FossilOrigin-Name: af94d7d41c6c8a2f4c94bacc434da9964e7f816d56ea54fedeb97d1b073bcfa6
This commit is contained in:
7u83@maiol.ru 2016-11-07 20:32:11 +00:00
parent 11bbcab554
commit 78596aec27
3 changed files with 2 additions and 542 deletions

View File

@ -1,393 +0,0 @@
/*
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"
#include "strheap.h"
#include "radio.h"
cw_action_in_t capwap_actions_ac_in[] = {
/* ------------------------------------------------------------------------------- */
/* Message Discovery Request */
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, 0,
0, cw_in_check_disc_req}
,
/* Element Discovery Type */
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ELEM_DISCOVERY_TYPE,
cw_in_generic, 0, MBAG_BYTE, CW_ITEM_DISCOVERY_TYPE, 1, 1, 1}
,
/* Element Frame Tunnel Mode */
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST,
CW_ACTION_IN_WTP_FRAME_TUNNEL_MODE, 1}
,
/* Element WTP Mac Tpe */
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_MAC_TYPE, 1}
,
/* Vendor Specific Payload */
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST,
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
,
/* 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}
,
/* Element WTP Board Data */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_DISCOVERY_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA,
1}
,
/* ------------------------------------------------------------------------------- */
/* Message: Join Request */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, 0,
0, cw_in_check_join_req}
,
/* Location Data */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_LOCATION_DATA, 1}
,
/* WTP Board Data */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_BOARD_DATA, 1}
,
/* WTP Board Descriptor */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_DESCRIPTOR, 1}
,
/* Element WTP Name */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_NAME, 1}
,
/* Element Session ID */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_SESSION_ID, 1}
,
/* Element WTP Frame Tunnel Mode */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_FRAME_TUNNEL_MODE, 1}
,
/* Element WTP MAC Type */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_WTP_MAC_TYPE, 1}
,
/* Non-Mandatory Join Req Elements */
/* Element Vendor Specific Payload */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
,
/* Maximum Message Length */
{0, 0, CW_STATE_JOIN, CW_MSG_JOIN_REQUEST, CW_ACTION_IN_MAXIMUM_MESSAGE_LENGTH}
,
/* ------------------------------------------------------------------------------- */
/* Message: Configuration Status Request */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST, 0,
0, 0}
,
/* 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}
,
/* Element: Statistics Timer */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
CW_ACTION_IN_WTP_REBOOT_STATISTICS, 1}
,
/* Element Vendor Specific Payload */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CONFIGURATION_STATUS_REQUEST,
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
,
/* ------------------------------------------------------------------------------- */
/* Message: Image Data Request - in Config State */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST, 0,
0, cw_in_check_img_data_req_ac}
,
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST,
CW_ACTION_IN_IMAGE_IDENTIFIER,
0}
,
/* ------------------------------------------------------------------------------- */
/* Message: Change State Event Request - in Config State */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_REQUEST, 0,
cw_in_check_chng_state_evnt_req, 0}
,
/* Element: Result Code */
{0, 0, CW_STATE_CONFIGURE, CW_MSG_CHANGE_STATE_EVENT_REQUEST,
CW_ACTION_IN_RESULT_CODE, 1}
,
/* ------------------------------------------------------------------------------- */
/* Message: Change State Event Request - in Config State */
{0, 0, CW_STATE_RUN, CW_MSG_CHANGE_STATE_EVENT_REQUEST, 0,
cw_in_check_chng_state_evnt_req, 0}
,
/* ------------------------------------------------------------------------------- */
/* 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}
,
/* ------------------------------------------------------------------------------- */
/* WTP Event Request */
{0, 0, CW_STATE_RUN, CW_MSG_WTP_EVENT_REQUEST, 0,
0, 0 }
,
/* Vendor Specific Payload */
{0, 0, CW_STATE_RUN, CW_MSG_WTP_EVENT_REQUEST,
CW_ACTION_IN_VENDOR_SPECIFIC_PAYLOAD}
,
/* ------------------------------------------------------------------------------- */
/* Echoh Request */
{0, 0, CW_STATE_RUN, CW_MSG_ECHO_REQUEST, 0,
0, 0 }
,
/* Message: Join Request */
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_RESPONSE, 0,
0, 0}
,
{0, 0, 0}
};
cw_action_out_t capwap_actions_ac_out[] = {
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_NONE}
,
/* AC Descriptor */
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_DESCRIPTOR, 0, CW_ELEM_AC_DESCRIPTOR,
NULL,cw_out_ac_descriptor, 0}
,
/* AC Name */
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_AC_NAME, 0,
CW_ELEM_AC_NAME, NULL, cw_out_generic, cw_out_get_local}
,
/* List of CAPWAP Control IPv4 and IPv6 addresses */
{CW_MSG_DISCOVERY_RESPONSE, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, 0,
0, NULL, cw_out_capwap_control_ip_addr_list, cw_out_get_outgoing}
,
/* -------------------------------------------------------------------------------
* 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, NULL,cw_out_generic, cw_out_get_outgoing, 1}
,
/* AC Descriptor */
{CW_MSG_JOIN_RESPONSE, CW_ITEM_AC_DESCRIPTOR, 0, CW_ELEM_AC_DESCRIPTOR,
NULL,cw_out_ac_descriptor, 0, 1}
,
/* AC Name */
{CW_MSG_JOIN_RESPONSE, CW_ITEM_AC_NAME, 0,
CW_ELEM_AC_NAME, NULL, cw_out_generic, cw_out_get_local,1}
,
/* Local IP Address */
{CW_MSG_JOIN_RESPONSE, CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS, 0,
0, NULL, cw_out_capwap_local_ip_address, NULL,1}
,
/* List of CAPWAP Control IPv4 and IPv6 addresses */
{CW_MSG_JOIN_RESPONSE, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, 0,
0, NULL, cw_out_capwap_control_ip_addr_list, cw_out_get_outgoing}
,
/* -------------------------------------------------------------------------------
* Image Data Response OUT
*/
{CW_MSG_IMAGE_DATA_RESPONSE, CW_ITEM_NONE}
,
/* Result Code */
{CW_MSG_IMAGE_DATA_RESPONSE, CW_ITEM_RESULT_CODE, 0,
CW_ELEM_RESULT_CODE, NULL,cw_out_generic, cw_out_get_outgoing, 1}
,
/* -------------------------------------------------------------------------------
* 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}
// ,
/* -------------------------------------------------------------------------------
* 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}
,
/* -------------------------------------------------------------------------------
* Change State Event Response OUT
*/
{CW_MSG_CHANGE_STATE_EVENT_RESPONSE, CW_ITEM_NONE}
,
/* -------------------------------------------------------------------------------
* WTP Event Response OUT
*/
{CW_MSG_WTP_EVENT_RESPONSE, CW_ITEM_NONE}
,
/* -------------------------------------------------------------------------------
* Echo Response OUT
*/
{CW_MSG_ECHO_RESPONSE, CW_ITEM_NONE}
,
/* -------------------------------------------------------------------------------
* Update Request OUT
*/
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_NONE}
,
/* Result Code */
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_WTP_NAME, 0,
CW_ELEM_WTP_NAME, NULL,cw_out_generic, cw_out_get_outgoing, 0}
,
/* Location Data */
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_LOCATION_DATA, 0,
CW_ELEM_LOCATION_DATA, NULL,cw_out_generic, cw_out_get_outgoing,0}
,
/* End of list */
{0, 0}
};
#include "item.h"
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();
def->wbids = intavltree_create();
def->items = cw_itemdefheap_create();
def->radioitems = cw_itemdefheap_create();
int rc;
rc = cw_actionlist_in_register_actions(def->in, capwap_actions_ac_in);
rc += cw_actionlist_out_register_actions(def->out, capwap_actions_ac_out);
rc += cw_strheap_register_strings(def->strmsg, capwap_strings_msg);
rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem);
rc += cw_itemdefheap_register(def->items,capwap_itemdefs);
rc += cw_itemdefheap_register(def->radioitems,capwap_radioitemdefs);
intavltree_add(def->wbids,0);
return rc;
}

