]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IEEE 802.15.4: Refactor with two functions
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 16 Mar 2018 15:55:30 +0000 (16:55 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 16 Mar 2018 15:55:30 +0000 (16:55 +0100)
print-802_15_4.c

index a5aa291ca77cf971aca13277869806cba2adee96..17d0ded746f3e65577487a76766a0a6b50e78d75 100644 (file)
@@ -61,11 +61,10 @@ static const char *ftypes[] = {
 #define FC_ADDRESSING_MODE_SHORT       0x02
 #define FC_ADDRESSING_MODE_LONG                0x03
 
-u_int
-ieee802_15_4_if_print(netdissect_options *ndo,
-                      const struct pcap_pkthdr *h, const u_char *p)
+static u_int
+ieee802_15_4_print(netdissect_options *ndo,
+                   const u_char *p, u_int caplen)
 {
-       u_int caplen = h->caplen;
        u_int hdrlen;
        uint16_t fc;
        uint8_t seq;
@@ -221,3 +220,11 @@ ieee802_15_4_if_print(netdissect_options *ndo,
 
        return hdrlen;
 }
+
+/* For DLT_IEEE802_15_4 and DLT_IEEE802_15_4_NOFCS */
+u_int
+ieee802_15_4_if_print(netdissect_options *ndo,
+                      const struct pcap_pkthdr *h, const u_char *p)
+{
+       return ieee802_15_4_print(ndo, p, h->caplen);
+}