More WTP functions.
FossilOrigin-Name: d911169da02fad41102ebdbd34b7533d78a39bb3c452d4174269ba7e3c825c53
This commit is contained in:
parent
f1feb4bc0d
commit
2ac7210734
9
INSTALL
9
INSTALL
@ -1,6 +1,15 @@
|
||||
pre-requisites
|
||||
--------------
|
||||
|
||||
On a fresh Ubuntu 14.04:
|
||||
|
||||
apt-get install git
|
||||
git clone https://github.com/7u83/actube.git
|
||||
apt-get install build-essential
|
||||
|
||||
|
||||
|
||||
|
||||
libcapwap:
|
||||
|
||||
gnutls (http://www.gnutls.org/)
|
||||
|
@ -106,6 +106,40 @@ AP = RAD = WTP
|
||||
containing a TIM element whose DTIM Count field is 0. This value
|
||||
is transmitted in the DTIM Period field of Beacon frames.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
54. Cisco AP Mode and Type
|
||||
|
||||
The AP Mode and Type message element is used to configure a WTP to
|
||||
operate in a specific mode.
|
||||
|
||||
0 1
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Mode | Type |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
Type: 54 for AP Mode and Type
|
||||
|
||||
Length: 2
|
||||
|
||||
Mode: An 8-bit value describing the type of information being sent.
|
||||
The following values are supported:
|
||||
|
||||
0 - Split MAC / Local Mode
|
||||
1 - Monitor
|
||||
2 - Local MAC / FlexConnect
|
||||
3 - Rogue Detector
|
||||
4 - Sniffer
|
||||
|
||||
Type: AP Type
|
||||
|
||||
0 - ?
|
||||
4 - ?
|
||||
|
||||
|
||||
|
||||
|
||||
83. Cisco AP IP Address
|
||||
@ -168,6 +202,10 @@ AP = RAD = WTP
|
||||
containing the AC name, whose maximum size MUST NOT exceed 512
|
||||
bytes.
|
||||
|
||||
108. Cisco Mesh Stats
|
||||
|
||||
|
||||
|
||||
125. SPAM AP LED State
|
||||
0
|
||||
0 1 2 3 4 5 6 7
|
||||
@ -245,12 +283,17 @@ AP = RAD = WTP
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| ANT Type | Reserved | AP Type | Join Priority |
|
||||
| ANT Type | FlexConnect | AP Type | Join Priority |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 207
|
||||
Length: 4
|
||||
|
||||
FlexConnect:
|
||||
00 = FlexConnect not supported
|
||||
01 = FlexConnect supported
|
||||
|
||||
|
||||
|
||||
208. Cisco MWAR Type
|
||||
|
||||
@ -302,7 +345,6 @@ Length: 4
|
||||
|
||||
|
||||
|
||||
|
||||
254. Cisco SPAM AP LED Flash Config
|
||||
|
||||
|
||||
@ -353,35 +395,14 @@ Vendor spec CAPWAP | Vedor spec LWAPP | Vendor specific LWAPP data
|
||||
Length: 2
|
||||
|
||||
|
||||
67. AP Submode (LWAPP)
|
||||
0
|
||||
0 1 2 3 4 5 6 7
|
||||
+-+-+-+-+-+-+-+-+
|
||||
| Submode |
|
||||
+-+-+-+-+-+-+-+-+
|
||||
|
||||
54. Cisco AP Mode and Type (LWAPP)
|
||||
|
||||
The AP Mode and Type message element is used to configure a WTP to
|
||||
operate in a specific mode.
|
||||
|
||||
0 1
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Mode | Type |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
Type: 54 for AP Mode and Type
|
||||
|
||||
Length: 2
|
||||
|
||||
Mode: An 8-bit value describing the type of information being sent.
|
||||
The following values are supported:
|
||||
|
||||
0 - Split MAC / Local Mode
|
||||
1 - Monitor
|
||||
2 - Local MAC / FlexConnect
|
||||
3 - Rogue Detector
|
||||
4 - Sniffer
|
||||
|
||||
Type: AP Type
|
||||
|
||||
0 - ?
|
||||
Type: 67
|
||||
|
||||
|
||||
|
||||
|
@ -163,6 +163,7 @@ int main (int argc, const char * argv[])
|
||||
DBGX("Attention! %s","DBGX is ON!");
|
||||
|
||||
cw_register_actions_cipwap_ac(&capwap_actions);
|
||||
//cw_register_actions_capwap_80211_ac(&capwap_actions);
|
||||
|
||||
|
||||
/*
|
||||
@ -177,13 +178,12 @@ int main (int argc, const char * argv[])
|
||||
|
||||
ac_global_init();
|
||||
|
||||
/*
|
||||
db_init();
|
||||
db_start();
|
||||
db_ping();
|
||||
pthread_t alth;
|
||||
pthread_create (&alth, NULL, alive_thread, (void *)0);
|
||||
*/
|
||||
|
||||
int rc=0;
|
||||
dtls_init();
|
||||
if (!socklist_init())
|
||||
|
@ -110,7 +110,7 @@ static void wtpman_run_discovery(void *arg)
|
||||
|
||||
struct conn * conn = wtpman->conn;
|
||||
|
||||
conn->strict_capwap=1;
|
||||
conn->strict_capwap=0;
|
||||
conn->strict_hdr=1;
|
||||
|
||||
conn->capwap_mode=CW_MODE_CIPWAP;
|
||||
@ -302,7 +302,7 @@ static int wtpman_join(void *arg, time_t timer)
|
||||
|
||||
struct conn * conn = wtpman->conn;
|
||||
|
||||
conn->strict_capwap=1;
|
||||
conn->strict_capwap=0;
|
||||
conn->strict_hdr=1;
|
||||
conn->capwap_mode=CW_MODE_CIPWAP;
|
||||
|
||||
@ -414,7 +414,6 @@ static void wtpman_run(void *arg)
|
||||
|
||||
/* here the WTP has joined, now we assume an image data request
|
||||
or an configuration status request. Nothing else.
|
||||
State is Image update
|
||||
*/
|
||||
|
||||
int rc = 0;
|
||||
|
@ -325,6 +325,8 @@ CWACTION=action.o \
|
||||
cw_in_generic.o \
|
||||
cw_in_wtp_descriptor.o \
|
||||
cw_out_wtp_board_data.o \
|
||||
cw_out_ac_name_with_priority.o \
|
||||
cw_in_ac_name_with_priority.o \
|
||||
cw_out_image_data.o \
|
||||
cipwap_actions_ac.o \
|
||||
cipwap_actions_wtp.o \
|
||||
@ -357,7 +359,7 @@ O:=$(OBJS);
|
||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||
|
||||
CFLAGS = -Werror -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include
|
||||
#CFLAGS = -Wall -O3 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
||||
#CFLAGS = -Wall -Os -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
||||
|
||||
CFLAGS += $(GNUTLS_CFLAGS) \
|
||||
-DWITH_CW_LOG \
|
||||
|
@ -39,9 +39,18 @@ static void acprio_del(void *d)
|
||||
cw_acprio_t *p = (cw_acprio_t*)d;
|
||||
if ( p->name )
|
||||
free (p->name);
|
||||
// if ( p->addr )
|
||||
// free(p->addr);
|
||||
free(d);
|
||||
}
|
||||
|
||||
const struct mbag_typedef mbag_type_acprio = {
|
||||
acprio_del
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
cw_acpriolist_t cw_acpriolist_create()
|
||||
{
|
||||
return mavl_create(acprio_cmp, acprio_del);
|
||||
|
@ -2,13 +2,21 @@
|
||||
#define __ACIPRIORITYLIST_H
|
||||
|
||||
#include "mavl.h"
|
||||
#include "mbag.h"
|
||||
//#include "mavl.h"
|
||||
|
||||
struct cw_acprio{
|
||||
char *name;
|
||||
struct sockaddr_storage * addr;
|
||||
uint8_t prio;
|
||||
};
|
||||
|
||||
extern const struct mbag_typedef mbag_type_acprio;
|
||||
|
||||
#define MBAG_ACPRIO (&mbag_type_acprio)
|
||||
|
||||
|
||||
|
||||
typedef struct cw_acprio cw_acprio_t;
|
||||
typedef struct mavl * cw_acpriolist_t;
|
||||
|
||||
|
@ -273,7 +273,7 @@ CW_MSG_MAXMSG = 26
|
||||
#define CW_ELEM_LOCATION_DATA 28
|
||||
#define CWMSGELEM_MAXIMUM_MESSAGE_LENGTH 29
|
||||
#define CWMSGELEM_MTU_DISCOVERY_PADDING 52
|
||||
#define CWMSGELEM_RADIO_ADMINISTRATIVE_STATE 31
|
||||
#define CW_ELEM_RADIO_ADMINISTRATIVE_STATE 31
|
||||
#define CW_ELEM_RADIO_OPERATIONAL_STATE 32
|
||||
#define CW_ELEM_RESULT_CODE 33
|
||||
#define CW_ELEM_RETURNED_MESSAGE_ELEMENT 34
|
||||
@ -1101,9 +1101,18 @@ struct mbag_item *cw_out_get_config(struct conn *conn, struct cw_action_out *a);
|
||||
extern int cw_in_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from);
|
||||
|
||||
int cw_out_ac_name_with_priority(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||
|
||||
int cw_send_request(struct conn *conn, int msg_id);
|
||||
int cw_is_utf8(unsigned char *str, size_t len);
|
||||
|
||||
int cw_in_ac_name_with_priority(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from);
|
||||
|
||||
int cw_out_radio_administrative_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||
|
||||
int cw_in_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -121,7 +121,7 @@
|
||||
|
||||
#define CW_ACTION_IN_CAPWAP_CONTROL_IPV6_ADDRESS \
|
||||
CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID*/ \
|
||||
cw_in_capwap_control_iv4p_address, 0, /* start/end callback */ \
|
||||
cw_in_capwap_control_ipv4_address, 0, /* start/end callback */ \
|
||||
MBAG_AVLTREE, /* Type of element */ \
|
||||
CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, /* ID to use store */ \
|
||||
18,18 /* min/max length */
|
||||
@ -157,6 +157,16 @@
|
||||
CW_ITEM_IDLE_TIMEOUT, /* ID to use store */ \
|
||||
4, 4 /* min/max length */
|
||||
|
||||
|
||||
#define CW_ACTION_IN_AC_NAME_WITH_PRIORITY \
|
||||
CW_ELEM_IDLE_TIMEOUT, /* Element ID*/ \
|
||||
cw_in_generic, 0, /* start/end callback */ \
|
||||
MBAG_DWORD, /* Type of element */ \
|
||||
CW_ITEM_IDLE_TIMEOUT, /* ID to use store */ \
|
||||
4, 4 /* min/max length */
|
||||
|
||||
|
||||
|
||||
#define CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE \
|
||||
CW_ELEM_RADIO_ADMINISTRATIVE_STATE, /* Element ID*/ \
|
||||
cw_in_radio_administrative_state, 0, /* start/end callback */ \
|
||||
|
@ -59,6 +59,11 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
1}
|
||||
,
|
||||
|
||||
/* Element WTP Board Data */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA,
|
||||
1}
|
||||
,
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
||||
@ -96,7 +101,7 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
|
||||
/* Message: Configuration Status Request */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST, 0,
|
||||
0, cw_in_check_join_req}
|
||||
0, 0}
|
||||
,
|
||||
/* Element: AC Name */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
@ -112,17 +117,11 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
CW_ACTION_IN_WTP_REBOOT_STATISTICS, 1}
|
||||
,
|
||||
|
||||
|
||||
/* Element Vendor Specific Payload */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
|
||||
,
|
||||
|
||||
/* Element WTP Board Data */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA,
|
||||
1}
|
||||
,
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
||||
@ -135,6 +134,21 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
0}
|
||||
,
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
||||
/* Message: Change State Request - in Config State */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_REQUEST, 0,
|
||||
0, 0}
|
||||
,
|
||||
|
||||
/* Element: Result Code */
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_REQUEST,
|
||||
CW_ACTION_IN_RESULT_CODE, 1}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
||||
/* Message Image Data Response IN */
|
||||
@ -239,6 +253,12 @@ cw_action_out_t capwap_actions_ac_out[] = {
|
||||
,
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Change State Event Response OUT
|
||||
*/
|
||||
|
||||
{CW_MSG_CHANGE_STATE_EVENT_RESPONSE, CW_ITEM_NONE}
|
||||
,
|
||||
|
||||
|
||||
|
||||
|
@ -39,23 +39,28 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
||||
CW_ACTION_IN_AC_DESCRIPTOR, 1}
|
||||
,
|
||||
|
||||
/* Element: AC Name */
|
||||
/* AC Name */
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_RESPONSE,
|
||||
CW_ACTION_IN_AC_NAME, 1}
|
||||
,
|
||||
|
||||
/* Element CAPWAP Control IPv4 Address */
|
||||
/* CAPWAP Control IPv4 Address */
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_RESPONSE,
|
||||
CW_ACTION_IN_CAPWAP_CONTROL_IPV4_ADDRESS, 1}
|
||||
,
|
||||
|
||||
/* CAPWAP Control IPv6 Address */
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_RESPONSE,
|
||||
CW_ACTION_IN_CAPWAP_CONTROL_IPV6_ADDRESS, 1}
|
||||
,
|
||||
|
||||
/* Element: Vendor Specific */
|
||||
/* Vendor Specific Payload*/
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_RESPONSE,
|
||||
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD, 0}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
||||
/* Message Join Response */
|
||||
@ -63,16 +68,21 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
||||
0, cw_in_check_join_resp }
|
||||
,
|
||||
|
||||
/* Element: Vendor Specific */
|
||||
/* AC Descriptor */
|
||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
||||
CW_ACTION_IN_RESULT_CODE, 1}
|
||||
CW_ACTION_IN_AC_DESCRIPTOR, 1}
|
||||
,
|
||||
|
||||
/* Element: AC Name */
|
||||
/* AC Name */
|
||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
||||
CW_ACTION_IN_AC_NAME, 1}
|
||||
,
|
||||
|
||||
/* Vendor Specific */
|
||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
||||
CW_ACTION_IN_RESULT_CODE, 1}
|
||||
,
|
||||
|
||||
|
||||
|
||||
|
||||
@ -120,6 +130,8 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
||||
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD, 0}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
||||
/* Message Change State Response IN */
|
||||
@ -135,10 +147,15 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
||||
|
||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
CW_ACTION_IN_CAPWAP_TIMERS, 0}
|
||||
|
||||
,
|
||||
|
||||
|
||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE, 0}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* Element: Vendor Specific */
|
||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD, 0}
|
||||
@ -151,6 +168,9 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
||||
0,0 }
|
||||
,
|
||||
|
||||
|
||||
|
||||
|
||||
/* Element: Vendor Specific */
|
||||
{0, 0, CW_STATE_RUN, CW_MSG_ECHO_RESPONSE,
|
||||
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD, 0}
|
||||
@ -226,12 +246,12 @@ cw_action_out_t capwap_actions_wtp_out[] = {
|
||||
|
||||
/* WTP MAC Type */
|
||||
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_MAC_TYPE, 0,
|
||||
CW_ELEM_WTP_MAC_TYPE, NULL,cw_out_generic, cw_out_get_local,1}
|
||||
CW_ELEM_WTP_MAC_TYPE, NULL,cw_out_generic, cw_out_get_config,1}
|
||||
,
|
||||
|
||||
/* WTP MAC Type */
|
||||
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_FRAME_TUNNEL_MODE, 0,
|
||||
CW_ELEM_WTP_FRAME_TUNNEL_MODE, NULL,cw_out_generic, cw_out_get_local,1}
|
||||
CW_ELEM_WTP_FRAME_TUNNEL_MODE, NULL,cw_out_generic, cw_out_get_config,1}
|
||||
,
|
||||
|
||||
/* Session ID */
|
||||
@ -251,7 +271,7 @@ cw_action_out_t capwap_actions_wtp_out[] = {
|
||||
CW_ELEM_IMAGE_IDENTIFIER, NULL,cw_out_generic, cw_out_get_outgoing,0}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Image Data Response OUT
|
||||
*/
|
||||
@ -275,6 +295,19 @@ cw_action_out_t capwap_actions_wtp_out[] = {
|
||||
CW_ELEM_AC_NAME, NULL, cw_out_generic, cw_out_get_local,1}
|
||||
,
|
||||
|
||||
/* AC Name with Priority */
|
||||
{CW_MSG_CONFIGURATION_STATUS_REQUEST, CW_ITEM_AC_NAME_WITH_PRIORITY, 0,
|
||||
CW_ELEM_AC_NAME_WITH_PRIORITY, NULL, cw_out_ac_name_with_priority, cw_out_get_config,1}
|
||||
,
|
||||
|
||||
/* Radio Admin State */
|
||||
{CW_MSG_CONFIGURATION_STATUS_REQUEST, CW_ITEM_RADIO_ADMINISTRATIVE_STATE, 0,
|
||||
CW_ELEM_RADIO_ADMINISTRATIVE_STATE, NULL, cw_out_radio_administrative_states, cw_out_get_config,1}
|
||||
,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
|
@ -209,6 +209,10 @@ int cw_in_check_cipwap_join_req(struct conn *conn, struct cw_action_in *a, uint8
|
||||
|
||||
int cw_out_cisco_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||
|
||||
int cw_in_cisco_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
#define cw_addelem_cisco_rad(dst,acinfo)\
|
||||
|
@ -27,6 +27,7 @@ enum capwap_items {
|
||||
CW_ITEM_WTP_BOARD_DATA,
|
||||
CW_ITEM_WTP_DESCRIPTOR,
|
||||
CW_ITEM_CAPWAP_TIMERS,
|
||||
CW_ITEM_RADIO_ADMINISTRATIVE_STATE,
|
||||
|
||||
CW_ITEM_AC_NAME,
|
||||
CW_ITEM_AC_DESCRIPTOR,
|
||||
@ -47,6 +48,8 @@ enum capwap_items {
|
||||
CW_ITEM_WTP_REBOOT_STATISTICS,
|
||||
CW_ITEM_IMAGE_IDENTIFIER,
|
||||
CW_ITEM_AC_HASH_VALUE,
|
||||
|
||||
CW_ITEM_AC_NAME_WITH_PRIORITY,
|
||||
|
||||
|
||||
|
||||
@ -58,12 +61,15 @@ enum capwap_items {
|
||||
CW_ITEM_AC_IMAGE_DIR, /* Path where WTP images are stored */
|
||||
CW_ITEM_IMAGE_FILENAME, /* Full path of image filename */
|
||||
CW_ITEM_DISCOVERIES,
|
||||
CW_ITEM_AC_PRIO_LIST, /* AC Name with Priority list */
|
||||
|
||||
/** FILE handle for uploading and downloading images */
|
||||
CW_ITEM_IMAGE_FILEHANDLE,
|
||||
|
||||
CW_ITEM_RADIO_CFG,
|
||||
CW_ITEM_AP_MODE_AND_TYPE,
|
||||
|
||||
CW_ITEM_CISCO_BOARD_DATA_OPTIONS,
|
||||
CW_ITEM_RADIOS
|
||||
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ struct cw_str capwap_strings_elem[] = {
|
||||
{CW_ELEM_ADD_STATION, "Add Station"},
|
||||
{CW_ELEM_RESERVED_9, "Reserved 9"},
|
||||
{CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, "Control IPv4 Address"},
|
||||
{CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, "Controll IPv6 Address"},
|
||||
{CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, "Control IPv6 Address"},
|
||||
{CW_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS, "CAWPAP Local IPv4 Address"},
|
||||
{CW_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS, "CAPWAP Local IPv6 Address"},
|
||||
{CW_ELEM_CAPWAP_TIMERS, "CAPWAP Timers"},
|
||||
@ -37,7 +37,7 @@ struct cw_str capwap_strings_elem[] = {
|
||||
{CW_ELEM_LOCATION_DATA, "Location Data"},
|
||||
{CWMSGELEM_MAXIMUM_MESSAGE_LENGTH, "Maximum Message Length"},
|
||||
{CWMSGELEM_MTU_DISCOVERY_PADDING, "MTU Discovery Padding"},
|
||||
{CWMSGELEM_RADIO_ADMINISTRATIVE_STATE, "Radio Administrative State"},
|
||||
{CW_ELEM_RADIO_ADMINISTRATIVE_STATE, "Radio Administrative State"},
|
||||
{CW_ELEM_RADIO_OPERATIONAL_STATE, "Radio Operational State"},
|
||||
{CW_ELEM_RESULT_CODE, "Result Code"},
|
||||
{CW_ELEM_RETURNED_MESSAGE_ELEMENT, "Returned Message Element"},
|
||||
|
@ -24,7 +24,7 @@
|
||||
8,1028
|
||||
|
||||
/* For CIPWAP we allow a
|
||||
Session ID with 4 .. 16 bytes length */
|
||||
Session ID with 2 ... 16 bytes length */
|
||||
#define CW_ACTION_IN_CIPWAP_SESSION_ID \
|
||||
CW_ELEM_SESSION_ID, /* Element ID*/ \
|
||||
cw_in_generic, 0, /* start/end callback */ \
|
||||
|
@ -24,10 +24,16 @@
|
||||
#include "capwap_cisco.h"
|
||||
#include "strheap.h"
|
||||
|
||||
|
||||
#include "cipwap_actions.h"
|
||||
|
||||
cw_action_in_t cipwap_actions_wtp_in[] = {
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Configuration Update Request IN
|
||||
*/
|
||||
|
||||
{CW_VENDOR_ID_CISCO, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_CISCO_RAD_NAME,
|
||||
cw_in_generic, 0, MBAG_BSTR16,CW_ITEM_WTP_NAME,0,512}
|
||||
,
|
||||
@ -35,8 +41,35 @@ cw_action_in_t cipwap_actions_wtp_in[] = {
|
||||
cw_in_generic, 0, MBAG_BSTR16,CW_ITEM_LOCATION_DATA,0,512}
|
||||
,
|
||||
|
||||
{CW_VENDOR_ID_CISCO, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_CISCO_AC_NAME_WITH_INDEX,
|
||||
cw_in_ac_name_with_priority, 0, MBAG_BSTR16,CW_ITEM_AC_NAME_WITH_PRIORITY,0,512}
|
||||
,
|
||||
|
||||
|
||||
{CW_VENDOR_ID_CISCO, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
CW_ACTION_IN_CISCO_AP_MODE_AND_TYPE,
|
||||
1}
|
||||
,
|
||||
|
||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
CW_ACTION_IN_CISCO_RADIO_ADMINISTRATIVE_STATE, 0}
|
||||
,
|
||||
|
||||
|
||||
|
||||
{CW_VENDOR_ID_CISCO, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_CISCO_AP_GROUP_NAME,
|
||||
cw_in_generic, 0, MBAG_BSTR16,CW_ITEM_WTP_GROUP_NAME,1,512}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Configuration Status Response IN
|
||||
*/
|
||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE, 0}
|
||||
,
|
||||
|
||||
|
||||
|
||||
{0, 0, 0}
|
||||
@ -54,19 +87,35 @@ cw_action_out_t cipwap_actions_wtp_out[] = {
|
||||
/* Cisco AP Groupname - Important to get the WTP a DTLS
|
||||
connection established*/
|
||||
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_WTP_GROUP_NAME, CW_VENDOR_ID_CISCO,
|
||||
CW_CISCO_AP_GROUP_NAME, NULL,cw_out_generic, cw_out_get_local, 0}
|
||||
CW_CISCO_AP_GROUP_NAME, NULL,cw_out_generic, cw_out_get_config, 0}
|
||||
,
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Join Request OUT
|
||||
*/
|
||||
|
||||
{CW_MSG_JOIN_REQUEST, CW_ITEM_CISCO_BOARD_DATA_OPTIONS, CW_VENDOR_ID_CISCO,
|
||||
CW_CISCO_BOARD_DATA_OPTIONS, NULL,cw_out_generic, cw_out_get_config, 1}
|
||||
,
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Configuration Status Request OUT
|
||||
*/
|
||||
|
||||
|
||||
/* Cisco AP Groupname - Important to get the WTP a DTLS
|
||||
connection established*/
|
||||
{CW_MSG_CONFIGURATION_STATUS_REQUEST, CW_ITEM_RADIO_CFG, CW_VENDOR_ID_CISCO,
|
||||
CW_CISCO_AP_GROUP_NAME, NULL,cw_out_cisco_wtp_radio_cfg, cw_out_get_local, 1}
|
||||
CW_CISCO_AP_GROUP_NAME, NULL,cw_out_cisco_wtp_radio_cfg, cw_out_get_config, 1}
|
||||
,
|
||||
|
||||
{CW_MSG_CONFIGURATION_STATUS_REQUEST, CW_ITEM_AP_MODE_AND_TYPE, CW_VENDOR_ID_CISCO,
|
||||
CW_CISCO_AP_MODE_AND_TYPE, NULL,cw_out_generic, cw_out_get_config, 1}
|
||||
,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// {CW_MSG_DISCOVERY_REQUEST, CW_ITEM_NONE}
|
||||
|
@ -75,7 +75,7 @@ int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_i
|
||||
continue;
|
||||
|
||||
int i = ai->item_id;
|
||||
void * rc = avltree_del(conn->mand,&i);
|
||||
void * rc = mavl_get(conn->mand,&i);
|
||||
if (!rc) {
|
||||
out[n++]=ai;
|
||||
}
|
||||
|
@ -15,12 +15,15 @@ int cw_in_check_join_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
||||
|
||||
/* Check for mandatory elements */
|
||||
int n = cw_check_missing_mand(mlist,conn,a);
|
||||
if (n) {
|
||||
cw_dbg_missing_mand(DBG_ELEM,conn,mlist,n,a);
|
||||
if (n && conn->strict_capwap) {
|
||||
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
|
||||
conn->capwap_state=CW_STATE_JOIN;
|
||||
errno=EAGAIN;
|
||||
return -1; //CW_RESULT_MISSING_MAND_ELEM;
|
||||
}
|
||||
if (n){
|
||||
cw_dbg_missing_mand(DBG_RFC,conn,mlist,n,a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -7,13 +7,3 @@
|
||||
|
||||
|
||||
|
||||
int cw_in_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
int rid = cw_get_byte(data);
|
||||
|
||||
mbag_get_mbag(conn->radios,rid,NULL);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -19,6 +19,14 @@ int cw_put_elem_radio_info(uint8_t*dst,int radio_id,mbag_t radio)
|
||||
|
||||
}
|
||||
|
||||
|
||||
int cw_put_elem_radio_administrative_state(uint8_t *dst,int radio_id,mbag_t radio)
|
||||
{
|
||||
cw_put_byte(dst+4,radio_id);
|
||||
cw_put_byte(dst+5,mbag_get_byte(radio,CW_RADIO_ADMIN_STATE,9));
|
||||
return 2 + cw_put_elem_hdr(dst,CW_ELEM_RADIO_ADMINISTRATIVE_STATE,2);
|
||||
}
|
||||
|
||||
int cw_out_radio_infos(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
int l=0;
|
||||
@ -34,3 +42,61 @@ int cw_out_radio_infos(struct conn *conn, struct cw_action_out *a, uint8_t * dst
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
int cw_out_radio_administrative_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
int l=0;
|
||||
MAVLITER_DEFINE(it,conn->radios);
|
||||
mavliter_foreach(&it){
|
||||
struct mbag_item *i = mavliter_get(&it);
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->id,i->data);
|
||||
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int set_radio_admin_state(mbag_t radios,int rid,int state)
|
||||
{
|
||||
|
||||
mbag_t radio = mbag_get_mbag(radios,rid,NULL);
|
||||
if (!radio){
|
||||
cw_dbg(DBG_ELEM_ERR,"Can't set radio administrative state for radio %d - radio does't exists",rid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mbag_set_byte(radio,CW_RADIO_ADMIN_STATE,state);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cw_in_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
int rid = cw_get_byte(data);
|
||||
int state = cw_get_byte(data+1);
|
||||
return set_radio_admin_state(conn->radios,rid,state);
|
||||
}
|
||||
|
||||
|
||||
int cw_in_cisco_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
|
||||
int rid = cw_get_byte(data);
|
||||
int state = cw_get_byte(data+1);
|
||||
if (rid != 255)
|
||||
return set_radio_admin_state(conn->radios,rid,state);
|
||||
|
||||
|
||||
MAVLITER_DEFINE(it,conn->radios);
|
||||
mavliter_foreach(&it){
|
||||
mbag_item_t *i = mavliter_get(&it);
|
||||
mbag_set_byte(i->data,CW_RADIO_ADMIN_STATE,state);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ const struct mbag_typedef mbag_type_const_data = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
const struct mbag_typedef mbag_type_bstr = {
|
||||
free
|
||||
};
|
||||
@ -77,6 +75,21 @@ static void mbag_del_fun(void *e)
|
||||
}
|
||||
|
||||
|
||||
static void strmbag_del_fun(void *e)
|
||||
{
|
||||
|
||||
mbag_del_data(e);
|
||||
free(e);
|
||||
}
|
||||
|
||||
|
||||
static int strmbag_cmp_fun(const void *x1, const void *x2)
|
||||
{
|
||||
return strcmp(( (struct mbag_item *) x1)->name , ((struct mbag_item *) x2)->name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int mbag_cmp_fun(const void *x1, const void *x2)
|
||||
{
|
||||
return ((struct mbag_item *) x1)->id - ((struct mbag_item *) x2)->id;
|
||||
@ -87,11 +100,19 @@ mbag_t mbag_create()
|
||||
return mavl_create(mbag_cmp_fun, mbag_del_fun);
|
||||
}
|
||||
|
||||
|
||||
mbag_t strmbag_create()
|
||||
{
|
||||
return mavl_create(strmbag_cmp_fun, strmbag_del_fun);
|
||||
|
||||
}
|
||||
|
||||
struct mbag_item *mbag_item_create(mbag_t s, uint32_t id)
|
||||
{
|
||||
struct mbag_item is;
|
||||
is.id = id;
|
||||
|
||||
|
||||
struct mbag_item *i = mavl_get(s, &is);
|
||||
if (i) {
|
||||
mbag_del_data(i);
|
||||
@ -106,5 +127,23 @@ struct mbag_item *mbag_item_create(mbag_t s, uint32_t id)
|
||||
}
|
||||
|
||||
|
||||
struct mbag_item *strmbag_item_create(mbag_t s, char *name)
|
||||
{
|
||||
struct mbag_item is;
|
||||
is.name = name;
|
||||
|
||||
|
||||
struct mbag_item *i = mavl_get(s, &is);
|
||||
if (i) {
|
||||
mbag_del_data(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
i = malloc(sizeof(struct mbag_item));
|
||||
if (!i)
|
||||
return NULL;
|
||||
i->name = name;
|
||||
return mavl_add(s, i);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,10 @@ typedef const struct mbagtype_def * mbagtype_t;
|
||||
|
||||
|
||||
struct mbag_item{
|
||||
uint32_t id;
|
||||
union {
|
||||
uint32_t id;
|
||||
char *name;
|
||||
};
|
||||
const struct mbag_typedef * type;
|
||||
union {
|
||||
void *data;
|
||||
@ -88,6 +91,7 @@ extern const struct mbag_typedef mbag_type_const_data;
|
||||
extern mbag_t mbag_create();
|
||||
|
||||
extern struct mbag_item *mbag_item_create(mbag_t s, uint32_t id);
|
||||
extern struct mbag_item *strmbag_item_create(mbag_t s, char *name);
|
||||
|
||||
|
||||
|
||||
@ -172,6 +176,7 @@ static inline mbag_item_t *mbag_get(mbag_t s, uint32_t id)
|
||||
{
|
||||
mbag_item_t i;
|
||||
i.id = id;
|
||||
i.type=0;
|
||||
return mavl_get(s, &i);
|
||||
}
|
||||
|
||||
@ -179,6 +184,7 @@ static inline void mbag_del(mbag_t s,uint32_t id)
|
||||
{
|
||||
mbag_item_t i;
|
||||
i.id = id;
|
||||
i.type=0;
|
||||
mavl_del(s, &i);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ enum radiodata{
|
||||
CW_RADIO_OCCUPANCY_LIMIT,
|
||||
CW_RADIO_CFP_PERIOD,
|
||||
CW_RADIO_CFP_MAX_DURATION
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
@ -20,8 +20,8 @@ ifndef ARCH
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS += -O0 -Wall -g
|
||||
#CFLAGS += -Os -Wall
|
||||
#CFLAGS += -O0 -Wall -g
|
||||
CFLAGS += -Os -Wall
|
||||
LDFLAGS += -L../contrib/jsmn -L../../src/capwap/$(ARCH)
|
||||
|
||||
|
||||
|
884
src/wtp/cfg.c
884
src/wtp/cfg.c
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,10 @@
|
||||
{
|
||||
"idle_timeout":"300",
|
||||
"wtp_name":"Kaffe-Point22",
|
||||
"wtp_name":"Kaffe-Point",
|
||||
"wtp_mac_type":"1",
|
||||
"wtp_frame_tunnel_mode":"4",
|
||||
"hardware_version":["4232704",".x01000000"],
|
||||
"software_version":["4232704",".x08006e00"],
|
||||
"software_version":["4232704",".x08007300"],
|
||||
"wtp_board_data":{
|
||||
"vendor_id":"4232704",
|
||||
"model_no":"AIR-LAP1131AG-E-K9",
|
||||
@ -16,5 +18,20 @@
|
||||
"fe80::219:dbff:fee0:9327"
|
||||
],
|
||||
"location_data":"Germany",
|
||||
"ac_name_with_priority":{
|
||||
"":"2",
|
||||
"Master AC":"1"
|
||||
},
|
||||
"wtp_group_name":"tobias",
|
||||
"ap_mode_and_type":"512",
|
||||
"wtp_board_data_options":".x00010000",
|
||||
"radios":{
|
||||
"0":{
|
||||
"admin_state":"2"
|
||||
},
|
||||
"1":{
|
||||
"admin_state":"2"
|
||||
}
|
||||
},
|
||||
"bssid":""
|
||||
}
|
@ -55,7 +55,7 @@ cw_aciplist_t cw_select_ac(struct conn *conn, mbag_t dis)
|
||||
|
||||
/* get the AC Name with Priority list */
|
||||
cw_acpriolist_t priolist;
|
||||
priolist = mbag_get_avltree(conn->local, CW_ITEM_AC_PRIO_LIST);
|
||||
priolist = mbag_get_avltree(conn->config, CW_ITEM_AC_NAME_WITH_PRIORITY);
|
||||
|
||||
cw_aciplist_t resultlist=cw_aciplist_create();
|
||||
|
||||
@ -73,6 +73,8 @@ cw_aciplist_t cw_select_ac(struct conn *conn, mbag_t dis)
|
||||
prio = cw_acpriolist_get(priolist, ac_name);
|
||||
else
|
||||
prio = 256;
|
||||
printf("Prio for %s is %d\n",ac_name,prio);
|
||||
printf("nprio: %d\n",priolist->count);
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ bstr_t get_base_rmac()
|
||||
{
|
||||
// static uint8_t rm[8]={0x00,0x4a,0x99,0x02,0xfa,0xc0};
|
||||
|
||||
static uint8_t rm[8]={0x00,0x3a,0x99,0x02,0xfa,0xc0};
|
||||
static uint8_t rm[8]={0x00,0x4a,0x99,0x02,0xfa,0xc0};
|
||||
return bstr_create(rm,6);
|
||||
}
|
||||
|
||||
@ -68,9 +68,6 @@ int handle_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int main()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
wtpconf_preinit();
|
||||
|
||||
if (!read_config("./wtp_uci.conf")) {
|
||||
@ -156,9 +153,8 @@ conn->config=mbag_create();
|
||||
cw_acpriolist_set(acprios,"Master AC",strlen("Master AC"),1);
|
||||
cw_acpriolist_set(acprios,"AC8new",strlen("AC8new"),12);
|
||||
|
||||
mbag_set_avltree(conn->local,CW_ITEM_AC_PRIO_LIST,acprios);
|
||||
|
||||
mbag_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
|
||||
// mbag_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
|
||||
// mbag_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
|
||||
|
||||
mbag_set_byte(conn->local,CW_ITEM_WTP_MAC_TYPE,0);
|
||||
@ -172,7 +168,7 @@ cw_set_msg_end_callback(conn,CW_STATE_CONFIGURE,CW_MSG_CONFIGURATION_STATUS_RESP
|
||||
|
||||
|
||||
|
||||
the_conn->strict_capwap=1;
|
||||
the_conn->strict_capwap=0;
|
||||
discovery();
|
||||
join();
|
||||
mavl_destroy(conn->incomming);
|
||||
|
Loading…
Reference in New Issue
Block a user