X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fb2479d733dbe8a991d11909b319341f7db62ab1..a8abce5c5e2dce2ba6dbccd5d3829da104b80f9c:/print-forces.c diff --git a/print-forces.c b/print-forces.c index 726c2f83..072c9389 100644 --- a/print-forces.c +++ b/print-forces.c @@ -27,7 +27,6 @@ #include "netdissect.h" #include "extract.h" -static const char tstr[] = "[|forces]"; #define ForCES_VERS 1 #define ForCES_HDRL 24 @@ -86,7 +85,8 @@ enum { }; #define TOM_MAX_IND (_TOM_RSV_MAX - 1) -static inline int tom_valid(uint8_t tom) +static int +tom_valid(uint8_t tom) { if (tom > 0) { if (tom >= 0x7 && tom <= 0xe) @@ -100,7 +100,8 @@ static inline int tom_valid(uint8_t tom) return 0; } -static inline const char *ForCES_node(uint32_t node) +static const char * +ForCES_node(uint32_t node) { if (node <= 0x3FFFFFFF) return "FE"; @@ -276,7 +277,8 @@ 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(uint16_t opt) +static 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]; @@ -290,7 +292,8 @@ static inline const struct optlv_h *get_forces_optlv_h(uint16_t opt) #define IND_SUF 0x0 static char ind_buf[IND_SIZE]; -static inline char *indent_pr(int indent, int nlpref) +static char * +indent_pr(int indent, int nlpref) { int i = 0; char *r = ind_buf; @@ -311,7 +314,8 @@ static inline char *indent_pr(int indent, int nlpref) return r; } -static inline int op_valid(uint16_t op, uint16_t mask) +static int +op_valid(uint16_t op, uint16_t mask) { if (op == 0) return 0; @@ -357,7 +361,8 @@ static const struct tok ForCES_TLV[] = { }; #define TLV_HLN 4 -static inline int ttlv_valid(uint16_t ttlv) +static int +ttlv_valid(uint16_t ttlv) { if (ttlv > 0) { if (ttlv == 1 || ttlv == 0x1000) @@ -408,7 +413,8 @@ static const struct tok ForCES_TLV_err[] = { {0, NULL} }; -static inline u_int tlv_valid(u_int tlvl, u_int rlen) +static u_int +tlv_valid(u_int tlvl, u_int rlen) { if (rlen < TLV_HDRL) return INVALID_RLEN; @@ -422,7 +428,8 @@ static inline u_int tlv_valid(u_int tlvl, u_int rlen) return 0; } -static inline int ilv_valid(const struct forces_ilv *ilv, u_int rlen) +static int +ilv_valid(const struct forces_ilv *ilv, u_int rlen) { if (rlen < ILV_HDRL) return INVALID_RLEN; @@ -478,7 +485,8 @@ 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(uint8_t tom) +static const struct tom_h * +get_forces_tom(uint8_t tom) { int i; for (i = TOM_RSV_I; i <= TOM_MAX_IND; i++) { @@ -509,14 +517,15 @@ enum { }; #define PD_MAX_IND (_TOM_RSV_MAX - 1) -static inline int pd_valid(uint16_t pd) +static int +pd_valid(uint16_t pd) { if (pd >= F_TLV_PDAT && pd <= F_TLV_REST) return 1; return 0; } -static inline void +static void chk_op_type(netdissect_options *ndo, uint16_t type, uint16_t msk, uint16_t omsk) { @@ -564,7 +573,8 @@ 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(uint16_t pd) +static const struct pdata_ops * +get_forces_pd(uint16_t pd) { int i; for (i = PD_RSV_I + 1; i <= PD_MAX_IND; i++) { @@ -671,7 +681,7 @@ prestlv_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -706,7 +716,7 @@ fdatatlv_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -752,7 +762,7 @@ sdatailv_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -781,7 +791,7 @@ sdatatlv_print(netdissect_options *ndo, return sdatailv_print(ndo, tdp, rlen, op_msk, indent); trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -823,7 +833,7 @@ pkeyitlv_print(netdissect_options *ndo, return fdatatlv_print(ndo, dp, tll, op_msk, indent); trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -980,7 +990,7 @@ pd_err: return len; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1045,7 +1055,7 @@ pdata_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1092,7 +1102,7 @@ genoptlv_print(netdissect_options *ndo, } trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1146,7 +1156,7 @@ recpdoptlv_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1205,7 +1215,7 @@ otlv_print(netdissect_options *ndo, return rc; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1263,7 +1273,7 @@ asttlv_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1316,7 +1326,7 @@ asrtlv_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1365,7 +1375,7 @@ print_metailv(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1406,7 +1416,7 @@ print_metatlv(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1500,7 +1510,7 @@ redirect_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1586,7 +1596,7 @@ lfbselect_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1681,7 +1691,7 @@ forces_type_print(netdissect_options *ndo, return 0; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); return -1; } @@ -1696,6 +1706,7 @@ forces_print(netdissect_options *ndo, const struct tom_h *tops; int rc = 0; + ndo->ndo_protocol = "forces"; fhdr = (const struct forcesh *)pptr; ND_TCHECK_SIZE(fhdr); tom = EXTRACT_U_1(fhdr->fm_tom); @@ -1761,11 +1772,5 @@ error: return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); } -/* - * Local Variables: - * c-style: whitesmith - * c-basic-offset: 8 - * End: - */