X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/62a5184ed49a1735c903c1556a30d938e8463f57..refs/pull/482/head:/print-forces.c diff --git a/print-forces.c b/print-forces.c index 3a12d03f..40789611 100644 --- a/print-forces.c +++ b/print-forces.c @@ -14,21 +14,20 @@ * */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include -#include "interface.h" +#include "netdissect.h" #include "extract.h" static const char tstr[] = "[|forces]"; /* - * Per draft-ietf-forces-protocol-22 -*/ + * RFC5810: Forwarding and Control Element Separation (ForCES) Protocol + */ #define ForCES_VERS 1 #define ForCES_HDRL 24 #define ForCES_ALNL 4U @@ -62,12 +61,12 @@ static const char tstr[] = "[|forces]"; #define TTLV_T2 (ONE_MORE_TTLV|MAX_TLV) struct tom_h { - u_int32_t v; - u_int16_t flags; - u_int16_t op_msk; + uint32_t v; + uint16_t flags; + uint16_t op_msk; const char *s; int (*print) (netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); }; enum { @@ -86,7 +85,7 @@ enum { }; #define TOM_MAX_IND (_TOM_RSV_MAX - 1) -static inline int tom_valid(u_int8_t tom) +static inline int tom_valid(uint8_t tom) { if (tom > 0) { if (tom >= 0x7 && tom <= 0xe) @@ -100,7 +99,7 @@ static inline int tom_valid(u_int8_t tom) return 0; } -static inline const char *ForCES_node(u_int32_t node) +static inline const char *ForCES_node(uint32_t node) { if (node <= 0x3FFFFFFF) return "FE"; @@ -153,17 +152,17 @@ static const struct tok ForCES_TPs[] = { * Structure of forces header, naked of TLVs. */ struct forcesh { - u_int8_t fm_vrsvd; /* version and reserved */ + uint8_t fm_vrsvd; /* version and reserved */ #define ForCES_V(forcesh) ((forcesh)->fm_vrsvd >> 4) - u_int8_t fm_tom; /* type of message */ - u_int16_t fm_len; /* total length * 4 bytes */ -#define ForCES_BLN(forcesh) ((u_int32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2)) - u_int32_t fm_sid; /* Source ID */ + uint8_t fm_tom; /* type of message */ + uint16_t fm_len; /* total length * 4 bytes */ +#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2)) + uint32_t fm_sid; /* Source ID */ #define ForCES_SID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_sid) - u_int32_t fm_did; /* Destination ID */ + uint32_t fm_did; /* Destination ID */ #define ForCES_DID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_did) - u_int8_t fm_cor[8]; /* correlator */ - u_int32_t fm_flags; /* flags */ + uint8_t fm_cor[8]; /* correlator */ + uint32_t fm_flags; /* flags */ #define ForCES_ACK(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30) #define ForCES_PRI(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27) #define ForCES_RS1(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24) @@ -187,26 +186,28 @@ static const struct tok ForCES_LFBs[] = { {0, NULL} }; +/* this is defined in RFC5810 section A.2 */ +/* http://www.iana.org/assignments/forces/forces.xhtml#oper-tlv-types */ enum { - F_OP_RSV, - F_OP_SET, - F_OP_SETPROP, - F_OP_SETRESP, - F_OP_SETPRESP, - F_OP_DEL, - F_OP_DELRESP, - F_OP_GET, - F_OP_GETPROP, - F_OP_GETRESP, - F_OP_GETPRESP, - F_OP_REPORT, - F_OP_COMMIT, - F_OP_RCOMMIT, - F_OP_RTRCOMP, + F_OP_RSV = 0, + F_OP_SET = 1, + F_OP_SETPROP = 2, + F_OP_SETRESP = 3, + F_OP_SETPRESP = 4, + F_OP_DEL = 5, + F_OP_DELRESP = 6, + F_OP_GET = 7, + F_OP_GETPROP = 8, + F_OP_GETRESP = 9, + F_OP_GETPRESP = 10, + F_OP_REPORT = 11, + F_OP_COMMIT = 12, + F_OP_RCOMMIT = 13, + F_OP_RTRCOMP = 14, _F_OP_MAX }; - #define F_OP_MAX (_F_OP_MAX - 1) + enum { B_OP_SET = 1 << (F_OP_SET - 1), B_OP_SETPROP = 1 << (F_OP_SETPROP - 1), @@ -221,28 +222,28 @@ enum { B_OP_REPORT = 1 << (F_OP_REPORT - 1), B_OP_COMMIT = 1 << (F_OP_COMMIT - 1), B_OP_RCOMMIT = 1 << (F_OP_RCOMMIT - 1), - B_OP_RTRCOMP = 1 << (F_OP_RTRCOMP - 1), + B_OP_RTRCOMP = 1 << (F_OP_RTRCOMP - 1) }; struct optlv_h { - u_int16_t flags; - u_int16_t op_msk; + uint16_t flags; + uint16_t op_msk; const char *s; int (*print) (netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); }; static int genoptlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int recpdoptlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int invoptlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); #define OP_MIN_SIZ 8 struct pathdata_h { - u_int16_t pflags; - u_int16_t pIDcnt; + uint16_t pflags; + uint16_t pIDcnt; }; #define B_FULLD 0x1 @@ -274,7 +275,7 @@ static const struct optlv_h OPTLV_msg[F_OP_MAX + 1] = { /* F_OP_RTRCOMP */ {ZERO_TTLV, 0, " RTRCOMP", NULL}, }; -static inline const struct optlv_h *get_forces_optlv_h(u_int16_t opt) +static inline const struct optlv_h *get_forces_optlv_h(uint16_t opt) { if (opt > F_OP_MAX || opt <= F_OP_RSV) return &OPTLV_msg[F_OP_RSV]; @@ -309,7 +310,7 @@ static inline char *indent_pr(int indent, int nlpref) return r; } -static inline int op_valid(u_int16_t op, u_int16_t mask) +static inline int op_valid(uint16_t op, uint16_t mask) { int opb = 1 << (op - 1); @@ -357,7 +358,7 @@ static const struct tok ForCES_TLV[] = { }; #define TLV_HLN 4 -static inline int ttlv_valid(u_int16_t ttlv) +static inline int ttlv_valid(uint16_t ttlv) { if (ttlv > 0) { if (ttlv == 1 || ttlv == 0x1000) @@ -374,30 +375,30 @@ static inline int ttlv_valid(u_int16_t ttlv) } struct forces_ilv { - u_int32_t type; - u_int32_t length; + uint32_t type; + uint32_t length; }; struct forces_tlv { - u_int16_t type; - u_int16_t length; + uint16_t type; + uint16_t length; }; #define F_ALN_LEN(len) ( ((len)+ForCES_ALNL-1) & ~(ForCES_ALNL-1) ) -#define GET_TOP_TLV(fhdr) ((struct forces_tlv *)((fhdr) + sizeof (struct forcesh))) +#define GET_TOP_TLV(fhdr) ((const struct forces_tlv *)((fhdr) + sizeof (struct forcesh))) #define TLV_SET_LEN(len) (F_ALN_LEN(TLV_HDRL) + (len)) #define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len)) #define TLV_RDAT_LEN(tlv) ((int)(EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0)) -#define TLV_DATA(tlvp) ((void*)(((char*)(tlvp)) + TLV_SET_LEN(0))) +#define TLV_DATA(tlvp) ((const void*)(((const char*)(tlvp)) + TLV_SET_LEN(0))) #define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)), \ - (struct forces_tlv*)(((char*)(tlv)) \ + (const struct forces_tlv*)(((const char*)(tlv)) \ + F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)))) #define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len)) #define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len)) #define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_32BITS(&(ilv)->length)) - ILV_SET_LEN(0)) -#define ILV_DATA(ilvp) ((void*)(((char*)(ilvp)) + ILV_SET_LEN(0))) +#define ILV_DATA(ilvp) ((const void*)(((const char*)(ilvp)) + ILV_SET_LEN(0))) #define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)), \ - (struct forces_ilv *)(((char*)(ilv)) \ + (const struct forces_ilv *)(((const char*)(ilv)) \ + F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)))) #define INVALID_RLEN 1 #define INVALID_STLN 2 @@ -441,17 +442,17 @@ static inline int ilv_valid(const struct forces_ilv *ilv, u_int rlen) } static int lfbselect_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int redirect_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int asrtlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int asttlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); struct forces_lfbsh { - u_int32_t class; - u_int32_t instance; + uint32_t class; + uint32_t instance; }; #define ASSNS_OPS (B_OP_REPORT) @@ -482,7 +483,7 @@ static const struct tom_h ForCES_msg[TOM_MAX_IND + 1] = { {TOM_QUERYREP, TTLV_T2, CFG_QYR, "Query Response", lfbselect_print}, }; -static inline const struct tom_h *get_forces_tom(u_int8_t tom) +static inline const struct tom_h *get_forces_tom(uint8_t tom) { int i; for (i = TOM_RSV_I; i <= TOM_MAX_IND; i++) { @@ -494,12 +495,12 @@ static inline const struct tom_h *get_forces_tom(u_int8_t tom) } struct pdata_ops { - u_int32_t v; - u_int16_t flags; - u_int16_t op_msk; + uint32_t v; + uint16_t flags; + uint16_t op_msk; const char *s; int (*print) (netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); }; enum { @@ -513,7 +514,7 @@ enum { }; #define PD_MAX_IND (_TOM_RSV_MAX - 1) -static inline int pd_valid(u_int16_t pd) +static inline int pd_valid(uint16_t pd) { if (pd >= F_TLV_PDAT && pd <= F_TLV_REST) return 1; @@ -522,7 +523,7 @@ static inline int pd_valid(u_int16_t pd) static inline void chk_op_type(netdissect_options *ndo, - u_int16_t type, u_int16_t msk, u_int16_t omsk) + uint16_t type, uint16_t msk, uint16_t omsk) { if (type != F_TLV_PDAT) { if (msk & B_KEYIN) { @@ -544,19 +545,19 @@ chk_op_type(netdissect_options *ndo, #define F_TABAPPEND 4 struct res_val { - u_int8_t result; - u_int8_t resv1; - u_int16_t resv2; + uint8_t result; + uint8_t resv1; + uint16_t resv2; }; static int prestlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int pkeyitlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int fdatatlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static int sdatatlv_print(netdissect_options *, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent); + uint16_t op_msk, int indent); static const struct pdata_ops ForCES_pdata[PD_MAX_IND + 1] = { /* PD_RSV_I */ {0, 0, 0, "Invalid message", NULL}, @@ -568,7 +569,7 @@ static const struct pdata_ops ForCES_pdata[PD_MAX_IND + 1] = { {F_TLV_PDAT, 0, 0, "Inner PATH-DATA TLV", recpdoptlv_print}, }; -static inline const struct pdata_ops *get_forces_pd(u_int16_t pd) +static inline const struct pdata_ops *get_forces_pd(uint16_t pd) { int i; for (i = PD_RSV_I + 1; i <= PD_MAX_IND; i++) { @@ -642,11 +643,11 @@ static const struct tok ForCES_errs[] = { static int prestlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { - const struct forces_tlv *tlv = (struct forces_tlv *)pptr; - register const u_char *tdp = (u_char *) TLV_DATA(tlv); - struct res_val *r = (struct res_val *)tdp; + const struct forces_tlv *tlv = (const struct forces_tlv *)pptr; + register const u_char *tdp = (const u_char *) TLV_DATA(tlv); + const struct res_val *r = (const struct res_val *)tdp; u_int dlen; /* @@ -680,12 +681,12 @@ trunc: static int fdatatlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { - const struct forces_tlv *tlv = (struct forces_tlv *)pptr; + const struct forces_tlv *tlv = (const struct forces_tlv *)pptr; u_int rlen; - register const u_char *tdp = (u_char *) TLV_DATA(tlv); - u_int16_t type; + register const u_char *tdp = (const u_char *) TLV_DATA(tlv); + uint16_t type; /* * pdatacnt_print() or pkeyitlv_print() has ensured that len @@ -715,10 +716,10 @@ trunc: static int sdatailv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { u_int rlen; - const struct forces_ilv *ilv = (struct forces_ilv *)pptr; + const struct forces_ilv *ilv = (const struct forces_ilv *)pptr; int invilv; if (len < ILV_HDRL) { @@ -732,7 +733,7 @@ sdatailv_print(netdissect_options *ndo, ND_PRINT((ndo, "Jamal - outstanding length <%d>\n", rlen)); #endif char *ib = indent_pr(indent, 1); - register const u_char *tdp = (u_char *) ILV_DATA(ilv); + register const u_char *tdp = (const u_char *) ILV_DATA(ilv); ND_TCHECK(*ilv); invilv = ilv_valid(ilv, rlen); if (invilv) { @@ -761,12 +762,12 @@ trunc: static int sdatatlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent) + uint16_t op_msk, int indent) { - const struct forces_tlv *tlv = (struct forces_tlv *)pptr; + const struct forces_tlv *tlv = (const struct forces_tlv *)pptr; u_int rlen; - register const u_char *tdp = (u_char *) TLV_DATA(tlv); - u_int16_t type; + register const u_char *tdp = (const u_char *) TLV_DATA(tlv); + uint16_t type; /* * pdatacnt_print() has ensured that len (the TLV length) @@ -790,15 +791,15 @@ trunc: static int pkeyitlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent) + uint16_t op_msk, int indent) { - const struct forces_tlv *tlv = (struct forces_tlv *)pptr; - register const u_char *tdp = (u_char *) TLV_DATA(tlv); + const struct forces_tlv *tlv = (const struct forces_tlv *)pptr; + register const u_char *tdp = (const u_char *) TLV_DATA(tlv); register const u_char *dp = tdp + 4; - const struct forces_tlv *kdtlv = (struct forces_tlv *)dp; - u_int32_t id; + const struct forces_tlv *kdtlv = (const struct forces_tlv *)dp; + uint32_t id; char *ib = indent_pr(indent, 0); - u_int16_t type, tll; + uint16_t type, tll; u_int invtlv; ND_TCHECK(*tdp); @@ -820,7 +821,7 @@ pkeyitlv_print(netdissect_options *ndo, * go past the end of the containing TLV). */ tll = EXTRACT_16BITS(&kdtlv->length); - dp = (u_char *) TLV_DATA(kdtlv); + dp = (const u_char *) TLV_DATA(kdtlv); return fdatatlv_print(ndo, dp, tll, op_msk, indent); trunc: @@ -833,10 +834,10 @@ trunc: static int pdatacnt_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t IDcnt, u_int16_t op_msk, int indent) + uint16_t IDcnt, uint16_t op_msk, int indent) { u_int i; - u_int32_t id; + uint32_t id; char *ib = indent_pr(indent, 0); if ((op_msk & B_APPND) && ndo->ndo_vflag >= 3) { @@ -855,7 +856,7 @@ pdatacnt_print(netdissect_options *ndo, if ((op_msk & B_TRNG) || (op_msk & B_KEYIN)) { if (op_msk & B_TRNG) { - u_int32_t starti, endi; + uint32_t starti, endi; if (len < PTH_DESC_SIZE) { ND_PRINT((ndo, "pathlength %d with key/range too short %d\n", @@ -879,8 +880,8 @@ pdatacnt_print(netdissect_options *ndo, } if (op_msk & B_KEYIN) { - struct forces_tlv *keytlv; - u_int16_t tll; + const struct forces_tlv *keytlv; + uint16_t tll; if (len < PTH_DESC_SIZE) { ND_PRINT((ndo, "pathlength %d with key/range too short %d\n", @@ -891,7 +892,7 @@ pdatacnt_print(netdissect_options *ndo, /* skip keyid */ pptr += 4; len -= 4; - keytlv = (struct forces_tlv *)pptr; + keytlv = (const struct forces_tlv *)pptr; /* skip header */ pptr += sizeof(struct forces_tlv); len -= sizeof(struct forces_tlv); @@ -914,9 +915,9 @@ pdatacnt_print(netdissect_options *ndo, } if (len) { - const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr; - u_int16_t type; - u_int16_t tll; + const struct forces_tlv *pdtlv = (const struct forces_tlv *)pptr; + uint16_t type; + uint16_t tll; int pad = 0; u_int aln; u_int invtlv; @@ -988,13 +989,13 @@ trunc: static int pdata_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent) + uint16_t op_msk, int indent) { - const struct pathdata_h *pdh = (struct pathdata_h *)pptr; + const struct pathdata_h *pdh = (const struct pathdata_h *)pptr; char *ib = indent_pr(indent, 0); u_int minsize = 0; int more_pd = 0; - u_int16_t idcnt = 0; + uint16_t idcnt = 0; ND_TCHECK(*pdh); if (len < sizeof(struct pathdata_h)) @@ -1052,10 +1053,10 @@ trunc: static int genoptlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent) + uint16_t op_msk, int indent) { - const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr; - u_int16_t type; + const struct forces_tlv *pdtlv = (const struct forces_tlv *)pptr; + uint16_t type; int tll; u_int invtlv; char *ib = indent_pr(indent, 0); @@ -1072,7 +1073,7 @@ genoptlv_print(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the containing TLV). */ - register const u_char *dp = (u_char *) TLV_DATA(pdtlv); + register const u_char *dp = (const u_char *) TLV_DATA(pdtlv); if (!ttlv_valid(type)) { ND_PRINT((ndo, "%s TLV type 0x%x len %d\n", tok2str(ForCES_TLV_err, NULL, invtlv), type, @@ -1098,12 +1099,12 @@ trunc: static int recpdoptlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent) + uint16_t op_msk, int indent) { - const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr; + const struct forces_tlv *pdtlv = (const struct forces_tlv *)pptr; int tll; u_int invtlv; - u_int16_t type; + uint16_t type; register const u_char *dp; char *ib; @@ -1121,7 +1122,7 @@ recpdoptlv_print(netdissect_options *ndo, */ ib = indent_pr(indent, 0); type = EXTRACT_16BITS(&pdtlv->type); - dp = (u_char *) TLV_DATA(pdtlv); + dp = (const u_char *) TLV_DATA(pdtlv); tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL; if (ndo->ndo_vflag >= 3) @@ -1152,7 +1153,7 @@ trunc: static int invoptlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { char *ib = indent_pr(indent, 1); @@ -1166,11 +1167,11 @@ invoptlv_print(netdissect_options *ndo, static int otlv_print(netdissect_options *ndo, - const struct forces_tlv *otlv, u_int16_t op_msk _U_, int indent) + const struct forces_tlv *otlv, uint16_t op_msk _U_, int indent) { int rc = 0; - register const u_char *dp = (u_char *) TLV_DATA(otlv); - u_int16_t type; + register const u_char *dp = (const u_char *) TLV_DATA(otlv); + uint16_t type; int tll; char *ib = indent_pr(indent, 0); const struct optlv_h *ops; @@ -1187,12 +1188,6 @@ otlv_print(netdissect_options *ndo, ND_PRINT((ndo, "%sOper TLV %s(0x%x) length %d\n", ib, ops->s, type, EXTRACT_16BITS(&otlv->length))); } - /* empty TLVs like COMMIT and TRCOMMIT are empty, we stop here .. */ - if (!ops->flags & ZERO_TTLV) { - if (tll != 0) /* instead of "if (tll)" - for readability .. */ - ND_PRINT((ndo, "%s: Illegal - MUST be empty\n", ops->s)); - return rc; - } /* rest of ops must at least have 12B {pathinfo} */ if (tll < OP_MIN_SIZ) { ND_PRINT((ndo, "\t\tOper TLV %s(0x%x) length %d\n", ops->s, type, @@ -1203,7 +1198,10 @@ otlv_print(netdissect_options *ndo, } - rc = ops->print(ndo, dp, tll, ops->op_msk, indent + 1); + /* XXX - do anything with ops->flags? */ + if(ops->print) { + rc = ops->print(ndo, dp, tll, ops->op_msk, indent + 1); + } return rc; trunc: @@ -1216,9 +1214,9 @@ trunc: static int asttlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { - u_int32_t rescode; + uint32_t rescode; u_int dlen; char *ib = indent_pr(indent, 0); @@ -1274,9 +1272,9 @@ trunc: static int asrtlv_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { - u_int32_t rescode; + uint32_t rescode; u_int dlen; char *ib = indent_pr(indent, 0); @@ -1329,7 +1327,7 @@ trunc: static int gentltlv_print(netdissect_options *ndo, register const u_char * pptr _U_, register u_int len, - u_int16_t op_msk _U_, int indent _U_) + uint16_t op_msk _U_, int indent _U_) { u_int dlen = len - TLV_HDRL; @@ -1345,12 +1343,12 @@ gentltlv_print(netdissect_options *ndo, static int print_metailv(netdissect_options *ndo, - register const u_char * pptr, u_int16_t op_msk _U_, int indent) + register const u_char * pptr, uint16_t op_msk _U_, int indent) { u_int rlen; char *ib = indent_pr(indent, 0); /* XXX: check header length */ - const struct forces_ilv *ilv = (struct forces_ilv *)pptr; + const struct forces_ilv *ilv = (const struct forces_ilv *)pptr; /* * print_metatlv() has ensured that len (what remains in the @@ -1374,12 +1372,12 @@ trunc: static int print_metatlv(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { u_int dlen; char *ib = indent_pr(indent, 0); u_int rlen; - const struct forces_ilv *ilv = (struct forces_ilv *)pptr; + const struct forces_ilv *ilv = (const struct forces_ilv *)pptr; int invilv; /* @@ -1401,7 +1399,7 @@ print_metatlv(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the containing TLV). */ - print_metailv(ndo, (u_char *) ilv, 0, indent + 1); + print_metailv(ndo, (const u_char *) ilv, 0, indent + 1); ilv = GO_NXT_ILV(ilv, rlen); } @@ -1416,7 +1414,7 @@ trunc: static int print_reddata(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent _U_) + uint16_t op_msk _U_, int indent _U_) { u_int dlen; char *ib = indent_pr(indent, 0); @@ -1438,9 +1436,9 @@ print_reddata(netdissect_options *ndo, static int redirect_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk _U_, int indent) + uint16_t op_msk _U_, int indent) { - const struct forces_tlv *tlv = (struct forces_tlv *)pptr; + const struct forces_tlv *tlv = (const struct forces_tlv *)pptr; u_int dlen; u_int rlen; u_int invtlv; @@ -1472,10 +1470,10 @@ redirect_print(netdissect_options *ndo, * go past the end of the containing TLV). */ if (EXTRACT_16BITS(&tlv->type) == F_TLV_METD) { - print_metatlv(ndo, (u_char *) TLV_DATA(tlv), + print_metatlv(ndo, (const u_char *) TLV_DATA(tlv), EXTRACT_16BITS(&tlv->length), 0, indent); } else if ((EXTRACT_16BITS(&tlv->type) == F_TLV_REDD)) { - print_reddata(ndo, (u_char *) TLV_DATA(tlv), + print_reddata(ndo, (const u_char *) TLV_DATA(tlv), EXTRACT_16BITS(&tlv->length), 0, indent); } else { ND_PRINT((ndo, "Unknown REDIRECT TLV 0x%x len %d\n", @@ -1507,7 +1505,7 @@ trunc: static int lfbselect_print(netdissect_options *ndo, register const u_char * pptr, register u_int len, - u_int16_t op_msk, int indent) + uint16_t op_msk, int indent) { const struct forces_lfbsh *lfbs; const struct forces_tlv *otlv; @@ -1542,7 +1540,7 @@ lfbselect_print(netdissect_options *ndo, EXTRACT_32BITS(&lfbs->instance))); } - otlv = (struct forces_tlv *)(lfbs + 1); + otlv = (const struct forces_tlv *)(lfbs + 1); indent += 1; while (rlen != 0) { @@ -1564,7 +1562,7 @@ lfbselect_print(netdissect_options *ndo, ND_PRINT((ndo, "\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n", EXTRACT_16BITS(&otlv->type), EXTRACT_16BITS(&otlv->length))); - invoptlv_print(ndo, (u_char *)otlv, rlen, 0, indent); + invoptlv_print(ndo, (const u_char *)otlv, rlen, 0, indent); } otlv = GO_NXT_TLV(otlv, rlen); } @@ -1646,7 +1644,7 @@ forces_type_print(netdissect_options *ndo, EXTRACT_16BITS(&tltlv->length), EXTRACT_16BITS(&tltlv->length) - TLV_HDRL)); - rc = tops->print(ndo, (u_char *) TLV_DATA(tltlv), + rc = tops->print(ndo, (const u_char *) TLV_DATA(tltlv), EXTRACT_16BITS(&tltlv->length), tops->op_msk, 9); if (rc < 0) { return -1; @@ -1679,7 +1677,7 @@ forces_print(netdissect_options *ndo, { const struct forcesh *fhdr; u_int mlen; - u_int32_t flg_raw; + uint32_t flg_raw; const struct tom_h *tops; int rc = 0;