Remove the hard coded layer 4 driver coding from the accounting data
and functions, use the call ID instead.
This commit is contained in:
parent
ed84d53b75
commit
14a03255ac
|
@ -27,7 +27,7 @@
|
|||
* i4b_i4bdrv.c - i4b userland interface driver
|
||||
* --------------------------------------------
|
||||
*
|
||||
* $Id: i4b_i4bdrv.c,v 1.10 2002/03/17 09:46:00 martin Exp $
|
||||
* $Id: i4b_i4bdrv.c,v 1.11 2002/03/17 11:08:31 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_i4bdrv.c,v 1.10 2002/03/17 09:46:00 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_i4bdrv.c,v 1.11 2002/03/17 11:08:31 martin Exp $");
|
||||
|
||||
#include "isdn.h"
|
||||
#include "irip.h"
|
||||
|
@ -382,8 +382,8 @@ isdnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
|
||||
cd->bri = mcr->controller; /* fill cd */
|
||||
cd->bprot = mcr->bprot;
|
||||
cd->driver = mcr->driver;
|
||||
cd->driver_unit = mcr->driver_unit;
|
||||
cd->bchan_driver_index = mcr->driver;
|
||||
cd->bchan_driver_unit = mcr->driver_unit;
|
||||
cd->cr = get_rand_cr(cd->bri);
|
||||
|
||||
cd->shorthold_data.shorthold_algorithm = mcr->shorthold_data.shorthold_algorithm;
|
||||
|
@ -466,8 +466,8 @@ isdnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
|
||||
T400_stop(cd);
|
||||
|
||||
cd->driver = mcrsp->driver;
|
||||
cd->driver_unit = mcrsp->driver_unit;
|
||||
cd->bchan_driver_index = mcrsp->driver;
|
||||
cd->bchan_driver_unit = mcrsp->driver_unit;
|
||||
cd->max_idle_time = mcrsp->max_idle_time;
|
||||
|
||||
cd->shorthold_data.shorthold_algorithm = SHA_FIXU;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_ioctl.h - messages kernel <--> userland
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ioctl.h,v 1.2 2001/08/05 11:16:56 jdolecek Exp $
|
||||
* $Id: i4b_ioctl.h,v 1.3 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -414,8 +414,6 @@ typedef struct {
|
|||
int accttype; /* accounting type */
|
||||
#define ACCT_DURING 0
|
||||
#define ACCT_FINAL 1
|
||||
int driver; /* driver type */
|
||||
int driver_unit; /* driver unit number */
|
||||
int ioutbytes; /* ISDN # of bytes sent */
|
||||
int iinbytes; /* ISDN # of bytes received */
|
||||
int outbps; /* bytes per sec out */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_ipr.c - isdn4bsd IP over raw HDLC ISDN network driver
|
||||
* ---------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ipr.c,v 1.9 2002/03/17 09:46:00 martin Exp $
|
||||
* $Id: i4b_ipr.c,v 1.10 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -59,7 +59,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_ipr.c,v 1.9 2002/03/17 09:46:00 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_ipr.c,v 1.10 2002/03/17 11:08:32 martin Exp $");
|
||||
|
||||
#include "irip.h"
|
||||
|
||||
|
@ -725,8 +725,9 @@ iprwatchdog(struct ifnet *ifp)
|
|||
sc->sc_linb = sc->sc_iinb;
|
||||
sc->sc_loutb = sc->sc_ioutb;
|
||||
|
||||
i4b_l4_accounting(BDRV_IPR, unit, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
|
||||
if (sc->sc_cdp)
|
||||
i4b_l4_accounting(sc->sc_cdp->cdid, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
|
||||
}
|
||||
sc->sc_if.if_timer = I4BIPRACCTINTVL;
|
||||
#ifdef __bsdi__
|
||||
|
@ -853,10 +854,10 @@ ipr_disconnect(void *softc, void *cdp)
|
|||
sc->sc_log_first = IPR_LOG;
|
||||
#endif
|
||||
|
||||
i4b_l4_accounting(BDRV_IPR, cd->driver_unit, ACCT_FINAL,
|
||||
i4b_l4_accounting(cd->cdid, ACCT_FINAL,
|
||||
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
|
||||
|
||||
sc->sc_cdp = (call_desc_t *)0;
|
||||
sc->sc_cdp = NULL;
|
||||
|
||||
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* the "cx" driver for Cronyx's HDLC-in-hardware device). This driver
|
||||
* is only the glue between sppp and i4b.
|
||||
*
|
||||
* $Id: i4b_isppp.c,v 1.13 2002/03/17 09:46:00 martin Exp $
|
||||
* $Id: i4b_isppp.c,v 1.14 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -43,7 +43,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_isppp.c,v 1.13 2002/03/17 09:46:00 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_isppp.c,v 1.14 2002/03/17 11:08:32 martin Exp $");
|
||||
|
||||
#ifndef __NetBSD__
|
||||
#define USE_ISPPP
|
||||
|
@ -452,8 +452,9 @@ i4bisppp_watchdog(struct ifnet *ifp)
|
|||
sc->sc_linb = sc->sc_iinb;
|
||||
sc->sc_loutb = sc->sc_ioutb;
|
||||
|
||||
i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
|
||||
if (sc->sc_cdp)
|
||||
i4b_l4_accounting(sc->sc_cdp->cdid, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
|
||||
}
|
||||
sc->sc_sp.pp_if.if_timer = I4BISPPPACCTINTVL;
|
||||
|
||||
|
@ -588,7 +589,7 @@ i4bisppp_disconnect(void *softc, void *cdp)
|
|||
sc->sc_sp.pp_if.if_timer = 0;
|
||||
#endif
|
||||
|
||||
i4b_l4_accounting(BDRV_ISPPP, sc->sc_unit, ACCT_FINAL,
|
||||
i4b_l4_accounting(cd->cdid, ACCT_FINAL,
|
||||
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
|
||||
|
||||
if (sc->sc_state == ST_CONNECTED)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l3l4.h - layer 3 / layer 4 interface
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l3l4.h,v 1.3 2002/03/17 09:46:01 martin Exp $
|
||||
* $Id: i4b_l3l4.h,v 1.4 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -149,8 +149,8 @@ typedef struct
|
|||
|
||||
int bprot; /* B channel protocol BPROT_XXX */
|
||||
|
||||
int driver; /* driver to use for B channel */
|
||||
int driver_unit; /* unit for above driver number */
|
||||
int bchan_driver_index; /* driver to use for B channel */
|
||||
int bchan_driver_unit; /* unit for above driver number */
|
||||
|
||||
cause_t cause_in; /* cause value from NT */
|
||||
cause_t cause_out; /* cause value to NT */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l4.c - kernel interface to userland
|
||||
* -----------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4.c,v 1.9 2002/03/17 09:46:01 martin Exp $
|
||||
* $Id: i4b_l4.c,v 1.10 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.9 2002/03/17 09:46:01 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.10 2002/03/17 11:08:32 martin Exp $");
|
||||
|
||||
#include "isdn.h"
|
||||
#include "irip.h"
|
||||
|
@ -313,7 +313,7 @@ i4b_l4_drvrdisc(int driver, int driver_unit)
|
|||
* send MSG_ACCT_IND message to userland
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
i4b_l4_accounting(int driver, int driver_unit, int accttype, int ioutbytes,
|
||||
i4b_l4_accounting(int cdid, int accttype, int ioutbytes,
|
||||
int iinbytes, int ro, int ri, int outbytes, int inbytes)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
@ -323,10 +323,7 @@ i4b_l4_accounting(int driver, int driver_unit, int accttype, int ioutbytes,
|
|||
msg_accounting_ind_t *md = (msg_accounting_ind_t *)m->m_data;
|
||||
|
||||
md->header.type = MSG_ACCT_IND;
|
||||
md->header.cdid = -1;
|
||||
|
||||
md->driver = driver;
|
||||
md->driver_unit = driver_unit;
|
||||
md->header.cdid = cdid;
|
||||
|
||||
md->accttype = accttype;
|
||||
md->ioutbytes = ioutbytes;
|
||||
|
@ -604,41 +601,41 @@ i4b_link_bchandrvr(call_desc_t *cd)
|
|||
cd->channelid);
|
||||
}
|
||||
|
||||
switch(cd->driver)
|
||||
switch(cd->bchan_driver_index)
|
||||
{
|
||||
#if NISDNBCHAN > 0
|
||||
case BDRV_RBCH:
|
||||
cd->dlt = rbch_ret_linktab(cd->driver_unit);
|
||||
cd->dlt = rbch_ret_linktab(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NISDNTEL > 0
|
||||
case BDRV_TEL:
|
||||
cd->dlt = tel_ret_linktab(cd->driver_unit);
|
||||
cd->dlt = tel_ret_linktab(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NIRIP > 0
|
||||
case BDRV_IPR:
|
||||
cd->dlt = ipr_ret_linktab(cd->driver_unit);
|
||||
cd->dlt = ipr_ret_linktab(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NIPPP > 0
|
||||
case BDRV_ISPPP:
|
||||
cd->dlt = i4bisppp_ret_linktab(cd->driver_unit);
|
||||
cd->dlt = i4bisppp_ret_linktab(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(__bsdi__) && NIBC > 0
|
||||
case BDRV_IBC:
|
||||
cd->dlt = ibc_ret_linktab(cd->driver_unit);
|
||||
cd->dlt = ibc_ret_linktab(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NI4BING > 0
|
||||
case BDRV_ING:
|
||||
cd->dlt = ing_ret_linktab(cd->driver_unit);
|
||||
cd->dlt = ing_ret_linktab(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -658,41 +655,41 @@ i4b_link_bchandrvr(call_desc_t *cd)
|
|||
cd->dlt);
|
||||
}
|
||||
|
||||
switch(cd->driver)
|
||||
switch(cd->bchan_driver_index)
|
||||
{
|
||||
#if NISDNBCHAN > 0
|
||||
case BDRV_RBCH:
|
||||
rbch_set_linktab(cd->driver_unit, cd->ilt);
|
||||
rbch_set_linktab(cd->bchan_driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NISDNTEL > 0
|
||||
case BDRV_TEL:
|
||||
tel_set_linktab(cd->driver_unit, cd->ilt);
|
||||
tel_set_linktab(cd->bchan_driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NIRIP > 0
|
||||
case BDRV_IPR:
|
||||
ipr_set_linktab(cd->driver_unit, cd->ilt);
|
||||
ipr_set_linktab(cd->bchan_driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NIPPP > 0
|
||||
case BDRV_ISPPP:
|
||||
i4bisppp_set_linktab(cd->driver_unit, cd->ilt);
|
||||
i4bisppp_set_linktab(cd->bchan_driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(__bsdi__) && NIBC > 0
|
||||
case BDRV_IBC:
|
||||
ibc_set_linktab(cd->driver_unit, cd->ilt);
|
||||
ibc_set_linktab(cd->bchan_driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NI4BING > 0
|
||||
case BDRV_ING:
|
||||
ing_set_linktab(cd->driver_unit, cd->ilt);
|
||||
ing_set_linktab(cd->bchan_driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -778,10 +775,10 @@ idletime_state: IST_NONCHK IST_CHECK IST_SAFE
|
|||
static time_t
|
||||
i4b_get_idletime(call_desc_t *cd)
|
||||
{
|
||||
switch (cd->driver) {
|
||||
switch (cd->bchan_driver_index) {
|
||||
#if NIPPP > 0
|
||||
case BDRV_ISPPP:
|
||||
return i4bisppp_idletime(cd->driver_unit);
|
||||
return i4bisppp_idletime(cd->bchan_driver_unit);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l4.h - kernel interface to userland header file
|
||||
* ---------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4.h,v 1.1.1.1 2001/01/05 12:49:56 martin Exp $
|
||||
* $Id: i4b_l4.h,v 1.2 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
extern void i4bputqueue ( struct mbuf *m );
|
||||
extern void i4bputqueue_hipri(struct mbuf *m);
|
||||
extern void i4b_l4_accounting(int, int, int, int, int, int, int, int, int);
|
||||
extern void i4b_l4_accounting(int, int, int, int, int, int, int, int);
|
||||
extern void i4b_l4_alert_ind ( call_desc_t *cd );
|
||||
extern void i4b_l4_charging_ind( call_desc_t *cd );
|
||||
extern void i4b_l4_connect_active_ind ( call_desc_t *cd );
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_rbch.c - device driver for raw B channel data
|
||||
* ---------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_rbch.c,v 1.6 2002/03/17 09:46:01 martin Exp $
|
||||
* $Id: i4b_rbch.c,v 1.7 2002/03/17 11:08:32 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_rbch.c,v 1.6 2002/03/17 09:46:01 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_rbch.c,v 1.7 2002/03/17 11:08:32 martin Exp $");
|
||||
|
||||
#include "isdnbchan.h"
|
||||
|
||||
|
@ -852,8 +852,9 @@ rbch_timeout(struct rbch_softc *sc)
|
|||
sc->sc_linb = sc->sc_iinb;
|
||||
sc->sc_loutb = sc->sc_ioutb;
|
||||
|
||||
i4b_l4_accounting(BDRV_RBCH, unit, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb);
|
||||
if (sc->sc_cd)
|
||||
i4b_l4_accounting(sc->sc_cd->cdid, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb);
|
||||
}
|
||||
START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz);
|
||||
}
|
||||
|
@ -920,14 +921,16 @@ rbch_disconnect(void *softc, void *cdp)
|
|||
|
||||
sc->sc_devstate &= ~ST_CONNECTED;
|
||||
|
||||
sc->sc_cd = NULL;
|
||||
|
||||
#if I4BRBCHACCT
|
||||
i4b_l4_accounting(BDRV_RBCH, sc->sc_unit, ACCT_FINAL,
|
||||
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb);
|
||||
if (sc->sc_cd)
|
||||
i4b_l4_accounting(sc->sc_cd->cdid, ACCT_FINAL,
|
||||
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb);
|
||||
|
||||
STOP_TIMER(sc->sc_callout, rbch_timeout, sc);
|
||||
#endif
|
||||
|
||||
sc->sc_cd = NULL;
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue