From 1885f82f42a9195dc4f48d3170e11b25ad1bcee4 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sat, 5 Mar 2016 09:11:39 +0000 Subject: [PATCH] Work on mods. FossilOrigin-Name: 5c56ae361f2c31ef33603f8b657f3d4768c67a8bb2135b82b0933ba65fd3c985 --- src/cw/Makefile | 2 +- src/cw/bstr.h | 2 +- src/mod/capwap/Makefile | 3 +- src/mod/capwap/capwap_actions_ac.c | 28 ++++++++++++++++--- .../capwap/capwap_out_ac_descriptor.c} | 26 +++++------------ src/mod/capwap/capwap_out_wtp_descriptor.c | 2 +- src/mod/capwap/mod_capwap.h | 2 ++ src/mod/cisco/cisco_actions_ac.c | 7 +++-- 8 files changed, 42 insertions(+), 30 deletions(-) rename src/{cw/cw_out_ac_descriptor.c => mod/capwap/capwap_out_ac_descriptor.c} (61%) diff --git a/src/cw/Makefile b/src/cw/Makefile index eea89a78..dfb2a39a 100644 --- a/src/cw/Makefile +++ b/src/cw/Makefile @@ -143,7 +143,6 @@ CAPWAPOBJS= \ cw_in_check_img_data_req_wtp.o \ cw_in_check_img_data_resp.o \ cw_out_generic.o \ - cw_out_ac_descriptor.o \ cw_out_wtp_descriptor.o \ cw_in_cisco_image_identifier.o\ cw_out_radio_operational_state.o\ @@ -159,6 +158,7 @@ CAPWAPOBJS= \ format.o \ cw_in_cisco_add_wlan.o +# cw_out_ac_descriptor.o \ diff --git a/src/cw/bstr.h b/src/cw/bstr.h index 8a8019fa..ccbf354e 100644 --- a/src/cw/bstr.h +++ b/src/cw/bstr.h @@ -199,7 +199,7 @@ static inline uint8_t * bstrv_create(uint32_t vendor_id, uint8_t *data, uint8_t uint8_t * bstrv_create_from_str(uint32_t vendor_id,const char *s); -uint8_t * bstr16cfgstr(const char * s); +//uint8_t * bstr16cfgstr(const char * s); #endif diff --git a/src/mod/capwap/Makefile b/src/mod/capwap/Makefile index b8c216d0..fcfa84ee 100644 --- a/src/mod/capwap/Makefile +++ b/src/mod/capwap/Makefile @@ -6,7 +6,8 @@ OBJS=\ capwap_actions_wtp.o \ capwap_in_wtp_descriptor.o \ capwap_in_wtp_board_data.o \ - capwap_out_wtp_descriptor.o + capwap_out_wtp_descriptor.o \ + capwap_out_ac_descriptor.o NAME=libcapwap.a diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c index 9b3657de..473c2a07 100644 --- a/src/mod/capwap/capwap_actions_ac.c +++ b/src/mod/capwap/capwap_actions_ac.c @@ -132,7 +132,8 @@ static cw_action_in_t actions_in[] = { .item_id = CW_ITEM_LOCATION_DATA, .start = cw_in_generic2, .max_len = 1024, - .min_len = 1 + .min_len = 1, + .mand = 1 } , @@ -242,14 +243,16 @@ static cw_action_in_t actions_in[] = { static cw_action_out_t actions_out[]={ - /* Message Discovery Response */ + /* --------------------------------------------------- + * Discovery Response Message + */ /* Discovery Response AC Descriptor */ { .msg_id = CW_MSG_DISCOVERY_RESPONSE, .item_id = CW_ITEM_AC_DESCRIPTOR, .elem_id = CW_ELEM_AC_DESCRIPTOR, - .out = cw_out_ac_descriptor, + .out = capwap_out_ac_descriptor, .mand = 1 } , @@ -265,7 +268,11 @@ static cw_action_out_t actions_out[]={ } , - /* List of CAPWAP Control IPv4 and IPv6 addresses */ + /* List of CAPWAP Control IPv4 and IPv6 addresses + * The handler cw_out_capwap_control_ip_addr_list puts + * ipv4 and ipv6 message elements, so the definition + * of .elem_id isn't needed. + */ { .msg_id = CW_MSG_DISCOVERY_RESPONSE, .item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, @@ -275,6 +282,19 @@ static cw_action_out_t actions_out[]={ } , + /* --------------------------------------------------- + * Join Response Message + */ + + { + .msg_id = CW_MSG_JOIN_RESPONSE, + .elem_id = CW_ELEM_RESULT_CODE, + .item_id = CW_ITEM_RESULT_CODE, + .out = cw_out_generic, + .get = cw_out_get_outgoing, + .mand = 1 + } + , {0,0} diff --git a/src/cw/cw_out_ac_descriptor.c b/src/mod/capwap/capwap_out_ac_descriptor.c similarity index 61% rename from src/cw/cw_out_ac_descriptor.c rename to src/mod/capwap/capwap_out_ac_descriptor.c index 87146487..61a0be0d 100644 --- a/src/cw/cw_out_ac_descriptor.c +++ b/src/mod/capwap/capwap_out_ac_descriptor.c @@ -1,28 +1,16 @@ -#include "log.h" -#include "conn.h" +#include "cw/log.h" +#include "cw/conn.h" -#include "mbag.h" -#include "capwap_items.h" -#include "capwap.h" +#include "cw/mbag.h" +#include "cw/capwap_items.h" +#include "cw/capwap.h" -#include "cw.h" +#include "cw/cw.h" -/* -int cw_put_subelem_version(uint8_t *dst,uint16_t subelem_id, uint32_t vendor_id,bstr16_t data) -{ - uint8_t *d=dst; - d += cw_put_dword(d,vendor_id); - d += cw_put_dword(d, (subelem_id<<16) | bstr16_len(data)); - d += cw_put_data(d,bstr16_data(data),bstr16_len(data)); - return d-dst; -} -*/ - - -int cw_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst) +int capwap_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst) { uint8_t *d = dst+4; diff --git a/src/mod/capwap/capwap_out_wtp_descriptor.c b/src/mod/capwap/capwap_out_wtp_descriptor.c index d8a1c11a..167bc513 100644 --- a/src/mod/capwap/capwap_out_wtp_descriptor.c +++ b/src/mod/capwap/capwap_out_wtp_descriptor.c @@ -60,7 +60,7 @@ int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_ d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->data); } else { - cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set."); + cw_log(LOG_ERR, "Can't send Bootloader Version in WTP descriptor, not set."); } diff --git a/src/mod/capwap/mod_capwap.h b/src/mod/capwap/mod_capwap.h index 303980e0..2ccf7f9b 100644 --- a/src/mod/capwap/mod_capwap.h +++ b/src/mod/capwap/mod_capwap.h @@ -14,5 +14,7 @@ extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst); +extern int capwap_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst); + #endif diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index 17af559c..dbc6dee4 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -106,8 +106,9 @@ static cw_action_out_t actions_out[]={ /* Message Discovery Response */ - /* Cisco AP Timesync - Important to get the WTP a DTLS - * connection established*/ + /* Cisco AP Timesync - Discovery Request + * Important to get the WTP a DTLS connection established + */ { .msg_id = CW_MSG_DISCOVERY_RESPONSE, .item_id = CW_ITEM_AC_TIMESTAMP, @@ -117,7 +118,7 @@ static cw_action_out_t actions_out[]={ .mand = 1 } , - /* Discovery Response AC Descriptor */ + /* AC Descriptor - Discovery Response */ { .msg_id = CW_MSG_DISCOVERY_RESPONSE, .item_id = CW_ITEM_AC_DESCRIPTOR,