From 9f577d1a5c6ab66d52e3bb221f043ab7c14f1e23 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sun, 4 Mar 2018 15:59:20 +0000 Subject: [PATCH] new debug functions - work on hex dump FossilOrigin-Name: c76afdd26f14000b912fea5a052abf0338c8515871ae526fef727a828924d2e7 --- actube.workspace | 4 +- libcw.project | 5 + src/ac/ac_global.c | 4 +- src/ac/ac_main.c | 10 ++ src/ac/conf.c | 32 ++++- src/cw/conn.h | 2 + src/cw/conn_process_packet.c | 6 +- src/cw/cw_format_dump.c | 135 ++++++++++++++++++ src/cw/dbg.c | 4 +- src/cw/dbg.h | 1 - src/cw/format.h | 22 ++- src/cw/mavl.h | 7 +- src/cw/mavl_add_ptr.c | 10 ++ src/cw/mavl_add_strdup.c | 17 +++ src/cw/mavl_cmp_str.c | 6 + src/cw/message_set.c | 55 +++---- src/cw/message_set.h | 3 +- src/mod/capwap/mod_capwap_ac.c | 4 - src/mod/cisco/cisco80211.c | 6 +- .../cisco80211_in_wtp_radio_configuration.c | 2 +- .../cisco80211_out_wtp_radio_configuration.c | 6 +- src/mod/cisco/cisco_actions_ac.c | 78 +++++----- src/mod/cisco/cisco_items.c | 1 + src/mod/cisco/cisco_out_ac_descriptor.c | 6 +- .../cisco/cisco_out_radio_operational_state.c | 4 +- src/mod/cisco/cisco_out_telnet_ssh.c | 2 +- src/mod/cisco/cisco_out_wtp_descriptor.c | 6 +- 27 files changed, 327 insertions(+), 111 deletions(-) create mode 100644 src/cw/cw_format_dump.c create mode 100644 src/cw/mavl_add_ptr.c create mode 100644 src/cw/mavl_add_strdup.c create mode 100644 src/cw/mavl_cmp_str.c diff --git a/actube.workspace b/actube.workspace index c63c2d68..b21adfd1 100644 --- a/actube.workspace +++ b/actube.workspace @@ -1,10 +1,10 @@ - + - + diff --git a/libcw.project b/libcw.project index 4a32a17b..41fae974 100644 --- a/libcw.project +++ b/libcw.project @@ -319,6 +319,11 @@ + + + + + diff --git a/src/ac/ac_global.c b/src/ac/ac_global.c index 09e4cd3b..a3764641 100644 --- a/src/ac/ac_global.c +++ b/src/ac/ac_global.c @@ -107,7 +107,7 @@ int ac_global_init() // mod_set_actions_registered_cb(setup_actions); - +/* ac_config = mbag_create(); mbag_set_str(ac_config, CW_ITEM_AC_NAME, conf_acname); mbag_set_ptr(ac_config, CW_ITEM_AC_STATUS, &ac_status); @@ -133,6 +133,6 @@ int ac_global_init() mbag_set_fun(ac_config, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, get_iplist,release_iplist,(void*)771); - +*/ return 1; } diff --git a/src/ac/ac_main.c b/src/ac/ac_main.c index 78dbfa9f..6911c7fa 100644 --- a/src/ac/ac_main.c +++ b/src/ac/ac_main.c @@ -98,6 +98,16 @@ extern void test_sets(); int main(int argc, char *argv[]) { + char * dump_data = "Eine kleine Mickey Maus zog sich mal die Hosen\ + aus, zog sie wieder an, und du bist dran. Dran bist du noch lange nicht\ + musst erst sagen, wie alt du bist."; + + char * result = cw_format_dump(dump_data,strlen(dump_data),0); + + printf("Dump Result:\n%s\n", result); + exit(0); + + /* char data[100]; mavl_t im; mavldata_t val,itt; diff --git a/src/ac/conf.c b/src/ac/conf.c index 4bd14aca..248aeeb1 100644 --- a/src/ac/conf.c +++ b/src/ac/conf.c @@ -357,12 +357,17 @@ static char *conf_default_mcast_groups_ipv6[] = { #endif //#include "avltree" -#include "cw/stravltree.h" +//#include "cw/stravltree.h" static int add_bcast_addr(void *priv, void *addr) { + printf("Callback Called\n"); + union mavldata *ud; + ud = addr; + printf("Callback Called %s\n", ud->str); + char *s = (char *) addr; conf_bcast_addrs[conf_bcast_addrs_len] = strdup(s); if (conf_bcast_addrs[conf_bcast_addrs_len] != 0) @@ -375,18 +380,21 @@ static int add_bcast_addr(void *priv, void *addr) */ int init_bcast_addrs() { + mavl_t t; + mavliter_t it; + if (conf_bcast_addrs) return 1; if (!conf_ipv4) return 1; - struct avltree *t = stravltree_create(); + t = mavl_create(mavl_cmp_str,mavl_free_str); if (!t) return 0; /* add the default broadast address */ - stravltree_add(t, "255.255.255.255"); + mavl_add_strdup(t, "255.255.255.255"); /* add all other local broadcast addresses */ @@ -417,15 +425,27 @@ int init_bcast_addrs() if (ifa->ifa_broadaddr) { sock_addrtostr(ifa->ifa_broadaddr, str, 100,1); *strchr(str, ':') = 0; - stravltree_add(t, str); + mavl_add_strdup(t, str); } } conf_bcast_addrs = malloc(t->count * sizeof(char *)); - stravltree_foreach_asc(t, add_bcast_addr, 0); - stravltree_destroy(t); +//mavl_foreach_asc(t, add_bcast_addr, 0); + + mavliter_init(&it,t); + mavliter_foreach(&it){ + union mavldata * d; + d = mavliter_get(&it); + conf_bcast_addrs[conf_bcast_addrs_len] = strdup(d->str); + if (conf_bcast_addrs[conf_bcast_addrs_len] != 0) + conf_bcast_addrs_len++; + + } + + + mavl_destroy(t); freeifaddrs(ifa0); diff --git a/src/cw/conn.h b/src/cw/conn.h index 103f297a..48864af9 100644 --- a/src/cw/conn.h +++ b/src/cw/conn.h @@ -32,6 +32,8 @@ #include "fragman.h" #include "cwmsg.h" +#include "mbag.h" + /*#include "action.h"*/ /*#include "mbag.h"*/ diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c index 7ad33dac..98fb6b82 100644 --- a/src/cw/conn_process_packet.c +++ b/src/cw/conn_process_packet.c @@ -273,8 +273,8 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len, /* Search message */ struct cw_MsgData * message; - message = mavl_get(conn->msgset->messages,&search); - + message = mavl_find_ptr(conn->msgset->messages,&search); + int result_code = 0; if (!message){ @@ -475,8 +475,6 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len, - - int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen, struct sockaddr *from) { diff --git a/src/cw/cw_format_dump.c b/src/cw/cw_format_dump.c new file mode 100644 index 00000000..6aec84cb --- /dev/null +++ b/src/cw/cw_format_dump.c @@ -0,0 +1,135 @@ + +#include +#include +#include + +#include "format.h" + + +static struct cw_FormatDumpSettings CW_FORMAT_DUMP_SETTINGS = { + 32/*CW_FORMAT_DUMP_ROW_LEN*/, /* rowlen */ + 1, /* ascii */ + 0, /* settings->invlen */ + "\n\t", /* dump_prefix */ +}; + + + + +static int cw_format_dump_row(char *dst, const uint8_t * data, int len){ + char *pdst = dst; + int i; + char *sp; + for (i = 0; i < len; i++) { + sp = ((i+1)%4==0 && i 0x7f) + c = '.'; + pdst+=sprintf(pdst,"%c",c); + } + + pdst+=sprintf(pdst,"%s","\n"); + return pdst-dst; +} + + + +/** + * Create an ASCII hex dump of binary data + * + * @param data data to dump + * @param len number of bytes to dump (size of data) + * @return a character string with the created data ASCII + * dump (must be released with free).If memory cannot be allocated + * the return value is NULL. + */ +char *cw_format_dump(const uint8_t * data, int len, + struct cw_FormatDumpSettings *settings) +{ + int i; + + int row,rows; + + + + + if (!settings) + settings = &CW_FORMAT_DUMP_SETTINGS; + + rows = len / settings->rowlen; + + printf("Number fo rows: %d\n",rows); + + int md; + if (settings->ascii) + md = 2; + else + md = 1; + + char *dst = malloc(2 * (md * (len * 3 + (rows * 2) + 8 ))); + if (!dst) + return NULL; + + if (len % settings->rowlen) + rows++; + + char *pdst = dst; + + pdst += sprintf(pdst, "%s",settings->dump_prefix); +/* pdst += 2; */ + + char asc_buffer[128]; + char *ascdst = asc_buffer; + + pdst = dst; + for (row; rowrowlen,settings->rowlen); + } + return dst; + + + for (i = 0; i < len; i++) { + char *sp = " "; + if (i == settings->invlen - 1) + sp = "|"; + + pdst += sprintf(pdst, "%02X%s", data[i] & 0xff, sp); + if (settings->ascii) { + int c = data[i] & 0xff; + if (c < 0x20 || c > 0x7f) + c = '.'; + *ascdst = c; + ascdst++; + } + + if ((i + 1) % settings->rowlen == 0) { + int l; + if (settings->ascii) { + *ascdst = 0; + l = sprintf(pdst, " | %s\n\t", asc_buffer); + ascdst = asc_buffer; + + } else { + l = sprintf(pdst, "\n\t"); + } + pdst += l; + } + + } + + if (settings->ascii) { + *ascdst = 0; + if (strlen(asc_buffer)) + pdst += sprintf(pdst, " | %s", asc_buffer); + } + + return dst; +} + diff --git a/src/cw/dbg.c b/src/cw/dbg.c index 3aa24353..6a9ebbd8 100644 --- a/src/cw/dbg.c +++ b/src/cw/dbg.c @@ -473,8 +473,6 @@ void cw_dbg_dmp_(int level, const char *file, int line, } - - void cw_dbg_msg(int level, struct conn *conn, uint8_t * packet, int len, struct sockaddr *from) { @@ -494,7 +492,7 @@ void cw_dbg_msg(int level, struct conn *conn, uint8_t * packet, int len, struct cw_MsgData search; search.type = msg_id; struct cw_MsgData * message; - message = mavl_get(conn->msgset->messages,&search); + message = mavl_get_ptr(conn->msgset->messages,&search); char * msname; if (!message) diff --git a/src/cw/dbg.h b/src/cw/dbg.h index 55eefb4c..c1c83b11 100644 --- a/src/cw/dbg.h +++ b/src/cw/dbg.h @@ -65,7 +65,6 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len); */ #include "debug.h" -#define DBG_LN(level) level,__FILE__,__LINE__ /* driver specific debugs */ diff --git a/src/cw/format.h b/src/cw/format.h index 8138a1cb..0fcdee28 100644 --- a/src/cw/format.h +++ b/src/cw/format.h @@ -25,10 +25,10 @@ #ifndef __FORMAT_H #define __FORMAT_H -#include "cw.h" +#include +#include - -extern int format_hex_bytes(char *dst, const char *format, const char *delim, +int format_hex_bytes(char *dst, const char *format, const char *delim, const uint8_t * src, int len); char *format_s_hex_bytes(char *dst, const char *format, const char *delim, @@ -84,6 +84,22 @@ int format_dot11_fc(char *dst, uint16_t fc); + +#ifndef CW_FORMAT_DUMP_ROW_LEN + #define CW_FORMAT_DUMP_ROW_LEN 16 +#endif + +struct cw_FormatDumpSettings { + int rowlen; + int ascii; + int invlen; + + const char * dump_prefix; +}; + +char *cw_format_dump(const uint8_t * data, int len, + struct cw_FormatDumpSettings *settings); + /**@}*/ #endif diff --git a/src/cw/mavl.h b/src/cw/mavl.h index 4faaedc4..08f34898 100644 --- a/src/cw/mavl.h +++ b/src/cw/mavl.h @@ -58,7 +58,7 @@ union mavldata { uint32_t dword; uint16_t word; uint8_t byte; - const char *str; + char *str; }; typedef union mavldata mavldata_t; @@ -112,6 +112,8 @@ union mavldata *mavl_add(struct mavl *t, union mavldata *data); union mavldata * mavl_get(struct mavl *t ,union mavldata *data); struct mavlnode *mavl_get_node(struct mavl *t, union mavldata *data); void * mavl_get_ptr(mavl_t tree, void * search); +void *mavl_add_ptr(mavl_t tree, void *ptr); + void mavl_merge(mavl_t m, mavl_t t); @@ -221,7 +223,10 @@ typedef mavl_t mavl_conststr_t; extern mavl_conststr_t mavl_create_conststr(); int mavl_cmp_dword(const union mavldata *e1, const union mavldata *e2); +int mavl_cmp_str(const union mavldata *e1, const union mavldata *e2); + void mavl_free_bin(union mavldata *data); +void mavl_free_str(union mavldata *data); /* diff --git a/src/cw/mavl_add_ptr.c b/src/cw/mavl_add_ptr.c new file mode 100644 index 00000000..c4f9ceaa --- /dev/null +++ b/src/cw/mavl_add_ptr.c @@ -0,0 +1,10 @@ +#include "mavl.h" + +void *mavl_add_ptr(mavl_t tree, void *ptr){ + mavldata_t data, *result; + data.ptr = ptr; + result = mavl_add(tree,&data); + if (result) + return result->ptr; + return NULL; +} diff --git a/src/cw/mavl_add_strdup.c b/src/cw/mavl_add_strdup.c new file mode 100644 index 00000000..a466645b --- /dev/null +++ b/src/cw/mavl_add_strdup.c @@ -0,0 +1,17 @@ +#include "mavl.h" + +const char * mavl_add_strdup(mavl_t t, const char * str) +{ + mavldata_t s, *result; + s.str = strdup(str); + if (!s.str) + return NULL; + + result = mavl_add(t,&s); + if (!result){ + free(s.str); + return NULL; + } + + return result->str; +} diff --git a/src/cw/mavl_cmp_str.c b/src/cw/mavl_cmp_str.c new file mode 100644 index 00000000..a465fc2f --- /dev/null +++ b/src/cw/mavl_cmp_str.c @@ -0,0 +1,6 @@ + +#include "mavl.h" + +int mavl_cmp_str(const union mavldata *e1, const union mavldata *e2){ + return strcmp (e1->str,e2->str); +} diff --git a/src/cw/message_set.c b/src/cw/message_set.c index f0e79309..61a7ffa5 100644 --- a/src/cw/message_set.c +++ b/src/cw/message_set.c @@ -1,9 +1,9 @@ #include -#include "mbag.h" + #include "mavl.h" -#include "cw/debug.h" -#include "cw/log.h" +#include "debug.h" +#include "log.h" #include "message_set.h" @@ -65,7 +65,7 @@ static void msgdata_destroy(struct cw_MsgData *data){ free(data); } -static struct cw_MsgData * msgdata_create(){ +static struct cw_MsgData * msgdata_create(int type){ struct cw_MsgData * msg; msg = malloc( sizeof(struct cw_MsgData)); @@ -78,7 +78,7 @@ static struct cw_MsgData * msgdata_create(){ return NULL; } - + msg->type=type; return msg; } @@ -179,7 +179,6 @@ static int update_msgdata(struct cw_MsgSet * set, struct cw_MsgData * msgdata, elemdef->id, elemdef->vendor, handler->name - DBG_END } @@ -226,13 +225,18 @@ int cw_msgset_add(struct cw_MsgSet * set, msg = mavl_find_ptr(set->messages,&search); if (!msg){ - msg = msgdata_create(); + msg = msgdata_create(msgdef->type); + if (!msg){ cw_log(LOG_ERR,"Can't create messae"); return 0; } - } + mavl_add_ptr(set->messages,msg); + } + + + /* Overwrite the found message */ if (msgdef->name) msg->name=msgdef->name; @@ -243,36 +247,21 @@ int cw_msgset_add(struct cw_MsgSet * set, DBG_START(NULL,DBG_INFO) "Add message Type:%d - %s ",msgdef->type,msgdef->name DBG_END - - + update_msgdata(set,msg,msgdef); } - DBG_START(NULL,DBG_INFO) "Hello world" DBG_END - exit(0); - return 0; } -/* -struct cw_ElemHandler * cw_message_set_find_element( - struct cw_MsgSet * set, - struct cw_ElemHandler * element){ - return mavl_find(set->all_elems_by_id,element); -} -*/ - - -/* -mlist_t cw_msgset_get_msg(struct cw_MsgSet * set, int type){ +/** + * @brief Find message data to a specific message + * @param set message set + * @param type message type to search for + * @return message data or NULL if not found + */ +struct cw_MsgData * cw_msgset_get_msgdata(struct cw_MsgSet *set,int type){ struct cw_MsgData search; - search.type = type; - struct cw_MsgData * result = mavl_find(set->messages,&search); - if (!result){ - printf ("no result\n"); - return NULL; - - } - return result->elements_list; + search.type=type; + return mavl_find_ptr(set->messages,&search); } -*/ diff --git a/src/cw/message_set.h b/src/cw/message_set.h index fe4dd99c..2bfa7ac0 100644 --- a/src/cw/message_set.h +++ b/src/cw/message_set.h @@ -68,8 +68,7 @@ extern void cw_msgset_destroy(struct cw_MsgSet * set); extern int cw_msgset_add(struct cw_MsgSet * set, struct cw_MsgDef messages[], struct cw_ElemHandler handlers[]); mlist_t cw_msgset_get_msg(struct cw_MsgSet * set, int type); - - +struct cw_MsgData * cw_msgset_get_msgdata(struct cw_MsgSet *set,int type); #endif diff --git a/src/mod/capwap/mod_capwap_ac.c b/src/mod/capwap/mod_capwap_ac.c index 5d2ed2be..e82f3524 100644 --- a/src/mod/capwap/mod_capwap_ac.c +++ b/src/mod/capwap/mod_capwap_ac.c @@ -18,10 +18,6 @@ extern int capwap_register_actions_ac(struct cw_actiondef *def); static int init() { cw_dbg(DBG_MOD, "Initialiazing mod_capwap."); - - test_sets(); - - exit(0); return 0; } diff --git a/src/mod/cisco/cisco80211.c b/src/mod/cisco/cisco80211.c index f106b9b7..7332f10b 100644 --- a/src/mod/cisco/cisco80211.c +++ b/src/mod/cisco/cisco80211.c @@ -95,8 +95,8 @@ int cisco_out_80211_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, ui continue; } // l+=cw_put_elem_radio_info(dst+l,i->id,i->data); - l+=cw_put_elem_cisco_radio_cfg(dst+l,i->iid,i->data); - l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->iid,i->data,0); + l+=cw_put_elem_cisco_radio_cfg(dst+l,i->u1.iid,i->u2.data); + l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->u1.iid,i->u2.data,0); // l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->iid,i->data,1); // l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->iid,i->data,2); @@ -149,7 +149,7 @@ int cw_radio_cisco_set_state(struct conn * conn, uint8_t *data, int len, int cau MAVLITER_DEFINE(it,conn->radios); mavliter_foreach(&it){ mbag_item_t *i = mavliter_get(&it); - cw_radio_set_admin_state(conn->radios,i->iid,state,cause); + cw_radio_set_admin_state(conn->radios,i->u1.iid,state,cause); } return 1; diff --git a/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c b/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c index a173d043..4b217515 100644 --- a/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c +++ b/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c @@ -25,7 +25,7 @@ int cisco80211_in_wtp_radio_configuration(struct conn *conn, struct cw_action_in mbag_set_word(r,CIPWAP_RADIOITEM80211_CFP_MAXIMUM_DURATION,cw_get_word(data+5)); struct mbag_item * bssid = MBAG_DATA->get(data+7,6); - bssid->id=CW_RADIOITEM80211_BSSID; + bssid->u1.id=CW_RADIOITEM80211_BSSID; mbag_set(r,bssid); mbag_set_word(r,CW_RADIOITEM80211_BEACON_PERIOD,cw_get_word(data+13)); diff --git a/src/mod/cisco/cisco80211_out_wtp_radio_configuration.c b/src/mod/cisco/cisco80211_out_wtp_radio_configuration.c index 150e396f..9187e70f 100644 --- a/src/mod/cisco/cisco80211_out_wtp_radio_configuration.c +++ b/src/mod/cisco/cisco80211_out_wtp_radio_configuration.c @@ -25,12 +25,12 @@ cw_dbg(DBG_X,"The update beginns *********************************************** MAVLITER_DEFINE(it,conn->radios_upd); mavliter_foreach(&it){ struct mbag_item *r = mavliter_get(&it); - mbag_t radio_upd = r->data; - mbag_t radio = mbag_i_get_mbag(conn->radios,r->iid,NULL); + mbag_t radio_upd = r->u2.data; + mbag_t radio = mbag_i_get_mbag(conn->radios,r->u1.iid,NULL); radio = radio_upd; - d+=cw_put_byte(d,r->iid); + d+=cw_put_byte(d,r->u1.iid); // mbag_t radio = mbag_i_get(conn->radios,radio_upd->data->iid); diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index 08dfd829..7d738c34 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -40,40 +40,50 @@ #include "include/cipwap_items.h" +#include "cw/message_set.h" +#include "cw/cw_types.h" + +static struct cw_ElemHandler handlers[] = { + + { + "Discovery Type", /* name */ + CAPWAP_ELEM_DISCOVERY_TYPE, /* Element ID */ + 0,0, /* Vendor / Proto */ + 1,1, /* min/max length */ + CW_TYPE_BYTE, /* type */ + "discovery_type" /* Key */ + } + , + { + "WTP Mac Type", /* name */ + CAPWAP_ELEM_WTP_MAC_TYPE, /* Element ID */ + 0,0, /* Vendor / Proto */ + 1,1, /* min/max length */ + CW_TYPE_BYTE, /* type */ + "wtp_mac_type" /* Key */ + } + , + {0,0,0,0,0,0,0,0} -/* -static cw_elem_handler_t _DISCOVERY_TYPE = { - .id = CAPWAP_ELEM_DISCOVERY_TYPE, - .name = "WTP Frame Tunnel Mode", -// .start = cw_in_generic2, -// .item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE, - .min_len = 1, - .max_len = 1 }; -*/ -static cw_msgdef_t messages[] = { +static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0}; +static struct cw_ElemDef discovery_request_elements[] ={ + {0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0}, + {0,0,0,00} + +}; - /* Discovery Request Message*/ +static struct cw_MsgDef messages[] = { { - .name = "Discovery Request Cisco", - .type = CAPWAP_MSG_DISCOVERY_REQUEST, - .states = (int[]){CAPWAP_STATE_DISCOVERY,0}, - .elements = (cw_ElemDef_t []){ - {&_DISCOVERY_TYPE,1}, - {0,0}, - } - }, - /* Discovery Request Response */ - { - .name = "Discovery Response", - .type = CAPWAP_MSG_DISCOVERY_RESPONSE, - .states = (int[]){CAPWAP_STATE_DISCOVERY,0}, - .elements = (cw_ElemDef_t[]){ - {0,0}, - } + "Discovery Request", + CAPWAP_MSG_DISCOVERY_REQUEST, + CW_RECEIVER_AC, + discovery_request_states, + discovery_request_elements }, + {0,0,0,0} @@ -94,9 +104,6 @@ static cw_msgdef_t messages[] = { - - - static cw_action_in_t actions_in[] = { @@ -550,11 +557,14 @@ static cw_action_out_t actions_out[]={ }; + + + struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){ - if (mode != CW_MOD_MODE_CAPWAP) - return NULL; - cw_msgset_add(set,messages); - return set; + if (mode != CW_MOD_MODE_CAPWAP) + return NULL; + cw_msgset_add(set,messages, handlers); + return set; } diff --git a/src/mod/cisco/cisco_items.c b/src/mod/cisco/cisco_items.c index ac9c2245..872673ca 100644 --- a/src/mod/cisco/cisco_items.c +++ b/src/mod/cisco/cisco_items.c @@ -1,3 +1,4 @@ +#include "cw/mbag.h" #include "cw/item.h" #include "cisco_items.h" diff --git a/src/mod/cisco/cisco_out_ac_descriptor.c b/src/mod/cisco/cisco_out_ac_descriptor.c index d6433066..0c9a5113 100644 --- a/src/mod/cisco/cisco_out_ac_descriptor.c +++ b/src/mod/cisco/cisco_out_ac_descriptor.c @@ -37,7 +37,7 @@ int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t * return 0; } - d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->data),conn); + d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->u2.data),conn); i = mbag_get(cisco_config,CW_ITEM_AC_SOFTWARE_VERSION); @@ -49,7 +49,7 @@ int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t * } if ( i ) { - d += cw_put_version(d,1,i->data); + d += cw_put_version(d,1,i->u2.data); } else { cw_log(LOG_ERR, "Can't set Cisco Software Version in AC descriptor, No value defined."); @@ -57,7 +57,7 @@ int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t * i = mbag_get(cisco_config, CW_ITEM_AC_HARDWARE_VERSION); if ( i ) { - d += cw_put_version(d,0,i->data); + d += cw_put_version(d,0,i->u2.data); } else { cw_log(LOG_ERR, "Can't set Cisco Hardware Version in AC descriptor, No value defined."); diff --git a/src/mod/cisco/cisco_out_radio_operational_state.c b/src/mod/cisco/cisco_out_radio_operational_state.c index e3645d76..baee6536 100644 --- a/src/mod/cisco/cisco_out_radio_operational_state.c +++ b/src/mod/cisco/cisco_out_radio_operational_state.c @@ -18,7 +18,7 @@ int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a continue; } - int state = mbag_get_word(i->data,CW_RADIOITEM_OPER_STATE,CW_RADIO_OPER_STATE_DISABLED<<8); + int state = mbag_get_word(i->u2.data,CW_RADIOITEM_OPER_STATE,CW_RADIO_OPER_STATE_DISABLED<<8); int oper_state = (state >> 8) & 0xff; int oper_cause = state & 0xff; @@ -31,7 +31,7 @@ int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a cw_dbg(DBG_X,"Translated oper state for output from %d to %d",oper_state, oper_state_t); l+=cw_put_elem_radio_operational_state(dst+l,255,oper_state_t, oper_cause); - l+=cw_put_elem_radio_operational_state(dst+l,i->iid,oper_state_t, oper_cause); + l+=cw_put_elem_radio_operational_state(dst+l,i->u1.iid,oper_state_t, oper_cause); diff --git a/src/mod/cisco/cisco_out_telnet_ssh.c b/src/mod/cisco/cisco_out_telnet_ssh.c index 2f97c489..3b1b2a87 100644 --- a/src/mod/cisco/cisco_out_telnet_ssh.c +++ b/src/mod/cisco/cisco_out_telnet_ssh.c @@ -27,7 +27,7 @@ int lw_cisco_put_telnet_ssh(struct conn *conn, uint8_t type,const char * item_id if (item){ if (item->type == MBAG_BYTE) { - d+=lw_put_byte(d,item->byte); + d+=lw_put_byte(d,item->u2.byte); d+=lw_put_byte(d,type); } } diff --git a/src/mod/cisco/cisco_out_wtp_descriptor.c b/src/mod/cisco/cisco_out_wtp_descriptor.c index b861d7b7..d85f5707 100644 --- a/src/mod/cisco/cisco_out_wtp_descriptor.c +++ b/src/mod/cisco/cisco_out_wtp_descriptor.c @@ -29,7 +29,7 @@ mbag_t mbag = NULL; mbag_item_t * i; i = mbag_get(mbag,CW_ITEM_WTP_HARDWARE_VERSION); if ( i ) { - d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->data); + d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->u2.data); } else { cw_log(LOG_ERR, "Can't send Hardware Version in WTP Descriptor, not set."); @@ -39,7 +39,7 @@ mbag_t mbag = NULL; i = mbag_get(mbag,CW_ITEM_WTP_SOFTWARE_VERSION); if ( i ) { - d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->data); + d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->u2.data); } else { cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set."); @@ -47,7 +47,7 @@ mbag_t mbag = NULL; i = mbag_get(mbag,CW_ITEM_WTP_BOOTLOADER_VERSION); if ( i ) { - d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->data); + d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->u2.data); } else { cw_log(LOG_ERR, "Can't send Bootloader Version in WTP descriptor, not set.");