2001-02-11 22:46:19 +00:00
|
|
|
|
/* $Id$
|
|
|
|
|
*
|
|
|
|
|
* EURO/DSS1 D-channel protocol
|
|
|
|
|
*
|
|
|
|
|
* Author Karsten Keil (keil@isdn4linux.de)
|
|
|
|
|
*
|
|
|
|
|
* This file is (c) under GNU PUBLIC LICENSE
|
|
|
|
|
* For changes and modifications please read
|
2003-07-21 12:00:05 +00:00
|
|
|
|
* ../../../Documentation/isdn/mISDN.cert
|
2001-02-11 22:46:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Thanks to Jan den Ouden
|
|
|
|
|
* Fritz Elfert
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
2003-07-21 12:44:46 +00:00
|
|
|
|
#include "layer3.h"
|
2001-02-13 10:42:55 +00:00
|
|
|
|
#include "helper.h"
|
|
|
|
|
#include "debug.h"
|
2001-02-11 22:46:19 +00:00
|
|
|
|
#include "dss1.h"
|
|
|
|
|
|
|
|
|
|
static int debug = 0;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
static mISDNobject_t u_dss1;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *dss1_revision = "$Revision$";
|
|
|
|
|
|
2001-02-13 10:42:55 +00:00
|
|
|
|
static int dss1man(l3_process_t *, u_int, void *);
|
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
static int
|
|
|
|
|
parseQ931(struct sk_buff *skb) {
|
|
|
|
|
Q931_info_t *qi;
|
|
|
|
|
int l, codeset, maincodeset;
|
|
|
|
|
int len, iep, pos = 0, cnt = 0;
|
|
|
|
|
u16 *ie, cr;
|
|
|
|
|
u_char t, *p = skb->data;
|
|
|
|
|
|
|
|
|
|
if (skb->len < 3)
|
|
|
|
|
return(-1);
|
|
|
|
|
p++;
|
|
|
|
|
l = (*p++) & 0xf;
|
|
|
|
|
if (l>2)
|
|
|
|
|
return(-2);
|
|
|
|
|
if (l)
|
|
|
|
|
cr = *p++;
|
|
|
|
|
else
|
|
|
|
|
cr = 0;
|
|
|
|
|
if (l == 2) {
|
|
|
|
|
cr <<= 8;
|
|
|
|
|
cr |= *p++;
|
|
|
|
|
} else if (l == 1)
|
|
|
|
|
if (cr & 0x80) {
|
|
|
|
|
cr |= 0x8000;
|
|
|
|
|
cr &= 0xFF7F;
|
|
|
|
|
}
|
|
|
|
|
t = *p;
|
|
|
|
|
if ((u_long)p & 1)
|
|
|
|
|
pos = 1;
|
|
|
|
|
else
|
|
|
|
|
pos = 0;
|
|
|
|
|
skb_pull(skb, (p - skb->data) - pos);
|
|
|
|
|
len = skb->len;
|
|
|
|
|
p = skb->data;
|
2003-07-27 11:14:19 +00:00
|
|
|
|
if (skb_headroom(skb) < (int)L3_EXTRA_SIZE) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
int_error();
|
|
|
|
|
return(-3);
|
|
|
|
|
}
|
|
|
|
|
qi = (Q931_info_t *)skb_push(skb, L3_EXTRA_SIZE);
|
|
|
|
|
initQ931_info(qi);
|
|
|
|
|
qi->type = t;
|
|
|
|
|
qi->crlen = l;
|
|
|
|
|
qi->cr = cr;
|
|
|
|
|
pos++;
|
|
|
|
|
codeset = maincodeset = 0;
|
|
|
|
|
ie = &qi->bearer_capability;
|
|
|
|
|
while (pos < len) {
|
|
|
|
|
if ((p[pos] & 0xf0) == 0x90) {
|
|
|
|
|
codeset = p[pos] & 0x07;
|
|
|
|
|
if (!(p[pos] & 0x08))
|
|
|
|
|
maincodeset = codeset;
|
|
|
|
|
pos++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (codeset == 0) {
|
|
|
|
|
if (p[pos] & 0x80) { /* single octett IE */
|
|
|
|
|
if (p[pos] == IE_MORE_DATA)
|
|
|
|
|
qi->more_data = pos;
|
|
|
|
|
else if (p[pos] == IE_COMPLETE)
|
|
|
|
|
qi->sending_complete = pos;
|
|
|
|
|
else if ((p[pos] & 0xf0) == IE_CONGESTION)
|
|
|
|
|
qi->congestion_level = pos;
|
|
|
|
|
cnt++;
|
|
|
|
|
pos++;
|
|
|
|
|
} else {
|
2003-07-18 16:36:03 +00:00
|
|
|
|
iep = l3_ie2pos(p[pos]);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((pos+1) >= len)
|
|
|
|
|
return(-4);
|
|
|
|
|
l = p[pos+1];
|
|
|
|
|
if ((pos+l+1) >= len)
|
|
|
|
|
return(-5);
|
|
|
|
|
if (iep>=0) {
|
|
|
|
|
ie[iep] = pos;
|
|
|
|
|
}
|
|
|
|
|
pos += l + 2;
|
|
|
|
|
cnt++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
codeset = maincodeset;
|
2001-02-19 22:25:31 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(cnt);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
static int
|
|
|
|
|
calc_msg_len(Q931_info_t *qi)
|
|
|
|
|
{
|
|
|
|
|
int i, cnt = 0;
|
|
|
|
|
u_char *buf = (u_char *)qi;
|
|
|
|
|
u16 *v_ie;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
buf += L3_EXTRA_SIZE;
|
|
|
|
|
if (qi->more_data)
|
|
|
|
|
cnt++;
|
|
|
|
|
if (qi->sending_complete)
|
|
|
|
|
cnt++;
|
|
|
|
|
if (qi->congestion_level)
|
|
|
|
|
cnt++;
|
|
|
|
|
v_ie = &qi->bearer_capability;
|
|
|
|
|
for (i=0; i<32; i++) {
|
|
|
|
|
if (v_ie[i])
|
|
|
|
|
cnt += buf[v_ie[i] + 1] + 2;
|
|
|
|
|
}
|
|
|
|
|
return(cnt);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
static int
|
|
|
|
|
compose_msg(struct sk_buff *skb, Q931_info_t *qi)
|
|
|
|
|
{
|
|
|
|
|
int i, l;
|
|
|
|
|
u_char *p, *buf = (u_char *)qi;
|
|
|
|
|
u16 *v_ie;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
buf += L3_EXTRA_SIZE;
|
|
|
|
|
|
|
|
|
|
if (qi->more_data) {
|
|
|
|
|
p = skb_put(skb, 1);
|
|
|
|
|
*p = buf[qi->more_data];
|
|
|
|
|
}
|
|
|
|
|
if (qi->sending_complete) {
|
|
|
|
|
p = skb_put(skb, 1);
|
|
|
|
|
*p = buf[qi->sending_complete];
|
|
|
|
|
}
|
|
|
|
|
if (qi->congestion_level) {
|
|
|
|
|
p = skb_put(skb, 1);
|
|
|
|
|
*p = buf[qi->congestion_level];
|
|
|
|
|
}
|
|
|
|
|
v_ie = &qi->bearer_capability;
|
|
|
|
|
for (i=0; i<32; i++) {
|
|
|
|
|
if (v_ie[i]) {
|
|
|
|
|
l = buf[v_ie[i] + 1] +1;
|
|
|
|
|
p = skb_put(skb, l + 1);
|
2003-07-18 16:36:03 +00:00
|
|
|
|
*p++ = l3_pos2ie(i);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
memcpy(p, &buf[v_ie[i] + 1], l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct sk_buff
|
|
|
|
|
*MsgStart(l3_process_t *pc, u_char mt, int len) {
|
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
int lx = 4;
|
|
|
|
|
u_char *p;
|
|
|
|
|
|
|
|
|
|
if (test_bit(FLG_CRLEN2, &pc->l3->Flag))
|
|
|
|
|
lx++;
|
|
|
|
|
if (pc->callref == -1) /* dummy cr */
|
|
|
|
|
lx = 3;
|
2003-08-01 22:15:53 +00:00
|
|
|
|
if (!(skb = alloc_stack_skb(len + lx, pc->l3->down_headerlen)))
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(NULL);
|
|
|
|
|
p = skb_put(skb, lx);
|
|
|
|
|
*p++ = 8;
|
|
|
|
|
if (lx == 3)
|
|
|
|
|
*p++ = 0;
|
|
|
|
|
else if (lx == 5) {
|
|
|
|
|
*p++ = 2;
|
|
|
|
|
*p++ = (pc->callref >> 8) ^ 0x80;
|
|
|
|
|
*p++ = pc->callref & 0xff;
|
|
|
|
|
} else {
|
|
|
|
|
*p++ = 1;
|
|
|
|
|
*p = pc->callref & 0xff;
|
|
|
|
|
if (!(pc->callref & 0x8000))
|
|
|
|
|
*p |= 0x80;
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
*p = mt;
|
|
|
|
|
return(skb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int SendMsg(l3_process_t *pc, struct sk_buff *skb, int state) {
|
|
|
|
|
int l;
|
|
|
|
|
int ret;
|
|
|
|
|
struct sk_buff *nskb;
|
|
|
|
|
Q931_info_t *qi;
|
|
|
|
|
|
|
|
|
|
if (!skb)
|
|
|
|
|
return(-EINVAL);
|
|
|
|
|
qi = (Q931_info_t *)skb->data;
|
|
|
|
|
l = calc_msg_len(qi);
|
|
|
|
|
if (!(nskb = MsgStart(pc, qi->type, l))) {
|
|
|
|
|
kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
return(-ENOMEM);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
}
|
|
|
|
|
if (l)
|
|
|
|
|
compose_msg(nskb, qi);
|
|
|
|
|
kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (state != -1)
|
|
|
|
|
newl3state(pc, state);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((ret=l3_msg(pc->l3, DL_DATA | REQUEST, DINFO_SKB, 0, nskb)))
|
|
|
|
|
kfree_skb(nskb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
return(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3dss1_message(l3_process_t *pc, u_char mt)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(skb = MsgStart(pc, mt, 0)))
|
2001-02-19 11:51:42 +00:00
|
|
|
|
return(-ENOMEM);
|
2001-03-03 18:17:16 +00:00
|
|
|
|
if ((ret=l3_msg(pc->l3, DL_DATA | REQUEST, DINFO_SKB, 0, skb)))
|
2001-11-02 23:41:26 +00:00
|
|
|
|
kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
return(ret);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_message_cause(l3_process_t *pc, u_char mt, u_char cause)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
u_char *p;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
if (!(skb = MsgStart(pc, mt, 4)))
|
|
|
|
|
return;
|
|
|
|
|
p = skb_put(skb, 4);
|
|
|
|
|
*p++ = IE_CAUSE;
|
|
|
|
|
*p++ = 0x2;
|
|
|
|
|
*p++ = 0x80 | CAUSE_LOC_USER;
|
|
|
|
|
*p++ = 0x80 | cause;
|
|
|
|
|
if ((ret=l3_msg(pc->l3, DL_DATA | REQUEST, DINFO_SKB, 0, skb)))
|
|
|
|
|
kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(l3_process_t *pc, u_char cause)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
u_char *p;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(skb = MsgStart(pc, MT_STATUS, 7)))
|
|
|
|
|
return;
|
|
|
|
|
p = skb_put(skb, 7);
|
|
|
|
|
*p++ = IE_CAUSE;
|
|
|
|
|
*p++ = 2;
|
|
|
|
|
*p++ = 0x80 | CAUSE_LOC_USER;
|
|
|
|
|
*p++ = 0x80 | cause;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
*p++ = IE_CALL_STATE;
|
|
|
|
|
*p++ = 1;
|
|
|
|
|
*p++ = pc->state & 0x3f;
|
|
|
|
|
if ((ret=l3_msg(pc->l3, DL_DATA | REQUEST, DINFO_SKB, 0, skb)))
|
|
|
|
|
kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_msg_without_setup(l3_process_t *pc, u_char cause)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
|
|
|
|
/* This routine is called if here was no SETUP made (checks in dss1up and in
|
|
|
|
|
* l3dss1_setup) and a RELEASE_COMPLETE have to be sent with an error code
|
|
|
|
|
* MT_STATUS_ENQUIRE in the NULL state is handled too
|
|
|
|
|
*/
|
|
|
|
|
switch (cause) {
|
|
|
|
|
case 81: /* invalid callreference */
|
|
|
|
|
case 88: /* incomp destination */
|
|
|
|
|
case 96: /* mandory IE missing */
|
|
|
|
|
case 100: /* invalid IE contents */
|
|
|
|
|
case 101: /* incompatible Callstate */
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_message_cause(pc, MT_RELEASE_COMPLETE, cause);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_ERR "mISDN l3dss1_msg_without_setup wrong cause %d\n",
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause);
|
|
|
|
|
}
|
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int ie_ALERTING[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1,
|
|
|
|
|
IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, IE_HLC,
|
|
|
|
|
IE_USER_USER, -1};
|
|
|
|
|
static int ie_CALL_PROCEEDING[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1,
|
|
|
|
|
IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_HLC, -1};
|
|
|
|
|
static int ie_CONNECT[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1,
|
|
|
|
|
IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_DATE, IE_SIGNAL,
|
|
|
|
|
IE_CONNECT_PN, IE_CONNECT_SUB, IE_LLC, IE_HLC, IE_USER_USER, -1};
|
|
|
|
|
static int ie_CONNECT_ACKNOWLEDGE[] = {IE_CHANNEL_ID, IE_DISPLAY, IE_SIGNAL, -1};
|
|
|
|
|
static int ie_DISCONNECT[] = {IE_CAUSE | IE_MANDATORY, IE_FACILITY,
|
|
|
|
|
IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1};
|
|
|
|
|
static int ie_INFORMATION[] = {IE_COMPLETE, IE_DISPLAY, IE_KEYPAD, IE_SIGNAL,
|
|
|
|
|
IE_CALLED_PN, -1};
|
|
|
|
|
static int ie_NOTIFY[] = {IE_BEARER, IE_NOTIFY | IE_MANDATORY, IE_DISPLAY, -1};
|
|
|
|
|
static int ie_PROGRESS[] = {IE_BEARER, IE_CAUSE, IE_FACILITY, IE_PROGRESS |
|
|
|
|
|
IE_MANDATORY, IE_DISPLAY, IE_HLC, IE_USER_USER, -1};
|
|
|
|
|
static int ie_RELEASE[] = {IE_CAUSE | IE_MANDATORY_1, IE_FACILITY, IE_DISPLAY,
|
|
|
|
|
IE_SIGNAL, IE_USER_USER, -1};
|
|
|
|
|
/* a RELEASE_COMPLETE with errors don't require special actions
|
2001-02-21 19:18:27 +00:00
|
|
|
|
static int ie_RELEASE_COMPLETE[] = {IE_CAUSE | IE_MANDATORY_1, IE_FACILITY,
|
|
|
|
|
IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1};
|
2001-02-11 22:46:19 +00:00
|
|
|
|
*/
|
|
|
|
|
static int ie_RESUME_ACKNOWLEDGE[] = {IE_CHANNEL_ID| IE_MANDATORY, IE_FACILITY,
|
|
|
|
|
IE_DISPLAY, -1};
|
|
|
|
|
static int ie_RESUME_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1};
|
|
|
|
|
static int ie_SETUP[] = {IE_COMPLETE, IE_BEARER | IE_MANDATORY,
|
|
|
|
|
IE_CHANNEL_ID| IE_MANDATORY, IE_FACILITY, IE_PROGRESS,
|
|
|
|
|
IE_NET_FAC, IE_DISPLAY, IE_KEYPAD, IE_SIGNAL, IE_CALLING_PN,
|
|
|
|
|
IE_CALLING_SUB, IE_CALLED_PN, IE_CALLED_SUB, IE_REDIR_NR,
|
|
|
|
|
IE_LLC, IE_HLC, IE_USER_USER, -1};
|
|
|
|
|
static int ie_SETUP_ACKNOWLEDGE[] = {IE_CHANNEL_ID | IE_MANDATORY, IE_FACILITY,
|
|
|
|
|
IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, -1};
|
|
|
|
|
static int ie_STATUS[] = {IE_CAUSE | IE_MANDATORY, IE_CALL_STATE |
|
|
|
|
|
IE_MANDATORY, IE_DISPLAY, -1};
|
|
|
|
|
static int ie_STATUS_ENQUIRY[] = {IE_DISPLAY, -1};
|
2001-02-19 11:51:42 +00:00
|
|
|
|
static int ie_SUSPEND_ACKNOWLEDGE[] = {IE_FACILITY, IE_DISPLAY, -1};
|
2001-02-11 22:46:19 +00:00
|
|
|
|
static int ie_SUSPEND_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1};
|
|
|
|
|
/* not used
|
|
|
|
|
* static int ie_CONGESTION_CONTROL[] = {IE_CONGESTION | IE_MANDATORY,
|
|
|
|
|
* IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1};
|
|
|
|
|
* static int ie_USER_INFORMATION[] = {IE_MORE_DATA, IE_USER_USER | IE_MANDATORY, -1};
|
|
|
|
|
* static int ie_RESTART[] = {IE_CHANNEL_ID, IE_DISPLAY, IE_RESTART_IND |
|
|
|
|
|
* IE_MANDATORY, -1};
|
|
|
|
|
*/
|
|
|
|
|
static int ie_FACILITY[] = {IE_FACILITY | IE_MANDATORY, IE_DISPLAY, -1};
|
|
|
|
|
static int comp_required[] = {1,2,3,5,6,7,9,10,11,14,15,-1};
|
|
|
|
|
static int l3_valid_states[] = {0,1,2,3,4,6,7,8,9,10,11,12,15,17,19,25,-1};
|
|
|
|
|
|
|
|
|
|
struct ie_len {
|
|
|
|
|
int ie;
|
|
|
|
|
int len;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
|
struct ie_len max_ie_len[] = {
|
|
|
|
|
{IE_SEGMENT, 4},
|
|
|
|
|
{IE_BEARER, 12},
|
|
|
|
|
{IE_CAUSE, 32},
|
|
|
|
|
{IE_CALL_ID, 10},
|
|
|
|
|
{IE_CALL_STATE, 3},
|
|
|
|
|
{IE_CHANNEL_ID, 34},
|
|
|
|
|
{IE_FACILITY, 255},
|
|
|
|
|
{IE_PROGRESS, 4},
|
|
|
|
|
{IE_NET_FAC, 255},
|
|
|
|
|
{IE_NOTIFY, 3},
|
|
|
|
|
{IE_DISPLAY, 82},
|
|
|
|
|
{IE_DATE, 8},
|
|
|
|
|
{IE_KEYPAD, 34},
|
|
|
|
|
{IE_SIGNAL, 3},
|
|
|
|
|
{IE_INFORATE, 6},
|
|
|
|
|
{IE_E2E_TDELAY, 11},
|
|
|
|
|
{IE_TDELAY_SEL, 5},
|
|
|
|
|
{IE_PACK_BINPARA, 3},
|
|
|
|
|
{IE_PACK_WINSIZE, 4},
|
|
|
|
|
{IE_PACK_SIZE, 4},
|
|
|
|
|
{IE_CUG, 7},
|
|
|
|
|
{IE_REV_CHARGE, 3},
|
|
|
|
|
{IE_CALLING_PN, 24},
|
|
|
|
|
{IE_CALLING_SUB, 23},
|
|
|
|
|
{IE_CALLED_PN, 24},
|
|
|
|
|
{IE_CALLED_SUB, 23},
|
|
|
|
|
{IE_REDIR_NR, 255},
|
|
|
|
|
{IE_TRANS_SEL, 255},
|
|
|
|
|
{IE_RESTART_IND, 3},
|
|
|
|
|
{IE_LLC, 18},
|
|
|
|
|
{IE_HLC, 5},
|
|
|
|
|
{IE_USER_USER, 131},
|
|
|
|
|
{-1,0},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
getmax_ie_len(u_char ie) {
|
|
|
|
|
int i = 0;
|
|
|
|
|
while (max_ie_len[i].ie != -1) {
|
|
|
|
|
if (max_ie_len[i].ie == ie)
|
|
|
|
|
return(max_ie_len[i].len);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return(255);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
ie_in_set(l3_process_t *pc, u_char ie, int *checklist) {
|
|
|
|
|
int ret = 1;
|
|
|
|
|
|
|
|
|
|
while (*checklist != -1) {
|
|
|
|
|
if ((*checklist & 0xff) == ie) {
|
|
|
|
|
if (ie & 0x80)
|
|
|
|
|
return(-ret);
|
|
|
|
|
else
|
|
|
|
|
return(ret);
|
|
|
|
|
}
|
|
|
|
|
ret++;
|
|
|
|
|
checklist++;
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
check_infoelements(l3_process_t *pc, struct sk_buff *skb, int *checklist)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
int *cl = checklist;
|
|
|
|
|
u_char *p, ie;
|
|
|
|
|
u16 *iep;
|
|
|
|
|
int i, l, newpos, oldpos;
|
|
|
|
|
int err_seq = 0, err_len = 0, err_compr = 0, err_ureg = 0;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
p = skb->data;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
p += L3_EXTRA_SIZE;
|
|
|
|
|
iep = &qi->bearer_capability;
|
|
|
|
|
oldpos = -1;
|
|
|
|
|
for (i=0; i<32; i++) {
|
|
|
|
|
if (iep[i]) {
|
2003-07-18 16:36:03 +00:00
|
|
|
|
ie = l3_pos2ie(i);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((newpos = ie_in_set(pc, ie, cl))) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (newpos > 0) {
|
|
|
|
|
if (newpos < oldpos)
|
|
|
|
|
err_seq++;
|
|
|
|
|
else
|
|
|
|
|
oldpos = newpos;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (ie_in_set(pc, ie, comp_required))
|
2001-02-11 22:46:19 +00:00
|
|
|
|
err_compr++;
|
|
|
|
|
else
|
|
|
|
|
err_ureg++;
|
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l = p[iep[i] +1];
|
|
|
|
|
if (l > getmax_ie_len(ie))
|
|
|
|
|
err_len++;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (err_compr | err_ureg | err_len | err_seq) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_CHECK)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "check IE MT(%x) %d/%d/%d/%d",
|
2003-07-07 14:29:39 +00:00
|
|
|
|
qi->type, err_compr, err_ureg, err_len, err_seq);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (err_compr)
|
|
|
|
|
return(ERR_IE_COMPREHENSION);
|
|
|
|
|
if (err_ureg)
|
|
|
|
|
return(ERR_IE_UNRECOGNIZED);
|
|
|
|
|
if (err_len)
|
|
|
|
|
return(ERR_IE_LENGTH);
|
|
|
|
|
if (err_seq)
|
|
|
|
|
return(ERR_IE_SEQUENCE);
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* verify if a message type exists and contain no IE error */
|
|
|
|
|
static int
|
|
|
|
|
l3dss1_check_messagetype_validity(l3_process_t *pc, int mt, void *arg)
|
|
|
|
|
{
|
|
|
|
|
switch (mt) {
|
|
|
|
|
case MT_ALERTING:
|
|
|
|
|
case MT_CALL_PROCEEDING:
|
|
|
|
|
case MT_CONNECT:
|
|
|
|
|
case MT_CONNECT_ACKNOWLEDGE:
|
|
|
|
|
case MT_DISCONNECT:
|
|
|
|
|
case MT_INFORMATION:
|
|
|
|
|
case MT_FACILITY:
|
|
|
|
|
case MT_NOTIFY:
|
|
|
|
|
case MT_PROGRESS:
|
|
|
|
|
case MT_RELEASE:
|
|
|
|
|
case MT_RELEASE_COMPLETE:
|
|
|
|
|
case MT_SETUP:
|
|
|
|
|
case MT_SETUP_ACKNOWLEDGE:
|
|
|
|
|
case MT_RESUME_ACKNOWLEDGE:
|
|
|
|
|
case MT_RESUME_REJECT:
|
|
|
|
|
case MT_SUSPEND_ACKNOWLEDGE:
|
|
|
|
|
case MT_SUSPEND_REJECT:
|
|
|
|
|
case MT_USER_INFORMATION:
|
|
|
|
|
case MT_RESTART:
|
|
|
|
|
case MT_RESTART_ACKNOWLEDGE:
|
|
|
|
|
case MT_CONGESTION_CONTROL:
|
|
|
|
|
case MT_STATUS:
|
|
|
|
|
case MT_STATUS_ENQUIRY:
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_CHECK)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "l3dss1_check_messagetype_validity mt(%x) OK", mt);
|
|
|
|
|
break;
|
|
|
|
|
case MT_RESUME: /* RESUME only in user->net */
|
|
|
|
|
case MT_SUSPEND: /* SUSPEND only in user->net */
|
|
|
|
|
default:
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & (L3_DEB_CHECK | L3_DEB_WARN))
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "l3dss1_check_messagetype_validity mt(%x) fail", mt);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, CAUSE_MT_NOTIMPLEMENTED);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_std_ie_err(l3_process_t *pc, int ret) {
|
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_CHECK)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "check_infoelements ret %d", ret);
|
|
|
|
|
switch(ret) {
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case ERR_IE_COMPREHENSION:
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, CAUSE_MANDATORY_IE_MISS);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case ERR_IE_UNRECOGNIZED:
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, CAUSE_IE_NOTIMPLEMENTED);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case ERR_IE_LENGTH:
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, CAUSE_INVALID_CONTENTS);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case ERR_IE_SEQUENCE:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
static int
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_get_channel_id(l3_process_t *pc, struct sk_buff *skb) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
u_char *p;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->channel_id) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->channel_id;
|
|
|
|
|
p++;
|
2001-11-14 10:41:26 +00:00
|
|
|
|
if (test_bit(FLG_EXTCID, &pc->l3->Flag)) {
|
|
|
|
|
if (*p != 1) {
|
|
|
|
|
pc->bc = 1;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return (0);
|
2001-11-14 10:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (*p != 1) { /* len for BRI = 1 */
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "wrong chid len %d", *p);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return (-2);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
p++;
|
|
|
|
|
if (*p & 0x60) { /* only base rate interface */
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "wrong chid %x", *p);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return (-3);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
pc->bc = *p & 3;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
} else
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(-1);
|
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
static int
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3dss1_get_cause(l3_process_t *pc, struct sk_buff *skb) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
u_char l;
|
|
|
|
|
u_char *p;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->cause) {
|
|
|
|
|
p = skb->data;
|
2003-11-09 16:03:19 +00:00
|
|
|
|
p += L3_EXTRA_SIZE + qi->cause;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
p++;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l = *p++;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (l>30) {
|
2003-11-09 16:03:19 +00:00
|
|
|
|
return(-30);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
if (l)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l--;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
else {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(-2);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (l && !(*p & 0x80)) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l--;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
p++; /* skip recommendation */
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
p++;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (l) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (!(*p & 0x80)) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(-3);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
pc->err = *p & 0x7F;
|
|
|
|
|
} else {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(-4);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
} else
|
2003-07-07 14:29:39 +00:00
|
|
|
|
return(-1);
|
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_release_req(l3_process_t *pc, u_char pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2001-02-19 11:51:42 +00:00
|
|
|
|
StopAllL3Timer(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 19);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 19);
|
|
|
|
|
l3dss1_message(pc, MT_RELEASE);
|
|
|
|
|
}
|
|
|
|
|
L3AddTimer(&pc->timer, T308, CC_T308_1);
|
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
static void
|
|
|
|
|
l3dss1_setup_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = skb_clone(arg, GFP_ATOMIC);
|
|
|
|
|
|
|
|
|
|
if (!SendMsg(pc, arg, 1)) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T303, CC_T303);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
pc->t303skb = skb;
|
|
|
|
|
} else
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
static void
|
|
|
|
|
l3dss1_disconnect_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
Q931_info_t *qi;
|
|
|
|
|
u_char *p;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
StopAllL3Timer(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
qi = (Q931_info_t *)skb->data;
|
|
|
|
|
if (!qi->cause) {
|
|
|
|
|
qi->cause = skb->len - L3_EXTRA_SIZE;
|
|
|
|
|
p = skb_put(skb, 4);
|
|
|
|
|
*p++ = IE_CAUSE;
|
|
|
|
|
*p++ = 2;
|
|
|
|
|
*p++ = 0x80 | CAUSE_LOC_USER;
|
|
|
|
|
*p++ = 0x80 | CAUSE_NORMALUNSPECIFIED;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
SendMsg(pc, arg, 11);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 11);
|
|
|
|
|
l3dss1_message_cause(pc, MT_DISCONNECT, CAUSE_NORMALUNSPECIFIED);
|
|
|
|
|
}
|
|
|
|
|
L3AddTimer(&pc->timer, T305, CC_T305);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_connect_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
if (!pc->bc) {
|
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "D-chan connect for waiting call");
|
|
|
|
|
l3dss1_disconnect_req(pc, pr, NULL);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 8);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 8);
|
|
|
|
|
l3dss1_message(pc, MT_CONNECT);
|
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T313, CC_T313);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_release_cmpl_req(l3_process_t *pc, u_char pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
|
|
|
|
StopAllL3Timer(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 0);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 0);
|
|
|
|
|
l3dss1_message(pc, MT_RELEASE_COMPLETE);
|
|
|
|
|
}
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_RELEASE_COMPLETE | CONFIRM, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_alert_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 7);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 7);
|
|
|
|
|
l3dss1_message(pc, MT_ALERTING);
|
|
|
|
|
}
|
2001-02-20 00:34:55 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_proceed_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 9);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 9);
|
|
|
|
|
l3dss1_message(pc, MT_CALL_PROCEEDING);
|
|
|
|
|
}
|
2001-02-20 00:34:55 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_setup_ack_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 25);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 25);
|
|
|
|
|
l3dss1_message(pc, MT_SETUP_ACKNOWLEDGE);
|
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T302, CC_T302);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_suspend_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 15);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 15);
|
|
|
|
|
l3dss1_message(pc, MT_SUSPEND);
|
|
|
|
|
}
|
|
|
|
|
L3AddTimer(&pc->timer, T319, CC_T319);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_resume_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 17);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
newl3state(pc, 17);
|
|
|
|
|
l3dss1_message(pc, MT_RESUME);
|
|
|
|
|
}
|
|
|
|
|
L3AddTimer(&pc->timer, T318, CC_T318);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-29 23:26:30 +00:00
|
|
|
|
static void
|
|
|
|
|
l3dss1_status_enq_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (arg)
|
|
|
|
|
dev_kfree_skb(arg);
|
2002-04-29 23:26:30 +00:00
|
|
|
|
l3dss1_message(pc, MT_STATUS_ENQUIRY);
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-09 16:03:19 +00:00
|
|
|
|
static void
|
|
|
|
|
l3dss1_information_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
if (pc->state == 2) {
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T304, CC_T304);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_progress_req(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
if (arg) {
|
|
|
|
|
SendMsg(pc, arg, 10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-11 22:46:19 +00:00
|
|
|
|
static void
|
|
|
|
|
l3dss1_release_cmpl(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
StopAllL3Timer(pc);
|
|
|
|
|
newl3state(pc, 0);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_RELEASE_COMPLETE | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_alerting(l3_process_t *pc, u_char pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2001-02-19 11:51:42 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
ret = check_infoelements(pc, skb, ie_ALERTING);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer); /* T304 */
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb) {
|
|
|
|
|
dev_kfree_skb(pc->t303skb);
|
|
|
|
|
pc->t303skb = NULL;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
newl3state(pc, 4);
|
|
|
|
|
if (ret)
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_ALERTING | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_call_proc(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
|
|
|
|
u_char cause;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(ret = l3dss1_get_channel_id(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if ((0 == pc->bc) || (3 == pc->bc)) {
|
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "setup answer with wrong chid %x", pc->bc);
|
|
|
|
|
l3dss1_status_send(pc, CAUSE_INVALID_CONTENTS);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if (1 == pc->state) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "setup answer wrong chid (ret %d)", ret);
|
|
|
|
|
if (ret == -1)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else
|
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, cause);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Now we are on none mandatory IEs */
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_CALL_PROCEEDING);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb) {
|
|
|
|
|
dev_kfree_skb(pc->t303skb);
|
|
|
|
|
pc->t303skb = NULL;
|
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
newl3state(pc, 3);
|
|
|
|
|
L3AddTimer(&pc->timer, T310, CC_T310);
|
|
|
|
|
if (ret) /* STATUS for none mandatory IE errors after actions are taken */
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_PROCEEDING | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_connect(l3_process_t *pc, u_char pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
ret = check_infoelements(pc, skb, ie_CONNECT);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
L3DelTimer(&pc->timer); /* T310 */
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb) {
|
|
|
|
|
dev_kfree_skb(pc->t303skb);
|
|
|
|
|
pc->t303skb = NULL;
|
|
|
|
|
}
|
2002-06-26 08:38:24 +00:00
|
|
|
|
l3dss1_message(pc, MT_CONNECT_ACKNOWLEDGE);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
newl3state(pc, 10);
|
|
|
|
|
if (ret)
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_CONNECT | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_connect_ack(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_CONNECT_ACKNOWLEDGE);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
newl3state(pc, 10);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb) {
|
|
|
|
|
dev_kfree_skb(pc->t303skb);
|
|
|
|
|
pc->t303skb = NULL;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (ret)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_CONNECT_ACKNOWLEDGE | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_disconnect(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
|
|
|
|
u_char cause = 0;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
StopAllL3Timer(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((ret = l3dss1_get_cause(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "DISC get_cause ret(%d)", ret);
|
|
|
|
|
if (ret == -1)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
else
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
}
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_DISCONNECT);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret)
|
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else if ((!cause) && (ERR_IE_UNRECOGNIZED == ret))
|
|
|
|
|
cause = CAUSE_IE_NOTIMPLEMENTED;
|
|
|
|
|
ret = pc->state;
|
|
|
|
|
if (cause)
|
|
|
|
|
newl3state(pc, 19);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
else
|
|
|
|
|
newl3state(pc, 12);
|
2003-07-18 16:36:03 +00:00
|
|
|
|
if (11 != ret) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_DISCONNECT | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
} else if (!cause) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_release_req(pc, pr, NULL);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
} else
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (cause) {
|
|
|
|
|
l3dss1_message_cause(pc, MT_RELEASE, cause);
|
|
|
|
|
L3AddTimer(&pc->timer, T308, CC_T308_1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_setup_ack(l3_process_t *pc, u_char pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
|
|
|
|
u_char cause;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(ret = l3dss1_get_channel_id(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if ((0 == pc->bc) || (3 == pc->bc)) {
|
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "setup answer with wrong chid %x", pc->bc);
|
|
|
|
|
l3dss1_status_send(pc, CAUSE_INVALID_CONTENTS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "setup answer wrong chid (ret %d)", ret);
|
|
|
|
|
if (ret == -1)
|
2001-02-19 11:51:42 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else
|
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
l3dss1_status_send(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
/* Now we are on none mandatory IEs */
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_SETUP_ACKNOWLEDGE);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb) {
|
|
|
|
|
dev_kfree_skb(pc->t303skb);
|
|
|
|
|
pc->t303skb = NULL;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
newl3state(pc, 2);
|
|
|
|
|
L3AddTimer(&pc->timer, T304, CC_T304);
|
|
|
|
|
if (ret) /* STATUS for none mandatory IE errors after actions are taken */
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_SETUP_ACKNOWLEDGE | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_setup(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
u_char *p, cause, bc2 = 0;
|
|
|
|
|
int bcfound = 0;
|
|
|
|
|
struct sk_buff *nskb, *skb = arg;
|
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
int err = 0, **idp;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Bearer Capabilities
|
|
|
|
|
*/
|
|
|
|
|
/* only the first occurence 'll be detected ! */
|
2003-07-07 14:29:39 +00:00
|
|
|
|
p = skb->data;
|
|
|
|
|
if (qi->bearer_capability) {
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->bearer_capability;
|
|
|
|
|
p++;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if ((p[0] < 2) || (p[0] > 11))
|
2001-02-11 22:46:19 +00:00
|
|
|
|
err = 1;
|
|
|
|
|
else {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
bc2 = p[2] & 0x7f;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
switch (p[1] & 0x7f) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
case 0x00: /* Speech */
|
|
|
|
|
case 0x10: /* 3.1 Khz audio */
|
|
|
|
|
case 0x08: /* Unrestricted digital information */
|
|
|
|
|
case 0x09: /* Restricted digital information */
|
|
|
|
|
case 0x11:
|
|
|
|
|
/* Unrestr. digital information with
|
|
|
|
|
* tones/announcements ( or 7 kHz audio
|
|
|
|
|
*/
|
|
|
|
|
case 0x18: /* Video */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
err = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
switch (p[2] & 0x7f) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
case 0x40: /* packed mode */
|
|
|
|
|
case 0x10: /* 64 kbit */
|
|
|
|
|
case 0x11: /* 2*64 kbit */
|
|
|
|
|
case 0x13: /* 384 kbit */
|
|
|
|
|
case 0x15: /* 1536 kbit */
|
|
|
|
|
case 0x17: /* 1920 kbit */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
err = 3;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (err) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "setup with wrong bearer(l=%d:%x,%x)",
|
2001-02-19 11:51:42 +00:00
|
|
|
|
p[0], p[1], p[2]);
|
|
|
|
|
l3dss1_msg_without_setup(pc, CAUSE_INVALID_CONTENTS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
} else {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "setup without bearer capabilities");
|
|
|
|
|
/* ETS 300-104 1.3.3 */
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_msg_without_setup(pc, CAUSE_MANDATORY_IE_MISS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Channel Identification
|
|
|
|
|
*/
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(err = l3dss1_get_channel_id(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->bc) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((3 == pc->bc) && (0x10 == bc2)) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "setup with wrong chid %x",
|
2001-02-19 11:51:42 +00:00
|
|
|
|
pc->bc);
|
|
|
|
|
l3dss1_msg_without_setup(pc,
|
2001-02-11 22:46:19 +00:00
|
|
|
|
CAUSE_INVALID_CONTENTS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bcfound++;
|
|
|
|
|
} else {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "setup without bchannel, call waiting");
|
|
|
|
|
bcfound++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "setup with wrong chid ret %d", err);
|
|
|
|
|
if (err == -1)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else
|
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_msg_without_setup(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Now we are on none mandatory IEs */
|
|
|
|
|
err = check_infoelements(pc, skb, ie_SETUP);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == err) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_msg_without_setup(pc, CAUSE_MANDATORY_IE_MISS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
newl3state(pc, 6);
|
2001-02-20 00:34:55 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T_CTRL, CC_TCTRL);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (err) /* STATUS for none mandatory IE errors after actions are taken */
|
|
|
|
|
l3dss1_std_ie_err(pc, err);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((nskb = alloc_skb(sizeof(idp) + 8, GFP_ATOMIC))) {
|
|
|
|
|
idp = (int **)skb_put(nskb, sizeof(idp));
|
|
|
|
|
*idp = &pc->id;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
err = mISDN_l3up(pc, CC_NEW_CR | INDICATION, nskb);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (err)
|
|
|
|
|
dev_kfree_skb(nskb);
|
|
|
|
|
} else
|
|
|
|
|
err = -ENOMEM;
|
2001-10-31 23:06:07 +00:00
|
|
|
|
if (err) {
|
2001-02-27 17:45:44 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-10-31 23:06:07 +00:00
|
|
|
|
l3_debug(pc->l3, "cannot register SETUP CR err(%d)",
|
|
|
|
|
err);
|
2001-02-27 17:45:44 +00:00
|
|
|
|
release_l3_process(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-10-31 23:06:07 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_SETUP | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_reset(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_release(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret, cause=0;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
StopAllL3Timer(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((ret = l3dss1_get_cause(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "REL get_cause ret(%d)", ret);
|
|
|
|
|
if ((ret == -1) && (pc->state != 11))
|
2001-02-19 11:51:42 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
else if (ret != -1)
|
2001-02-19 11:51:42 +00:00
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_RELEASE);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret)
|
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else if ((ERR_IE_UNRECOGNIZED == ret) && (!cause))
|
|
|
|
|
cause = CAUSE_IE_NOTIMPLEMENTED;
|
|
|
|
|
if (cause)
|
|
|
|
|
l3dss1_message_cause(pc, MT_RELEASE_COMPLETE, cause);
|
|
|
|
|
else
|
|
|
|
|
l3dss1_message(pc, MT_RELEASE_COMPLETE);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_RELEASE | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
newl3state(pc, 0);
|
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_progress(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
int err = 0;
|
|
|
|
|
u_char *p, cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
|
|
|
|
|
if (qi->progress) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->progress;
|
|
|
|
|
p++;
|
|
|
|
|
if (p[0] != 2) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
err = 1;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
} else if (!(p[1] & 0x70)) {
|
|
|
|
|
switch (p[1]) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
case 0x80:
|
|
|
|
|
case 0x81:
|
|
|
|
|
case 0x82:
|
|
|
|
|
case 0x84:
|
|
|
|
|
case 0x85:
|
|
|
|
|
case 0x87:
|
|
|
|
|
case 0x8a:
|
2003-07-07 14:29:39 +00:00
|
|
|
|
switch (p[2]) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
case 0x81:
|
|
|
|
|
case 0x82:
|
|
|
|
|
case 0x83:
|
|
|
|
|
case 0x84:
|
|
|
|
|
case 0x88:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
err = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
err = 3;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
err = 4;
|
|
|
|
|
}
|
|
|
|
|
if (err) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "progress error %d", err);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Now we are on none mandatory IEs */
|
|
|
|
|
err = check_infoelements(pc, skb, ie_PROGRESS);
|
|
|
|
|
if (err)
|
|
|
|
|
l3dss1_std_ie_err(pc, err);
|
2003-07-18 16:36:03 +00:00
|
|
|
|
if (ERR_IE_COMPREHENSION != err) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_PROGRESS | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
} else
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_notify(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
int err = 0;
|
|
|
|
|
u_char *p, cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
|
|
|
|
|
if (qi->notify) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->notify;
|
|
|
|
|
p++;
|
|
|
|
|
if (p[0] != 1) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
err = 1;
|
|
|
|
|
} else {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
switch (p[1]) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
case 0x80:
|
|
|
|
|
case 0x81:
|
|
|
|
|
case 0x82:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
err = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
err = 3;
|
|
|
|
|
}
|
|
|
|
|
if (err) {
|
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "notify error %d", err);
|
|
|
|
|
l3dss1_status_send(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Now we are on none mandatory IEs */
|
|
|
|
|
err = check_infoelements(pc, skb, ie_NOTIFY);
|
|
|
|
|
if (err)
|
|
|
|
|
l3dss1_std_ie_err(pc, err);
|
2003-07-18 16:36:03 +00:00
|
|
|
|
if (ERR_IE_COMPREHENSION != err) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_NOTIFY | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
} else
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_enq(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
int ret;
|
|
|
|
|
struct sk_buff *skb = arg;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
ret = check_infoelements(pc, skb, ie_STATUS_ENQUIRY);
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
|
|
|
|
l3dss1_status_send(pc, CAUSE_STATUS_RESPONSE);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_STATUS_ENQUIRY | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_information(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
int ret;
|
|
|
|
|
struct sk_buff *skb = arg;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
ret = check_infoelements(pc, skb, ie_INFORMATION);
|
|
|
|
|
if (ret)
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
|
|
|
|
if (pc->state == 25) { /* overlap receiving */
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T302, CC_T302);
|
|
|
|
|
}
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_INFORMATION | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_release_ind(l3_process_t *pc, u_char pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
u_char *p;
|
|
|
|
|
struct sk_buff *skb = arg;
|
2003-07-18 16:36:03 +00:00
|
|
|
|
int err, callState = -1;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
|
|
|
|
|
if (qi->call_state) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->call_state;
|
|
|
|
|
p++;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (1 == *p++)
|
|
|
|
|
callState = *p;
|
|
|
|
|
}
|
|
|
|
|
if (callState == 0) {
|
|
|
|
|
/* ETS 300-104 7.6.1, 8.6.1, 10.6.1... and 16.1
|
|
|
|
|
* set down layer 3 without sending any message
|
|
|
|
|
*/
|
|
|
|
|
newl3state(pc, 0);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
err = mISDN_l3up(pc, CC_RELEASE | INDICATION, skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
} else {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
err = mISDN_l3up(pc, CC_RELEASE | INDICATION, skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-18 16:36:03 +00:00
|
|
|
|
if (err)
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_restart(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_RELEASE | INDICATION, NULL);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
release_l3_process(pc);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (skb)
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_status(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
int ret = 0;
|
|
|
|
|
u_char *p, cause = 0, callState = 0xff;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((ret = l3dss1_get_cause(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "STATUS get_cause ret(%d)", ret);
|
|
|
|
|
if (ret == -1)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
else
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->call_state) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->call_state;
|
|
|
|
|
p++;
|
|
|
|
|
if (1 == *p++) {
|
|
|
|
|
callState = *p;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (!ie_in_set(pc, callState, l3_valid_states))
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
} else
|
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
|
|
|
|
} else
|
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
if (!cause) { /* no error before */
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_STATUS);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret)
|
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else if (ERR_IE_UNRECOGNIZED == ret)
|
|
|
|
|
cause = CAUSE_IE_NOTIMPLEMENTED;
|
|
|
|
|
}
|
|
|
|
|
if (cause) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "STATUS error(%d/%d)", ret, cause);
|
|
|
|
|
l3dss1_status_send(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (cause != CAUSE_IE_NOTIMPLEMENTED) {
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->cause)
|
2001-02-19 11:51:42 +00:00
|
|
|
|
cause = pc->err & 0x7f;
|
|
|
|
|
if ((cause == CAUSE_PROTOCOL_ERROR) && (callState == 0)) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
/* ETS 300-104 7.6.1, 8.6.1, 10.6.1...
|
|
|
|
|
* if received MT_STATUS with cause == 111 and call
|
|
|
|
|
* state == 0, then we must set down layer 3
|
|
|
|
|
*/
|
|
|
|
|
newl3state(pc, 0);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
ret = mISDN_l3up(pc, CC_STATUS| INDICATION, skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
release_l3_process(pc);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
} else
|
2003-07-21 12:00:05 +00:00
|
|
|
|
ret = mISDN_l3up(pc, CC_STATUS | INDICATION, skb);
|
2003-07-18 16:36:03 +00:00
|
|
|
|
if (ret)
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_facility(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_FACILITY);
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!qi->facility) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "FACILITY without IE_FACILITY");
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_FACILITY | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_suspend_ack(l3_process_t *pc, u_char pr, void *arg) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
newl3state(pc, 0);
|
|
|
|
|
/* We don't handle suspend_ack for IE errors now */
|
|
|
|
|
if ((ret = check_infoelements(pc, skb, ie_SUSPEND_ACKNOWLEDGE)))
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "SUSPACK check ie(%d)",ret);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_SUSPEND_ACKNOWLEDGE | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_suspend_rej(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
|
|
|
|
u_char cause;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((ret = l3dss1_get_cause(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "SUSP_REJ get_cause err(%d)", ret);
|
|
|
|
|
if (ret == -1)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else
|
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_SUSPEND_REJECT);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_SUSPEND_REJECT | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
newl3state(pc, 10);
|
|
|
|
|
if (ret) /* STATUS for none mandatory IE errors after actions are taken */
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_resume_ack(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(ret = l3dss1_get_channel_id(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if ((0 == pc->bc) || (3 == pc->bc)) {
|
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "resume ack with wrong chid %x",
|
|
|
|
|
pc->bc);
|
|
|
|
|
l3dss1_status_send(pc, CAUSE_INVALID_CONTENTS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if (1 == pc->state) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
|
|
|
|
l3_debug(pc->l3, "resume ack without chid err(%d)",
|
2003-07-07 14:29:39 +00:00
|
|
|
|
ret);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, CAUSE_MANDATORY_IE_MISS);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_RESUME_ACKNOWLEDGE);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_RESUME_ACKNOWLEDGE | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
newl3state(pc, 10);
|
|
|
|
|
if (ret) /* STATUS for none mandatory IE errors after actions are taken */
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_resume_rej(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
int ret;
|
|
|
|
|
u_char cause;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((ret = l3dss1_get_cause(pc, skb))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (pc->l3->debug & L3_DEB_WARN)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(pc->l3, "RES_REJ get_cause err(%d)", ret);
|
|
|
|
|
if (ret == -1)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = CAUSE_MANDATORY_IE_MISS;
|
|
|
|
|
else
|
|
|
|
|
cause = CAUSE_INVALID_CONTENTS;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, cause);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ret = check_infoelements(pc, skb, ie_RESUME_REJECT);
|
|
|
|
|
if (ERR_IE_COMPREHENSION == ret) {
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_RESUME_REJECT | INDICATION, skb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
newl3state(pc, 0);
|
|
|
|
|
if (ret) /* STATUS for none mandatory IE errors after actions are taken */
|
|
|
|
|
l3dss1_std_ie_err(pc, ret);
|
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_global_restart(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
u_char *p, ri, ch = 0, chan = 0;
|
|
|
|
|
struct sk_buff *skb = arg;
|
|
|
|
|
Q931_info_t *qi = (Q931_info_t *)skb->data;
|
|
|
|
|
l3_process_t *up;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
newl3state(pc, 2);
|
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->restart_ind) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->restart_ind;
|
|
|
|
|
p++;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
ri = p[1];
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "Restart %x", ri);
|
|
|
|
|
} else {
|
|
|
|
|
l3_debug(pc->l3, "Restart without restart IE");
|
|
|
|
|
ri = 0x86;
|
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->channel_id) {
|
|
|
|
|
p = skb->data;
|
|
|
|
|
p += L3_EXTRA_SIZE + qi->channel_id;
|
|
|
|
|
p++;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
chan = p[1] & 3;
|
|
|
|
|
ch = p[1];
|
|
|
|
|
if (pc->l3->debug)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(pc->l3, "Restart for channel %d", chan);
|
|
|
|
|
}
|
|
|
|
|
up = pc->l3->proc;
|
|
|
|
|
while (up) {
|
|
|
|
|
if ((ri & 7) == 7)
|
2001-02-13 10:42:55 +00:00
|
|
|
|
dss1man(up, CC_RESTART | REQUEST, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
else if (up->bc == chan)
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(up, CC_RESTART | REQUEST, NULL);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
up = up->next;
|
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
skb = MsgStart(pc, MT_RESTART_ACKNOWLEDGE, chan ? 6 : 3);
|
|
|
|
|
p = skb_put(skb, chan ? 6 : 3);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (chan) {
|
2003-07-07 14:29:39 +00:00
|
|
|
|
*p++ = IE_CHANNEL_ID;
|
|
|
|
|
*p++ = 1;
|
|
|
|
|
*p++ = ch | 0x80;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
*p++ = IE_RESTART_IND;
|
|
|
|
|
*p++ = 1;
|
|
|
|
|
*p++ = ri;
|
|
|
|
|
if (l3_msg(pc->l3, DL_DATA | REQUEST, DINFO_SKB, 0, skb))
|
|
|
|
|
kfree_skb(skb);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_dummy(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t302(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
newl3state(pc, 11);
|
|
|
|
|
l3dss1_message_cause(pc, MT_DISCONNECT, CAUSE_INVALID_NUMBER);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_TIMEOUT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t303(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
if (pc->n303 > 0) {
|
|
|
|
|
pc->n303--;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb) {
|
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
if (pc->n303 > 0) {
|
|
|
|
|
skb = skb_clone(pc->t303skb, GFP_ATOMIC);
|
|
|
|
|
} else {
|
|
|
|
|
skb = pc->t303skb;
|
|
|
|
|
pc->t303skb = NULL;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (skb)
|
|
|
|
|
SendMsg(pc, skb, -1);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
L3AddTimer(&pc->timer, T303, CC_T303);
|
|
|
|
|
return;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (pc->t303skb)
|
|
|
|
|
kfree_skb(pc->t303skb);
|
|
|
|
|
pc->t303skb = NULL;
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_message_cause(pc, MT_RELEASE_COMPLETE, CAUSE_TIMER_EXPIRED);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_TIMEOUT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t304(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
newl3state(pc, 11);
|
|
|
|
|
l3dss1_message_cause(pc, MT_DISCONNECT, CAUSE_TIMER_EXPIRED);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_TIMEOUT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t305(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
#if 0
|
|
|
|
|
if (pc->cause != NO_CAUSE)
|
|
|
|
|
cause = pc->cause;
|
|
|
|
|
#endif
|
|
|
|
|
newl3state(pc, 19);
|
|
|
|
|
l3dss1_message_cause(pc, MT_RELEASE, CAUSE_NORMALUNSPECIFIED);
|
|
|
|
|
L3AddTimer(&pc->timer, T308, CC_T308_1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t310(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
newl3state(pc, 11);
|
|
|
|
|
l3dss1_message_cause(pc, MT_DISCONNECT, CAUSE_TIMER_EXPIRED);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_TIMEOUT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t313(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
newl3state(pc, 11);
|
|
|
|
|
l3dss1_message_cause(pc, MT_DISCONNECT, CAUSE_TIMER_EXPIRED);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_TIMEOUT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t308_1(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
newl3state(pc, 19);
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
l3dss1_message(pc, MT_RELEASE);
|
|
|
|
|
L3AddTimer(&pc->timer, T308, CC_T308_2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t308_2(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_TIMEOUT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
release_l3_process(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t318(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
#if 0
|
|
|
|
|
pc->cause = 102; /* Timer expiry */
|
|
|
|
|
pc->para.loc = 0; /* local */
|
|
|
|
|
#endif
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_RESUME_REJECT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
newl3state(pc, 19);
|
|
|
|
|
l3dss1_message(pc, MT_RELEASE);
|
|
|
|
|
L3AddTimer(&pc->timer, T308, CC_T308_1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_t319(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
#if 0
|
|
|
|
|
pc->cause = 102; /* Timer expiry */
|
|
|
|
|
pc->para.loc = 0; /* local */
|
|
|
|
|
#endif
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_l3up(pc, CC_SUSPEND_REJECT | INDICATION, NULL);
|
2001-02-19 11:51:42 +00:00
|
|
|
|
newl3state(pc, 10);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_dl_reset(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2003-07-07 14:29:39 +00:00
|
|
|
|
struct sk_buff *nskb, *skb = alloc_skb(L3_EXTRA_SIZE + 10, GFP_ATOMIC);
|
|
|
|
|
Q931_info_t *qi;
|
|
|
|
|
u_char *p;
|
2001-02-21 19:18:27 +00:00
|
|
|
|
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!skb)
|
|
|
|
|
return;
|
|
|
|
|
qi = (Q931_info_t *)skb_put(skb, L3_EXTRA_SIZE);
|
|
|
|
|
initQ931_info(qi);
|
|
|
|
|
qi->type = MT_DISCONNECT;
|
|
|
|
|
qi->cause = 1;
|
|
|
|
|
p = skb_put(skb, 5);
|
|
|
|
|
p++;
|
|
|
|
|
*p++ = IE_CAUSE;
|
|
|
|
|
*p++ = 2;
|
|
|
|
|
*p++ = 0x80 | CAUSE_LOC_USER;
|
|
|
|
|
*p++ = 0x80 | CAUSE_TEMPORARY_FAILURE;
|
|
|
|
|
nskb = skb_clone(skb, GFP_ATOMIC);
|
|
|
|
|
l3dss1_disconnect_req(pc, pr, skb);
|
2003-07-18 16:36:03 +00:00
|
|
|
|
if (nskb) {
|
2003-11-09 16:03:19 +00:00
|
|
|
|
// jolly patch start: frage
|
|
|
|
|
#warning jolly asks: wieso verschicken wir ein REQUEST nach oben? wenn das nicht ok ist, dann schaue nach allen REQUESTS, da hier mehrere sind.
|
|
|
|
|
// jolly patch stop
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if (mISDN_l3up(pc, CC_DISCONNECT | REQUEST, nskb))
|
2003-07-18 16:36:03 +00:00
|
|
|
|
dev_kfree_skb(nskb);
|
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_dl_release(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2001-02-21 19:18:27 +00:00
|
|
|
|
newl3state(pc, 0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
#if 0
|
2001-02-19 11:51:42 +00:00
|
|
|
|
pc->cause = 0x1b; /* Destination out of order */
|
2001-02-11 22:46:19 +00:00
|
|
|
|
pc->para.loc = 0;
|
|
|
|
|
#endif
|
2003-11-09 16:03:19 +00:00
|
|
|
|
// jolly patch start: shouldn't we use CC_RELEASE_COMPLETE (cause 27=0x1b) instead and do ONE DL_RLEASE for the complete port, not for all processes ?
|
|
|
|
|
// mISDN_l3up(pc, DL_RELEASE | INDICATION, NULL);
|
|
|
|
|
// hier muesste man eine message mit cause generieren.
|
|
|
|
|
// jolly patch_stop:
|
2001-02-21 19:18:27 +00:00
|
|
|
|
release_l3_process(pc);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_dl_reestablish(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
2001-02-21 19:18:27 +00:00
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
L3AddTimer(&pc->timer, T309, CC_T309);
|
2001-03-03 18:17:16 +00:00
|
|
|
|
l3_msg(pc->l3, DL_ESTABLISH | REQUEST, 0, 0, NULL);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
l3dss1_dl_reest_status(l3_process_t *pc, u_char pr, void *arg)
|
|
|
|
|
{
|
|
|
|
|
L3DelTimer(&pc->timer);
|
|
|
|
|
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(pc, CAUSE_NORMALUNSPECIFIED);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
|
static struct stateentry downstatelist[] =
|
|
|
|
|
{
|
|
|
|
|
{SBIT(0),
|
|
|
|
|
CC_SETUP | REQUEST, l3dss1_setup_req},
|
2003-11-09 16:03:19 +00:00
|
|
|
|
// jolly patch start: wie soll ich sonst w<>hlen :=)
|
|
|
|
|
{SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) |
|
|
|
|
|
SBIT(10) | SBIT(11) | SBIT(12) | SBIT(15) | SBIT(25),
|
|
|
|
|
CC_INFORMATION | REQUEST, l3dss1_information_req},
|
|
|
|
|
{SBIT(10),
|
|
|
|
|
CC_PROGRESS | REQUEST, l3dss1_progress_req},
|
|
|
|
|
// jolly patch stop
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{SBIT(0),
|
|
|
|
|
CC_RESUME | REQUEST, l3dss1_resume_req},
|
2001-02-13 10:42:55 +00:00
|
|
|
|
{SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(6) | SBIT(7) |
|
|
|
|
|
SBIT(8) | SBIT(9) | SBIT(10) | SBIT(25),
|
2001-02-11 22:46:19 +00:00
|
|
|
|
CC_DISCONNECT | REQUEST, l3dss1_disconnect_req},
|
2002-04-29 23:26:30 +00:00
|
|
|
|
{SBIT(11) | SBIT(12),
|
2001-02-11 22:46:19 +00:00
|
|
|
|
CC_RELEASE | REQUEST, l3dss1_release_req},
|
|
|
|
|
{ALL_STATES,
|
|
|
|
|
CC_RESTART | REQUEST, l3dss1_restart},
|
|
|
|
|
{SBIT(6) | SBIT(25),
|
2001-02-19 11:51:42 +00:00
|
|
|
|
CC_SETUP | RESPONSE, l3dss1_release_cmpl_req},
|
2001-10-31 23:06:07 +00:00
|
|
|
|
{ALL_STATES,
|
|
|
|
|
CC_RELEASE_COMPLETE | REQUEST, l3dss1_release_cmpl_req},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{SBIT(6) | SBIT(25),
|
2001-03-11 21:05:21 +00:00
|
|
|
|
CC_PROCEEDING | REQUEST, l3dss1_proceed_req},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{SBIT(6),
|
2001-03-11 21:05:21 +00:00
|
|
|
|
CC_SETUP_ACKNOWLEDGE | REQUEST, l3dss1_setup_ack_req},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{SBIT(25),
|
2001-03-11 21:05:21 +00:00
|
|
|
|
CC_SETUP_ACKNOWLEDGE | REQUEST, l3dss1_dummy},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{SBIT(6) | SBIT(9) | SBIT(25),
|
|
|
|
|
CC_ALERTING | REQUEST, l3dss1_alert_req},
|
|
|
|
|
{SBIT(6) | SBIT(7) | SBIT(9) | SBIT(25),
|
2001-02-13 10:42:55 +00:00
|
|
|
|
CC_CONNECT | REQUEST, l3dss1_connect_req},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{SBIT(10),
|
|
|
|
|
CC_SUSPEND | REQUEST, l3dss1_suspend_req},
|
2002-04-29 23:26:30 +00:00
|
|
|
|
{ALL_STATES,
|
|
|
|
|
CC_STATUS_ENQUIRY | REQUEST, l3dss1_status_enq_req},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define DOWNSLLEN \
|
|
|
|
|
(sizeof(downstatelist) / sizeof(struct stateentry))
|
|
|
|
|
|
|
|
|
|
static struct stateentry datastatelist[] =
|
|
|
|
|
{
|
|
|
|
|
{ALL_STATES,
|
|
|
|
|
MT_STATUS_ENQUIRY, l3dss1_status_enq},
|
|
|
|
|
{ALL_STATES,
|
|
|
|
|
MT_FACILITY, l3dss1_facility},
|
|
|
|
|
{SBIT(19),
|
|
|
|
|
MT_STATUS, l3dss1_release_ind},
|
|
|
|
|
{ALL_STATES,
|
|
|
|
|
MT_STATUS, l3dss1_status},
|
|
|
|
|
{SBIT(0),
|
|
|
|
|
MT_SETUP, l3dss1_setup},
|
|
|
|
|
{SBIT(6) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) | SBIT(11) | SBIT(12) |
|
|
|
|
|
SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
|
|
|
|
|
MT_SETUP, l3dss1_dummy},
|
|
|
|
|
{SBIT(1) | SBIT(2),
|
|
|
|
|
MT_CALL_PROCEEDING, l3dss1_call_proc},
|
|
|
|
|
{SBIT(1),
|
|
|
|
|
MT_SETUP_ACKNOWLEDGE, l3dss1_setup_ack},
|
|
|
|
|
{SBIT(2) | SBIT(3),
|
|
|
|
|
MT_ALERTING, l3dss1_alerting},
|
|
|
|
|
{SBIT(2) | SBIT(3),
|
|
|
|
|
MT_PROGRESS, l3dss1_progress},
|
|
|
|
|
{SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) |
|
|
|
|
|
SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
|
|
|
|
|
MT_INFORMATION, l3dss1_information},
|
|
|
|
|
{SBIT(10) | SBIT(11) | SBIT(15),
|
|
|
|
|
MT_NOTIFY, l3dss1_notify},
|
|
|
|
|
{SBIT(0) | SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(10) |
|
|
|
|
|
SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
|
|
|
|
|
MT_RELEASE_COMPLETE, l3dss1_release_cmpl},
|
|
|
|
|
{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),
|
|
|
|
|
MT_RELEASE, l3dss1_release},
|
|
|
|
|
{SBIT(19), MT_RELEASE, l3dss1_release_ind},
|
|
|
|
|
{SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) | SBIT(11) | SBIT(15) | SBIT(17) | SBIT(25),
|
|
|
|
|
MT_DISCONNECT, l3dss1_disconnect},
|
|
|
|
|
{SBIT(19),
|
|
|
|
|
MT_DISCONNECT, l3dss1_dummy},
|
|
|
|
|
{SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4),
|
|
|
|
|
MT_CONNECT, l3dss1_connect},
|
|
|
|
|
{SBIT(8),
|
|
|
|
|
MT_CONNECT_ACKNOWLEDGE, l3dss1_connect_ack},
|
|
|
|
|
{SBIT(15),
|
|
|
|
|
MT_SUSPEND_ACKNOWLEDGE, l3dss1_suspend_ack},
|
|
|
|
|
{SBIT(15),
|
|
|
|
|
MT_SUSPEND_REJECT, l3dss1_suspend_rej},
|
|
|
|
|
{SBIT(17),
|
|
|
|
|
MT_RESUME_ACKNOWLEDGE, l3dss1_resume_ack},
|
|
|
|
|
{SBIT(17),
|
|
|
|
|
MT_RESUME_REJECT, l3dss1_resume_rej},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define DATASLLEN \
|
|
|
|
|
(sizeof(datastatelist) / sizeof(struct stateentry))
|
|
|
|
|
|
|
|
|
|
static struct stateentry globalmes_list[] =
|
|
|
|
|
{
|
|
|
|
|
{ALL_STATES,
|
|
|
|
|
MT_STATUS, l3dss1_status},
|
|
|
|
|
{SBIT(0),
|
|
|
|
|
MT_RESTART, l3dss1_global_restart},
|
|
|
|
|
/* {SBIT(1),
|
|
|
|
|
MT_RESTART_ACKNOWLEDGE, l3dss1_restart_ack},
|
|
|
|
|
*/
|
|
|
|
|
};
|
|
|
|
|
#define GLOBALM_LEN \
|
|
|
|
|
(sizeof(globalmes_list) / sizeof(struct stateentry))
|
|
|
|
|
|
|
|
|
|
static struct stateentry manstatelist[] =
|
|
|
|
|
{
|
|
|
|
|
{SBIT(2),
|
|
|
|
|
DL_ESTABLISH | INDICATION, l3dss1_dl_reset},
|
|
|
|
|
{SBIT(10),
|
|
|
|
|
DL_ESTABLISH | CONFIRM, l3dss1_dl_reest_status},
|
|
|
|
|
{SBIT(10),
|
|
|
|
|
DL_RELEASE | INDICATION, l3dss1_dl_reestablish},
|
|
|
|
|
{ALL_STATES,
|
|
|
|
|
DL_RELEASE | INDICATION, l3dss1_dl_release},
|
2001-02-13 10:42:55 +00:00
|
|
|
|
{SBIT(25),
|
|
|
|
|
CC_T302, l3dss1_t302},
|
|
|
|
|
{SBIT(1),
|
|
|
|
|
CC_T303, l3dss1_t303},
|
|
|
|
|
{SBIT(2),
|
|
|
|
|
CC_T304, l3dss1_t304},
|
|
|
|
|
{SBIT(3),
|
|
|
|
|
CC_T310, l3dss1_t310},
|
|
|
|
|
{SBIT(8),
|
|
|
|
|
CC_T313, l3dss1_t313},
|
|
|
|
|
{SBIT(11),
|
|
|
|
|
CC_T305, l3dss1_t305},
|
|
|
|
|
{SBIT(15),
|
|
|
|
|
CC_T319, l3dss1_t319},
|
|
|
|
|
{SBIT(17),
|
|
|
|
|
CC_T318, l3dss1_t318},
|
|
|
|
|
{SBIT(19),
|
|
|
|
|
CC_T308_1, l3dss1_t308_1},
|
|
|
|
|
{SBIT(19),
|
|
|
|
|
CC_T308_2, l3dss1_t308_2},
|
|
|
|
|
{SBIT(10),
|
|
|
|
|
CC_T309, l3dss1_dl_release},
|
2001-02-20 00:34:55 +00:00
|
|
|
|
{SBIT(6),
|
|
|
|
|
CC_TCTRL, l3dss1_reset},
|
2001-02-13 10:42:55 +00:00
|
|
|
|
{ALL_STATES,
|
|
|
|
|
CC_RESTART | REQUEST, l3dss1_restart},
|
2001-02-11 22:46:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define MANSLLEN \
|
|
|
|
|
(sizeof(manstatelist) / sizeof(struct stateentry))
|
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2003-07-27 11:14:19 +00:00
|
|
|
|
global_handler(layer3_t *l3, u_int mt, struct sk_buff *skb)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-27 11:14:19 +00:00
|
|
|
|
u_int i;
|
|
|
|
|
l3_process_t *proc = l3->global;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
|
|
|
|
proc->callref = skb->data[2]; /* cr flag */
|
|
|
|
|
for (i = 0; i < GLOBALM_LEN; i++)
|
|
|
|
|
if ((mt == globalmes_list[i].primitive) &&
|
|
|
|
|
((1 << proc->state) & globalmes_list[i].state))
|
|
|
|
|
break;
|
|
|
|
|
if (i == GLOBALM_LEN) {
|
|
|
|
|
if (l3->debug & L3_DEB_STATE) {
|
|
|
|
|
l3_debug(l3, "dss1 global state %d mt %x unhandled",
|
|
|
|
|
proc->state, mt);
|
|
|
|
|
}
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(proc, CAUSE_INVALID_CALLREF);
|
2003-11-09 09:22:17 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (l3->debug & L3_DEB_STATE) {
|
|
|
|
|
l3_debug(l3, "dss1 global %d mt %x",
|
|
|
|
|
proc->state, mt);
|
|
|
|
|
}
|
|
|
|
|
globalmes_list[i].rout(proc, mt, skb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-13 10:42:55 +00:00
|
|
|
|
static int
|
2003-07-21 12:00:05 +00:00
|
|
|
|
dss1_fromdown(mISDNif_t *hif, struct sk_buff *skb)
|
2001-08-02 14:51:56 +00:00
|
|
|
|
{
|
2002-05-01 01:00:40 +00:00
|
|
|
|
layer3_t *l3;
|
2003-07-27 11:14:19 +00:00
|
|
|
|
u_int i;
|
|
|
|
|
int cause, callState, ret = -EINVAL;
|
2002-05-01 01:00:40 +00:00
|
|
|
|
char *ptr;
|
|
|
|
|
l3_process_t *proc;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_head_t *hh;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
Q931_info_t *qi;
|
|
|
|
|
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if (!hif || !skb)
|
|
|
|
|
return(ret);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
l3 = hif->fdata;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
hh = mISDN_HEAD_P(skb);
|
2002-09-16 23:49:38 +00:00
|
|
|
|
printk(KERN_DEBUG "%s: prim(%x)\n", __FUNCTION__, hh->prim);
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if (!l3)
|
|
|
|
|
return(ret);
|
|
|
|
|
switch (hh->prim) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
case (DL_DATA | INDICATION):
|
|
|
|
|
case (DL_UNITDATA | INDICATION):
|
|
|
|
|
break;
|
|
|
|
|
case (DL_ESTABLISH | CONFIRM):
|
|
|
|
|
case (DL_ESTABLISH | INDICATION):
|
|
|
|
|
case (DL_RELEASE | INDICATION):
|
|
|
|
|
case (DL_RELEASE | CONFIRM):
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if (l3_msg(l3, hh->prim, hh->dinfo, 0, skb))
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
break;
|
2001-12-05 13:49:17 +00:00
|
|
|
|
case (DL_DATA | CONFIRM):
|
|
|
|
|
case (DL_UNITDATA | CONFIRM):
|
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
return(0);
|
|
|
|
|
break;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
default:
|
2002-09-16 23:49:38 +00:00
|
|
|
|
printk(KERN_WARNING "%s: unknown pr=%04x\n",
|
|
|
|
|
__FUNCTION__, hh->prim);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(-EINVAL);
|
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (skb->len < 3) {
|
|
|
|
|
l3_debug(l3, "dss1up frame too short(%d)", skb->len);
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
if (skb->data[0] != PROTO_DIS_EURO) {
|
|
|
|
|
if (l3->debug & L3_DEB_PROTERR) {
|
|
|
|
|
l3_debug(l3, "dss1up%sunexpected discriminator %x message len %d",
|
2001-08-02 14:51:56 +00:00
|
|
|
|
(hh->prim == (DL_DATA | INDICATION)) ? " " : "(broadcast) ",
|
2001-02-11 22:46:19 +00:00
|
|
|
|
skb->data[0], skb->len);
|
|
|
|
|
}
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
ret = parseQ931(skb);
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
if (l3->debug & L3_DEB_PROTERR)
|
|
|
|
|
l3_debug(l3, "dss1up: parse IE error %d", ret);
|
|
|
|
|
printk(KERN_WARNING "dss1up: parse IE error %d\n", ret);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
qi = (Q931_info_t *)skb->data;
|
|
|
|
|
ptr = skb->data;
|
|
|
|
|
ptr += L3_EXTRA_SIZE;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (l3->debug & L3_DEB_STATE)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
l3_debug(l3, "dss1up cr %d", qi->cr);
|
|
|
|
|
if (qi->crlen == 0) { /* Dummy Callref */
|
|
|
|
|
if (qi->type == MT_FACILITY)
|
2001-08-02 14:51:56 +00:00
|
|
|
|
l3dss1_facility(l3->dummy, hh->prim, skb);
|
2001-02-19 22:25:31 +00:00
|
|
|
|
else if (l3->debug & L3_DEB_WARN)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3_debug(l3, "dss1up dummy Callref (no facility msg or ie)");
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
} else if ((qi->cr & 0x7fff) == 0) { /* Global CallRef */
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (l3->debug & L3_DEB_STATE)
|
|
|
|
|
l3_debug(l3, "dss1up Global CallRef");
|
2003-07-07 14:29:39 +00:00
|
|
|
|
global_handler(l3, qi->type, skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
} else if (!(proc = getl3proc(l3, qi->cr))) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
/* No transaction process exist, that means no call with
|
|
|
|
|
* this callreference is active
|
|
|
|
|
*/
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->type == MT_SETUP) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
/* Setup creates a new transaction process */
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->cr & 0x8000) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
/* Setup with wrong CREF flag */
|
|
|
|
|
if (l3->debug & L3_DEB_STATE)
|
|
|
|
|
l3_debug(l3, "dss1up wrong CRef flag");
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (!(proc = new_l3_process(l3, qi->cr, N303))) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
/* May be to answer with RELEASE_COMPLETE and
|
|
|
|
|
* CAUSE 0x2f "Resource unavailable", but this
|
|
|
|
|
* need a new_l3_process too ... arghh
|
|
|
|
|
*/
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
} else if (qi->type == MT_STATUS) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
cause = 0;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->cause) {
|
|
|
|
|
if (ptr[qi->cause +1] >= 2)
|
|
|
|
|
cause = ptr[qi->cause + 3] & 0x7f;
|
|
|
|
|
else
|
|
|
|
|
cause = ptr[qi->cause + 2] & 0x7f;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
callState = 0;
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (qi->call_state) {
|
|
|
|
|
callState = ptr[qi->cause + 2];
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
/* ETS 300-104 part 2.4.1
|
|
|
|
|
* if setup has not been made and a message type
|
|
|
|
|
* MT_STATUS is received with call state == 0,
|
|
|
|
|
* we must send nothing
|
|
|
|
|
*/
|
|
|
|
|
if (callState != 0) {
|
|
|
|
|
/* ETS 300-104 part 2.4.2
|
|
|
|
|
* if setup has not been made and a message type
|
|
|
|
|
* MT_STATUS is received with call state != 0,
|
|
|
|
|
* we must send MT_RELEASE_COMPLETE cause 101
|
|
|
|
|
*/
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((proc = new_l3_process(l3, qi->cr, N303))) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
l3dss1_msg_without_setup(proc,
|
2001-02-19 11:51:42 +00:00
|
|
|
|
CAUSE_NOTCOMPAT_STATE);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
} else if (qi->type == MT_RELEASE_COMPLETE) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* ETS 300-104 part 2
|
|
|
|
|
* if setup has not been made and a message type
|
|
|
|
|
* (except MT_SETUP and RELEASE_COMPLETE) is received,
|
|
|
|
|
* we must send MT_RELEASE_COMPLETE cause 81 */
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((proc = new_l3_process(l3, qi->cr, N303))) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_msg_without_setup(proc,
|
2001-02-11 22:46:19 +00:00
|
|
|
|
CAUSE_INVALID_CALLREF);
|
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if (l3dss1_check_messagetype_validity(proc, qi->type, skb)) {
|
2001-02-11 22:46:19 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < DATASLLEN; i++)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((qi->type == datastatelist[i].primitive) &&
|
2001-02-11 22:46:19 +00:00
|
|
|
|
((1 << proc->state) & datastatelist[i].state))
|
|
|
|
|
break;
|
|
|
|
|
if (i == DATASLLEN) {
|
|
|
|
|
if (l3->debug & L3_DEB_STATE) {
|
|
|
|
|
l3_debug(l3, "dss1up%sstate %d mt %#x unhandled",
|
2001-08-02 14:51:56 +00:00
|
|
|
|
(hh->prim == (DL_DATA | INDICATION)) ? " " : "(broadcast) ",
|
2003-07-07 14:29:39 +00:00
|
|
|
|
proc->state, qi->type);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
if ((MT_RELEASE_COMPLETE != qi->type) && (MT_RELEASE != qi->type)) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
l3dss1_status_send(proc, CAUSE_NOTCOMPAT_STATE);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (l3->debug & L3_DEB_STATE) {
|
|
|
|
|
l3_debug(l3, "dss1up%sstate %d mt %x",
|
2001-08-02 14:51:56 +00:00
|
|
|
|
(hh->prim == (DL_DATA | INDICATION)) ?
|
2003-07-07 14:29:39 +00:00
|
|
|
|
" " : "(broadcast) ", proc->state, qi->type);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-08-02 14:51:56 +00:00
|
|
|
|
datastatelist[i].rout(proc, hh->prim, skb);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-13 10:42:55 +00:00
|
|
|
|
static int
|
2003-07-21 12:00:05 +00:00
|
|
|
|
dss1_fromup(mISDNif_t *hif, struct sk_buff *skb)
|
2001-08-02 14:51:56 +00:00
|
|
|
|
{
|
|
|
|
|
layer3_t *l3;
|
2003-07-27 11:14:19 +00:00
|
|
|
|
u_int i;
|
|
|
|
|
int cr, ret = -EINVAL;
|
2001-08-02 14:51:56 +00:00
|
|
|
|
l3_process_t *proc;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDN_head_t *hh;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if (!hif || !skb)
|
|
|
|
|
return(ret);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
l3 = hif->fdata;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
hh = mISDN_HEAD_P(skb);
|
2002-09-16 23:49:38 +00:00
|
|
|
|
printk(KERN_DEBUG "%s: prim(%x)\n", __FUNCTION__, hh->prim);
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if (!l3)
|
|
|
|
|
return(ret);
|
2003-11-09 16:03:19 +00:00
|
|
|
|
// jolly patch start: warum eingentlich nicht?
|
|
|
|
|
// kke weil die user Seite kein DL_RELEASE kennt lt Q.920/921/931
|
|
|
|
|
// if ((DL_RELEASE | REQUEST) == hh->prim) {
|
|
|
|
|
// l3_msg(l3, hh->prim, 0, 0, NULL);
|
|
|
|
|
// dev_kfree_skb(skb);
|
|
|
|
|
// return(0);
|
|
|
|
|
// }
|
|
|
|
|
// jolly patch stop
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if ((DL_ESTABLISH | REQUEST) == hh->prim) {
|
|
|
|
|
l3_msg(l3, hh->prim, 0, 0, NULL);
|
|
|
|
|
dev_kfree_skb(skb);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-27 17:45:44 +00:00
|
|
|
|
}
|
2002-04-29 23:26:30 +00:00
|
|
|
|
proc = getl3proc4id(l3, hh->dinfo);
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if ((CC_NEW_CR | REQUEST) == hh->prim) {
|
2002-04-29 23:26:30 +00:00
|
|
|
|
if (proc) {
|
2002-09-16 23:49:38 +00:00
|
|
|
|
printk(KERN_WARNING "%s: proc(%x) allready exist\n",
|
|
|
|
|
__FUNCTION__, hh->dinfo);
|
2002-04-29 23:26:30 +00:00
|
|
|
|
ret = -EBUSY;
|
|
|
|
|
} else {
|
|
|
|
|
cr = newcallref();
|
2003-07-07 14:29:39 +00:00
|
|
|
|
cr |= 0x8000;
|
2002-04-29 23:26:30 +00:00
|
|
|
|
ret = -ENOMEM;
|
|
|
|
|
if ((proc = new_l3_process(l3, cr, N303))) {
|
|
|
|
|
proc->id = hh->dinfo;
|
|
|
|
|
ret = 0;
|
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
}
|
2001-02-27 17:45:44 +00:00
|
|
|
|
}
|
2001-08-02 14:51:56 +00:00
|
|
|
|
return(ret);
|
2002-04-29 23:26:30 +00:00
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
if (!proc) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_ERR "mISDN dss1 fromup without proc pr=%04x\n",
|
2001-08-02 14:51:56 +00:00
|
|
|
|
hh->prim);
|
|
|
|
|
return(-EINVAL);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < DOWNSLLEN; i++)
|
2001-08-02 14:51:56 +00:00
|
|
|
|
if ((hh->prim == downstatelist[i].primitive) &&
|
2001-02-11 22:46:19 +00:00
|
|
|
|
((1 << proc->state) & downstatelist[i].state))
|
|
|
|
|
break;
|
|
|
|
|
if (i == DOWNSLLEN) {
|
|
|
|
|
if (l3->debug & L3_DEB_STATE) {
|
|
|
|
|
l3_debug(l3, "dss1down state %d prim %#x unhandled",
|
2001-08-02 14:51:56 +00:00
|
|
|
|
proc->state, hh->prim);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (l3->debug & L3_DEB_STATE) {
|
2001-10-31 23:06:07 +00:00
|
|
|
|
l3_debug(l3, "dss1down state %d prim %#x para len %d",
|
|
|
|
|
proc->state, hh->prim, skb->len);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-10-31 23:06:07 +00:00
|
|
|
|
if (skb->len)
|
2003-07-07 14:29:39 +00:00
|
|
|
|
downstatelist[i].rout(proc, hh->prim, skb);
|
|
|
|
|
else {
|
2001-10-31 23:06:07 +00:00
|
|
|
|
downstatelist[i].rout(proc, hh->prim, NULL);
|
2003-07-07 14:29:39 +00:00
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
|
}
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-13 10:42:55 +00:00
|
|
|
|
static int
|
|
|
|
|
dss1man(l3_process_t *proc, u_int pr, void *arg)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-27 11:14:19 +00:00
|
|
|
|
u_int i;
|
2001-02-11 22:46:19 +00:00
|
|
|
|
|
2001-02-13 10:42:55 +00:00
|
|
|
|
if (!proc) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_ERR "mISDN dss1man without proc pr=%04x\n", pr);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(-EINVAL);
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < MANSLLEN; i++)
|
|
|
|
|
if ((pr == manstatelist[i].primitive) &&
|
|
|
|
|
((1 << proc->state) & manstatelist[i].state))
|
|
|
|
|
break;
|
|
|
|
|
if (i == MANSLLEN) {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (proc->l3->debug & L3_DEB_STATE) {
|
2001-02-13 10:42:55 +00:00
|
|
|
|
l3_debug(proc->l3, "cr %d dss1man state %d prim %#x unhandled",
|
|
|
|
|
proc->callref & 0x7f, proc->state, pr);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2001-02-19 11:51:42 +00:00
|
|
|
|
if (proc->l3->debug & L3_DEB_STATE) {
|
2001-02-13 10:42:55 +00:00
|
|
|
|
l3_debug(proc->l3, "cr %d dss1man state %d prim %#x",
|
|
|
|
|
proc->callref & 0x7f, proc->state, pr);
|
|
|
|
|
}
|
|
|
|
|
manstatelist[i].rout(proc, pr, arg);
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-13 10:42:55 +00:00
|
|
|
|
static void
|
|
|
|
|
release_udss1(layer3_t *l3)
|
2001-02-11 22:46:19 +00:00
|
|
|
|
{
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDNinstance_t *inst = &l3->inst;
|
2001-02-13 10:42:55 +00:00
|
|
|
|
|
2001-02-27 17:45:44 +00:00
|
|
|
|
printk(KERN_DEBUG "release_udss1 refcnt %d l3(%p) inst(%p)\n",
|
|
|
|
|
u_dss1.refcnt, l3, inst);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
release_l3(l3);
|
2001-03-26 11:40:02 +00:00
|
|
|
|
if (inst->up.peer) {
|
|
|
|
|
inst->up.peer->obj->ctrl(inst->up.peer,
|
|
|
|
|
MGR_DISCONNECT | REQUEST, &inst->up);
|
|
|
|
|
}
|
|
|
|
|
if (inst->down.peer) {
|
|
|
|
|
inst->down.peer->obj->ctrl(inst->down.peer,
|
|
|
|
|
MGR_DISCONNECT | REQUEST, &inst->down);
|
|
|
|
|
}
|
|
|
|
|
REMOVE_FROM_LISTBASE(l3, ((layer3_t *)u_dss1.ilist));
|
2001-03-27 15:34:20 +00:00
|
|
|
|
u_dss1.ctrl(inst, MGR_UNREGLAYER | REQUEST, NULL);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
kfree(l3);
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-26 11:40:02 +00:00
|
|
|
|
static int
|
2003-07-21 12:00:05 +00:00
|
|
|
|
new_udss1(mISDNstack_t *st, mISDN_pid_t *pid)
|
2001-03-26 11:40:02 +00:00
|
|
|
|
{
|
2003-08-01 22:15:53 +00:00
|
|
|
|
layer3_t *nl3;
|
|
|
|
|
int err;
|
2001-02-13 10:42:55 +00:00
|
|
|
|
|
2001-03-26 11:40:02 +00:00
|
|
|
|
if (!st || !pid)
|
|
|
|
|
return(-EINVAL);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
if (!(nl3 = kmalloc(sizeof(layer3_t), GFP_ATOMIC))) {
|
|
|
|
|
printk(KERN_ERR "kmalloc layer3 failed\n");
|
2001-03-26 11:40:02 +00:00
|
|
|
|
return(-ENOMEM);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
|
|
|
|
memset(nl3, 0, sizeof(layer3_t));
|
2003-07-21 12:00:05 +00:00
|
|
|
|
memcpy(&nl3->inst.pid, pid, sizeof(mISDN_pid_t));
|
2001-02-13 10:42:55 +00:00
|
|
|
|
nl3->debug = debug;
|
2003-08-01 22:15:53 +00:00
|
|
|
|
init_mISDNinstance(&nl3->inst, &u_dss1, nl3);
|
2001-03-26 11:40:02 +00:00
|
|
|
|
if (!SetHandledPID(&u_dss1, &nl3->inst.pid)) {
|
|
|
|
|
int_error();
|
|
|
|
|
return(-ENOPROTOOPT);
|
|
|
|
|
}
|
2001-11-14 10:41:26 +00:00
|
|
|
|
if ((pid->protocol[3] & ~ISDN_PID_FEATURE_MASK) != ISDN_PID_L3_DSS1USER) {
|
2001-03-26 11:40:02 +00:00
|
|
|
|
printk(KERN_ERR "udss1 create failed prt %x\n",
|
|
|
|
|
pid->protocol[3]);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
kfree(nl3);
|
2001-03-26 11:40:02 +00:00
|
|
|
|
return(-ENOPROTOOPT);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
2001-03-03 08:07:30 +00:00
|
|
|
|
init_l3(nl3);
|
2001-11-14 10:41:26 +00:00
|
|
|
|
if (pid->protocol[3] & ISDN_PID_L3_DF_PTP)
|
|
|
|
|
test_and_set_bit(FLG_PTP, &nl3->Flag);
|
|
|
|
|
if (pid->protocol[3] & ISDN_PID_L3_DF_EXTCID)
|
|
|
|
|
test_and_set_bit(FLG_EXTCID, &nl3->Flag);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
if (!(nl3->global = kmalloc(sizeof(l3_process_t), GFP_ATOMIC))) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_ERR "mISDN can't get memory for dss1 global CR\n");
|
2001-03-03 08:07:30 +00:00
|
|
|
|
release_l3(nl3);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
kfree(nl3);
|
2001-03-26 11:40:02 +00:00
|
|
|
|
return(-ENOMEM);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
2003-08-01 22:15:53 +00:00
|
|
|
|
nl3->global->state = 0;
|
|
|
|
|
nl3->global->callref = 0;
|
|
|
|
|
nl3->global->next = NULL;
|
|
|
|
|
nl3->global->n303 = N303;
|
|
|
|
|
nl3->global->l3 = nl3;
|
|
|
|
|
nl3->global->t303skb = NULL;
|
|
|
|
|
L3InitTimer(nl3->global, &nl3->global->timer);
|
2001-02-19 22:25:31 +00:00
|
|
|
|
if (!(nl3->dummy = kmalloc(sizeof(l3_process_t), GFP_ATOMIC))) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_ERR "mISDN can't get memory for dss1 dummy CR\n");
|
2001-03-03 08:07:30 +00:00
|
|
|
|
release_l3(nl3);
|
2001-02-19 22:25:31 +00:00
|
|
|
|
kfree(nl3);
|
2001-03-26 11:40:02 +00:00
|
|
|
|
return(-ENOMEM);
|
2001-02-19 22:25:31 +00:00
|
|
|
|
}
|
2003-08-01 22:15:53 +00:00
|
|
|
|
nl3->dummy->state = 0;
|
|
|
|
|
nl3->dummy->callref = -1;
|
|
|
|
|
nl3->dummy->next = NULL;
|
|
|
|
|
nl3->dummy->n303 = N303;
|
|
|
|
|
nl3->dummy->l3 = nl3;
|
|
|
|
|
nl3->dummy->t303skb = NULL;
|
|
|
|
|
L3InitTimer(nl3->dummy, &nl3->dummy->timer);
|
2001-03-11 21:23:39 +00:00
|
|
|
|
sprintf(nl3->inst.name, "DSS1 %d", st->id);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
nl3->p_mgr = dss1man;
|
2001-03-26 11:40:02 +00:00
|
|
|
|
APPEND_TO_LIST(nl3, ((layer3_t *)u_dss1.ilist));
|
|
|
|
|
err = u_dss1.ctrl(st, MGR_REGLAYER | INDICATION, &nl3->inst);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
if (err) {
|
2001-03-26 11:40:02 +00:00
|
|
|
|
release_l3(nl3);
|
|
|
|
|
REMOVE_FROM_LISTBASE(nl3, ((layer3_t *)u_dss1.ilist));
|
|
|
|
|
kfree(nl3);
|
2003-08-01 22:15:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
mISDN_stPara_t stp;
|
|
|
|
|
|
|
|
|
|
if (st->para.down_headerlen)
|
|
|
|
|
nl3->down_headerlen = st->para.down_headerlen;
|
|
|
|
|
stp.maxdatalen = 0;
|
|
|
|
|
stp.up_headerlen = L3_EXTRA_SIZE;
|
|
|
|
|
stp.down_headerlen = 0;
|
|
|
|
|
u_dss1.ctrl(st, MGR_ADDSTPARA | REQUEST, &stp);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
2001-03-26 11:40:02 +00:00
|
|
|
|
return(err);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char MName[] = "UDSS1";
|
|
|
|
|
|
|
|
|
|
#ifdef MODULE
|
|
|
|
|
MODULE_AUTHOR("Karsten Keil");
|
2002-09-16 23:49:38 +00:00
|
|
|
|
#ifdef MODULE_LICENSE
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
#endif
|
2001-02-13 10:42:55 +00:00
|
|
|
|
MODULE_PARM(debug, "1i");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
udss1_manager(void *data, u_int prim, void *arg) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDNinstance_t *inst = data;
|
2001-03-26 11:40:02 +00:00
|
|
|
|
layer3_t *l3l = u_dss1.ilist;
|
2001-02-13 10:42:55 +00:00
|
|
|
|
|
2003-08-01 22:15:53 +00:00
|
|
|
|
if (debug & 0x1000)
|
|
|
|
|
printk(KERN_DEBUG "udss1_manager data:%p prim:%x arg:%p\n", data, prim, arg);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
if (!data)
|
|
|
|
|
return(-EINVAL);
|
|
|
|
|
while(l3l) {
|
2001-03-26 11:40:02 +00:00
|
|
|
|
if (&l3l->inst == inst)
|
2001-02-13 10:42:55 +00:00
|
|
|
|
break;
|
|
|
|
|
l3l = l3l->next;
|
|
|
|
|
}
|
2003-08-01 22:15:53 +00:00
|
|
|
|
if (prim == (MGR_NEWLAYER | REQUEST))
|
2001-03-26 11:40:02 +00:00
|
|
|
|
return(new_udss1(data, arg));
|
2003-08-01 22:15:53 +00:00
|
|
|
|
if (!l3l) {
|
|
|
|
|
if (debug & 0x1)
|
|
|
|
|
printk(KERN_WARNING "udss1_manager prim(%x) no instance\n", prim);
|
|
|
|
|
return(-EINVAL);
|
|
|
|
|
}
|
|
|
|
|
switch(prim) {
|
|
|
|
|
case MGR_ADDSTPARA | INDICATION:
|
|
|
|
|
l3l->down_headerlen = ((mISDN_stPara_t *)arg)->down_headerlen;
|
|
|
|
|
case MGR_CLRSTPARA | INDICATION:
|
|
|
|
|
break;
|
2001-03-26 11:40:02 +00:00
|
|
|
|
case MGR_CONNECT | REQUEST:
|
|
|
|
|
return(ConnectIF(inst, arg));
|
|
|
|
|
case MGR_SETIF | REQUEST:
|
|
|
|
|
case MGR_SETIF | INDICATION:
|
|
|
|
|
return(SetIF(inst, arg, prim, dss1_fromup, dss1_fromdown, l3l));
|
|
|
|
|
case MGR_DISCONNECT | REQUEST:
|
|
|
|
|
case MGR_DISCONNECT | INDICATION:
|
|
|
|
|
return(DisConnectIF(inst, arg));
|
2001-02-13 10:42:55 +00:00
|
|
|
|
case MGR_RELEASE | INDICATION:
|
2001-03-26 11:40:02 +00:00
|
|
|
|
case MGR_UNREGLAYER | REQUEST:
|
2003-08-01 22:15:53 +00:00
|
|
|
|
if (debug & 0x1000)
|
2001-02-13 10:42:55 +00:00
|
|
|
|
printk(KERN_DEBUG "release_udss1 id %x\n", l3l->inst.st->id);
|
2003-08-01 22:15:53 +00:00
|
|
|
|
release_udss1(l3l);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2003-08-01 22:15:53 +00:00
|
|
|
|
if (debug & 0x1)
|
|
|
|
|
printk(KERN_WARNING "udss1 prim %x not handled\n", prim);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
return(-EINVAL);
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UDSS1Init(void)
|
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
char tmp[32];
|
|
|
|
|
|
2001-02-11 22:46:19 +00:00
|
|
|
|
strcpy(tmp, dss1_revision);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_INFO "mISDN: DSS1 Rev. %s\n", mISDN_getrev(tmp));
|
2003-06-24 21:58:53 +00:00
|
|
|
|
SET_MODULE_OWNER(&u_dss1);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
u_dss1.name = MName;
|
2001-11-14 10:41:26 +00:00
|
|
|
|
u_dss1.DPROTO.protocol[3] = ISDN_PID_L3_DSS1USER |
|
|
|
|
|
ISDN_PID_L3_DF_PTP |
|
|
|
|
|
ISDN_PID_L3_DF_EXTCID;
|
2001-02-13 10:42:55 +00:00
|
|
|
|
u_dss1.own_ctrl = udss1_manager;
|
|
|
|
|
u_dss1.prev = NULL;
|
|
|
|
|
u_dss1.next = NULL;
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDNl3New();
|
|
|
|
|
if ((err = mISDN_register(&u_dss1))) {
|
2001-02-13 10:42:55 +00:00
|
|
|
|
printk(KERN_ERR "Can't register %s error(%d)\n", MName, err);
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDNl3Free();
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
|
|
|
|
return(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef MODULE
|
2003-08-01 22:15:53 +00:00
|
|
|
|
void UDSS1_cleanup(void)
|
2001-02-13 10:42:55 +00:00
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
|
2003-07-21 12:00:05 +00:00
|
|
|
|
if ((err = mISDN_unregister(&u_dss1))) {
|
2001-02-13 10:42:55 +00:00
|
|
|
|
printk(KERN_ERR "Can't unregister User DSS1 error(%d)\n", err);
|
|
|
|
|
}
|
2001-03-26 11:40:02 +00:00
|
|
|
|
if (u_dss1.ilist) {
|
2003-07-21 12:00:05 +00:00
|
|
|
|
printk(KERN_WARNING "mISDNl3 u_dss1 list not empty\n");
|
2001-03-26 11:40:02 +00:00
|
|
|
|
while(u_dss1.ilist)
|
|
|
|
|
release_udss1(u_dss1.ilist);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
}
|
2003-07-21 12:00:05 +00:00
|
|
|
|
mISDNl3Free();
|
2001-02-11 22:46:19 +00:00
|
|
|
|
}
|
2003-08-01 22:15:53 +00:00
|
|
|
|
|
|
|
|
|
module_init(UDSS1Init);
|
|
|
|
|
module_exit(UDSS1_cleanup);
|
2001-02-13 10:42:55 +00:00
|
|
|
|
#endif
|