Work on State machine
FossilOrigin-Name: 87d98b73010c7316cb9b53b5ba8c3dfdddca06042630cf8437ea506e1c424c70
This commit is contained in:
@ -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[] = {
|
||||
},
|
||||
|
||||
|
||||
{0,0,0,0}
|
||||
|
||||
|
||||
|
||||
/* {
|
||||
"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}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user