]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-fddi.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-fddi.c
index 22987d418eec81a24953fb6852315fb31343b7aa..ccdf588923658c0cede2352294a6bd48aa702a1c 100644 (file)
@@ -21,9 +21,7 @@
 
 /* \summary: Fiber Distributed Data Interface (FDDI) printer */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
 
 #include "netdissect-stdinc.h"
 
@@ -39,8 +37,8 @@
 
 struct fddi_header {
        nd_uint8_t  fddi_fc;            /* frame control */
-       nd_mac_addr fddi_dhost;
-       nd_mac_addr fddi_shost;
+       nd_mac48 fddi_dhost;
+       nd_mac48 fddi_shost;
 };
 
 /*
@@ -84,7 +82,7 @@ struct fddi_header {
 /*
  * Some FDDI interfaces use bit-swapped addresses.
  */
-#if defined(ultrix) || defined(__alpha) || defined(__bsdi) || defined(__NetBSD__) || defined(__linux__)
+#if defined(__alpha) || defined(__NetBSD__) || defined(__linux__)
 static int fddi_bitswap = 0;
 #else
 static int fddi_bitswap = 1;
@@ -158,7 +156,7 @@ static const u_char fddi_bit_swap[] = {
 /*
  * Print FDDI frame-control bits
  */
-static inline void
+static void
 print_fddi_fc(netdissect_options *ndo, u_char fc)
 {
        switch (fc) {
@@ -226,7 +224,7 @@ print_fddi_fc(netdissect_options *ndo, u_char fc)
 }
 
 /* Extract src, dst addresses */
-static inline void
+static void
 extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst)
 {
        int i;
@@ -240,8 +238,7 @@ extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst)
                        fdst[i] = fddi_bit_swap[fddip->fddi_dhost[i]];
                for (i = 0; i < 6; ++i)
                        fsrc[i] = fddi_bit_swap[fddip->fddi_shost[i]];
-       }
-       else {
+       } else {
                memcpy(fdst, (const char *)fddip->fddi_dhost, 6);
                memcpy(fsrc, (const char *)fddip->fddi_shost, 6);
        }
@@ -250,24 +247,24 @@ extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst)
 /*
  * Print the FDDI MAC header
  */
-static inline void
+static void
 fddi_hdr_print(netdissect_options *ndo,
                const struct fddi_header *fddip, u_int length,
                const u_char *fsrc, const u_char *fdst)
 {
        const char *srcname, *dstname;
 
-       srcname = etheraddr_string(ndo, fsrc);
-       dstname = etheraddr_string(ndo, fdst);
+       srcname = mac48_string(ndo, fsrc);
+       dstname = mac48_string(ndo, fdst);
 
        if (!ndo->ndo_qflag)
-               print_fddi_fc(ndo, EXTRACT_U_1(fddip->fddi_fc));
+               print_fddi_fc(ndo, GET_U_1(fddip->fddi_fc));
        ND_PRINT("%s > %s, length %u: ",
               srcname, dstname,
               length);
 }
 
-static inline void
+static void
 fddi_smt_print(netdissect_options *ndo, const u_char *p _U_, u_int length _U_)
 {
        ND_PRINT("<SMT printer not yet implemented>");
@@ -278,16 +275,17 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
 {
        const struct fddi_header *fddip = (const struct fddi_header *)p;
        uint8_t fc;
-       nd_mac_addr srcmac, dstmac;
+       nd_mac48 srcmac, dstmac;
        struct lladdr_info src, dst;
        int llc_hdrlen;
 
+       ndo->ndo_protocol = "fddi";
        if (caplen < FDDI_HDRLEN) {
-               ND_PRINT("[|fddi]");
+               nd_print_trunc(ndo);
                return (caplen);
        }
 
-       fc = EXTRACT_U_1(fddip->fddi_fc);
+       fc = GET_U_1(fddip->fddi_fc);
 
        /*
         * Get the FDDI addresses into a canonical form
@@ -298,9 +296,9 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
                fddi_hdr_print(ndo, fddip, length, srcmac, dstmac);
 
        src.addr = srcmac;
-       src.addr_string = etheraddr_string;
+       src.addr_string = mac48_string;
        dst.addr = dstmac;
-       dst.addr_string = etheraddr_string;
+       dst.addr_string = mac48_string;
 
        /* Skip over FDDI MAC header */
        length -= FDDI_HDRLEN;
@@ -341,8 +339,9 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 fddi_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
-       return (fddi_print(ndo, p, h->len, h->caplen));
+       ndo->ndo_protocol = "fddi";
+       ndo->ndo_ll_hdr_len += fddi_print(ndo, p, h->len, h->caplen);
 }