WTP work...

FossilOrigin-Name: c770fa37c379da9fb78feebb463e2843ba8179e3f9026687dcfb44b4c7c47388
This commit is contained in:
7u83@mail.ru
2015-04-18 09:20:24 +00:00
parent e963edb4ce
commit 5a80bdecea
17 changed files with 306 additions and 80 deletions

View File

@ -633,6 +633,8 @@ extern int cw_readmsg_configuration_update_request(uint8_t * elems, int elems_le
#define cw_set_hdr_preamble(th,v) ((*th)=v)
/**
* Set the HLEN field of a CAWAP Header
* @param th pointer to the header
@ -726,6 +728,32 @@ static inline int cw_get_hdr_msg_total_len(uint8_t * rawmsg)
return offset + cw_get_msg_elems_len(rawmsg + offset) + 8;
}
static inline int cw_set_hdr_rmac(uint8_t * th,bstr_t rmac)
{
if (!rmac){
cw_set_hdr_flags(th,CW_FLAG_HDR_M,0);
cw_set_hdr_hlen(th, 2);
return 0;
}
int rmac_len = bstr_len(rmac);
memcpy(cw_get_hdr_rmac(th),rmac,rmac_len+1);
cw_set_hdr_flags(th,CW_FLAG_HDR_M,1);
int hlen = 4+rmac_len/4;
if (rmac_len %4 != 0) {
hlen++;
}
cw_set_hdr_hlen(th,hlen);
return 1;
}
/**
* Get length of a CAPWAP message elemet
* @param e pointer to element (uint8_t*)