Work on updating aps via sql

FossilOrigin-Name: 4b4d4dfa95b0aa4185bb4485f92d5ff3bbc7e4f99fffce654984b92ce55766d2
This commit is contained in:
7u83@mail.ru 2016-04-04 05:28:50 +00:00
parent 9348502fe5
commit addc4557c4
11 changed files with 71 additions and 12 deletions

View File

@ -297,7 +297,8 @@ MBAGOBJS = \
mbag_set_from_buf.o\ mbag_set_from_buf.o\
mbag_type_str.o \ mbag_type_str.o \
mbag_type_ptr.o \ mbag_type_ptr.o \
mbag_type_data.o mbag_type_data.o \
mbag_get_upd.o

View File

@ -130,7 +130,7 @@ static inline int bstr16_ncpy(uint8_t *dst,uint8_t*src,uint16_t len)
*/ */
static inline uint8_t * bstr16_create(uint8_t *data, uint16_t len) static inline uint8_t * bstr16_create(const uint8_t *data, uint16_t len)
{ {
uint8_t * str = malloc(2+len*sizeof(uint8_t)); uint8_t * str = malloc(2+len*sizeof(uint8_t));
if (!str) if (!str)

View File

@ -54,7 +54,7 @@ struct cw_itemdef capwap80211_radioitemdefs[] = {
{CW_RADIOITEM80211_SHORT_PREAMBLE,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM80211_SHORT_PREAMBLE,CW_ITEM_NONE,MBAG_BYTE},
{CW_RADIOITEM80211_NUM_BSS_IDS,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM80211_NUM_BSS_IDS,CW_ITEM_NONE,MBAG_BYTE},
{CW_RADIOITEM80211_DTIM_PERIOD,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM80211_DTIM_PERIOD,CW_ITEM_NONE,MBAG_BYTE},
{CW_RADIOITEM80211_BSSID,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM80211_BSSID,CW_ITEM_NONE,MBAG_DATA},
{CW_RADIOITEM80211_BEACON_PERIOD,CW_ITEM_NONE,MBAG_WORD}, {CW_RADIOITEM80211_BEACON_PERIOD,CW_ITEM_NONE,MBAG_WORD},
{CW_RADIOITEM80211_COUNTRY_STRING,CW_ITEM_NONE,MBAG_BSTR16}, {CW_RADIOITEM80211_COUNTRY_STRING,CW_ITEM_NONE,MBAG_BSTR16},

View File

@ -62,7 +62,9 @@ struct mbag_typedef{
struct mbag_item * (*get)(const uint8_t*src, int len); struct mbag_item * (*get)(const uint8_t*src, int len);
/** A method to put this object to a buffer */ /** A method to put this object to a buffer */
int (*put)(void *,uint8_t*dst); int (*put)(struct mbag_item *i,uint8_t*dst);
int (*def)(void *, void *);
}; };

View File

@ -32,6 +32,28 @@ static struct mbag_item * from_str(const char *src)
return i; return i;
} }
int put(struct mbag_item *i, uint8_t *dst)
{
int l = bstr16_len(i->data);
memcpy(dst,bstr16_data(i->data),l);
return l;
}
static struct mbag_item * get(const uint8_t *src, int len)
{
mbag_item_t * i = mbag_item_new(MBAG_BSTR16);
if (!i)
return NULL;
i->data=bstr16_create(src,len);
return i;
}
const struct mbag_typedef mbag_type_bstr16 = { const struct mbag_typedef mbag_type_bstr16 = {
"Bstr16",free,to_str,from_str .name = "Bstr16",
.del = free,
.to_str = to_str,
.from_str = from_str,
.get = get,
.put = put
}; };

View File

