Work on radio admin state ...
FossilOrigin-Name: dd3899fd9ec453e8722f0e927878ddef7b3e2aaca717b32866cedf07e1167f4e
This commit is contained in:
parent
368b09b2d7
commit
622b094992
@ -174,6 +174,22 @@
|
|||||||
0, /* ID to use store */ \
|
0, /* ID to use store */ \
|
||||||
4, 4 /* min/max length */
|
4, 4 /* min/max length */
|
||||||
|
|
||||||
|
#define CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE_WTP \
|
||||||
|
CW_ELEM_RADIO_ADMINISTRATIVE_STATE, /* Element ID*/ \
|
||||||
|
cw_in_radio_administrative_state_wtp, 0, /* start/end callback */ \
|
||||||
|
MBAG_DWORD, /* Type of element */ \
|
||||||
|
0, /* ID to use store */ \
|
||||||
|
4, 4 /* min/max length */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CW_ACTION_IN_MAXIMUM_MESSAGE_LENGTH \
|
||||||
|
CW_ELEM_MAXIMUM_MESSAGE_LENGTH, /* Element ID*/ \
|
||||||
|
cw_in_generic, 0, /* start/end callback */ \
|
||||||
|
MBAG_WORD, /* Type of element */ \
|
||||||
|
CW_ITEM_MAXIMUM_MESSAGE_LENGTH /* ID to use store */ \
|
||||||
|
2, 2 /* min/max length */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,6 +68,11 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
0, cw_in_check_join_resp }
|
0, cw_in_check_join_resp }
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* Result Code */
|
||||||
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
||||||
|
CW_ACTION_IN_RESULT_CODE, 1}
|
||||||
|
,
|
||||||
|
|
||||||
/* AC Descriptor */
|
/* AC Descriptor */
|
||||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
||||||
CW_ACTION_IN_AC_DESCRIPTOR, 1}
|
CW_ACTION_IN_AC_DESCRIPTOR, 1}
|
||||||
@ -78,13 +83,14 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
CW_ACTION_IN_AC_NAME, 1}
|
CW_ACTION_IN_AC_NAME, 1}
|
||||||
,
|
,
|
||||||
|
|
||||||
/* Vendor Specific */
|
|
||||||
|
/* CAPWAP Control IPv4 Address */
|
||||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_RESPONSE,
|
||||||
CW_ACTION_IN_RESULT_CODE, 1}
|
CW_ACTION_IN_CAPWAP_CONTROL_IPV4_ADDRESS, 1}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
@ -102,7 +108,7 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Message Image Data Request */
|
/* Message Image Data Request IN */
|
||||||
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_REQUEST, 0,
|
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_REQUEST, 0,
|
||||||
0, cw_in_check_img_data_req_wtp }
|
0, cw_in_check_img_data_req_wtp }
|
||||||
,
|
,
|
||||||
@ -133,13 +139,12 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Message Change State Response IN */
|
/* Message Change State Response IN */
|
||||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_RESPONSE, 0,
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_RESPONSE, 0,
|
||||||
0,0 }
|
0, cw_in_check_cfg_update_req }
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------- */
|
||||||
/* Message Configuration Update Request IN */
|
/* Message Configuration Update Request IN */
|
||||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
0, 0,0 }
|
0, 0,0 }
|
||||||
@ -151,7 +156,7 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
|
|
||||||
|
|
||||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE, 0}
|
CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE_WTP, 0}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
@ -163,6 +168,7 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------- */
|
||||||
/* Echo Response Response IN */
|
/* Echo Response Response IN */
|
||||||
{0, 0, CW_STATE_RUN, CW_MSG_ECHO_RESPONSE, 0,
|
{0, 0, CW_STATE_RUN, CW_MSG_ECHO_RESPONSE, 0,
|
||||||
0,0 }
|
0,0 }
|
||||||
@ -316,6 +322,11 @@ cw_action_out_t capwap_actions_wtp_out[] = {
|
|||||||
{CW_MSG_CHANGE_STATE_EVENT_REQUEST, CW_ITEM_NONE}
|
{CW_MSG_CHANGE_STATE_EVENT_REQUEST, CW_ITEM_NONE}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* Radio Ooerational State */
|
||||||
|
{CW_MSG_CHANGE_STATE_EVENT_REQUEST, CW_ITEM_RADIO_OPER_STATE, 0,
|
||||||
|
0, NULL, cw_out_radio_operational_states, cw_out_get_config,1}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------------
|
||||||
@ -325,10 +336,16 @@ cw_action_out_t capwap_actions_wtp_out[] = {
|
|||||||
,
|
,
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------------
|
||||||
* Echo Request Request OUT
|
* Configuration Update Response
|
||||||
*/
|
*/
|
||||||
{CW_MSG_CONFIGURATION_UPDATE_RESPONSE, CW_ITEM_NONE}
|
{CW_MSG_CONFIGURATION_UPDATE_RESPONSE, CW_ITEM_NONE}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* Radio Oper State */
|
||||||
|
{CW_MSG_CONFIGURATION_UPDATE_RESPONSE, CW_ITEM_RADIO_OPER_STATE, 0,
|
||||||
|
0, NULL, cw_out_radio_operational_states, cw_out_get_config,1}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
{0, 0}
|
{0, 0}
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#define CW_CISCO_DIRECT_SEQUENCE_CONTROL LW_ELEM_DIRECT_SEQUENCE_CONTROL /* 14 */
|
#define CW_CISCO_DIRECT_SEQUENCE_CONTROL LW_ELEM_DIRECT_SEQUENCE_CONTROL /* 14 */
|
||||||
#define CW_CISCO_SUPPORTED_RATES LW_ELEM_80211_RATE_SET /* 16 */
|
#define CW_CISCO_SUPPORTED_RATES LW_ELEM_80211_RATE_SET /* 16 */
|
||||||
|
|
||||||
|
#define CW_CISCO_80211_DELETE_WLAN LW_ELEM_80211_DELETE_WLAN /* 28 */
|
||||||
|
|
||||||
#define CW_CISCO_MWAR_NAME LW_ELEM_AC_NAME /* 31 */
|
#define CW_CISCO_MWAR_NAME LW_ELEM_AC_NAME /* 31 */
|
||||||
|
|
||||||
#define CW_CISCO_LOCATION_DATA LW_ELEM_LOCATION_DATA /* 35 */
|
#define CW_CISCO_LOCATION_DATA LW_ELEM_LOCATION_DATA /* 35 */
|
||||||
@ -61,6 +63,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#define CW_CISCO_AP_STATIC_IP_ADDR 83
|
#define CW_CISCO_AP_STATIC_IP_ADDR 83
|
||||||
|
#define CW_CISCO_SIG_PAYLOAD 84
|
||||||
|
#define CW_CISCO_SIG_TOGGLE 87
|
||||||
|
|
||||||
#define CW_CISCO_AC_NAME_WITH_INDEX 91
|
#define CW_CISCO_AC_NAME_WITH_INDEX 91
|
||||||
#define CW_CISCO_SPAM_DOMAIN_SECRET 96
|
#define CW_CISCO_SPAM_DOMAIN_SECRET 96
|
||||||
@ -212,41 +216,13 @@ int cw_out_cisco_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, uint8
|
|||||||
int cw_in_cisco_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
int cw_in_cisco_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
struct sockaddr *from);
|
struct sockaddr *from);
|
||||||
|
|
||||||
|
int cw_in_cisco_radio_administrative_state_wtp(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
|
struct sockaddr *from);
|
||||||
|
|
||||||
|
|
||||||
/*
|
int cw_in_cisco_radio_cfg(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
#define cw_addelem_cisco_rad(dst,acinfo)\
|
struct sockaddr *from);
|
||||||
lw_put_ac_descriptor(dst+10,acinfo)
|
|
||||||
cw_put_elem_vedor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_RAD,
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* cwmsg methods */
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define cwmsg_addelem_cisco_ap_timesync(cwmsg,time,type)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_cisco_ap_timesync(((cwmsg)->msgelems+(cwmsg)->pos),time,type)
|
|
||||||
|
|
||||||
#define cwmsg_addelem_cisco_rad_name(cwmsg,name)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_cisco_rad_name(((cwmsg)->msgelems+(cwmsg)->pos),(name))
|
|
||||||
|
|
||||||
#define cwmsg_addelem_cisco_ap_grpoup_name(cwmsg,name)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_ap_group_name(((cwmsg)->msgelems+(cwmsg)->pos),(name))
|
|
||||||
|
|
||||||
#define cwmsg_addelem_cisco_mwar(cwmsg,acinfo)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_cisco_mwar(((cwmsg)->msgelems+(cwmsg)->pos),(acinfo))
|
|
||||||
|
|
||||||
#define cwmsg_addelem_cisco_certificate(cwmsg,crt,len)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_cisco_certificate(((cwmsg)->msgelems+(cwmsg)->pos),crt,len)
|
|
||||||
|
|
||||||
#define cwmsg_addelem_cisco_ap_regulatory_domain(cwmsg,radioinfo)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_cisco_ap_regulatory_domain(((cwmsg)->msgelems+(cwmsg)->pos),radioinfo)
|
|
||||||
|
|
||||||
#define cwmsg_addelem_cisco_wtp_radio_cfg(cwmsg,radioinfo)\
|
|
||||||
(cwmsg)->pos+=cw_addelem_cisco_wtp_radio_cfg(((cwmsg)->msgelems+(cwmsg)->pos),radioinfo)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,7 +51,7 @@ enum capwap_items {
|
|||||||
CW_ITEM_AC_HASH_VALUE,
|
CW_ITEM_AC_HASH_VALUE,
|
||||||
|
|
||||||
CW_ITEM_AC_NAME_WITH_PRIORITY,
|
CW_ITEM_AC_NAME_WITH_PRIORITY,
|
||||||
|
CW_ITEM_MAXIMUM_MESSAGE_LENGTH,
|
||||||
|
|
||||||
|
|
||||||
/* CIPWAP and Cisco */
|
/* CIPWAP and Cisco */
|
||||||
@ -70,7 +70,9 @@ enum capwap_items {
|
|||||||
CW_ITEM_AP_MODE_AND_TYPE,
|
CW_ITEM_AP_MODE_AND_TYPE,
|
||||||
|
|
||||||
CW_ITEM_CISCO_BOARD_DATA_OPTIONS,
|
CW_ITEM_CISCO_BOARD_DATA_OPTIONS,
|
||||||
CW_ITEM_RADIOS
|
CW_ITEM_RADIOS,
|
||||||
|
CW_ITEM_RADIO_OPER_STATE,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,3 +17,20 @@
|
|||||||
4, 4 /* min/max length */
|
4, 4 /* min/max length */
|
||||||
|
|
||||||
|
|
||||||
|
#define CW_ACTION_IN_CISCO_RADIO_ADMINISTRATIVE_STATE_WTP \
|
||||||
|
CW_ELEM_RADIO_ADMINISTRATIVE_STATE, /* Element ID*/ \
|
||||||
|
cw_in_cisco_radio_administrative_state_wtp, 0, /* start/end callback */ \
|
||||||
|
MBAG_DWORD, /* Type of element */ \
|
||||||
|
0, /* ID to use store */ \
|
||||||
|
4, 4 /* min/max length */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CW_ACTION_IN_CISCO_RADIO_CFG\
|
||||||
|
CW_CISCO_WTP_RADIO_CFG, /* Element ID*/ \
|
||||||
|
cw_in_cisco_radio_cfg, 0, /* start/end callback */ \
|
||||||
|
NULL, /* Type of element */ \
|
||||||
|
0, /* ID to use store */ \
|
||||||
|
0, 1114 /* min/max length */
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,14 +45,16 @@ cw_action_in_t cipwap_actions_wtp_in[] = {
|
|||||||
cw_in_ac_name_with_priority, 0, MBAG_BSTR16,CW_ITEM_AC_NAME_WITH_PRIORITY,0,512}
|
cw_in_ac_name_with_priority, 0, MBAG_BSTR16,CW_ITEM_AC_NAME_WITH_PRIORITY,0,512}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* AP Mode an Type */
|
||||||
{CW_VENDOR_ID_CISCO, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
{CW_VENDOR_ID_CISCO, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
CW_ACTION_IN_CISCO_AP_MODE_AND_TYPE,
|
CW_ACTION_IN_CISCO_AP_MODE_AND_TYPE,
|
||||||
1}
|
1}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* Radio Administrative State */
|
||||||
|
/* Oveload CAPWAP action to handle a radio ID of 255 */
|
||||||
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
CW_ACTION_IN_CISCO_RADIO_ADMINISTRATIVE_STATE, 0}
|
CW_ACTION_IN_CISCO_RADIO_ADMINISTRATIVE_STATE_WTP, 0}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +69,11 @@ cw_action_in_t cipwap_actions_wtp_in[] = {
|
|||||||
* Configuration Status Response IN
|
* Configuration Status Response IN
|
||||||
*/
|
*/
|
||||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_RESPONSE,
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||||
CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE, 0}
|
CW_ACTION_IN_RADIO_ADMINISTRATIVE_STATE_WTP, 0}
|
||||||
|
,
|
||||||
|
|
||||||
|
{CW_VENDOR_ID_CISCO, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||||
|
CW_ACTION_IN_CISCO_RADIO_CFG, 0}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "mbag.h"
|
#include "mbag.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
int cw_put_cisco_wtp_radio_cfg(uint8_t *dst, int rid, mbag_t radio)
|
int cw_put_cisco_wtp_radio_cfg(uint8_t *dst, int rid, mbag_t radio)
|
||||||
{
|
{
|
||||||
@ -112,3 +113,59 @@ int cw_out_cisco_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, uint8
|
|||||||
// return l+cw_out_cisco_wtp_radio_cfg_(conn,a,dst+l,1);
|
// return l+cw_out_cisco_wtp_radio_cfg_(conn,a,dst+l,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cw_in_cisco_radio_cfg(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
|
struct sockaddr *from)
|
||||||
|
{
|
||||||
|
|
||||||
|
int rid = cw_get_byte(data);
|
||||||
|
mbag_t radio = mbag_get_mbag(conn->radios,rid,NULL);
|
||||||
|
if ( !radio){
|
||||||
|
cw_dbg(DBG_ELEM_ERR,"Radio ID %d not defined",rid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// printf("Here we are %d\n",rid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int cw_radio_cisco_set_state(struct conn * conn, uint8_t *data, int len, int cause)
|
||||||
|
{
|
||||||
|
|
||||||
|
int rid = cw_get_byte(data);
|
||||||
|
int state = cw_get_byte(data+1);
|
||||||
|
if (rid != 255)
|
||||||
|
return cw_radio_set_admin_state(conn->radios,rid,state,cause);
|
||||||
|
|
||||||
|
|
||||||
|
MAVLITER_DEFINE(it,conn->radios);
|
||||||
|
mavliter_foreach(&it){
|
||||||
|
mbag_item_t *i = mavliter_get(&it);
|
||||||
|
cw_radio_set_admin_state(conn->radios,i->id,state,cause);
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int cw_in_cisco_radio_administrative_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
|
struct sockaddr *from)
|
||||||
|
{
|
||||||
|
return cw_radio_cisco_set_state(conn,data,len,-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int cw_in_cisco_radio_administrative_state_wtp(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||||
|
struct sockaddr *from)
|
||||||
|
{
|
||||||
|
return cw_radio_cisco_set_state(conn,data,len,3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +114,12 @@ const char * cw_cisco_id_to_str(int elem_id)
|
|||||||
return "AP Retransmit Param";
|
return "AP Retransmit Param";
|
||||||
case CW_CISCO_AP_VENUE_SETTINGS:
|
case CW_CISCO_AP_VENUE_SETTINGS:
|
||||||
return "AP Venue Settings";
|
return "AP Venue Settings";
|
||||||
|
case CW_CISCO_80211_DELETE_WLAN:
|
||||||
|
return "Delete WLAN";
|
||||||
|
case CW_CISCO_SIG_PAYLOAD:
|
||||||
|
return "Signature Payload";
|
||||||
|
case CW_CISCO_SIG_TOGGLE:
|
||||||
|
return "Signature Toggle";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
#include "capwap.h"
|
|
||||||
#include "intavltree.h"
|
|
||||||
#include "dbg.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "capwap_items.h"
|
|
||||||
|
|
||||||
int cw_in_check_cfg_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
||||||
int len,struct sockaddr *from)
|
|
||||||
{
|
|
||||||
|
|
||||||
cw_action_in_t * mlist[60];
|
|
||||||
|
|
||||||
/* Check for mandatory elements */
|
|
||||||
int n = cw_check_missing_mand(mlist,conn,a);
|
|
||||||
if (n) {
|
|
||||||
if ( conn->strict_capwap ){
|
|
||||||
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
|
|
||||||
conn->capwap_state=CW_STATE_JOIN;
|
|
||||||
return CW_RESULT_MISSING_MAND_ELEM;
|
|
||||||
}
|
|
||||||
cw_dbg_missing_mand(DBG_RFC,conn,mlist,n,a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* set result code to ok and change to configure state */
|
|
||||||
mbag_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -97,7 +97,6 @@ int cw_in_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data, int
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,37 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mbag.h"
|
#include "mbag.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
#include "radio.h"
|
||||||
|
|
||||||
|
|
||||||
|
int cw_radio_set_admin_state(mbag_t radios,int rid, int state, int cause)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (cause < 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set operational state for next config update response. */
|
||||||
|
|
||||||
|
mbag_set_word(radio,CW_RADIO_OPER_STATE, (state<<8) | 3);
|
||||||
|
|
||||||
|
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 cw_radio_set_admin_state(conn->radios,rid,state,-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,3 +91,7 @@ int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst) //
|
|||||||
|
|
||||||
return len + cw_put_elem_hdr(dst, a->elem_id, len);
|
return len + cw_put_elem_hdr(dst, a->elem_id, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,43 +60,4 @@ int cw_out_radio_administrative_states(struct conn *conn, struct cw_action_out *
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
@ -134,6 +134,8 @@
|
|||||||
#define LW_ELEM_TX_POWER_LEVELS 13
|
#define LW_ELEM_TX_POWER_LEVELS 13
|
||||||
#define LW_ELEM_DIRECT_SEQUENCE_CONTROL 14
|
#define LW_ELEM_DIRECT_SEQUENCE_CONTROL 14
|
||||||
|
|
||||||
|
#define LW_ELEM_80211_DELETE_WLAN 28
|
||||||
|
|
||||||
#define LW_ELEM_AC_NAME 31
|
#define LW_ELEM_AC_NAME 31
|
||||||
#define LW_ELEM_LOCATION_DATA 35
|
#define LW_ELEM_LOCATION_DATA 35
|
||||||
#define LW_ELEM_STATISTICS_TIMER 37
|
#define LW_ELEM_STATISTICS_TIMER 37
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
enum radiodata{
|
enum radiodata{
|
||||||
CW_RADIO_ADMIN_STATE=10000,
|
CW_RADIO_ADMIN_STATE=10000,
|
||||||
|
CW_RADIO_OPER_STATE,
|
||||||
CW_RADIO_TYPE,
|
CW_RADIO_TYPE,
|
||||||
CW_RADIO_REG_DOMAIN,
|
CW_RADIO_REG_DOMAIN,
|
||||||
CW_RADIO_BSSID,
|
CW_RADIO_BSSID,
|
||||||
|
@ -29,6 +29,7 @@ int cfg_json_put_ac_ip_list(char *dst, const char *name, mbag_item_t * i, int n)
|
|||||||
int cfg_json_put_acobj(char *dst, const char *name, mbag_item_t * i, int n);
|
int cfg_json_put_acobj(char *dst, const char *name, mbag_item_t * i, int n);
|
||||||
int cfg_json_put_byte(char *dst, const char *name, mbag_item_t * i, int n);
|
int cfg_json_put_byte(char *dst, const char *name, mbag_item_t * i, int n);
|
||||||
int cfg_json_put_radios(char *dst, const char *name, mbag_item_t * i, int n);
|
int cfg_json_put_radios(char *dst, const char *name, mbag_item_t * i, int n);
|
||||||
|
int cfg_json_put_bstr(char *dst, const char *name, mbag_item_t * i, int n);
|
||||||
|
|
||||||
|
|
||||||
//static int scn_obj(char *js, jsmntok_t *t, int (vcb)(char*js,jsmntok_t*t,struct mbag_itemdef *defs,mbag_t mbag), struct mbag_itemdef *defs,mbag_t mbag);
|
//static int scn_obj(char *js, jsmntok_t *t, int (vcb)(char*js,jsmntok_t*t,struct mbag_itemdef *defs,mbag_t mbag), struct mbag_itemdef *defs,mbag_t mbag);
|
||||||
@ -48,6 +49,7 @@ int cfg_json_get_word(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t
|
|||||||
int cfg_json_get_byte(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t mbag);
|
int cfg_json_get_byte(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t mbag);
|
||||||
int cfg_json_get_ac_name_with_priority(struct mbag_itemdef *idef, char *js, jsmntok_t * t,
|
int cfg_json_get_ac_name_with_priority(struct mbag_itemdef *idef, char *js, jsmntok_t * t,
|
||||||
mbag_t mbag);
|
mbag_t mbag);
|
||||||
|
int cfg_json_get_bstr(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t mbag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -244,6 +246,33 @@ int cfg_json_get_vendorstr(struct mbag_itemdef *idef, char *js, jsmntok_t * t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int cfg_json_get_bstr(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t mbag)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct conn *conn = get_conn();
|
||||||
|
|
||||||
|
int item_id = idef->item_id;
|
||||||
|
*(js + t->end) = 0;
|
||||||
|
// char *str = js+t->start;
|
||||||
|
if (t->type != JSMN_STRING) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*(js + t->end) = 0;
|
||||||
|
bstr16_t b16 = bstr16cfgstr(js + t->start);
|
||||||
|
|
||||||
|
/* this is a dirty hack. It should be removed
|
||||||
|
when we have a bstrcfgstr function */
|
||||||
|
|
||||||
|
bstr_t b=bstr_create(bstr16_data(b16),bstr_len(b16));
|
||||||
|
free(b16);
|
||||||
|
|
||||||
|
mbag_set_bstr(mbag, item_id, b);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cfg_json_get_bstr16(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t mbag)
|
int cfg_json_get_bstr16(struct mbag_itemdef *idef, char *js, jsmntok_t * t, mbag_t mbag)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -409,6 +438,7 @@ struct mbag_itemdef general_cfg[] = {
|
|||||||
cfg_json_put_bstr16},
|
cfg_json_put_bstr16},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* {CW_ITEM_WTP_FRAME_TUNNEL_MODE,"frame_tunnel_mode",byte_local},
|
/* {CW_ITEM_WTP_FRAME_TUNNEL_MODE,"frame_tunnel_mode",byte_local},
|
||||||
{CW_ITEM_WTP_MAC_TYPE,"mac_type",byte_local},
|
{CW_ITEM_WTP_MAC_TYPE,"mac_type",byte_local},
|
||||||
{CW_ITEM_WTP_GROUP_NAME,"group_name",bstr16_local},
|
{CW_ITEM_WTP_GROUP_NAME,"group_name",bstr16_local},
|
||||||
@ -432,6 +462,8 @@ struct mbag_itemdef board_data_cfg[] = {
|
|||||||
struct mbag_itemdef radio_cfg[] = {
|
struct mbag_itemdef radio_cfg[] = {
|
||||||
{CW_RADIO_ADMIN_STATE, "admin_state", cfg_json_get_byte, cfg_json_put_byte},
|
{CW_RADIO_ADMIN_STATE, "admin_state", cfg_json_get_byte, cfg_json_put_byte},
|
||||||
{CW_RADIO_TYPE, "radio_type", cfg_json_get_dword, cfg_json_put_dword},
|
{CW_RADIO_TYPE, "radio_type", cfg_json_get_dword, cfg_json_put_dword},
|
||||||
|
/* {CW_RADIO_OPER_STATE,"oper_state", cfg_json_get_word,cfg_json_put_word},*/
|
||||||
|
{CW_RADIO_BSSID,"bssid", cfg_json_get_bstr,cfg_json_put_bstr},
|
||||||
{0,0,0}
|
{0,0,0}
|
||||||
|
|
||||||
|
|
||||||
@ -451,6 +483,32 @@ struct mbag_itemdef *get_idef_by_id(struct mbag_itemdef *cfg, uint32_t id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* This is almost a copy of the bstr16 function.
|
||||||
|
Maybe it could be combined to shorten the code. */
|
||||||
|
int cfg_json_put_bstr(char *dst, const char *name, mbag_item_t * i, int n)
|
||||||
|
{
|
||||||
|
if (i->type != MBAG_BSTR) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *d = dst;
|
||||||
|
memset(d, '\t', n);
|
||||||
|
d += n;
|
||||||
|
d += sprintf(d, "\"%s\":", name);
|
||||||
|
|
||||||
|
int utf8 = cw_is_utf8(bstr_data(i->data), bstr_len(i->data));
|
||||||
|
if (utf8) {
|
||||||
|
d += sprintf(d, "\"%.*s\"", bstr_len(i->data), bstr_data(i->data));
|
||||||
|
} else {
|
||||||
|
d += sprintf(d, "\".x");
|
||||||
|
d += cw_format_hex(d, bstr_data(i->data), bstr_len(i->data));
|
||||||
|
d += sprintf(d, "\"");
|
||||||
|
}
|
||||||
|
return d - dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,12 +27,14 @@
|
|||||||
"wtp_board_data_options":".x00010000",
|
"wtp_board_data_options":".x00010000",
|
||||||
"radios":{
|
"radios":{
|
||||||
"0":{
|
"0":{
|
||||||
"admin_state":"2",
|
"admin_state":"1",
|
||||||
"radio_type":"1"
|
"radio_type":"1",
|
||||||
|
"bssid":".x123456789abc"
|
||||||
},
|
},
|
||||||
"1":{
|
"1":{
|
||||||
"admin_state":"2",
|
"admin_state":"1",
|
||||||
"radio_type":"2"
|
"radio_type":"2",
|
||||||
|
"bssid":".xaabbccddeeff"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bssid":""
|
"bssid":""
|
||||||
|
Loading…
Reference in New Issue
Block a user