Lines Matching defs:tlv
252 #define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0)))
254 static inline int TLV_OK(const void *tlv, __u16 space)
257 * Would also like to check that "tlv" is a multiple of 4,
259 * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler
261 * - Tried casting "tlv" to integer type, but causes warning about size
266 (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space);
269 static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type)
271 return TLV_OK(tlv, space) &&
272 (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type);
275 static inline int TLV_GET_LEN(struct tlv_desc *tlv)
277 return ntohs(tlv->tlv_len);
280 static inline void TLV_SET_LEN(struct tlv_desc *tlv, __u16 len)
282 tlv->tlv_len = htons(len);
285 static inline int TLV_CHECK_TYPE(struct tlv_desc *tlv, __u16 type)
287 return (ntohs(tlv->tlv_type) == type);
290 static inline void TLV_SET_TYPE(struct tlv_desc *tlv, __u16 type)
292 tlv->tlv_type = htons(type);
295 static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len)
301 tlv_ptr = (struct tlv_desc *)tlv;