#define F_LFB_RSVD 0x0
#define F_LFB_FEO 0x1
#define F_LFB_FEPO 0x2
-struct tok ForCES_LFBs[] = {
+const struct tok ForCES_LFBs[] = {
{F_LFB_RSVD, "Invalid TLV"},
{F_LFB_FEO, "FEObj LFB"},
{F_LFB_FEPO, "FEProtoObj LFB"},
};
int forces_type_print(register const u_char * pptr, const struct forcesh *fhdr,
- register u_int mlen, struct tom_h *tops);
+ register u_int mlen, const struct tom_h *tops);
enum {
F_OP_RSV,
#define B_RESTV 0x4
#define B_KEYIN 0x8
-static struct optlv_h OPTLV_msg[F_OP_MAX + 1] = {
+static const struct optlv_h OPTLV_msg[F_OP_MAX + 1] = {
/* F_OP_RSV */ {ZERO_TTLV, 0, "Invalid OPTLV", invoptlv_print},
/* F_OP_SET */ {TTLV_T2, B_FULLD | B_SPARD, " Set", recpdoptlv_print},
/* F_OP_SETPROP */
/* F_OP_RTRCOMP */ {ZERO_TTLV, 0, " RTRCOMP", NULL},
};
-static inline struct optlv_h *get_forces_optlv_h(u_int16_t opt)
+static inline const struct optlv_h *get_forces_optlv_h(u_int16_t opt)
{
if (opt > F_OP_MAX || opt <= F_OP_RSV)
return &OPTLV_msg[F_OP_RSV];
#define F_TLV_REDD 0x0116
#define F_TLV_VNST 0x8000
-static struct tok ForCES_TLV[] = {
+static const struct tok ForCES_TLV[] = {
{F_TLV_RSVD, "Invalid TLV"},
{F_TLV_REDR, "REDIRECT TLV"},
{F_TLV_ASRS, "ASResult TLV"},
u_int16_t length;
};
-int otlv_print(struct forces_tlv *otlv, u_int16_t op_msk, int indent);
+int otlv_print(const struct forces_tlv *otlv, u_int16_t op_msk, int indent);
#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 INVALID_LTLN -3
#define INVALID_ALEN -4
-static struct tok ForCES_TLV_err[] = {
+static const struct tok ForCES_TLV_err[] = {
{INVALID_RLEN, "Invalid total length"},
{INVALID_STLN, "xLV too short"},
{INVALID_LTLN, "xLV too long"},
{0, NULL}
};
-static inline int tlv_valid(struct forces_tlv *tlv, u_int rlen)
+static inline int tlv_valid(const struct forces_tlv *tlv, u_int rlen)
{
if (rlen < (int) sizeof(struct forces_tlv))
return INVALID_RLEN;
return 0;
}
-static inline int ilv_valid(struct forces_ilv *ilv, u_int rlen)
+static inline int ilv_valid(const struct forces_ilv *ilv, u_int rlen)
{
if (rlen < sizeof(struct forces_ilv))
return INVALID_RLEN;
#define CFG_QYR (B_OP_GETRESP|B_OP_GETPRESP)
#define CFG_EVN (B_OP_REPORT)
-static struct tom_h ForCES_msg[TOM_MAX_IND + 1] = {
+static const struct tom_h ForCES_msg[TOM_MAX_IND + 1] = {
/* TOM_RSV_I */ {TOM_RSVD, ZERO_TTLV, 0, "Invalid message", NULL},
/* TOM_ASS_I */ {TOM_ASSNSETUP, ZERO_MORE_TTLV | TWO_TLV, ASSNS_OPS,
"Association Setup", lfbselect_print},
{TOM_QUERYREP, TTLV_T2, CFG_QYR, "Query Response", lfbselect_print},
};
-static inline struct tom_h *get_forces_tom(u_int8_t tom)
+static inline const struct tom_h *get_forces_tom(u_int8_t tom)
{
int i;
for (i = TOM_RSV_I; i <= TOM_MAX_IND; i++) {
- struct tom_h *th = &ForCES_msg[i];
+ const struct tom_h *th = &ForCES_msg[i];
if (th->v == tom)
return th;
}
u_int16_t resv2;
};
-static struct pdata_ops ForCES_pdata[PD_MAX_IND + 1] = {
+static const struct pdata_ops ForCES_pdata[PD_MAX_IND + 1] = {
/* PD_RSV_I */ {0, 0, 0, "Invalid message", NULL},
/* PD_SEL_I */ {F_TLV_KEYI, 0, 0, "KEYINFO TLV", pkeyitlv_print},
/* PD_FDT_I */ {F_TLV_FULD, 0, B_FULLD, "FULLDATA TLV", fdatatlv_print},
{F_TLV_PDAT, 0, 0, "Inner PATH-DATA TLV", recpdoptlv_print},
};
-static inline struct pdata_ops *get_forces_pd(u_int16_t pd)
+static inline const struct pdata_ops *get_forces_pd(u_int16_t pd)
{
int i;
for (i = PD_RSV_I + 1; i <= PD_MAX_IND; i++) {
- struct pdata_ops *pdo = &ForCES_pdata[i];
+ const struct pdata_ops *pdo = &ForCES_pdata[i];
if (pdo->v == pd)
return pdo;
}
E_UNSPECIFIED_ERROR = 0XFF
};
-struct tok ForCES_errs[] = {
+const struct tok ForCES_errs[] = {
{E_SUCCESS, "SUCCESS"},
{E_INVALID_HEADER, "INVALID HEADER"},
{E_LENGTH_MISMATCH, "LENGTH MISMATCH"},
prestlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk _U_, int indent)
{
- struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ 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;
u_int dlen = len - TLV_HDRL;
fdatatlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk _U_, int indent)
{
- struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
u_int tll = len - TLV_HDRL;
register const u_char *tdp = (u_char *) TLV_DATA(tlv);
u_int16_t type;
u_int16_t op_msk _U_, int indent)
{
u_int tll = len - ILV_HDRL;
- struct forces_ilv *ilv = (struct forces_ilv *)pptr;
+ const struct forces_ilv *ilv = (struct forces_ilv *)pptr;
int invilv;
indent += 1;
sdatatlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk, int indent)
{
- struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
u_int tll = len - TLV_HDRL;
register const u_char *tdp = (u_char *) TLV_DATA(tlv);
u_int16_t type;
pkeyitlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk, int indent)
{
- struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
register const u_char *tdp = (u_char *) TLV_DATA(tlv);
register const u_char *dp = tdp + 4;
- struct forces_tlv *kdtlv = (struct forces_tlv *)dp;
+ const struct forces_tlv *kdtlv = (struct forces_tlv *)dp;
u_int32_t id;
char *ib = indent_pr(indent, 0);
u_int16_t type, tll;
pptr += 4;
}
if (len) {
- struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
u_int16_t type;
u_int16_t tll;
int pad = 0;
}
}
if (pd_valid(type)) {
- struct pdata_ops *ops = get_forces_pd(type);
+ const struct pdata_ops *ops = get_forces_pd(type);
if (vflag >= 3 && ops->v != F_TLV_PDAT) {
if (pad)
pdata_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk, int indent)
{
- struct pathdata_h *pdh = (struct pathdata_h *)pptr;
+ const struct pathdata_h *pdh = (struct pathdata_h *)pptr;
char *ib = indent_pr(indent, 0);
u_int minsize = 0;
genoptlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk, int indent)
{
- struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
u_int16_t type;
int tll;
int invtlv;
recpdoptlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk, int indent)
{
- struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
int tll = len;
int rc = 0;
int invtlv;
u_int16_t op_msk _U_, int indent)
{
char *ib = indent_pr(indent, 1);
+
if (vflag >= 3) {
printf("%sData[", &ib[1]);
hex_print_with_offset(ib, pptr, len, 0);
return -1;
}
-int otlv_print(struct forces_tlv *otlv, u_int16_t op_msk _U_, int indent)
+int otlv_print(const struct forces_tlv *otlv, u_int16_t op_msk _U_, int indent)
{
int rc = 0;
register const u_char *dp = (u_char *) TLV_DATA(otlv);
u_int16_t type;
int tll;
char *ib = indent_pr(indent, 0);
- struct optlv_h *ops;
+ const struct optlv_h *ops;
TCHECK(*otlv);
type = EXTRACT_16BITS(&otlv->type);
asttlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk _U_, int indent)
{
-
u_int32_t rescode;
u_int dlen = len - TLV_HDRL;
char *ib = indent_pr(indent, 0);
+
if (dlen != ASTDLN) {
printf("illegal ASTresult-TLV: %d bytes!\n", dlen);
return -1;
asrtlv_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk _U_, int indent)
{
-
u_int32_t rescode;
u_int dlen = len - TLV_HDRL;
char *ib = indent_pr(indent, 0);
u_int16_t op_msk _U_, int indent _U_)
{
u_int dlen = len - TLV_HDRL;
+
if (dlen < 4) { /* at least 32 bits must exist */
printf("truncated TLV: %d bytes missing! ", 4 - dlen);
return -1;
int tll = dlen;
char *ib = indent_pr(indent, 0);
/* XXX: check header length */
- struct forces_ilv *ilv = (struct forces_ilv *)pptr;
+ const struct forces_ilv *ilv = (struct forces_ilv *)pptr;
TCHECK(*ilv);
printf("\n%sMetaID 0x%x length %d\n", ib, EXTRACT_32BITS(&ilv->type),
u_int dlen = len - TLV_HDRL;
char *ib = indent_pr(indent, 0);
u_int tll = dlen;
- struct forces_ilv *ilv = (struct forces_ilv *)pptr;
+ const struct forces_ilv *ilv = (struct forces_ilv *)pptr;
int invilv;
printf("\n%s METADATA\n", ib);
u_int dlen = len - TLV_HDRL;
u_int tll = dlen;
int invtlv;
- struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
printf("\n\t\t Redirect DATA\n");
if (dlen <= RD_MIN) {
redirect_print(register const u_char * pptr, register u_int len,
u_int16_t op_msk _U_, int indent)
{
- struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
u_int dlen = len - TLV_HDRL;
u_int tll = dlen;
int invtlv;
u_int16_t op_msk, int indent)
{
const struct forces_lfbsh *lfbs;
- struct forces_tlv *otlv;
+ const struct forces_tlv *otlv;
char *ib = indent_pr(indent, 0);
u_int dlen = len - TLV_HDRL;
u_int tll = dlen - OP_OFF;
int
forces_type_print(register const u_char * pptr, const struct forcesh *fhdr _U_,
- register u_int mlen, struct tom_h *tops)
+ register u_int mlen, const struct tom_h *tops)
{
- struct forces_tlv *tltlv;
+ const struct forces_tlv *tltlv;
u_int tll;
int invtlv;
int rc = 0;
const struct forcesh *fhdr;
u_int mlen;
u_int32_t flg_raw;
- struct tom_h *tops;
+ const struct tom_h *tops;
int rc = 0;
fhdr = (const struct forcesh *)pptr;