static void l3_1tr6_setup_ack(struct l3_process *pc, u_char pr, void *arg) { u_char *p; struct sk_buff *skb = arg; L3DelTimer(&pc->timer); p = skb->data; newl3state(pc, 2); if ((p = findie(p, skb->len, WE0_chanID, 0))) { if (p[1] != 1) { l3_1tr6_error(pc, "setup_ack wrong chanID len", skb); return; } if ((p[2] & 0xf4) != 0x80) { l3_1tr6_error(pc, "setup_ack wrong WE0_chanID", skb); return; } pc->para.bchannel = p[2] & 0x3; } else { l3_1tr6_error(pc, "missing setup_ack WE0_chanID", skb); return; } dev_kfree_skb(skb); L3AddTimer(&pc->timer, T304, CC_T304); pc->st->l3.l3l4(pc->st, CC_MORE_INFO | INDICATION, pc); }
static void l3_1tr6_setup(struct PStack *st, u_char pr, void *arg) { u_char *p; int bcfound = 0; char tmp[80]; struct sk_buff *skb = arg; p = skb->data; st->pa->callref = getcallref(p); st->l3.callref = 0x80 + st->pa->callref; /* Channel Identification */ p = skb->data; if ((p = findie(p, skb->len, WE0_chanID, 0))) { st->pa->bchannel = p[2] & 0x3; bcfound++; } else if (st->l3.debug & L3_DEB_WARN) l3_debug(st, "setup without bchannel"); p = skb->data; if ((p = findie(p, skb->len, WE6_serviceInd, 6))) { st->pa->setup.si1 = p[2]; st->pa->setup.si2 = p[3]; } else if (st->l3.debug & L3_DEB_WARN) l3_debug(st, "setup without service indicator"); p = skb->data; if ((p = findie(p, skb->len, WE0_destAddr, 0))) iecpy(st->pa->setup.eazmsn, p, 1); else st->pa->setup.eazmsn[0] = 0; p = skb->data; if ((p = findie(p, skb->len, WE0_origAddr, 0))) { iecpy(st->pa->setup.phone, p, 1); } else st->pa->setup.phone[0] = 0; p = skb->data; st->pa->spv = 0; if ((p = findie(p, skb->len, WE0_netSpecFac, 0))) { if ((FAC_SPV == p[3]) || (FAC_Activate == p[3])) st->pa->spv = 1; } SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); /* Signal all services, linklevel takes care of Service-Indicator */ if (bcfound) { if ((st->pa->setup.si1 != 7) && (st->l3.debug & L3_DEB_WARN)) { sprintf(tmp, "non-digital call: %s -> %s", st->pa->setup.phone, st->pa->setup.eazmsn); l3_debug(st, tmp); } newl3state(st, 6); st->l3.l3l4(st, CC_SETUP_IND, NULL); } }
static void l3_1tr6_t305(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb; u_char tmp[16]; u_char *p = tmp; int l; u_char cause = 0x90; u_char clen = 1; L3DelTimer(&pc->timer); if (pc->para.cause != NO_CAUSE) cause = pc->para.cause; /* Map DSS1 causes */ switch (cause & 0x7f) { case 0x10: clen = 0; break; case 0x15: cause = CAUSE_CallRejected; break; } MsgHead(p, pc->callref, MT_N1_REL, PROTO_DIS_N1); *p++ = WE0_cause; *p++ = clen; /* Laenge */ if (clen) *p++ = cause; newl3state(pc, 19); l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; memcpy(skb_put(skb, l), tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T308, CC_T308_1); }
static void l3_1tr6_rel(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb = arg; u_char *p; p = skb->data; if ((p = findie(p, skb->len, WE0_cause, 0))) { if (p[1] > 0) { pc->para.cause = p[2]; if (p[1] > 1) pc->para.loc = p[3]; else pc->para.loc = 0; } else { pc->para.cause = 0; pc->para.loc = 0; } } else { pc->para.cause = NO_CAUSE; l3_1tr6_error(pc, "missing REL cause", skb); return; } dev_kfree_skb(skb); StopAllL3Timer(pc); newl3state(pc, 0); l3_1TR6_message(pc, MT_N1_REL_ACK, PROTO_DIS_N1); pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc); release_l3_process(pc); }
static void l3_1tr6_setup_rsp(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb; u_char tmp[24]; u_char *p = tmp; int l; MsgHead(p, st->l3.callref, MT_N1_CONN, PROTO_DIS_N1); if (st->pa->spv) { /* SPV ? */ /* NSF SPV */ *p++ = WE0_netSpecFac; *p++ = 4; /* Laenge */ *p++ = 0; *p++ = FAC_SPV; /* SPV */ *p++ = st->pa->setup.si1; *p++ = st->pa->setup.si2; *p++ = WE0_netSpecFac; *p++ = 4; /* Laenge */ *p++ = 0; *p++ = FAC_Activate; /* aktiviere SPV */ *p++ = st->pa->setup.si1; *p++ = st->pa->setup.si2; } newl3state(st, 8); l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; memcpy(skb_put(skb, l), tmp, l); st->l3.l3l2(st, DL_DATA, skb); L3DelTimer(&st->l3.timer); L3AddTimer(&st->l3.timer, st->l3.t313, CC_T313); }
static void l3_1tr6_t308_2(struct PStack *st, u_char pr, void *arg) { L3DelTimer(&st->l3.timer); st->l3.l3l4(st, CC_RELEASE_ERR, NULL); newl3state(st, 0); }
static void l3_1tr6_t305(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb; u_char tmp[16]; u_char *p = tmp; int l; u_char cause = 0x90; u_char clen = 1; L3DelTimer(&st->l3.timer); if (st->pa->cause > 0) cause = st->pa->cause; /* Map DSS1 causes */ switch (cause & 0x7f) { case 0x10: clen = 0; break; case 0x15: cause = CAUSE_CallRejected; break; } MsgHead(p, st->l3.callref, MT_N1_REL, PROTO_DIS_N1); *p++ = WE0_cause; *p++ = clen; /* Laenge */ if (clen) *p++ = cause; newl3state(st, 19); l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; memcpy(skb_put(skb, l), tmp, l); st->l3.l3l2(st, DL_DATA, skb); L3AddTimer(&st->l3.timer, st->l3.t308, CC_T308_1); }
static void l3_1tr6_setup_rsp(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb; u_char tmp[24]; u_char *p = tmp; int l; MsgHead(p, pc->callref, MT_N1_CONN, PROTO_DIS_N1); if (pc->para.spv) { /* SPV ? */ /* NSF SPV */ *p++ = WE0_netSpecFac; *p++ = 4; /* Laenge */ *p++ = 0; *p++ = FAC_SPV; /* SPV */ *p++ = pc->para.setup.si1; *p++ = pc->para.setup.si2; *p++ = WE0_netSpecFac; *p++ = 4; /* Laenge */ *p++ = 0; *p++ = FAC_Activate; /* aktiviere SPV */ *p++ = pc->para.setup.si1; *p++ = pc->para.setup.si2; } newl3state(pc, 8); l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; memcpy(skb_put(skb, l), tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3DelTimer(&pc->timer); L3AddTimer(&pc->timer, T313, CC_T313); }
static void l3_1tr6_rel(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb = arg; u_char *p; p = skb->data; if ((p = findie(p, skb->len, WE0_cause, 0))) { if (p[1] > 0) { st->pa->cause = p[2]; if (p[1] > 1) st->pa->loc = p[3]; else st->pa->loc = 0; } else { st->pa->cause = 0; st->pa->loc = 0; } } else st->pa->cause = -1; SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); StopAllL3Timer(st); newl3state(st, 0); l3_1TR6_message(st, MT_N1_REL_ACK, PROTO_DIS_N1); st->l3.l3l4(st, CC_RELEASE_IND, NULL); }
static void l3_1tr6_call_sent(struct l3_process *pc, u_char pr, void *arg) { u_char *p; struct sk_buff *skb = arg; L3DelTimer(&pc->timer); p = skb->data; if ((p = findie(p, skb->len, WE0_chanID, 0))) { if (p[1] != 1) { l3_1tr6_error(pc, "call sent wrong chanID len", skb); return; } if ((p[2] & 0xf4) != 0x80) { l3_1tr6_error(pc, "call sent wrong WE0_chanID", skb); return; } if ((pc->state == 2) && (pc->para.bchannel != (p[2] & 0x3))) { l3_1tr6_error(pc, "call sent wrong chanID value", skb); return; } pc->para.bchannel = p[2] & 0x3; } else { l3_1tr6_error(pc, "missing call sent WE0_chanID", skb); return; } dev_kfree_skb(skb); L3AddTimer(&pc->timer, T310, CC_T310); newl3state(pc, 3); pc->st->l3.l3l4(pc->st, CC_PROCEEDING | INDICATION, pc); }
static void l3_1tr6_t308_1(struct PStack *st, u_char pr, void *arg) { L3DelTimer(&st->l3.timer); l3_1TR6_message(st, MT_N1_REL, PROTO_DIS_N1); L3AddTimer(&st->l3.timer, st->l3.t308, CC_T308_2); newl3state(st, 19); }
static void l3_1tr6_release_req(struct l3_process *pc, u_char pr, void *arg) { StopAllL3Timer(pc); newl3state(pc, 19); l3_1TR6_message(pc, MT_N1_REL, PROTO_DIS_N1); L3AddTimer(&pc->timer, T308, CC_T308_1); }
static void l3_1tr6_release_req(struct PStack *st, u_char pr, void *arg) { StopAllL3Timer(st); newl3state(st, 19); l3_1TR6_message(st, MT_N1_REL, PROTO_DIS_N1); L3AddTimer(&st->l3.timer, st->l3.t308, CC_T308_1); }
static void l3_1tr6_t308_1(struct l3_process *pc, u_char pr, void *arg) { L3DelTimer(&pc->timer); l3_1TR6_message(pc, MT_N1_REL, PROTO_DIS_N1); L3AddTimer(&pc->timer, T308, CC_T308_2); newl3state(pc, 19); }
static void l3_1tr6_dl_release(struct l3_process *pc, u_char pr, void *arg) { newl3state(pc, 0); pc->para.cause = 0x1b; /* Destination out of order */ pc->para.loc = 0; pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc); release_l3_process(pc); }
static void l3_1tr6_alert(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb = arg; dev_kfree_skb(skb); L3DelTimer(&pc->timer); /* T304 */ newl3state(pc, 4); pc->st->l3.l3l4(pc->st, CC_ALERTING | INDICATION, pc); }
static void l3_1tr6_alert(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb = arg; SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); L3DelTimer(&st->l3.timer); /* T304 */ newl3state(st, 4); st->l3.l3l4(st, CC_ALERTING_IND, NULL); }
static void l3_1tr6_rel_ack(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb = arg; SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); StopAllL3Timer(st); newl3state(st, 0); st->pa->cause = -1; st->l3.l3l4(st, CC_RELEASE_CNF, NULL); }
static void l3_1tr6_disc(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb = arg; u_char *p; int i, tmpcharge = 0; char a_charge[8], tmp[32]; StopAllL3Timer(pc); p = skb->data; if ((p = findie(p, skb->len, WE6_chargingInfo, 6))) { iecpy(a_charge, p, 1); for (i = 0; i < strlen(a_charge); i++) { tmpcharge *= 10; tmpcharge += a_charge[i] & 0xf; } if (tmpcharge > pc->para.chargeinfo) { pc->para.chargeinfo = tmpcharge; pc->st->l3.l3l4(pc->st, CC_CHARGE | INDICATION, pc); } if (pc->st->l3.debug & L3_DEB_CHARGE) { sprintf(tmp, "charging info %d", pc->para.chargeinfo); l3_debug(pc->st, tmp); } } else if (pc->st->l3.debug & L3_DEB_CHARGE) l3_debug(pc->st, "charging info not found"); p = skb->data; if ((p = findie(p, skb->len, WE0_cause, 0))) { if (p[1] > 0) { pc->para.cause = p[2]; if (p[1] > 1) pc->para.loc = p[3]; else pc->para.loc = 0; } else { pc->para.cause = 0; pc->para.loc = 0; } } else { if (pc->st->l3.debug & L3_DEB_WARN) l3_debug(pc->st, "cause not found"); pc->para.cause = NO_CAUSE; } if (!findie(skb->data, skb->len, WE6_date, 6)) { l3_1tr6_error(pc, "missing connack date", skb); return; } dev_kfree_skb(skb); newl3state(pc, 12); pc->st->l3.l3l4(pc->st, CC_DISCONNECT | INDICATION, pc); }
static void l3_1tr6_connect_ack(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb = arg; SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); newl3state(st, 10); st->pa->chargeinfo = 0; L3DelTimer(&st->l3.timer); st->l3.l3l4(st, CC_SETUP_COMPLETE_IND, NULL); }
static void l3_1tr6_rel_ack(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb = arg; dev_kfree_skb(skb); StopAllL3Timer(pc); newl3state(pc, 0); pc->para.cause = NO_CAUSE; pc->st->l3.l3l4(pc->st, CC_RELEASE | CONFIRM, pc); release_l3_process(pc); }
static void l3_1tr6_disc(struct PStack *st, u_char pr, void *arg) { struct sk_buff *skb = arg; u_char *p; int i, tmpcharge = 0; char a_charge[8], tmp[32]; StopAllL3Timer(st); p = skb->data; if ((p = findie(p, skb->len, WE6_chargingInfo, 6))) { iecpy(a_charge, p, 1); for (i = 0; i < strlen(a_charge); i++) { tmpcharge *= 10; tmpcharge += a_charge[i] & 0xf; } if (tmpcharge > st->pa->chargeinfo) { st->pa->chargeinfo = tmpcharge; st->l3.l3l4(st, CC_INFO_CHARGE, NULL); } if (st->l3.debug & L3_DEB_CHARGE) { sprintf(tmp, "charging info %d", st->pa->chargeinfo); l3_debug(st, tmp); } } else if (st->l3.debug & L3_DEB_CHARGE) l3_debug(st, "charging info not found"); p = skb->data; if ((p = findie(p, skb->len, WE0_cause, 0))) { if (p[1] > 0) { st->pa->cause = p[2]; if (p[1] > 1) st->pa->loc = p[3]; else st->pa->loc = 0; } else { st->pa->cause = 0; st->pa->loc = 0; } } else { if (st->l3.debug & L3_DEB_WARN) l3_debug(st, "cause not found"); st->pa->cause = -1; } SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); newl3state(st, 12); st->l3.l3l4(st, CC_DISCONNECT_IND, NULL); }
static void l3_1tr6_t303(struct PStack *st, u_char pr, void *arg) { if (st->l3.n_t303 > 0) { st->l3.n_t303--; L3DelTimer(&st->l3.timer); l3_1tr6_setup_req(st, pr, arg); } else { L3DelTimer(&st->l3.timer); st->l3.l3l4(st, CC_NOSETUP_RSP_ERR, NULL); st->l3.n_t303 = 1; newl3state(st, 0); } }
static void l3_1tr6_connect_ack(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb = arg; if (!findie(skb->data, skb->len, WE6_date, 6)) { l3_1tr6_error(pc, "missing connack date", skb); return; } dev_kfree_skb(skb); newl3state(pc, 10); pc->para.chargeinfo = 0; L3DelTimer(&pc->timer); pc->st->l3.l3l4(pc->st, CC_SETUP_COMPL | INDICATION, pc); }
static void l3_1tr6_connect(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb = arg; L3DelTimer(&pc->timer); /* T310 */ if (!findie(skb->data, skb->len, WE6_date, 6)) { l3_1tr6_error(pc, "missing connect date", skb); return; } newl3state(pc, 10); dev_kfree_skb(skb); pc->para.chargeinfo = 0; pc->st->l3.l3l4(pc->st, CC_SETUP | CONFIRM, pc); }
static void l3_1tr6_call_sent(struct PStack *st, u_char pr, void *arg) { u_char *p; struct sk_buff *skb = arg; L3DelTimer(&st->l3.timer); p = skb->data; if ((p = findie(p, skb->len, WE0_chanID, 0))) { st->pa->bchannel = p[2] & 0x3; } else if (st->l3.debug & L3_DEB_WARN) l3_debug(st, "setup answer without bchannel"); SET_SKB_FREE(skb); dev_kfree_skb(skb, FREE_READ); L3AddTimer(&st->l3.timer, st->l3.t310, CC_T310); newl3state(st, 3); st->l3.l3l4(st, CC_PROCEEDING_IND, NULL); }
static void l3_1tr6_disconnect_req(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb; u_char tmp[16]; u_char *p = tmp; int l; u_char cause = 0x10; u_char clen = 1; if (pc->para.cause > 0) cause = pc->para.cause; /* Map DSS1 causes */ switch (cause & 0x7f) { case 0x10: clen = 0; break; case 0x11: cause = CAUSE_UserBusy; break; case 0x15: cause = CAUSE_CallRejected; break; } StopAllL3Timer(pc); MsgHead(p, pc->callref, MT_N1_DISC, PROTO_DIS_N1); *p++ = WE0_cause; *p++ = clen; /* Laenge */ if (clen) *p++ = cause | 0x80; newl3state(pc, 11); l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; memcpy(skb_put(skb, l), tmp, l); l3_msg(pc->st, DL_DATA | REQUEST, skb); L3AddTimer(&pc->timer, T305, CC_T305); }
static void l3_1tr6_setup_req(struct l3_process *pc, u_char pr, void *arg) { struct sk_buff *skb; u_char tmp[128]; u_char *p = tmp; u_char *teln; u_char *eaz; u_char channel = 0; int l; MsgHead(p, pc->callref, MT_N1_SETUP, PROTO_DIS_N1); teln = pc->para.setup.phone; pc->para.spv = 0; if (!isdigit(*teln)) { switch (0x5f & *teln) { case 'S': pc->para.spv = 1; break; case 'C': channel = 0x08; case 'P': channel |= 0x80; teln++; if (*teln == '1') channel |= 0x01; else channel |= 0x02; break; default: if (pc->st->l3.debug & L3_DEB_WARN) l3_debug(pc->st, "Wrong MSN Code"); break; } teln++; } if (channel) { *p++ = 0x18; /* channel indicator */ *p++ = 1; *p++ = channel; } if (pc->para.spv) { /* SPV ? */ /* NSF SPV */ *p++ = WE0_netSpecFac; *p++ = 4; /* Laenge */ *p++ = 0; *p++ = FAC_SPV; /* SPV */ *p++ = pc->para.setup.si1; /* 0 for all Services */ *p++ = pc->para.setup.si2; /* 0 for all Services */ *p++ = WE0_netSpecFac; *p++ = 4; /* Laenge */ *p++ = 0; *p++ = FAC_Activate; /* aktiviere SPV (default) */ *p++ = pc->para.setup.si1; /* 0 for all Services */ *p++ = pc->para.setup.si2; /* 0 for all Services */ } eaz = pc->para.setup.eazmsn; if (*eaz) { *p++ = WE0_origAddr; *p++ = strlen(eaz) + 1; /* Classify as AnyPref. */ *p++ = 0x81; /* Ext = '1'B, Type = '000'B, Plan = '0001'B. */ while (*eaz) *p++ = *eaz++ & 0x7f; } *p++ = WE0_destAddr; *p++ = strlen(teln) + 1; /* Classify as AnyPref. */ *p++ = 0x81; /* Ext = '1'B, Type = '000'B, Plan = '0001'B. */ while (*teln) *p++ = *teln++ & 0x7f; *p++ = WE_Shift_F6; /* Codesatz 6 fuer Service */ *p++ = WE6_serviceInd; *p++ = 2; /* len=2 info,info2 */ *p++ = pc->para.setup.si1; *p++ = pc->para.setup.si2; l = p - tmp; if (!(skb = l3_alloc_skb(l))) return; memcpy(skb_put(skb, l), tmp, l); L3DelTimer(&pc->timer); L3AddTimer(&pc->timer, T303, CC_T303); newl3state(pc, 1); l3_msg(pc->st, DL_DATA | REQUEST, skb); }
static void l3_1tr6_alert_req(struct l3_process *pc, u_char pr, void *arg) { newl3state(pc, 7); l3_1TR6_message(pc, MT_N1_ALERT, PROTO_DIS_N1); }
static void l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg) { u_char *p; int bcfound = 0; char tmp[80]; struct sk_buff *skb = arg; p = skb->data; /* Channel Identification */ p = skb->data; if ((p = findie(p, skb->len, WE0_chanID, 0))) { if (p[1] != 1) { l3_1tr6_error(pc, "setup wrong chanID len", skb); return; } if ((p[2] & 0xf4) != 0x80) { l3_1tr6_error(pc, "setup wrong WE0_chanID", skb); return; } if ((pc->para.bchannel = p[2] & 0x3)) bcfound++; } else { l3_1tr6_error(pc, "missing setup chanID", skb); return; } p = skb->data; if ((p = findie(p, skb->len, WE6_serviceInd, 6))) { pc->para.setup.si1 = p[2]; pc->para.setup.si2 = p[3]; } else { l3_1tr6_error(pc, "missing setup SI", skb); return; } p = skb->data; if ((p = findie(p, skb->len, WE0_destAddr, 0))) iecpy(pc->para.setup.eazmsn, p, 1); else pc->para.setup.eazmsn[0] = 0; p = skb->data; if ((p = findie(p, skb->len, WE0_origAddr, 0))) { iecpy(pc->para.setup.phone, p, 1); } else pc->para.setup.phone[0] = 0; p = skb->data; pc->para.spv = 0; if ((p = findie(p, skb->len, WE0_netSpecFac, 0))) { if ((FAC_SPV == p[3]) || (FAC_Activate == p[3])) pc->para.spv = 1; } dev_kfree_skb(skb); /* Signal all services, linklevel takes care of Service-Indicator */ if (bcfound) { if ((pc->para.setup.si1 != 7) && (pc->st->l3.debug & L3_DEB_WARN)) { sprintf(tmp, "non-digital call: %s -> %s", pc->para.setup.phone, pc->para.setup.eazmsn); l3_debug(pc->st, tmp); } newl3state(pc, 6); pc->st->l3.l3l4(pc->st, CC_SETUP | INDICATION, pc); } else release_l3_process(pc); }