*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
-#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
#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 {
};
#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)
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";
* 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)
{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),
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
/* 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];
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);
};
#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)
}
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
}
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)
{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++) {
}
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 {
};
#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;
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) {
#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},
{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++) {
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;
/*
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
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) {
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) {
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)
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);
* 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:
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) {
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",
}
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",
/* 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);
}
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;
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))
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);
* 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,
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;
*/
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)
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);
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;
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,
}
- 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:
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);
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);
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;
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
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;
/*
* 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);
}
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);
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;
* 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",
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;
EXTRACT_32BITS(&lfbs->instance)));
}
- otlv = (struct forces_tlv *)(lfbs + 1);
+ otlv = (const struct forces_tlv *)(lfbs + 1);
indent += 1;
while (rlen != 0) {
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);
}
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;
{
const struct forcesh *fhdr;
u_int mlen;
- u_int32_t flg_raw;
+ uint32_t flg_raw;
const struct tom_h *tops;
int rc = 0;