static u_int dlci, addr_len;
static uint32_t flags;
- static char buffer[sizeof("DLCI xxxxxxxxxx")];
+ static char buffer[sizeof("parse_q922_header() returned XXXXXXXXXXX")];
+ int ret;
memset(buffer, 0, sizeof(buffer));
- if (parse_q922_header(ndo, p, &dlci, &addr_len, &flags, length) == 1){
+ ret = parse_q922_header(ndo, p, &dlci, &addr_len, &flags, length);
+ if (ret == 1) {
snprintf(buffer, sizeof(buffer), "DLCI %u", dlci);
+ return buffer;
+ } else if (ret == 0) {
+ return "<Invalid DLCI>";
+ } else if (ret == -1) {
+ return "<Truncated>";
+ } else {
+ snprintf(buffer, sizeof(buffer), "parse_q922_header() returned %d", ret);
+ return buffer;
}
-
- return buffer;
}
}
}
-u_int
+/* Frame Relay */
+void
fr_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
u_int caplen = h->caplen;
- ndo->ndo_protocol = "fr_if";
- ND_TCHECK_4(p); /* minimum frame header length */
+ ndo->ndo_protocol = "fr";
+ if (caplen < 4) { /* minimum frame header length */
+ nd_print_trunc(ndo);
+ ndo->ndo_ll_hdr_len += caplen;
+ return;
+ }
- if ((length = fr_print(ndo, p, length)) == 0)
- return (0);
- else
- return length;
-trunc:
- nd_print_trunc(ndo);
- return caplen;
+ ndo->ndo_ll_hdr_len += fr_print(ndo, p, length);
}
u_int
}
-u_int
+/* Multi Link Frame Relay (FRF.16) */
+void
mfr_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
u_int caplen = h->caplen;
- ndo->ndo_protocol = "mfr_if";
- ND_TCHECK_2(p); /* minimum frame header length */
+ ndo->ndo_protocol = "mfr";
+ if (caplen < 2) { /* minimum frame header length */
+ nd_print_trunc(ndo);
+ ndo->ndo_ll_hdr_len += caplen;
+ return;
+ }
- if ((length = mfr_print(ndo, p, length)) == 0)
- return (0);
- else
- return length;
-trunc:
- nd_print_trunc(ndo);
- return caplen;
+ ndo->ndo_ll_hdr_len += mfr_print(ndo, p, length);
}
if (length < 2)
goto trunc;
- ND_TCHECK_2(p);
flags = GET_U_1(p)&MFR_BEC_MASK;
sequence_num = (GET_U_1(p)&0x1e)<<7 | GET_U_1(p + 1);
* dig as deep as we can - e.g. on the first (B) fragment
* there is enough payload to print the IP header
* on non (B) fragments it depends if the fragmentation
- * model is end-to-end or interface based wether we want to print
+ * model is end-to-end or interface based whether we want to print
* another Q.922 header
*/
return;
ND_PRINT("%s, codeset %u", is_ansi ? "ANSI" : "CCITT", codeset);
if (call_ref_length != 0) {
- ND_TCHECK_1(p);
if (call_ref_length > 1 || GET_U_1(p) != 0) {
/*
* Not a dummy call reference.