X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/d08b4abef4de825b3aecbb7c7e7601ac010806fc..9f957a5883cb4c5c99cefa71b42fc9d2d27d73e1:/print-lane.c diff --git a/print-lane.c b/print-lane.c index dd8aff0b..745c339c 100644 --- a/print-lane.c +++ b/print-lane.c @@ -20,28 +20,29 @@ * */ +/* \summary: ATM LANE printer */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include #include "netdissect.h" #include "extract.h" -#include "ether.h" struct lecdatahdr_8023 { - u_int16_t le_header; - u_int8_t h_dest[ETHER_ADDR_LEN]; - u_int8_t h_source[ETHER_ADDR_LEN]; - u_int16_t h_type; + nd_uint16_t le_header; + nd_mac_addr h_dest; + nd_mac_addr h_source; + nd_uint16_t h_type; }; struct lane_controlhdr { - u_int16_t lec_header; - u_int8_t lec_proto; - u_int8_t lec_vers; - u_int16_t lec_opcode; + nd_uint16_t lec_header; + nd_uint8_t lec_proto; + nd_uint8_t lec_vers; + nd_uint16_t lec_opcode; }; static const struct tok lecop2str[] = { @@ -67,7 +68,7 @@ static const struct tok lecop2str[] = { static void lane_hdr_print(netdissect_options *ndo, const u_char *bp) { - (void)ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, "lecid:%x ", EXTRACT_BE_U_2(bp))); } /* @@ -81,21 +82,22 @@ lane_hdr_print(netdissect_options *ndo, const u_char *bp) void lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) { - struct lane_controlhdr *lec; + const struct lane_controlhdr *lec; if (caplen < sizeof(struct lane_controlhdr)) { ND_PRINT((ndo, "[|lane]")); return; } - lec = (struct lane_controlhdr *)p; - if (EXTRACT_16BITS(&lec->lec_header) == 0xff00) { + lec = (const struct lane_controlhdr *)p; + if (EXTRACT_BE_U_2(lec->lec_header) == 0xff00) { /* * LE Control. */ ND_PRINT((ndo, "lec: proto %x vers %x %s", - lec->lec_proto, lec->lec_vers, - tok2str(lecop2str, "opcode-#%u", EXTRACT_16BITS(&lec->lec_opcode)))); + EXTRACT_U_1(lec->lec_proto), + EXTRACT_U_1(lec->lec_vers), + tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_U_2(lec->lec_opcode)))); return; }