View File

@ -11,7 +11,8 @@ OBJS=\
capwap_out_wtp_descriptor.o \ capwap_out_wtp_descriptor.o \
capwap_in_wtp_descriptor.o \ capwap_in_wtp_descriptor.o \
capwap_out_ac_ip_list.o \ capwap_out_ac_ip_list.o \
capwap_in_session_id.o capwap_in_session_id.o \
capwap_in
NAME=libcapwap.a NAME=libcapwap.a

View File

@ -1,148 +0,0 @@
#include "item.h"
#include "capwap_items.h"
const char CW_ITEM_IDLE_TIMEOUT[]="idle_timeout";
const char CW_ITEM_DISCOVERY_TYPE[]="discovery_type";
const char CW_ITEM_WTP_NAME[]="wtp_name";
const char CW_ITEM_WTP_MAC_TYPE[]="wtp_mac_type";
const char CW_ITEM_WTP_FRAME_TUNNEL_MODE[]="wtp_frame_tunnel_mode";
const char CW_ITEM_WTP_RADIOS_IN_USE[]="max_radios";
const char CW_ITEM_WTP_MAX_RADIOS[]="radios_in_use";
/*
const char CW_ITEM_WTP_HARDWARE_VENDOR=
*/
const char CW_ITEM_WTP_HARDWARE_VERSION[]="wtp_hardware_version";
const char CW_ITEM_WTP_SOFTWARE_VERSION[]="wtp_software_version";
/*
const char CW_ITEM_WTP_SOFTWARE_VENDOR,
*/
/*
const char CW_ITEM_WTP_BOOTLOADER_VENDOR,
*/
const char CW_ITEM_WTP_BOOTLOADER_VERSION[]="wtp_bootloader_version";
/*
const char CW_ITEM_WTP_OTHERSOFTWARE_VENDOR,
const char CW_ITEM_WTP_OTHERSOFTWARE_VERSION,
*/
const char CW_ITEM_WTP_BOARD_DATA[]="wtp_board_data";
const char CW_ITEM_WTP_DESCRIPTOR[]="0wtp_descriptor";
const char CW_ITEM_CAPWAP_TIMERS[]="capwap_timers";
const char CW_ITEM_RADIO_ADMINISTRATIVE_STATE[]="radio_admin_state";
const char CW_ITEM_AC_NAME[]="ac_name";
const char CW_ITEM_AC_DESCRIPTOR[]="ac_descriptor";
const char CW_ITEM_RESULT_CODE[]="result_code";
const char CW_ITEM_AC_STATUS[]="ac_status";
const char CW_ITEM_AC_HARDWARE_VERSION[]="ac_hardware_version";
const char CW_ITEM_AC_SOFTWARE_VERSION[]="ac_software_version";
const char CW_ITEM_AC_IP_LIST[]="ac_ip_list";
const char CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST[]="capwap_ctrl_ip_addr";
const char CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS[]="capwap_local_ip_addr";
const char CW_ITEM_LOCATION_DATA[]="location_data";
const char CW_ITEM_SESSION_ID[]="session_id";
const char CW_ITEM_AC_TIMESTAMP[]="ac_timestamp";
const char CW_ITEM_STATISTICS_TIMER[]="statistics_timer";
const char CW_ITEM_WTP_REBOOT_STATISTICS[]="wtp_reboot_statistics";
const char CW_ITEM_IMAGE_IDENTIFIER[]="image_identifier";
const char CW_ITEM_AC_HASH_VALUE[]="ac_hash_value";
const char CW_ITEM_AC_NAME_WITH_PRIORITY[]="ac_name_with_priority";
const char CW_ITEM_MAXIMUM_MESSAGE_LENGTH[]="maximum_message_length";
/* CIPWAP and Cisco */
const char CW_ITEM_WTP_GROUP_NAME[]="wtp_group_name";
/* Other Items */
const char CW_ITEM_AC_IMAGE_DIR[]="ac_img_dir"; /* Path where WTP images are stored */
const char CW_ITEM_IMAGE_FILENAME[]="img_filename"; /* Full path of image filename */
const char CW_ITEM_DISCOVERIES[]="discoveries";
/** FILE handle for uploading and downloading images */
const char CW_ITEM_IMAGE_FILEHANDLE[]="image_file_handle";
const char CW_ITEM_RADIO_CFG[]="radio_cfg";
const char CW_ITEM_AP_MODE_AND_TYPE[]="cisco_ap_mode_and_type";
const char CW_ITEM_CISCO_BOARD_DATA_OPTIONS[]="cisco_board_data_options";
const char CW_ITEM_RADIOS[]="radios";
const char CW_ITEM_RADIO_OPER_STATE[]="radio_oper_state";
const char CW_ITEM_WTP_BOARD_VENDOR[]="vendor_id";
const char CW_ITEM_WTP_BOARD_MODELNO[]="model_no";
const char CW_ITEM_WTP_BOARD_MACADDRESS[]="wtp_board_macadddress";
const char CW_ITEM_WTP_BOARD_ID[]="wtp_board_id";
const char CW_ITEM_WTP_BOARD_REVISION[]="wtp_board_revision";
const char CW_ITEM_WTP_BOARD_SERIALNO[]="serial_no";
const char CW_ITEM_RADIO_INFOS[]="radio_infos";
//const char CW_ITEM_XY[]="wtp_name";
struct cw_itemdef capwap_itemdefs[] = {
{"wtp_name",CW_ITEM_NONE,MBAG_STR},
{"wtp_mac_type",CW_ITEM_NONE,MBAG_BYTE},
{CW_ITEM_WTP_FRAME_TUNNEL_MODE,CW_ITEM_NONE,MBAG_BYTE},
{CW_ITEM_LOCATION_DATA,CW_ITEM_NONE,MBAG_STR},
{CW_ITEM_WTP_HARDWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
{CW_ITEM_WTP_SOFTWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
{CW_ITEM_WTP_GROUP_NAME,CW_ITEM_NONE,MBAG_STR},
{CW_ITEM_MAXIMUM_MESSAGE_LENGTH,CW_ITEM_NONE,MBAG_WORD},
{CW_ITEM_STATISTICS_TIMER,CW_ITEM_NONE,MBAG_WORD},
{CW_ITEM_IDLE_TIMEOUT,CW_ITEM_NONE,MBAG_DWORD},
{CW_ITEM_CAPWAP_TIMERS,CW_ITEM_NONE,MBAG_WORD},
{CW_ITEM_AC_NAME_WITH_PRIORITY,CW_ITEM_ANY,MBAG_STR},
{CW_ITEM_AP_MODE_AND_TYPE,CW_ITEM_NONE,MBAG_WORD},
/* Board Data */
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_NONE,MBAG_MBAG},
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_WTP_BOARD_VENDOR,MBAG_DWORD},
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_WTP_BOARD_MODELNO,MBAG_BSTR16},
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_WTP_BOARD_SERIALNO,MBAG_BSTR16},
/* Cisco Specific items, should be moved to a file like
cisco_items or so */
{CW_ITEM_AP_MODE_AND_TYPE,CW_ITEM_NONE,MBAG_WORD},
{CW_ITEM_CISCO_BOARD_DATA_OPTIONS,CW_ITEM_NONE,MBAG_BSTR16},
{CW_ITEM_NONE}
};
struct cw_itemdef capwap_radiodefs[] = {
{CW_ITEM_NONE}
};