Some CW_.. -> CAPWAP ... renaming

FossilOrigin-Name: 24455dc7c6d5b4d258807d82819ca9b752cfef10ee127ee8bee9f7173e87cc41
This commit is contained in:
7u83@mail.ru 2018-03-09 09:57:16 +00:00
parent f43860bf5c
commit 6c38ad4a5d
14 changed files with 90 additions and 65 deletions

View File

@ -3,9 +3,9 @@
<Project Name="ac" Path="ac.project" Active="No"/>
<Project Name="wtp" Path="wtp.project" Active="No"/>
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
<Project Name="mod_capwap" Path="mod_capwap.project" Active="Yes"/>
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
<Project Name="libcw" Path="libcw.project" Active="No"/>
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
<BuildMatrix>

View File

@ -122,7 +122,6 @@
<File Name="src/cw/sock_getifhwaddr.c"/>
<File Name="src/cw/stravltree.h"/>
<File Name="src/cw/conn_send_packet.c"/>
<File Name="src/cw/conn_detect_capwap.c"/>
<File Name="src/cw/mbag_type_bstr16.c"/>
<File Name="src/cw/cipwap.h"/>
<File Name="src/cw/cw_in_check_join_resp.c"/>

View File

@ -257,20 +257,20 @@
#define CAPWAP_ELEM_WTP_DESCRIPTOR 39
#define CAPWAP_ELEM_WTP_FALLBACK 40
#define CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE 41
#define CW_ELEM_RESERVED_42 42
#define CW_ELEM_RESERVED_43 43
#define CAPWAP_ELEM_RESERVED_42 42
#define CAPWAP_ELEM_RESERVED_43 43
#define CAPWAP_ELEM_WTP_MAC_TYPE 44
#define CW_ELEM_WTP_NAME 45
#define CW_ELEM_RESERVED_46 46
#define CW_ELEM_WTP_RADIO_STATISTICS 47
#define CW_ELEM_WTP_REBOOT_STATISTICS 48
#define CAPWAP_ELEM_WTP_NAME 45
#define CAPWAP_ELEM_RESERVED_46 46
#define CAPWAP_ELEM_WTP_RADIO_STATISTICS 47
#define CAPWAP_ELEM_WTP_REBOOT_STATISTICS 48
#define CW_ELEM_WTP_STATIC_IP_ADDRESS_INFORMATION 49
#define CW_ELEM_WTP_STATIC_IP_ADDR_INFO 49
/* Cisco's CAPWAP definitions (CAPWAP draft 7) */
#define CW_ELEM_WTP_IPV4_IP_ADDRESS 42
#define CW_ELEM_WTP_IPV6_IP_ADDRESS 43
#define CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS 42
#define CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS 43
/**@}*/
@ -330,9 +330,9 @@
/* WTP mac types */
#define CW_WTP_MAC_TYPE_LOCAL 0
#define CW_WTP_MAC_TYPE_SPLIT 1
#define CW_WTP_MAC_TYPE_BOTH 2
#define CAPWAP_WTP_MAC_TYPE_LOCAL 0
#define CAPWAP_WTP_MAC_TYPE_SPLIT 1
#define CAPWAP_WTP_MAC_TYPE_BOTH 2
/*
@ -442,12 +442,15 @@ extern void cwmsg_addelem_vendor_specific_payload(struct cwmsg *msg, int vendor_
int type, uint8_t * payload, int len);
/*
extern int hdr_print(char *str, uint8_t * packet, int len);
*/
/*
extern int cw_readelem_ecn_support(uint8_t * ecn_support, int type, uint8_t * msgelem,
int len);
/*
*/
/*
//extern int cw_readelem_maximum_message_length(uint16_t * dst, int type, uint8_t * msgelem,
// int len);
//extern int cw_readelem_ac_name(uint8_t ** dst, int type, uint8_t * msgelem, int len);
@ -485,10 +488,19 @@ enum cw_reboot_failure_types {
};
/**
* @defgroup CAPWAPResultCodes CAPWAP Result Codes
* @{
*/
/** The Result Success code is sent, whenever
* all went fine ;-) */
#define CAPWAP_RESULT_SUCCESS 0
/**
* The Missing AC List Result Code is sent by the
* WTP to the AC when the AC List is missing */
#define CW_RESULT_MISSING_AC_LIST 1
#define CW_RESULT_SUCCESS_NAT 2
#define CAPWAP_RESULT_SUCCESS_NAT 2
#define CW_RESULT_JOIN_FAILURE 3
#define CW_RESULT_JOIN_RESOURCE_DEPLETION 4
#define CW_RESULT_JOIN_UNKNOWN_SOURCE 5
@ -513,7 +525,7 @@ enum cw_reboot_failure_types {
13 Configuration Failure (Unable to Apply Requested Configuration
- Service Not Provided)
*/
#define CAPWAP_RESULT_CONFIGURATION_FAILURE_SERVICE_NOT PROVIDED 13
/**
* Image Data Error (Invalid Checksum)
*/
@ -534,11 +546,14 @@ enum cw_reboot_failure_types {
*/
#define CAPWAP_RESULT_MSG_INVALID_IN_CURRENT_STATE 18
#define CW_RESULT_MSG_UNRECOGNIZED 19
#define CAPWAP_RESULT_MSG_UNRECOGNIZED 19
#define CW_RESULT_MISSING_MAND_ELEM 20
#define CW_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT 21
#define CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT 21
/* 22 Data Transfer Error (No Information to Transfer)
@ -562,7 +577,9 @@ enum cw_reboot_failure_types {
#define CW_RADIO_OPER_CAUSE_ADMIN_SET 3
/**
* @}
*/
extern void cw_read_image_data_request(struct cwimage_data *, uint8_t * msg, int len);

View File

@ -49,13 +49,13 @@ struct cw_strlist_elem capwap_strings_elem[] = {
{CAPWAP_ELEM_WTP_DESCRIPTOR, "WTP Descriptor"},
{CAPWAP_ELEM_WTP_FALLBACK, "WTP Fallback"},
{CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, "WTP Frame Tunnel Mode"},
{CW_ELEM_RESERVED_42, "Reserved 42"},
{CW_ELEM_RESERVED_43, "Reserved 43"},
{CAPWAP_ELEM_RESERVED_42, "Reserved 42"},
{CAPWAP_ELEM_RESERVED_43, "Reserved 43"},
{CAPWAP_ELEM_WTP_MAC_TYPE, "WTP MAC Type"},
{CW_ELEM_WTP_NAME, "WTP Name"},
{CW_ELEM_RESERVED_46, "Reserved 46"},
{CW_ELEM_WTP_RADIO_STATISTICS, "WTP Radio Statistics"},
{CW_ELEM_WTP_REBOOT_STATISTICS, "WTP Reboot Statistics"},
{CAPWAP_ELEM_WTP_NAME, "WTP Name"},
{CAPWAP_ELEM_RESERVED_46, "Reserved 46"},
{CAPWAP_ELEM_WTP_RADIO_STATISTICS, "WTP Radio Statistics"},
{CAPWAP_ELEM_WTP_REBOOT_STATISTICS, "WTP Reboot Statistics"},
{CW_ELEM_WTP_STATIC_IP_ADDRESS_INFORMATION, "WTP Static IP Address Information"},

View File

@ -4,15 +4,15 @@
struct cw_strlist_elem capwap_strings_result[] = {
{CAPWAP_RESULT_SUCCESS,"Success"}, /* 0 */
{CAPWAP_RESULT_SUCCESS,"Success"}, /* 0 */
{CW_RESULT_MISSING_AC_LIST,"AC List Message Element MUST be Present"}, /* 1 */
{CW_RESULT_SUCCESS_NAT,"Success - NAT Detected"}, /* 2 */
{CAPWAP_RESULT_SUCCESS_NAT,"Success - NAT Detected"}, /* 2 */
{CW_RESULT_RESET_UNABLE_TO_RESET,"Reset Failure - Unable to Reset"}, /* 10 */
{CW_RESULT_IMAGE_DATA_INVALID_CHECKSUM,"Image Data Error (Invalid Checksum)"}, /* 14 */
{CAPWAP_RESULT_IMAGE_DATA_ERROR,"Image Data Error (Unspecified)"}, /* 16 */
{CW_RESULT_IMAGE_DATA_INVALID_CHECKSUM,"Image Data Error (Invalid Checksum)"}, /* 14 */
{CAPWAP_RESULT_IMAGE_DATA_ERROR,"Image Data Error (Unspecified)"}, /* 16 */
{CAPWAP_RESULT_MSG_INVALID_IN_CURRENT_STATE,"Message unexpected (Invalid in current state)"}, /* 18 */
{CW_RESULT_MISSING_MAND_ELEM,"Missing Mandatory Message Element"}, /* 20 */
{CW_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT,"Unrecognized Message Element"}, /* 21 */
{CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT,"Unrecognized Message Element"}, /* 21 */
{CW_STR_STOP,"Unknown Result Code"}
};

View File

@ -7,8 +7,8 @@
struct cw_strlist_elem cipwap_strings_elem[] = {
{CW_ELEM_WTP_IPV4_IP_ADDRESS, "WTP IPv4 IP Address"},
{CW_ELEM_WTP_IPV6_IP_ADDRESS, "WTP IPv6 IP Address"},
{CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS, "WTP IPv4 IP Address"},
{CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS, "WTP IPv6 IP Address"},
{CW_ELEM_AC_NAME_WITH_INDEX, "AC Name with Index"},
{CW_CISCO_AP_GROUP_NAME, "WTP Group Name" },

View File

@ -310,7 +310,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
cw_dbg(DBG_MSG_ERR, "Message type %d (%s) unknown.",
search.type, cw_strmsg(search.type),
cw_strstate(conn->capwap_state));
result_code = CW_RESULT_MSG_UNRECOGNIZED;
result_code = CAPWAP_RESULT_MSG_UNRECOGNIZED;
cw_send_error_response(conn, rawmsg, result_code);
errno = EAGAIN;
return -1;
@ -394,7 +394,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
params.from=from;
params.msgdata=message;
cw_process_element(&params,0,0,elem_id,elem_data,elem_len); //elems_len-(elem-elems_ptr));
result_code = cw_process_element(&params,0,0,elem_id,elem_data,elem_len); //elems_len-(elem-elems_ptr));
/*
@ -557,7 +557,7 @@ exit(0);
if ( (!result_code) && ((afm->msg_id & 1))) {
if (conn->strict_capwap) {
result_code = CW_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
result_code = CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
}
}

View File

@ -30,6 +30,25 @@ int cw_in_wtp_reboot_statistics(struct conn *conn, struct cw_action_in *a, uint8
return 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/>.
*/
mbag_set_word( rs, CW_ITEM_REBOOT_COUNT,cw_get_word(data+0) );
mbag_set_word( rs, CW_ITEM_REBOOT_AC_INITIATED_COUNT,cw_get_word(data+2) );

View File

@ -49,5 +49,5 @@
int cw_out_wtp_ip_address(struct conn *conn, struct cw_action_out *action,
uint8_t * dst)
{
return cw_put_local_ip_address(conn->sock,dst,CW_ELEM_WTP_IPV4_IP_ADDRESS,CW_ELEM_WTP_IPV6_IP_ADDRESS);
return cw_put_local_ip_address(conn->sock,dst,CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS,CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS);
}

View File

@ -10,7 +10,7 @@
* @param handler
* @param elems_ptr
* @param elems_len
* @return
* @return Result Code as defined in RFC5415
*/
int cw_process_element(struct cw_ElemHandlerParams *params, int proto, int vendor,int elem_id,
uint8_t * data, int len){
@ -18,17 +18,13 @@ int cw_process_element(struct cw_ElemHandlerParams *params, int proto, int vendo
struct cw_ElemHandler * handler;
struct cw_ElemData * elem_data, elem_data_search;
/*uint8_t * elem_data;*/
handler = cw_msgset_get_elemhandler(params->conn->msgset,0, 0, elem_id);
if (!handler) {
cw_dbg(DBG_ELEM_ERR, "Unknown message element: %d, ignoring",
cw_dbg(DBG_ELEM_ERR, "Unrecognized message element: %d, ignoring",
elem_id);
return 0;
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
}
elem_data_search.id=elem_id;
elem_data_search.proto=0;
elem_data_search.vendor=0;
@ -40,16 +36,10 @@ int cw_process_element(struct cw_ElemHandlerParams *params, int proto, int vendo
elem_id, handler->name);
return 0;
}
cw_dbg_elem(DBG_ELEM, params->conn, params->msgdata->type, handler,
data,len);
handler->get(handler, params, data, len);
return 0;
return handler->get(handler, params, data, len);
}

View File

@ -391,7 +391,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CW_STATE_RUN,
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
.elem_id = CW_ELEM_WTP_NAME,
.elem_id = CAPWAP_ELEM_WTP_NAME,
.item_id = CW_ITEM_WTP_NAME,
.start = cw_in_generic2,
.min_len = 1,
@ -544,7 +544,7 @@ static cw_action_out_t actions_out[] = {
/* WTP Name - Join Request */
{
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_WTP_NAME,
.elem_id = CAPWAP_ELEM_WTP_NAME,
.item_id = CW_ITEM_WTP_NAME,
.out = cw_out_generic,
.get = cw_out_get_config,
@ -609,7 +609,7 @@ static cw_action_out_t actions_out[] = {
/* WTP Reboot Statistics - Join Request */
{
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_WTP_REBOOT_STATISTICS,
.elem_id = CAPWAP_ELEM_WTP_REBOOT_STATISTICS,
.item_id = CW_ITEM_WTP_REBOOT_STATISTICS,
.out = cw_out_wtp_reboot_statistics,
.get = cw_out_get_config,
@ -653,7 +653,7 @@ static cw_action_out_t actions_out[] = {
/* WTP Reboot Statistics - Config Status Request */
{
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_ELEM_WTP_REBOOT_STATISTICS,
.elem_id = CAPWAP_ELEM_WTP_REBOOT_STATISTICS,
.item_id = CW_ITEM_WTP_REBOOT_STATISTICS,
.out = cw_out_wtp_reboot_statistics,
.get = cw_out_get_config,

View File

@ -209,7 +209,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_WTP_IPV4_IP_ADDRESS,
.elem_id = CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS,
.item_id = CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS,
.start = cw_in_capwap_local_ipv4_address,
.mand = 1,
@ -222,7 +222,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_WTP_IPV6_IP_ADDRESS,
.elem_id = CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS,
.item_id = CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS,
.start = cw_in_capwap_local_ipv4_address,
.mand = 1,
@ -491,7 +491,7 @@ static cw_action_out_t actions_out[]={
or replace such elemenns */
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
.item_id = CW_ITEM_WTP_NAME,
.elem_id = CW_ELEM_WTP_NAME,
.elem_id = CAPWAP_ELEM_WTP_NAME,
}
,

View File

@ -107,7 +107,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CW_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_WTP_IPV4_IP_ADDRESS,
.elem_id = CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS,
.item_id = CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS,
.start = cw_in_capwap_local_ipv4_address,
.mand = 1,
@ -120,7 +120,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CW_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_WTP_IPV6_IP_ADDRESS,
.elem_id = CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS,
.item_id = CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS,
.start = cw_in_capwap_local_ipv4_address,
.mand = 1,

View File

@ -194,7 +194,7 @@ printf("Setting to 8 %p %p\n",mri,r);
mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, CW_WTP_MAC_TYPE_SPLIT);
mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, CAPWAP_WTP_MAC_TYPE_SPLIT);
mbag_set_byte(conn->local, CW_ITEM_WTP_FRAME_TUNNEL_MODE, CW_WTP_FRAME_TUNNEL_MODE_E);
conn->wbid=1;