From 6c38ad4a5d2467e54ebaf8b934cbd3fc6b4393c7 Mon Sep 17 00:00:00 2001
From: "7u83@mail.ru" <7u83@mail.ru@noemail.net>
Date: Fri, 9 Mar 2018 09:57:16 +0000
Subject: [PATCH] Some CW_.. -> CAPWAP ... renaming
FossilOrigin-Name: 24455dc7c6d5b4d258807d82819ca9b752cfef10ee127ee8bee9f7173e87cc41
---
actube.workspace | 4 +-
libcw.project | 1 -
src/cw/capwap.h | 55 +++++++++++++++++---------
src/cw/capwap_strings_elem.c | 12 +++---
src/cw/capwap_strings_result.c | 10 ++---
src/cw/cipwap_strings_elem.c | 4 +-
src/cw/conn_process_packet.c | 6 +--
src/cw/cw_in_wtp_reboot_statistics.c | 19 +++++++++
src/cw/cw_out_wtp_ip_address.c | 2 +-
src/cw/cw_process_element.c | 22 +++--------
src/mod/capwap/capwap_actions_wtp.c | 8 ++--
src/mod/cisco/cisco_actions_ac.c | 6 +--
src/mod/fortinet/fortinet_actions_ac.c | 4 +-
src/wtp/wtp_main.c | 2 +-
14 files changed, 90 insertions(+), 65 deletions(-)
diff --git a/actube.workspace b/actube.workspace
index b8870938..e0162c79 100644
--- a/actube.workspace
+++ b/actube.workspace
@@ -3,9 +3,9 @@
-
+
-
+
diff --git a/libcw.project b/libcw.project
index 851203c2..73f67ab4 100644
--- a/libcw.project
+++ b/libcw.project
@@ -122,7 +122,6 @@
-
diff --git a/src/cw/capwap.h b/src/cw/capwap.h
index 4cf25bfb..8ecd80df 100644
--- a/src/cw/capwap.h
+++ b/src/cw/capwap.h
@@ -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);
diff --git a/src/cw/capwap_strings_elem.c b/src/cw/capwap_strings_elem.c
index ee7a387a..e8702f74 100644
--- a/src/cw/capwap_strings_elem.c
+++ b/src/cw/capwap_strings_elem.c
@@ -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"},
diff --git a/src/cw/capwap_strings_result.c b/src/cw/capwap_strings_result.c
index d6e669e3..19da9bfc 100644
--- a/src/cw/capwap_strings_result.c
+++ b/src/cw/capwap_strings_result.c
@@ -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"}
};
diff --git a/src/cw/cipwap_strings_elem.c b/src/cw/cipwap_strings_elem.c
index 3953f82b..c571c8c6 100644
--- a/src/cw/cipwap_strings_elem.c
+++ b/src/cw/cipwap_strings_elem.c
@@ -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" },
diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c
index d7790217..f61e1e05 100644
--- a/src/cw/conn_process_packet.c
+++ b/src/cw/conn_process_packet.c
@@ -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(¶ms,0,0,elem_id,elem_data,elem_len); //elems_len-(elem-elems_ptr));
+ result_code = cw_process_element(¶ms,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;
}
}
diff --git a/src/cw/cw_in_wtp_reboot_statistics.c b/src/cw/cw_in_wtp_reboot_statistics.c
index d05be8f7..b5b2461d 100644
--- a/src/cw/cw_in_wtp_reboot_statistics.c
+++ b/src/cw/cw_in_wtp_reboot_statistics.c
@@ -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 .
+
+*/
+
+
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) );
diff --git a/src/cw/cw_out_wtp_ip_address.c b/src/cw/cw_out_wtp_ip_address.c
index fdc95e9c..a14eac9d 100644
--- a/src/cw/cw_out_wtp_ip_address.c
+++ b/src/cw/cw_out_wtp_ip_address.c
@@ -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);
}
diff --git a/src/cw/cw_process_element.c b/src/cw/cw_process_element.c
index c7f68579..e46b21da 100644
--- a/src/cw/cw_process_element.c
+++ b/src/cw/cw_process_element.c
@@ -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);
}
diff --git a/src/mod/capwap/capwap_actions_wtp.c b/src/mod/capwap/capwap_actions_wtp.c
index a860ec15..a24536e4 100644
--- a/src/mod/capwap/capwap_actions_wtp.c
+++ b/src/mod/capwap/capwap_actions_wtp.c
@@ -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,
diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c
index 226eb3a2..dc33b6fb 100644
--- a/src/mod/cisco/cisco_actions_ac.c
+++ b/src/mod/cisco/cisco_actions_ac.c
@@ -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,
}
,
diff --git a/src/mod/fortinet/fortinet_actions_ac.c b/src/mod/fortinet/fortinet_actions_ac.c
index 7528cd62..82f7d286 100644
--- a/src/mod/fortinet/fortinet_actions_ac.c
+++ b/src/mod/fortinet/fortinet_actions_ac.c
@@ -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,
diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c
index 8230dfe8..86fbca35 100644
--- a/src/wtp/wtp_main.c
+++ b/src/wtp/wtp_main.c
@@ -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;