1 /* $Id: q931.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
3 * code to decode ITU Q.931 call control messages
6 * Copyright by Jan den Ouden
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
13 * Pauline Middelink general improvements
14 * Beat Doebeli cause texts, display information element
15 * Karsten Keil cause texts, display information element for 1TR6
20 #define __NO_VERSION__
25 iecpy(u_char * dest, u_char * iestart, int ieoffset)
30 p = iestart + ieoffset + 2;
31 l = iestart[1] - ieoffset;
38 * According to Table 4-2/Q.931
50 0x2, "CALL PROCEEDING"
56 0xf, "CONNECT ACKNOWLEDGE"
65 0xd, "SETUP ACKNOWLEDGE"
71 0x28, "HOLD ACKNOWLEDGE"
80 0x33, "RETRIEVE ACKNOWLEDGE"
83 0x37, "RETRIEVE REJECT"
89 0x2e, "RESUME ACKNOWLEDGE"
98 0x2d, "SUSPEND ACKNOWLEDGE"
101 0x21, "SUSPEND REJECT"
104 0x20, "USER INFORMATION"
113 0x5a, "RELEASE COMPLETE"
119 0x4e, "RESTART ACKNOWLEDGE"
125 0x79, "CONGESTION CONTROL"
140 0x75, "STATUS ENQUIRY"
144 #define MTSIZE sizeof(mtlist)/sizeof(struct MessageType)
147 struct MessageType mt_n0[] =
149 {MT_N0_REG_IND, "REGister INDication"},
150 {MT_N0_CANC_IND, "CANCel INDication"},
151 {MT_N0_FAC_STA, "FACility STAtus"},
152 {MT_N0_STA_ACK, "STAtus ACKnowledge"},
153 {MT_N0_STA_REJ, "STAtus REJect"},
154 {MT_N0_FAC_INF, "FACility INFormation"},
155 {MT_N0_INF_ACK, "INFormation ACKnowledge"},
156 {MT_N0_INF_REJ, "INFormation REJect"},
157 {MT_N0_CLOSE, "CLOSE"},
158 {MT_N0_CLO_ACK, "CLOse ACKnowledge"}
161 #define MT_N0_LEN (sizeof(mt_n0) / sizeof(struct MessageType))
164 struct MessageType mt_n1[] =
166 {MT_N1_ESC, "ESCape"},
167 {MT_N1_ALERT, "ALERT"},
168 {MT_N1_CALL_SENT, "CALL SENT"},
169 {MT_N1_CONN, "CONNect"},
170 {MT_N1_CONN_ACK, "CONNect ACKnowledge"},
171 {MT_N1_SETUP, "SETUP"},
172 {MT_N1_SETUP_ACK, "SETUP ACKnowledge"},
173 {MT_N1_RES, "RESume"},
174 {MT_N1_RES_ACK, "RESume ACKnowledge"},
175 {MT_N1_RES_REJ, "RESume REJect"},
176 {MT_N1_SUSP, "SUSPend"},
177 {MT_N1_SUSP_ACK, "SUSPend ACKnowledge"},
178 {MT_N1_SUSP_REJ, "SUSPend REJect"},
179 {MT_N1_USER_INFO, "USER INFO"},
180 {MT_N1_DET, "DETach"},
181 {MT_N1_DISC, "DISConnect"},
182 {MT_N1_REL, "RELease"},
183 {MT_N1_REL_ACK, "RELease ACKnowledge"},
184 {MT_N1_CANC_ACK, "CANCel ACKnowledge"},
185 {MT_N1_CANC_REJ, "CANCel REJect"},
186 {MT_N1_CON_CON, "CONgestion CONtrol"},
187 {MT_N1_FAC, "FACility"},
188 {MT_N1_FAC_ACK, "FACility ACKnowledge"},
189 {MT_N1_FAC_CAN, "FACility CANcel"},
190 {MT_N1_FAC_REG, "FACility REGister"},
191 {MT_N1_FAC_REJ, "FACility REJect"},
192 {MT_N1_INFO, "INFOrmation"},
193 {MT_N1_REG_ACK, "REGister ACKnowledge"},
194 {MT_N1_REG_REJ, "REGister REJect"},
195 {MT_N1_STAT, "STATus"}
198 #define MT_N1_LEN (sizeof(mt_n1) / sizeof(struct MessageType))
202 prbits(char *dest, u_char b, int start, int len)
206 b = b << (8 - start);
221 while (!(*p++ & 0x80));
226 * Cause Values According to Q.850
227 * edescr: English description
228 * ddescr: German description used by Swissnet II (Swiss Telecom
240 0x01, "Unallocated (unassigned) number", "Nummer nicht zugeteilt"
243 0x02, "No route to specified transit network", ""
246 0x03, "No route to destination", ""
249 0x04, "Send special information tone", ""
252 0x05, "Misdialled trunk prefix", ""
255 0x06, "Channel unacceptable", "Kanal nicht akzeptierbar"
258 0x07, "Channel awarded and being delivered in an established channel", ""
261 0x08, "Preemption", ""
264 0x09, "Preemption - circuit reserved for reuse", ""
267 0x10, "Normal call clearing", "Normale Ausloesung"
270 0x11, "User busy", "TNB besetzt"
273 0x12, "No user responding", ""
276 0x13, "No answer from user (user alerted)", ""
279 0x14, "Subscriber absent", ""
282 0x15, "Call rejected", ""
285 0x16, "Number changed", ""
288 0x1a, "non-selected user clearing", ""
291 0x1b, "Destination out of order", ""
294 0x1c, "Invalid number format (address incomplete)", ""
297 0x1d, "Facility rejected", ""
300 0x1e, "Response to Status enquiry", ""
303 0x1f, "Normal, unspecified", ""
306 0x22, "No circuit/channel available", ""
309 0x26, "Network out of order", ""
312 0x27, "Permanent frame mode connection out-of-service", ""
315 0x28, "Permanent frame mode connection operational", ""
318 0x29, "Temporary failure", ""
321 0x2a, "Switching equipment congestion", ""
324 0x2b, "Access information discarded", ""
327 0x2c, "Requested circuit/channel not available", ""
330 0x2e, "Precedence call blocked", ""
333 0x2f, "Resource unavailable, unspecified", ""
336 0x31, "Quality of service unavailable", ""
339 0x32, "Requested facility not subscribed", ""
342 0x35, "Outgoing calls barred within CUG", ""
345 0x37, "Incoming calls barred within CUG", ""
348 0x39, "Bearer capability not authorized", ""
351 0x3a, "Bearer capability not presently available", ""
354 0x3e, "Inconsistency in designated outgoing access information and subscriber class ", " "
357 0x3f, "Service or option not available, unspecified", ""
360 0x41, "Bearer capability not implemented", ""
363 0x42, "Channel type not implemented", ""
366 0x43, "Requested facility not implemented", ""
369 0x44, "Only restricted digital information bearer capability is available", ""
372 0x4f, "Service or option not implemented", ""
375 0x51, "Invalid call reference value", ""
378 0x52, "Identified channel does not exist", ""
381 0x53, "A suspended call exists, but this call identity does not", ""
384 0x54, "Call identity in use", ""
387 0x55, "No call suspended", ""
390 0x56, "Call having the requested call identity has been cleared", ""
393 0x57, "User not member of CUG", ""
396 0x58, "Incompatible destination", ""
399 0x5a, "Non-existent CUG", ""
402 0x5b, "Invalid transit network selection", ""
405 0x5f, "Invalid message, unspecified", ""
408 0x60, "Mandatory information element is missing", ""
411 0x61, "Message type non-existent or not implemented", ""
414 0x62, "Message not compatible with call state or message type non-existent or not implemented ", " "
417 0x63, "Information element/parameter non-existent or not implemented", ""
420 0x64, "Invalid information element contents", ""
423 0x65, "Message not compatible with call state", ""
426 0x66, "Recovery on timer expiry", ""
429 0x67, "Parameter non-existent or not implemented - passed on", ""
432 0x6e, "Message with unrecognized parameter discarded", ""
435 0x6f, "Protocol error, unspecified", ""
438 0x7f, "Interworking, unspecified", ""
442 #define CVSIZE sizeof(cvlist)/sizeof(struct CauseValue)
446 prcause(char *dest, u_char * p)
454 dp += sprintf(dp, " coding ");
455 dp += prbits(dp, *p, 7, 2);
456 dp += sprintf(dp, " location ");
457 dp += prbits(dp, *p, 4, 4);
463 /* locate cause value */
464 for (i = 0; i < CVSIZE; i++)
465 if (cvlist[i].nr == cause)
468 /* display cause value if it exists */
470 dp += sprintf(dp, "Unknown cause type %x!\n", cause);
472 dp += sprintf(dp, " cause value %x : %s \n", cause, cvlist[i].edescr);
477 dp += sprintf(dp, " diag attribute %d ", *p++ & 0x7f);
478 dp += sprintf(dp, " rej %d ", *p & 0x7f);
483 dp += sprintf(dp, " av %d\n", (*++p) & 0x7f);
490 struct MessageType cause_1tr6[] =
492 {CAUSE_InvCRef, "Invalid Call Reference"},
493 {CAUSE_BearerNotImpl, "Bearer Service Not Implemented"},
494 {CAUSE_CIDunknown, "Caller Identity unknown"},
495 {CAUSE_CIDinUse, "Caller Identity in Use"},
496 {CAUSE_NoChans, "No Channels available"},
497 {CAUSE_FacNotImpl, "Facility Not Implemented"},
498 {CAUSE_FacNotSubscr, "Facility Not Subscribed"},
499 {CAUSE_OutgoingBarred, "Outgoing calls barred"},
500 {CAUSE_UserAccessBusy, "User Access Busy"},
501 {CAUSE_NegativeGBG, "Negative GBG"},
502 {CAUSE_UnknownGBG, "Unknown GBG"},
503 {CAUSE_NoSPVknown, "No SPV known"},
504 {CAUSE_DestNotObtain, "Destination not obtainable"},
505 {CAUSE_NumberChanged, "Number changed"},
506 {CAUSE_OutOfOrder, "Out Of Order"},
507 {CAUSE_NoUserResponse, "No User Response"},
508 {CAUSE_UserBusy, "User Busy"},
509 {CAUSE_IncomingBarred, "Incoming Barred"},
510 {CAUSE_CallRejected, "Call Rejected"},
511 {CAUSE_NetworkCongestion, "Network Congestion"},
512 {CAUSE_RemoteUser, "Remote User initiated"},
513 {CAUSE_LocalProcErr, "Local Procedure Error"},
514 {CAUSE_RemoteProcErr, "Remote Procedure Error"},
515 {CAUSE_RemoteUserSuspend, "Remote User Suspend"},
516 {CAUSE_RemoteUserResumed, "Remote User Resumed"},
517 {CAUSE_UserInfoDiscarded, "User Info Discarded"}
520 int cause_1tr6_len = (sizeof(cause_1tr6) / sizeof(struct MessageType));
523 prcause_1tr6(char *dest, u_char * p)
530 dp += sprintf(dp, " OK (cause length=0)\n");
533 dp += sprintf(dp, " coding ");
534 dp += prbits(dp, p[2], 7, 2);
535 dp += sprintf(dp, " location ");
536 dp += prbits(dp, p[2], 4, 4);
542 /* locate cause value */
543 for (i = 0; i < cause_1tr6_len; i++)
544 if (cause_1tr6[i].nr == cause)
547 /* display cause value if it exists */
548 if (i == cause_1tr6_len)
549 dp += sprintf(dp, "Unknown cause type %x!\n", cause);
551 dp += sprintf(dp, " cause value %x : %s \n", cause, cause_1tr6[i].descr);
558 prchident(char *dest, u_char * p)
563 dp += sprintf(dp, " octet 3 ");
564 dp += prbits(dp, *p, 8, 8);
570 prcalled(char *dest, u_char * p)
577 dp += sprintf(dp, " octet 3 ");
578 dp += prbits(dp, *p++, 8, 8);
580 dp += sprintf(dp, " number digits ");
587 prcalling(char *dest, u_char * p)
594 dp += sprintf(dp, " octet 3 ");
595 dp += prbits(dp, *p, 8, 8);
598 dp += sprintf(dp, " octet 3a ");
599 dp += prbits(dp, *++p, 8, 8);
605 dp += sprintf(dp, " number digits ");
614 prbearer(char *dest, u_char * p)
619 dp += sprintf(dp, " octet 3 ");
620 dp += prbits(dp, *p++, 8, 8);
622 dp += sprintf(dp, " octet 4 ");
623 dp += prbits(dp, *p, 8, 8);
625 if ((*p++ & 0x1f) == 0x18) {
626 dp += sprintf(dp, " octet 4.1 ");
627 dp += prbits(dp, *p++, 8, 8);
630 /* check for user information layer 1 */
631 if ((*p & 0x60) == 0x20) {
634 dp += sprintf(dp, " octet 5%c ", ch);
635 dp += prbits(dp, *p, 8, 8);
642 while (!(*p++ & 0x80));
644 /* check for user information layer 2 */
645 if ((*p & 0x60) == 0x40) {
646 dp += sprintf(dp, " octet 6 ");
647 dp += prbits(dp, *p++, 8, 8);
650 /* check for user information layer 3 */
651 if ((*p & 0x60) == 0x60) {
652 dp += sprintf(dp, " octet 7 ");
653 dp += prbits(dp, *p++, 8, 8);
662 prbearer_ni1(char *dest, u_char * p)
669 dp += sprintf(dp, " octet 3 ");
670 dp += prbits(dp, *p, 8, 8);
673 dp += sprintf(dp, " Speech");
676 dp += sprintf(dp, " Unrestricted digital information");
679 dp += sprintf(dp, " 3.1 kHz audio");
682 dp += sprintf(dp, " Unknown information-transfer capability");
685 dp += sprintf(dp, " octet 4 ");
686 dp += prbits(dp, *p, 8, 8);
689 dp += sprintf(dp, " 64 kbps, circuit mode");
692 dp += sprintf(dp, " Packet mode");
695 dp += sprintf(dp, " Unknown transfer mode");
699 dp += sprintf(dp, " octet 5 ");
700 dp += prbits(dp, *p, 8, 8);
703 dp += sprintf(dp, " Rate adaption\n");
704 dp += sprintf(dp, " octet 5a ");
705 dp += prbits(dp, *p, 8, 8);
708 dp += sprintf(dp, " u-law");
711 dp += sprintf(dp, " Unknown UI layer 1 protocol");
719 general(char *dest, u_char * p)
727 /* Iterate over all octets in the information element */
729 dp += sprintf(dp, " octet %d%c ", octet, ch);
730 dp += prbits(dp, *p++, 8, 8);
733 /* last octet in group? */
737 } else if (ch == ' ')
746 general_ni1(char *dest, u_char * p)
754 /* Iterate over all octets in the information element */
756 dp += sprintf(dp, " octet %d%c ", octet, ch);
757 dp += prbits(dp, *p, 8, 8);
760 /* last octet in group? */
764 } else if (ch == ' ')
773 prcharge(char *dest, u_char * p)
780 dp += sprintf(dp, " GEA ");
781 dp += prbits(dp, *p++, 8, 8);
782 dp += sprintf(dp, " Anzahl: ");
783 /* Iterate over all octets in the * information element */
790 prtext(char *dest, u_char * p)
797 dp += sprintf(dp, " ");
798 /* Iterate over all octets in the * information element */
806 prfeatureind(char *dest, u_char * p)
810 p += 2; /* skip id, len */
811 dp += sprintf(dp, " octet 3 ");
812 dp += prbits(dp, *p, 8, 8);
815 dp += sprintf(dp, " octet 4 ");
816 dp += prbits(dp, *p++, 8, 8);
819 dp += sprintf(dp, " Status: ");
822 dp += sprintf(dp, "Idle");
825 dp += sprintf(dp, "Active");
828 dp += sprintf(dp, "Prompt");
831 dp += sprintf(dp, "Pending");
834 dp += sprintf(dp, "(Reserved)");
842 struct DTag { /* Display tags */
846 { 0x82, "Continuation" },
847 { 0x83, "Called address" },
849 { 0x85, "Progress indicator" },
850 { 0x86, "Notification indicator" },
852 { 0x88, "Accumlated digits" },
855 { 0x8b, "Calling address" },
857 { 0x8d, "Calling party name" },
858 { 0x8e, "Called party name" },
859 { 0x8f, "Orignal called name" },
860 { 0x90, "Redirecting name" },
861 { 0x91, "Connected name" },
862 { 0x92, "Originating restrictions" },
863 { 0x93, "Date & time of day" },
864 { 0x94, "Call Appearance ID" },
865 { 0x95, "Feature address" },
866 { 0x96, "Redirection name" },
869 #define DTAGSIZE sizeof(dtaglist)/sizeof(struct DTag)
872 disptext_ni1(char *dest, u_char * p)
880 dp += sprintf(dp, " Unknown display type\n");
883 /* Iterate over all tag,length,text fields */
888 /* Don't space or skip */
889 if ((tag == 0x80) || (tag == 0x81)) p++;
891 for (i = 0; i < DTAGSIZE; i++)
892 if (tag == dtaglist[i].nr)
895 /* When not found, give appropriate msg */
897 dp += sprintf(dp, " %s: ", dtaglist[i].descr);
901 dp += sprintf(dp, " (unknown display tag %2x): ", tag);
905 dp += sprintf(dp, "\n");
911 display(char *dest, u_char * p)
919 /* Iterate over all octets in the * display-information element */
920 dp += sprintf(dp, " \"");
922 dp += sprintf(dp, "%c", *p++);
924 /* last octet in group? */
928 } else if (ch == ' ')
940 prfacility(char *dest, u_char * p)
947 dp += sprintf(dp, " octet 3 ");
948 dp += prbits(dp, *p++, 8, 8);
949 dp += sprintf(dp, "\n");
953 dp += sprintf(dp, " octet 4 ");
954 dp += prbits(dp, *p++, 8, 8);
955 dp += sprintf(dp, "\n");
956 dp += sprintf(dp, " octet 5 %d\n", l2 = *p++ & 0x7f);
958 dp += sprintf(dp, " contents ");
960 dp += sprintf(dp, "%2x ", *p++);
963 dp += sprintf(dp, "\n");
970 struct InformationElement {
973 int (*f) (char *, u_char *);
977 0x00, "Segmented message", general
980 0x04, "Bearer capability", prbearer
983 0x08, "Cause", prcause
986 0x10, "Call identity", general
989 0x14, "Call state", general
992 0x18, "Channel identification", prchident
995 0x1c, "Facility", prfacility
998 0x1e, "Progress indicator", general
1001 0x20, "Network-specific facilities", general
1004 0x27, "Notification indicator", general
1007 0x28, "Display", display
1010 0x29, "Date/Time", general
1013 0x2c, "Keypad facility", general
1016 0x34, "Signal", general
1019 0x40, "Information rate", general
1022 0x42, "End-to-end delay", general
1025 0x43, "Transit delay selection and indication", general
1028 0x44, "Packet layer binary parameters", general
1031 0x45, "Packet layer window size", general
1034 0x46, "Packet size", general
1037 0x47, "Closed user group", general
1040 0x4a, "Reverse charge indication", general
1043 0x6c, "Calling party number", prcalling
1046 0x6d, "Calling party subaddress", general
1049 0x70, "Called party number", prcalled
1052 0x71, "Called party subaddress", general
1055 0x74, "Redirecting number", general
1058 0x78, "Transit network selection", general
1061 0x79, "Restart indicator", general
1064 0x7c, "Low layer compatibility", general
1067 0x7d, "High layer compatibility", general
1070 0x7e, "User-user", general
1073 0x7f, "Escape for extension", general
1078 #define IESIZE sizeof(ielist)/sizeof(struct InformationElement)
1081 struct InformationElement ielist_ni1[] = {
1082 { 0x04, "Bearer Capability", prbearer_ni1 },
1083 { 0x08, "Cause", prcause },
1084 { 0x14, "Call State", general_ni1 },
1085 { 0x18, "Channel Identification", prchident },
1086 { 0x1e, "Progress Indicator", general_ni1 },
1087 { 0x27, "Notification Indicator", general_ni1 },
1088 { 0x2c, "Keypad Facility", prtext },
1089 { 0x32, "Information Request", general_ni1 },
1090 { 0x34, "Signal", general_ni1 },
1091 { 0x38, "Feature Activation", general_ni1 },
1092 { 0x39, "Feature Indication", prfeatureind },
1093 { 0x3a, "Service Profile Identification (SPID)", prtext },
1094 { 0x3b, "Endpoint Identifier", general_ni1 },
1095 { 0x6c, "Calling Party Number", prcalling },
1096 { 0x6d, "Calling Party Subaddress", general_ni1 },
1097 { 0x70, "Called Party Number", prcalled },
1098 { 0x71, "Called Party Subaddress", general_ni1 },
1099 { 0x74, "Redirecting Number", general_ni1 },
1100 { 0x78, "Transit Network Selection", general_ni1 },
1101 { 0x7c, "Low Layer Compatibility", general_ni1 },
1102 { 0x7d, "High Layer Compatibility", general_ni1 },
1106 #define IESIZE_NI1 sizeof(ielist_ni1)/sizeof(struct InformationElement)
1109 struct InformationElement ielist_ni1_cs5[] = {
1110 { 0x1d, "Operator system access", general_ni1 },
1111 { 0x2a, "Display text", disptext_ni1 },
1114 #define IESIZE_NI1_CS5 sizeof(ielist_ni1_cs5)/sizeof(struct InformationElement)
1117 struct InformationElement ielist_ni1_cs6[] = {
1118 { 0x7b, "Call appearance", general_ni1 },
1121 #define IESIZE_NI1_CS6 sizeof(ielist_ni1_cs6)/sizeof(struct InformationElement)
1123 static struct InformationElement we_0[] =
1125 {WE0_cause, "Cause", prcause_1tr6},
1126 {WE0_connAddr, "Connecting Address", prcalled},
1127 {WE0_callID, "Call IDentity", general},
1128 {WE0_chanID, "Channel IDentity", general},
1129 {WE0_netSpecFac, "Network Specific Facility", general},
1130 {WE0_display, "Display", general},
1131 {WE0_keypad, "Keypad", general},
1132 {WE0_origAddr, "Origination Address", prcalled},
1133 {WE0_destAddr, "Destination Address", prcalled},
1134 {WE0_userInfo, "User Info", general}
1137 #define WE_0_LEN (sizeof(we_0) / sizeof(struct InformationElement))
1139 static struct InformationElement we_6[] =
1141 {WE6_serviceInd, "Service Indicator", general},
1142 {WE6_chargingInfo, "Charging Information", prcharge},
1143 {WE6_date, "Date", prtext},
1144 {WE6_facSelect, "Facility Select", general},
1145 {WE6_facStatus, "Facility Status", general},
1146 {WE6_statusCalled, "Status Called", general},
1147 {WE6_addTransAttr, "Additional Transmission Attributes", general}
1149 #define WE_6_LEN (sizeof(we_6) / sizeof(struct InformationElement))
1152 QuickHex(char *txt, u_char * p, int cnt)
1155 register char *t = txt;
1158 for (i = 0; i < cnt; i++) {
1160 w = (p[i] >> 4) & 0x0f;
1164 *t++ = 'A' - 10 + w;
1169 *t++ = 'A' - 10 + w;
1176 LogFrame(struct IsdnCardState *cs, u_char * buf, int size)
1183 if (size < MAX_DLOG_SPACE / 3 - 10) {
1188 dp += QuickHex(dp, buf, size);
1192 HiSax_putstatus(cs, NULL, cs->dlog);
1194 HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);
1198 dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir)
1202 unsigned char pd, cr_l, cr, mt;
1203 unsigned char sapi, tei, ftyp;
1204 int i, cset = 0, cs_old = 0, cs_fest = 0;
1205 int size, finish = 0;
1209 /* display header */
1211 dp += jiftime(dp, jiffies);
1213 sapi = skb->data[0] >> 2;
1214 tei = skb->data[1] >> 1;
1215 ftyp = skb->data[2];
1217 dp += sprintf(dp, "frame %s ", dir ? "network->user" : "user->network");
1220 if (tei == GROUP_TEI) {
1221 if (sapi == CTRL_SAPI) { /* sapi 0 */
1223 dp += sprintf(dp, "broadcast\n");
1227 dp += sprintf(dp, "no UI broadcast\n");
1230 } else if (sapi == TEI_SAPI) {
1231 dp += sprintf(dp, "tei management\n");
1234 dp += sprintf(dp, "unknown sapi %d broadcast\n", sapi);
1238 if (sapi == CTRL_SAPI) {
1239 if (!(ftyp & 1)) { /* IFrame */
1240 dp += sprintf(dp, "with tei %d\n", tei);
1244 dp += sprintf(dp, "SFrame with tei %d\n", tei);
1248 dp += sprintf(dp, "unknown sapi %d tei %d\n", sapi, tei);
1252 bend = skb->data + skb->len;
1254 dp += sprintf(dp, "frame too short\n");
1259 HiSax_putstatus(cs, NULL, cs->dlog);
1262 if ((0xfe & buf[0]) == PROTO_DIS_N0) { /* 1TR6 */
1263 /* locate message type */
1271 if (pd == PROTO_DIS_N0) { /* N0 */
1272 for (i = 0; i < MT_N0_LEN; i++)
1273 if (mt_n0[i].nr == mt)
1275 /* display message type if it exists */
1277 dp += sprintf(dp, "callref %d %s size %d unknown message type N0 %x!\n",
1278 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1281 dp += sprintf(dp, "callref %d %s size %d message type %s\n",
1282 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1283 size, mt_n0[i].descr);
1285 for (i = 0; i < MT_N1_LEN; i++)
1286 if (mt_n1[i].nr == mt)
1288 /* display message type if it exists */
1290 dp += sprintf(dp, "callref %d %s size %d unknown message type N1 %x!\n",
1291 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1294 dp += sprintf(dp, "callref %d %s size %d message type %s\n",
1295 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1296 size, mt_n1[i].descr);
1299 /* display each information element */
1300 while (buf < bend) {
1301 /* Is it a single octet information element? */
1303 switch ((*buf >> 4) & 7) {
1305 dp += sprintf(dp, " Shift %x\n", *buf & 0xf);
1311 dp += sprintf(dp, " Congestion level %x\n", *buf & 0xf);
1315 dp += sprintf(dp, " More data\n");
1319 dp += sprintf(dp, " Sending complete\n");
1324 dp += sprintf(dp, " Reserved %x\n", *buf);
1330 /* No, locate it in the table */
1332 for (i = 0; i < WE_0_LEN; i++)
1333 if (*buf == we_0[i].nr)
1336 /* When found, give appropriate msg */
1337 if (i != WE_0_LEN) {
1338 dp += sprintf(dp, " %s\n", we_0[i].descr);
1339 dp += we_0[i].f(dp, buf);
1341 dp += sprintf(dp, " Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
1342 } else if (cset == 6) {
1343 for (i = 0; i < WE_6_LEN; i++)
1344 if (*buf == we_6[i].nr)
1347 /* When found, give appropriate msg */
1348 if (i != WE_6_LEN) {
1349 dp += sprintf(dp, " %s\n", we_6[i].descr);
1350 dp += we_6[i].f(dp, buf);
1352 dp += sprintf(dp, " Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
1354 dp += sprintf(dp, " Unknown Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
1355 /* Skip to next element */
1363 } else if ((buf[0] == 8) && (cs->protocol == ISDN_PTYPE_NI1)) { /* NI-1 */
1364 /* locate message type */
1372 for (i = 0; i < MTSIZE; i++)
1373 if (mtlist[i].nr == mt)
1376 /* display message type if it exists */
1378 dp += sprintf(dp, "callref %d %s size %d unknown message type %x!\n",
1379 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1382 dp += sprintf(dp, "callref %d %s size %d message type %s\n",
1383 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1384 size, mtlist[i].descr);
1386 /* display each information element */
1387 while (buf < bend) {
1388 /* Is it a single octet information element? */
1390 switch ((*buf >> 4) & 7) {
1392 dp += sprintf(dp, " Shift %x\n", *buf & 0xf);
1398 dp += sprintf(dp, " Unknown single-octet IE %x\n", *buf);
1404 /* No, locate it in the table */
1406 for (i = 0; i < IESIZE; i++)
1407 if (*buf == ielist_ni1[i].nr)
1410 /* When not found, give appropriate msg */
1412 dp += sprintf(dp, " %s\n", ielist_ni1[i].descr);
1413 dp += ielist_ni1[i].f(dp, buf);
1415 dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]);
1416 } else if (cset == 5) {
1417 for (i = 0; i < IESIZE_NI1_CS5; i++)
1418 if (*buf == ielist_ni1_cs5[i].nr)
1421 /* When not found, give appropriate msg */
1422 if (i != IESIZE_NI1_CS5) {
1423 dp += sprintf(dp, " %s\n", ielist_ni1_cs5[i].descr);
1424 dp += ielist_ni1_cs5[i].f(dp, buf);
1426 dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]);
1427 } else if (cset == 6) {
1428 for (i = 0; i < IESIZE_NI1_CS6; i++)
1429 if (*buf == ielist_ni1_cs6[i].nr)
1432 /* When not found, give appropriate msg */
1433 if (i != IESIZE_NI1_CS6) {
1434 dp += sprintf(dp, " %s\n", ielist_ni1_cs6[i].descr);
1435 dp += ielist_ni1_cs6[i].f(dp, buf);
1437 dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]);
1439 dp += sprintf(dp, " Unknown Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
1441 /* Skip to next element */
1449 } else if ((buf[0] == 8) && (cs->protocol == ISDN_PTYPE_EURO)) { /* EURO */
1450 /* locate message type */
1458 for (i = 0; i < MTSIZE; i++)
1459 if (mtlist[i].nr == mt)
1462 /* display message type if it exists */
1464 dp += sprintf(dp, "callref %d %s size %d unknown message type %x!\n",
1465 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1468 dp += sprintf(dp, "callref %d %s size %d message type %s\n",
1469 cr & 0x7f, (cr & 0x80) ? "called" : "caller",
1470 size, mtlist[i].descr);
1472 /* display each information element */
1473 while (buf < bend) {
1474 /* Is it a single octet information element? */
1476 switch ((*buf >> 4) & 7) {
1478 dp += sprintf(dp, " Shift %x\n", *buf & 0xf);
1481 dp += sprintf(dp, " Congestion level %x\n", *buf & 0xf);
1484 dp += sprintf(dp, " Repeat indicator %x\n", *buf & 0xf);
1488 dp += sprintf(dp, " More data\n");
1492 dp += sprintf(dp, " Sending complete\n");
1497 dp += sprintf(dp, " Reserved %x\n", *buf);
1503 /* No, locate it in the table */
1504 for (i = 0; i < IESIZE; i++)
1505 if (*buf == ielist[i].nr)
1508 /* When not found, give appropriate msg */
1510 dp += sprintf(dp, " %s\n", ielist[i].descr);
1511 dp += ielist[i].f(dp, buf);
1513 dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]);
1515 /* Skip to next element */
1519 dp += sprintf(dp, "Unknown protocol %x!", buf[0]);
1522 HiSax_putstatus(cs, NULL, cs->dlog);