patch-2.2.19 linux/drivers/isdn/hisax/callc.c

Next file: linux/drivers/isdn/hisax/cert.c
Previous file: linux/drivers/isdn/hisax/bkm_ax.h
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/drivers/isdn/hisax/callc.c linux/drivers/isdn/hisax/callc.c
@@ -1,5 +1,5 @@
-/* $Id: callc.c,v 2.40 1999/12/19 12:59:56 keil Exp $
-
+/* $Id: callc.c,v 2.51 2000/11/24 17:05:37 kai Exp $
+ *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
  *
@@ -10,156 +10,9 @@
  * Thanks to    Jan den Ouden
  *              Fritz Elfert
  *
- * $Log: callc.c,v $
- * Revision 2.40  1999/12/19 12:59:56  keil
- * fix leased line handling
- * and cosmetics
- *
- * Revision 2.39  1999/10/14 20:25:28  keil
- * add a statistic for error monitoring
- *
- * Revision 2.38  1999/10/11 22:16:27  keil
- * Suspend/Resume is possible without explicit ID too
- *
- * Revision 2.37  1999/09/20 19:49:47  keil
- * Fix wrong init of PStack
- *
- * Revision 2.36  1999/09/20 12:13:13  keil
- * Fix hang if no protocol was selected
- *
- * Revision 2.35  1999/09/04 06:20:05  keil
- * Changes from kernel set_current_state()
- *
- * Revision 2.34  1999/08/25 20:02:34  werner
- * Changed return values for stat_icall(w) from 3->4 and 4->5 because of conflicts
- * with existing software definitions. (PtP incomplete called party number)
- *
- * Revision 2.33  1999/08/25 17:00:09  keil
- * Make ISAR V32bis modem running
- * Make LL->HL interface open for additional commands
- *
- * Revision 2.32  1999/08/22 20:27:01  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 2.31  1999/08/05 20:43:10  keil
- * ISAR analog modem support
- *
- * Revision 2.30  1999/07/25 16:24:04  keil
- * Fixed TEI now working again
- *
- * Revision 2.29  1999/07/13 21:05:41  werner
- * Modified set_channel_limit to use new callback ISDN_STAT_DISCH.
- *
- * Revision 2.28  1999/07/09 08:30:02  keil
- * cosmetics
- *
- * Revision 2.27  1999/07/05 23:51:38  werner
- * Allow limiting of available HiSax B-chans per card. Controlled by hisaxctrl
- * hisaxctrl id 10 <nr. of chans 0-2>
- *
- * Revision 2.26  1999/07/01 08:11:21  keil
- * Common HiSax version for 2.0, 2.1, 2.2 and 2.3 kernel
- *
- * Revision 2.25  1999/01/02 11:17:20  keil
- * Changes for 2.2
- *
- * Revision 2.24  1998/11/15 23:54:24  keil
- * changes from 2.0
- *
- * Revision 2.23  1998/09/30 22:21:57  keil
- * cosmetics
- *
- * Revision 2.22  1998/08/20 13:50:29  keil
- * More support for hybrid modem (not working yet)
- *
- * Revision 2.21  1998/08/13 23:36:15  keil
- * HiSax 3.1 - don't work stable with current LinkLevel
- *
- * Revision 2.20  1998/06/26 15:13:05  fritz
- * Added handling of STAT_ICALL with incomplete CPN.
- * Added AT&L for ttyI emulator.
- * Added more locking stuff in tty_write.
- *
- * Revision 2.19  1998/05/25 14:08:06  keil
- * HiSax 3.0
- * fixed X.75 and leased line to work again
- * Point2Point and fixed TEI are runtime options now:
- *    hisaxctrl <id> 7 1  set PTP
- *    hisaxctrl <id> 8 <TEIVALUE *2 >
- *    set fixed TEI to TEIVALUE (0-63)
- *
- * Revision 2.18  1998/05/25 12:57:40  keil
- * HiSax golden code from certification, Don't use !!!
- * No leased lines, no X75, but many changes.
- *
- * Revision 2.17  1998/04/15 16:46:06  keil
- * RESUME support
- *
- * Revision 2.16  1998/04/10 10:35:17  paul
- * fixed (silly?) warnings from egcs on Alpha.
- *
- * Revision 2.15  1998/03/19 13:18:37  keil
- * Start of a CAPI like interface for supplementary Service
- * first service: SUSPEND
- *
- * Revision 2.14  1998/03/07 22:56:54  tsbogend
- * made HiSax working on Linux/Alpha
- *
- * Revision 2.13  1998/02/12 23:07:16  keil
- * change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
- *
- * Revision 2.12  1998/02/09 10:55:54  keil
- * New leased line mode
- *
- * Revision 2.11  1998/02/02 13:35:19  keil
- * config B-channel delay
- *
- * Revision 2.10  1997/11/06 17:09:15  keil
- * New 2.1 init code
- *
- * Revision 2.9  1997/10/29 19:01:58  keil
- * new LL interface
- *
- * Revision 2.8  1997/10/10 20:56:44  fritz
- * New HL interface.
- *
- * Revision 2.7  1997/10/01 09:21:28  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 2.6  1997/09/11 17:26:58  keil
- * Open B-channel if here are incomming packets
- *
- * Revision 2.5  1997/08/07 17:46:05  keil
- * Fix Incomming Call without broadcast
- *
- * Revision 2.4  1997/08/03 14:37:58  keil
- * Activate Layer2 in PtP mode
- *
- * Revision 2.3  1997/07/31 19:23:40  keil
- * LAYER2_WATCHING for PtP
- *
- * Revision 2.2  1997/07/31 11:48:18  keil
- * experimental REJECT after ALERTING
- *
- * Revision 2.1  1997/07/30 17:12:59  keil
- * more changes for 'One TEI per card'
- *
- * Revision 2.0  1997/07/27 21:12:21  keil
- * CRef based L3; new channel handling; many other stuff
- *
- * Revision 1.31  1997/06/26 11:09:23  keil
- * New managment and minor changes
- *
- * old logs removed /KKe
- *
  */
-
 #define __NO_VERSION__
+#include <linux/init.h>
 #include "hisax.h"
 #include "../avmb1/capicmd.h"  /* this should be moved in a common place */
 
@@ -167,7 +20,7 @@
 #define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module))
 #endif	/* MODULE */
 
-const char *lli_revision = "$Revision: 2.40 $";
+const char *lli_revision = "$Revision: 2.51 $";
 
 extern struct IsdnCard cards[];
 extern int nrcards;
@@ -177,10 +30,8 @@
 static int init_b_st(struct Channel *chanp, int incoming);
 static void release_b_st(struct Channel *chanp);
 
-static struct Fsm callcfsm =
-{NULL, 0, 0, NULL, NULL};
-
-static int chancount = 0;
+static struct Fsm callcfsm;
+static int chancount;
 
 /* experimental REJECT after ALERTING for CALLBACK to beat the 4s delay */
 #define ALERT_REJECT 0
@@ -349,6 +200,8 @@
 {
 	isdn_ctrl ic;
 
+	if (!chanp->proc)
+		return;
 	if (chanp->proc->para.cause == NO_CAUSE)
 		return;
 	ic.driver = chanp->cs->myid;
@@ -511,7 +364,7 @@
 		 * No need to return "unknown" for calls without OAD,
 		 * cause that's handled in linklevel now (replaced by '0')
 		 */
-		ic.parm.setup = chanp->proc->para.setup;
+		memcpy(&ic.parm.setup, &chanp->proc->para.setup, sizeof(setup_parm));
 		ret = chanp->cs->iif.statcallb(&ic);
 		if (chanp->debug & 1)
 			link_debug(chanp, 1, "statcallb ret=%d", ret);
@@ -528,12 +381,16 @@
 				FsmChangeState(fi, ST_IN_PROCEED_SEND);
 				chanp->d_st->lli.l4l3(chanp->d_st, CC_PROCEED_SEND | REQUEST, chanp->proc);
 				if (ret == 5) {
-					chanp->setup = ic.parm.setup;
+					memcpy(&chanp->setup, &ic.parm.setup, sizeof(setup_parm));
 					chanp->d_st->lli.l4l3(chanp->d_st, CC_REDIR | REQUEST, chanp->proc);
 				}
 				break;
 			case 2:	/* Rejecting Call */
 				break;
+			case 3:	/* incomplete number */
+				FsmDelTimer(&chanp->drel_timer, 61);
+				chanp->d_st->lli.l4l3(chanp->d_st, CC_MORE_INFO | REQUEST, chanp->proc);
+				break;
 			case 0:	/* OK, nobody likes this call */
 			default:	/* statcallb problems */
 				chanp->d_st->lli.l4l3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc);
