Configuration Update Request implemented
FossilOrigin-Name: 512ddfe97e9f76c9db9e3d40d6ec54b48951d9aaec609b63994cab263e9dae1f
This commit is contained in:
parent
d786fa1928
commit
25776eaacf
@ -3,8 +3,8 @@
|
||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="Yes"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
|
@ -648,7 +648,7 @@ enum capwap_states {
|
||||
CW_STATE_IMAGE_DATA,
|
||||
CW_STATE_UPDATE,
|
||||
/** Run State */
|
||||
CW_STATE_RUN
|
||||
CAPWAP_STATE_RUN
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
struct cw_StrListElem capwap_strings_state[] = {
|
||||
{ CAPWAP_STATE_DISCOVERY, "Discovery" },
|
||||
{ CAPWAP_STATE_JOIN,"Join" },
|
||||
{ CW_STATE_RUN,"Run" },
|
||||
{ CAPWAP_STATE_RUN,"Run" },
|
||||
{ CW_STATE_CONFIGURE,"Configure" },
|
||||
{ CW_STATE_IMAGE_DATA,"Image Data" },
|
||||
{ CW_STR_STOP,"Undefined" },
|
||||
|
@ -190,7 +190,7 @@ int cw_put_elem_radio_operational_state(uint8_t * dst, int rid, int state, int c
|
||||
cw_set_byte(dst+4,rid);
|
||||
cw_set_byte(dst+5,state);
|
||||
cw_set_byte(dst+6,cause);
|
||||
return 3+cw_put_elem_hdr(dst,CW_ELEM_RADIO_OPERATIONAL_STATE,3);
|
||||
return 3+cw_put_elem_hdr(dst,CAPWAP_ELEM_RADIO_OPERATIONAL_STATE,3);
|
||||
}
|
||||
|
||||
int cw_put_elem_radio_administrative_state(uint8_t * dst, int rid, int state) {
|
||||
|
@ -462,6 +462,39 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_STATISTICS_TIMER, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_REBOOT_STATISTICS, 1, 0},
|
||||
|
||||
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int echo_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef echo_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_STATISTICS_TIMER, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_REBOOT_STATISTICS, 1, 0},
|
||||
|
||||
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int echo_response_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef echo_response_elements[] ={
|
||||
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static struct cw_MsgDef messages[] = {
|
||||
{
|
||||
"Discovery Request",
|
||||
@ -511,7 +544,36 @@ static struct cw_MsgDef messages[] = {
|
||||
configuration_status_response_elements /* msg elements */
|
||||
},
|
||||
|
||||
{
|
||||
"Configuration Update Request", /* name */
|
||||
CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST, /* msg type */
|
||||
CW_ROLE_WTP, /* role */
|
||||
configuration_update_request_states, /* allowed states */
|
||||
configuration_update_request_elements /* msg elements */
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"Echo Request", /* name */
|
||||
CAPWAP_MSG_ECHO_REQUEST, /* msg type */
|
||||
CW_ROLE_AC, /* role */
|
||||
echo_request_states, /* allowed states */
|
||||
echo_request_elements /* msg elements */
|
||||
},
|
||||
|
||||
{
|
||||
"Echo Response", /* name */
|
||||
CAPWAP_MSG_ECHO_RESPONSE, /* msg type */
|
||||
CW_ROLE_WTP, /* role */
|
||||
echo_response_states, /* allowed states */
|
||||
echo_response_elements /* msg elements */
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* {
|
||||
"Discovery Request",
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
|
@ -32,7 +32,7 @@ endif
|
||||
|
||||
|
||||
#SRC=$(wildcard *.c)
|
||||
SRC=wtp_main.c discovery.c join.c configure.c
|
||||
SRC=wtp_main.c discovery.c join.c configure.c run.c
|
||||
|
||||
OBJS=$(patsubst %.c,%.o,$(SRC))
|
||||
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "cw/dtls.h"
|
||||
#include "cw/sock.h"
|
||||
#include "cw/cw_util.h"
|
||||
#include "cw/capwap_items.h"
|
||||
|
||||
|
||||
|
||||
#include "wtp_conf.h"
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
int update =0;
|
||||
|
||||
/*
|
||||
int handle_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from)
|
||||
{
|
||||
@ -53,16 +54,19 @@ cw_dbg(DBG_X,"Saving configuration ...");
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static void update_radio(struct conn * conn, int rid, mbag_t radio_upd, mbag_t radio,mbag_t iresult )
|
||||
{
|
||||
|
||||
printf("Updating radio with rid %d\n",rid);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
static void update_radios(struct conn * conn, mbag_t result)
|
||||
{
|
||||
MAVLITER_DEFINE (it,conn->radios_upd);
|
||||
@ -81,20 +85,21 @@ static void update_radios(struct conn * conn, mbag_t result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
static void do_update(struct conn * conn)
|
||||
{
|
||||
int rc;
|
||||
if (!update)
|
||||
return;
|
||||
update=0;
|
||||
|
||||
mbag_t result = mbag_create();
|
||||
/* mbag_t result = mbag_create();
|
||||
update_radios(conn,result);
|
||||
cw_dbg(DBG_INFO, "Saving configuration ...");
|
||||
cfg_to_json();
|
||||
*/ cw_dbg(DBG_INFO, "Saving configuration ...");
|
||||
/* cfg_to_json();*/
|
||||
/* Change State ... */
|
||||
int rc = cw_send_request(conn,CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST);
|
||||
rc = cw_send_request(conn,CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST);
|
||||
if ( !cw_result_is_ok(rc) ) {
|
||||
cw_strresult(rc);
|
||||
return ;
|
||||
@ -107,18 +112,21 @@ static void do_update(struct conn * conn)
|
||||
|
||||
|
||||
|
||||
int run()
|
||||
int run(struct conn * conn)
|
||||
{
|
||||
|
||||
|
||||
struct conn *conn = get_conn();
|
||||
|
||||
conn->capwap_state = CW_STATE_RUN;
|
||||
|
||||
conn->msg_end=handle_update_req;
|
||||
/* conn->msg_end=handle_update_req;*/
|
||||
|
||||
do {
|
||||
|
||||
int echo_interval = mbag_get_word(conn->config,CW_ITEM_CAPWAP_TIMERS,CW_TIMERS)&0xff;
|
||||
int echo_interval = cw_ktv_get_byte(conn->local_cfg,"capwap-timers/echo-interval",CAPWAP_ECHO_INTERVAL);
|
||||
|
||||
/*mbag_get_word(conn->config,CW_ITEM_CAPWAP_TIMERS,CW_TIMERS)&0xff;*/
|
||||
|
||||
time_t timer = cw_timer_start(echo_interval);
|
||||
int rc;
|
||||
|
||||
@ -135,7 +143,7 @@ int run()
|
||||
break;
|
||||
|
||||
|
||||
cw_dbg(DBG_X,"We hav a message processed");
|
||||
/*cw_dbg(DBG_X,"We hav a message processed");*/
|
||||
|
||||
do_update(conn);
|
||||
|
||||
@ -162,13 +170,13 @@ int run()
|
||||
} while (conn->capwap_state == CW_STATE_RUN);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// int rc = cw_send_request(conn,CW_MSG_CHANGE_STATE_EVENT_REQUEST);
|
||||
|
||||
// if ( !cw_rcok(rc) ) {
|
||||
// cw_strresult(rc);
|
||||
// }
|
||||
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -231,7 +239,7 @@ struct cwrmsg * send_request(struct conn * conn,struct cwmsg *cwmsg)
|
||||
|
||||
*/
|
||||
|
||||
//extern struct conn * get_conn();
|
||||
/*//extern struct conn * get_conn();*/
|
||||
|
||||
/*
|
||||
int run(struct conn * conn)
|
||||
|
@ -221,6 +221,7 @@ exit(0);
|
||||
|
||||
|
||||
configure(conn);
|
||||
run(conn);
|
||||
|
||||
cw_discovery_free_results(&dis);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user