2016-02-27 10:50:51 +01:00
|
|
|
#ifndef __CW_H
|
|
|
|
#define __CW_H
|
|
|
|
|
2016-03-04 21:01:38 +01:00
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
2018-04-01 10:03:17 +02:00
|
|
|
/*#include "bstr.h"*/
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2018-04-01 10:03:17 +02:00
|
|
|
/*#include "conn.h"*/
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-02-27 10:50:51 +01:00
|
|
|
|
2016-03-04 20:23:32 +01:00
|
|
|
#include "lw.h"
|
2016-03-11 22:23:00 +01:00
|
|
|
#include "capwap.h"
|
2018-03-12 11:22:06 +01:00
|
|
|
#include "msgset.h"
|
2016-02-27 14:25:32 +01:00
|
|
|
|
2018-03-25 11:14:37 +02:00
|
|
|
/**
|
|
|
|
* @addtogroup CAPWAP
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
/**
|
|
|
|
* @defgroup CW CW
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2016-02-27 14:25:32 +01:00
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
/* Use some macros from LWAPP */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put a byte to an output buffer.
|
|
|
|
* see #lw_put_byte
|
|
|
|
*/
|
|
|
|
#define cw_put_byte lw_put_byte
|
2016-03-05 22:32:52 +01:00
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
/**
|
2016-03-04 21:01:38 +01:00
|
|
|
* Put a word to an output buffer.
|
2016-03-04 19:37:02 +01:00
|
|
|
* see #lw_put_word
|
|
|
|
*/
|
|
|
|
#define cw_put_word lw_put_word
|
2016-03-05 22:32:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Put a dword
|
|
|
|
* see #lw_put_dword
|
|
|
|
*/
|
2016-03-04 19:37:02 +01:00
|
|
|
#define cw_put_dword lw_put_dword
|
2016-03-05 22:32:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Put some bytes
|
|
|
|
* See #lw_put_data
|
|
|
|
*/
|
2016-03-04 19:37:02 +01:00
|
|
|
#define cw_put_data lw_put_data
|
2016-03-05 22:32:52 +01:00
|
|
|
|
2018-04-01 00:49:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Put a 0-terminated string
|
|
|
|
*/
|
|
|
|
#define cw_put_str lw_put_str
|
|
|
|
|
2016-03-05 23:10:35 +01:00
|
|
|
/**
|
|
|
|
* Put a bstr_t object
|
|
|
|
* see #lw_put_bstr
|
|
|
|
*/
|
2016-03-04 19:37:02 +01:00
|
|
|
#define cw_put_bstr lw_put_bstr
|
2016-03-05 23:10:35 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Put bstr16_t object
|
|
|
|
* see #lw_put_bstr16
|
|
|
|
*/
|
2016-03-04 19:37:02 +01:00
|
|
|
#define cw_put_bstr16 lw_put_bstr16
|
|
|
|
|
2016-03-05 23:10:35 +01:00
|
|
|
/**
|
|
|
|
* Set dword
|
|
|
|
* see #lw_set_dword
|
|
|
|
*/
|
2016-03-04 21:01:38 +01:00
|
|
|
#define cw_set_dword lw_set_dword
|
|
|
|
|
|
|
|
#define cw_get_byte lw_get_byte
|
|
|
|
#define cw_get_word lw_get_word
|
|
|
|
#define cw_get_dword lw_get_dword
|
|
|
|
|
2018-03-24 07:56:05 +01:00
|
|
|
|
|
|
|
#define cw_set_byte lw_set_byte
|
|
|
|
#define cw_set_word lw_set_word
|
|
|
|
#define cw_set_dword lw_set_dword
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2018-02-22 22:18:46 +01:00
|
|
|
#define cw_get_str(data, maxlen) (strndup((char*)(data),maxlen))
|
2018-03-24 07:56:05 +01:00
|
|
|
*/
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Macro to isolate bits from a dword
|
|
|
|
* @param src dword to isolate bits from
|
|
|
|
* @param start start position
|
|
|
|
* @len number of bits
|
|
|
|
*/
|
|
|
|
#define cw_get_dword_bits(src,start,len) ((~(0xFFFFFFFF<<len)) & (src >> (32 - start - len)))
|
|
|
|
|
|
|
|
/* macros to acces transport header values */
|
|
|
|
|
|
|
|
#define cw_get_hdr_preamble(th) (th[0])
|
2020-03-29 22:58:00 +02:00
|
|
|
|
|
|
|
#define cw_get_hdr_fragid(th)\
|
|
|
|
(((ntohl(*(((uint32_t*)(th))+1))) >> 16) & 0xffff)
|
|
|
|
|
|
|
|
#define cw_get_hdr_fragoffset(th)\
|
|
|
|
(((ntohl(*(((uint32_t*)(th))+1))) >> 3) & 0x1fff)
|
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#define cw_get_hdr_rid(th) ((ntohl((((uint32_t*)th)[0]) >> 14) & 0x1f))
|
|
|
|
#define cw_get_hdr_wbid(th) ((ntohl(((uint32_t*)th)[0]) >> 9) & 0x1f)
|
|
|
|
#define cw_get_hdr_hlen(th) ((ntohl(((uint32_t*)th)[0]) >> 19) & 0x1f)
|
|
|
|
|
|
|
|
#define cw_get_hdr_rmac(th) (th+8)
|
|
|
|
#define cw_get_hdr_rmac_len(th) (*(th+8))
|
|
|
|
#define cw_get_hdr_rmac_size(th) cw_get_hdr_rmac_len(th)
|
|
|
|
#define cw_get_hdr_rmac_data(th) (th+9)
|
|
|
|
|
2018-02-23 09:30:10 +01:00
|
|
|
#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)
|
2016-03-16 07:58:45 +01:00
|
|
|
|
2018-02-23 09:30:10 +01:00
|
|
|
#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)
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-02-23 20:14:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-24 23:58:31 +01:00
|
|
|
|
2018-02-23 20:14:10 +01:00
|
|
|
|
2018-02-26 18:28:12 +01:00
|
|
|
|
2018-02-23 20:14:10 +01:00
|
|
|
|
2018-03-31 17:49:16 +02:00
|
|
|
/*
|
2018-02-28 07:38:02 +01:00
|
|
|
#define CW_RECEIVER_AC 1
|
|
|
|
#define CW_RECEIVER_WTP 1
|
2018-03-31 17:49:16 +02:00
|
|
|
*/
|
2018-02-28 07:38:02 +01:00
|
|
|
|
2018-03-31 17:49:16 +02:00
|
|
|
#define CW_ROLE_AC 1
|
|
|
|
#define CW_ROLE_WTP 2
|
|
|
|
#define CW_ROLE_BOTH (CW_ROLE_AC | CW_ROLE_WTP)
|
2018-02-23 20:14:10 +01:00
|
|
|
|
2016-03-21 22:30:23 +01:00
|
|
|
|
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_get_hdr_ws_len(uint8_t * th);
|
|
|
|
uint8_t *cw_get_hdr_ws_data(uint8_t * th);
|
2016-03-21 22:30:23 +01:00
|
|
|
|
2016-04-10 15:59:35 +02:00
|
|
|
|
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
#define cw_get_hdr_msg_offset(th) (4*cw_get_hdr_hlen(th))
|
|
|
|
|
|
|
|
uint8_t * cw_get_hdr_payload_ptr(uint8_t *th);
|
2016-04-10 15:59:35 +02:00
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#define cw_get_hdr_msg_elems_offset(th) (cw_get_hdr_msg_offset(th)+8)
|
|
|
|
|
|
|
|
#define cw_set_hdr_preamble(th,v) ((*th)=v)
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
void cw_set_hdr_hlen(uint8_t * th, int hlen);
|
|
|
|
void cw_set_hdr_wbid(uint8_t * th, int wbid);
|
|
|
|
void cw_set_hdr_rid(uint8_t * th, int rid);
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set CAPWAP header flags
|
|
|
|
* @param th pointer to header
|
|
|
|
* @param flags list of flags to set or unset
|
|
|
|
* @param set 1=set flag, 0=unset flag
|
|
|
|
*/
|
|
|
|
#define cw_set_hdr_flags(th,flags,set) \
|
|
|
|
( set ? ((*((uint32_t*)th)) |= htonl(flags)) : ((*((uint32_t*)th)) &= (0xffffffff^htonl(flags))) )
|
|
|
|
|
2018-02-23 09:30:10 +01:00
|
|
|
#define cw_set_hdr_flag_f(th,set) cw_set_hdr_flag(th, CAPWAP_FLAG_HDR_F)
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Macros for message headers */
|
|
|
|
|
|
|
|
#define cw_get_msg_id(msgptr) (cw_get_dword(msgptr))
|
|
|
|
#define cw_get_msg_type(msgptr) cw_get_msg_id(msgptr)
|
|
|
|
|
|
|
|
#define cw_get_msg_seqnum(msgptr) cw_get_byte( (msgptr) +4 )
|
|
|
|
#define cw_get_msg_elems_len(msgptr) ( cw_get_word( (msgptr) +5 )-3)
|
|
|
|
#define cw_get_msg_elems_ptr(msgptr) ((msgptr)+8)
|
|
|
|
|
2016-04-10 15:59:35 +02:00
|
|
|
#define cw_get_datamsg_elems_len(msgptr) (cw_get_word(msgptr));
|
|
|
|
#define cw_get_datamsg_elems_ptr(msgptr) ((msgptr)+2);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the elems_len field of a data (keep-alive) msg
|
|
|
|
* @param msgptr Pointer to payload
|
|
|
|
* @param lem Value to set
|
|
|
|
*/
|
|
|
|
#define cw_set_datamsg_elems_len(msgptr,len) (cw_put_word(msgptr,len));
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-03-25 10:35:53 +02:00
|
|
|
#define cw_set_msg_id(msgptr,t) cw_set_dword(msgptr,t)
|
2016-03-11 22:23:00 +01:00
|
|
|
#define cw_set_msg_type(msgptr,t) cw_set_msg_id(msgptr,t)
|
2018-03-25 10:35:53 +02:00
|
|
|
#define cw_set_msg_seqnum(msgptr,s) cw_set_byte( (msgptr) +4,s);
|
|
|
|
#define cw_set_msg_elems_len(msgptr,n) (cw_set_word((msgptr)+5,((n)+3)))
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-03-25 10:35:53 +02:00
|
|
|
#define cw_set_msg_flags(msgptr,f) (cw_set_byte( (msgptr)+7,f))
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2016-03-13 18:47:16 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2016-03-19 09:17:55 +01:00
|
|
|
#define cw_is_request(msg_id) (msg_id & 1)
|
2016-03-13 18:47:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if message id is from a response msg
|
|
|
|
* @see #cw_is_request
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define cw_is_response(msg_id) (!is_response(msg_id))
|
|
|
|
|
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
uint8_t *cw_get_hdr_msg_elems_ptr(uint8_t * m);
|
|
|
|
uint8_t *cw_get_hdr_msg_ptr(uint8_t * rawmsg);
|
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
#define cw_get_hdr_msg_id(ptr)\
|
|
|
|
cw_get_msg_id(cw_get_hdr_msg_ptr(ptr))
|
|
|
|
#define cw_get_hdr_msg_type cw_get_hdr_msg_id
|
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_get_hdr_msg_total_len(uint8_t * rawmsg);
|
|
|
|
int cw_set_hdr_rmac(uint8_t * th, bstr_t rmac);
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get length of a CAPWAP message elemet
|
|
|
|
* @param e pointer to element (uint8_t*)
|
|
|
|
* @return length of element
|
|
|
|
*/
|
|
|
|
#define cw_get_elem_type(e) cw_get_word(e)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Alias for #cw_get_elem_type
|
|
|
|
*/
|
|
|
|
#define cw_get_elem_id(e) cw_get_elem_type(e)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get type of a CAPWAP message element
|
|
|
|
* @pram e pointer to element (uint8_t*)
|
|
|
|
* @return type of element
|
|
|
|
*/
|
|
|
|
#define cw_get_elem_len(e) cw_get_word((e)+2)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a pointer to the data of a CAPWAP message element
|
|
|
|
* @param e pointer to message element
|
|
|
|
* @return pointer to data
|
|
|
|
*/
|
|
|
|
#define cw_get_elem_data(e) ((e)+4)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterate through message elements of a CAPWAP message
|
|
|
|
* @param i iterator witch points to the current element (uint8_t*)
|
|
|
|
* @param elems pointer to message elements (uint8_t*)
|
|
|
|
* @param len length of message element buffer
|
|
|
|
*
|
|
|
|
* You can use this macro like a for loop.
|
|
|
|
*
|
|
|
|
* uint8_t * i
|
|
|
|
* cw_foreach_elem(i,elem,len){
|
|
|
|
* ...
|
|
|
|
* print_message(i);
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
#define cw_foreach_elem(i,elems,len) for(i=elems; i<elems+len; i=i+4+cw_get_elem_len(i))
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put a message element header to buffer
|
|
|
|
* @param dst pointer to buffer (uint8_t)
|
|
|
|
* @param type tpe of message element
|
|
|
|
* @param len length of message element data
|
|
|
|
* @return the number bytes put (always 4)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define cw_put_elem_hdr(dst,type,len) \
|
2018-03-25 10:35:53 +02:00
|
|
|
(cw_set_dword(dst, (((uint32_t)type)<<16) | (len)),4)
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-03-25 10:35:53 +02:00
|
|
|
/**
|
|
|
|
* same as #cw_put_elem_hdrm but without return value
|
|
|
|
*/
|
|
|
|
#define cw_set_elem_hdr(dst,type,len) \
|
|
|
|
(cw_set_dword(dst, (((uint32_t)type)<<16) | (len)))
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_put_elem_vendor_hdr(uint8_t * dst, uint32_t vendorid,
|
|
|
|
uint16_t elemid, uint16_t len);
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
2016-03-12 02:34:07 +01:00
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#define cw_put_sockaddr lw_put_sockaddr
|
|
|
|
|
2016-03-11 23:45:35 +01:00
|
|
|
int cw_put_image_data(uint8_t * dst, FILE * infile);
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-03-12 02:34:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put encryption capabilities as described in CAWAP
|
2018-03-06 03:08:14 +01:00
|
|
|
* draft 7 fpr WTP DescriptorSubelemDef
|
2016-03-12 02:34:07 +01:00
|
|
|
* @param dst Destination buffer
|
|
|
|
* @param cap Capability
|
|
|
|
* @return number of bytes put
|
|
|
|
*/
|
|
|
|
#define cw_put_encryption_capabilities_7(dst,cap) cw_put_word(dst,cap)
|
|
|
|
|
2018-04-01 10:03:17 +02:00
|
|
|
/*
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_addelem(uint8_t * dst, uint16_t type, uint8_t * data, uint16_t len);
|
|
|
|
int cw_addelem_bstr(uint8_t * dst, uint16_t type, const bstr_t bstr);
|
2018-04-01 10:03:17 +02:00
|
|
|
*/
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_put_elem_result_code(uint8_t * dst, uint32_t code);
|
2018-04-01 10:03:17 +02:00
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-30 11:58:05 +02:00
|
|
|
/*extern int cw_put_ac_status(uint8_t * dst, struct cw_ac_status *s, struct conn *conn);*/
|
2016-03-11 22:23:00 +01:00
|
|
|
|
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
struct cw_DescriptorSubelemDef {
|
2016-03-15 00:31:31 +01:00
|
|
|
int vendor_id;
|
|
|
|
int type;
|
2018-03-06 03:08:14 +01:00
|
|
|
const char *key;
|
2016-03-15 00:31:31 +01:00
|
|
|
int maxlen;
|
|
|
|
int mand;
|
|
|
|
};
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-02-25 00:52:45 +01:00
|
|
|
#define CW_DELETE 1
|
|
|
|
#define CW_APPEND 2
|
|
|
|
#define CW_PREPEND 3
|
|
|
|
#define CW_REPLACE 4
|
2018-03-12 18:01:40 +01:00
|
|
|
#define CW_IGNORE 5
|
2018-02-25 00:52:45 +01:00
|
|
|
|
|
|
|
|
2018-05-07 10:57:12 +02:00
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
|
|
|
|
|
2018-03-12 11:22:06 +01:00
|
|
|
int cw_check_missing_mand(struct cw_MsgData *msgdata, mavl_t keys );
|
|
|
|
|
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
|
2018-03-07 08:57:04 +01:00
|
|
|
extern int cw_read_descriptor_subelems(mavl_t store, const char * key, uint8_t * data, int len,
|
2018-03-06 03:08:14 +01:00
|
|
|
struct cw_DescriptorSubelemDef *elems);
|
2016-03-15 00:31:31 +01:00
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
/*
|
|
|
|
int cw_read_wtp_descriptor(mavl_t mbag, struct conn *conn,
|
|
|
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
|
|
|
struct cw_DescriptorSubelemDef *allowed);
|
|
|
|
*/
|
2016-03-04 21:01:38 +01:00
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
int cw_read_wtp_descriptor(mavl_t mbag, struct conn *conn,
|
|
|
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
|
|
|
struct cw_DescriptorSubelemDef *allowed);
|
|
|
|
|
2018-03-15 20:07:17 +01:00
|
|
|
int cw_write_descriptor_subelem (uint8_t *dst, mavl_t ktvstore,
|
|
|
|
int subelem_id, const char * parent_key);
|
|
|
|
|
2018-03-28 10:11:47 +02:00
|
|
|
int cw_write_radio_element(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params, int idx,
|
|
|
|
uint8_t * dst);
|
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor_7(mavl_t mbag, struct conn *conn,
|
|
|
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
|
|
|
struct cw_DescriptorSubelemDef *allowed);
|
2016-03-15 00:31:31 +01:00
|
|
|
|
2016-03-04 21:01:38 +01:00
|
|
|
|
2018-03-25 08:34:32 +02:00
|
|
|
int cw_read_ac_descriptor(mavl_t store,
|
|
|
|
struct cw_ElemHandler *eh,
|
|
|
|
struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t *data, int len,
|
|
|
|
struct cw_DescriptorSubelemDef *allowed);
|
|
|
|
|
|
|
|
|
2018-04-01 10:03:17 +02:00
|
|
|
int cw_setup_dtls(struct conn * conn, mavl_t cfg, const char *prefix, char * default_cipher);
|
2016-03-04 21:01:38 +01:00
|
|
|
|
|
|
|
|
2016-03-07 19:10:39 +01:00
|
|
|
|
2016-03-04 21:01:38 +01:00
|
|
|
|
2016-03-06 16:52:17 +01:00
|
|
|
/**
|
|
|
|
* @defgroup CWELEMIN Input Handlers for Message Elements
|
|
|
|
* @{
|
|
|
|
*/
|
2018-03-09 07:44:17 +01:00
|
|
|
|
2018-04-13 07:28:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
int cw_in_idx_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
2018-04-20 05:46:50 +02:00
|
|
|
|
|
|
|
int cw_in_generic_with_index(struct cw_ElemHandler *eh,
|
|
|
|
struct cw_ElemHandlerParams *params,
|
|
|
|
uint8_t * data, int len);
|
|
|
|
int cw_out_generic_with_index(struct cw_ElemHandler * eh,
|
|
|
|
struct cw_ElemHandlerParams * params, uint8_t * dst);
|
|
|
|
|
2018-04-13 07:28:11 +02:00
|
|
|
int cw_in_idx_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
|
|
|
|
|
|
|
int cw_out_idx_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst);
|
2016-04-11 04:00:59 +02:00
|
|
|
|
2018-03-09 07:44:17 +01:00
|
|
|
int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
2016-04-11 04:00:59 +02:00
|
|
|
|
2018-03-26 00:00:21 +02:00
|
|
|
int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
|
|
|
|
2018-04-08 16:48:13 +02:00
|
|
|
int cw_in_generic_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
2018-04-22 09:00:55 +02:00
|
|
|
|
|
|
|
int cw_in_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
|
|
|
|
|
|
|
int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst);
|
2018-04-08 16:48:13 +02:00
|
|
|
|
2018-03-12 18:01:40 +01:00
|
|
|
int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst);
|
2018-04-07 19:28:00 +02:00
|
|
|
|
|
|
|
int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst);
|
|
|
|
|
2018-03-27 18:39:10 +02:00
|
|
|
int cw_in_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
2016-04-11 04:00:59 +02:00
|
|
|
|
2018-04-08 16:48:13 +02:00
|
|
|
int cw_in_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
|
|
|
uint8_t * elem_data, int elem_len);
|
|
|
|
|
2018-03-27 07:07:14 +02:00
|
|
|
int cw_out_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst);
|
2018-04-17 07:46:09 +02:00
|
|
|
|
|
|
|
int cw_out_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst);
|
2018-03-27 07:07:14 +02:00
|
|
|
|
2016-03-21 22:30:23 +01:00
|
|
|
extern int cw_in_wtp_reboot_statistics(struct conn *conn, struct cw_action_in *a,
|
|
|
|
uint8_t * data, int len, struct sockaddr *from);
|
2016-03-11 23:45:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
2016-03-21 22:30:23 +01:00
|
|
|
int len, struct sockaddr *from);
|
2016-03-11 23:45:35 +01:00
|
|
|
|
2018-03-09 08:28:11 +01:00
|
|
|
/*
|
2018-03-09 07:44:17 +01:00
|
|
|
int cw_in_vendor_specific_payload(struct cw_ElemHandler *handler,
|
|
|
|
struct cw_ElemHandlerParams *params,
|
|
|
|
uint8_t * data, int len);
|
2018-03-09 08:28:11 +01:00
|
|
|
*/
|
2016-03-04 21:01:38 +01:00
|
|
|
|
2016-03-06 13:34:34 +01:00
|
|
|
extern int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
2016-03-06 16:48:24 +01:00
|
|
|
uint8_t * data, int len,
|
|
|
|
struct sockaddr *from);
|
2016-03-06 19:14:02 +01:00
|
|
|
|
|
|
|
extern int cw_in_capwap_local_ipv4_address(struct conn *conn, struct cw_action_in *a,
|
2016-03-11 23:45:35 +01:00
|
|
|
uint8_t * data, int len,
|
|
|
|
struct sockaddr *from);
|
2016-03-06 19:14:02 +01:00
|
|
|
|
|
|
|
extern int cw_in_capwap_local_ipv6_address(struct conn *conn, struct cw_action_in *a,
|
2016-03-11 23:45:35 +01:00
|
|
|
uint8_t * data, int len,
|
|
|
|
struct sockaddr *from);
|
2016-03-06 19:14:02 +01:00
|
|
|
|
2016-03-11 23:45:35 +01:00
|
|
|
extern int cw_in_radio_operational_state(struct conn *conn, struct cw_action_in *a,
|
|
|
|
uint8_t * data, int len, struct sockaddr *from);
|
2016-03-09 20:15:36 +01:00
|
|
|
|
|
|
|
|
2018-03-09 07:44:17 +01:00
|
|
|
/*
|
|
|
|
int cw_process_element(struct conn * conn,
|
|
|
|
struct cw_MsgData * msgdata, int proto, int vendor,
|
|
|
|
uint8_t * elem, int max_len);
|
|
|
|
*/
|
|
|
|
int cw_process_element(struct cw_ElemHandlerParams *params,
|
|
|
|
int proto, int vendor,int msgid,
|
|
|
|
uint8_t * elem, int max_len);
|
2016-03-12 02:34:07 +01:00
|
|
|
|
2016-03-06 16:52:17 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2016-03-06 16:48:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup CWELEMOUT Output Handlers for Message Elements
|
|
|
|
* @{
|
|
|
|
*/
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-03-13 01:56:44 +01:00
|
|
|
|
2016-03-19 12:57:47 +01:00
|
|
|
|
2016-03-13 09:35:47 +01:00
|
|
|
/**
|
|
|
|
* With this alias for #cw_out_wtp_ip_address we can
|
|
|
|
* can hav more consitent naming, when implement draft 7
|
|
|
|
* specific stuff
|
|
|
|
*/
|
|
|
|
#define cw_out_capwap_local_ip_address_7 cw_out_wtp_ip_address
|
|
|
|
|
2016-03-11 23:45:35 +01:00
|
|
|
|
2018-03-17 16:21:23 +01:00
|
|
|
void cw_init_request(struct conn *conn, int msg_id);
|
|
|
|
|
2016-03-13 01:56:44 +01:00
|
|
|
|
2016-03-06 16:48:24 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2016-03-06 13:34:34 +01:00
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
|
2016-04-02 09:05:07 +02:00
|
|
|
/**
|
|
|
|
* @defgroup CAPWAP_RADIO Radio Operations
|
|
|
|
* @{
|
|
|
|
*/
|
2018-03-17 17:29:09 +01:00
|
|
|
/*
|
2016-04-02 09:05:07 +02:00
|
|
|
extern int cw_radio_set_admin_state(mbag_t radios,int rid, int state, int cause);
|
2018-03-17 17:29:09 +01:00
|
|
|
*/
|
|
|
|
|
2016-04-09 14:19:23 +02:00
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_put_elem_radio_operational_state(uint8_t * dst, int rid, int state, int cause);
|
|
|
|
int cw_put_elem_radio_administrative_state(uint8_t * dst, int rid, int state);
|
2016-04-09 14:19:23 +02:00
|
|
|
|
2016-04-12 09:02:55 +02:00
|
|
|
|
|
|
|
|
2018-04-07 19:28:00 +02:00
|
|
|
int cw_put_local_ip_address(uint8_t *dst, int id, int ipv_id, int ipv6_id,
|
|
|
|
uint8_t *src, int len);
|
|
|
|
|
2018-04-08 00:28:45 +02:00
|
|
|
int cw_detect_nat(struct conn *conn);
|
2018-04-07 19:28:00 +02:00
|
|
|
|
2016-04-10 15:59:35 +02:00
|
|
|
uint8_t *cw_init_data_keep_alive_msg(uint8_t * buffer,uint8_t *rmac);
|
2016-04-02 09:05:07 +02:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
/*int cw_out_radio_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst);*/
|
|
|
|
|
2018-03-02 13:36:03 +01:00
|
|
|
int cw_put_elem_session_id(uint8_t *dst, uint8_t *session_id, int len);
|
2016-04-11 04:17:23 +02:00
|
|
|
|
2018-03-09 15:38:21 +01:00
|
|
|
int cw_result_is_ok( int rc );
|
2018-03-17 16:21:23 +01:00
|
|
|
int cw_put_msg(struct conn *conn, uint8_t * rawout);
|
2016-04-11 04:17:23 +02:00
|
|
|
|
2016-04-02 09:05:07 +02:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2016-03-07 15:41:50 +01:00
|
|
|
|
2016-11-07 07:28:36 +01:00
|
|
|
|
2018-03-07 10:30:40 +01:00
|
|
|
char *cw_strdup(const char *s);
|
2018-04-04 10:59:07 +02:00
|
|
|
int cw_stricmp(char const *a, char const *b);
|
2016-11-07 07:28:36 +01:00
|
|
|
|
2016-03-07 15:41:50 +01:00
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
/**
|
|
|
|
*@}
|
|
|
|
*/
|
2016-02-27 10:50:51 +01:00
|
|
|
|
2018-03-25 11:14:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*@} CAPWAP
|
|
|
|
*/
|
|
|
|
|
2016-02-27 10:50:51 +01:00
|
|
|
#endif
|