@@ -641,7 +498,8 @@
 		lli_leased_hup(fi, chanp);
 	} else {
 		FsmChangeState(fi, ST_WAIT_DRELEASE);
-		chanp->proc->para.cause = 0x10;	/* Normal Call Clearing */
+		if (chanp->proc)
+			chanp->proc->para.cause = 0x10;	/* Normal Call Clearing */
 		chanp->d_st->lli.l4l3(chanp->d_st, CC_DISCONNECT | REQUEST,
 			chanp->proc);
 	}
@@ -656,7 +514,8 @@
 		lli_leased_hup(fi, chanp);
 	} else {
 		FsmChangeState(fi, ST_WAIT_DRELEASE);
-		chanp->proc->para.cause = 0x15;	/* Call Rejected */
+		if (chanp->proc)
+			chanp->proc->para.cause = 0x15;	/* Call Rejected */
 		chanp->d_st->lli.l4l3(chanp->d_st, CC_DISCONNECT | REQUEST,
 			chanp->proc);
 	}
@@ -688,7 +547,8 @@
 		return;
 	}
 #ifndef ALERT_REJECT
-	chanp->proc->para.cause = 0x15;	/* Call Rejected */
+	if (chanp->proc)
+		chanp->proc->para.cause = 0x15;	/* Call Rejected */
 	chanp->d_st->lli.l4l3(chanp->d_st, CC_REJECT | REQUEST, chanp->proc);
 	lli_dhup_close(fi, event, arg);
 #else
@@ -920,7 +780,7 @@
 }
 
 /* *INDENT-OFF* */
-static struct FsmNode fnlist[] HISAX_INITDATA =
+static struct FsmNode fnlist[] __initdata =
 {
         {ST_NULL,               EV_DIAL,                lli_prep_dialout},
         {ST_NULL,               EV_RESUME,              lli_resume},
@@ -937,6 +797,8 @@
         {ST_IN_WAIT_LL,         EV_HANGUP,              lli_reject_req},
         {ST_IN_WAIT_LL,         EV_DISCONNECT_IND,      lli_release_req},
         {ST_IN_WAIT_LL,         EV_RELEASE,             lli_dhup_close},
+        {ST_IN_WAIT_LL,         EV_SETUP_IND,           lli_deliver_call},
+        {ST_IN_WAIT_LL,         EV_SETUP_ERR,           lli_error},
         {ST_IN_ALERT_SENT,      EV_SETUP_CMPL_IND,      lli_init_bchan_in},
         {ST_IN_ALERT_SENT,      EV_ACCEPTD,             lli_send_dconnect},
         {ST_IN_ALERT_SENT,      EV_HANGUP,              lli_disconnect_reject},
@@ -988,8 +850,8 @@
 
 #define FNCOUNT (sizeof(fnlist)/sizeof(struct FsmNode))
 
-HISAX_INITFUNC(void
-CallcNew(void))
+void __init
+CallcNew(void)
 {
 	callcfsm.state_count = STATE_COUNT;
 	callcfsm.event_count = EVENT_COUNT;
@@ -1016,6 +878,7 @@
 				releasestack_isdnl2(st);
 				break;
 			case (ISDN_PROTO_L2_HDLC):
+			case (ISDN_PROTO_L2_HDLC_56K):
 			case (ISDN_PROTO_L2_TRANS):
 			case (ISDN_PROTO_L2_MODEM):
 			case (ISDN_PROTO_L2_FAX):
@@ -1098,6 +961,9 @@
 		return;
 
 	switch (pr) {
+		case (CC_MORE_INFO | INDICATION):
+			FsmEvent(&chanp->fi, EV_SETUP_IND, NULL);
+			break;
 		case (CC_DISCONNECT | INDICATION):
 			FsmEvent(&chanp->fi, EV_DISCONNECT_IND, NULL);
 			break;
@@ -1245,7 +1111,7 @@
 	chanp->fi.printdebug = callc_debug;
 	FsmInitTimer(&chanp->fi, &chanp->dial_timer);
 	FsmInitTimer(&chanp->fi, &chanp->drel_timer);
-	if (!chan || test_bit(FLG_TWO_DCHAN, &csta->HW_Flags)) {
+	if (!chan || (test_bit(FLG_TWO_DCHAN, &csta->HW_Flags) && chan < 2)) {
 		init_d_st(chanp);
 	} else {
 		chanp->d_st = csta->channel->d_st;
@@ -1318,9 +1184,12 @@
 
 	switch (pr) {
 		case (DL_DATA  | INDICATION):
-			if (chanp->data_open)
+			if (chanp->data_open) {
+				if (chanp->debug & 0x800)
+					link_debug(chanp, 0, "lldata: %d", skb->len);
 				chanp->cs->iif.rcvcallb_skb(chanp->cs->myid, chanp->chan, skb);
-			else {
+			} else {
+				link_debug(chanp, 0, "lldata: channel not open");
 				dev_kfree_skb(skb);
 			}
 			break;
@@ -1347,10 +1216,12 @@
 
 	switch (pr) {
 		case (PH_DATA | INDICATION):
-			if (chanp->data_open)
+			if (chanp->data_open) {
+				if (chanp->debug & 0x800)
+					link_debug(chanp, 0, "lltrans: %d", skb->len);
 				chanp->cs->iif.rcvcallb_skb(chanp->cs->myid, chanp->chan, skb);
-			else {
-				link_debug(chanp, 0, "channel not open");
+			} else {
+				link_debug(chanp, 0, "lltrans: channel not open");
 				dev_kfree_skb(skb);
 			}
 			break;
@@ -1375,6 +1246,8 @@
 	struct Channel *chanp = st->lli.userdata;
 	isdn_ctrl ic;
 
+	if (chanp->debug & 0x800)
+		link_debug(chanp, 0, "llwakeup: %d", len);
 	ic.driver = chanp->cs->myid;
 	ic.command = ISDN_STAT_BSENT;
 	ic.arg = chanp->chan;
@@ -1399,6 +1272,9 @@
 		case (ISDN_PROTO_L2_HDLC):
 			st->l1.mode = L1_MODE_HDLC;
 			break;
+		case (ISDN_PROTO_L2_HDLC_56K):
+			st->l1.mode = L1_MODE_HDLC_56K;
+			break;
 		case (ISDN_PROTO_L2_TRANS):
 			st->l1.mode = L1_MODE_TRANS;
 			break;
@@ -1435,6 +1311,7 @@
 			st->l2.debug = chanp->debug & 64;
 			break;
 		case (ISDN_PROTO_L2_HDLC):
+		case (ISDN_PROTO_L2_HDLC_56K):
 		case (ISDN_PROTO_L2_TRANS):
 		case (ISDN_PROTO_L2_MODEM):
 		case (ISDN_PROTO_L2_FAX):
@@ -1648,7 +1525,7 @@
 				link_debug(chanp, 1, "DIAL %s -> %s (%d,%d)",
 					ic->parm.setup.eazmsn, ic->parm.setup.phone,
 					ic->parm.setup.si1, ic->parm.setup.si2);
-			chanp->setup = ic->parm.setup;
+			memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
 			if (!strcmp(chanp->setup.eazmsn, "0"))
 				chanp->setup.eazmsn[0] = '\0';
 			/* this solution is dirty and may be change, if
@@ -1668,6 +1545,7 @@
 			break;
 		case (ISDN_CMD_ACCEPTD):
 			chanp = csta->channel + ic->arg;
+			memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
 			if (chanp->debug & 1)
 				link_debug(chanp, 1, "ACCEPTD");
 			FsmEvent(&chanp->fi, EV_ACCEPTD, NULL);
@@ -1864,7 +1742,7 @@
 			chanp = csta->channel + ic->arg;
 			if (chanp->debug & 1)
 				link_debug(chanp, 1, "REDIR");
-			chanp->setup = ic->parm.setup;
+			memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
 			FsmEvent(&chanp->fi, EV_REDIR, NULL);
 			break;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)