19 #include <linux/ctype.h>
22 static const char *l3_1tr6_revision =
"$Revision: 2.15.2.3 $";
24 #define MsgHead(ptr, cref, mty, dis) \
27 *ptr++ = cref ^ 0x80; \
39 MsgHead(p, pc->callref, mt, pd);
44 l3_1tr6_release_req(
struct l3_process *
pc,
u_char pr,
void *
arg)
58 l3_1tr6_release_req(pc, 0,
NULL);
67 l3_1tr6_release_req(pc, 0,
NULL);
71 l3_1tr6_setup_req(
struct l3_process *pc,
u_char pr,
void *
arg)
82 teln = pc->para.setup.phone;
85 switch (0x5f & *teln) {
117 *p++ = pc->para.setup.si1;
118 *p++ = pc->para.setup.si2;
123 *p++ = pc->para.setup.si1;
124 *p++ = pc->para.setup.si2;
126 eaz = pc->para.setup.eazmsn;
133 *p++ = *eaz++ & 0x7f;
140 *p++ = *teln++ & 0x7f;
146 *p++ = pc->para.setup.si1;
147 *p++ = pc->para.setup.si2;
160 l3_1tr6_setup(
struct l3_process *pc,
u_char pr,
void *arg)
171 l3_1tr6_error(pc,
"setup wrong chanID len", skb);
174 if ((p[2] & 0xf4) != 0x80) {
175 l3_1tr6_error(pc,
"setup wrong WE0_chanID", skb);
178 if ((pc->para.bchannel = p[2] & 0x3))
181 l3_1tr6_error(pc,
"missing setup chanID", skb);
187 pc->para.setup.si1 = p[2];
188 pc->para.setup.si2 = p[3];
190 l3_1tr6_error(pc,
"missing setup SI", skb);
196 iecpy(pc->para.setup.eazmsn, p, 1);
198 pc->para.setup.eazmsn[0] = 0;
202 iecpy(pc->para.setup.phone, p, 1);
204 pc->para.setup.phone[0] = 0;
216 if ((pc->para.setup.si1 != 7) && (pc->st->l3.debug &
L3_DEB_WARN)) {
217 sprintf(tmp,
"non-digital call: %s -> %s",
218 pc->para.setup.phone,
219 pc->para.setup.eazmsn);
229 l3_1tr6_setup_ack(
struct l3_process *pc,
u_char pr,
void *arg)
239 l3_1tr6_error(pc,
"setup_ack wrong chanID len", skb);
242 if ((p[2] & 0xf4) != 0x80) {
243 l3_1tr6_error(pc,
"setup_ack wrong WE0_chanID", skb);
246 pc->para.bchannel = p[2] & 0x3;
248 l3_1tr6_error(pc,
"missing setup_ack WE0_chanID", skb);
257 l3_1tr6_call_sent(
struct l3_process *pc,
u_char pr,
void *arg)
266 l3_1tr6_error(pc,
"call sent wrong chanID len", skb);
269 if ((p[2] & 0xf4) != 0x80) {
270 l3_1tr6_error(pc,
"call sent wrong WE0_chanID", skb);
273 if ((pc->state == 2) && (pc->para.bchannel != (p[2] & 0x3))) {
274 l3_1tr6_error(pc,
"call sent wrong chanID value", skb);
277 pc->para.bchannel = p[2] & 0x3;
279 l3_1tr6_error(pc,
"missing call sent WE0_chanID", skb);
289 l3_1tr6_alert(
struct l3_process *pc,
u_char pr,
void *arg)
300 l3_1tr6_info(
struct l3_process *pc,
u_char pr,
void *arg)
303 int i, tmpcharge = 0;
304 char a_charge[8], tmp[32];
309 iecpy(a_charge, p, 1);
310 for (i = 0; i <
strlen(a_charge); i++) {
312 tmpcharge += a_charge[
i] & 0xf;
314 if (tmpcharge > pc->para.chargeinfo) {
315 pc->para.chargeinfo = tmpcharge;
319 sprintf(tmp,
"charging info %d", pc->para.chargeinfo);
323 l3_debug(pc->st,
"charging info not found");
329 l3_1tr6_info_s2(
struct l3_process *pc,
u_char pr,
void *arg)
337 l3_1tr6_connect(
struct l3_process *pc,
u_char pr,
void *arg)
343 l3_1tr6_error(pc,
"missing connect date", skb);
348 pc->para.chargeinfo = 0;
353 l3_1tr6_rel(
struct l3_process *pc,
u_char pr,
void *arg)
361 pc->para.cause = p[2];
371 pc->para.cause = NO_CAUSE;
372 l3_1tr6_error(pc,
"missing REL cause", skb);
384 l3_1tr6_rel_ack(
struct l3_process *pc,
u_char pr,
void *arg)
391 pc->para.cause = NO_CAUSE;
397 l3_1tr6_disc(
struct l3_process *pc,
u_char pr,
void *arg)
401 int i, tmpcharge = 0;
402 char a_charge[8], tmp[32];
407 iecpy(a_charge, p, 1);
408 for (i = 0; i <
strlen(a_charge); i++) {
410 tmpcharge += a_charge[
i] & 0xf;
412 if (tmpcharge > pc->para.chargeinfo) {
413 pc->para.chargeinfo = tmpcharge;
417 sprintf(tmp,
"charging info %d", pc->para.chargeinfo);
421 l3_debug(pc->st,
"charging info not found");
427 pc->para.cause = p[2];
438 l3_debug(pc->st,
"cause not found");
439 pc->para.cause = NO_CAUSE;
442 l3_1tr6_error(pc,
"missing connack date", skb);
452 l3_1tr6_connect_ack(
struct l3_process *pc,
u_char pr,
void *arg)
457 l3_1tr6_error(pc,
"missing connack date", skb);
462 pc->para.chargeinfo = 0;
468 l3_1tr6_alert_req(
struct l3_process *pc,
u_char pr,
void *arg)
475 l3_1tr6_setup_rsp(
struct l3_process *pc,
u_char pr,
void *arg)
489 *p++ = pc->para.setup.si1;
490 *p++ = pc->para.setup.si2;
495 *p++ = pc->para.setup.si1;
496 *p++ = pc->para.setup.si2;
509 l3_1tr6_reset(
struct l3_process *pc,
u_char pr,
void *arg)
515 l3_1tr6_disconnect_req(
struct l3_process *pc,
u_char pr,
void *arg)
524 if (pc->para.cause > 0)
525 cause = pc->para.cause;
527 switch (cause & 0x7f) {
554 l3_1tr6_t303(
struct l3_process *pc,
u_char pr,
void *arg)
559 l3_1tr6_setup_req(pc, pr, arg);
563 l3_1tr6_disconnect_req(pc, 0,
NULL);
568 l3_1tr6_t304(
struct l3_process *pc,
u_char pr,
void *arg)
571 pc->para.cause = 0xE6;
572 l3_1tr6_disconnect_req(pc, pr,
NULL);
577 l3_1tr6_t305(
struct l3_process *pc,
u_char pr,
void *arg)
587 if (pc->para.cause != NO_CAUSE)
588 cause = pc->para.cause;
590 switch (cause & 0x7f) {
613 l3_1tr6_t310(
struct l3_process *pc,
u_char pr,
void *arg)
616 pc->para.cause = 0xE6;
617 l3_1tr6_disconnect_req(pc, pr,
NULL);
622 l3_1tr6_t313(
struct l3_process *pc,
u_char pr,
void *arg)
625 pc->para.cause = 0xE6;
626 l3_1tr6_disconnect_req(pc, pr,
NULL);
631 l3_1tr6_t308_1(
struct l3_process *pc,
u_char pr,
void *arg)
640 l3_1tr6_t308_2(
struct l3_process *pc,
u_char pr,
void *arg)
648 l3_1tr6_dl_reset(
struct l3_process *pc,
u_char pr,
void *arg)
651 l3_1tr6_disconnect_req(pc, pr,
NULL);
656 l3_1tr6_dl_release(
struct l3_process *pc,
u_char pr,
void *arg)
659 pc->para.cause = 0x1b;
744 up1tr6(
struct PStack *
st,
int pr,
void *arg)
747 struct l3_process *proc;
773 sprintf(tmp,
"up1tr6%sunexpected discriminator %x message len %d",
781 if (skb->
data[1] != 1) {
783 sprintf(tmp,
"up1tr6 CR len not 1");
794 sprintf(tmp,
"up1tr6%s N0 mt %x unhandled",
804 sprintf(tmp,
"up1tr6 no roc mem");
824 sprintf(tmp,
"up1tr6 no roc mem");
834 if ((mt == datastln1[i].primitive) &&
835 ((1 << proc->state) & datastln1[i].
state))
840 sprintf(tmp,
"up1tr6%sstate %d mt %x unhandled",
848 sprintf(tmp,
"up1tr6%sstate %d mt %x",
853 datastln1[
i].
rout(proc, pr, skb);
859 down1tr6(
struct PStack *st,
int pr,
void *arg)
862 struct l3_process *proc;
886 if ((pr == downstl[i].primitive) &&
887 ((1 << proc->state) & downstl[i].state))
891 sprintf(tmp,
"down1tr6 state %d prim %d unhandled",
897 sprintf(tmp,
"down1tr6 state %d prim %d",
901 downstl[
i].
rout(proc, pr, arg);
906 man1tr6(
struct PStack *st,
int pr,
void *arg)
909 struct l3_process *proc =
arg;
915 for (i = 0; i <
ARRAY_SIZE(manstatelist); i++)
916 if ((pr == manstatelist[i].primitive) &&
917 ((1 << proc->state) & manstatelist[i].state))
921 l3_debug(st,
"cr %d man1tr6 state %d prim %d unhandled",
922 proc->callref & 0x7f, proc->state, pr);
926 l3_debug(st,
"cr %d man1tr6 state %d prim %d",
927 proc->callref & 0x7f, proc->state, pr);
929 manstatelist[
i].
rout(proc, pr, arg);
938 st->lli.l4l3 = down1tr6;
939 st->l2.l2l3 = up1tr6;
940 st->l3.l3ml3 = man1tr6;
943 strcpy(tmp, l3_1tr6_revision);