Renamed CW_FLAGS... -> CAPWAP_FLAGS...

FossilOrigin-Name: 8b713609a3b32597a7622fcfc5ddd74e223643615bdd28ccac322f9f0e82cc23
This commit is contained in:
7u83@mail.ru 2018-02-23 08:30:10 +00:00
parent 8f054b3b59
commit bb85f1c371
7 changed files with 33 additions and 33 deletions

View File

@ -70,15 +70,15 @@
/**
* CAPWAP header flags.
*/
#define CW_FLAG_HDR_R1 0x01 /* bit 0 reserved 1 */
#define CW_FLAG_HDR_R2 0x02 /* bit 1 reserved 2 */
#define CW_FLAG_HDR_R3 0x04 /* bit 2 reserved 3 */
#define CW_FLAG_HDR_K 0x08 /* bit 3 Keep alive flag */
#define CW_FLAG_HDR_M 0x10 /* bit 4 MAC Adress field present */
#define CW_FLAG_HDR_W 0x20 /* bit 5 wireless info present */
#define CW_FLAG_HDR_L 0x40 /* bit 6 last fragment */
#define CW_FLAG_HDR_F 0x80 /* bit 7 fragment */
#define CW_FLAG_HDR_T 0x100 /* bit 8 type of payload frame */
#define CAPWAP_FLAG_HDR_R1 0x01 /**< bit 0 reserved 1 */
#define CAPWAP_FLAG_HDR_R2 0x02 /**< bit 1 reserved 2 */
#define CAPWAP_FLAG_HDR_R3 0x04 /**< bit 2 reserved 3 */
#define CAPWAP_FLAG_HDR_K 0x08 /**< bit 3 Keep alive flag */
#define CAPWAP_FLAG_HDR_M 0x10 /**< bit 4 MAC Adress field present */
#define CAPWAP_FLAG_HDR_W 0x20 /**< bit 5 wireless info present */
#define CAPWAP_FLAG_HDR_L 0x40 /**< bit 6 last fragment */
#define CAPWAP_FLAG_HDR_F 0x80 /**< bit 7 fragment */
#define CAPWAP_FLAG_HDR_T 0x100 /**< bit 8 type of payload frame */

View File

@ -89,16 +89,16 @@
#define cw_get_hdr_rmac_size(th) cw_get_hdr_rmac_len(th)
#define cw_get_hdr_rmac_data(th) (th+9)
#define cw_get_hdr_flag_r1(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_R1 ) ? 1:0)
#define cw_get_hdr_flag_r2(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_R2 ) ? 1:0)
#define cw_get_hdr_flag_r3(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_R3 ) ? 1:0)
#define cw_get_hdr_flag_r1(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_R1 ) ? 1:0)
#define cw_get_hdr_flag_r2(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_R2 ) ? 1:0)
#define cw_get_hdr_flag_r3(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_R3 ) ? 1:0)
#define cw_get_hdr_flag_k(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_K ) ? 1:0)
#define cw_get_hdr_flag_m(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_M ) ? 1:0)
#define cw_get_hdr_flag_w(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_W ) ? 1:0)
#define cw_get_hdr_flag_l(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_L ) ? 1:0)
#define cw_get_hdr_flag_f(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_F ) ? 1:0)
#define cw_get_hdr_flag_t(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_T ) ? 1:0)
#define cw_get_hdr_flag_k(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_K ) ? 1:0)
#define cw_get_hdr_flag_m(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_M ) ? 1:0)
#define cw_get_hdr_flag_w(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_W ) ? 1:0)
#define cw_get_hdr_flag_l(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_L ) ? 1:0)
#define cw_get_hdr_flag_f(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_F ) ? 1:0)
#define cw_get_hdr_flag_t(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_T ) ? 1:0)
/**
* Get length wireless specific data
@ -196,7 +196,7 @@ static inline void cw_set_hdr_rid(uint8_t * th, int rid)
#define cw_set_hdr_flags(th,flags,set) \
( set ? ((*((uint32_t*)th)) |= htonl(flags)) : ((*((uint32_t*)th)) &= (0xffffffff^htonl(flags))) )
#define cw_set_hdr_flag_f(th,set) cw_set_hdr_flag(th, CW_FLAG_HDR_F)
#define cw_set_hdr_flag_f(th,set) cw_set_hdr_flag(th, CAPWAP_FLAG_HDR_F)
@ -267,13 +267,13 @@ static inline int cw_get_hdr_msg_total_len(uint8_t * rawmsg)
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_flags(th, CAPWAP_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);
cw_set_hdr_flags(th, CAPWAP_FLAG_HDR_M, 1);
int hlen = 4 + rmac_len / 4;

View File

@ -16,7 +16,7 @@ uint8_t *cw_init_data_keep_alive_msg(uint8_t * buffer,uint8_t *rmac)
cw_set_hdr_rmac(buffer, rmac);
cw_set_hdr_flags(buffer, CW_FLAG_HDR_K,1);
cw_set_hdr_flags(buffer, CAPWAP_FLAG_HDR_K,1);
return cw_get_hdr_payload_ptr(buffer);
}

View File

@ -19,7 +19,7 @@ void cw_init_response(struct conn * conn, uint8_t *req)
int dhbytes;
memcpy(buffer,req,shbytes);
cw_set_hdr_hlen(buffer,2);
cw_set_hdr_flags(buffer,CW_FLAG_HDR_M,1);
cw_set_hdr_flags(buffer,CAPWAP_FLAG_HDR_M,1);
dhbytes = cw_get_hdr_msg_offset(buffer);
uint8_t * msgptr = req+shbytes;

View File

@ -168,7 +168,7 @@ uint8_t * fragman_add(frag_t * frags, uint8_t *packet, int hlen, int payloadlen)
f->bytesreceived+=payloadlen;
}
if (val0 & CW_FLAG_HDR_L){
if (val0 & CAPWAP_FLAG_HDR_L){
f->bytesneeded=dst+payloadlen;
}

View File

@ -202,7 +202,7 @@ int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
int mtu = 1400;
while (msglen>mtu){
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
cw_put_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
cw_dbg_pkt_nc(DBG_PKT_OUT,nc,ptr,mtu,(struct sockaddr*)&nc->addr);
@ -219,9 +219,9 @@ int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
if (fragoffset)
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F | CW_FLAG_HDR_L,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F | CAPWAP_FLAG_HDR_L,1);
else
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,0);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
cw_put_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );

View File

@ -36,7 +36,7 @@ cw_dbg(DBG_X,"Here is a conn_send_msg for anything");
int mtu = conn->mtu;
while (packetlen>mtu){
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
cw_dbg_pkt(DBG_PKT_OUT,conn,ptr,mtu,(struct sockaddr*)&conn->addr);
@ -54,9 +54,9 @@ cw_dbg(DBG_X,"Here is a conn_send_msg for anything");
if (fragoffset)
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F | CW_FLAG_HDR_L,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F | CAPWAP_FLAG_HDR_L,1);
else
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,0);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
@ -83,7 +83,7 @@ int conn_send_data_msg(struct conn * conn, uint8_t *rawmsg,int len)
int mtu = conn->mtu;
while (packetlen>mtu){
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
cw_dbg_pkt(DBG_PKT_OUT,conn,ptr,mtu,(struct sockaddr*)&conn->addr);
@ -101,9 +101,9 @@ int conn_send_data_msg(struct conn * conn, uint8_t *rawmsg,int len)
if (fragoffset)
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F | CW_FLAG_HDR_L,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F | CAPWAP_FLAG_HDR_L,1);
else
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,0);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );