2015-04-05 02:11:49 +02:00
|
|
|
/*
|
|
|
|
This file is part of libcapwap.
|
|
|
|
|
|
|
|
libcapwap is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
libcapwap is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "capwap_items.h"
|
|
|
|
#include "capwap_actions.h"
|
2015-04-05 20:27:17 +02:00
|
|
|
#include "strheap.h"
|
2015-04-05 02:11:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cw_action_in_t capwap_actions_ac_in[] = {
|
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* ------------------------------------------------------------------------------- */
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-05 03:34:25 +02:00
|
|
|
/* Message Discovery Request */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, 0,
|
|
|
|
0, cw_in_check_disc_req}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
/* Element Discovery Type */
|
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ELEM_DISCOVERY_TYPE,
|
2015-04-19 23:27:44 +02:00
|
|
|
cw_in_generic, 0, MBAG_BYTE, CW_ITEM_DISCOVERY_TYPE, 1, 1, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element Frame Tunnel Mode */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST,
|
|
|
|
CW_ACTION_IN_WTP_FRAME_TUNNEL_MODE, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element WTP Mac Tpe */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_MAC_TYPE, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Vendor Specific Payload */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST,
|
|
|
|
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
2015-04-12 19:19:29 +02:00
|
|
|
/* Element WTP Descriptor */
|
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_DESCRIPTOR,
|
|
|
|
1}
|
|
|
|
,
|
|
|
|
/* Element WTP Board Data */
|
|
|
|
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA,
|
|
|
|
1}
|
|
|
|
,
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
/* Element WTP Board Data */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA,
|
|
|
|
1}
|
|
|
|
,
|
|
|
|
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* ------------------------------------------------------------------------------- */
|
2015-04-05 02:11:49 +02:00
|
|
|
|
|
|
|
/* Message: Join Request */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, 0,
|
|
|
|
0, cw_in_check_join_req}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
/* Element Location Data */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_LOCATION_DATA, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element WTP Board Data */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element WTP Board Data */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_DESCRIPTOR, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element WTP Board Data */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_NAME, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element WTP Board Data */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_SESSION_ID, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
/* Element WTP Board Data */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_FRAME_TUNNEL_MODE, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
2015-04-05 03:34:25 +02:00
|
|
|
/* Element WTP MAC Type */
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_MAC_TYPE, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
2015-04-05 20:27:17 +02:00
|
|
|
/* Element Vendor Specific Payload */
|
|
|
|
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
|
|
|
|
,
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* ------------------------------------------------------------------------------- */
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* Message: Configuration Status Request */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST, 0,
|
2015-04-26 08:41:12 +02:00
|
|
|
0, 0}
|
2015-04-07 07:42:36 +02:00
|
|
|
,
|
|
|
|
/* Element: AC Name */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
|
|
|
CW_ACTION_IN_AC_NAME, 1}
|
|
|
|
,
|
|
|
|
/* Element: Statistics Timer */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
|
|
|
CW_ACTION_IN_STATISTICS_TIMER, 1}
|
|
|
|
,
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* Element: Statistics Timer */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
|
|
|
CW_ACTION_IN_WTP_REBOOT_STATISTICS, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* Element Vendor Specific Payload */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
|
|
|
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* ------------------------------------------------------------------------------- */
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* Message: Image Data Request - in Config State */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST, 0,
|
2015-04-11 19:00:51 +02:00
|
|
|
0, cw_in_check_img_data_req_ac}
|
2015-04-07 07:42:36 +02:00
|
|
|
,
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST,
|
|
|
|
CW_ACTION_IN_IMAGE_IDENTIFIER,
|
|
|
|
0}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Message: Change State Request - in Config State */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_REQUEST, 0,
|
|
|
|
0, 0}
|
|
|
|
,
|
|
|
|
|
|
|
|
/* Element: Result Code */
|
|
|
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_REQUEST,
|
|
|
|
CW_ACTION_IN_RESULT_CODE, 1}
|
|
|
|
,
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
/* ------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Message Image Data Response IN */
|
|
|
|
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_RESPONSE, 0,
|
|
|
|
0, cw_in_check_img_data_resp }
|
|
|
|
,
|
|
|
|
|
|
|
|
/* Element: Result Code */
|
|
|
|
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_RESPONSE,
|
|
|
|
CW_ACTION_IN_RESULT_CODE, 1}
|
|
|
|
|
|
|
|
,
|
|
|
|
|
2015-04-05 02:11:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
{0, 0, 0}
|
|
|
|
};
|
2015-04-05 02:11:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cw_action_out_t capwap_actions_ac_out[] = {
|
|
|
|
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_NONE}
|
|
|
|
,
|
2015-04-07 07:42:36 +02:00
|
|
|
|
2015-04-05 02:11:49 +02:00
|
|
|
/* AC Descriptor */
|
2015-04-07 07:42:36 +02:00
|
|
|
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_DESCRIPTOR, 0, CW_ELEM_AC_DESCRIPTOR,
|
2015-04-10 21:44:05 +02:00
|
|
|
NULL,cw_out_ac_descriptor, 0}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
2015-04-05 20:27:17 +02:00
|
|
|
|
2015-04-05 02:11:49 +02:00
|
|
|
/* AC Name */
|
2015-04-05 20:27:17 +02:00
|
|
|
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_NAME, 0,
|
2015-04-12 10:19:02 +02:00
|
|
|
CW_ELEM_AC_NAME, NULL, cw_out_generic, cw_out_get_local}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
/* List of CAPWAP Control IPv4 and IPv6 addresses */
|
2015-04-10 17:14:55 +02:00
|
|
|
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, 0,
|
2015-04-10 21:44:05 +02:00
|
|
|
0, NULL, cw_out_capwap_control_ip_addr_list, cw_out_get_outgoing}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
* Join Response OUT
|
|
|
|
*/
|
|
|
|
{CW_MSG_JOIN_RESPONSE, CW_ITEM_NONE}
|
|
|
|
,
|
2015-04-05 02:11:49 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* Result Code */
|
2015-04-05 20:27:17 +02:00
|
|
|
{CW_MSG_JOIN_RESPONSE, CW_ITEM_RESULT_CODE, 0,
|
2015-04-10 21:44:05 +02:00
|
|
|
CW_ELEM_RESULT_CODE, NULL,cw_out_generic, cw_out_get_outgoing, 1}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
2015-04-07 07:42:36 +02:00
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
/* AC Descriptor */
|
2015-04-07 07:42:36 +02:00
|
|
|
{CW_MSG_JOIN_RESPONSE, CW_ITEM_AC_DESCRIPTOR, 0, CW_ELEM_AC_DESCRIPTOR,
|
2015-04-10 21:44:05 +02:00
|
|
|
NULL,cw_out_ac_descriptor, 0, 1}
|
2015-04-07 07:42:36 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
/* AC Name */
|
|
|
|
{CW_MSG_JOIN_RESPONSE, CW_ITEM_AC_NAME, 0,
|
2015-04-10 21:44:05 +02:00
|
|
|
CW_ELEM_AC_NAME, NULL, cw_out_generic, cw_out_get_outgoing}
|
2015-04-05 02:11:49 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
* Image Data Response OUT
|
|
|
|
*/
|
|
|
|
{CW_MSG_IMAGE_DATA_RESPONSE, CW_ITEM_NONE}
|
|
|
|
,
|
|
|
|
|
|
|
|
/* Result Code */
|
|
|
|
{CW_MSG_IMAGE_DATA_RESPONSE, CW_ITEM_RESULT_CODE, 0,
|
2015-04-10 21:44:05 +02:00
|
|
|
CW_ELEM_RESULT_CODE, NULL,cw_out_generic, cw_out_get_outgoing, 1}
|
2015-04-07 07:42:36 +02:00
|
|
|
,
|
|
|
|
|
|
|
|
|
2015-04-14 07:42:23 +02:00
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
* Image Data Response OUT
|
|
|
|
*/
|
|
|
|
{CW_MSG_CONFIGURATION_STATUS_RESPONSE, CW_ITEM_NONE}
|
|
|
|
,
|
|
|
|
|
|
|
|
/* Result Code */
|
|
|
|
{CW_MSG_CONFIGURATION_STATUS_RESPONSE, CW_ITEM_RESULT_CODE, 0,
|
|
|
|
CW_ELEM_RESULT_CODE, NULL,cw_out_generic, cw_out_get_outgoing, 1}
|
|
|
|
,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
* Image Data Request OUT
|
|
|
|
*/
|
|
|
|
|
|
|
|
{CW_MSG_IMAGE_DATA_REQUEST, CW_ITEM_NONE}
|
|
|
|
,
|
|
|
|
/* Image Data */
|
|
|
|
{CW_MSG_IMAGE_DATA_REQUEST, CW_ITEM_IMAGE_FILEHANDLE, 0,
|
|
|
|
CW_ELEM_IMAGE_DATA, NULL,cw_out_image_data, cw_out_get_outgoing,0}
|
|
|
|
,
|
|
|
|
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
* Change State Event Response OUT
|
|
|
|
*/
|
|
|
|
|
|
|
|
{CW_MSG_CHANGE_STATE_EVENT_RESPONSE, CW_ITEM_NONE}
|
|
|
|
,
|
2015-04-11 19:00:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
|
|
|
|
/* End of list */
|
2015-04-05 02:11:49 +02:00
|
|
|
{0, 0}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cw_register_actions_capwap_ac(struct cw_actiondef *def)
|
|
|
|
{
|
|
|
|
def->in = cw_actionlist_in_create();
|
|
|
|
def->out = cw_actionlist_out_create();
|
2015-04-05 20:27:17 +02:00
|
|
|
def->strmsg = cw_strheap_create();
|
|
|
|
def->strelem = cw_strheap_create();
|
2015-04-12 10:19:02 +02:00
|
|
|
def->wbids = intavltree_create();
|
2015-04-05 02:11:49 +02:00
|
|
|
|
|
|
|
cw_actionlist_in_register_actions(def->in, capwap_actions_ac_in);
|
|
|
|
cw_actionlist_out_register_actions(def->out, capwap_actions_ac_out);
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
int rc;
|
|
|
|
rc = cw_strheap_register_strings(def->strmsg, capwap_strings_msg);
|
|
|
|
rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem);
|
2015-04-12 10:19:02 +02:00
|
|
|
|
|
|
|
|
2015-04-12 19:19:29 +02:00
|
|
|
intavltree_add(def->wbids,0);
|
2015-04-05 20:27:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-05 02:11:49 +02:00
|
|
|
return 1;
|
|
|
|
}
|