#define ForCES_RS2(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
};
-#define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= sizeof(struct forcesh) && \
- (fhl) >= sizeof(struct forcesh) && \
+#define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \
+ (fhl) >= ForCES_HDRL && \
(fhl) == (tlen))
#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 TLV_SET_LEN(len) (F_ALN_LEN(sizeof(struct forces_tlv)) + (len))
+#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 GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)), \
(struct forces_tlv*)(((char*)(tlv)) \
+ F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length))))
-#define ILV_SET_LEN(len) (F_ALN_LEN(sizeof(struct forces_ilv)) + (len))
+#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 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))
+ if (rlen < TLV_HDRL)
return INVALID_RLEN;
- if (EXTRACT_16BITS(&tlv->length) < sizeof(struct forces_tlv))
+ if (EXTRACT_16BITS(&tlv->length) < TLV_HDRL)
return INVALID_STLN;
if (EXTRACT_16BITS(&tlv->length) > rlen)
return INVALID_LTLN;
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))
+ if (rlen < ILV_HDRL)
return INVALID_RLEN;
- if (EXTRACT_32BITS(&ilv->length) < sizeof(struct forces_ilv))
+ if (EXTRACT_32BITS(&ilv->length) < ILV_HDRL)
return INVALID_STLN;
if (EXTRACT_32BITS(&ilv->length) > rlen)
return INVALID_LTLN;
#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"},