patch-pre2.0.6 linux/drivers/isdn/teles/l3_1TR6.c
Next file: linux/drivers/isdn/teles/l3_1TR6.h
Previous file: linux/drivers/isdn/teles/isdnl3.c
Back to the patch index
Back to the overall index
- Lines: 398
- Date:
Sun May 19 15:29:31 1996
- Orig file:
pre2.0.5/linux/drivers/isdn/teles/l3_1TR6.c
- Orig date:
Sun Apr 21 19:22:07 1996
diff -u --recursive --new-file pre2.0.5/linux/drivers/isdn/teles/l3_1TR6.c linux/drivers/isdn/teles/l3_1TR6.c
@@ -1,6 +1,9 @@
-/* $Id: l3_1TR6.c,v 1.2 1996/04/20 16:47:23 fritz Exp $
+/* $Id: l3_1TR6.c,v 1.3 1996/04/30 21:54:42 isdn4dev Exp $
*
* $Log: l3_1TR6.c,v $
+ * Revision 1.3 1996/04/30 21:54:42 isdn4dev
+ * SPV, callback , remove some debugging code Karsten Keil
+ *
* Revision 1.2 1996/04/20 16:47:23 fritz
* Changed statemachine to allow reject of an incoming call.
* Report all incoming calls, not just those with Service = 7.
@@ -12,27 +15,6 @@
*
*/
-char *
-mt_trans(int pd, int mt)
-{
- int i;
-
- if (pd == PROTO_DIS_N0) {
- for (i = 0; i < (sizeof(mtdesc_n0) / sizeof(struct MTypeDesc)); i++) {
- if (mt == mtdesc_n0[i].mt)
- return (mtdesc_n0[i].descr);
- }
- return ("unknown Message Type PD=N0");
- } else if (pd == PROTO_DIS_N1) {
- for (i = 0; i < (sizeof(mtdesc_n1) / sizeof(struct MTypeDesc)); i++) {
- if (mt == mtdesc_n1[i].mt)
- return (mtdesc_n1[i].descr);
- }
- return ("unknown Message Type PD=N1");
- }
- return ("unknown Protokolldiscriminator");
-}
-
static void
l3_1TR6_message(struct PStack *st, int mt, int pd)
{
@@ -59,10 +41,6 @@
byte *p;
char *teln;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: sent SETUP\n");
-#endif
-
st->l3.callref = st->pa->callref;
BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 19);
p = DATAPTR(dibh);
@@ -73,7 +51,21 @@
*p++ = st->l3.callref;
*p++ = MT_N1_SETUP;
-
+ if ('S' == (st->pa->called[0] & 0x5f)) { /* SPV ??? */
+ /* NSF SPV */
+ *p++ = WE0_netSpecFac;
+ *p++ = 4; /* Laenge */
+ *p++ = 0;
+ *p++ = FAC_SPV; /* SPV */
+ *p++ = st->pa->info; /* 0 for all Services */
+ *p++ = st->pa->info2; /* 0 for all Services */
+ *p++ = WE0_netSpecFac;
+ *p++ = 4; /* Laenge */
+ *p++ = 0;
+ *p++ = FAC_Activate; /* aktiviere SPV (default) */
+ *p++ = st->pa->info; /* 0 for all Services */
+ *p++ = st->pa->info2; /* 0 for all Services */
+ }
if (st->pa->calling[0] != '\0') {
*p++ = WE0_origAddr;
*p++ = strlen(st->pa->calling) + 1;
@@ -84,11 +76,17 @@
*p++ = *teln++ & 0x7f;
}
*p++ = WE0_destAddr;
- *p++ = strlen(st->pa->called) + 1;
+ teln = st->pa->called;
+ if ('S' != (st->pa->called[0] & 0x5f)) { /* Keine SPV ??? */
+ *p++ = strlen(st->pa->called) + 1;
+ st->pa->spv = 0;
+ } else { /* SPV */
+ *p++ = strlen(st->pa->called);
+ teln++; /* skip S */
+ st->pa->spv = 1;
+ }
/* Classify as AnyPref. */
*p++ = 0x81; /* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
-
- teln = st->pa->called;
while (*teln)
*p++ = *teln++ & 0x7f;
@@ -106,7 +104,6 @@
}
-
static void
l3_1tr6_tu_setup(struct PStack *st, byte pr, void *arg)
{
@@ -118,13 +115,7 @@
st->pa->callref = getcallref(p);
st->l3.callref = 0x80 + st->pa->callref;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: TU_SETUP cr=%d\n",st->l3.callref);
-#endif
-
- /*
- * Channel Identification
- */
+ /* Channel Identification */
p = DATAPTR(ibh);
if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
WE0_chanID, 0))) {
@@ -154,6 +145,13 @@
} else
strcpy(st->pa->calling, "");
+ p = DATAPTR(ibh);
+ st->pa->spv = 0;
+ if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
+ WE0_netSpecFac, 0))) {
+ if ((FAC_SPV == p[3]) || (FAC_Activate == p[3]))
+ st->pa->spv = 1;
+ }
BufPoolRelease(ibh);
/* Signal all services, linklevel takes care of Service-Indicator */
@@ -172,10 +170,6 @@
byte *p;
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: SETUP_ACK\n");
-#endif
-
p = DATAPTR(ibh);
if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
WE0_chanID, 0))) {
@@ -183,6 +177,7 @@
} else
printk(KERN_INFO "octect 3 not found\n");
+
BufPoolRelease(ibh);
newl3state(st, 2);
}
@@ -193,10 +188,6 @@
byte *p;
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: CALL_SENT\n");
-#endif
-
p = DATAPTR(ibh);
if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
WE0_chanID, 0))) {
@@ -215,9 +206,6 @@
byte *p;
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: TU_ALERT\n");
-#endif
p = DATAPTR(ibh);
if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
@@ -236,24 +224,22 @@
l3_1tr6_tu_info(struct PStack *st, byte pr, void *arg)
{
byte *p;
- int i;
+ int i,tmpcharge=0;
char a_charge[8];
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: TU_INFO\n");
-#endif
-
p = DATAPTR(ibh);
if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
WE6_chargingInfo, 6))) {
iecpy(a_charge, p, 1);
- st->pa->chargeinfo = 0;
- for (i = 0; i < strlen(a_charge); i++) {
- st->pa->chargeinfo *= 10;
- st->pa->chargeinfo += a_charge[i] & 0xf;
- st->l3.l3l4(st, CC_INFO_CHARGE, NULL);
- }
+ for (i = 0; i < strlen (a_charge); i++) {
+ tmpcharge *= 10;
+ tmpcharge += a_charge[i] & 0xf;
+ }
+ if (tmpcharge > st->pa->chargeinfo) {
+ st->pa->chargeinfo = tmpcharge;
+ st->l3.l3l4 (st, CC_INFO_CHARGE, NULL);
+ }
if (DEBUG_1TR6 > 2)
printk(KERN_INFO "chargingInfo %d\n", st->pa->chargeinfo);
} else if (DEBUG_1TR6 > 2)
@@ -269,10 +255,6 @@
int i;
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: TU_INFO 2\n");
-#endif
-
if (DEBUG_1TR6 > 4) {
p = DATAPTR(ibh);
for (i = 0; i < ibh->datasize; i++) {
@@ -287,10 +269,7 @@
{
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: CONNECT\n");
-#endif
-
+ st->pa->chargeinfo=0;
BufPoolRelease(ibh);
st->l3.l3l4(st, CC_SETUP_CNF, NULL);
newl3state(st, 10);
@@ -301,11 +280,6 @@
{
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: REL\n");
-#endif
-
-
BufPoolRelease(ibh);
l3_1TR6_message(st, MT_N1_REL_ACK, PROTO_DIS_N1);
st->l3.l3l4(st, CC_RELEASE_IND, NULL);
@@ -317,11 +291,6 @@
{
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: REL_ACK\n");
-#endif
-
-
BufPoolRelease(ibh);
newl3state(st, 0);
st->l3.l3l4(st, CC_RELEASE_CNF, NULL);
@@ -332,25 +301,21 @@
{
struct BufHeader *ibh = arg;
byte *p;
- int i;
+ int i,tmpcharge=0;
char a_charge[8];
-
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: TU_DISC\n");
-#endif
-
-
p = DATAPTR(ibh);
if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
WE6_chargingInfo, 6))) {
iecpy(a_charge, p, 1);
- st->pa->chargeinfo = 0;
- for (i = 0; i < strlen(a_charge); i++) {
- st->pa->chargeinfo *= 10;
- st->pa->chargeinfo += a_charge[i] & 0xf;
- st->l3.l3l4(st, CC_INFO_CHARGE, NULL);
- }
+ for (i = 0; i < strlen (a_charge); i++) {
+ tmpcharge *= 10;
+ tmpcharge += a_charge[i] & 0xf;
+ }
+ if (tmpcharge > st->pa->chargeinfo) {
+ st->pa->chargeinfo = tmpcharge;
+ st->l3.l3l4 (st, CC_INFO_CHARGE, NULL);
+ }
if (DEBUG_1TR6 > 2)
printk(KERN_INFO "chargingInfo %d\n", st->pa->chargeinfo);
} else if (DEBUG_1TR6 > 2)
@@ -380,12 +345,8 @@
{
struct BufHeader *ibh = arg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: CONN_ACK\n");
-#endif
-
-
BufPoolRelease(ibh);
+ st->pa->chargeinfo = 0;
st->l3.l3l4(st, CC_SETUP_COMPLETE_IND, NULL);
newl3state(st, 10);
}
@@ -394,10 +355,6 @@
l3_1tr6_alert(struct PStack *st, byte pr,
void *arg)
{
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: send ALERT\n");
-#endif
-
l3_1TR6_message(st, MT_N1_ALERT, PROTO_DIS_N1);
newl3state(st, 7);
}
@@ -406,22 +363,45 @@
l3_1tr6_conn(struct PStack *st, byte pr,
void *arg)
{
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: send CONNECT\n");
-#endif
+ struct BufHeader *dibh;
+ byte *p;
st->l3.callref = 0x80 + st->pa->callref;
- l3_1TR6_message(st, MT_N1_CONN, PROTO_DIS_N1);
+
+ BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 20);
+ p = DATAPTR(dibh);
+ p += st->l2.ihsize;
+
+ *p++ = PROTO_DIS_N1;
+ *p++ = 0x1;
+ *p++ = st->l3.callref;
+ *p++ = MT_N1_CONN;
+
+ if (st->pa->spv) { /* SPV ??? */
+ /* NSF SPV */
+ *p++ = WE0_netSpecFac;
+ *p++ = 4; /* Laenge */
+ *p++ = 0;
+ *p++ = FAC_SPV; /* SPV */
+ *p++ = st->pa->info;
+ *p++ = st->pa->info2;
+ *p++ = WE0_netSpecFac;
+ *p++ = 4; /* Laenge */
+ *p++ = 0;
+ *p++ = FAC_Activate; /* aktiviere SPV */
+ *p++ = st->pa->info;
+ *p++ = st->pa->info2;
+ }
+ dibh->datasize = p - DATAPTR(dibh);
+
+ i_down(st, dibh);
+
newl3state(st, 8);
}
static void
l3_1tr6_ignore(struct PStack *st, byte pr, void *arg)
{
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: IGNORE\n");
-#endif
-
newl3state(st, 0);
}
@@ -432,10 +412,6 @@
byte *p;
byte rejflg;
-#if DEBUG_1TR6
- printk(KERN_INFO "1tr6: send DISCON\n");
-#endif
-
BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 21);
p = DATAPTR(dibh);
p += st->l2.ihsize;
@@ -460,10 +436,7 @@
i_down(st, dibh);
- if (rejflg)
- newl3state(st, 0);
- else
- newl3state(st, 11);
+ newl3state(st, 11);
}
static void
@@ -472,8 +445,6 @@
l3_1TR6_message(st, MT_N1_REL, PROTO_DIS_N1);
newl3state(st, 19);
}
-
-
static struct stateentry downstatelist_1tr6t[] =
{
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this