1 /* $Id: l3dss1.c,v 2.30.6.2 2001/09/23 22:24:49 kai Exp $
3 * EURO/DSS1 D-channel protocol
5 * German 1TR6 D-channel protocol
8 * based on the teles driver from Jan den Ouden
9 * Copyright by Karsten Keil <keil@isdn4linux.de>
11 * This software may be used and distributed according to the terms
12 * of the GNU General Public License, incorporated herein by reference.
14 * For changes and modifications please read
15 * ../../../Documentation/isdn/HiSax.cert
17 * Thanks to Jan den Ouden
25 #include <linux/ctype.h>
26 #include <linux/config.h>
28 extern char *HiSax_getrev(const char *revision
);
29 const char *dss1_revision
= "$Revision: 2.30.6.2 $";
30 static spinlock_t l3dss1_lock
= SPIN_LOCK_UNLOCKED
;
32 #define EXT_BEARER_CAPS 1
34 #define MsgHead(ptr, cref, mty) \
45 /**********************************************/
46 /* get a new invoke id for remote operations. */
47 /* Only a return value != 0 is valid */
48 /**********************************************/
49 static unsigned char new_invoke_id(struct PStack
*p
)
55 i
= 32; /* maximum search depth */
57 spin_lock_irqsave(&l3dss1_lock
, flags
);
59 retval
= p
->prot
.dss1
.last_invoke_id
+ 1; /* try new id */
60 while ((i
) && (p
->prot
.dss1
.invoke_used
[retval
>> 3] == 0xFF)) {
61 p
->prot
.dss1
.last_invoke_id
= (retval
& 0xF8) + 8;
65 while (p
->prot
.dss1
.invoke_used
[retval
>> 3] & (1 << (retval
& 7)))
69 p
->prot
.dss1
.last_invoke_id
= retval
;
70 p
->prot
.dss1
.invoke_used
[retval
>> 3] |= (1 << (retval
& 7));
71 spin_unlock_irqrestore(&l3dss1_lock
, flags
);
76 /*************************/
77 /* free a used invoke id */
78 /*************************/
79 static void free_invoke_id(struct PStack
*p
, unsigned char id
)
80 { unsigned long flags
;
82 if (!id
) return; /* 0 = invalid value */
84 spin_lock_irqsave(&l3dss1_lock
, flags
);
85 p
->prot
.dss1
.invoke_used
[id
>> 3] &= ~(1 << (id
& 7));
86 spin_unlock_irqrestore(&l3dss1_lock
, flags
);
87 } /* free_invoke_id */
90 /**********************************************************/
91 /* create a new l3 process and fill in dss1 specific data */
92 /**********************************************************/
93 static struct l3_process
94 *dss1_new_l3_process(struct PStack
*st
, int cr
)
95 { struct l3_process
*proc
;
97 if (!(proc
= new_l3_process(st
, cr
)))
100 proc
->prot
.dss1
.invoke_id
= 0;
101 proc
->prot
.dss1
.remote_operation
= 0;
102 proc
->prot
.dss1
.uus1_data
[0] = '\0';
105 } /* dss1_new_l3_process */
107 /************************************************/
108 /* free a l3 process and all dss1 specific data */
109 /************************************************/
111 dss1_release_l3_process(struct l3_process
*p
)
113 free_invoke_id(p
->st
,p
->prot
.dss1
.invoke_id
);
114 release_l3_process(p
);
115 } /* dss1_release_l3_process */
117 /********************************************************/
118 /* search a process with invoke id id and dummy callref */
119 /********************************************************/
120 static struct l3_process
*
121 l3dss1_search_dummy_proc(struct PStack
*st
, int id
)
122 { struct l3_process
*pc
= st
->l3
.proc
; /* start of processes */
124 if (!id
) return(NULL
);
127 { if ((pc
->callref
== -1) && (pc
->prot
.dss1
.invoke_id
== id
))
132 } /* l3dss1_search_dummy_proc */
134 /*******************************************************************/
135 /* called when a facility message with a dummy callref is received */
136 /* and a return result is delivered. id specifies the invoke id. */
137 /*******************************************************************/
139 l3dss1_dummy_return_result(struct PStack
*st
, int id
, u8
*p
, u8 nlen
)
141 struct IsdnCardState
*cs
;
142 struct l3_process
*pc
= NULL
;
144 if ((pc
= l3dss1_search_dummy_proc(st
, id
)))
145 { L3DelTimer(&pc
->timer
); /* remove timer */
147 cs
= pc
->st
->l1
.hardware
;
148 ic
.driver
= cs
->myid
;
149 ic
.command
= ISDN_STAT_PROT
;
150 ic
.arg
= DSS1_STAT_INVOKE_RES
;
151 ic
.parm
.dss1_io
.hl_id
= pc
->prot
.dss1
.invoke_id
;
152 ic
.parm
.dss1_io
.ll_id
= pc
->prot
.dss1
.ll_id
;
153 ic
.parm
.dss1_io
.proc
= pc
->prot
.dss1
.proc
;
154 ic
.parm
.dss1_io
.timeout
= 0;
155 ic
.parm
.dss1_io
.datalen
= nlen
;
156 ic
.parm
.dss1_io
.data
= p
;
157 free_invoke_id(pc
->st
, pc
->prot
.dss1
.invoke_id
);
158 pc
->prot
.dss1
.invoke_id
= 0; /* reset id */
160 cs
->iif
.statcallb(&ic
);
161 dss1_release_l3_process(pc
);
164 l3_debug(st
, "dummy return result id=0x%x result len=%d",id
,nlen
);
165 } /* l3dss1_dummy_return_result */
167 /*******************************************************************/
168 /* called when a facility message with a dummy callref is received */
169 /* and a return error is delivered. id specifies the invoke id. */
170 /*******************************************************************/
172 l3dss1_dummy_error_return(struct PStack
*st
, int id
, ulong error
)
174 struct IsdnCardState
*cs
;
175 struct l3_process
*pc
= NULL
;
177 if ((pc
= l3dss1_search_dummy_proc(st
, id
)))
178 { L3DelTimer(&pc
->timer
); /* remove timer */
180 cs
= pc
->st
->l1
.hardware
;
181 ic
.driver
= cs
->myid
;
182 ic
.command
= ISDN_STAT_PROT
;
183 ic
.arg
= DSS1_STAT_INVOKE_ERR
;
184 ic
.parm
.dss1_io
.hl_id
= pc
->prot
.dss1
.invoke_id
;
185 ic
.parm
.dss1_io
.ll_id
= pc
->prot
.dss1
.ll_id
;
186 ic
.parm
.dss1_io
.proc
= pc
->prot
.dss1
.proc
;
187 ic
.parm
.dss1_io
.timeout
= error
;
188 ic
.parm
.dss1_io
.datalen
= 0;
189 ic
.parm
.dss1_io
.data
= NULL
;
190 free_invoke_id(pc
->st
, pc
->prot
.dss1
.invoke_id
);
191 pc
->prot
.dss1
.invoke_id
= 0; /* reset id */
193 cs
->iif
.statcallb(&ic
);
194 dss1_release_l3_process(pc
);
197 l3_debug(st
, "dummy return error id=0x%x error=0x%lx",id
,error
);
198 } /* l3dss1_error_return */
200 /*******************************************************************/
201 /* called when a facility message with a dummy callref is received */
202 /* and a invoke is delivered. id specifies the invoke id. */
203 /*******************************************************************/
205 l3dss1_dummy_invoke(struct PStack
*st
, int cr
, int id
,
206 int ident
, u8
*p
, u8 nlen
)
208 struct IsdnCardState
*cs
;
210 l3_debug(st
, "dummy invoke %s id=0x%x ident=0x%x datalen=%d",
211 (cr
== -1) ? "local" : "broadcast",id
,ident
,nlen
);
212 if (cr
>= -1) return; /* ignore local data */
214 cs
= st
->l1
.hardware
;
215 ic
.driver
= cs
->myid
;
216 ic
.command
= ISDN_STAT_PROT
;
217 ic
.arg
= DSS1_STAT_INVOKE_BRD
;
218 ic
.parm
.dss1_io
.hl_id
= id
;
219 ic
.parm
.dss1_io
.ll_id
= 0;
220 ic
.parm
.dss1_io
.proc
= ident
;
221 ic
.parm
.dss1_io
.timeout
= 0;
222 ic
.parm
.dss1_io
.datalen
= nlen
;
223 ic
.parm
.dss1_io
.data
= p
;
225 cs
->iif
.statcallb(&ic
);
226 } /* l3dss1_dummy_invoke */
229 l3dss1_parse_facility(struct PStack
*st
, struct l3_process
*pc
,
233 unsigned char nlen
= 0, ilen
, cp_tag
;
238 st
= pc
->st
; /* valid Stack */
240 if ((!st
) || (cr
>= 0)) return; /* neither pc nor st specified */
245 l3_debug(st
, "qd_len == 0");
248 if ((*p
& 0x1F) != 0x11) { /* Service discriminator, supplementary service */
249 l3_debug(st
, "supplementary service != 0x11");
252 while (qd_len
> 0 && !(*p
& 0x80)) { /* extension ? */
257 l3_debug(st
, "qd_len < 2");
262 if ((*p
& 0xE0) != 0xA0) { /* class and form */
263 l3_debug(st
, "class and form != 0xA0");
267 cp_tag
= *p
& 0x1F; /* remember tag value */
272 { l3_debug(st
, "qd_len < 1");
276 { /* length format indefinite or limited */
277 nlen
= *p
++ & 0x7F; /* number of len bytes or indefinite */
278 if ((qd_len
-- < ((!nlen
) ? 3 : (1 + nlen
))) ||
280 { l3_debug(st
, "length format error or not implemented");
284 { nlen
= *p
++; /* complete length */
288 { qd_len
-= 2; /* trailing null bytes */
289 if ((*(p
+qd_len
)) || (*(p
+qd_len
+1)))
290 { l3_debug(st
,"length format indefinite error");
301 { l3_debug(st
, "qd_len < nlen");
307 { l3_debug(st
, "nlen < 2");
311 { /* invoke identifier tag */
312 l3_debug(st
, "invoke identifier tag !=0x02");
318 { /* length format */
319 l3_debug(st
, "invoke id length format 2");
324 if (ilen
> nlen
|| ilen
== 0)
325 { l3_debug(st
, "ilen > nlen || ilen == 0");
331 { id
= (id
<< 8) | (*p
++ & 0xFF); /* invoke identifier */
335 switch (cp_tag
) { /* component tag */
338 l3_debug(st
, "nlen < 2 22");
341 if (*p
!= 0x02) { /* operation value */
342 l3_debug(st
, "operation value !=0x02");
349 if (ilen
> nlen
|| ilen
== 0) {
350 l3_debug(st
, "ilen > nlen || ilen == 0 22");
356 ident
= (ident
<< 8) | (*p
++ & 0xFF);
361 { l3dss1_dummy_invoke(st
, cr
, id
, ident
, p
, nlen
);
367 #define FOO1(s,a,b) \
370 if(nlen < ilen+2) { \
371 l3_debug(st, "FOO1 nlen < ilen+2"); \
375 if((*p & 0xFF) == (a)) { \
385 case 0x22: /* during */
386 FOO1("1A", 0x30, FOO1("1C", 0xA1, FOO1("1D", 0x30, FOO1("1E", 0x02, ( {
388 nlen
= (nlen
)?nlen
:0; /* Make gcc happy */
390 ident
= (ident
<< 8) | *p
++;
393 if (ident
> pc
->para
.chargeinfo
) {
394 pc
->para
.chargeinfo
= ident
;
395 st
->l3
.l3l4(st
, CC_CHARGE
| INDICATION
, pc
);
397 if (st
->l3
.debug
& L3_DEB_CHARGE
) {
399 l3_debug(st
, "charging info during %d", pc
->para
.chargeinfo
);
402 l3_debug(st
, "charging info final %d", pc
->para
.chargeinfo
);
408 case 0x24: /* final */
409 FOO1("2A", 0x30, FOO1("2B", 0x30, FOO1("2C", 0xA1, FOO1("2D", 0x30, FOO1("2E", 0x02, ( {
411 nlen
= (nlen
)?nlen
:0; /* Make gcc happy */
413 ident
= (ident
<< 8) | *p
++;
416 if (ident
> pc
->para
.chargeinfo
) {
417 pc
->para
.chargeinfo
= ident
;
418 st
->l3
.l3l4(st
, CC_CHARGE
| INDICATION
, pc
);
420 if (st
->l3
.debug
& L3_DEB_CHARGE
) {
421 l3_debug(st
, "charging info final %d", pc
->para
.chargeinfo
);
427 l3_debug(st
, "invoke break invalid ident %02x",ident
);
433 #else /* not HISAX_DE_AOC */
434 l3_debug(st
, "invoke break");
435 #endif /* not HISAX_DE_AOC */
437 case 2: /* return result */
438 /* if no process available handle separately */
441 l3dss1_dummy_return_result(st
, id
, p
, nlen
);
444 if ((pc
->prot
.dss1
.invoke_id
) && (pc
->prot
.dss1
.invoke_id
== id
))
445 { /* Diversion successful */
446 free_invoke_id(st
,pc
->prot
.dss1
.invoke_id
);
447 pc
->prot
.dss1
.remote_result
= 0; /* success */
448 pc
->prot
.dss1
.invoke_id
= 0;
449 pc
->redir_result
= pc
->prot
.dss1
.remote_result
;
450 L3L4(st
, CC_REDIR
| INDICATION
, pc
); } /* Diversion successful */
452 l3_debug(st
,"return error unknown identifier");
454 case 3: /* return error */
457 { l3_debug(st
, "return error nlen < 2");
462 l3_debug(st
, "invoke error tag !=0x02");
468 { /* length format */
469 l3_debug(st
, "invoke return errlen > 4 ");
474 if (ilen
> nlen
|| ilen
== 0)
475 { l3_debug(st
, "error return ilen > nlen || ilen == 0");
480 { err_ret
= (err_ret
<< 8) | (*p
++ & 0xFF); /* error value */
483 /* if no process available handle separately */
486 l3dss1_dummy_error_return(st
, id
, err_ret
);
489 if ((pc
->prot
.dss1
.invoke_id
) && (pc
->prot
.dss1
.invoke_id
== id
))
490 { /* Deflection error */
491 free_invoke_id(st
,pc
->prot
.dss1
.invoke_id
);
492 pc
->prot
.dss1
.remote_result
= err_ret
; /* result */
493 pc
->prot
.dss1
.invoke_id
= 0;
494 pc
->redir_result
= pc
->prot
.dss1
.remote_result
;
495 L3L4(st
, CC_REDIR
| INDICATION
, pc
);
496 } /* Deflection error */
498 l3_debug(st
,"return result unknown identifier");
501 l3_debug(st
, "facility default break tag=0x%02x",cp_tag
);
507 l3dss1_message(struct l3_process
*pc
, u8 mt
)
512 if (!(skb
= l3_alloc_skb(4)))
515 MsgHead(p
, pc
->callref
, mt
);
516 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
520 l3dss1_message_cause(struct l3_process
*pc
, u8 mt
, u8 cause
)
527 MsgHead(p
, pc
->callref
, mt
);
534 if (!(skb
= l3_alloc_skb(l
)))
536 memcpy(skb_put(skb
, l
), tmp
, l
);
537 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
541 l3dss1_status_send(struct l3_process
*pc
, u8 pr
, void *arg
)
548 MsgHead(p
, pc
->callref
, MT_STATUS
);
553 *p
++ = pc
->para
.cause
| 0x80;
555 *p
++ = IE_CALL_STATE
;
557 *p
++ = pc
->state
& 0x3f;
560 if (!(skb
= l3_alloc_skb(l
)))
562 memcpy(skb_put(skb
, l
), tmp
, l
);
563 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
567 l3dss1_msg_without_setup(struct l3_process
*pc
, u8 pr
, void *arg
)
569 /* This routine is called if here was no SETUP made (checks in dss1up and in
570 * l3dss1_setup) and a RELEASE_COMPLETE have to be sent with an error code
571 * MT_STATUS_ENQUIRE in the NULL state is handled too
578 switch (pc
->para
.cause
) {
579 case 81: /* invalid callreference */
580 case 88: /* incomp destination */
581 case 96: /* mandory IE missing */
582 case 100: /* invalid IE contents */
583 case 101: /* incompatible Callstate */
584 MsgHead(p
, pc
->callref
, MT_RELEASE_COMPLETE
);
588 *p
++ = pc
->para
.cause
| 0x80;
591 printk(KERN_ERR
"HiSax l3dss1_msg_without_setup wrong cause %d\n",
596 if (!(skb
= l3_alloc_skb(l
)))
598 memcpy(skb_put(skb
, l
), tmp
, l
);
599 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
600 dss1_release_l3_process(pc
);
603 static int ie_ALERTING
[] = {IE_BEARER
, IE_CHANNEL_ID
| IE_MANDATORY_1
,
604 IE_FACILITY
, IE_PROGRESS
, IE_DISPLAY
, IE_SIGNAL
, IE_HLC
,
606 static int ie_CALL_PROCEEDING
[] = {IE_BEARER
, IE_CHANNEL_ID
| IE_MANDATORY_1
,
607 IE_FACILITY
, IE_PROGRESS
, IE_DISPLAY
, IE_HLC
, -1};
608 static int ie_CONNECT
[] = {IE_BEARER
, IE_CHANNEL_ID
| IE_MANDATORY_1
,
609 IE_FACILITY
, IE_PROGRESS
, IE_DISPLAY
, IE_DATE
, IE_SIGNAL
,
610 IE_CONNECT_PN
, IE_CONNECT_SUB
, IE_LLC
, IE_HLC
, IE_USER_USER
, -1};
611 static int ie_CONNECT_ACKNOWLEDGE
[] = {IE_CHANNEL_ID
, IE_DISPLAY
, IE_SIGNAL
, -1};
612 static int ie_DISCONNECT
[] = {IE_CAUSE
| IE_MANDATORY
, IE_FACILITY
,
613 IE_PROGRESS
, IE_DISPLAY
, IE_SIGNAL
, IE_USER_USER
, -1};
614 static int ie_INFORMATION
[] = {IE_COMPLETE
, IE_DISPLAY
, IE_KEYPAD
, IE_SIGNAL
,
616 static int ie_NOTIFY
[] = {IE_BEARER
, IE_NOTIFY
| IE_MANDATORY
, IE_DISPLAY
, -1};
617 static int ie_PROGRESS
[] = {IE_BEARER
, IE_CAUSE
, IE_FACILITY
, IE_PROGRESS
|
618 IE_MANDATORY
, IE_DISPLAY
, IE_HLC
, IE_USER_USER
, -1};
619 static int ie_RELEASE
[] = {IE_CAUSE
| IE_MANDATORY_1
, IE_FACILITY
, IE_DISPLAY
,
620 IE_SIGNAL
, IE_USER_USER
, -1};
621 /* a RELEASE_COMPLETE with errors don't require special actions
622 static int ie_RELEASE_COMPLETE[] = {IE_CAUSE | IE_MANDATORY_1, IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1};
624 static int ie_RESUME_ACKNOWLEDGE
[] = {IE_CHANNEL_ID
| IE_MANDATORY
, IE_FACILITY
,
626 static int ie_RESUME_REJECT
[] = {IE_CAUSE
| IE_MANDATORY
, IE_DISPLAY
, -1};
627 static int ie_SETUP
[] = {IE_COMPLETE
, IE_BEARER
| IE_MANDATORY
,
628 IE_CHANNEL_ID
| IE_MANDATORY
, IE_FACILITY
, IE_PROGRESS
,
629 IE_NET_FAC
, IE_DISPLAY
, IE_KEYPAD
, IE_SIGNAL
, IE_CALLING_PN
,
630 IE_CALLING_SUB
, IE_CALLED_PN
, IE_CALLED_SUB
, IE_REDIR_NR
,
631 IE_LLC
, IE_HLC
, IE_USER_USER
, -1};
632 static int ie_SETUP_ACKNOWLEDGE
[] = {IE_CHANNEL_ID
| IE_MANDATORY
, IE_FACILITY
,
633 IE_PROGRESS
, IE_DISPLAY
, IE_SIGNAL
, -1};
634 static int ie_STATUS
[] = {IE_CAUSE
| IE_MANDATORY
, IE_CALL_STATE
|
635 IE_MANDATORY
, IE_DISPLAY
, -1};
636 static int ie_STATUS_ENQUIRY
[] = {IE_DISPLAY
, -1};
637 static int ie_SUSPEND_ACKNOWLEDGE
[] = {IE_DISPLAY
, IE_FACILITY
, -1};
638 static int ie_SUSPEND_REJECT
[] = {IE_CAUSE
| IE_MANDATORY
, IE_DISPLAY
, -1};
640 * static int ie_CONGESTION_CONTROL[] = {IE_CONGESTION | IE_MANDATORY,
641 * IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1};
642 * static int ie_USER_INFORMATION[] = {IE_MORE_DATA, IE_USER_USER | IE_MANDATORY, -1};
643 * static int ie_RESTART[] = {IE_CHANNEL_ID, IE_DISPLAY, IE_RESTART_IND |
646 static int ie_FACILITY
[] = {IE_FACILITY
| IE_MANDATORY
, IE_DISPLAY
, -1};
647 static int comp_required
[] = {1,2,3,5,6,7,9,10,11,14,15,-1};
648 static int l3_valid_states
[] = {0,1,2,3,4,6,7,8,9,10,11,12,15,17,19,25,-1};
656 struct ie_len max_ie_len
[] = {
674 {IE_PACK_BINPARA
, 3},
675 {IE_PACK_WINSIZE
, 4},
680 {IE_CALLING_SUB
, 23},
693 getmax_ie_len(u8 ie
) {
695 while (max_ie_len
[i
].ie
!= -1) {
696 if (max_ie_len
[i
].ie
== ie
)
697 return(max_ie_len
[i
].len
);
704 ie_in_set(struct l3_process
*pc
, u8 ie
, int *checklist
) {
707 while (*checklist
!= -1) {
708 if ((*checklist
& 0xff) == ie
) {
721 check_infoelements(struct l3_process
*pc
, struct sk_buff
*skb
, int *checklist
)
726 int l
, newpos
, oldpos
;
727 int err_seq
= 0, err_len
= 0, err_compr
= 0, err_ureg
= 0;
739 while ((p
- skb
->data
) < skb
->len
) {
740 if ((*p
& 0xf0) == 0x90) { /* shift codeset */
741 old_codeset
= codeset
;
747 if (pc
->debug
& L3_DEB_CHECK
)
748 l3_debug(pc
->st
, "check IE shift%scodeset %d->%d",
749 codelock
? " locking ": " ", old_codeset
, codeset
);
753 if (!codeset
) { /* only codeset 0 */
754 if ((newpos
= ie_in_set(pc
, *p
, cl
))) {
762 if (ie_in_set(pc
, *p
, comp_required
))
776 if (!codeset
&& (l
> getmax_ie_len(ie
)))
779 if (pc
->debug
& L3_DEB_CHECK
)
780 l3_debug(pc
->st
, "check IE shift back codeset %d->%d",
781 codeset
, old_codeset
);
782 codeset
= old_codeset
;
786 if (err_compr
| err_ureg
| err_len
| err_seq
) {
787 if (pc
->debug
& L3_DEB_CHECK
)
788 l3_debug(pc
->st
, "check IE MT(%x) %d/%d/%d/%d",
789 mt
, err_compr
, err_ureg
, err_len
, err_seq
);
791 return(ERR_IE_COMPREHENSION
);
793 return(ERR_IE_UNRECOGNIZED
);
795 return(ERR_IE_LENGTH
);
797 return(ERR_IE_SEQUENCE
);
802 /* verify if a message type exists and contain no IE error */
804 l3dss1_check_messagetype_validity(struct l3_process
*pc
, int mt
, void *arg
)
808 case MT_CALL_PROCEEDING
:
810 case MT_CONNECT_ACKNOWLEDGE
:
817 case MT_RELEASE_COMPLETE
:
819 case MT_SETUP_ACKNOWLEDGE
:
820 case MT_RESUME_ACKNOWLEDGE
:
821 case MT_RESUME_REJECT
:
822 case MT_SUSPEND_ACKNOWLEDGE
:
823 case MT_SUSPEND_REJECT
:
824 case MT_USER_INFORMATION
:
826 case MT_RESTART_ACKNOWLEDGE
:
827 case MT_CONGESTION_CONTROL
:
829 case MT_STATUS_ENQUIRY
:
830 if (pc
->debug
& L3_DEB_CHECK
)
831 l3_debug(pc
->st
, "l3dss1_check_messagetype_validity mt(%x) OK", mt
);
833 case MT_RESUME
: /* RESUME only in user->net */
834 case MT_SUSPEND
: /* SUSPEND only in user->net */
836 if (pc
->debug
& (L3_DEB_CHECK
| L3_DEB_WARN
))
837 l3_debug(pc
->st
, "l3dss1_check_messagetype_validity mt(%x) fail", mt
);
839 l3dss1_status_send(pc
, 0, NULL
);
846 l3dss1_std_ie_err(struct l3_process
*pc
, int ret
) {
848 if (pc
->debug
& L3_DEB_CHECK
)
849 l3_debug(pc
->st
, "check_infoelements ret %d", ret
);
853 case ERR_IE_COMPREHENSION
:
855 l3dss1_status_send(pc
, 0, NULL
);
857 case ERR_IE_UNRECOGNIZED
:
859 l3dss1_status_send(pc
, 0, NULL
);
862 pc
->para
.cause
= 100;
863 l3dss1_status_send(pc
, 0, NULL
);
865 case ERR_IE_SEQUENCE
:
872 l3dss1_get_channel_id(struct l3_process
*pc
, struct sk_buff
*skb
) {
876 if ((p
= findie(p
, skb
->len
, IE_CHANNEL_ID
, 0))) {
878 if (*p
!= 1) { /* len for BRI = 1 */
879 if (pc
->debug
& L3_DEB_WARN
)
880 l3_debug(pc
->st
, "wrong chid len %d", *p
);
884 if (*p
& 0x60) { /* only base rate interface */
885 if (pc
->debug
& L3_DEB_WARN
)
886 l3_debug(pc
->st
, "wrong chid %x", *p
);
895 l3dss1_get_cause(struct l3_process
*pc
, struct sk_buff
*skb
) {
902 if ((p
= findie(p
, skb
->len
, IE_CAUSE
, 0))) {
913 if (l
&& !(pc
->para
.loc
& 0x80)) {
915 p
++; /* skip recommendation */
918 pc
->para
.cause
= *p
++;
920 if (!(pc
->para
.cause
& 0x80))
925 pc
->para
.diag
[i
++] = *p
++;
934 l3dss1_msg_with_uus(struct l3_process
*pc
, u8 cmd
)
941 MsgHead(p
, pc
->callref
, cmd
);
943 if (pc
->prot
.dss1
.uus1_data
[0])
944 { *p
++ = IE_USER_USER
; /* UUS info element */
945 *p
++ = strlen(pc
->prot
.dss1
.uus1_data
) + 1;
946 *p
++ = 0x04; /* IA5 chars */
947 strcpy(p
,pc
->prot
.dss1
.uus1_data
);
948 p
+= strlen(pc
->prot
.dss1
.uus1_data
);
949 pc
->prot
.dss1
.uus1_data
[0] = '\0';
953 if (!(skb
= l3_alloc_skb(l
)))
955 memcpy(skb_put(skb
, l
), tmp
, l
);
956 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
957 } /* l3dss1_msg_with_uus */
960 l3dss1_release_req(struct l3_process
*pc
, u8 pr
, void *arg
)
964 if (!pc
->prot
.dss1
.uus1_data
[0])
965 l3dss1_message(pc
, MT_RELEASE
);
967 l3dss1_msg_with_uus(pc
, MT_RELEASE
);
968 L3AddTimer(&pc
->timer
, T308
, CC_T308_1
);
972 l3dss1_release_cmpl(struct l3_process
*pc
, u8 pr
, void *arg
)
974 struct sk_buff
*skb
= arg
;
977 if ((ret
= l3dss1_get_cause(pc
, skb
))>0) {
978 if (pc
->debug
& L3_DEB_WARN
)
979 l3_debug(pc
->st
, "RELCMPL get_cause ret(%d)",ret
);
981 pc
->para
.cause
= NO_CAUSE
;
984 L3L4(pc
->st
, CC_RELEASE
| CONFIRM
, pc
);
985 dss1_release_l3_process(pc
);
991 EncodeASyncParams(u8
* p
, u8 si2
)
992 { // 7c 06 88 90 21 42 00 bb
995 p
[1] = 0x40; // Intermediate rate: 16 kbit/s jj 2000.02.19
997 if (si2
& 32) // 7 data bits
1004 if (si2
& 16) // 2 stop bits
1011 if (si2
& 8) // even parity
1018 switch (si2
& 0x07) {
1020 p
[0] = 66; // 1200 bit/s
1024 p
[0] = 88; // 1200/75 bit/s
1028 p
[0] = 87; // 75/1200 bit/s
1032 p
[0] = 67; // 2400 bit/s
1036 p
[0] = 69; // 4800 bit/s
1040 p
[0] = 72; // 9600 bit/s
1044 p
[0] = 73; // 14400 bit/s
1048 p
[0] = 75; // 19200 bit/s
1056 EncodeSyncParams(u8 si2
, u8 ai
)
1061 return ai
+ 2; // 1200 bit/s
1064 return ai
+ 24; // 1200/75 bit/s
1067 return ai
+ 23; // 75/1200 bit/s
1070 return ai
+ 3; // 2400 bit/s
1073 return ai
+ 5; // 4800 bit/s
1076 return ai
+ 8; // 9600 bit/s
1079 return ai
+ 9; // 14400 bit/s
1082 return ai
+ 11; // 19200 bit/s
1085 return ai
+ 14; // 48000 bit/s
1088 return ai
+ 15; // 56000 bit/s
1091 return ai
+ 40; // negotiate bit/s
1101 DecodeASyncParams(u8 si2
, u8
* p
)
1106 case 66: // 1200 bit/s
1108 break; // si2 don't change
1110 case 88: // 1200/75 bit/s
1114 case 87: // 75/1200 bit/s
1118 case 67: // 2400 bit/s
1122 case 69: // 4800 bit/s
1126 case 72: // 9600 bit/s
1130 case 73: // 14400 bit/s
1134 case 75: // 19200 bit/s
1141 if ((info
& 16) && (!(info
& 8))) // 7 data bits
1143 si2
+= 32; // else 8 data bits
1145 if ((info
& 96) == 96) // 2 stop bits
1147 si2
+= 16; // else 1 stop bit
1149 if ((info
& 2) && (!(info
& 1))) // even parity
1151 si2
+= 8; // else no parity
1158 DecodeSyncParams(u8 si2
, u8 info
)
1162 case 40: // bit/s negotiation failed ai := 165 not 175!
1165 case 15: // 56000 bit/s failed, ai := 0 not 169 !
1168 case 14: // 48000 bit/s
1171 case 11: // 19200 bit/s
1174 case 9: // 14400 bit/s
1177 case 8: // 9600 bit/s
1180 case 5: // 4800 bit/s
1183 case 3: // 2400 bit/s
1186 case 23: // 75/1200 bit/s
1189 case 24: // 1200/75 bit/s
1192 default: // 1200 bit/s
1199 DecodeSI2(struct sk_buff
*skb
)
1201 u8
*p
; //, *pend=skb->data + skb->len;
1203 if ((p
= findie(skb
->data
, skb
->len
, 0x7c, 0))) {
1204 switch (p
[4] & 0x0f) {
1206 if (p
[1] == 0x04) // sync. Bitratenadaption
1208 return DecodeSyncParams(160, p
[5]); // V.110/X.30
1210 else if (p
[1] == 0x06) // async. Bitratenadaption
1212 return DecodeASyncParams(192, p
); // V.110/X.30
1215 case 0x08: // if (p[5] == 0x02) // sync. Bitratenadaption
1217 return DecodeSyncParams(176, p
[5]); // V.120
1228 l3dss1_setup_req(struct l3_process
*pc
, u8 pr
,
1231 struct sk_buff
*skb
;
1244 MsgHead(p
, pc
->callref
, MT_SETUP
);
1246 teln
= pc
->para
.setup
.phone
;
1247 #ifndef CONFIG_HISAX_NO_KEYPAD
1248 send_keypad
= (strchr(teln
,'*') || strchr(teln
,'#')) ? 1 : 0;
1252 #ifndef CONFIG_HISAX_NO_SENDCOMPLETE
1254 *p
++ = 0xa1; /* complete indicator */
1257 * Set Bearer Capability, Map info from 1TR6-convention to EDSS1
1259 switch (pc
->para
.setup
.si1
) {
1260 case 1: /* Telephony */
1262 *p
++ = 0x3; /* Length */
1263 *p
++ = 0x90; /* Coding Std. CCITT, 3.1 kHz audio */
1264 *p
++ = 0x90; /* Circuit-Mode 64kbps */
1265 *p
++ = 0xa3; /* A-Law Audio */
1267 case 5: /* Datatransmission 64k, BTX */
1268 case 7: /* Datatransmission 64k */
1271 *p
++ = 0x2; /* Length */
1272 *p
++ = 0x88; /* Coding Std. CCITT, unrestr. dig. Inform. */
1273 *p
++ = 0x90; /* Circuit-Mode 64kbps */
1279 *p
++ = strlen(teln
);
1281 *p
++ = (*teln
++) & 0x7F;
1285 * What about info2? Mapping to High-Layer-Compatibility?
1287 if ((*teln
) && (!send_keypad
)) {
1288 /* parse number for special things */
1289 if (!isdigit(*teln
)) {
1290 switch (0x5f & *teln
) {
1309 if (pc
->debug
& L3_DEB_WARN
)
1310 l3_debug(pc
->st
, "Wrong MSN Code");
1317 *p
++ = IE_CHANNEL_ID
;
1321 msn
= pc
->para
.setup
.eazmsn
;
1332 *p
++ = IE_CALLING_PN
;
1333 *p
++ = strlen(msn
) + (screen
? 2 : 1);
1334 /* Classify as AnyPref. */
1336 *p
++ = 0x01; /* Ext = '0'B, Type = '000'B, Plan = '0001'B. */
1339 *p
++ = 0x81; /* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
1341 *p
++ = *msn
++ & 0x7f;
1345 *p
++ = IE_CALLING_SUB
;
1346 *p
++ = strlen(sub
) + 2;
1347 *p
++ = 0x80; /* NSAP coded */
1348 *p
++ = 0x50; /* local IDI format */
1350 *p
++ = *sub
++ & 0x7f;
1363 *p
++ = IE_CALLED_PN
;
1364 *p
++ = strlen(teln
) + 1;
1365 /* Classify as AnyPref. */
1366 *p
++ = 0x81; /* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
1368 *p
++ = *teln
++ & 0x7f;
1372 *p
++ = IE_CALLED_SUB
;
1373 *p
++ = strlen(sub
) + 2;
1374 *p
++ = 0x80; /* NSAP coded */
1375 *p
++ = 0x50; /* local IDI format */
1377 *p
++ = *sub
++ & 0x7f;
1381 if ((pc
->para
.setup
.si2
>= 160) && (pc
->para
.setup
.si2
<= 175)) { // sync. Bitratenadaption, V.110/X.30
1388 *p
++ = EncodeSyncParams(pc
->para
.setup
.si2
- 160, 0x80);
1389 } else if ((pc
->para
.setup
.si2
>= 176) && (pc
->para
.setup
.si2
<= 191)) { // sync. Bitratenadaption, V.120
1396 *p
++ = EncodeSyncParams(pc
->para
.setup
.si2
- 176, 0);
1398 } else if (pc
->para
.setup
.si2
>= 192) { // async. Bitratenadaption, V.110/X.30
1405 p
= EncodeASyncParams(p
, pc
->para
.setup
.si2
- 192);
1406 #ifndef CONFIG_HISAX_NO_LLC
1408 switch (pc
->para
.setup
.si1
) {
1409 case 1: /* Telephony */
1411 *p
++ = 0x3; /* Length */
1412 *p
++ = 0x90; /* Coding Std. CCITT, 3.1 kHz audio */
1413 *p
++ = 0x90; /* Circuit-Mode 64kbps */
1414 *p
++ = 0xa3; /* A-Law Audio */
1416 case 5: /* Datatransmission 64k, BTX */
1417 case 7: /* Datatransmission 64k */
1420 *p
++ = 0x2; /* Length */
1421 *p
++ = 0x88; /* Coding Std. CCITT, unrestr. dig. Inform. */
1422 *p
++ = 0x90; /* Circuit-Mode 64kbps */
1429 if (!(skb
= l3_alloc_skb(l
)))
1431 memcpy(skb_put(skb
, l
), tmp
, l
);
1432 L3DelTimer(&pc
->timer
);
1433 L3AddTimer(&pc
->timer
, T303
, CC_T303
);
1435 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
1439 l3dss1_call_proc(struct l3_process
*pc
, u8 pr
, void *arg
)
1441 struct sk_buff
*skb
= arg
;
1444 if ((id
= l3dss1_get_channel_id(pc
, skb
)) >= 0) {
1445 if ((0 == id
) || ((3 == id
) && (0x10 == pc
->para
.moderate
))) {
1446 if (pc
->debug
& L3_DEB_WARN
)
1447 l3_debug(pc
->st
, "setup answer with wrong chid %x", id
);
1448 pc
->para
.cause
= 100;
1449 l3dss1_status_send(pc
, pr
, NULL
);
1452 pc
->para
.bchannel
= id
;
1453 } else if (1 == pc
->state
) {
1454 if (pc
->debug
& L3_DEB_WARN
)
1455 l3_debug(pc
->st
, "setup answer wrong chid (ret %d)", id
);
1457 pc
->para
.cause
= 96;
1459 pc
->para
.cause
= 100;
1460 l3dss1_status_send(pc
, pr
, NULL
);
1463 /* Now we are on none mandatory IEs */
1464 ret
= check_infoelements(pc
, skb
, ie_CALL_PROCEEDING
);
1465 if (ERR_IE_COMPREHENSION
== ret
) {
1466 l3dss1_std_ie_err(pc
, ret
);
1469 L3DelTimer(&pc
->timer
);
1471 L3AddTimer(&pc
->timer
, T310
, CC_T310
);
1472 if (ret
) /* STATUS for none mandatory IE errors after actions are taken */
1473 l3dss1_std_ie_err(pc
, ret
);
1474 L3L4(pc
->st
, CC_PROCEEDING
| INDICATION
, pc
);
1478 l3dss1_setup_ack(struct l3_process
*pc
, u8 pr
, void *arg
)
1480 struct sk_buff
*skb
= arg
;
1483 if ((id
= l3dss1_get_channel_id(pc
, skb
)) >= 0) {
1484 if ((0 == id
) || ((3 == id
) && (0x10 == pc
->para
.moderate
))) {
1485 if (pc
->debug
& L3_DEB_WARN
)
1486 l3_debug(pc
->st
, "setup answer with wrong chid %x", id
);
1487 pc
->para
.cause
= 100;
1488 l3dss1_status_send(pc
, pr
, NULL
);
1491 pc
->para
.bchannel
= id
;
1493 if (pc
->debug
& L3_DEB_WARN
)
1494 l3_debug(pc
->st
, "setup answer wrong chid (ret %d)", id
);
1496 pc
->para
.cause
= 96;
1498 pc
->para
.cause
= 100;
1499 l3dss1_status_send(pc
, pr
, NULL
);
1502 /* Now we are on none mandatory IEs */
1503 ret
= check_infoelements(pc
, skb
, ie_SETUP_ACKNOWLEDGE
);
1504 if (ERR_IE_COMPREHENSION
== ret
) {
1505 l3dss1_std_ie_err(pc
, ret
);
1508 L3DelTimer(&pc
->timer
);
1510 L3AddTimer(&pc
->timer
, T304
, CC_T304
);
1511 if (ret
) /* STATUS for none mandatory IE errors after actions are taken */
1512 l3dss1_std_ie_err(pc
, ret
);
1513 L3L4(pc
->st
, CC_MORE_INFO
| INDICATION
, pc
);
1517 l3dss1_disconnect(struct l3_process
*pc
, u8 pr
, void *arg
)
1519 struct sk_buff
*skb
= arg
;
1525 if ((ret
= l3dss1_get_cause(pc
, skb
))) {
1526 if (pc
->debug
& L3_DEB_WARN
)
1527 l3_debug(pc
->st
, "DISC get_cause ret(%d)", ret
);
1533 if ((p
= findie(skb
->data
, skb
->len
, IE_FACILITY
, 0)))
1534 l3dss1_parse_facility(pc
->st
, pc
, pc
->callref
, p
);
1535 ret
= check_infoelements(pc
, skb
, ie_DISCONNECT
);
1536 if (ERR_IE_COMPREHENSION
== ret
)
1538 else if ((!cause
) && (ERR_IE_UNRECOGNIZED
== ret
))
1545 L3L4(pc
->st
, CC_DISCONNECT
| INDICATION
, pc
);
1547 l3dss1_release_req(pc
, pr
, NULL
);
1549 l3dss1_message_cause(pc
, MT_RELEASE
, cause
);
1550 L3AddTimer(&pc
->timer
, T308
, CC_T308_1
);
1555 l3dss1_connect(struct l3_process
*pc
, u8 pr
, void *arg
)
1557 struct sk_buff
*skb
= arg
;
1560 ret
= check_infoelements(pc
, skb
, ie_CONNECT
);
1561 if (ERR_IE_COMPREHENSION
== ret
) {
1562 l3dss1_std_ie_err(pc
, ret
);
1565 L3DelTimer(&pc
->timer
); /* T310 */
1567 pc
->para
.chargeinfo
= 0;
1568 /* here should inserted COLP handling KKe */
1570 l3dss1_std_ie_err(pc
, ret
);
1571 L3L4(pc
->st
, CC_SETUP
| CONFIRM
, pc
);
1575 l3dss1_alerting(struct l3_process
*pc
, u8 pr
, void *arg
)
1577 struct sk_buff
*skb
= arg
;
1580 ret
= check_infoelements(pc
, skb
, ie_ALERTING
);
1581 if (ERR_IE_COMPREHENSION
== ret
) {
1582 l3dss1_std_ie_err(pc
, ret
);
1585 L3DelTimer(&pc
->timer
); /* T304 */
1588 l3dss1_std_ie_err(pc
, ret
);
1589 L3L4(pc
->st
, CC_ALERTING
| INDICATION
, pc
);
1593 l3dss1_setup(struct l3_process
*pc
, u8 pr
, void *arg
)
1598 struct sk_buff
*skb
= arg
;
1603 * Bearer Capabilities
1606 /* only the first occurrence 'll be detected ! */
1607 if ((p
= findie(p
, skb
->len
, 0x04, 0))) {
1608 if ((p
[1] < 2) || (p
[1] > 11))
1611 pc
->para
.setup
.si2
= 0;
1612 switch (p
[2] & 0x7f) {
1613 case 0x00: /* Speech */
1614 case 0x10: /* 3.1 Khz audio */
1615 pc
->para
.setup
.si1
= 1;
1617 case 0x08: /* Unrestricted digital information */
1618 pc
->para
.setup
.si1
= 7;
1619 /* JIM, 05.11.97 I wanna set service indicator 2 */
1621 pc
->para
.setup
.si2
= DecodeSI2(skb
);
1624 case 0x09: /* Restricted digital information */
1625 pc
->para
.setup
.si1
= 2;
1628 /* Unrestr. digital information with
1629 * tones/announcements ( or 7 kHz audio
1631 pc
->para
.setup
.si1
= 3;
1633 case 0x18: /* Video */
1634 pc
->para
.setup
.si1
= 4;
1640 switch (p
[3] & 0x7f) {
1641 case 0x40: /* packed mode */
1642 pc
->para
.setup
.si1
= 8;
1644 case 0x10: /* 64 kbit */
1645 case 0x11: /* 2*64 kbit */
1646 case 0x13: /* 384 kbit */
1647 case 0x15: /* 1536 kbit */
1648 case 0x17: /* 1920 kbit */
1649 pc
->para
.moderate
= p
[3] & 0x7f;
1656 if (pc
->debug
& L3_DEB_SI
)
1657 l3_debug(pc
->st
, "SI=%d, AI=%d",
1658 pc
->para
.setup
.si1
, pc
->para
.setup
.si2
);
1660 if (pc
->debug
& L3_DEB_WARN
)
1661 l3_debug(pc
->st
, "setup with wrong bearer(l=%d:%x,%x)",
1663 pc
->para
.cause
= 100;
1664 l3dss1_msg_without_setup(pc
, pr
, NULL
);
1668 if (pc
->debug
& L3_DEB_WARN
)
1669 l3_debug(pc
->st
, "setup without bearer capabilities");
1670 /* ETS 300-104 1.3.3 */
1671 pc
->para
.cause
= 96;
1672 l3dss1_msg_without_setup(pc
, pr
, NULL
);
1676 * Channel Identification
1678 if ((id
= l3dss1_get_channel_id(pc
, skb
)) >= 0) {
1679 if ((pc
->para
.bchannel
= id
)) {
1680 if ((3 == id
) && (0x10 == pc
->para
.moderate
)) {
1681 if (pc
->debug
& L3_DEB_WARN
)
1682 l3_debug(pc
->st
, "setup with wrong chid %x",
1684 pc
->para
.cause
= 100;
1685 l3dss1_msg_without_setup(pc
, pr
, NULL
);
1690 { if (pc
->debug
& L3_DEB_WARN
)
1691 l3_debug(pc
->st
, "setup without bchannel, call waiting");
1695 if (pc
->debug
& L3_DEB_WARN
)
1696 l3_debug(pc
->st
, "setup with wrong chid ret %d", id
);
1698 pc
->para
.cause
= 96;
1700 pc
->para
.cause
= 100;
1701 l3dss1_msg_without_setup(pc
, pr
, NULL
);
1704 /* Now we are on none mandatory IEs */
1705 err
= check_infoelements(pc
, skb
, ie_SETUP
);
1706 if (ERR_IE_COMPREHENSION
== err
) {
1707 pc
->para
.cause
= 96;
1708 l3dss1_msg_without_setup(pc
, pr
, NULL
);
1712 if ((p
= findie(p
, skb
->len
, 0x70, 0)))
1713 iecpy(pc
->para
.setup
.eazmsn
, p
, 1);
1715 pc
->para
.setup
.eazmsn
[0] = 0;
1718 if ((p
= findie(p
, skb
->len
, 0x71, 0))) {
1719 /* Called party subaddress */
1720 if ((p
[1] >= 2) && (p
[2] == 0x80) && (p
[3] == 0x50)) {
1722 iecpy(&tmp
[1], p
, 2);
1723 strcat(pc
->para
.setup
.eazmsn
, tmp
);
1724 } else if (pc
->debug
& L3_DEB_WARN
)
1725 l3_debug(pc
->st
, "wrong called subaddress");
1728 if ((p
= findie(p
, skb
->len
, 0x6c, 0))) {
1729 pc
->para
.setup
.plan
= p
[2];
1731 iecpy(pc
->para
.setup
.phone
, p
, 1);
1732 pc
->para
.setup
.screen
= 0;
1734 iecpy(pc
->para
.setup
.phone
, p
, 2);
1735 pc
->para
.setup
.screen
= p
[3];
1738 pc
->para
.setup
.phone
[0] = 0;
1739 pc
->para
.setup
.plan
= 0;
1740 pc
->para
.setup
.screen
= 0;
1743 if ((p
= findie(p
, skb
->len
, 0x6d, 0))) {
1744 /* Calling party subaddress */
1745 if ((p
[1] >= 2) && (p
[2] == 0x80) && (p
[3] == 0x50)) {
1747 iecpy(&tmp
[1], p
, 2);
1748 strcat(pc
->para
.setup
.phone
, tmp
);
1749 } else if (pc
->debug
& L3_DEB_WARN
)
1750 l3_debug(pc
->st
, "wrong calling subaddress");
1753 if (err
) /* STATUS for none mandatory IE errors after actions are taken */
1754 l3dss1_std_ie_err(pc
, err
);
1755 L3L4(pc
->st
, CC_SETUP
| INDICATION
, pc
);
1759 l3dss1_reset(struct l3_process
*pc
, u8 pr
, void *arg
)
1761 dss1_release_l3_process(pc
);
1765 l3dss1_disconnect_req(struct l3_process
*pc
, u8 pr
, void *arg
)
1767 struct sk_buff
*skb
;
1773 if (pc
->para
.cause
!= NO_CAUSE
)
1774 cause
= pc
->para
.cause
;
1778 MsgHead(p
, pc
->callref
, MT_DISCONNECT
);
1783 *p
++ = cause
| 0x80;
1785 if (pc
->prot
.dss1
.uus1_data
[0])
1786 { *p
++ = IE_USER_USER
; /* UUS info element */
1787 *p
++ = strlen(pc
->prot
.dss1
.uus1_data
) + 1;
1788 *p
++ = 0x04; /* IA5 chars */
1789 strcpy(p
,pc
->prot
.dss1
.uus1_data
);
1790 p
+= strlen(pc
->prot
.dss1
.uus1_data
);
1791 pc
->prot
.dss1
.uus1_data
[0] = '\0';
1795 if (!(skb
= l3_alloc_skb(l
)))
1797 memcpy(skb_put(skb
, l
), tmp
, l
);
1799 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
1800 L3AddTimer(&pc
->timer
, T305
, CC_T305
);
1804 l3dss1_setup_rsp(struct l3_process
*pc
, u8 pr
,
1807 if (!pc
->para
.bchannel
)
1808 { if (pc
->debug
& L3_DEB_WARN
)
1809 l3_debug(pc
->st
, "D-chan connect for waiting call");
1810 l3dss1_disconnect_req(pc
, pr
, arg
);
1814 l3dss1_message(pc
, MT_CONNECT
);
1815 L3DelTimer(&pc
->timer
);
1816 L3AddTimer(&pc
->timer
, T313
, CC_T313
);
1820 l3dss1_connect_ack(struct l3_process
*pc
, u8 pr
, void *arg
)
1822 struct sk_buff
*skb
= arg
;
1825 ret
= check_infoelements(pc
, skb
, ie_CONNECT_ACKNOWLEDGE
);
1826 if (ERR_IE_COMPREHENSION
== ret
) {
1827 l3dss1_std_ie_err(pc
, ret
);
1831 L3DelTimer(&pc
->timer
);
1833 l3dss1_std_ie_err(pc
, ret
);
1834 L3L4(pc
->st
, CC_SETUP_COMPL
| INDICATION
, pc
);
1838 l3dss1_reject_req(struct l3_process
*pc
, u8 pr
, void *arg
)
1840 struct sk_buff
*skb
;
1846 if (pc
->para
.cause
!= NO_CAUSE
)
1847 cause
= pc
->para
.cause
;
1849 MsgHead(p
, pc
->callref
, MT_RELEASE_COMPLETE
);
1854 *p
++ = cause
| 0x80;
1857 if (!(skb
= l3_alloc_skb(l
)))
1859 memcpy(skb_put(skb
, l
), tmp
, l
);
1860 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
1861 L3L4(pc
->st
, CC_RELEASE
| INDICATION
, pc
);
1863 dss1_release_l3_process(pc
);
1867 l3dss1_release(struct l3_process
*pc
, u8 pr
, void *arg
)
1869 struct sk_buff
*skb
= arg
;
1874 if ((ret
= l3dss1_get_cause(pc
, skb
))>0) {
1875 if (pc
->debug
& L3_DEB_WARN
)
1876 l3_debug(pc
->st
, "REL get_cause ret(%d)", ret
);
1878 pc
->para
.cause
= NO_CAUSE
;
1879 if ((p
= findie(skb
->data
, skb
->len
, IE_FACILITY
, 0))) {
1880 l3dss1_parse_facility(pc
->st
, pc
, pc
->callref
, p
);
1882 if ((ret
<0) && (pc
->state
!= 11))
1886 ret
= check_infoelements(pc
, skb
, ie_RELEASE
);
1887 if (ERR_IE_COMPREHENSION
== ret
)
1889 else if ((ERR_IE_UNRECOGNIZED
== ret
) && (!cause
))
1892 l3dss1_message_cause(pc
, MT_RELEASE_COMPLETE
, cause
);
1894 l3dss1_message(pc
, MT_RELEASE_COMPLETE
);
1895 L3L4(pc
->st
, CC_RELEASE
| INDICATION
, pc
);
1897 dss1_release_l3_process(pc
);
1901 l3dss1_alert_req(struct l3_process
*pc
, u8 pr
,
1905 if (!pc
->prot
.dss1
.uus1_data
[0])
1906 l3dss1_message(pc
, MT_ALERTING
);
1908 l3dss1_msg_with_uus(pc
, MT_ALERTING
);
1912 l3dss1_proceed_req(struct l3_process
*pc
, u8 pr
,
1916 l3dss1_message(pc
, MT_CALL_PROCEEDING
);
1917 L3L4(pc
->st
, CC_PROCEED_SEND
| INDICATION
, pc
);
1921 l3dss1_setup_ack_req(struct l3_process
*pc
, u8 pr
,
1925 L3DelTimer(&pc
->timer
);
1926 L3AddTimer(&pc
->timer
, T302
, CC_T302
);
1927 l3dss1_message(pc
, MT_SETUP_ACKNOWLEDGE
);
1930 /********************************************/
1931 /* deliver a incoming display message to HL */
1932 /********************************************/
1934 l3dss1_deliver_display(struct l3_process
*pc
, int pr
, u8
*infp
)
1937 struct IsdnCardState
*cs
;
1940 if (*infp
++ != IE_DISPLAY
) return;
1941 if ((len
= *infp
++) > 80) return; /* total length <= 82 */
1942 if (!pc
->chan
) return;
1944 p
= ic
.parm
.display
;
1948 ic
.command
= ISDN_STAT_DISPLAY
;
1949 cs
= pc
->st
->l1
.hardware
;
1950 ic
.driver
= cs
->myid
;
1951 ic
.arg
= pc
->chan
->chan
;
1952 cs
->iif
.statcallb(&ic
);
1953 } /* l3dss1_deliver_display */
1957 l3dss1_progress(struct l3_process
*pc
, u8 pr
, void *arg
)
1959 struct sk_buff
*skb
= arg
;
1963 if ((p
= findie(skb
->data
, skb
->len
, IE_PROGRESS
, 0))) {
1966 pc
->para
.cause
= 100;
1967 } else if (!(p
[2] & 0x70)) {
1985 pc
->para
.cause
= 100;
1991 pc
->para
.cause
= 100;
1996 pc
->para
.cause
= 96;
2000 if (pc
->debug
& L3_DEB_WARN
)
2001 l3_debug(pc
->st
, "progress error %d", err
);
2002 l3dss1_status_send(pc
, pr
, NULL
);
2005 /* Now we are on none mandatory IEs */
2006 err
= check_infoelements(pc
, skb
, ie_PROGRESS
);
2008 l3dss1_std_ie_err(pc
, err
);
2009 if (ERR_IE_COMPREHENSION
!= err
)
2010 L3L4(pc
->st
, CC_PROGRESS
| INDICATION
, pc
);
2014 l3dss1_notify(struct l3_process
*pc
, u8 pr
, void *arg
)
2016 struct sk_buff
*skb
= arg
;
2020 if ((p
= findie(skb
->data
, skb
->len
, IE_NOTIFY
, 0))) {
2023 pc
->para
.cause
= 100;
2031 pc
->para
.cause
= 100;
2037 pc
->para
.cause
= 96;
2041 if (pc
->debug
& L3_DEB_WARN
)
2042 l3_debug(pc
->st
, "notify error %d", err
);
2043 l3dss1_status_send(pc
, pr
, NULL
);
2046 /* Now we are on none mandatory IEs */
2047 err
= check_infoelements(pc
, skb
, ie_NOTIFY
);
2049 l3dss1_std_ie_err(pc
, err
);
2050 if (ERR_IE_COMPREHENSION
!= err
)
2051 L3L4(pc
->st
, CC_NOTIFY
| INDICATION
, pc
);
2055 l3dss1_status_enq(struct l3_process
*pc
, u8 pr
, void *arg
)
2058 struct sk_buff
*skb
= arg
;
2060 ret
= check_infoelements(pc
, skb
, ie_STATUS_ENQUIRY
);
2061 l3dss1_std_ie_err(pc
, ret
);
2062 pc
->para
.cause
= 30; /* response to STATUS_ENQUIRY */
2063 l3dss1_status_send(pc
, pr
, NULL
);
2067 l3dss1_information(struct l3_process
*pc
, u8 pr
, void *arg
)
2070 struct sk_buff
*skb
= arg
;
2074 ret
= check_infoelements(pc
, skb
, ie_INFORMATION
);
2076 l3dss1_std_ie_err(pc
, ret
);
2077 if (pc
->state
== 25) { /* overlap receiving */
2078 L3DelTimer(&pc
->timer
);
2080 if ((p
= findie(p
, skb
->len
, 0x70, 0))) {
2082 strcat(pc
->para
.setup
.eazmsn
, tmp
);
2083 L3L4(pc
->st
, CC_MORE_INFO
| INDICATION
, pc
);
2085 L3AddTimer(&pc
->timer
, T302
, CC_T302
);
2089 /******************************/
2090 /* handle deflection requests */
2091 /******************************/
2092 static void l3dss1_redir_req(struct l3_process
*pc
, u8 pr
, void *arg
)
2094 struct sk_buff
*skb
;
2103 strcpy(pc
->prot
.dss1
.uus1_data
,pc
->chan
->setup
.eazmsn
); /* copy uus element if available */
2104 if (!pc
->chan
->setup
.phone
[0])
2105 { pc
->para
.cause
= -1;
2106 l3dss1_disconnect_req(pc
,pr
,arg
); /* disconnect immediately */
2110 if (pc
->prot
.dss1
.invoke_id
)
2111 free_invoke_id(pc
->st
,pc
->prot
.dss1
.invoke_id
);
2113 if (!(pc
->prot
.dss1
.invoke_id
= new_invoke_id(pc
->st
)))
2116 MsgHead(p
, pc
->callref
, MT_FACILITY
);
2118 for (subp
= pc
->chan
->setup
.phone
; (*subp
) && (*subp
!= '.'); subp
++) len_phone
++; /* len of phone number */
2119 if (*subp
++ == '.') len_sub
= strlen(subp
) + 2; /* length including info subaddress element */
2121 *p
++ = 0x1c; /* Facility info element */
2122 *p
++ = len_phone
+ len_sub
+ 2 + 2 + 8 + 3 + 3; /* length of element */
2123 *p
++ = 0x91; /* remote operations protocol */
2124 *p
++ = 0xa1; /* invoke component */
2126 *p
++ = len_phone
+ len_sub
+ 2 + 2 + 8 + 3; /* length of data */
2127 *p
++ = 0x02; /* invoke id tag, integer */
2128 *p
++ = 0x01; /* length */
2129 *p
++ = pc
->prot
.dss1
.invoke_id
; /* invoke id */
2130 *p
++ = 0x02; /* operation value tag, integer */
2131 *p
++ = 0x01; /* length */
2132 *p
++ = 0x0D; /* Call Deflect */
2134 *p
++ = 0x30; /* sequence phone number */
2135 *p
++ = len_phone
+ 2 + 2 + 3 + len_sub
; /* length */
2137 *p
++ = 0x30; /* Deflected to UserNumber */
2138 *p
++ = len_phone
+2+len_sub
; /* length */
2139 *p
++ = 0x80; /* NumberDigits */
2140 *p
++ = len_phone
; /* length */
2141 for (l
= 0; l
< len_phone
; l
++)
2142 *p
++ = pc
->chan
->setup
.phone
[l
];
2145 { *p
++ = 0x04; /* called party subaddress */
2147 while (*subp
) *p
++ = *subp
++;
2150 *p
++ = 0x01; /* screening identifier */
2152 *p
++ = pc
->chan
->setup
.screen
;
2155 if (!(skb
= l3_alloc_skb(l
))) return;
2156 memcpy(skb_put(skb
, l
), tmp
, l
);
2158 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
2159 } /* l3dss1_redir_req */
2161 /********************************************/
2162 /* handle deflection request in early state */
2163 /********************************************/
2164 static void l3dss1_redir_req_early(struct l3_process
*pc
, u8 pr
, void *arg
)
2166 l3dss1_proceed_req(pc
,pr
,arg
);
2167 l3dss1_redir_req(pc
,pr
,arg
);
2168 } /* l3dss1_redir_req_early */
2170 /***********************************************/
2171 /* handle special commands for this protocol. */
2172 /* Examples are call independent services like */
2173 /* remote operations with dummy callref. */
2174 /***********************************************/
2175 static int l3dss1_cmd_global(struct PStack
*st
, isdn_ctrl
*ic
)
2180 struct sk_buff
*skb
;
2181 struct l3_process
*pc
= NULL
;
2184 { case DSS1_CMD_INVOKE
:
2185 if (ic
->parm
.dss1_io
.datalen
< 0) return(-2); /* invalid parameter */
2187 for (proc_len
= 1, i
= ic
->parm
.dss1_io
.proc
>> 8; i
; i
++)
2188 i
= i
>> 8; /* add one byte */
2189 l
= ic
->parm
.dss1_io
.datalen
+ proc_len
+ 8; /* length excluding ie header */
2191 return(-2); /* too long */
2193 if (!(id
= new_invoke_id(st
)))
2194 return(0); /* first get a invoke id -> return if no available */
2197 MsgHead(p
, i
, MT_FACILITY
); /* build message head */
2198 *p
++ = 0x1C; /* Facility IE */
2199 *p
++ = l
; /* length of ie */
2200 *p
++ = 0x91; /* remote operations */
2201 *p
++ = 0xA1; /* invoke */
2202 *p
++ = l
- 3; /* length of invoke */
2203 *p
++ = 0x02; /* invoke id tag */
2204 *p
++ = 0x01; /* length is 1 */
2205 *p
++ = id
; /* invoke id */
2206 *p
++ = 0x02; /* operation */
2207 *p
++ = proc_len
; /* length of operation */
2209 for (i
= proc_len
; i
; i
--)
2210 *p
++ = (ic
->parm
.dss1_io
.proc
>> (i
-1)) & 0xFF;
2211 memcpy(p
, ic
->parm
.dss1_io
.data
, ic
->parm
.dss1_io
.datalen
); /* copy data */
2212 l
= (p
- temp
) + ic
->parm
.dss1_io
.datalen
; /* total length */
2214 if (ic
->parm
.dss1_io
.timeout
> 0)
2215 if (!(pc
= dss1_new_l3_process(st
, -1)))
2216 { free_invoke_id(st
, id
);
2219 pc
->prot
.dss1
.ll_id
= ic
->parm
.dss1_io
.ll_id
; /* remember id */
2220 pc
->prot
.dss1
.proc
= ic
->parm
.dss1_io
.proc
; /* and procedure */
2222 if (!(skb
= l3_alloc_skb(l
)))
2223 { free_invoke_id(st
, id
);
2224 if (pc
) dss1_release_l3_process(pc
);
2227 memcpy(skb_put(skb
, l
), temp
, l
);
2230 { pc
->prot
.dss1
.invoke_id
= id
; /* remember id */
2231 L3AddTimer(&pc
->timer
, ic
->parm
.dss1_io
.timeout
, CC_TDSS1_IO
| REQUEST
);
2234 l3_msg(st
, DL_DATA
| REQUEST
, skb
);
2235 ic
->parm
.dss1_io
.hl_id
= id
; /* return id */
2238 case DSS1_CMD_INVOKE_ABORT
:
2239 if ((pc
= l3dss1_search_dummy_proc(st
, ic
->parm
.dss1_io
.hl_id
)))
2240 { L3DelTimer(&pc
->timer
); /* remove timer */
2241 dss1_release_l3_process(pc
);
2245 { l3_debug(st
, "l3dss1_cmd_global abort unknown id");
2251 l3_debug(st
, "l3dss1_cmd_global unknown cmd 0x%lx", ic
->arg
);
2253 } /* switch ic-> arg */
2255 } /* l3dss1_cmd_global */
2258 l3dss1_io_timer(struct l3_process
*pc
)
2260 struct IsdnCardState
*cs
= pc
->st
->l1
.hardware
;
2262 L3DelTimer(&pc
->timer
); /* remove timer */
2264 ic
.driver
= cs
->myid
;
2265 ic
.command
= ISDN_STAT_PROT
;
2266 ic
.arg
= DSS1_STAT_INVOKE_ERR
;
2267 ic
.parm
.dss1_io
.hl_id
= pc
->prot
.dss1
.invoke_id
;
2268 ic
.parm
.dss1_io
.ll_id
= pc
->prot
.dss1
.ll_id
;
2269 ic
.parm
.dss1_io
.proc
= pc
->prot
.dss1
.proc
;
2270 ic
.parm
.dss1_io
.timeout
= -1;
2271 ic
.parm
.dss1_io
.datalen
= 0;
2272 ic
.parm
.dss1_io
.data
= NULL
;
2273 free_invoke_id(pc
->st
, pc
->prot
.dss1
.invoke_id
);
2274 pc
->prot
.dss1
.invoke_id
= 0; /* reset id */
2276 cs
->iif
.statcallb(&ic
);
2278 dss1_release_l3_process(pc
);
2279 } /* l3dss1_io_timer */
2282 l3dss1_release_ind(struct l3_process
*pc
, u8 pr
, void *arg
)
2285 struct sk_buff
*skb
= arg
;
2289 if ((p
= findie(p
, skb
->len
, IE_CALL_STATE
, 0))) {
2294 if (callState
== 0) {
2295 /* ETS 300-104 7.6.1, 8.6.1, 10.6.1... and 16.1
2296 * set down layer 3 without sending any message
2298 L3L4(pc
->st
, CC_RELEASE
| INDICATION
, pc
);
2300 dss1_release_l3_process(pc
);
2302 L3L4(pc
->st
, CC_IGNORE
| INDICATION
, pc
);
2307 l3dss1_dummy(struct l3_process
*pc
, u8 pr
, void *arg
)
2312 l3dss1_t302(struct l3_process
*pc
, u8 pr
, void *arg
)
2314 L3DelTimer(&pc
->timer
);
2316 pc
->para
.cause
= 28; /* invalid number */
2317 l3dss1_disconnect_req(pc
, pr
, NULL
);
2318 L3L4(pc
->st
, CC_SETUP_ERR
, pc
);
2322 l3dss1_t303(struct l3_process
*pc
, u8 pr
, void *arg
)
2326 L3DelTimer(&pc
->timer
);
2327 l3dss1_setup_req(pc
, pr
, arg
);
2329 L3DelTimer(&pc
->timer
);
2330 l3dss1_message_cause(pc
, MT_RELEASE_COMPLETE
, 102);
2331 L3L4(pc
->st
, CC_NOSETUP_RSP
, pc
);
2332 dss1_release_l3_process(pc
);
2337 l3dss1_t304(struct l3_process
*pc
, u8 pr
, void *arg
)
2339 L3DelTimer(&pc
->timer
);
2341 pc
->para
.cause
= 102;
2342 l3dss1_disconnect_req(pc
, pr
, NULL
);
2343 L3L4(pc
->st
, CC_SETUP_ERR
, pc
);
2348 l3dss1_t305(struct l3_process
*pc
, u8 pr
, void *arg
)
2353 struct sk_buff
*skb
;
2356 L3DelTimer(&pc
->timer
);
2357 if (pc
->para
.cause
!= NO_CAUSE
)
2358 cause
= pc
->para
.cause
;
2360 MsgHead(p
, pc
->callref
, MT_RELEASE
);
2365 *p
++ = cause
| 0x80;
2368 if (!(skb
= l3_alloc_skb(l
)))
2370 memcpy(skb_put(skb
, l
), tmp
, l
);
2372 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
2373 L3AddTimer(&pc
->timer
, T308
, CC_T308_1
);
2377 l3dss1_t310(struct l3_process
*pc
, u8 pr
, void *arg
)
2379 L3DelTimer(&pc
->timer
);
2381 pc
->para
.cause
= 102;
2382 l3dss1_disconnect_req(pc
, pr
, NULL
);
2383 L3L4(pc
->st
, CC_SETUP_ERR
, pc
);
2387 l3dss1_t313(struct l3_process
*pc
, u8 pr
, void *arg
)
2389 L3DelTimer(&pc
->timer
);
2391 pc
->para
.cause
= 102;
2392 l3dss1_disconnect_req(pc
, pr
, NULL
);
2393 L3L4(pc
->st
, CC_CONNECT_ERR
, pc
);
2397 l3dss1_t308_1(struct l3_process
*pc
, u8 pr
, void *arg
)
2400 L3DelTimer(&pc
->timer
);
2401 l3dss1_message(pc
, MT_RELEASE
);
2402 L3AddTimer(&pc
->timer
, T308
, CC_T308_2
);
2406 l3dss1_t308_2(struct l3_process
*pc
, u8 pr
, void *arg
)
2408 L3DelTimer(&pc
->timer
);
2409 L3L4(pc
->st
, CC_RELEASE_ERR
, pc
);
2410 dss1_release_l3_process(pc
);
2414 l3dss1_t318(struct l3_process
*pc
, u8 pr
, void *arg
)
2416 L3DelTimer(&pc
->timer
);
2417 pc
->para
.cause
= 102; /* Timer expiry */
2418 pc
->para
.loc
= 0; /* local */
2419 L3L4(pc
->st
, CC_RESUME_ERR
, pc
);
2421 l3dss1_message(pc
, MT_RELEASE
);
2422 L3AddTimer(&pc
->timer
, T308
, CC_T308_1
);
2426 l3dss1_t319(struct l3_process
*pc
, u8 pr
, void *arg
)
2428 L3DelTimer(&pc
->timer
);
2429 pc
->para
.cause
= 102; /* Timer expiry */
2430 pc
->para
.loc
= 0; /* local */
2431 L3L4(pc
->st
, CC_SUSPEND_ERR
, pc
);
2436 l3dss1_restart(struct l3_process
*pc
, u8 pr
, void *arg
)
2438 L3DelTimer(&pc
->timer
);
2439 L3L4(pc
->st
, CC_RELEASE
| INDICATION
, pc
);
2440 dss1_release_l3_process(pc
);
2444 l3dss1_status(struct l3_process
*pc
, u8 pr
, void *arg
)
2447 struct sk_buff
*skb
= arg
;
2449 u8 cause
= 0, callState
= 0;
2451 if ((ret
= l3dss1_get_cause(pc
, skb
))) {
2452 if (pc
->debug
& L3_DEB_WARN
)
2453 l3_debug(pc
->st
, "STATUS get_cause ret(%d)",ret
);
2459 if ((p
= findie(skb
->data
, skb
->len
, IE_CALL_STATE
, 0))) {
2463 if (!ie_in_set(pc
, *p
, l3_valid_states
))
2469 if (!cause
) { /* no error before */
2470 ret
= check_infoelements(pc
, skb
, ie_STATUS
);
2471 if (ERR_IE_COMPREHENSION
== ret
)
2473 else if (ERR_IE_UNRECOGNIZED
== ret
)
2479 if (pc
->debug
& L3_DEB_WARN
)
2480 l3_debug(pc
->st
, "STATUS error(%d/%d)",ret
,cause
);
2481 tmp
= pc
->para
.cause
;
2482 pc
->para
.cause
= cause
;
2483 l3dss1_status_send(pc
, 0, NULL
);
2485 pc
->para
.cause
= tmp
;
2489 cause
= pc
->para
.cause
;
2490 if (((cause
& 0x7f) == 111) && (callState
== 0)) {
2491 /* ETS 300-104 7.6.1, 8.6.1, 10.6.1...
2492 * if received MT_STATUS with cause == 111 and call
2493 * state == 0, then we must set down layer 3
2495 L3L4(pc
->st
, CC_RELEASE
| INDICATION
, pc
);
2497 dss1_release_l3_process(pc
);
2502 l3dss1_facility(struct l3_process
*pc
, u8 pr
, void *arg
)
2504 struct sk_buff
*skb
= arg
;
2507 ret
= check_infoelements(pc
, skb
, ie_FACILITY
);
2508 l3dss1_std_ie_err(pc
, ret
);
2511 if ((p
= findie(skb
->data
, skb
->len
, IE_FACILITY
, 0)))
2512 l3dss1_parse_facility(pc
->st
, pc
, pc
->callref
, p
);
2517 l3dss1_suspend_req(struct l3_process
*pc
, u8 pr
, void *arg
)
2519 struct sk_buff
*skb
;
2523 u8
*msg
= pc
->chan
->setup
.phone
;
2525 MsgHead(p
, pc
->callref
, MT_SUSPEND
);
2527 if (l
&& (l
<= 10)) { /* Max length 10 octets */
2530 for (i
= 0; i
< l
; i
++)
2533 l3_debug(pc
->st
, "SUS wrong CALL_ID len %d", l
);
2537 if (!(skb
= l3_alloc_skb(l
)))
2539 memcpy(skb_put(skb
, l
), tmp
, l
);
2540 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
2542 L3AddTimer(&pc
->timer
, T319
, CC_T319
);
2546 l3dss1_suspend_ack(struct l3_process
*pc
, u8 pr
, void *arg
)
2548 struct sk_buff
*skb
= arg
;
2551 L3DelTimer(&pc
->timer
);
2553 pc
->para
.cause
= NO_CAUSE
;
2554 L3L4(pc
->st
, CC_SUSPEND
| CONFIRM
, pc
);
2555 /* We don't handle suspend_ack for IE errors now */
2556 if ((ret
= check_infoelements(pc
, skb
, ie_SUSPEND_ACKNOWLEDGE
)))
2557 if (pc
->debug
& L3_DEB_WARN
)
2558 l3_debug(pc
->st
, "SUSPACK check ie(%d)",ret
);
2559 dss1_release_l3_process(pc
);
2563 l3dss1_suspend_rej(struct l3_process
*pc
, u8 pr
, void *arg
)
2565 struct sk_buff
*skb
= arg
;
2568 if ((ret
= l3dss1_get_cause(pc
, skb
))) {
2569 if (pc
->debug
& L3_DEB_WARN
)
2570 l3_debug(pc
->st
, "SUSP_REJ get_cause ret(%d)",ret
);
2572 pc
->para
.cause
= 96;
2574 pc
->para
.cause
= 100;
2575 l3dss1_status_send(pc
, pr
, NULL
);
2578 ret
= check_infoelements(pc
, skb
, ie_SUSPEND_REJECT
);
2579 if (ERR_IE_COMPREHENSION
== ret
) {
2580 l3dss1_std_ie_err(pc
, ret
);
2583 L3DelTimer(&pc
->timer
);
2584 L3L4(pc
->st
, CC_SUSPEND_ERR
, pc
);
2586 if (ret
) /* STATUS for none mandatory IE errors after actions are taken */
2587 l3dss1_std_ie_err(pc
, ret
);
2591 l3dss1_resume_req(struct l3_process
*pc
, u8 pr
, void *arg
)
2593 struct sk_buff
*skb
;
2597 u8
*msg
= pc
->para
.setup
.phone
;
2599 MsgHead(p
, pc
->callref
, MT_RESUME
);
2602 if (l
&& (l
<= 10)) { /* Max length 10 octets */
2605 for (i
= 0; i
< l
; i
++)
2608 l3_debug(pc
->st
, "RES wrong CALL_ID len %d", l
);
2612 if (!(skb
= l3_alloc_skb(l
)))
2614 memcpy(skb_put(skb
, l
), tmp
, l
);
2615 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
2617 L3AddTimer(&pc
->timer
, T318
, CC_T318
);
2621 l3dss1_resume_ack(struct l3_process
*pc
, u8 pr
, void *arg
)
2623 struct sk_buff
*skb
= arg
;
2626 if ((id
= l3dss1_get_channel_id(pc
, skb
)) > 0) {
2627 if ((0 == id
) || ((3 == id
) && (0x10 == pc
->para
.moderate
))) {
2628 if (pc
->debug
& L3_DEB_WARN
)
2629 l3_debug(pc
->st
, "resume ack with wrong chid %x", id
);
2630 pc
->para
.cause
= 100;
2631 l3dss1_status_send(pc
, pr
, NULL
);
2634 pc
->para
.bchannel
= id
;
2635 } else if (1 == pc
->state
) {
2636 if (pc
->debug
& L3_DEB_WARN
)
2637 l3_debug(pc
->st
, "resume ack without chid (ret %d)", id
);
2638 pc
->para
.cause
= 96;
2639 l3dss1_status_send(pc
, pr
, NULL
);
2642 ret
= check_infoelements(pc
, skb
, ie_RESUME_ACKNOWLEDGE
);
2643 if (ERR_IE_COMPREHENSION
== ret
) {
2644 l3dss1_std_ie_err(pc
, ret
);
2647 L3DelTimer(&pc
->timer
);
2648 L3L4(pc
->st
, CC_RESUME
| CONFIRM
, pc
);
2650 if (ret
) /* STATUS for none mandatory IE errors after actions are taken */
2651 l3dss1_std_ie_err(pc
, ret
);
2655 l3dss1_resume_rej(struct l3_process
*pc
, u8 pr
, void *arg
)
2657 struct sk_buff
*skb
= arg
;
2660 if ((ret
= l3dss1_get_cause(pc
, skb
))) {
2661 if (pc
->debug
& L3_DEB_WARN
)
2662 l3_debug(pc
->st
, "RES_REJ get_cause ret(%d)",ret
);
2664 pc
->para
.cause
= 96;
2666 pc
->para
.cause
= 100;
2667 l3dss1_status_send(pc
, pr
, NULL
);
2670 ret
= check_infoelements(pc
, skb
, ie_RESUME_REJECT
);
2671 if (ERR_IE_COMPREHENSION
== ret
) {
2672 l3dss1_std_ie_err(pc
, ret
);
2675 L3DelTimer(&pc
->timer
);
2676 L3L4(pc
->st
, CC_RESUME_ERR
, pc
);
2678 if (ret
) /* STATUS for none mandatory IE errors after actions are taken */
2679 l3dss1_std_ie_err(pc
, ret
);
2680 dss1_release_l3_process(pc
);
2684 l3dss1_global_restart(struct l3_process
*pc
, u8 pr
, void *arg
)
2688 u8 ri
, ch
= 0, chan
= 0;
2690 struct sk_buff
*skb
= arg
;
2691 struct l3_process
*up
;
2694 L3DelTimer(&pc
->timer
);
2696 if ((p
= findie(p
, skb
->len
, IE_RESTART_IND
, 0))) {
2698 l3_debug(pc
->st
, "Restart %x", ri
);
2700 l3_debug(pc
->st
, "Restart without restart IE");
2704 if ((p
= findie(p
, skb
->len
, IE_CHANNEL_ID
, 0))) {
2707 if (pc
->st
->l3
.debug
)
2708 l3_debug(pc
->st
, "Restart for channel %d", chan
);
2711 up
= pc
->st
->l3
.proc
;
2714 L4L3(up
->st
, CC_RESTART
| REQUEST
, up
);
2715 else if (up
->para
.bchannel
== chan
)
2716 L4L3(up
->st
, CC_RESTART
| REQUEST
, up
);
2720 MsgHead(p
, pc
->callref
, MT_RESTART_ACKNOWLEDGE
);
2722 *p
++ = IE_CHANNEL_ID
;
2726 *p
++ = 0x79; /* RESTART Ind */
2730 if (!(skb
= l3_alloc_skb(l
)))
2732 memcpy(skb_put(skb
, l
), tmp
, l
);
2734 l3_msg(pc
->st
, DL_DATA
| REQUEST
, skb
);
2738 l3dss1_dl_reset(struct l3_process
*pc
, u8 pr
, void *arg
)
2740 pc
->para
.cause
= 0x29; /* Temporary failure */
2742 l3dss1_disconnect_req(pc
, pr
, NULL
);
2743 L3L4(pc
->st
, CC_SETUP_ERR
, pc
);
2747 l3dss1_dl_release(struct l3_process
*pc
, u8 pr
, void *arg
)
2750 pc
->para
.cause
= 0x1b; /* Destination out of order */
2752 L3L4(pc
->st
, CC_RELEASE
| INDICATION
, pc
);
2753 release_l3_process(pc
);
2757 l3dss1_dl_reestablish(struct l3_process
*pc
, u8 pr
, void *arg
)
2759 L3DelTimer(&pc
->timer
);
2760 L3AddTimer(&pc
->timer
, T309
, CC_T309
);
2761 l3_msg(pc
->st
, DL_ESTABLISH
| REQUEST
, NULL
);
2765 l3dss1_dl_reest_status(struct l3_process
*pc
, u8 pr
, void *arg
)
2767 L3DelTimer(&pc
->timer
);
2769 pc
->para
.cause
= 0x1F; /* normal, unspecified */
2770 l3dss1_status_send(pc
, 0, NULL
);
2774 static struct stateentry downstatelist
[] =
2777 CC_SETUP
| REQUEST
, l3dss1_setup_req
},
2779 CC_RESUME
| REQUEST
, l3dss1_resume_req
},
2780 {SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(6) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) | SBIT(25),
2781 CC_DISCONNECT
| REQUEST
, l3dss1_disconnect_req
},
2783 CC_RELEASE
| REQUEST
, l3dss1_release_req
},
2785 CC_RESTART
| REQUEST
, l3dss1_restart
},
2786 {SBIT(6) | SBIT(25),
2787 CC_IGNORE
| REQUEST
, l3dss1_reset
},
2788 {SBIT(6) | SBIT(25),
2789 CC_REJECT
| REQUEST
, l3dss1_reject_req
},
2790 {SBIT(6) | SBIT(25),
2791 CC_PROCEED_SEND
| REQUEST
, l3dss1_proceed_req
},
2793 CC_MORE_INFO
| REQUEST
, l3dss1_setup_ack_req
},
2795 CC_MORE_INFO
| REQUEST
, l3dss1_dummy
},
2796 {SBIT(6) | SBIT(9) | SBIT(25),
2797 CC_ALERTING
| REQUEST
, l3dss1_alert_req
},
2798 {SBIT(6) | SBIT(7) | SBIT(9) | SBIT(25),
2799 CC_SETUP
| RESPONSE
, l3dss1_setup_rsp
},
2801 CC_SUSPEND
| REQUEST
, l3dss1_suspend_req
},
2802 {SBIT(7) | SBIT(9) | SBIT(25),
2803 CC_REDIR
| REQUEST
, l3dss1_redir_req
},
2805 CC_REDIR
| REQUEST
, l3dss1_redir_req_early
},
2806 {SBIT(9) | SBIT(25),
2807 CC_DISCONNECT
| REQUEST
, l3dss1_disconnect_req
},
2809 CC_T302
, l3dss1_t302
},
2811 CC_T303
, l3dss1_t303
},
2813 CC_T304
, l3dss1_t304
},
2815 CC_T310
, l3dss1_t310
},
2817 CC_T313
, l3dss1_t313
},
2819 CC_T305
, l3dss1_t305
},
2821 CC_T319
, l3dss1_t319
},
2823 CC_T318
, l3dss1_t318
},
2825 CC_T308_1
, l3dss1_t308_1
},
2827 CC_T308_2
, l3dss1_t308_2
},
2829 CC_T309
, l3dss1_dl_release
},
2833 (sizeof(downstatelist) / sizeof(struct stateentry))
2835 static struct stateentry datastatelist
[] =
2838 MT_STATUS_ENQUIRY
, l3dss1_status_enq
},
2840 MT_FACILITY
, l3dss1_facility
},
2842 MT_STATUS
, l3dss1_release_ind
},
2844 MT_STATUS
, l3dss1_status
},
2846 MT_SETUP
, l3dss1_setup
},
2847 {SBIT(6) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) | SBIT(11) | SBIT(12) |
2848 SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
2849 MT_SETUP
, l3dss1_dummy
},
2851 MT_CALL_PROCEEDING
, l3dss1_call_proc
},
2853 MT_SETUP_ACKNOWLEDGE
, l3dss1_setup_ack
},
2855 MT_ALERTING
, l3dss1_alerting
},
2857 MT_PROGRESS
, l3dss1_progress
},
2858 {SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) |
2859 SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
2860 MT_INFORMATION
, l3dss1_information
},
2861 {SBIT(10) | SBIT(11) | SBIT(15),
2862 MT_NOTIFY
, l3dss1_notify
},
2863 {SBIT(0) | SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(10) |
2864 SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
2865 MT_RELEASE_COMPLETE
, l3dss1_release_cmpl
},
2866 {SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) | SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(25),
2867 MT_RELEASE
, l3dss1_release
},
2868 {SBIT(19), MT_RELEASE
, l3dss1_release_ind
},
2869 {SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) | SBIT(11) | SBIT(15) | SBIT(17) | SBIT(25),
2870 MT_DISCONNECT
, l3dss1_disconnect
},
2872 MT_DISCONNECT
, l3dss1_dummy
},
2873 {SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4),
2874 MT_CONNECT
, l3dss1_connect
},
2876 MT_CONNECT_ACKNOWLEDGE
, l3dss1_connect_ack
},
2878 MT_SUSPEND_ACKNOWLEDGE
, l3dss1_suspend_ack
},
2880 MT_SUSPEND_REJECT
, l3dss1_suspend_rej
},
2882 MT_RESUME_ACKNOWLEDGE
, l3dss1_resume_ack
},
2884 MT_RESUME_REJECT
, l3dss1_resume_rej
},
2888 (sizeof(datastatelist) / sizeof(struct stateentry))
2890 static struct stateentry globalmes_list
[] =
2893 MT_STATUS
, l3dss1_status
},
2895 MT_RESTART
, l3dss1_global_restart
},
2897 MT_RESTART_ACKNOWLEDGE, l3dss1_restart_ack},
2900 #define GLOBALM_LEN \
2901 (sizeof(globalmes_list) / sizeof(struct stateentry))
2903 static struct stateentry manstatelist
[] =
2906 DL_ESTABLISH
| INDICATION
, l3dss1_dl_reset
},
2908 DL_ESTABLISH
| CONFIRM
, l3dss1_dl_reest_status
},
2910 DL_RELEASE
| INDICATION
, l3dss1_dl_reestablish
},
2912 DL_RELEASE
| INDICATION
, l3dss1_dl_release
},
2916 (sizeof(manstatelist) / sizeof(struct stateentry))
2921 global_handler(struct PStack
*st
, int mt
, struct sk_buff
*skb
)
2927 struct l3_process
*proc
= st
->l3
.global
;
2929 proc
->callref
= skb
->data
[2]; /* cr flag */
2930 for (i
= 0; i
< GLOBALM_LEN
; i
++)
2931 if ((mt
== globalmes_list
[i
].primitive
) &&
2932 ((1 << proc
->state
) & globalmes_list
[i
].state
))
2934 if (i
== GLOBALM_LEN
) {
2935 if (st
->l3
.debug
& L3_DEB_STATE
) {
2936 l3_debug(st
, "dss1 global state %d mt %x unhandled",
2939 MsgHead(p
, proc
->callref
, MT_STATUS
);
2943 *p
++ = 81 |0x80; /* invalid cr */
2944 *p
++ = 0x14; /* CallState */
2946 *p
++ = proc
->state
& 0x3f;
2948 if (!(skb
= l3_alloc_skb(l
)))
2950 memcpy(skb_put(skb
, l
), tmp
, l
);
2951 l3_msg(proc
->st
, DL_DATA
| REQUEST
, skb
);
2953 if (st
->l3
.debug
& L3_DEB_STATE
) {
2954 l3_debug(st
, "dss1 global %d mt %x",
2957 globalmes_list
[i
].rout(proc
, mt
, skb
);
2962 dss1up(struct PStack
*st
, int pr
, void *arg
)
2964 int i
, mt
, cr
, cause
, callState
;
2967 struct sk_buff
*skb
= arg
;
2968 struct l3_process
*proc
;
2971 case (DL_DATA
| INDICATION
):
2972 case (DL_UNIT_DATA
| INDICATION
):
2974 case (DL_ESTABLISH
| CONFIRM
):
2975 case (DL_ESTABLISH
| INDICATION
):
2976 case (DL_RELEASE
| INDICATION
):
2977 case (DL_RELEASE
| CONFIRM
):
2978 l3_msg(st
, pr
, arg
);
2982 printk(KERN_ERR
"HiSax dss1up unknown pr=%04x\n", pr
);
2986 l3_debug(st
, "dss1up frame too short(%d)", skb
->len
);
2991 if (skb
->data
[0] != PROTO_DIS_EURO
) {
2992 if (st
->l3
.debug
& L3_DEB_PROTERR
) {
2993 l3_debug(st
, "dss1up%sunexpected discriminator %x message len %d",
2994 (pr
== (DL_DATA
| INDICATION
)) ? " " : "(broadcast) ",
2995 skb
->data
[0], skb
->len
);
3000 cr
= getcallref(skb
->data
);
3001 if (skb
->len
< ((skb
->data
[1] & 0x0f) + 3)) {
3002 l3_debug(st
, "dss1up frame too short(%d)", skb
->len
);
3006 mt
= skb
->data
[skb
->data
[1] + 2];
3007 if (st
->l3
.debug
& L3_DEB_STATE
)
3008 l3_debug(st
, "dss1up cr %d", cr
);
3009 if (cr
== -2) { /* wrong Callref */
3010 if (st
->l3
.debug
& L3_DEB_WARN
)
3011 l3_debug(st
, "dss1up wrong Callref");
3014 } else if (cr
== -1) { /* Dummy Callref */
3015 if (mt
== MT_FACILITY
)
3016 if ((p
= findie(skb
->data
, skb
->len
, IE_FACILITY
, 0))) {
3017 l3dss1_parse_facility(st
, NULL
,
3018 (pr
== (DL_DATA
| INDICATION
)) ? -1 : -2, p
);
3022 if (st
->l3
.debug
& L3_DEB_WARN
)
3023 l3_debug(st
, "dss1up dummy Callref (no facility msg or ie)");
3026 } else if ((((skb
->data
[1] & 0x0f) == 1) && (0==(cr
& 0x7f))) ||
3027 (((skb
->data
[1] & 0x0f) == 2) && (0==(cr
& 0x7fff)))) { /* Global CallRef */
3028 if (st
->l3
.debug
& L3_DEB_STATE
)
3029 l3_debug(st
, "dss1up Global CallRef");
3030 global_handler(st
, mt
, skb
);
3033 } else if (!(proc
= getl3proc(st
, cr
))) {
3034 /* No transaction process exist, that means no call with
3035 * this callreference is active
3037 if (mt
== MT_SETUP
) {
3038 /* Setup creates a new transaction process */
3039 if (skb
->data
[2] & 0x80) {
3040 /* Setup with wrong CREF flag */
3041 if (st
->l3
.debug
& L3_DEB_STATE
)
3042 l3_debug(st
, "dss1up wrong CRef flag");
3046 if (!(proc
= dss1_new_l3_process(st
, cr
))) {
3047 /* May be to answer with RELEASE_COMPLETE and
3048 * CAUSE 0x2f "Resource unavailable", but this
3049 * need a new_l3_process too ... arghh
3054 } else if (mt
== MT_STATUS
) {
3056 if ((ptr
= findie(skb
->data
, skb
->len
, IE_CAUSE
, 0)) != NULL
) {
3060 cause
= *ptr
& 0x7f;
3063 if ((ptr
= findie(skb
->data
, skb
->len
, IE_CALL_STATE
, 0)) != NULL
) {
3069 /* ETS 300-104 part 2.4.1
3070 * if setup has not been made and a message type
3071 * MT_STATUS is received with call state == 0,
3072 * we must send nothing
3074 if (callState
!= 0) {
3075 /* ETS 300-104 part 2.4.2
3076 * if setup has not been made and a message type
3077 * MT_STATUS is received with call state != 0,
3078 * we must send MT_RELEASE_COMPLETE cause 101
3080 if ((proc
= dss1_new_l3_process(st
, cr
))) {
3081 proc
->para
.cause
= 101;
3082 l3dss1_msg_without_setup(proc
, 0, NULL
);
3087 } else if (mt
== MT_RELEASE_COMPLETE
) {
3091 /* ETS 300-104 part 2
3092 * if setup has not been made and a message type
3093 * (except MT_SETUP and RELEASE_COMPLETE) is received,
3094 * we must send MT_RELEASE_COMPLETE cause 81 */
3096 if ((proc
= dss1_new_l3_process(st
, cr
))) {
3097 proc
->para
.cause
= 81;
3098 l3dss1_msg_without_setup(proc
, 0, NULL
);
3103 if (l3dss1_check_messagetype_validity(proc
, mt
, skb
)) {
3107 if ((p
= findie(skb
->data
, skb
->len
, IE_DISPLAY
, 0)) != NULL
)
3108 l3dss1_deliver_display(proc
, pr
, p
); /* Display IE included */
3109 for (i
= 0; i
< DATASLLEN
; i
++)
3110 if ((mt
== datastatelist
[i
].primitive
) &&
3111 ((1 << proc
->state
) & datastatelist
[i
].state
))
3113 if (i
== DATASLLEN
) {
3114 if (st
->l3
.debug
& L3_DEB_STATE
) {
3115 l3_debug(st
, "dss1up%sstate %d mt %#x unhandled",
3116 (pr
== (DL_DATA
| INDICATION
)) ? " " : "(broadcast) ",
3119 if ((MT_RELEASE_COMPLETE
!= mt
) && (MT_RELEASE
!= mt
)) {
3120 proc
->para
.cause
= 101;
3121 l3dss1_status_send(proc
, pr
, skb
);
3124 if (st
->l3
.debug
& L3_DEB_STATE
) {
3125 l3_debug(st
, "dss1up%sstate %d mt %x",
3126 (pr
== (DL_DATA
| INDICATION
)) ? " " : "(broadcast) ",
3129 datastatelist
[i
].rout(proc
, pr
, skb
);
3136 dss1down(struct PStack
*st
, int pr
, void *arg
)
3139 struct l3_process
*proc
;
3140 struct Channel
*chan
;
3142 if ((DL_ESTABLISH
| REQUEST
) == pr
) {
3143 l3_msg(st
, pr
, NULL
);
3145 } else if (((CC_SETUP
| REQUEST
) == pr
) || ((CC_RESUME
| REQUEST
) == pr
)) {
3149 if ((proc
= dss1_new_l3_process(st
, cr
))) {
3152 memcpy(&proc
->para
.setup
, &chan
->setup
, sizeof(setup_parm
));
3159 printk(KERN_ERR
"HiSax dss1down without proc pr=%04x\n", pr
);
3163 if ( pr
== (CC_TDSS1_IO
| REQUEST
)) {
3164 l3dss1_io_timer(proc
); /* timer expires */
3168 for (i
= 0; i
< DOWNSLLEN
; i
++)
3169 if ((pr
== downstatelist
[i
].primitive
) &&
3170 ((1 << proc
->state
) & downstatelist
[i
].state
))
3172 if (i
== DOWNSLLEN
) {
3173 if (st
->l3
.debug
& L3_DEB_STATE
) {
3174 l3_debug(st
, "dss1down state %d prim %#x unhandled",
3178 if (st
->l3
.debug
& L3_DEB_STATE
) {
3179 l3_debug(st
, "dss1down state %d prim %#x",
3182 downstatelist
[i
].rout(proc
, pr
, arg
);
3187 dss1man(struct PStack
*st
, int pr
, void *arg
)
3190 struct l3_process
*proc
= arg
;
3193 printk(KERN_ERR
"HiSax dss1man without proc pr=%04x\n", pr
);
3196 for (i
= 0; i
< MANSLLEN
; i
++)
3197 if ((pr
== manstatelist
[i
].primitive
) &&
3198 ((1 << proc
->state
) & manstatelist
[i
].state
))
3200 if (i
== MANSLLEN
) {
3201 if (st
->l3
.debug
& L3_DEB_STATE
) {
3202 l3_debug(st
, "cr %d dss1man state %d prim %#x unhandled",
3203 proc
->callref
& 0x7f, proc
->state
, pr
);
3206 if (st
->l3
.debug
& L3_DEB_STATE
) {
3207 l3_debug(st
, "cr %d dss1man state %d prim %#x",
3208 proc
->callref
& 0x7f, proc
->state
, pr
);
3210 manstatelist
[i
].rout(proc
, pr
, arg
);
3215 setstack_dss1(struct PStack
*st
)
3220 st
->l3
.l4l3
= dss1down
;
3221 st
->l3
.l4l3_proto
= l3dss1_cmd_global
;
3222 st
->l3
.l2l3
= dss1up
;
3223 st
->l3
.l3ml3
= dss1man
;
3225 st
->prot
.dss1
.last_invoke_id
= 0;
3226 st
->prot
.dss1
.invoke_used
[0] = 1; /* Bit 0 must always be set to 1 */
3229 st
->prot
.dss1
.invoke_used
[i
++] = 0;
3231 if (!(st
->l3
.global
= kmalloc(sizeof(struct l3_process
), GFP_ATOMIC
))) {
3232 printk(KERN_ERR
"HiSax can't get memory for dss1 global CR\n");
3234 st
->l3
.global
->state
= 0;
3235 st
->l3
.global
->callref
= 0;
3236 st
->l3
.global
->next
= NULL
;
3237 st
->l3
.global
->debug
= L3_DEB_WARN
;
3238 st
->l3
.global
->st
= st
;
3239 st
->l3
.global
->N303
= 1;
3240 st
->l3
.global
->prot
.dss1
.invoke_id
= 0;
3242 L3InitTimer(st
->l3
.global
, &st
->l3
.global
->timer
);
3244 strcpy(tmp
, dss1_revision
);
3245 printk(KERN_INFO
"HiSax: DSS1 Rev. %s\n", HiSax_getrev(tmp
));