Some refactoring + introduction of message_sets

Renamed CW_... to CAPWAP_...

FossilOrigin-Name: fa5322d9f5ca8a145cd828c1179501f50aad0cb6280efb76dc3779b19f2626e8
This commit is contained in:
7u83@mail.ru
2018-02-23 19:14:10 +00:00
parent 40de403b03
commit 096672b0aa
17 changed files with 160 additions and 57 deletions

View File

@ -220,7 +220,11 @@
#define CW_ELEM_DELETE_MAC_ACL_ENTRY 17
#define CW_ELEM_DELETE_STATION 18
#define CW_ELEM_RESERVED_19 19
#define CW_ELEM_DISCOVERY_TYPE 20
/**
* Indicates the AP's Discovery Type
* @see CAPWAPDIscoveryTypes
*/
#define CAPWAP_ELEM_DISCOVERY_TYPE 20
#define CW_ELEM_DUPLICATE_IPV4_ADDRESS 21
#define CW_ELEM_DUPLICATE_IPV6_ADRESS 22
#define CW_ELEM_ECN_SUPPORT 53
@ -239,8 +243,11 @@
#define CW_ELEM_SESSION_ID 35
#define CW_ELEM_STATISTICS_TIMER 36
#define CW_ELEM_VENDOR_SPECIFIC_PAYLOAD 37
#define CW_ELEM_WTP_BOARD_DATA 38
#define CW_ELEM_WTP_DESCRIPTOR 39
#define CAPWAP_ELEM_WTP_BOARD_DATA 38
/**
* The WTP Descriptor message element conteins information
* about the WTP */
#define CAPWAP_ELEM_WTP_DESCRIPTOR 39
#define CW_ELEM_WTP_FALLBACK 40
#define CW_ELEM_WTP_FRAME_TUNNEL_MODE 41
#define CW_ELEM_RESERVED_42 42
@ -662,7 +669,7 @@ struct cw_ac_status {
enum capwap_states {
CW_STATE_NONE = 0,
/** Discovery State */
CW_STATE_DISCOVERY,
CAPWAP_STATE_DISCOVERY,
/** Join State */
CW_STATE_JOIN,
/** Config State */

View File

@ -16,7 +16,7 @@ cw_action_in_t capwap_80211_actions_ac_in[] = {
* Discovery Resquest
*/
{0, 0, CW_STATE_DISCOVERY, CAPWAP_MSG_DISCOVERY_REQUEST,
{0, 0, CAPWAP_STATE_DISCOVERY, CAPWAP_MSG_DISCOVERY_REQUEST,
CW_ACTION_IN_80211_WTP_RADIO_INFORMATION, 1}
,
/* --------------------------------------------------------

View File

@ -13,7 +13,7 @@
cw_action_in_t capwap_80211_actions_wtp_in[] = {
/* Discovery Response */
{0, 0, CW_STATE_DISCOVERY, CAPWAP_MSG_DISCOVERY_RESPONSE,
{0, 0, CAPWAP_STATE_DISCOVERY, CAPWAP_MSG_DISCOVERY_RESPONSE,
CW_ACTION_IN_80211_WTP_RADIO_INFORMATION, 1}
,

View File

@ -25,7 +25,7 @@ struct cw_strlist_elem capwap_strings_elem[] = {
{CW_ELEM_DELETE_MAC_ACL_ENTRY, "Delete MAC ACL Entry"},
{CW_ELEM_DELETE_STATION, "Delete Station"},
{CW_ELEM_RESERVED_19, "Reserved 19"},
{CW_ELEM_DISCOVERY_TYPE, "Discovery Type"},
{CAPWAP_ELEM_DISCOVERY_TYPE, "Discovery Type"},
{CW_ELEM_DUPLICATE_IPV4_ADDRESS, "Duplicate IPv4 Address"},
{CW_ELEM_DUPLICATE_IPV6_ADRESS, "Duplicate IPv6 Address"},
{CW_ELEM_ECN_SUPPORT, "ECN Support"},
@ -44,8 +44,8 @@ struct cw_strlist_elem capwap_strings_elem[] = {
{CW_ELEM_SESSION_ID, "Session ID"},
{CW_ELEM_STATISTICS_TIMER, "Statistics Timer"},
{CW_ELEM_VENDOR_SPECIFIC_PAYLOAD, "Vendor Specific Payload"},
{CW_ELEM_WTP_BOARD_DATA, "WTP Board Data"},
{CW_ELEM_WTP_DESCRIPTOR, "WTP Descriptor"},
{CAPWAP_ELEM_WTP_BOARD_DATA, "WTP Board Data"},
{CAPWAP_ELEM_WTP_DESCRIPTOR, "WTP Descriptor"},
{CW_ELEM_WTP_FALLBACK, "WTP Fallback"},
{CW_ELEM_WTP_FRAME_TUNNEL_MODE, "WTP Frame Tunnel Mode"},
{CW_ELEM_RESERVED_42, "Reserved 42"},

View File

@ -1,7 +1,7 @@
#include "capwap.h"
struct cw_strlist_elem capwap_strings_state[] = {
{ CW_STATE_DISCOVERY, "Discovery" },
{ CAPWAP_STATE_DISCOVERY, "Discovery" },
{ CW_STATE_JOIN,"Join" },
{ CW_STATE_RUN,"Run" },
{ CW_STATE_CONFIGURE,"Configure" },

View File

@ -100,6 +100,40 @@
#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)
typedef struct{
int proto;
int vendor;
int id;
int mand;
}cw_messagedef_t;
typedef struct {
int type;
int * states;
cw_messagedef_t * elements;
}cw_message_t;
typedef struct {
int proto;
int vendor;
int id;
int min_len;
int max_len;
const char * name;
}cw_message_element_t;
typefe struct {
}cw_message_set;
/**
* Get length wireless specific data
* @param th Pointer to packet

View File

@ -105,6 +105,6 @@ printf("Val: %s\n",buf);
}
int l = d - dst-4;
return l + cw_put_elem_hdr(dst, CW_ELEM_WTP_BOARD_DATA, l );
return l + cw_put_elem_hdr(dst, CAPWAP_ELEM_WTP_BOARD_DATA, l );
}

View File

@ -58,7 +58,7 @@ static void wtpinfo_readsubelems_wtp_board_data(struct wtpinfo * wtpinfo,uint8_t
int wtpinfo_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len)
{
if (type!=CW_ELEM_WTP_BOARD_DATA)
if (type!=CAPWAP_ELEM_WTP_BOARD_DATA)
return 0;
if (len<4){
cw_dbg(DBG_ELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len);