+static int juniper_parse_header (const u_char *, const struct pcap_pkthdr *, struct juniper_l2info_t *);
+
+u_int
+juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ struct juniper_l2info_t l2info;
+
+ l2info.pictype = JUNIPER_MLPPP;
+ if(juniper_parse_header(p, h, &l2info) == 0)
+ return l2info.header_len;
+
+ /* suppress Bundle-ID if frame was captured on a child-link
+ * best indicator if the cookie looks like a proto */
+ if (eflag &&
+ EXTRACT_16BITS(&l2info.cookie) != PPP_OSI &&
+ EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
+ printf(", Bundle-ID %u: ",l2info.bundle);
+
+ p+=l2info.header_len;
+
+ switch (EXTRACT_16BITS(&l2info.cookie)) {
+ case PPP_OSI:
+ ppp_print(p-2,l2info.length+2);
+ break;
+ case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */
+ default:
+ ppp_print(p,l2info.length);
+ break;
+ }
+
+ return l2info.header_len;
+}
+
+
+u_int
+juniper_mfr_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ struct juniper_l2info_t l2info;
+
+ l2info.pictype = JUNIPER_MFR;
+ if(juniper_parse_header(p, h, &l2info) == 0)
+ return l2info.header_len;
+
+ p+=l2info.header_len;
+ /* suppress Bundle-ID if frame was captured on a child-link */
+ if (eflag && EXTRACT_32BITS(l2info.cookie) != 1) printf("Bundle-ID %u, ",l2info.bundle);
+ switch (l2info.proto) {
+ case (LLCSAP_ISONS<<8 | LLCSAP_ISONS):
+ isoclns_print(p+1, l2info.length-1, l2info.caplen-1);
+ break;
+ case (LLC_UI<<8 | NLPID_Q933):
+ case (LLC_UI<<8 | NLPID_IP):
+ case (LLC_UI<<8 | NLPID_IP6):
+ /* pass IP{4,6} to the OSI layer for proper link-layer printing */
+ isoclns_print(p-1, l2info.length+1, l2info.caplen+1);
+ break;
+ default:
+ printf("unknown protocol 0x%04x, length %u",l2info.proto, l2info.length);
+ }
+
+ return l2info.header_len;
+}
+
+u_int
+juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ struct juniper_l2info_t l2info;
+
+ l2info.pictype = JUNIPER_MLFR;
+ if(juniper_parse_header(p, h, &l2info) == 0)
+ return l2info.header_len;
+
+ p+=l2info.header_len;
+
+ /* suppress Bundle-ID if frame was captured on a child-link */
+ if (eflag && EXTRACT_32BITS(l2info.cookie) != 1) printf("Bundle-ID %u, ",l2info.bundle);
+ switch (l2info.proto) {
+ case (LLC_UI):
+ case (LLC_UI<<8):
+ isoclns_print(p, l2info.length, l2info.caplen);
+ break;
+ case (LLC_UI<<8 | NLPID_Q933):
+ case (LLC_UI<<8 | NLPID_IP):
+ case (LLC_UI<<8 | NLPID_IP6):
+ /* pass IP{4,6} to the OSI layer for proper link-layer printing */
+ isoclns_print(p-1, l2info.length+1, l2info.caplen+1);
+ break;
+ default:
+ printf("unknown protocol 0x%04x, length %u",l2info.proto, l2info.length);
+ }
+
+ return l2info.header_len;
+}