Rename CW_ -> CAPWAP_

FossilOrigin-Name: 815905c068277bbfc6cf94cea5cbf44bb71258d56d748028b865ab76346ba085
This commit is contained in:
7u83@mail.ru
2018-02-28 06:38:02 +00:00
parent f0e838de0a
commit ad79d0a3a4
29 changed files with 107 additions and 64 deletions

View File

@ -675,7 +675,7 @@ enum capwap_states {
/** Discovery State */
CAPWAP_STATE_DISCOVERY,
/** Join State */
CW_STATE_JOIN,
CAPWAP_STATE_JOIN,
/** Config State */
CW_STATE_CONFIGURE,
/** Image Data Upload */

View File

@ -23,7 +23,7 @@ cw_action_in_t capwap_80211_actions_ac_in[] = {
* Discovery Resquest
*/
{0, 0, CW_STATE_JOIN, CAPWAP_MSG_JOIN_REQUEST,
{0, 0, CAPWAP_STATE_JOIN, CAPWAP_MSG_JOIN_REQUEST,
CW_ACTION_IN_80211_WTP_RADIO_INFORMATION, 1}
,

View File

@ -18,7 +18,7 @@ cw_action_in_t capwap_80211_actions_wtp_in[] = {
,
/* Join Response */
{0, 0, CW_STATE_JOIN, CAPWAP_MSG_JOIN_RESPONSE,
{0, 0, CAPWAP_STATE_JOIN, CAPWAP_MSG_JOIN_RESPONSE,
CW_ACTION_IN_80211_WTP_RADIO_INFORMATION, 1}
,

View File

@ -2,7 +2,7 @@
struct cw_strlist_elem capwap_strings_state[] = {
{ CAPWAP_STATE_DISCOVERY, "Discovery" },
{ CW_STATE_JOIN,"Join" },
{ CAPWAP_STATE_JOIN,"Join" },
{ CW_STATE_RUN,"Run" },
{ CW_STATE_CONFIGURE,"Configure" },
{ CW_STATE_IMAGE_DATA,"Image Data" },

View File

@ -82,6 +82,8 @@ struct conn {
uint8_t session_id[16];
int receiver;
/** base_mac */
bstr_t base_rmac;

View File

@ -288,11 +288,42 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
return -1;
}
printf("Receivers: %d %d\n",message->receiver,conn->receiver);
/* Throw away unexpected messages */
if (!(message->receiver & conn->receiver)) {
cw_dbg(DBG_MSG_ERR,
"Message type %d (%s) unexpected/illegal in %s State, discarding.",
search.type, cw_strmsg(search.type),
cw_strstate(conn->capwap_state));
errno = EAGAIN;
return -1;
}
/* Check if current state is in state of message */
int *i = message->states;
for (i=message->states; *i; i++){
if(*i==conn->capwap_state)
break;
}
if (!*i){
/* Message found, but it was in wrong state */
cw_dbg(DBG_MSG_ERR,
"Message type %d (%s) not allowed in %s State.", search.type,
cw_strmsg(search.type), cw_strstate(conn->capwap_state));
result_code = CAPWAP_RESULT_MSG_INVALID_IN_CURRENT_STATE;
cw_send_error_response(conn, rawmsg, result_code);
errno = EAGAIN;
return -1;
}
// afm = cw_actionlist_in_get(conn->actions->in, &as);
if (!afm) {
/* Throw away unexpected response messages */
// Throw away unexpected response messages
if (!(as.msg_id & 1)) {
cw_dbg(DBG_MSG_ERR,
"Message type %d (%s) unexpected/illegal in %s State, discarding.",

View File

@ -133,9 +133,14 @@ typedef struct{
int op;
}cw_msgelemprops_t;
#define CW_RECEIVER_AC 1
#define CW_RECEIVER_WTP 1
struct cw_MsgDef{
int type;
int * states;
int type; /**< Message type */
int * states; /**< states in wich the message is allowed */
int receiver; /**< Who can receive this message */
cw_msgelemprops_t * elements;
const char * name;
};

View File

@ -16,7 +16,7 @@ int cw_in_check_cfg_update_req(struct conn *conn, struct cw_action_in *a, uint8_
if (n) {
if ( conn->strict_capwap ){
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
return CW_RESULT_MISSING_MAND_ELEM;
}
cw_dbg_missing_mand(DBG_RFC,conn,mlist,n,a);

View File

@ -35,7 +35,7 @@ int cw_in_check_disc_req(struct conn *conn, struct cw_action_in *a, uint8_t * da
/* ok, send response */
conn->capwap_state = CW_STATE_JOIN;
conn->capwap_state = CAPWAP_STATE_JOIN;
return 0;
}

View File

@ -15,7 +15,7 @@ int cw_in_check_img_data_req_ac(struct conn *conn, struct cw_action_in *a, uint8
int n = cw_check_missing_mand(mlist,conn,a);
if (n) {
cw_dbg_missing_mand(DBG_ELEM,conn,mlist,n,a);
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
return CW_RESULT_MISSING_MAND_ELEM;
}

View File

@ -26,7 +26,7 @@ int cw_in_check_img_data_req_wtp(struct conn *conn, struct cw_action_in *a, uint
int n = cw_check_missing_mand(mlist,conn,a);
if (n) {
cw_dbg_missing_mand(DBG_ELEM,conn,mlist,n,a);
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
return CW_RESULT_MISSING_MAND_ELEM;
}

View File

@ -16,7 +16,7 @@ int cw_in_check_img_data_resp(struct conn *conn, struct cw_action_in *a, uint8_t
int n = cw_check_missing_mand(mlist,conn,a);
if (n) {
cw_dbg_missing_mand(DBG_ELEM,conn,mlist,n,a);
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
errno=EAGAIN;
return -1; //CW_RESULT_MISSING_MAND_ELEM;
}

View File

@ -18,7 +18,7 @@ int cw_in_check_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * da
if (n) {
if ( conn->strict_capwap ){
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
return CW_RESULT_MISSING_MAND_ELEM;
}
cw_dbg_missing_mand(DBG_RFC,conn,mlist,n,a);
@ -32,7 +32,7 @@ int cw_in_check_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * da
connlist_unlock(conn->connlist);
if (cc){
cw_dbg(DBG_ELEM_ERR,"Session already in use %s",format_bin2hex(conn->session_id,16));
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
return CW_RESULT_JOIN_FAILURE_SESSION_ALREADY_IN_USE;
}

View File

@ -25,7 +25,7 @@ int cw_in_check_join_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
int n = cw_check_missing_mand(mlist,conn,a);
if (n && conn->strict_capwap) {
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
conn->capwap_state=CW_STATE_JOIN;
conn->capwap_state=CAPWAP_STATE_JOIN;
errno=EAGAIN;
return -1; //CW_RESULT_MISSING_MAND_ELEM;
}

View File

@ -136,6 +136,8 @@ void cw_msgset_add(cw_MsgSet_t * set,
next->name=message->name;
if (message->states)
next->states=message->states;
if (message->receiver)
next->receiver=message->receiver;
update_message(next,message, set);
}

View File

@ -14,6 +14,7 @@ typedef struct cw_MsgData{
int type;
const char * name;
int * states;
int receiver;
mavl_t elements_tree;
mlist_t elements_list;
};

View File

@ -212,7 +212,7 @@ struct cw_Mod * cw_mod_load(const char * mod_name){
filename = cw_filename(mod_path,mod_filename,".so");
if (filename==NULL)
return NULL;
cw_log(LOG_ERROR,"DLOPEN now !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
/* Open the DLL */
void * handle;
handle = dlopen(filename,RTLD_NOW);