diff --git a/actube.workspace b/actube.workspace index c63c2d68..b8870938 100644 --- a/actube.workspace +++ b/actube.workspace @@ -3,8 +3,8 @@ - - + + diff --git a/src/cw/capwap.h b/src/cw/capwap.h index bd4f7dd6..6fe42980 100644 --- a/src/cw/capwap.h +++ b/src/cw/capwap.h @@ -648,7 +648,7 @@ enum capwap_states { CW_STATE_IMAGE_DATA, CW_STATE_UPDATE, /** Run State */ - CW_STATE_RUN + CAPWAP_STATE_RUN }; /** diff --git a/src/cw/capwap_strings_state.c b/src/cw/capwap_strings_state.c index 5975289c..efdae495 100644 --- a/src/cw/capwap_strings_state.c +++ b/src/cw/capwap_strings_state.c @@ -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" }, diff --git a/src/cw/cw_inline.c b/src/cw/cw_inline.c index 306fd503..8afbd297 100644 --- a/src/cw/cw_inline.c +++ b/src/cw/cw_inline.c @@ -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) { diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c index c7e3d3f5..efb42880 100644 --- a/src/mod/capwap/capwap_actions_ac.c +++ b/src/mod/capwap/capwap_actions_ac.c @@ -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, diff --git a/src/wtp/Makefile b/src/wtp/Makefile index 6425e067..a1db54ee 100644 --- a/src/wtp/Makefile +++ b/src/wtp/Makefile @@ -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)) diff --git a/src/wtp/run.c b/src/wtp/run.c index b16baeaa..c3122949 100644 --- a/src/wtp/run.c +++ b/src/wtp/run.c @@ -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) diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c index c9e45538..f06a3852 100644 --- a/src/wtp/wtp_main.c +++ b/src/wtp/wtp_main.c @@ -221,6 +221,7 @@ exit(0); configure(conn); + run(conn); cw_discovery_free_results(&dis);