From 0b39c92a79de626dad1483f58185ad8e7bd77df3 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sun, 18 Oct 2015 07:49:14 +0000 Subject: [PATCH] Renamed cw_str to cw_strlist_elem. FossilOrigin-Name: eb87e178a02fd3daebd4d168489a4e5c99be67602caa8ea50d5b6702a4d13005 --- src/capwap/bstr16_create_from_str.c | 1 - src/capwap/capwap.h | 12 ++++++------ src/capwap/capwap_80211.h | 2 +- src/capwap/capwap_strings_elem.c | 2 +- src/capwap/capwap_strings_elem80211.c | 2 +- src/capwap/capwap_strings_msg.c | 2 +- src/capwap/capwap_strings_result.c | 2 +- src/capwap/capwap_strings_state.c | 2 +- src/capwap/capwap_strings_vendor.c | 2 +- src/capwap/cipwap.h | 2 +- src/capwap/cipwap_strings_elem.c | 2 +- src/capwap/cw_msg_init.c | 4 ---- src/capwap/cw_strlist_get_id.c | 2 +- src/capwap/cw_strlist_get_str.c | 2 +- src/capwap/dbg.c | 8 ++++---- src/capwap/dbg.h | 4 ++-- src/capwap/dbg_strings.c | 18 ++++++++++++++++-- src/capwap/strheap.c | 6 +++--- src/capwap/strheap.h | 6 +++--- src/capwap/strlist.h | 10 +++++----- 20 files changed, 50 insertions(+), 41 deletions(-) diff --git a/src/capwap/bstr16_create_from_str.c b/src/capwap/bstr16_create_from_str.c index b594acc5..27f96596 100644 --- a/src/capwap/bstr16_create_from_str.c +++ b/src/capwap/bstr16_create_from_str.c @@ -28,4 +28,3 @@ uint8_t * bstr16_create_from_str(const char *s) return mem; } - diff --git a/src/capwap/capwap.h b/src/capwap/capwap.h index 1b9acc1e..4e87b92f 100644 --- a/src/capwap/capwap.h +++ b/src/capwap/capwap.h @@ -942,12 +942,12 @@ static inline int cw_addelem_result_code(uint8_t * dst, uint32_t code) /* Message to text stuff */ /* Constants to string conversion lists */ -extern struct cw_str capwap_strings_msg[]; -extern struct cw_str capwap_strings_state[]; -extern struct cw_str capwap_strings_vendor[]; -extern struct cw_str capwap_strings_elem[]; -extern struct cw_str capwap_strings_result[]; -extern struct cw_str mbag_item_strings[]; +extern struct cw_strlist_elem capwap_strings_msg[]; +extern struct cw_strlist_elem capwap_strings_state[]; +extern struct cw_strlist_elem capwap_strings_vendor[]; +extern struct cw_strlist_elem capwap_strings_elem[]; +extern struct cw_strlist_elem capwap_strings_result[]; +extern struct cw_strlist_elem mbag_item_strings[]; diff --git a/src/capwap/capwap_80211.h b/src/capwap/capwap_80211.h index 6aed0ff1..737b5864 100644 --- a/src/capwap/capwap_80211.h +++ b/src/capwap/capwap_80211.h @@ -90,7 +90,7 @@ int cw_out_radio_infos(struct conn *conn, struct cw_action_out *a, uint8_t * dst extern int cw_register_actions_capwap_80211_wtp(struct cw_actiondef *def); -extern struct cw_str capwap_strings_elem80211[]; +extern struct cw_strlist_elem capwap_strings_elem80211[]; extern int cw_register_actions_capwap_80211_ac(struct cw_actiondef *def); diff --git a/src/capwap/capwap_strings_elem.c b/src/capwap/capwap_strings_elem.c index ce622d83..79afe02e 100644 --- a/src/capwap/capwap_strings_elem.c +++ b/src/capwap/capwap_strings_elem.c @@ -1,6 +1,6 @@ #include "capwap.h" -struct cw_str capwap_strings_elem[] = { +struct cw_strlist_elem capwap_strings_elem[] = { {CW_ELEM_AC_DESCRIPTOR, "AC Descriptor"}, {CW_ELEM_AC_IPV4_LIST, "AC IPv4 List"}, diff --git a/src/capwap/capwap_strings_elem80211.c b/src/capwap/capwap_strings_elem80211.c index c81cea1b..97f53046 100644 --- a/src/capwap/capwap_strings_elem80211.c +++ b/src/capwap/capwap_strings_elem80211.c @@ -1,7 +1,7 @@ #include "capwap_80211.h" -struct cw_str capwap_strings_elem80211[] = { +struct cw_strlist_elem capwap_strings_elem80211[] = { {CW_ELEM80211_ADD_WLAN, "802.11 Add WLAN"}, {CW_ELEM80211_ANTENNA, "802.11 Antenna"}, diff --git a/src/capwap/capwap_strings_msg.c b/src/capwap/capwap_strings_msg.c index ef709885..0a4d1f42 100644 --- a/src/capwap/capwap_strings_msg.c +++ b/src/capwap/capwap_strings_msg.c @@ -25,7 +25,7 @@ /** * CAPWAP Message Strings */ -struct cw_str capwap_strings_msg[] = { +struct cw_strlist_elem capwap_strings_msg[] = { { CW_MSG_DISCOVERY_REQUEST, "Discovery Request" }, { CW_MSG_DISCOVERY_RESPONSE,"Discovery Response" }, { CW_MSG_JOIN_REQUEST, "Join Request"}, diff --git a/src/capwap/capwap_strings_result.c b/src/capwap/capwap_strings_result.c index 9d7cc0bb..593af0cf 100644 --- a/src/capwap/capwap_strings_result.c +++ b/src/capwap/capwap_strings_result.c @@ -1,7 +1,7 @@ #include "capwap.h" -struct cw_str capwap_strings_result[] = { +struct cw_strlist_elem capwap_strings_result[] = { {CW_RESULT_SUCCESS,"Success"}, /* 0 */ {CW_RESULT_MISSING_AC_LIST,"AC List Message Element MUST be Present"}, /* 1 */ diff --git a/src/capwap/capwap_strings_state.c b/src/capwap/capwap_strings_state.c index cdaad00a..58b57a06 100644 --- a/src/capwap/capwap_strings_state.c +++ b/src/capwap/capwap_strings_state.c @@ -1,6 +1,6 @@ #include "capwap.h" -struct cw_str capwap_strings_state[] = { +struct cw_strlist_elem capwap_strings_state[] = { { CW_STATE_DISCOVERY, "Discovery" }, { CW_STATE_JOIN,"Join" }, { CW_STATE_RUN,"Run" }, diff --git a/src/capwap/capwap_strings_vendor.c b/src/capwap/capwap_strings_vendor.c index 8e13cd45..a799f698 100644 --- a/src/capwap/capwap_strings_vendor.c +++ b/src/capwap/capwap_strings_vendor.c @@ -1,7 +1,7 @@ #include "capwap.h" -struct cw_str capwap_strings_vendor[] = { +struct cw_strlist_elem capwap_strings_vendor[] = { { CW_VENDOR_ID_CISCO, "Cisco" }, { CW_VENDOR_ID_ZYXEL, "Zyxel" }, { CW_VENDOR_ID_FSF, "FSF"}, diff --git a/src/capwap/cipwap.h b/src/capwap/cipwap.h index a7ae5fc1..b946f708 100644 --- a/src/capwap/cipwap.h +++ b/src/capwap/cipwap.h @@ -5,7 +5,7 @@ #include "strheap.h" #include "action.h" -extern struct cw_str cipwap_strings_elem[]; +extern struct cw_strlist_elem cipwap_strings_elem[]; extern int cw_register_actions_cipwap_wtp(struct cw_actiondef *def); diff --git a/src/capwap/cipwap_strings_elem.c b/src/capwap/cipwap_strings_elem.c index 370cf598..4297ff4d 100644 --- a/src/capwap/cipwap_strings_elem.c +++ b/src/capwap/cipwap_strings_elem.c @@ -4,7 +4,7 @@ #include "capwap_cisco.h" -struct cw_str cipwap_strings_elem[] = { +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"}, diff --git a/src/capwap/cw_msg_init.c b/src/capwap/cw_msg_init.c index 794e1637..a92b109e 100644 --- a/src/capwap/cw_msg_init.c +++ b/src/capwap/cw_msg_init.c @@ -12,10 +12,6 @@ void cw_init(struct conn * conn, uint8_t *buffer, int type, int seqnum, struct r - - - - void cw_init_response(struct conn * conn, uint8_t *req) { uint8_t *buffer=conn->resp_buffer; diff --git a/src/capwap/cw_strlist_get_id.c b/src/capwap/cw_strlist_get_id.c index a373048f..f1093820 100644 --- a/src/capwap/cw_strlist_get_id.c +++ b/src/capwap/cw_strlist_get_id.c @@ -2,7 +2,7 @@ #include "strlist.h" -int cw_strlist_get_id(struct cw_str *s,const char *str) +int cw_strlist_get_id(struct cw_strlist_elem *s,const char *str) { while ( s->id!=CW_STR_STOP){ if (strcmp(s->str,str)==0) diff --git a/src/capwap/cw_strlist_get_str.c b/src/capwap/cw_strlist_get_str.c index 83239b0a..32e1b201 100644 --- a/src/capwap/cw_strlist_get_str.c +++ b/src/capwap/cw_strlist_get_str.c @@ -1,7 +1,7 @@ #include "strlist.h" -const char * cw_strlist_get_str(struct cw_str *s,int id) +const char * cw_strlist_get_str(struct cw_strlist_elem *s,int id) { while ( s->id!=CW_STR_STOP){ if (s->id==id) diff --git a/src/capwap/dbg.c b/src/capwap/dbg.c index 626c91bb..adc1e375 100644 --- a/src/capwap/dbg.c +++ b/src/capwap/dbg.c @@ -71,7 +71,7 @@ uint32_t cw_dbg_opt_level = 0; #define DBG_CLR_CYAN "\x1b[36m" -static struct cw_str color_on[] = { +static struct cw_strlist_elem color_on[] = { { DBG_PKT_IN, DBG_CLR_YELLO }, { DBG_PKT_OUT, DBG_CLR_YELLO_I }, @@ -90,19 +90,19 @@ static struct cw_str color_on[] = { { DBG_WARN, DBG_CLR_CYAN }, { CW_STR_STOP, "" } }; -static struct cw_str color_ontext[] = { +static struct cw_strlist_elem color_ontext[] = { { DBG_ELEM_DMP, "\x1b[30m"}, { CW_STR_STOP, "" } }; -static struct cw_str color_off[] = { +static struct cw_strlist_elem color_off[] = { { CW_STR_STOP, "\x1b[22;39m\x1b[23m" } }; -static struct cw_str prefix[] = { +static struct cw_strlist_elem prefix[] = { { DBG_INFO, " Info -" }, { DBG_PKT_IN, " Pkt IN -" }, { DBG_PKT_OUT, " Pkt Out -" }, diff --git a/src/capwap/dbg.h b/src/capwap/dbg.h index 6c9ab1e9..ae11ae5e 100644 --- a/src/capwap/dbg.h +++ b/src/capwap/dbg.h @@ -64,7 +64,7 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len); #endif /** - * @defgroup DebugOptions Debug Options + * @defgroup DbgOptions Debug Options * @{ */ @@ -157,7 +157,7 @@ enum cw_dbg_levels{ extern uint32_t cw_dbg_opt_display; extern uint32_t cw_dbg_opt_level; -extern struct cw_str cw_dbg_strings[]; +extern struct cw_strlist_elem cw_dbg_strings[]; diff --git a/src/capwap/dbg_strings.c b/src/capwap/dbg_strings.c index bc9d7051..ca86057c 100644 --- a/src/capwap/dbg_strings.c +++ b/src/capwap/dbg_strings.c @@ -16,13 +16,24 @@ */ +/** + *@file + *@brief + */ -#include +//#include #include "dbg.h" +/** + *@addtogroup DbgOptions + *@{ + */ -struct cw_str cw_dbg_strings[] = { +/** + * Debug strings + */ +struct cw_strlist_elem cw_dbg_strings[] = { { DBG_INFO, "info" }, { DBG_PKT_IN, "pkt_in" }, { DBG_PKT_OUT, "pkt_out" }, @@ -45,6 +56,9 @@ struct cw_str cw_dbg_strings[] = { { CW_STR_STOP, NULL } }; +/** + *@} + */ diff --git a/src/capwap/strheap.c b/src/capwap/strheap.c index 38d54a89..433c2237 100644 --- a/src/capwap/strheap.c +++ b/src/capwap/strheap.c @@ -4,7 +4,7 @@ static int cmp(const void *v1,const void*v2) { - return ((struct cw_str *)v1)->id - ((struct cw_str *)v2)->id; + return ((struct cw_strlist_elem *)v1)->id - ((struct cw_strlist_elem *)v2)->id; } static void del(void* d) @@ -17,13 +17,13 @@ cw_strheap_t cw_strheap_create() return mavl_create(cmp,del); } -const char * cw_strheap_add(cw_strheap_t t, struct cw_str *s) +const char * cw_strheap_add(cw_strheap_t t, struct cw_strlist_elem *s) { mavl_del(t,s); return mavl_add(t,s); } -int cw_strheap_register_strings(cw_strheap_t h, struct cw_str *s) +int cw_strheap_register_strings(cw_strheap_t h, struct cw_strlist_elem *s) { int n=0; while ( s->id!=CW_STR_STOP){ diff --git a/src/capwap/strheap.h b/src/capwap/strheap.h index 8897c830..e9ce0240 100644 --- a/src/capwap/strheap.h +++ b/src/capwap/strheap.h @@ -11,12 +11,12 @@ typedef struct avltree * cw_strheap_t; extern cw_strheap_t cw_strheap_create(); -extern int cw_strheap_register_strings(cw_strheap_t h, struct cw_str *s); +extern int cw_strheap_register_strings(cw_strheap_t h, struct cw_strlist_elem *s); static inline const char * cw_strheap_get(cw_strheap_t h, int id) { - struct cw_str s; + struct cw_strlist_elem s; s.id=id; - struct cw_str *r = avltree_get(h,&s); + struct cw_strlist_elem *r = avltree_get(h,&s); if (r) return r->str; return NULL; diff --git a/src/capwap/strlist.h b/src/capwap/strlist.h index 23d6f6af..d8a0c2c9 100644 --- a/src/capwap/strlist.h +++ b/src/capwap/strlist.h @@ -7,14 +7,14 @@ */ -#include "stdio.h" - /** *Key/String pair, used for string tables, *to display message element names and so on... */ -struct cw_str { +struct cw_strlist_elem { + /** ID, an integer value */ int id; + /** a pointer to the string */ const char *str; }; @@ -22,8 +22,8 @@ struct cw_str { #define CW_STR_STOP 0xffffffff -extern const char *cw_strlist_get_str(struct cw_str *s, int id); -extern int cw_strlist_get_id(struct cw_str *s, const char *str); +extern const char *cw_strlist_get_str(struct cw_strlist_elem *s, int id); +extern int cw_strlist_get_id(struct cw_strlist_elem *s, const char *str); #endif