@ -54,7 +54,12 @@ static struct mbag_item * get(const uint8_t *src,int len)
return item; return item;
} }
static int put(struct mbag_item *i,uint8_t *dst)
{
int l = *((uint8_t*)i->data);
memcpy(dst,i->data+1,l);
return l;
}
const struct mbag_typedef mbag_type_data = { const struct mbag_typedef mbag_type_data = {
@ -62,6 +67,7 @@ const struct mbag_typedef mbag_type_data = {
.del = free, .del = free,
.from_str = from_str, .from_str = from_str,
.to_str = to_str, .to_str = to_str,
.get = get .get = get,
.put = put
}; };

View File

@ -18,7 +18,8 @@ OBJS=\
cisco_out_radio_administrative_states.o \ cisco_out_radio_administrative_states.o \
cisco_items.o \ cisco_items.o \
cisco80211_in_mac_operation.o \ cisco80211_in_mac_operation.o \
cisco80211_in_wtp_radio_configuration.o cisco80211_in_wtp_radio_configuration.o \
cisco80211_out_wtp_radio_configuration.o

View File

@ -38,5 +38,6 @@ int cisco80211_in_mac_operation(struct conn *conn, struct cw_action_in *a, uint8
int cisco80211_in_wtp_radio_configuration(struct conn *conn, struct cw_action_in *a, uint8_t * data, int cisco80211_in_wtp_radio_configuration(struct conn *conn, struct cw_action_in *a, uint8_t * data,
int len, struct sockaddr *from); int len, struct sockaddr *from);
int cisco80211_out_wtp_radio_configuration(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
#endif #endif

View File

@ -388,11 +388,26 @@ static cw_action_in_t actions80211_in[] = {
} }
,
{0,0}
}; };
static cw_action_out_t actions80211_out[]={
{
.msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST,
.vendor_id = CW_VENDOR_ID_CISCO,
.elem_id = CW_CISCO_WTP_RADIO_CFG,
.out = cisco80211_out_wtp_radio_configuration,
}
,
{0,0}
};
#include "cw/item.h" #include "cw/item.h"
@ -439,12 +454,12 @@ int cisco_register_actions80211_ac(struct cw_actiondef *def)
int rc; int rc;
rc=0; rc=0;
rc = cw_actionlist_in_register_actions(def->in, actions80211_in); rc = cw_actionlist_in_register_actions(def->in, actions80211_in);
rc += cw_actionlist_out_register_actions(def->out, actions80211_out);
rc += cw_itemdefheap_register(def->items, cisco_itemdefs); rc += cw_itemdefheap_register(def->items, cisco_itemdefs);
rc += cw_itemdefheap_register(def->radioitems, cisco_radioitemdefs); rc += cw_itemdefheap_register(def->radioitems, cisco_radioitemdefs);
/* rc += cw_actionlist_out_register_actions(def->out, actions_out);
rc += cw_strheap_register_strings(def->strmsg, capwap_strings_msg); /* rc += cw_strheap_register_strings(def->strmsg, capwap_strings_msg);
rc += cw_strheap_register_strings(def->strelem, cipwap_strings_elem); rc += cw_strheap_register_strings(def->strelem, cipwap_strings_elem);
rc += cw_itemdefheap_register(def->radioitems, capwap_radioitemdefs); rc += cw_itemdefheap_register(def->radioitems, capwap_radioitemdefs);

View File

@ -134,6 +134,17 @@ static cw_action_in_t actions_in[] = {
} }
, ,
/* Element Cisco 802.11 Radio Config - Config Status Resp */
{
.capwap_state = CW_STATE_RUN,
.msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST,
.vendor_id = CW_VENDOR_ID_CISCO,
.elem_id = CW_CISCO_WTP_RADIO_CFG,
.start=cisco80211_in_wtp_radio_configuration,
.item_id = "cisco_radio_cfg",
}
,
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------

View File

@ -19,8 +19,8 @@ const char CISCO_RADIOITEM80211_COUNTRY_STR2[]="cisco_country_str2";
struct cw_itemdef cisco_radioitemdefs[] = { struct cw_itemdef cisco_radioitemdefs[] = {
{CISCO_RADIOITEM80211_CFG_TYPE,CW_ITEM_NONE,MBAG_BYTE}, {CISCO_RADIOITEM80211_CFG_TYPE,CW_ITEM_NONE,MBAG_BYTE},
{CISCO_RADIOITEM80211_COUNTRY_STR1,CW_ITEM_NONE,MBAG_BSTR}, {CISCO_RADIOITEM80211_COUNTRY_STR1,CW_ITEM_NONE,MBAG_BSTR16},
{CISCO_RADIOITEM80211_COUNTRY_STR2,CW_ITEM_NONE,MBAG_BSTR}, {CISCO_RADIOITEM80211_COUNTRY_STR2,CW_ITEM_NONE,MBAG_BSTR16},
{CW_ITEM_NONE} {CW_ITEM_NONE}
}; };