From bd45eaf4478febdfa63f356c5bc61a9a36251a20 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sun, 13 Mar 2016 17:47:16 +0000 Subject: [PATCH] Added two macros and a prototype. FossilOrigin-Name: 0bb79c5fb5dfddf37aa16c7fa9ec4f46f46b369c027d3180fc422918d09ea66c --- src/cw/cw.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/cw/cw.h b/src/cw/cw.h index 1bcebaa6..01e6b12e 100644 --- a/src/cw/cw.h +++ b/src/cw/cw.h @@ -182,6 +182,21 @@ static inline void cw_set_hdr_rid(uint8_t * th, int rid) #define cw_set_msg_flags(msgptr,f) (cw_put_byte( (msgptr)+7,f)) +/** + * Check if a message id is from request msg + * @param msg_id id to check + * @return 1 if it msg id is a request msg id, otherwise 0 + */ +#define cw_is_request(msg) (msg_id & 1) + +/** + * Check if message id is from a response msg + * @see #cw_is_request + */ + +#define cw_is_response(msg_id) (!is_response(msg_id)) + + static inline uint8_t *cw_get_hdr_msg_elems_ptr(uint8_t * m) { return cw_get_msg_elems_ptr(m + cw_get_hdr_msg_offset(m)); @@ -228,7 +243,6 @@ static inline int cw_set_hdr_rmac(uint8_t * th, bstr_t rmac) - /** * Get length of a CAPWAP message elemet * @param e pointer to element (uint8_t*) @@ -310,6 +324,7 @@ static inline int cw_put_elem_vendor_hdr(uint8_t * dst, uint32_t vendorid, int cw_put_image_data(uint8_t * dst, FILE * infile); +extern int cw_put_mbag_item(uint8_t * dst, struct mbag_item *item); /**