?? q931.c
字號:
}, { 0x40, "Information rate", general }, { 0x42, "End-to-end delay", general }, { 0x43, "Transit delay selection and indication", general }, { 0x44, "Packet layer binary parameters", general }, { 0x45, "Packet layer window size", general }, { 0x46, "Packet size", general }, { 0x47, "Closed user group", general }, { 0x4a, "Reverse charge indication", general }, { 0x6c, "Calling party number", prcalling }, { 0x6d, "Calling party subaddress", general }, { 0x70, "Called party number", prcalled }, { 0x71, "Called party subaddress", general }, { 0x74, "Redirecting number", general }, { 0x78, "Transit network selection", general }, { 0x79, "Restart indicator", general }, { 0x7c, "Low layer compatibility", general }, { 0x7d, "High layer compatibility", general }, { 0x7e, "User-user", general }, { 0x7f, "Escape for extension", general },};#define IESIZE sizeof(ielist)/sizeof(struct InformationElement)staticstruct InformationElement ielist_ni1[] = { { 0x04, "Bearer Capability", prbearer_ni1 }, { 0x08, "Cause", prcause }, { 0x14, "Call State", general_ni1 }, { 0x18, "Channel Identification", prchident }, { 0x1e, "Progress Indicator", general_ni1 }, { 0x27, "Notification Indicator", general_ni1 }, { 0x2c, "Keypad Facility", prtext }, { 0x32, "Information Request", general_ni1 }, { 0x34, "Signal", general_ni1 }, { 0x38, "Feature Activation", general_ni1 }, { 0x39, "Feature Indication", prfeatureind }, { 0x3a, "Service Profile Identification (SPID)", prtext }, { 0x3b, "Endpoint Identifier", general_ni1 }, { 0x6c, "Calling Party Number", prcalling }, { 0x6d, "Calling Party Subaddress", general_ni1 }, { 0x70, "Called Party Number", prcalled }, { 0x71, "Called Party Subaddress", general_ni1 }, { 0x74, "Redirecting Number", general_ni1 }, { 0x78, "Transit Network Selection", general_ni1 }, { 0x7c, "Low Layer Compatibility", general_ni1 }, { 0x7d, "High Layer Compatibility", general_ni1 },};#define IESIZE_NI1 sizeof(ielist_ni1)/sizeof(struct InformationElement)staticstruct InformationElement ielist_ni1_cs5[] = { { 0x1d, "Operator system access", general_ni1 }, { 0x2a, "Display text", disptext_ni1 },};#define IESIZE_NI1_CS5 sizeof(ielist_ni1_cs5)/sizeof(struct InformationElement)staticstruct InformationElement ielist_ni1_cs6[] = { { 0x7b, "Call appearance", general_ni1 },};#define IESIZE_NI1_CS6 sizeof(ielist_ni1_cs6)/sizeof(struct InformationElement)static struct InformationElement we_0[] ={ {WE0_cause, "Cause", prcause_1tr6}, {WE0_connAddr, "Connecting Address", prcalled}, {WE0_callID, "Call IDentity", general}, {WE0_chanID, "Channel IDentity", general}, {WE0_netSpecFac, "Network Specific Facility", general}, {WE0_display, "Display", general}, {WE0_keypad, "Keypad", general}, {WE0_origAddr, "Origination Address", prcalled}, {WE0_destAddr, "Destination Address", prcalled}, {WE0_userInfo, "User Info", general}};#define WE_0_LEN (sizeof(we_0) / sizeof(struct InformationElement))static struct InformationElement we_6[] ={ {WE6_serviceInd, "Service Indicator", general}, {WE6_chargingInfo, "Charging Information", prcharge}, {WE6_date, "Date", prtext}, {WE6_facSelect, "Facility Select", general}, {WE6_facStatus, "Facility Status", general}, {WE6_statusCalled, "Status Called", general}, {WE6_addTransAttr, "Additional Transmission Attributes", general}};#define WE_6_LEN (sizeof(we_6) / sizeof(struct InformationElement))intQuickHex(char *txt, u_char * p, int cnt){ register int i; register char *t = txt; register u_char w; for (i = 0; i < cnt; i++) { *t++ = ' '; w = (p[i] >> 4) & 0x0f; if (w < 10) *t++ = '0' + w; else *t++ = 'A' - 10 + w; w = p[i] & 0x0f; if (w < 10) *t++ = '0' + w; else *t++ = 'A' - 10 + w; } *t++ = 0; return (t - txt);}voidLogFrame(struct IsdnCardState *cs, u_char * buf, int size){ char *dp; if (size < 1) return; dp = cs->dlog; if (size < MAX_DLOG_SPACE / 3 - 10) { *dp++ = 'H'; *dp++ = 'E'; *dp++ = 'X'; *dp++ = ':'; dp += QuickHex(dp, buf, size); dp--; *dp++ = '\n'; *dp = 0; HiSax_putstatus(cs, NULL, cs->dlog); } else HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);}voiddlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir){ u_char *bend, *buf; char *dp; unsigned char pd, cr_l, cr, mt; unsigned char sapi, tei, ftyp; int i, cset = 0, cs_old = 0, cs_fest = 0; int size, finish = 0; if (skb->len < 3) return; /* display header */ dp = cs->dlog; dp += jiftime(dp, jiffies); *dp++ = ' '; sapi = skb->data[0] >> 2; tei = skb->data[1] >> 1; ftyp = skb->data[2]; buf = skb->data; dp += sprintf(dp, "frame %s ", dir ? "network->user" : "user->network"); size = skb->len; if (tei == GROUP_TEI) { if (sapi == CTRL_SAPI) { /* sapi 0 */ if (ftyp == 3) { dp += sprintf(dp, "broadcast\n"); buf += 3; size -= 3; } else { dp += sprintf(dp, "no UI broadcast\n"); finish = 1; } } else if (sapi == TEI_SAPI) { dp += sprintf(dp, "tei management\n"); finish = 1; } else { dp += sprintf(dp, "unknown sapi %d broadcast\n", sapi); finish = 1; } } else { if (sapi == CTRL_SAPI) { if (!(ftyp & 1)) { /* IFrame */ dp += sprintf(dp, "with tei %d\n", tei); buf += 4; size -= 4; } else { dp += sprintf(dp, "SFrame with tei %d\n", tei); finish = 1; } } else { dp += sprintf(dp, "unknown sapi %d tei %d\n", sapi, tei); finish = 1; } } bend = skb->data + skb->len; if (buf >= bend) { dp += sprintf(dp, "frame too short\n"); finish = 1; } if (finish) { *dp = 0; HiSax_putstatus(cs, NULL, cs->dlog); return; } if ((0xfe & buf[0]) == PROTO_DIS_N0) { /* 1TR6 */ /* locate message type */ pd = *buf++; cr_l = *buf++; if (cr_l) cr = *buf++; else cr = 0; mt = *buf++; if (pd == PROTO_DIS_N0) { /* N0 */ for (i = 0; i < MT_N0_LEN; i++) if (mt_n0[i].nr == mt) break; /* display message type if it exists */ if (i == MT_N0_LEN) dp += sprintf(dp, "callref %d %s size %d unknown message type N0 %x!\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mt); else dp += sprintf(dp, "callref %d %s size %d message type %s\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mt_n0[i].descr); } else { /* N1 */ for (i = 0; i < MT_N1_LEN; i++) if (mt_n1[i].nr == mt) break; /* display message type if it exists */ if (i == MT_N1_LEN) dp += sprintf(dp, "callref %d %s size %d unknown message type N1 %x!\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mt); else dp += sprintf(dp, "callref %d %s size %d message type %s\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mt_n1[i].descr); } /* display each information element */ while (buf < bend) { /* Is it a single octet information element? */ if (*buf & 0x80) { switch ((*buf >> 4) & 7) { case 1: dp += sprintf(dp, " Shift %x\n", *buf & 0xf); cs_old = cset; cset = *buf & 7; cs_fest = *buf & 8; break; case 3: dp += sprintf(dp, " Congestion level %x\n", *buf & 0xf); break; case 2: if (*buf == 0xa0) { dp += sprintf(dp, " More data\n"); break; } if (*buf == 0xa1) { dp += sprintf(dp, " Sending complete\n"); } break; /* fall through */ default: dp += sprintf(dp, " Reserved %x\n", *buf); break; } buf++; continue; } /* No, locate it in the table */ if (cset == 0) { for (i = 0; i < WE_0_LEN; i++) if (*buf == we_0[i].nr) break; /* When found, give appropriate msg */ if (i != WE_0_LEN) { dp += sprintf(dp, " %s\n", we_0[i].descr); dp += we_0[i].f(dp, buf); } else dp += sprintf(dp, " Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]); } else if (cset == 6) { for (i = 0; i < WE_6_LEN; i++) if (*buf == we_6[i].nr) break; /* When found, give appropriate msg */ if (i != WE_6_LEN) { dp += sprintf(dp, " %s\n", we_6[i].descr); dp += we_6[i].f(dp, buf); } else dp += sprintf(dp, " Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]); } else dp += sprintf(dp, " Unknown Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]); /* Skip to next element */ if (cs_fest == 8) { cset = cs_old; cs_old = 0; cs_fest = 0; } buf += buf[1] + 2; } } else if ((buf[0] == 8) && (cs->protocol == ISDN_PTYPE_NI1)) { /* NI-1 */ /* locate message type */ buf++; cr_l = *buf++; if (cr_l) cr = *buf++; else cr = 0; mt = *buf++; for (i = 0; i < MTSIZE; i++) if (mtlist[i].nr == mt) break; /* display message type if it exists */ if (i == MTSIZE) dp += sprintf(dp, "callref %d %s size %d unknown message type %x!\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mt); else dp += sprintf(dp, "callref %d %s size %d message type %s\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mtlist[i].descr); /* display each information element */ while (buf < bend) { /* Is it a single octet information element? */ if (*buf & 0x80) { switch ((*buf >> 4) & 7) { case 1: dp += sprintf(dp, " Shift %x\n", *buf & 0xf); cs_old = cset; cset = *buf & 7; cs_fest = *buf & 8; break; default: dp += sprintf(dp, " Unknown single-octet IE %x\n", *buf); break; } buf++; continue; } /* No, locate it in the table */ if (cset == 0) { for (i = 0; i < IESIZE; i++) if (*buf == ielist_ni1[i].nr) break; /* When not found, give appropriate msg */ if (i != IESIZE) { dp += sprintf(dp, " %s\n", ielist_ni1[i].descr); dp += ielist_ni1[i].f(dp, buf); } else dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]); } else if (cset == 5) { for (i = 0; i < IESIZE_NI1_CS5; i++) if (*buf == ielist_ni1_cs5[i].nr) break; /* When not found, give appropriate msg */ if (i != IESIZE_NI1_CS5) { dp += sprintf(dp, " %s\n", ielist_ni1_cs5[i].descr); dp += ielist_ni1_cs5[i].f(dp, buf); } else dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]); } else if (cset == 6) { for (i = 0; i < IESIZE_NI1_CS6; i++) if (*buf == ielist_ni1_cs6[i].nr) break; /* When not found, give appropriate msg */ if (i != IESIZE_NI1_CS6) { dp += sprintf(dp, " %s\n", ielist_ni1_cs6[i].descr); dp += ielist_ni1_cs6[i].f(dp, buf); } else dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]); } else dp += sprintf(dp, " Unknown Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]); /* Skip to next element */ if (cs_fest == 8) { cset = cs_old; cs_old = 0; cs_fest = 0; } buf += buf[1] + 2; } } else if ((buf[0] == 8) && (cs->protocol == ISDN_PTYPE_EURO)) { /* EURO */ /* locate message type */ buf++; cr_l = *buf++; if (cr_l) cr = *buf++; else cr = 0; mt = *buf++; for (i = 0; i < MTSIZE; i++) if (mtlist[i].nr == mt) break; /* display message type if it exists */ if (i == MTSIZE) dp += sprintf(dp, "callref %d %s size %d unknown message type %x!\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mt); else dp += sprintf(dp, "callref %d %s size %d message type %s\n", cr & 0x7f, (cr & 0x80) ? "called" : "caller", size, mtlist[i].descr); /* display each information element */ while (buf < bend) { /* Is it a single octet information element? */ if (*buf & 0x80) { switch ((*buf >> 4) & 7) { case 1: dp += sprintf(dp, " Shift %x\n", *buf & 0xf); break; case 3: dp += sprintf(dp, " Congestion level %x\n", *buf & 0xf); break; case 5: dp += sprintf(dp, " Repeat indicator %x\n", *buf & 0xf); break; case 2: if (*buf == 0xa0) { dp += sprintf(dp, " More data\n"); break; } if (*buf == 0xa1) { dp += sprintf(dp, " Sending complete\n"); } break; /* fall through */ default: dp += sprintf(dp, " Reserved %x\n", *buf); break; } buf++; continue; } /* No, locate it in the table */ for (i = 0; i < IESIZE; i++) if (*buf == ielist[i].nr) break; /* When not found, give appropriate msg */ if (i != IESIZE) { dp += sprintf(dp, " %s\n", ielist[i].descr); dp += ielist[i].f(dp, buf); } else dp += sprintf(dp, " attribute %x attribute size %d\n", *buf, buf[1]); /* Skip to next element */ buf += buf[1] + 2; } } else { dp += sprintf(dp, "Unknown protocol %x!", buf[0]); } *dp = 0; HiSax_putstatus(cs, NULL, cs->dlog);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -