X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1cde6435df23876fb88998e38739def0dc7dca47..ff3d0e6578ff53fa34837353ebb6738b10d69dd4:/print-lmp.c diff --git a/print-lmp.c b/print-lmp.c index 396ce48b..53e62d18 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -17,14 +17,13 @@ * by Manu Pathak (mapathak@cisco.com), May 2005 */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include -#include "interface.h" +#include "netdissect.h" #include "extract.h" #include "addrtoname.h" #include "gmpls.h" @@ -42,11 +41,11 @@ */ struct lmp_common_header { - u_int8_t version_res[2]; - u_int8_t flags; - u_int8_t msg_type; - u_int8_t length[2]; - u_int8_t reserved[2]; + uint8_t version_res[2]; + uint8_t flags; + uint8_t msg_type; + uint8_t length[2]; + uint8_t reserved[2]; }; #define LMP_VERSION 1 @@ -212,9 +211,9 @@ static const struct tok lmp_msg_type_values[] = { */ struct lmp_object_header { - u_int8_t ctype; - u_int8_t class_num; - u_int8_t length[2]; + uint8_t ctype; + uint8_t class_num; + uint8_t length[2]; }; #define LMP_OBJ_CC_ID 1 @@ -354,8 +353,8 @@ static const struct tok lmp_ctype_values[] = { void lmp_print(netdissect_options *ndo, - register const u_char *pptr, register u_int len) { - + register const u_char *pptr, register u_int len) +{ const struct lmp_common_header *lmp_com_header; const struct lmp_object_header *lmp_obj_header; const u_char *tptr,*obj_tptr; @@ -366,7 +365,7 @@ lmp_print(netdissect_options *ndo, union { /* int to float conversion buffer */ float f; - u_int32_t i; + uint32_t i; } bw; tptr=pptr; @@ -406,8 +405,7 @@ lmp_print(netdissect_options *ndo, while(tlen>0) { /* did we capture enough for fully decoding the object header ? */ - if (!ND_TTEST2(*tptr, sizeof(struct lmp_object_header))) - goto trunc; + ND_TCHECK2(*tptr, sizeof(struct lmp_object_header)); lmp_obj_header = (const struct lmp_object_header *)tptr; lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length); @@ -432,8 +430,7 @@ lmp_print(netdissect_options *ndo, obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header); /* did we capture enough for fully decoding the object ? */ - if (!ND_TTEST2(*tptr, lmp_obj_len)) - goto trunc; + ND_TCHECK2(*tptr, lmp_obj_len); hexdump=FALSE; switch(lmp_obj_header->class_num) {