]> The Tcpdump Group git mirrors - tcpdump/commitdiff
moved ieee802.15.4 to NDO system
authorMichael Richardson <[email protected]>
Thu, 13 May 2010 18:30:59 +0000 (14:30 -0400)
committerMichael Richardson <[email protected]>
Thu, 13 May 2010 18:30:59 +0000 (14:30 -0400)
interface.h
netdissect.h
print-802_15_4.c
tcpdump.c

index c301e37d8f4f205f2ef58cd33eebab95b77dd788..6e04b058c21c83579071d983f1cf7f376a6fc7ad 100644 (file)
@@ -273,7 +273,6 @@ extern u_int juniper_ppp_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
-extern u_int ieee802_15_4_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void snmp_print(const u_char *, u_int);
 extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
 extern u_int symantec_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void snmp_print(const u_char *, u_int);
 extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
 extern u_int symantec_if_print(const struct pcap_pkthdr *, const u_char *);
index e87941daf180af4387241a6c4b1032a1f3e3c9ce..757cd7bf6acb7d3d462b5d374747b99e016c4c0a 100644 (file)
@@ -433,6 +433,7 @@ extern void pptp_print(netdissect_options *,const u_char *, u_int);
 #endif
 
 extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 #endif
 
 extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
+extern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 
 #if 0
 #ifdef INET6
 
 #if 0
 #ifdef INET6
index a5364124338b5b8e4928993fd07b0f4f7d68bb35..6fe00d882fc0112cdbc40907f19c79970eab6d9e 100644 (file)
@@ -87,7 +87,8 @@ extract_header_length(u_int16_t fc)
 
 
 u_int
 
 
 u_int
-ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
+ieee802_15_4_if_print(struct netdissect_options *ndo,
+                      const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
        u_int hdrlen;
 {
        u_int caplen = h->caplen;
        u_int hdrlen;
@@ -95,7 +96,7 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
        u_int8_t seq;
 
        if (caplen < 3) {
        u_int8_t seq;
 
        if (caplen < 3) {
-               printf("[|802.15.4] %x", caplen);
+               ND_PRINT((ndo, "[|802.15.4] %x", caplen));
                return caplen;
        }
 
                return caplen;
        }
 
@@ -107,11 +108,11 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
        p += 3;
        caplen -= 3;
 
        p += 3;
        caplen -= 3;
 
-       printf("IEEE 802.15.4 %s packet ", ftypes[fc & 0x7]);
+       ND_PRINT((ndo,"IEEE 802.15.4 %s packet ", ftypes[fc & 0x7]));
        if (vflag)
        if (vflag)
-               printf("seq %02x ", seq);
+               ND_PRINT((ndo,"seq %02x ", seq));
        if (hdrlen == -1) {
        if (hdrlen == -1) {
-               printf("malformed! ");
+               ND_PRINT((ndo,"malformed! "));
                return caplen;
        }
 
                return caplen;
        }
 
@@ -124,33 +125,33 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
 
                switch ((fc >> 10) & 0x3) {
                case 0x00:
 
                switch ((fc >> 10) & 0x3) {
                case 0x00:
-                       printf("none ");
+                       ND_PRINT((ndo,"none "));
                        break;
                case 0x02:
                        panid = EXTRACT_LE_16BITS(p);
                        p += 2;
                        break;
                case 0x02:
                        panid = EXTRACT_LE_16BITS(p);
                        p += 2;
-                       printf("%04x:%04x ", panid, EXTRACT_LE_16BITS(p));
+                       ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
                        p += 2;
                        break;
                case 0x03:
                        panid = EXTRACT_LE_16BITS(p);
                        p += 2;
                        p += 2;
                        break;
                case 0x03:
                        panid = EXTRACT_LE_16BITS(p);
                        p += 2;
-                       printf("%04x:%s ", panid, le64addr_string(p));
+                       ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p)));
                        p += 8;
                        break;
                }
                        p += 8;
                        break;
                }
-               printf("< ");
+               ND_PRINT((ndo,"< ");
 
                switch ((fc >> 14) & 0x3) {
                case 0x00:
 
                switch ((fc >> 14) & 0x3) {
                case 0x00:
-                       printf("none ");
+                       ND_PRINT((ndo,"none "));
                        break;
                case 0x02:
                        if (!(fc & (1 << 6))) {
                                panid = EXTRACT_LE_16BITS(p);
                                p += 2;
                        }
                        break;
                case 0x02:
                        if (!(fc & (1 << 6))) {
                                panid = EXTRACT_LE_16BITS(p);
                                p += 2;
                        }
-                       printf("%04x:%04x ", panid, EXTRACT_LE_16BITS(p));
+                       ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
                        p += 2;
                        break;
                case 0x03:
                        p += 2;
                        break;
                case 0x03:
@@ -158,7 +159,7 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
                                panid = EXTRACT_LE_16BITS(p);
                                p += 2;
                        }
                                panid = EXTRACT_LE_16BITS(p);
                                p += 2;
                        }
-                       printf("%04x:%s ", panid, le64addr_string(p));
+                        ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p))));
                        p += 8;
                        break;
                }
                        p += 8;
                        break;
                }
@@ -167,7 +168,7 @@ ieee802_15_4_if_print(const struct pcap_pkthdr *h, const u_char *p)
        }
 
        if (!suppress_default_print)
        }
 
        if (!suppress_default_print)
-               default_print(p, caplen);
+               (ndo->ndo_default_print)(ndo, p, caplen);
 
        return 0;
 }
 
        return 0;
 }
index c5f4bbeb878553aef3937b95ec0d50a422953336..da88d3837120501d8284ed2b1b446dddcc1ef93a 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -293,9 +293,6 @@ static struct printer printers[] = {
        { usb_linux_64_byte_print, DLT_USB_LINUX_MMAPPED},
 #endif /* DLT_USB_LINUX_MMAPPED */
 #endif /* HAVE_PCAP_USB_H */
        { usb_linux_64_byte_print, DLT_USB_LINUX_MMAPPED},
 #endif /* DLT_USB_LINUX_MMAPPED */
 #endif /* HAVE_PCAP_USB_H */
-#ifdef DLT_IEEE802_15_4
-       { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
-#endif
 #ifdef DLT_IPV4
        { raw_if_print,         DLT_IPV4 },
 #endif
 #ifdef DLT_IPV4
        { raw_if_print,         DLT_IPV4 },
 #endif
@@ -308,6 +305,9 @@ static struct printer printers[] = {
 static struct ndo_printer ndo_printers[] = {
 #ifdef DLT_IPNET
        { ipnet_if_print,       DLT_IPNET },
 static struct ndo_printer ndo_printers[] = {
 #ifdef DLT_IPNET
        { ipnet_if_print,       DLT_IPNET },
+#endif
+#ifdef DLT_IEEE802_15_4
+       { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
 #endif
        { NULL,                 0 },
 };
 #endif
        { NULL,                 0 },
 };