cisco radio and wtp operational/admin state implementation
FossilOrigin-Name: 3a86140816d6cc692257a4c16dd54f760a28145918a4d57b2fbeb8c58e2f84d5
This commit is contained in:
parent
0306b74b17
commit
5702c95964
@ -24,7 +24,9 @@ OBJS=\
|
||||
cisco_out_ac_ipv4_list.o \
|
||||
cisco_out_capwap_up.o \
|
||||
cisco_in_add_wlan.o \
|
||||
cisco_out_wtp_administrative_state.o
|
||||
cisco_out_wtp_administrative_state.o \
|
||||
cisco_out_radio_operational_state.o \
|
||||
cisco_in_radio_operational_state.o
|
||||
|
||||
|
||||
|
||||
|
@ -47,5 +47,8 @@ int cisco_in_add_wlan(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
struct sockaddr *from);
|
||||
|
||||
int cisco_out_wtp_administrative_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||
int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||
int cisco_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from);
|
||||
|
||||
#endif
|
||||
|
@ -177,6 +177,8 @@ static cw_action_in_t actions_in[] = {
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
@ -255,7 +257,7 @@ static cw_action_in_t actions_in[] = {
|
||||
}
|
||||
,
|
||||
|
||||
/* AP Mode and Type */
|
||||
/* Log Facility */
|
||||
{
|
||||
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
@ -269,6 +271,35 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
|
||||
|
||||
|
||||
/* Radio Operational State - Run State - Change State Event Req */
|
||||
{
|
||||
.capwap_state = CW_STATE_RUN,
|
||||
.msg_id= CW_MSG_CHANGE_STATE_EVENT_REQUEST,
|
||||
.elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE,
|
||||
.item_id = CW_RADIOITEM_OPER_STATE,
|
||||
.start = cisco_in_radio_operational_state,
|
||||
.min_len=3,
|
||||
.max_len=3,
|
||||
.mand = 0
|
||||
}
|
||||
,
|
||||
|
||||
/* Radio Operational State - Configure State - Change State Event Req */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.msg_id= CW_MSG_CHANGE_STATE_EVENT_REQUEST,
|
||||
.elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE,
|
||||
.item_id = CW_RADIOITEM_OPER_STATE,
|
||||
.start = cisco_in_radio_operational_state, //operational_state,
|
||||
.min_len=3,
|
||||
.max_len=3,
|
||||
.mand = 0
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* End of list */
|
||||
{0, 0}
|
||||
};
|
||||
@ -389,7 +420,7 @@ static cw_action_out_t actions_out[]={
|
||||
.msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
.elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE,
|
||||
.item_id = CW_RADIOITEM_OPER_STATE,
|
||||
.out = cw_out_radio_generic,
|
||||
.out = cisco_out_radio_operational_state,
|
||||
.mand = 0
|
||||
}
|
||||
,
|
||||
@ -431,6 +462,17 @@ static cw_action_out_t actions_out[]={
|
||||
,
|
||||
|
||||
|
||||
/* Cisco WTP Admin state - OUT */
|
||||
{
|
||||
.msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
// .elem_id = CW_CISCO_AP_MODE_AND_TYPE,
|
||||
.item_id = CISCO_ITEM_WTP_ADMIN_STATE,
|
||||
.out = cisco_out_wtp_administrative_state,
|
||||
// .get = cw_out_get_outgoming,
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
|
||||
{0,0}
|
||||
|
@ -1,22 +1,41 @@
|
||||
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
||||
#include "cw/action.h"
|
||||
#include "cw/dbg.h"
|
||||
#include "cw/log.h"
|
||||
#include "cw/mbag.h"
|
||||
#include "cw/capwap.h"
|
||||
#include "cw/capwap_actions.h"
|
||||
#include "cw/cw.h"
|
||||
|
||||
int cisco_in_radio_operational_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);
|
||||
int cause = cw_ get_byte(data+3);
|
||||
int cause = cw_get_byte(data+2);
|
||||
|
||||
if (state
|
||||
cw_dbg (DBG_X,"Read State %d",state);
|
||||
|
||||
int state_t = state;
|
||||
if (state == CW_RADIO_OPER_STATE_ENABLED_7)
|
||||
state_t = CW_RADIO_OPER_STATE_ENABLED;
|
||||
if (state == CW_RADIO_OPER_STATE_DISABLED_7)
|
||||
state_t = CW_RADIO_OPER_STATE_DISABLED;
|
||||
|
||||
cw_dbg(DBG_X,"Translated state to %d",state_t);
|
||||
|
||||
|
||||
mbag_t radio = mbag_i_get_mbag(conn->radios,rid,NULL);
|
||||
if (!radio){
|
||||
cw_dbg(DBG_ELEM_ERR,"Bad radio ID %d for radio operational state. ID doesn't exists.",rid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mbag_set_word(radio,CW_RADIOITEM_OPER_STATE,(state_t<<8)|cause);
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
#include "cw/capwap_items.h"
|
||||
|
||||
|
||||
int cisco_out_radio_administrative_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
|
||||
int l=0;
|
||||
MAVLITER_DEFINE(it,conn->radios_upd);
|
||||
mavliter_foreach(&it){
|
||||
@ -13,9 +14,20 @@ int cisco_out_radio_administrative_states(struct conn *conn, struct cw_action_ou
|
||||
continue;
|
||||
}
|
||||
|
||||
int state = mbag_get_byte(i->data,CW_RADIOITEM_ADMIN_STATE,CW_RADIO_ADMIN_STATE_DISABLED);
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->iid,i->data);
|
||||
// l+=cw_put_elem_radio_operational_state(dst+l,i->iid,state<<8,0);
|
||||
int state = mbag_get_word(i->data,CW_RADIOITEM_OPER_STATE,CW_RADIO_OPER_STATE_DISABLED<<8);
|
||||
int oper_state = (state >> 8) & 0xff;
|
||||
int oper_cause = state & 0xff;
|
||||
|
||||
int oper_state_t = oper_state;
|
||||
if (oper_state == CW_RADIO_OPER_STATE_ENABLED)
|
||||
oper_state_t = CW_RADIO_OPER_STATE_ENABLED_7;
|
||||
if (oper_state == CW_RADIO_OPER_STATE_DISABLED)
|
||||
oper_state_t = CW_RADIO_OPER_STATE_DISABLED_7;
|
||||
|
||||
cw_dbg(DBG_X,"Translated oper state for output from %d to %d",oper_state, oper_state_t);
|
||||
|
||||
l+=cw_put_elem_radio_operational_state(dst+l,i->iid,oper_state_t, oper_cause);
|
||||
|
||||
|
||||
}
|
||||
return l;
|
||||
|
Loading…
Reference in New Issue
Block a user