More work on CAPWAP VM
FossilOrigin-Name: 9d9a86d2bafe31253a6f505e874f188792539485bb4462f4d778e6c53ac3000b
This commit is contained in:
@ -21,13 +21,7 @@
|
||||
#include "action.h"
|
||||
#include "capwap_items.h"
|
||||
#include "capwap_actions.h"
|
||||
|
||||
int cw_in_set_state_none(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len)
|
||||
{
|
||||
conn->capwap_state=CW_STATE_NONE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include "strheap.h"
|
||||
|
||||
|
||||
|
||||
@ -58,8 +52,7 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_MAC_TYPE}
|
||||
,
|
||||
/* Vendor Specific Payload */
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ELEM_VENDOR_SPECIFIC_PAYLOAD,
|
||||
cw_in_vendor_specific_payload, 0}
|
||||
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
|
||||
,
|
||||
|
||||
/* -------------------------------------------------------------------------------*/
|
||||
@ -90,6 +83,9 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
/* Element WTP MAC Type */
|
||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_MAC_TYPE}
|
||||
,
|
||||
/* Element Vendor Specific Payload */
|
||||
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
|
||||
,
|
||||
|
||||
|
||||
|
||||
@ -121,6 +117,7 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
int cw_out_ac_name(uint8_t * dst, struct cw_item *item)
|
||||
{
|
||||
|
||||
@ -130,13 +127,8 @@ int cw_out_ac_name(uint8_t * dst, struct cw_item *item)
|
||||
int len = cw_put_data(dst + 4, data, strlen((char *) data));
|
||||
return len + cw_put_elem_hdr(dst, CW_ELEM_AC_NAME, len);
|
||||
}
|
||||
*/
|
||||
|
||||
struct cw_item *cw_get_local(struct conn *conn, uint32_t item_id)
|
||||
{
|
||||
struct cw_item i;
|
||||
i.id = item_id;
|
||||
return cw_itemstore_get(conn->local, item_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -145,26 +137,38 @@ cw_action_out_t capwap_actions_ac_out[] = {
|
||||
,
|
||||
|
||||
/* AC Descriptor */
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_DESCRIPTOR,
|
||||
CW_ELEM_AC_DESCRIPTOR, cw_out_ac_descriptor, 0}
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_DESCRIPTOR, 0
|
||||
,CW_ELEM_AC_DESCRIPTOR, cw_out_ac_descriptor, 0}
|
||||
,
|
||||
|
||||
/* AC Name */
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_NAME,
|
||||
CW_ELEM_AC_NAME, cw_out_generic, cw_get_local}
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_NAME, 0,
|
||||
CW_ELEM_AC_NAME, cw_out_generic, cw_out_get_local}
|
||||
,
|
||||
|
||||
/* List of CAPWAP Control IPv4 and IPv6 addresses */
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_CAPWAP_CONTROL_IP_LIST,
|
||||
0, cw_out_capwap_control_ip_addrs, cw_get_local}
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_CAPWAP_CONTROL_IP_LIST, 0,
|
||||
0, cw_out_capwap_control_ip_addrs, cw_out_get_local}
|
||||
,
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* Join Response OUT
|
||||
*/
|
||||
{CW_MSG_JOIN_RESPONSE, CW_ITEM_NONE}
|
||||
,
|
||||
|
||||
/* Result Code */
|
||||
{CW_MSG_JOIN_RESPONSE, CW_ITEM_RESULT_CODE, 0,
|
||||
CW_ELEM_RESULT_CODE, cw_out_generic, cw_out_get_local}
|
||||
,
|
||||
|
||||
/* AC Descriptor */
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_DESCRIPTOR, 0
|
||||
,CW_ELEM_AC_DESCRIPTOR, cw_out_ac_descriptor, 0}
|
||||
,
|
||||
|
||||
|
||||
{CW_MSG_JOIN_RESPONSE, CW_ITEM_AC_NAME}
|
||||
,
|
||||
{CW_MSG_JOIN_RESPONSE, CW_ITEM_RESULT_CODE}
|
||||
,
|
||||
|
||||
|
||||
{0, 0}
|
||||
@ -180,9 +184,18 @@ int cw_register_actions_capwap_ac(struct cw_actiondef *def)
|
||||
{
|
||||
def->in = cw_actionlist_in_create();
|
||||
def->out = cw_actionlist_out_create();
|
||||
def->strmsg = cw_strheap_create();
|
||||
def->strelem = cw_strheap_create();
|
||||
|
||||
cw_actionlist_in_register_actions(def->in, capwap_actions_ac_in);
|
||||
cw_actionlist_out_register_actions(def->out, capwap_actions_ac_out);
|
||||
|
||||
int rc ;
|
||||
rc = cw_strheap_register_strings(def->strmsg,capwap_strings_msg);
|
||||
rc += cw_strheap_register_strings(def->strelem,capwap_strings_elem);
|
||||
|
||||
|
||||
printf("Registered %d strings\n",rc);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user