new debug functions - work on hex dump
FossilOrigin-Name: c76afdd26f14000b912fea5a052abf0338c8515871ae526fef727a828924d2e7
This commit is contained in:
parent
bc98b67450
commit
9f577d1a5c
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Workspace Name="actube" Database="">
|
||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||
<Project Name="ac" Path="ac.project" Active="Yes"/>
|
||||
<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="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
|
@ -319,6 +319,11 @@
|
||||
<File Name="src/cw/debug.h"/>
|
||||
<File Name="src/cw/debug.c"/>
|
||||
<File Name="src/cw/mavl_get_ptr.c"/>
|
||||
<File Name="src/cw/mavl_add_strdup.c"/>
|
||||
<File Name="src/cw/mavl_cmp_str.c"/>
|
||||
<File Name="src/cw/mavliter_init.c"/>
|
||||
<File Name="src/cw/mavl_add_ptr.c"/>
|
||||
<File Name="src/cw/cw_format_dump.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "fragman.h"
|
||||
#include "cwmsg.h"
|
||||
|
||||
#include "mbag.h"
|
||||
|
||||
/*#include "action.h"*/
|
||||
|
||||
/*#include "mbag.h"*/
|
||||
|
@ -273,7 +273,7 @@ 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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
135
src/cw/cw_format_dump.c
Normal file
135
src/cw/cw_format_dump.c
Normal file
@ -0,0 +1,135 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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<len-1) ? "|" : " ";
|
||||
pdst += sprintf(pdst, "%02X%s", data[i] & 0xff, sp);
|
||||
}
|
||||
|
||||
pdst+=sprintf(pdst," ");
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int c = data[i] & 0xff;
|
||||
if (c < 0x20 || c > 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; row<rows; row++){
|
||||
int n;
|
||||
pdst += cw_format_dump_row(pdst,data+row*settings->rowlen,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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -25,10 +25,10 @@
|
||||
#ifndef __FORMAT_H
|
||||
#define __FORMAT_H
|
||||
|
||||
#include "cw.h"
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
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
|
||||
|
@ -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);
|
||||
|
||||
|
||||
/*
|
||||
|
10
src/cw/mavl_add_ptr.c
Normal file
10
src/cw/mavl_add_ptr.c
Normal file
@ -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;
|
||||
}
|
17
src/cw/mavl_add_strdup.c
Normal file
17
src/cw/mavl_add_strdup.c
Normal file
@ -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;
|
||||
}
|
6
src/cw/mavl_cmp_str.c
Normal file
6
src/cw/mavl_cmp_str.c
Normal file
@ -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);
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
|
||||
#include <errno.h>
|
||||
#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;
|
||||
@ -244,35 +248,20 @@ int cw_msgset_add(struct cw_MsgSet * set,
|
||||
"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);
|
||||
}
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
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){
|
||||
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 mavl_find_ptr(set->messages,&search);
|
||||
}
|
||||
return result->elements_list;
|
||||
}
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,10 +557,13 @@ 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);
|
||||
cw_msgset_add(set,messages, handlers);
|
||||
return set;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "cw/mbag.h"
|
||||
#include "cw/item.h"
|
||||
#include "cisco_items.h"
|
||||
|
||||
|
@ -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.");
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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.");
|
||||
|
Loading…
Reference in New Issue
Block a user