]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-802_15_4.c
Default to first interface from pcap_findalldevs()
[tcpdump] / print-802_15_4.c
index ee66832fcf8ec4b301dfbcc4aed74478b6cecff7..4a1ef49b7fd03da999c43bf50ec03a3d7c43f301 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 
 #include "extract.h"
@@ -44,7 +43,7 @@ static const char *ftypes[] = {
 };
 
 static int
-extract_header_length(u_int16_t fc)
+extract_header_length(uint16_t fc)
 {
        int len = 0;
 
@@ -87,13 +86,13 @@ extract_header_length(u_int16_t fc)
 
 
 u_int
-ieee802_15_4_if_print(struct netdissect_options *ndo,
+ieee802_15_4_if_print(netdissect_options *ndo,
                       const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
        int hdrlen;
-       u_int16_t fc;
-       u_int8_t seq;
+       uint16_t fc;
+       uint8_t seq;
 
        if (caplen < 3) {
                ND_PRINT((ndo, "[|802.15.4] %x", caplen));
@@ -112,7 +111,7 @@ ieee802_15_4_if_print(struct netdissect_options *ndo,
        if (ndo->ndo_vflag)
                ND_PRINT((ndo,"seq %02x ", seq));
        if (hdrlen == -1) {
-               ND_PRINT((ndo,"malformed! "));
+               ND_PRINT((ndo,"invalid! "));
                return caplen;
        }
 
@@ -121,7 +120,7 @@ ieee802_15_4_if_print(struct netdissect_options *ndo,
                p+= hdrlen;
                caplen -= hdrlen;
        } else {
-               u_int16_t panid = 0;
+               uint16_t panid = 0;
 
                switch ((fc >> 10) & 0x3) {
                case 0x00:
@@ -139,11 +138,11 @@ ieee802_15_4_if_print(struct netdissect_options *ndo,
                case 0x03:
                        panid = EXTRACT_LE_16BITS(p);
                        p += 2;
-                       ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p)));
+                       ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(ndo, p)));
                        p += 8;
                        break;
                }
-               ND_PRINT((ndo,"< ");
+               ND_PRINT((ndo,"< "));
 
                switch ((fc >> 14) & 0x3) {
                case 0x00:
@@ -165,7 +164,7 @@ ieee802_15_4_if_print(struct netdissect_options *ndo,
                                panid = EXTRACT_LE_16BITS(p);
                                p += 2;
                        }
-                        ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(p))));
+                        ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(ndo, p)));
                        p += 8;
                        break;
                }
@@ -174,7 +173,7 @@ ieee802_15_4_if_print(struct netdissect_options *ndo,
        }
 
        if (!ndo->ndo_suppress_default_print)
-               (ndo->ndo_default_print)(ndo, p, caplen);
+               ND_DEFAULTPRINT(p, caplen);
 
        return 0;
 }