X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/5cea2703185c6af1616dc338c43c6cf67b0bec60..c39d40a767a1ae36171e5bcbf6f157ff3e80fb6c:/print-fddi.c diff --git a/print-fddi.c b/print-fddi.c index 0b85034a..fb8d3ed5 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -22,10 +22,10 @@ /* \summary: Fiber Distributed Data Interface (FDDI) printer */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include +#include "netdissect-stdinc.h" #include @@ -158,75 +158,75 @@ 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) { case FDDIFC_VOID: /* Void frame */ - ND_PRINT((ndo, "void ")); + ND_PRINT("void "); break; case FDDIFC_NRT: /* Nonrestricted token */ - ND_PRINT((ndo, "nrt ")); + ND_PRINT("nrt "); break; case FDDIFC_RT: /* Restricted token */ - ND_PRINT((ndo, "rt ")); + ND_PRINT("rt "); break; case FDDIFC_SMT_INFO: /* SMT Info */ - ND_PRINT((ndo, "info ")); + ND_PRINT("info "); break; case FDDIFC_SMT_NSA: /* SMT Next station adrs */ - ND_PRINT((ndo, "nsa ")); + ND_PRINT("nsa "); break; case FDDIFC_MAC_BEACON: /* MAC Beacon frame */ - ND_PRINT((ndo, "beacon ")); + ND_PRINT("beacon "); break; case FDDIFC_MAC_CLAIM: /* MAC Claim frame */ - ND_PRINT((ndo, "claim ")); + ND_PRINT("claim "); break; default: switch (fc & FDDIFC_CLFF) { case FDDIFC_MAC: - ND_PRINT((ndo, "mac%1x ", fc & FDDIFC_ZZZZ)); + ND_PRINT("mac%1x ", fc & FDDIFC_ZZZZ); break; case FDDIFC_SMT: - ND_PRINT((ndo, "smt%1x ", fc & FDDIFC_ZZZZ)); + ND_PRINT("smt%1x ", fc & FDDIFC_ZZZZ); break; case FDDIFC_LLC_ASYNC: - ND_PRINT((ndo, "async%1x ", fc & FDDIFC_ZZZZ)); + ND_PRINT("async%1x ", fc & FDDIFC_ZZZZ); break; case FDDIFC_LLC_SYNC: - ND_PRINT((ndo, "sync%1x ", fc & FDDIFC_ZZZZ)); + ND_PRINT("sync%1x ", fc & FDDIFC_ZZZZ); break; case FDDIFC_IMP_ASYNC: - ND_PRINT((ndo, "imp_async%1x ", fc & FDDIFC_ZZZZ)); + ND_PRINT("imp_async%1x ", fc & FDDIFC_ZZZZ); break; case FDDIFC_IMP_SYNC: - ND_PRINT((ndo, "imp_sync%1x ", fc & FDDIFC_ZZZZ)); + ND_PRINT("imp_sync%1x ", fc & FDDIFC_ZZZZ); break; default: - ND_PRINT((ndo, "%02x ", fc)); + ND_PRINT("%02x ", fc); break; } } } /* Extract src, dst addresses */ -static inline void +static void extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst) { int i; @@ -250,7 +250,7 @@ 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) @@ -261,16 +261,16 @@ fddi_hdr_print(netdissect_options *ndo, dstname = etheraddr_string(ndo, fdst); if (!ndo->ndo_qflag) - print_fddi_fc(ndo, EXTRACT_U_1(fddip->fddi_fc)); - ND_PRINT((ndo, "%s > %s, length %u: ", + print_fddi_fc(ndo, GET_U_1(fddip->fddi_fc)); + ND_PRINT("%s > %s, length %u: ", srcname, dstname, - length)); + length); } -static inline void +static void fddi_smt_print(netdissect_options *ndo, const u_char *p _U_, u_int length _U_) { - ND_PRINT((ndo, "")); + ND_PRINT(""); } u_int @@ -282,12 +282,13 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) struct lladdr_info src, dst; int llc_hdrlen; + ndo->ndo_protocol = "fddi"; if (caplen < FDDI_HDRLEN) { - ND_PRINT((ndo, "[|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 @@ -341,8 +342,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); }