Work on State machine
FossilOrigin-Name: 87d98b73010c7316cb9b53b5ba8c3dfdddca06042630cf8437ea506e1c424c70
This commit is contained in:
parent
7d1ef1ff01
commit
9d3e24df52
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Workspace Name="actube" Database="">
|
||||
<Project Name="ac" Path="ac.project" Active="Yes"/>
|
||||
<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_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"/>
|
||||
|
@ -295,6 +295,7 @@
|
||||
<File Name="src/cw/cw_in_generic_indexed_enum.c"/>
|
||||
<File Name="src/cw/cw_out_generic_indexed_enum.c"/>
|
||||
<File Name="src/cw/cw_ktv_del_sub.c"/>
|
||||
<File Name="src/cw/cw_strtransition.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
|
@ -69,3 +69,8 @@ psk/ap1:Bstr16:hallo
|
||||
|
||||
actube/listen:Bstr16:192.168.0.1
|
||||
|
||||
|
||||
wait-dtls:Word:12
|
||||
wait-join:Word:3
|
||||
|
||||
capwap-timers/change-state-pending-timer: Word: 3
|
||||
|
225
src/ac/wtpman.c
225
src/ac/wtpman.c
@ -90,15 +90,15 @@ static void wtpman_run_discovery(void *arg)
|
||||
|
||||
time_t timer = cw_timer_start(10);
|
||||
|
||||
wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY;
|
||||
wtpman->conn->capwap_transition = CAPWAP_STATE_DISCOVERY;
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer)
|
||||
&& wtpman->conn->capwap_state == CAPWAP_STATE_DISCOVERY) {
|
||||
&& wtpman->conn->capwap_transition == CAPWAP_STATE_DISCOVERY) {
|
||||
int rc;
|
||||
rc = cw_read_messages(wtpman->conn);
|
||||
if (cw_result_is_ok(rc)){
|
||||
wtpman->conn->capwap_state=CAPWAP_STATE_JOIN;
|
||||
wtpman->conn->capwap_transition=CAPWAP_STATE_JOIN;
|
||||
|
||||
cw_dbg(DBG_INFO,"Discovery has detected mods: %s %s",
|
||||
wtpman->conn->cmod->name,wtpman->conn->bmod->name);
|
||||
@ -131,44 +131,13 @@ int xprocess_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||
*/
|
||||
|
||||
|
||||
static int wtpman_establish_dtls(void *arg)
|
||||
static int wtpman_dtls_setup(void *arg)
|
||||
{
|
||||
char cipherstr[512];
|
||||
int dtls_ok;
|
||||
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
struct wtpman *wtpman = (struct wtpman *) arg;
|
||||
|
||||
|
||||
/* setup cipher */
|
||||
/* wtpman->conn->dtls_cipher = conf_sslcipher;*/
|
||||
|
||||
/* setup DTSL certificates */
|
||||
/* dtls_ok = 0;
|
||||
if (conf_sslkeyfilename && conf_sslcertfilename) {
|
||||
|
||||
|
||||
wtpman->conn->dtls_key_file = conf_sslkeyfilename;
|
||||
wtpman->conn->dtls_cert_file = conf_sslcertfilename;
|
||||
wtpman->conn->dtls_key_pass = conf_sslkeypass;
|
||||
wtpman->conn->dtls_verify_peer = conf_dtls_verify_peer;
|
||||
cw_dbg(DBG_DTLS, "Using key file %s", wtpman->conn->dtls_key_file);
|
||||
cw_dbg(DBG_DTLS, "Using cert file %s", wtpman->conn->dtls_cert_file);
|
||||
dtls_ok = 1;
|
||||
}
|
||||
*/
|
||||
/* setup DTLS psk */
|
||||
/* if (conf_dtls_psk) {
|
||||
wtpman->conn->dtls_psk = conf_dtls_psk;
|
||||
wtpman->conn->dtls_psk_len = strlen(conf_dtls_psk);
|
||||
dtls_ok = 1;
|
||||
}
|
||||
|
||||
if (!dtls_ok) {
|
||||
cw_log(LOG_ERR,
|
||||
"Can't establish DTLS session, neither psk nor certs set in config file.");
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
/* try to accept the connection */
|
||||
if (!dtls_accept(wtpman->conn)) {
|
||||
cw_dbg(DBG_DTLS, "Error establishing DTLS session with %s",
|
||||
@ -182,35 +151,22 @@ static int wtpman_establish_dtls(void *arg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int wtpman_join(void *arg, time_t timer)
|
||||
static int wtpman_join(void *arg)
|
||||
{
|
||||
int rc;
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
struct wtpman *wtpman = (struct wtpman *) arg;
|
||||
struct conn *conn = wtpman->conn;
|
||||
|
||||
/*
|
||||
// wtpman->conn->outgoing = mbag_create();
|
||||
// wtpman->conn->incomming = mbag_create();
|
||||
// conn->config = conn->incomming;
|
||||
// wtpman->conn->local = ac_config;
|
||||
|
||||
// mbag_set_str(conn->local, CW_ITEM_AC_NAME, conf_acname);
|
||||
|
||||
*/
|
||||
|
||||
wtpman->conn->capwap_state = CAPWAP_STATE_JOIN;
|
||||
|
||||
/*
|
||||
// wtpman->conn->actions = &capwap_actions;
|
||||
|
||||
// wtpman->conn->itemstore = mbag_create();
|
||||
*/
|
||||
time_t timer, wait_join;
|
||||
|
||||
cw_dbg(DBG_INFO, "Join State - %s", sock_addr2str(&conn->addr,sock_buf));
|
||||
|
||||
wait_join = cw_ktv_get_word(conn->global_cfg,"wait-join",CAPWAP_WAIT_JOIN);
|
||||
|
||||
while (!cw_timer_timeout(timer) && wtpman->conn->capwap_state == CAPWAP_STATE_JOIN) {
|
||||
timer = cw_timer_start(wait_join);
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer) && wtpman->conn->capwap_transition == CAPWAP_STATE_JOIN) {
|
||||
rc = cw_read_messages(wtpman->conn);
|
||||
if (rc < 0) {
|
||||
if (errno == EAGAIN)
|
||||
@ -218,19 +174,20 @@ static int wtpman_join(void *arg, time_t timer)
|
||||
|
||||
break;
|
||||
}
|
||||
cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"-------------dump------------","DMP","---------end dump --------");
|
||||
cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,
|
||||
"-------------dump------------",
|
||||
"DMP","---------end dump --------");
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
cw_log(LOG_ERR, "Error joining WTP %s", cw_strerror(rc));
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (wtpman->conn->capwap_state == CAPWAP_STATE_JOIN) {
|
||||
if (wtpman->conn->capwap_transition != CAPWAP_STATE_JOIN_COMPLETE) {
|
||||
cw_dbg(DBG_MSG_ERR, "No join request from %s after %d seconds, WTP died.",
|
||||
sock_addr2str(&wtpman->conn->addr,sock_buf), wtpman->conn->wait_dtls);
|
||||
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_join);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -323,15 +280,16 @@ void * wtpman_run_data(void *wtpman_arg)
|
||||
}
|
||||
|
||||
|
||||
/*#define CW_TRANSITION(prestate,state) (prestate<<16|state)*/
|
||||
|
||||
|
||||
static void * wtpman_run(void *arg)
|
||||
static void * wtpman_main(void *arg)
|
||||
{
|
||||
mavl_t r;
|
||||
int rc ;
|
||||
time_t timer;
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
struct conn *conn;
|
||||
int last_state;
|
||||
|
||||
struct wtpman *wtpman = (struct wtpman *) arg;
|
||||
|
||||
@ -340,6 +298,7 @@ static void * wtpman_run(void *arg)
|
||||
|
||||
wtpman->conn->remote_cfg = cw_ktv_create();
|
||||
|
||||
|
||||
/* We were invoked with an unencrypted packet,
|
||||
* so assume, it is a discovery request */
|
||||
if (!wtpman->dtlsmode){
|
||||
@ -352,26 +311,124 @@ static void * wtpman_run(void *arg)
|
||||
/* reject connections to our multi- or broadcast sockets */
|
||||
if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
|
||||
cw_dbg(DBG_DTLS,"Reject multi");
|
||||
/* cw_dbg(DBG_DTLS, "Dropping connection from %s to non-unicast socket.",
|
||||
CLIENT_IP);
|
||||
*/ wtpman_remove(wtpman);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
timer = cw_timer_start(wtpman->conn->wait_dtls);
|
||||
|
||||
|
||||
/* establish dtls session */
|
||||
if (!wtpman_establish_dtls(wtpman)) {
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conn->capwap_transition = CAPWAP_STATE_DTLS_SETUP;
|
||||
/* establish dtls session */
|
||||
if (!wtpman_dtls_setup(wtpman)) {
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*last_state = conn->capwap_state;
|
||||
conn->capwap_state = CAPWAP_STATE_JOIN;
|
||||
*/
|
||||
conn->capwap_transition = CW_TRANSITION(CAPWAP_STATE_DTLS_SETUP, CAPWAP_STATE_JOIN);
|
||||
rc = 0;
|
||||
|
||||
while (1){
|
||||
|
||||
int wait_join;
|
||||
int wait_change_state;
|
||||
|
||||
|
||||
|
||||
switch (conn->capwap_transition){
|
||||
case CW_TRANSITION(CAPWAP_STATE_DTLS_SETUP, CAPWAP_STATE_JOIN):
|
||||
{
|
||||
|
||||
wait_join = cw_ktv_get_word(conn->global_cfg,"wait-join",CAPWAP_WAIT_JOIN);
|
||||
timer = cw_timer_start(wait_join);
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_JOIN):
|
||||
{
|
||||
char wtpname[CAPWAP_MAX_WTP_NAME_LEN];
|
||||
cw_KTV_t * result;
|
||||
result = cw_ktv_get(conn->remote_cfg,"wtp-name",NULL);
|
||||
result->type->to_str(result,wtpname,CAPWAP_MAX_WTP_NAME_LEN);
|
||||
cw_dbg(DBG_INFO, "WTP joined: '%s', IP %s.",
|
||||
wtpname,
|
||||
sock_addr2str(&conn->addr,sock_buf)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_JOIN,CAPWAP_STATE_TIMEOUT):
|
||||
{
|
||||
cw_dbg(DBG_MSG_ERR, "No join request from %s after %d seconds, WTP died.",
|
||||
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_join);
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_CONFIGURE):
|
||||
{
|
||||
|
||||
wait_change_state = cw_ktv_get_word(conn->global_cfg,
|
||||
"capwap-timers/change-state-pending-timer",
|
||||
CAPWAP_TIMER_CHANGE_STATE_PENDING_TIMER);
|
||||
|
||||
/* printf("Capwap state configure\n");
|
||||
exit(0);
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case CW_TRANSITION(CAPWAP_STATE_CONFIGURE,CAPWAP_STATE_TIMEOUT):
|
||||
{
|
||||
cw_dbg(DBG_MSG_ERR, "No Change State Event Request %s after %d seconds, WTP died.",
|
||||
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_change_state);
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer)) {
|
||||
rc = cw_read_messages(wtpman->conn);
|
||||
if (rc < 0) {
|
||||
if (errno == EAGAIN)
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(rc<0){
|
||||
conn->capwap_transition =
|
||||
CW_TRANSITION(conn->capwap_transition,CAPWAP_STATE_TIMEOUT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* dtls is established, goto join state */
|
||||
if (!wtpman_join(wtpman, timer)) {
|
||||
|
||||
conn->capwap_transition = CAPWAP_STATE_JOIN;
|
||||
if (!wtpman_join(wtpman)) {
|
||||
wtpman_remove(wtpman);
|
||||
return NULL;
|
||||
}
|
||||
@ -383,7 +440,7 @@ static void * wtpman_run(void *arg)
|
||||
format_bin2hex(conn->session_id,16));
|
||||
|
||||
|
||||
|
||||
exit(0);
|
||||
|
||||
/*
|
||||
// cw_dbg(DBG_INFO, "Creating data thread");
|
||||
@ -397,7 +454,7 @@ static void * wtpman_run(void *arg)
|
||||
|
||||
rc = 0;
|
||||
while (!cw_timer_timeout(timer)
|
||||
&& wtpman->conn->capwap_state == CW_STATE_CONFIGURE) {
|
||||
&& wtpman->conn->capwap_transition == CAPWAP_STATE_CONFIGURE) {
|
||||
rc = cw_read_messages(wtpman->conn);
|
||||
if (rc < 0) {
|
||||
if (errno != EAGAIN)
|
||||
@ -415,14 +472,14 @@ cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"-------------dump------------","DMP",
|
||||
}
|
||||
|
||||
|
||||
if (conn->capwap_state == CW_STATE_IMAGE_DATA) {
|
||||
if (conn->capwap_transition == CW_STATE_IMAGE_DATA) {
|
||||
wtpman_image_data(wtpman);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
conn->capwap_state = CAPWAP_STATE_RUN;
|
||||
conn->capwap_transition = CAPWAP_STATE_RUN;
|
||||
/*
|
||||
// XXX testing ...
|
||||
// DBGX("Cofig to sql", "");
|
||||
@ -435,7 +492,7 @@ cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"-------------dump------------","DMP",
|
||||
reset_echointerval_timer(wtpman);
|
||||
|
||||
rc = 0;
|
||||
while (wtpman->conn->capwap_state == CAPWAP_STATE_RUN) {
|
||||
while (wtpman->conn->capwap_transition == CAPWAP_STATE_RUN) {
|
||||
rc = cw_read_messages(wtpman->conn);
|
||||
if (rc < 0) {
|
||||
if (errno != EAGAIN)
|
||||
@ -540,12 +597,12 @@ static void wtpman_run_dtls(void *arg)
|
||||
/*// time_t timer = cw_timer_start(wtpman->conn->wait_dtls);*/
|
||||
|
||||
/* establish dtls session */
|
||||
if (!wtpman_establish_dtls(wtpman)) {
|
||||
if (!wtpman_dtls_setup(wtpman)) {
|
||||
wtpman_remove(wtpman);
|
||||
return;
|
||||
}
|
||||
|
||||
wtpman_run(arg);
|
||||
wtpman_main(arg);
|
||||
}
|
||||
|
||||
|
||||
@ -667,7 +724,7 @@ void wtpman_start(struct wtpman *wtpman, int dtlsmode)
|
||||
{
|
||||
cw_dbg(DBG_INFO, "Starting wtpman, DTLS mode = %d",dtlsmode);
|
||||
wtpman->dtlsmode=dtlsmode;
|
||||
pthread_create(&wtpman->thread, NULL, wtpman_run,
|
||||
pthread_create(&wtpman->thread, NULL, wtpman_main,
|
||||
(void *) wtpman);
|
||||
return;
|
||||
}
|
||||
|
@ -378,6 +378,8 @@
|
||||
#define CAPWAP_WAIT_DTLS 60
|
||||
#define CAPWAP_WAIT_JOIN 60
|
||||
|
||||
#define CAPWAP_TIMER_CHANGE_STATE_PENDING_TIMER 25
|
||||
|
||||
#define CAPWAP_IDLE_TIMEOUT 300
|
||||
|
||||
|
||||
@ -589,7 +591,9 @@ extern struct cw_StrListElem capwap_strings_board[];
|
||||
|
||||
#define cw_strmsg(id) cw_strlist_get_str(capwap_strings_msg,id)
|
||||
#define cw_strelem(id) cw_strlist_get_str(capwap_strings_elem,id)
|
||||
#define cw_strstate(id) cw_strlist_get_str(capwap_strings_state,id)
|
||||
|
||||
#define cw_strprestate(id) cw_strlist_get_str(capwap_strings_state,id >> 8)
|
||||
#define cw_strstate(id) cw_strlist_get_str(capwap_strings_state,id & 0xff)
|
||||
#define cw_strvendor(id) cw_strlist_get_str(capwap_strings_vendor,id)
|
||||
|
||||
#define cw_strresult(id) cw_strlist_get_str(capwap_strings_result,id)
|
||||
@ -642,13 +646,18 @@ enum capwap_states {
|
||||
CAPWAP_STATE_DISCOVERY,
|
||||
/** Join State */
|
||||
CAPWAP_STATE_JOIN,
|
||||
CAPWAP_STATE_JOIN_COMPLETE,
|
||||
|
||||
/** Config State */
|
||||
CW_STATE_CONFIGURE,
|
||||
CAPWAP_STATE_CONFIGURE,
|
||||
CAPWAP_STATE_DTLS_SETUP, /**< DTLS Setup */
|
||||
/** Image Data Upload */
|
||||
CW_STATE_IMAGE_DATA,
|
||||
CW_STATE_UPDATE,
|
||||
/** Run State */
|
||||
CAPWAP_STATE_RUN
|
||||
CAPWAP_STATE_RUN,
|
||||
|
||||
CAPWAP_STATE_TIMEOUT
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,10 @@ struct cw_StrListElem capwap_strings_state[] = {
|
||||
{ CAPWAP_STATE_DISCOVERY, "Discovery" },
|
||||
{ CAPWAP_STATE_JOIN,"Join" },
|
||||
{ CAPWAP_STATE_RUN,"Run" },
|
||||
{ CW_STATE_CONFIGURE,"Configure" },
|
||||
{ CAPWAP_STATE_CONFIGURE,"Configure" },
|
||||
{ CW_STATE_IMAGE_DATA,"Image Data" },
|
||||
{ CAPWAP_STATE_DTLS_SETUP, "DTLS Setup" },
|
||||
{ CW_STR_STOP,"Undefined" },
|
||||
|
||||
};
|
||||
|
||||
|
@ -115,7 +115,7 @@ struct conn {
|
||||
|
||||
/** Current CAPWAP state */
|
||||
|
||||
uint8_t capwap_state;
|
||||
uint16_t capwap_transition;
|
||||
|
||||
|
||||
/** The framgent manager used on this connection */
|
||||
|
@ -219,7 +219,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
struct cw_MsgData search;
|
||||
struct cw_MsgData * message;
|
||||
int result_code;
|
||||
int *i;
|
||||
uint16_t *ui;
|
||||
uint8_t *elems_ptr;
|
||||
uint8_t *elem;
|
||||
|
||||
@ -299,7 +299,8 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
cw_dbg(DBG_MSG_ERR,
|
||||
"Message type %d [%s] unrecognized, sending response.",
|
||||
search.type, cw_strmsg(search.type),
|
||||
cw_strstate(conn->capwap_state));
|
||||
cw_strstate(conn->capwap_transition));
|
||||
|
||||
result_code = CAPWAP_RESULT_MSG_UNRECOGNIZED;
|
||||
cw_send_error_response(conn, rawmsg, result_code);
|
||||
errno = EAGAIN;
|
||||
@ -308,7 +309,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
cw_dbg(DBG_MSG_ERR,
|
||||
"Message type %d [%s] unrecognized, discarding.",
|
||||
search.type, cw_strmsg(search.type),
|
||||
cw_strstate(conn->capwap_state));
|
||||
cw_strstate(conn->capwap_transition));
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
|
||||
@ -320,25 +321,29 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
* */
|
||||
if (!(message->receiver & conn->role)) {
|
||||
cw_dbg(DBG_MSG_ERR,
|
||||
"Message type %d (%s) unexpected/illegal in %s State, discarding.",
|
||||
"Message type %d (%s) unexpected/illegal in %s->%s State, discarding.",
|
||||
search.type, cw_strmsg(search.type),
|
||||
cw_strstate(conn->capwap_state));
|
||||
cw_strprestate(conn->capwap_transition),
|
||||
cw_strstate(conn->capwap_transition));
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check if current state is in state of message */
|
||||
i = message->states;
|
||||
for (i=message->states; *i; i++){
|
||||
if(*i==conn->capwap_state)
|
||||
ui = message->states;
|
||||
for (ui=message->states; *ui; ui++){
|
||||
printf("Comparing %d and %d\n", conn->capwap_transition, *ui);
|
||||
if(*ui==conn->capwap_transition)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!*i){
|
||||
if (!*ui){
|
||||
/* Message found, but it was in wrong state */
|
||||
cw_dbg(DBG_MSG_ERR,
|
||||
"Message type %d (%s) not allowed in %s State, sending response.",
|
||||
search.type,cw_strmsg(search.type), cw_strstate(conn->capwap_state));
|
||||
"Message type %d (%s) not allowed in %s->%s State, sending response.",
|
||||
search.type,cw_strmsg(search.type),
|
||||
cw_strprestate(conn->capwap_transition),
|
||||
cw_strstate(conn->capwap_transition));
|
||||
result_code = CAPWAP_RESULT_MSG_INVALID_IN_CURRENT_STATE;
|
||||
cw_send_error_response(conn, rawmsg, result_code);
|
||||
errno = EAGAIN;
|
||||
@ -444,6 +449,11 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
cw_send_error_response(conn, rawmsg, result_code);
|
||||
} else if (result_code == 0) {
|
||||
cw_ktv_set_dword(conn->local_cfg,"result-code",result_code);
|
||||
if (message->next_state){
|
||||
conn->capwap_transition =
|
||||
CW_TRANSITION(conn->capwap_transition,message->next_state);
|
||||
|
||||
}
|
||||
|
||||
/* All is ok, send regular response message */
|
||||
cw_send_response(conn, rawmsg, len);
|
||||
|
@ -340,6 +340,9 @@ struct cw_DescriptorSubelemDef {
|
||||
#define CW_IGNORE 5
|
||||
|
||||
|
||||
#define CW_TRANSITION(prestate,state) (prestate<<8|state)
|
||||
|
||||
|
||||
int cw_check_missing_mand(struct cw_MsgData *msgdata, mavl_t keys );
|
||||
|
||||
|
||||
|
8
src/cw/cw_strtransition.c
Normal file
8
src/cw/cw_strtransition.c
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
const char * cw_strtransition(uint16_t state)
|
||||
{
|
||||
|
||||
}
|
@ -284,14 +284,16 @@ int cw_msgset_add(struct cw_MsgSet *set,
|
||||
}
|
||||
|
||||
/* Overwrite the found message */
|
||||
if (msgdef->name)
|
||||
if (msgdef->name != NULL)
|
||||
msg->name = msgdef->name;
|
||||
if (msgdef->states)
|
||||
if (msgdef->states != NULL)
|
||||
msg->states = msgdef->states;
|
||||
if (msgdef->postprocess != NULL)
|
||||
msg->postprocess = msgdef->postprocess;
|
||||
if (msgdef->preprocess != NULL)
|
||||
msg->preprocess = msgdef->preprocess;
|
||||
if (msgdef->next_state)
|
||||
msg->next_state=msgdef->next_state;
|
||||
|
||||
msg->receiver = msgdef->receiver;
|
||||
|
||||
|
@ -66,19 +66,20 @@ struct cw_MsgDef{
|
||||
const char * name;
|
||||
int type; /**< Message type */
|
||||
int receiver; /**< Who can receive this message */
|
||||
int * states; /**< states in wich the message is allowed */
|
||||
uint16_t * states; /**< states in wich the message is allowed */
|
||||
|
||||
|
||||
struct cw_ElemDef * elements;
|
||||
int (*preprocess)(struct conn * conn);
|
||||
int (*postprocess)(struct conn * conn);
|
||||
uint8_t next_state;
|
||||
};
|
||||
|
||||
|
||||
struct cw_MsgData{
|
||||
int type;
|
||||
const char * name;
|
||||
int * states;
|
||||
uint16_t * states;
|
||||
int receiver;
|
||||
mavl_t elements_tree;
|
||||
mlist_t elements_list;
|
||||
@ -86,6 +87,7 @@ struct cw_MsgData{
|
||||
|
||||
int (*preprocess)(struct conn * conn);
|
||||
int (*postprocess)(struct conn * conn);
|
||||
uint8_t next_state;
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,6 +27,10 @@
|
||||
|
||||
#include "mod_capwap.h"
|
||||
|
||||
|
||||
static int postprocess_join_request(struct conn *conn);
|
||||
|
||||
|
||||
static cw_KTVStruct_t wtp_reboot_statistics[] = {
|
||||
{CW_TYPE_WORD, "reboot-count", 2,-1},
|
||||
{CW_TYPE_WORD, "ac-initiated-count", 2,-1},
|
||||
@ -397,7 +401,7 @@ static struct cw_ElemHandler handlers[] = {
|
||||
};
|
||||
|
||||
|
||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static uint16_t discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static struct cw_ElemDef discovery_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
||||
@ -410,7 +414,7 @@ static struct cw_ElemDef discovery_request_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static uint16_t discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static struct cw_ElemDef discovery_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
|
||||
@ -421,7 +425,9 @@ static struct cw_ElemDef discovery_response_elements[] ={
|
||||
|
||||
};
|
||||
|
||||
static int join_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t join_request_states[] = {
|
||||
CW_TRANSITION(CAPWAP_STATE_DTLS_SETUP,CAPWAP_STATE_JOIN),
|
||||
0};
|
||||
static struct cw_ElemDef join_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_LOCATION_DATA, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
||||
@ -440,7 +446,7 @@ static struct cw_ElemDef join_request_elements[] ={
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int join_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t join_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef join_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
|
||||
@ -459,7 +465,9 @@ static struct cw_ElemDef join_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int configuration_status_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t configuration_status_request_states[] = {
|
||||
CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_JOIN),
|
||||
0};
|
||||
static struct cw_ElemDef configuration_status_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1, 0},
|
||||
@ -471,7 +479,7 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int configuration_status_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t configuration_status_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef configuration_status_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_CAPWAP_TIMERS, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_DECRYPTION_ERROR_REPORT_PERIOD, 1, 0},
|
||||
@ -483,7 +491,7 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static uint16_t configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
|
||||
{0,0,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 0, 0},
|
||||
@ -497,14 +505,16 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
|
||||
|
||||
|
||||
static int configuration_update_response_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static uint16_t configuration_update_response_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef configuration_update_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
|
||||
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int change_state_event_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t change_state_event_request_states[] = {
|
||||
CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_CONFIGURE),
|
||||
0};
|
||||
static struct cw_ElemDef change_state_event_request_elements[] ={
|
||||
|
||||
{0,0,CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 1,0},
|
||||
@ -514,7 +524,7 @@ static struct cw_ElemDef change_state_event_request_elements[] ={
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int change_state_event_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t change_state_event_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef change_state_event_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
|
||||
|
||||
@ -522,14 +532,14 @@ static struct cw_ElemDef change_state_event_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int wtp_event_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t wtp_event_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef wtp_event_request_elements[] ={
|
||||
|
||||
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef wtp_event_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
|
||||
|
||||
@ -537,13 +547,13 @@ static struct cw_ElemDef wtp_event_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int echo_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static uint16_t echo_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef echo_request_elements[] ={
|
||||
{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 uint16_t echo_response_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef echo_response_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
|
||||
{0,0,0,0,0}
|
||||
@ -574,7 +584,11 @@ static struct cw_MsgDef messages[] = {
|
||||
CAPWAP_MSG_JOIN_REQUEST,
|
||||
CW_ROLE_AC,
|
||||
join_request_states,
|
||||
join_request_elements
|
||||
join_request_elements,
|
||||
NULL,
|
||||
postprocess_join_request,
|
||||
CAPWAP_STATE_JOIN,
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
@ -590,7 +604,10 @@ static struct cw_MsgDef messages[] = {
|
||||
CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST, /* msg type */
|
||||
CW_ROLE_AC, /* role */
|
||||
configuration_status_request_states, /* allowed states */
|
||||
configuration_status_request_elements /* msg elements */
|
||||
configuration_status_request_elements, /* msg elements */
|
||||
NULL,
|
||||
NULL,
|
||||
CAPWAP_STATE_CONFIGURE
|
||||
},
|
||||
|
||||
{
|
||||
@ -623,6 +640,9 @@ static struct cw_MsgDef messages[] = {
|
||||
CW_ROLE_AC, /* role */
|
||||
change_state_event_request_states, /* allowed states */
|
||||
change_state_event_request_elements /* msg elements */
|
||||
NULL,
|
||||
NULL,
|
||||
CAPWAP_STATE_DATA_CHECK
|
||||
},
|
||||
|
||||
{
|
||||
@ -667,54 +687,19 @@ static struct cw_MsgDef messages[] = {
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* {
|
||||
"Discovery Request",
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
CW_RECEIVER_AC,
|
||||
(int[]){CAPWAP_STATE_DISCOVERY,0}
|
||||
|
||||
},
|
||||
*/
|
||||
|
||||
/* Discovery Request Message*/
|
||||
/* {
|
||||
.name = "Discovery Request",
|
||||
.type = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
.receiver = CW_RECEIVER_AC,
|
||||
.states = (int[]){CAPWAP_STATE_DISCOVERY,0},
|
||||
.elements = (cw_ElemDef_t []){
|
||||
{&_DISCOVERY_TYPE,1},
|
||||
{&_WTP_BOARD_DATA,1},
|
||||
{&_WTP_DESCRIPTOR,1},
|
||||
{&_WTP_FRAME_TUNNEL_MODE,1},
|
||||
{&_WTP_MAC_TYPE,1},
|
||||
{&_MTU_DISCOVERY_PADDING,0},
|
||||
{&_VENDOR_SPECIFIC_PAYLOAD,0},
|
||||
{0,0},
|
||||
}
|
||||
},
|
||||
*/
|
||||
/* Discovery Request Response */
|
||||
/* {
|
||||
.name = "Discovery Response",
|
||||
.type = CAPWAP_MSG_DISCOVERY_RESPONSE,
|
||||
.receiver = CW_RECEIVER_WTP,
|
||||
.states = (int[]){CAPWAP_STATE_DISCOVERY,0},
|
||||
.elements = (cw_ElemDef_t[]){
|
||||
{&_AC_DESCRIPTOR,1},
|
||||
{0,0},
|
||||
}
|
||||
},
|
||||
*/ {0,0,0,0}
|
||||
|
||||
|
||||
{0,0,0,0}
|
||||
|
||||
};
|
||||
|
||||
|
||||
static int postprocess_join_request(struct conn *conn)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||
if (mode != CW_MOD_MODE_CAPWAP)
|
||||
return NULL;
|
||||
|
@ -203,7 +203,7 @@ static cw_action_in_t actions_in[] = {
|
||||
* Message Configuration Status Response - IN
|
||||
*/
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.end = cw_in_check_generic_resp
|
||||
}
|
||||
@ -212,7 +212,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Capwap Timers - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_CAPWAP_TIMERS,
|
||||
.item_id = CW_ITEM_CAPWAP_TIMERS,
|
||||
@ -225,7 +225,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Decryption Error Report - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_DECRYPTION_ERROR_REPORT_PERIOD,
|
||||
.item_id = CW_RADIOITEM_DECRYPTION_ERROR_REPORT_PERIOD,
|
||||
@ -239,7 +239,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Idle Timeout - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_IDLE_TIMEOUT,
|
||||
.item_id = CW_ITEM_IDLE_TIMEOUT,
|
||||
@ -253,7 +253,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* WTP Fallback - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_WTP_FALLBACK,
|
||||
.item_id = CW_ITEM_WTP_FALLBACK,
|
||||
@ -269,7 +269,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Result Code - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_RESULT_CODE,
|
||||
.item_id = CW_ITEM_RESULT_CODE,
|
||||
@ -283,7 +283,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* AC IPv4 List - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_AC_IPV4_LIST,
|
||||
.item_id = CW_ITEM_AC_IP_LIST,
|
||||
@ -297,7 +297,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Vendor Specific Payload - Cponfig Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD,
|
||||
.start = cw_in_vendor_specific_payload
|
||||
@ -312,14 +312,14 @@ static cw_action_in_t actions_in[] = {
|
||||
*/
|
||||
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CHANGE_STATE_EVENT_RESPONSE,
|
||||
.end = cw_in_check_cfg_update_req
|
||||
}
|
||||
,
|
||||
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CHANGE_STATE_EVENT_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_RESULT_CODE,
|
||||
.item_id = CW_ITEM_RESULT_CODE,
|
||||
|
@ -29,7 +29,7 @@ int capwap_in_vendor_specific_payload(struct cw_ElemHandler *handler,
|
||||
cw_dbg(DBG_WARN,
|
||||
"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
||||
cw_strvendor(vendor_id), elem_id, params->msgdata->type,
|
||||
params->msgdata->name, cw_strstate(params->conn->capwap_state));
|
||||
params->msgdata->name, cw_strstate(params->conn->capwap_transition));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,10 @@
|
||||
|
||||
#include "mod_capwap80211.h"
|
||||
|
||||
static int capwap80211_in_crate_set(struct cw_ElemHandler *eh,
|
||||
/*static int capwap80211_in_crate_set(struct cw_ElemHandler *eh,
|
||||
struct cw_ElemHandlerParams *params,
|
||||
uint8_t * data, int len);
|
||||
*/
|
||||
|
||||
static struct cw_ElemHandler handlers[] = {
|
||||
{
|
||||
@ -33,8 +34,8 @@ static struct cw_ElemHandler handlers[] = {
|
||||
3, 0, /* min/max length */
|
||||
CW_TYPE_BSTR16, /* type */
|
||||
"rate_set", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic /* put */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic /* put */
|
||||
}
|
||||
,
|
||||
{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL}
|
||||
@ -42,7 +43,7 @@ static struct cw_ElemHandler handlers[] = {
|
||||
|
||||
};
|
||||
|
||||
static int discovery_request_states[] = { CAPWAP_STATE_DISCOVERY, 0 };
|
||||
/*static int discovery_request_states[] = { CAPWAP_STATE_DISCOVERY, 0 };*/
|
||||
static struct cw_ElemDef discovery_request_elements[] = {
|
||||
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
|
||||
{0, 0, 0, 0, 0}
|
||||
@ -50,21 +51,21 @@ static struct cw_ElemDef discovery_request_elements[] = {
|
||||
};
|
||||
|
||||
|
||||
static int join_request_states[] = { CAPWAP_STATE_JOIN, 0 };
|
||||
/*static int join_request_states[] = { CAPWAP_STATE_JOIN, 0 };*/
|
||||
static struct cw_ElemDef join_request_elements[] = {
|
||||
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
|
||||
{0, 0, 0, 0, 0}
|
||||
|
||||
};
|
||||
|
||||
static int join_response_states[] = { CAPWAP_STATE_JOIN, 0 };
|
||||
/*static int join_response_states[] = { CAPWAP_STATE_JOIN, 0 };*/
|
||||
static struct cw_ElemDef join_response_elements[] = {
|
||||
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
|
||||
{0, 0, 0, 0, 0}
|
||||
|
||||
};
|
||||
|
||||
static int configuration_status_response_states[] = { CAPWAP_STATE_JOIN, 0 };
|
||||
/*static int configuration_status_response_states[] = { CAPWAP_STATE_JOIN, 0 };*/
|
||||
static struct cw_ElemDef configuration_status_response_elements[] = {
|
||||
{0, 0, CAPWAP80211_ELEM_RATE_SET , 1, 0},
|
||||
{0, 0, 0, 0, 0}
|
||||
@ -75,23 +76,23 @@ static struct cw_MsgDef messages[] = {
|
||||
NULL,
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
CW_ROLE_AC,
|
||||
discovery_request_states,
|
||||
NULL, /* states */
|
||||
discovery_request_elements
|
||||
}
|
||||
,
|
||||
{
|
||||
NULL,
|
||||
CAPWAP_MSG_JOIN_REQUEST,
|
||||
CW_ROLE_AC,
|
||||
join_request_states,
|
||||
join_request_elements
|
||||
NULL, /* name */
|
||||
CAPWAP_MSG_JOIN_REQUEST, /* type */
|
||||
CW_ROLE_AC, /* role */
|
||||
NULL, /* states */
|
||||
join_request_elements /* elements */
|
||||
}
|
||||
,
|
||||
{
|
||||
NULL,
|
||||
CAPWAP_MSG_JOIN_RESPONSE,
|
||||
CW_ROLE_AC,
|
||||
join_response_states,
|
||||
NULL,
|
||||
join_response_elements
|
||||
}
|
||||
,
|
||||
@ -99,7 +100,7 @@ static struct cw_MsgDef messages[] = {
|
||||
NULL,
|
||||
CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
CW_ROLE_WTP,
|
||||
configuration_status_response_states,
|
||||
NULL,
|
||||
configuration_status_response_elements
|
||||
}
|
||||
,
|
||||
@ -121,19 +122,19 @@ int mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static int capwap80211_in_crate_set(struct cw_ElemHandler *eh,
|
||||
struct cw_ElemHandlerParams *params,
|
||||
uint8_t * data, int len)
|
||||
{
|
||||
/* int radio;
|
||||
int radio;
|
||||
int i;
|
||||
radio = cw_get_byte(data);
|
||||
for (i=0; i<len-1; i++){
|
||||
int rate = (data+1)[i];
|
||||
sprintf(d,"%0.1f",dot11_rate2float(val & 0x7f));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
static int postprocess_discovery();
|
||||
static int preprocess_join_request();
|
||||
|
||||
static int postprocess_join_request();
|
||||
|
||||
|
||||
static cw_KTVStruct_t ap_time_sync[] = {
|
||||
@ -1338,7 +1338,7 @@ static struct cw_ElemHandler handlers73[] = {
|
||||
};
|
||||
|
||||
|
||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static uint16_t discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static struct cw_ElemDef discovery_request_elements[] ={
|
||||
/* {0,0, CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},*/
|
||||
{0,0, CAPWAP_ELEM_WTP_BOARD_DATA, 0, 0},
|
||||
@ -1348,7 +1348,7 @@ static struct cw_ElemDef discovery_request_elements[] ={
|
||||
|
||||
};
|
||||
|
||||
static int discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static uint16_t discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static struct cw_ElemDef discovery_response_elements[] ={
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_TIMESYNC, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_MWAR_TYPE, 0, 0},
|
||||
@ -1357,7 +1357,7 @@ static struct cw_ElemDef discovery_response_elements[] ={
|
||||
|
||||
};
|
||||
|
||||
static int join_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
/*static uint16_t join_request_states[] = {CAPWAP_STATE_JOIN,0};*/
|
||||
static struct cw_ElemDef join_request_elements[] ={
|
||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_BOARD_DATA_OPTIONS, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_GROUP_NAME, 1, 0},
|
||||
@ -1378,7 +1378,7 @@ static struct cw_ElemDef join_request_elements[] ={
|
||||
|
||||
};
|
||||
|
||||
static int join_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t join_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef join_response_elements[] ={
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||
|
||||
@ -1391,7 +1391,7 @@ static struct cw_ElemDef join_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int configuration_status_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
/*static uint16_t configuration_status_request_states[] = {CAPWAP_STATE_JOIN,0};*/
|
||||
static struct cw_ElemDef configuration_status_request_elements[] ={
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||
|
||||
@ -1433,7 +1433,7 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
|
||||
|
||||
};
|
||||
|
||||
static int configuration_status_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t configuration_status_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef configuration_status_response_elements[] ={
|
||||
{0,0, CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1,0},
|
||||
{0,0, CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 1,0},
|
||||
@ -1455,7 +1455,7 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
|
||||
};
|
||||
|
||||
|
||||
static int configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static uint16_t configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||
|
||||
@ -1513,21 +1513,21 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
|
||||
};
|
||||
|
||||
static int wtp_event_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t wtp_event_request_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef wtp_event_request_elements[] ={
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_HARDWARE_INFO, 0, 0},
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static uint16_t wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};
|
||||
static struct cw_ElemDef wtp_event_response_elements[] ={
|
||||
/* {0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},*/
|
||||
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
static int wtp_echo_response_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static uint16_t wtp_echo_response_states[] = {CAPWAP_STATE_RUN,0};
|
||||
static struct cw_ElemDef wtp_echo_response_elements[] ={
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_TIMESYNC, 1, 0},
|
||||
{0,0,0,0,0}
|
||||
@ -1555,11 +1555,11 @@ static struct cw_MsgDef messages[] = {
|
||||
{
|
||||
NULL, /* name */
|
||||
CAPWAP_MSG_JOIN_REQUEST, /* type */
|
||||
CW_ROLE_AC,
|
||||
join_request_states,
|
||||
CW_ROLE_AC, /* role to receive */
|
||||
NULL, /* states, taken from mod_capwap*/
|
||||
join_request_elements,
|
||||
preprocess_join_request, /* preprocess fun */
|
||||
postprocess_discovery /* postprocess */
|
||||
postprocess_join_request /* postprocess */
|
||||
},
|
||||
{
|
||||
NULL, /* name */
|
||||
@ -1574,7 +1574,7 @@ static struct cw_MsgDef messages[] = {
|
||||
NULL, /* name */
|
||||
CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST, /* type */
|
||||
CW_ROLE_AC,
|
||||
configuration_status_request_states,
|
||||
NULL, /* states */
|
||||
configuration_status_request_elements,
|
||||
NULL /* postprocess */
|
||||
},
|
||||
@ -1701,6 +1701,12 @@ static int postprocess_discovery(struct conn *conn)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int postprocess_join_request(struct conn *conn)
|
||||
{
|
||||
postprocess_discovery(conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int preprocess_join_request(struct conn *conn)
|
||||
{
|
||||
cw_KTV_t * ver;
|
||||
|
@ -190,7 +190,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Element Cisco 802.11 Radio Conffig - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.elem_id = CW_CISCO_WTP_RADIO_CFG,
|
||||
@ -202,7 +202,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* Radio Admin State - Config Status Response */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,
|
||||
.item_id = CW_RADIOITEM_ADMIN_STATE,
|
||||
@ -219,7 +219,7 @@ static cw_action_in_t actions_in[] = {
|
||||
|
||||
{
|
||||
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.elem_id = CISCO_ELEM_SPAM_VENDOR_SPECIFIC,
|
||||
@ -244,7 +244,7 @@ static cw_action_in_t actions_in[] = {
|
||||
{
|
||||
|
||||
.proto = CW_ACTION_PROTO_LWAPP,
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.vendor_id = LW_VENDOR_ID_CISCO,
|
||||
.elem_id = CISCO_LWELEM_MWAR_HASH_VALUE,
|
||||
@ -424,7 +424,7 @@ static cw_action_in_t actions80211_in[] = {
|
||||
|
||||
/* Radio Operational State - Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id= CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CAPWAP_ELEM_RADIO_OPERATIONAL_STATE,
|
||||
.item_id = CW_RADIOITEM_OPER_STATE,
|
||||
|
@ -20,7 +20,7 @@ int cisco_in_spam_vendor_specific(struct cw_ElemHandler *eh,
|
||||
cw_dbg(DBG_WARN,
|
||||
"Can't handle Vendor Specific LWAPP Payload %s/%d, in msg %d (%s) in %s state.",
|
||||
cw_strvendor(vendor_id), elem_id, params->msgdata->type,
|
||||
params->msgdata->name, cw_strstate(params->conn->capwap_state));
|
||||
params->msgdata->name, cw_strstate(params->conn->capwap_transition));
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ static cw_action_in_t actions_in[] = {
|
||||
/* AC Name - Config Status Request */
|
||||
{
|
||||
/* We have to deal with zero-length strings */
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.capwap_state = CAPWAP_STATE_CONFIGURE,
|
||||
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
.elem_id = CAPWAP_ELEM_AC_NAME,
|
||||
.item_id = CW_ITEM_AC_NAME,
|
||||
|
@ -10,7 +10,6 @@ int changestate(struct conn * conn)
|
||||
{
|
||||
|
||||
|
||||
|
||||
/* Update operational states, so they will be included
|
||||
in the change Change State Event Request message. */
|
||||
/*// cw_radio_update_oper_states(conn->radios,0);*/
|
||||
|
@ -148,7 +148,7 @@ static int run_discovery(struct conn *conn, struct cw_DiscoveryResult * dis)
|
||||
}
|
||||
|
||||
|
||||
conn->capwap_state = CAPWAP_STATE_DISCOVERY;
|
||||
conn->capwap_transition = CAPWAP_STATE_DISCOVERY;
|
||||
|
||||
|
||||
/* create and send a discovery request message */
|
||||
@ -164,7 +164,7 @@ static int run_discovery(struct conn *conn, struct cw_DiscoveryResult * dis)
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer)
|
||||
&& conn->capwap_state == CAPWAP_STATE_DISCOVERY) {
|
||||
&& conn->capwap_transition == CAPWAP_STATE_DISCOVERY) {
|
||||
int rc;
|
||||
char addr_str[SOCK_ADDR_BUFSIZE];
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
int image_update()
|
||||
{
|
||||
struct conn *conn = get_conn();
|
||||
if (conn->capwap_state != CW_STATE_CONFIGURE) {
|
||||
if (conn->capwap_state != CAPWAP_STATE_CONFIGURE) {
|
||||
cw_log(LOG_ERR, "Current state not image update");
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ int run_join_d(struct conn * conn, struct sockaddr *sa)
|
||||
}
|
||||
|
||||
/* setup a socket */
|
||||
conn->capwap_state = CAPWAP_STATE_JOIN;
|
||||
conn->capwap_transition = CAPWAP_STATE_JOIN;
|
||||
sockfd = socket(sa->sa_family, SOCK_DGRAM, 0);
|
||||
if (sockfd == -1) {
|
||||
cw_log(LOG_ERR, "Can't create socket: %s\n", strerror(errno));
|
||||
|
@ -140,7 +140,7 @@ int run(struct conn * conn)
|
||||
|
||||
|
||||
|
||||
conn->capwap_state = CAPWAP_STATE_RUN;
|
||||
conn->capwap_transition = CAPWAP_STATE_RUN;
|
||||
|
||||
/* conn->msg_end=handle_update_req;*/
|
||||
|
||||
@ -156,7 +156,7 @@ int run(struct conn * conn)
|
||||
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer) && conn->capwap_state == CAPWAP_STATE_RUN) {
|
||||
while (!cw_timer_timeout(timer) && conn->capwap_transition == CAPWAP_STATE_RUN) {
|
||||
mavl_del_all(conn->remote_cfg);
|
||||
rc = cw_read_messages(conn);
|
||||
if (rc < 0 && errno == EAGAIN) {
|
||||
@ -196,7 +196,7 @@ int run(struct conn * conn)
|
||||
|
||||
|
||||
|
||||
} while (conn->capwap_state == CAPWAP_STATE_RUN);
|
||||
} while (conn->capwap_transition == CAPWAP_STATE_RUN);
|
||||
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user