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>
|
|
|
|
|
|
|
|
#include "bstr.h"
|
2016-02-27 10:50:51 +01:00
|
|
|
#include "mbag.h"
|
|
|
|
#include "conn.h"
|
|
|
|
#include "action.h"
|
|
|
|
|
2016-03-04 20:23:32 +01:00
|
|
|
#include "lw.h"
|
2016-02-27 14:25:32 +01:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline int cw_put_version(uint8_t * dst, uint16_t subelem_id, bstrv_t v)
|
|
|
|
{
|
|
|
|
uint8_t *d = dst;
|
|
|
|
d += cw_put_dword(d, bstrv_get_vendor_id(v));
|
|
|
|
d += cw_put_dword(d, (subelem_id << 16) | bstrv_len(v));
|
|
|
|
d += cw_put_data(d, bstrv_data(v), bstrv_len(v));
|
|
|
|
return d - dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
2016-03-05 14:12:49 +01:00
|
|
|
struct cw_action_in *a, uint8_t * data, int len);
|
2016-03-04 21:01:38 +01:00
|
|
|
|
|
|
|
extern int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
|
|
|
struct cw_action_in *a, uint8_t * data, int len);
|
|
|
|
|
2016-03-05 14:12:49 +01:00
|
|
|
extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, int len);
|
2016-03-04 21:01:38 +01:00
|
|
|
|
|
|
|
|
2016-03-05 14:12:49 +01:00
|
|
|
extern int cw_in_check_generic_resp(struct conn *conn, struct cw_action_in *a,
|
|
|
|
uint8_t * data, int len, struct sockaddr *from);
|
2016-03-04 21:01:38 +01:00
|
|
|
|
|
|
|
|
2016-03-06 16:52:17 +01:00
|
|
|
/**
|
|
|
|
* @defgroup CWELEMIN Input Handlers for Message Elements
|
|
|
|
* @{
|
|
|
|
*/
|
2016-03-05 22:32:52 +01:00
|
|
|
extern int cw_in_vendor_specific_payload(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-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,
|
|
|
|
uint8_t * data, int len,struct sockaddr *from);
|
|
|
|
|
|
|
|
extern int cw_in_capwap_local_ipv6_address(struct conn *conn, struct cw_action_in *a,
|
|
|
|
uint8_t * data, int len,struct sockaddr *from);
|
|
|
|
|
2016-03-06 16:52:17 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2016-03-06 16:48:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup CWELEMOUT Output Handlers for Message Elements
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
extern int cw_out_capwap_local_ip_address(struct conn *conn, struct cw_action_out *action,
|
|
|
|
uint8_t * dst);
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2016-03-06 13:34:34 +01:00
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
|
2016-03-07 15:41:50 +01:00
|
|
|
/**
|
|
|
|
*@defgroup CAPWAP CAPWAP
|
|
|
|
*@{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CAWAP States
|
|
|
|
*/
|
|
|
|
enum capwap_states {
|
|
|
|
CW_STATE_NONE = 0,
|
|
|
|
/** Discovery State */
|
|
|
|
CW_STATE_DISCOVERY,
|
|
|
|
/** Join State */
|
|
|
|
CW_STATE_JOIN,
|
|
|
|
/** Config State */
|
|
|
|
CW_STATE_CONFIGURE,
|
|
|
|
/** Image Data Upload */
|
|
|
|
CW_STATE_IMAGE_DATA,
|
|
|
|
CW_STATE_UPDATE,
|
|
|
|
/** Run State */
|
|
|
|
CW_STATE_RUN
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
*@}
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-04 19:37:02 +01:00
|
|
|
/**
|
|
|
|
*@}
|
|
|
|
*/
|
2016-02-27 10:50:51 +01:00
|
|
|
|
|
|
|
#endif
|