summaryrefslogtreecommitdiffstats
path: root/sys/i4b/layer4
diff options
context:
space:
mode:
authorhm <hm@FreeBSD.org>1999-03-07 16:08:20 +0000
committerhm <hm@FreeBSD.org>1999-03-07 16:08:20 +0000
commit7e46cf5dd7cad6e069e50c85ee9a31ca260848fb (patch)
tree03a43e3e3e7f8598823a4548c687c6e4558751c8 /sys/i4b/layer4
parente2549f2539bc2e4543d92ba29f33e4313595b4d4 (diff)
downloadFreeBSD-src-7e46cf5dd7cad6e069e50c85ee9a31ca260848fb.zip
FreeBSD-src-7e46cf5dd7cad6e069e50c85ee9a31ca260848fb.tar.gz
update the i4b kernel part to i4b release 0.71.00
Diffstat (limited to 'sys/i4b/layer4')
-rw-r--r--sys/i4b/layer4/i4b_i4bdrv.c145
-rw-r--r--sys/i4b/layer4/i4b_l4.c332
-rw-r--r--sys/i4b/layer4/i4b_l4.h6
-rw-r--r--sys/i4b/layer4/i4b_l4mgmt.c6
-rw-r--r--sys/i4b/layer4/i4b_l4timer.c6
5 files changed, 361 insertions, 134 deletions
diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c
index e48d993..fbbc2dc 100644
--- a/sys/i4b/layer4/i4b_i4bdrv.c
+++ b/sys/i4b/layer4/i4b_i4bdrv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_i4bdrv.c - i4b userland interface driver
* --------------------------------------------
*
- * $Id: i4b_i4bdrv.c,v 1.1 1998/12/27 21:46:52 phk Exp $
+ * $Id: i4b_i4bdrv.c,v 1.37 1999/02/15 09:55:47 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:02 1998]
+ * last edit-date: [Mon Feb 15 10:36:25 1999]
*
*---------------------------------------------------------------------------*/
@@ -86,7 +86,7 @@
#include <i4b/layer4/i4b_l4.h>
-#if defined(__FreeBSD__) && (!defined(__FreeBSD_version) || __FreeBSD_version < 300001)
+#if (defined(__FreeBSD__) && (!defined(__FreeBSD_version) || __FreeBSD_version < 300001)) || defined(__bsdi__)
/* do nothing */
#else
#include <sys/poll.h>
@@ -108,10 +108,14 @@ PDEVSTATIC void i4battach __P((void));
PDEVSTATIC int i4bopen __P((dev_t dev, int flag, int fmt, struct proc *p));
PDEVSTATIC int i4bclose __P((dev_t dev, int flag, int fmt, struct proc *p));
PDEVSTATIC int i4bread __P((dev_t dev, struct uio *uio, int ioflag));
+#ifdef __bsdi__
+PDEVSTATIC int i4bioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p));
+#else
PDEVSTATIC int i4bioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct proc *p));
+#endif
PDEVSTATIC int i4bpoll __P((dev_t dev, int events, struct proc *p));
-#if defined (__OpenBSD__)
+#if defined (__OpenBSD__) || defined(__bsdi__)
PDEVSTATIC int i4bselect(dev_t dev, int rw, struct proc *p);
#endif
@@ -145,6 +149,36 @@ PSEUDO_SET(i4battach, i4b_i4bdrv);
#endif /* __FreeBSD__ */
+#ifdef __bsdi__
+#include <sys/device.h>
+int i4bmatch(struct device *parent, struct cfdata *cf, void *aux);
+void dummy_i4battach(struct device*, struct device *, void *);
+
+#define CDEV_MAJOR 65
+
+static struct cfdriver i4bcd =
+ { NULL, "i4b", i4bmatch, dummy_i4battach, DV_DULL,
+ sizeof(struct cfdriver) };
+struct devsw i4bsw =
+ { &i4bcd,
+ i4bopen, i4bclose, i4bread, nowrite,
+ i4bioctl, i4bselect, nommap, nostrat,
+ nodump, nopsize, 0, nostop
+};
+
+int
+i4bmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ printf("i4bmatch: aux=0x%x\n", aux);
+ return 1;
+}
+void
+dummy_i4battach(struct device *parent, struct device *self, void *aux)
+{
+ printf("dummy_i4battach: aux=0x%x\n", aux);
+}
+#endif /* __bsdi__ */
+
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -246,6 +280,8 @@ i4bread(dev_t dev, struct uio *uio, int ioflag)
PDEVSTATIC int
#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#elif defined(__bsdi__)
+i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
#else
i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
#endif
@@ -289,9 +325,10 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
cd->driver_unit = mcr->driver_unit;
cd->cr = get_rand_cr(ctrl_desc[cd->controller].unit);
- cd->unitlen_time = mcr->unitlen_time;
- cd->idle_time = mcr->idle_time;
- cd->earlyhup_time = mcr->earlyhup_time;
+ cd->shorthold_data.shorthold_algorithm = mcr->shorthold_data.shorthold_algorithm;
+ cd->shorthold_data.unitlen_time = mcr->shorthold_data.unitlen_time;
+ cd->shorthold_data.idle_time = mcr->shorthold_data.idle_time;
+ cd->shorthold_data.earlyhup_time = mcr->shorthold_data.earlyhup_time;
cd->last_aocd_time = 0;
if(mcr->unitlen_method == ULEN_METHOD_DYNAMIC)
@@ -305,8 +342,9 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
cd->dir = DIR_OUTGOING;
- DBGL4(L4_TIMO, "i4bioctl", ("I4B_CONNECT_REQ times, unitlen=%ld idle=%ld earlyhup=%ld\n",
- (long)cd->unitlen_time, (long)cd->idle_time, (long)cd->earlyhup_time));
+ DBGL4(L4_TIMO, "i4bioctl", ("I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld\n",
+ (long)cd->shorthold_data.shorthold_algorithm, (long)cd->shorthold_data.unitlen_time,
+ (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time));
strcpy(cd->dst_telno, mcr->dst_telno);
strcpy(cd->src_telno, mcr->src_telno);
@@ -376,9 +414,10 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
cd->driver_unit = mcrsp->driver_unit;
cd->max_idle_time = mcrsp->max_idle_time;
- cd->unitlen_time = 0; /* this is incoming */
- cd->idle_time = 0;
- cd->earlyhup_time = 0;
+ cd->shorthold_data.shorthold_algorithm = msg_alg__fix_unit_size;
+ cd->shorthold_data.unitlen_time = 0; /* this is incoming */
+ cd->shorthold_data.idle_time = 0;
+ cd->shorthold_data.earlyhup_time = 0;
cd->isdntxdelay = mcrsp->txdelay;
@@ -467,6 +506,9 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
mtu = (msg_timeout_upd_t *)data;
+ DBGL4(L4_TIMO, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!\n",
+ mtu->shorthold_data.shorthold_algorithm, mtu->shorthold_data.unitlen_time,
+ mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time ));
if((cd = cd_by_cdid(mtu->cdid)) == NULL)/* get cd */
{
DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, cdid not found!\n"));
@@ -474,10 +516,62 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
break;
}
+ switch( mtu->shorthold_data.shorthold_algorithm )
+ {
+
+ case msg_alg__fix_unit_size:
+ /*
+ * For this algorithm
+ * unitlen_time, idle_time and earlyhup_time
+ * are used.
+ */
+ if( mtu->shorthold_data.unitlen_time >= 0
+ && mtu->shorthold_data.idle_time > 0
+ && mtu->shorthold_data.earlyhup_time >= 0 )
+ {
+ break;
+ }
+
+ DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!\n"));
+ error = EINVAL;
+ break;
+
+ case msg_alg__var_unit_size:
+ /*
+ * For this algorithm
+ * unitlen_time and idle_time are used
+ * both must be positive integers
+ * earlyhup_time is not used and must be 0.
+ */
+ if( mtu->shorthold_data.unitlen_time > 0
+ && mtu->shorthold_data.idle_time > 0
+ && mtu->shorthold_data.earlyhup_time == 0 )
+ {
+ break;
+ }
+
+ DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!\n"));
+ error = EINVAL;
+ break;
+
+ default:
+ DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid algorithm!\n"));
+ error = EINVAL;
+ break;
+ }
+
+ /*
+ * any error set above requires us to break
+ * out of the outter switch
+ */
+ if( error != 0 )
+ break;
+
x = SPLI4B();
- cd->unitlen_time = mtu->unitlen_time;
- cd->idle_time = mtu->idle_time;
- cd->earlyhup_time = mtu->earlyhup_time;
+ cd->shorthold_data.shorthold_algorithm = mtu->shorthold_data.shorthold_algorithm;
+ cd->shorthold_data.unitlen_time = mtu->shorthold_data.unitlen_time;
+ cd->shorthold_data.idle_time = mtu->shorthold_data.idle_time;
+ cd->shorthold_data.earlyhup_time = mtu->shorthold_data.earlyhup_time;
splx(x);
break;
}
@@ -546,6 +640,12 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
(struct isdn_download_request*)data;
int i;
+ if (r->controller < 0 || r->controller >= nctrl)
+ {
+ error = ENODEV;
+ goto download_done;
+ }
+
if(!ctrl_desc[r->controller].N_DOWNLOAD)
{
error = ENODEV;
@@ -605,6 +705,11 @@ download_done:
(struct isdn_diagnostic_request*)data;
req.in_param = req.out_param = NULL;
+ if (r->controller < 0 || r->controller >= nctrl)
+ {
+ error = ENODEV;
+ goto diag_done;
+ }
if(!ctrl_desc[r->controller].N_DIAGNOSTICS)
{
@@ -623,7 +728,9 @@ download_done:
error = ENOMEM;
goto diag_done;
}
- copyin(r->in_param, req.in_param, req.in_param_len);
+ error = copyin(r->in_param, req.in_param, req.in_param_len);
+ if (error)
+ goto diag_done;
}
if(req.out_param_len)
@@ -640,7 +747,7 @@ download_done:
error = ctrl_desc[r->controller].N_DIAGNOSTICS(r->controller, &req);
if(!error && req.out_param_len)
- copyout(req.out_param, r->out_param, req.out_param_len);
+ error = copyout(req.out_param, r->out_param, req.out_param_len);
diag_done:
if(req.in_param)
@@ -664,7 +771,7 @@ diag_done:
#if (defined(__FreeBSD__) && \
(!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \
- || defined (__OpenBSD__)
+ || defined (__OpenBSD__) || defined(__bsdi__)
/*---------------------------------------------------------------------------*
* i4bselect - device driver select routine
diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c
index cecd5f4..1f87461 100644
--- a/sys/i4b/layer4/i4b_l4.c
+++ b/sys/i4b/layer4/i4b_l4.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,15 +27,20 @@
* i4b_l4.c - kernel interface to userland
* -----------------------------------------
*
- * $Id: i4b_l4.c,v 1.33 1998/12/05 18:05:49 hm Exp $
+ * $Id: i4b_l4.c,v 1.36 1999/02/15 09:55:48 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:16 1998]
+ * last edit-date: [Mon Feb 15 10:42:37 1999]
*
*---------------------------------------------------------------------------*/
#include "i4b.h"
#include "i4bipr.h"
+#ifdef __bsdi__
+#define NI4BISPPP 0
+#include "ibc.h"
+#else
#include "i4bisppp.h"
+#endif
#include "i4brbch.h"
#include "i4btel.h"
@@ -562,6 +567,12 @@ i4b_link_bchandrvr(call_desc_t *cd)
break;
#endif
+#if defined(__bsdi__) && NIBC > 0
+ case BDRV_IBC:
+ cd->dlt = ibc_ret_linktab(cd->driver_unit);
+ break;
+#endif
+
default:
cd->dlt = NULL;
break;
@@ -603,6 +614,12 @@ i4b_link_bchandrvr(call_desc_t *cd)
i4bisppp_set_linktab(cd->driver_unit, cd->ilt);
break;
#endif
+
+#if defined(__bsdi__) && NIBC > 0
+ case BDRV_IBC:
+ ibc_set_linktab(cd->driver_unit, cd->ilt);
+ break;
+#endif
default:
return(0);
break;
@@ -687,9 +704,15 @@ idletime_state: IST_NONCHK IST_CHECK IST_SAFE
/*---------------------------------------------------------------------------*
* B channel idle check timeout setup
*---------------------------------------------------------------------------*/
+static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd);
+static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd);
+
static void
i4b_l4_setup_timeout(call_desc_t *cd)
{
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: direction %d, shorthold algorithm %d\n",
+ (long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm ));
+
cd->timeout_active = 0;
cd->idletime_state = IST_IDLE;
@@ -704,58 +727,99 @@ i4b_l4_setup_timeout(call_desc_t *cd)
cd->timeout_active = 1;
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: incoming-call, setup max_idle_time to %ld\n", (long)SECOND, (long)cd->max_idle_time));
}
- else if((cd->dir == DIR_OUTGOING) && (cd->idle_time > 0))
+ else if((cd->dir == DIR_OUTGOING) && (cd->shorthold_data.idle_time > 0))
{
- /* outgoing call */
-
- if((cd->idle_time > 0) && (cd->unitlen_time == 0))
+ switch( cd->shorthold_data.shorthold_algorithm )
{
- /* outgoing call: simple max idletime check */
-
+ default: /* fall into the old fix algorithm */
+ case msg_alg__fix_unit_size:
+ i4b_l4_setup_timeout_fix_unit( cd );
+ break;
+ case msg_alg__var_unit_size:
+ i4b_l4_setup_timeout_var_unit( cd );
+ break;
+ }
+ }
+ else
+ {
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("no idle_timeout configured\n"));
+ }
+}
+
+static void
+i4b_l4_setup_timeout_fix_unit(call_desc_t *cd)
+{
+ /* outgoing call */
+
+ if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0))
+ {
+ /* outgoing call: simple max idletime check */
+
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
- cd->timeout_active = 1;
- DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n", (long)SECOND, (long)cd->idle_time));
- }
- else if((cd->unitlen_time > 0) && (cd->unitlen_time > (cd->idle_time + cd->earlyhup_time)))
- {
- /* outgoing call: full shorthold mode check */
-
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
+ cd->timeout_active = 1;
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n",
+ (long)SECOND, (long)cd->shorthold_data.idle_time));
+ }
+ else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)))
+ {
+ /* outgoing call: full shorthold mode check */
+
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->unitlen_time - (cd->idle_time + cd->earlyhup_time)));
- cd->timeout_active = 1;
- cd->idletime_state = IST_NONCHK;
- DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, start %ld sec nocheck window\n",
- (long)SECOND, (long)(cd->unitlen_time - (cd->idle_time + cd->earlyhup_time))));
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)));
+ cd->timeout_active = 1;
+ cd->idletime_state = IST_NONCHK;
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, start %ld sec nocheck window\n",
+ (long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))));
- if(cd->aocd_flag == 0)
- {
- cd->units_type = CHARGE_CALC;
- cd->cunits++;
- i4b_l4_charging_ind(cd);
- }
- }
- else
+ if(cd->aocd_flag == 0)
{
- /* parms somehow got wrong .. */
-
- DBGL4(L4_ERR, "i4b_l4_setup_timeout", ("%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!\n",
- (long)SECOND, (long)cd->idle_time, (long)cd->earlyhup_time, (long)cd->unitlen_time));
+ cd->units_type = CHARGE_CALC;
+ cd->cunits++;
+ i4b_l4_charging_ind(cd);
}
}
else
{
- DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("no idle_timeout configured\n"));
+ /* parms somehow got wrong .. */
+
+ DBGL4(L4_ERR, "i4b_l4_setup_timeout", ("%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!\n",
+ (long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time));
}
}
+static void
+i4b_l4_setup_timeout_var_unit(call_desc_t *cd)
+{
+ /* outgoing call: variable unit idletime check */
+
+ /*
+ * start checking for an idle connect one second before the end of the unit.
+ * The one second takes into account of rounding due to the driver only
+ * using the seconds and not the uSeconds of the current time
+ */
+ cd->idletime_state = IST_CHECK; /* move directly to the checking state */
+
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ cd->idle_timeout_handle =
+#endif
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz * (cd->shorthold_data.unitlen_time - 1) );
+ cd->timeout_active = 1;
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, var idle time - setup to %ld\n",
+ (long)SECOND, (long)cd->shorthold_data.unitlen_time));
+}
+
+
/*---------------------------------------------------------------------------*
* B channel idle check timeout function
*---------------------------------------------------------------------------*/
+static void i4b_idle_check_fix_unit(call_desc_t *cd);
+static void i4b_idle_check_var_unit(call_desc_t *cd);
+
void
i4b_idle_check(call_desc_t *cd)
{
@@ -803,95 +867,151 @@ i4b_idle_check(call_desc_t *cd)
else if(cd->dir == DIR_OUTGOING)
{
+ switch( cd->shorthold_data.shorthold_algorithm )
+ {
+ case msg_alg__fix_unit_size:
+ i4b_idle_check_fix_unit( cd );
+ break;
+ case msg_alg__var_unit_size:
+ i4b_idle_check_var_unit( cd );
+ break;
+ default:
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: bad value for shorthold_algorithm of %d\n",
+ (long)SECOND, cd->shorthold_data.shorthold_algorithm ));
+ i4b_idle_check_fix_unit( cd );
+ break;
+ }
+ }
+ splx(s);
+}
- /* simple idletime calculation */
+static void
+i4b_idle_check_fix_unit(call_desc_t *cd)
+{
+
+ /* simple idletime calculation */
- if((cd->idle_time > 0) && (cd->unitlen_time == 0))
+ if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0))
+ {
+ if((cd->last_active_time + cd->shorthold_data.idle_time) <= SECOND)
{
- if((cd->last_active_time + cd->idle_time) <= SECOND)
- {
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)SECOND));
- (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid,
- (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
- i4b_l4_idle_timeout_ind(cd);
- }
- else
- {
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld\n",
- (long)SECOND, (long)cd->last_active_time, (long)cd->idle_time));
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)SECOND));
+ (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
+ i4b_l4_idle_timeout_ind(cd);
+ }
+ else
+ {
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld\n",
+ (long)SECOND, (long)cd->last_active_time, (long)cd->shorthold_data.idle_time));
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
- cd->timeout_active = 1;
- }
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
+ cd->timeout_active = 1;
}
+ }
- /* full shorthold mode calculation */
+ /* full shorthold mode calculation */
- else if((cd->unitlen_time > 0) && (cd->unitlen_time > (cd->idle_time + cd->earlyhup_time)))
+ else if((cd->shorthold_data.unitlen_time > 0)
+ && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)))
+ {
+ switch(cd->idletime_state)
{
- switch(cd->idletime_state)
- {
- case IST_NONCHK: /* end of non-check time */
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
-#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->idle_time));
- cd->idletimechk_start = SECOND;
- cd->idletime_state = IST_CHECK;
- cd->timeout_active = 1;
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)SECOND));
- break;
- case IST_CHECK: /* end of idletime chk */
- if((cd->last_active_time > cd->idletimechk_start) &&
- (cd->last_active_time <= SECOND))
- { /* activity detected */
+ case IST_NONCHK: /* end of non-check time */
+
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->earlyhup_time));
- cd->timeout_active = 1;
- cd->idletime_state = IST_SAFE;
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)SECOND, (long)cd->last_active_time));
- }
- else
- { /* no activity, hangup */
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
- (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid,
- (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
- i4b_l4_idle_timeout_ind(cd);
- cd->idletime_state = IST_IDLE;
- }
- break;
-
- case IST_SAFE: /* end of earlyhup time */
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.idle_time));
+ cd->idletimechk_start = SECOND;
+ cd->idletime_state = IST_CHECK;
+ cd->timeout_active = 1;
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)SECOND));
+ break;
+
+ case IST_CHECK: /* end of idletime chk */
+ if((cd->last_active_time > cd->idletimechk_start) &&
+ (cd->last_active_time <= SECOND))
+ { /* activity detected */
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->unitlen_time - (cd->idle_time+cd->earlyhup_time)));
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.earlyhup_time));
cd->timeout_active = 1;
- cd->idletime_state = IST_NONCHK;
-
- if(cd->aocd_flag == 0)
- {
- cd->units_type = CHARGE_CALC;
- cd->cunits++;
- i4b_l4_charging_ind(cd);
- }
-
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)SECOND));
- break;
-
- default:
- DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: invalid idletime_state value!\n"));
+ cd->idletime_state = IST_SAFE;
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)SECOND, (long)cd->last_active_time));
+ }
+ else
+ { /* no activity, hangup */
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
+ (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
+ i4b_l4_idle_timeout_ind(cd);
cd->idletime_state = IST_IDLE;
- break;
}
+ break;
+
+ case IST_SAFE: /* end of earlyhup time */
+
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ cd->idle_timeout_handle =
+#endif
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time)));
+ cd->timeout_active = 1;
+ cd->idletime_state = IST_NONCHK;
+
+ if(cd->aocd_flag == 0)
+ {
+ cd->units_type = CHARGE_CALC;
+ cd->cunits++;
+ i4b_l4_charging_ind(cd);
+ }
+
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)SECOND));
+ break;
+
+ default:
+ DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: invalid idletime_state value!\n"));
+ cd->idletime_state = IST_IDLE;
+ break;
}
}
- splx(s);
+}
+
+static void
+i4b_idle_check_var_unit(call_desc_t *cd)
+{
+ switch(cd->idletime_state)
+ {
+
+ /* see if there has been any activity within the last idle_time seconds */
+ case IST_CHECK:
+ if( cd->last_active_time > (SECOND - cd->shorthold_data.idle_time))
+ { /* activity detected */
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ cd->idle_timeout_handle =
+#endif
+ /* check again in one second */
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz );
+ cd->timeout_active = 1;
+ cd->idletime_state = IST_CHECK;
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, var idle timeout - activity at %ld, continuing\n", (long)SECOND, (long)cd->last_active_time));
+ }
+ else
+ { /* no activity, hangup */
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, var idle timeout - last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
+ (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
+ i4b_l4_idle_timeout_ind(cd);
+ cd->idletime_state = IST_IDLE;
+ }
+ break;
+
+ default:
+ DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: var idle timeout invalid idletime_state value!\n"));
+ cd->idletime_state = IST_IDLE;
+ break;
+ }
}
#endif /* NI4B > 0 */
diff --git a/sys/i4b/layer4/i4b_l4.h b/sys/i4b/layer4/i4b_l4.h
index e4ed863f..d88e64c 100644
--- a/sys/i4b/layer4/i4b_l4.h
+++ b/sys/i4b/layer4/i4b_l4.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4.h - kernel interface to userland header file
* ---------------------------------------------------
*
- * $Id: i4b_l4.h,v 1.13 1998/12/05 18:05:50 hm Exp $
+ * $Id: i4b_l4.h,v 1.14 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:34 1998]
+ * last edit-date: [Sun Feb 14 10:35:08 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer4/i4b_l4mgmt.c b/sys/i4b/layer4/i4b_l4mgmt.c
index e8e1a96..6090f29 100644
--- a/sys/i4b/layer4/i4b_l4mgmt.c
+++ b/sys/i4b/layer4/i4b_l4mgmt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4mgmt.c - layer 4 calldescriptor management utilites
* -----------------------------------------------------------
*
- * $Id: i4b_l4mgmt.c,v 1.23 1998/12/05 18:05:52 hm Exp $
+ * $Id: i4b_l4mgmt.c,v 1.24 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:50 1998]
+ * last edit-date: [Sun Feb 14 10:35:13 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer4/i4b_l4timer.c b/sys/i4b/layer4/i4b_l4timer.c
index 7a38e13..ddc0256 100644
--- a/sys/i4b/layer4/i4b_l4timer.c
+++ b/sys/i4b/layer4/i4b_l4timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4timer.c - timer and timeout handling for layer 4
* --------------------------------------------------------
*
- * $Id: i4b_l4timer.c,v 1.10 1998/12/05 18:05:53 hm Exp $
+ * $Id: i4b_l4timer.c,v 1.11 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:36:07 1998]
+ * last edit-date: [Sun Feb 14 10:35:20 1999]
*
*---------------------------------------------------------------------------*/
OpenPOWER on IntegriCloud