Almost all ktv stuff deleted

This commit is contained in:
7u83 2022-08-19 22:23:55 +02:00
parent 14354039e1
commit 6dc8d80102
51 changed files with 658 additions and 1880 deletions

View File

@ -282,6 +282,7 @@ int ac_run(cw_Cfg_t * cfg)
{ {
struct cw_Cfg_iter cfi; struct cw_Cfg_iter cfi;
const char *s; const char *s;
struct cw_Cfg_entry *e;
int i; int i;
@ -292,11 +293,12 @@ int ac_run(cw_Cfg_t * cfg)
* good unicast reply socket */ * good unicast reply socket */
cw_cfg_iter_init(cfg, &cfi, "actube/listen"); cw_cfg_iter_init(cfg, &cfi, "actube/listen");
for (i=0; (s = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++) { for (i=0; (e = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++) {
char addr[100]; char addr[100];
char port[50]; char port[50];
int proto; int proto;
s=e->val;
conf_parse_listen_addr (s, addr, port, &proto); conf_parse_listen_addr (s, addr, port, &proto);
socklist_add_unicast (addr, port, proto, socklist_add_unicast (addr, port, proto,
@ -337,11 +339,12 @@ int ac_run(cw_Cfg_t * cfg)
//mavl_print(cfg,pcb,180); //mavl_print(cfg,pcb,180);
cw_cfg_iter_init(cfg, &cfi, "actube/bcast"); cw_cfg_iter_init(cfg, &cfi, "actube/bcast");
for (i=0; (s = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++) { for (i=0; (e = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++) {
// for (i = 0; i < conf_bcast_addrs_len; i++) { // for (i = 0; i < conf_bcast_addrs_len; i++) {
char addr[50], port[50]; char addr[50], port[50];
int proto; int proto;
s=e->val;
conf_parse_listen_addr (s, addr, port, &proto); conf_parse_listen_addr (s, addr, port, &proto);
socklist_add_broadcast (addr, port, proto); socklist_add_broadcast (addr, port, proto);

View File

@ -498,6 +498,7 @@ char *conf_mods_dir = NULL;
static int init_mods(cw_Cfg_t *cfg){ static int init_mods(cw_Cfg_t *cfg){
int n, i; int n, i;
struct cw_Cfg_entry *e;
const char * modname; const char * modname;
struct cw_Cfg_iter cfi; struct cw_Cfg_iter cfi;
@ -511,11 +512,8 @@ static int init_mods(cw_Cfg_t *cfg){
// cw_mod_set_path(conf_mods_dir); // cw_mod_set_path(conf_mods_dir);
cw_cfg_iter_init(cfg, &cfi, "actube/mod"); cw_cfg_iter_init(cfg, &cfi, "actube/mod");
printf("iter mods\n"); for (i=0; (e = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++) {
for (i=0; (modname = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++) { modname = e->val;
printf("init mod name: %s\n",modname);
struct cw_Mod * mod = cw_mod_load(modname, cfg, CW_ROLE_AC); struct cw_Mod * mod = cw_mod_load(modname, cfg, CW_ROLE_AC);
if (!mod) if (!mod)

View File

@ -33,7 +33,7 @@ void set_cmd(struct shelldata *sd, const char * cmd);
void del_cmd(struct shelldata *sd, const char * cmd); void del_cmd(struct shelldata *sd, const char * cmd);
void send_cmd(struct shelldata *sd, const char * cmd); void send_cmd(struct shelldata *sd, const char * cmd);
void wlan0_cmd(struct shelldata *sd, const char * cmd); void wlan0_cmd(struct shelldata *sd, const char * cmd);
void show_cfg (FILE *out, mavl_t ktv); //void show_cfg (FILE *out, mavl_t ktv);
void show_aps (FILE *out); void show_aps (FILE *out);
struct cw_Conn * find_ap(const char *name); struct cw_Conn * find_ap(const char *name);
@ -79,7 +79,8 @@ void cfg_cmd(struct shelldata *sd, const char *cmd)
fprintf(sd->out,"WTP '%s' not found\n",sd->prompt); fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
} }
else { else {
show_cfg(sd->out,conn->remote_cfg); stop();
// show_cfg(sd->out,conn->remote_cfg);
} }
wtplist_unlock(); wtplist_unlock();
} }
@ -87,7 +88,8 @@ void cfg_cmd(struct shelldata *sd, const char *cmd)
void ucfg_cmd(struct shelldata *sd, const char *cmd) void ucfg_cmd(struct shelldata *sd, const char *cmd)
{ {
struct cw_Conn * conn; struct cw_Conn * conn;
show_cfg(sd->out,sd->update_cfg); stop();
// show_cfg(sd->out,sd->update_cfg);
} }
@ -157,7 +159,7 @@ void del_cmd(struct shelldata *sd, const char *str)
} }
/*
void show_cfg (FILE *out, mavl_t ktv) void show_cfg (FILE *out, mavl_t ktv)
{ {
char value[500]; char value[500];
@ -179,10 +181,12 @@ void show_cfg (FILE *out, mavl_t ktv)
} }
*/
void show_aps (FILE *out) void show_aps (FILE *out)
{ {
struct connlist * cl; stop();
/* struct connlist * cl;
mavliter_t it; mavliter_t it;
wtplist_lock(); wtplist_lock();
@ -199,8 +203,9 @@ void show_aps (FILE *out)
conn = mavliter_get_ptr (&it); conn = mavliter_get_ptr (&it);
sock_addr2str_p (&conn->addr, addr); sock_addr2str_p (&conn->addr, addr);
result = cw_ktv_get (conn->remote_cfg, "wtp-name", NULL); stop();
// result = cw_ktv_get (conn->remote_cfg, "wtp-name", NULL);
if (result == NULL) { if (result == NULL) {
strcpy (wtp_name, ""); strcpy (wtp_name, "");
@ -213,16 +218,18 @@ void show_aps (FILE *out)
fprintf (out, "%s\t\t%s\n", addr, wtp_name); fprintf (out, "%s\t\t%s\n", addr, wtp_name);
} }
wtplist_unlock(); wtplist_unlock();
*/
} }
struct cw_Conn * find_ap(const char *name) struct cw_Conn * find_ap(const char *name)
{ {
stop();
/*
struct connlist * cl; struct connlist * cl;
mavliter_t it; mavliter_t it;
/*wtplist_lock();*/
cl = wtplist_get_connlist(); cl = wtplist_get_connlist();
@ -250,12 +257,16 @@ struct cw_Conn * find_ap(const char *name)
} }
return NULL; return NULL;
*/
/*wtplist_unlock();*/ /*wtplist_unlock();*/
} }
void con (FILE *out) void con (FILE *out)
{ {
stop();
/*
struct connlist * cl; struct connlist * cl;
mavliter_t it; mavliter_t it;
@ -290,10 +301,12 @@ void con (FILE *out)
fprintf (out, "Con!! %s\t\t%s\n", addr, wtp_name); fprintf (out, "Con!! %s\t\t%s\n", addr, wtp_name);
{ {
stop();
mavl_t update; mavl_t update;
update = cw_ktv_create(); // update = cw_ktv_create();
cw_ktv_set_byte(update,"radio.255/admin-state",1); // cw_ktv_set_byte(update,"radio.255/admin-state",1);
conn->update_cfg=update; // conn->update_cfg=update;
} }
@ -301,6 +314,7 @@ void con (FILE *out)
} }
wtplist_unlock(); wtplist_unlock();
*/
} }
@ -355,8 +369,10 @@ void execute_cmd (struct shelldata * sd, const char *str)
key[0]=0; key[0]=0;
type[0]=0; type[0]=0;
val[0]=0; val[0]=0;
cw_ktv_init_str_reader(&reader,str, strlen(str));
n = cw_ktv_parse_string(&reader, key,type,val); stop();
// cw_ktv_init_str_reader(&reader,str, strlen(str));
// n = cw_ktv_parse_string(&reader, key,type,val);
if (n==-1){ if (n==-1){
int i; int i;
@ -403,7 +419,8 @@ void shell_loop (FILE *file)
*/ */
char str[2048]; char str[2048];
sd.update_cfg = cw_ktv_create(); stop();
// sd.update_cfg = cw_ktv_create();

View File

@ -631,7 +631,7 @@ static int join_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, in
copy(params); copy(params);
const char * wtpname = cw_cfg_get(conn->local_cfg,"wtp-name","default"); const char * wtpname = cw_cfg_get(conn->local_cfg,"wtp-name","default");
sprintf(filename,"wtp-join-%s.ckv",wtpname); sprintf(filename,"wtp-join-%s.ckv",wtpname);
cw_cfg_save(filename,params->cfg); cw_cfg_save(filename,params->cfg,NULL);
cw_cfg_clear(params->cfg); cw_cfg_clear(params->cfg);
return 0; return 0;
} }
@ -648,8 +648,8 @@ static int update_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr,
const char * wtpname = cw_cfg_get(conn->local_cfg,"wtp-name","default"); const char * wtpname = cw_cfg_get(conn->local_cfg,"wtp-name","default");
sprintf(filename,"wtp-status-%s.ckv",wtpname); sprintf(filename,"wtp-status-%s.ckv",wtpname);
cw_cfg_save(filename,params->cfg); cw_cfg_save(filename,params->cfg,NULL);
stop();
return 0; return 0;
} }

View File

@ -79,36 +79,43 @@ CWSRC=\
# cw_process_element.c\ # cw_process_element.c\
KTVSRC=\ KTVSRC=\
cw_ktv_add.c\ cfg.c\
cw_ktv_cast.c\
cw_ktv_replace.c\
# cw_ktv_add.c\
cw_ktv_idx_get.c\
cw_ktv_mavlcmp.c\
cw_ktv_mavlcmp_type_by_name.c\
cw_ktv_mavldel.c\
# cw_ktv_parser.c\
# cw_ktv_del_sub.c\
# cw_ktv_base_exists.c\
cw_ktv_add_from_str.c\ cw_ktv_add_from_str.c\
cw_ktv_get_byte.c\ cw_ktv_read_file.c\
cw_ktv_readline.c\
cw_ktv_save.c\
cw_ktv_std_types.c\
cw_ktv_read_struct.c\
cw_ktv_write_struct.c\
# cw_ktv_get_byte.c\
cw_ktv_get_bool.c\ cw_ktv_get_bool.c\
cw_ktv_get_bstr16.c\ cw_ktv_get_bstr16.c\
cw_ktv_set_byte.c\ cw_ktv_set_byte.c\
cw_ktv_set_word.c\ cw_ktv_set_word.c\
cw_ktv_set_dword.c\ cw_ktv_set_dword.c\
cw_ktv_get.c\
cw_ktv_get_word.c\ # cw_ktv_get_word.c\
cw_ktv_get_dword.c\ cw_ktv_get_dword.c\
cw_ktv_get_sysptr.c\ cw_ktv_get_sysptr.c\
cw_ktv_get_str.c\ cw_ktv_get_str.c\
cw_ktv_idx_get.c\
cw_ktv_mavlcmp.c\
cw_ktv_mavlcmp_type_by_name.c\
cw_ktv_mavldel.c\
cw_ktv_read_file.c\
cw_ktv_readline.c\
cw_ktv_read_struct.c\
cw_ktv_write_struct.c\
cw_ktv_std_types.c\
cw_ktv_save.c\
cfg.c\
# cw_ktv_parser.c\ # cw_ktv_cast.c\
# cw_ktv_del_sub.c\ cw_ktv_replace.c\
# cw_ktv_base_exists.c\ cw_ktv_get.c\
LWSRC=\ LWSRC=\
lw_addelem.c\ lw_addelem.c\

View File

@ -495,12 +495,18 @@ int cw_cfg_write_to_file(FILE *f, cw_Cfg_t * cfg)
} }
int cw_cfg_save(const char *filename, cw_Cfg_t *cfg) int cw_cfg_save(const char *filename, cw_Cfg_t *cfg, const char *format, ...)
{ {
int rc; int rc;
FILE *f = fopen(filename, "wb"); FILE *f = fopen(filename, "wb");
if (!f) if (!f)
return errno; return errno;
if (format !=NULL){
va_list args;
va_start(args,format);
vfprintf(f,format,args);
va_end(args);
}
rc = cw_cfg_write_to_file(f, cfg); rc = cw_cfg_write_to_file(f, cfg);
fclose(f); fclose(f);
@ -519,7 +525,7 @@ void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base)
} }
const char *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key) struct cw_Cfg_entry *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *nnkey)
{ {
struct cw_Cfg_entry *e; struct cw_Cfg_entry *e;
int bl, kl; int bl, kl;
@ -541,7 +547,7 @@ const char *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key)
return NULL; return NULL;
else { else {
mavliter_next(&(cfi->it)); mavliter_next(&(cfi->it));
return e->val; return e;
} }
} }
@ -556,7 +562,7 @@ const char *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key)
return NULL; return NULL;
mavliter_next(&(cfi->it)); mavliter_next(&(cfi->it));
return e->val; return e;
} }
@ -686,22 +692,45 @@ void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst)
int exists; int exists;
struct cw_Cfg_entry * old_elem,*e, new_elem; struct cw_Cfg_entry * old_elem,*e, new_elem;
e = mavliter_get(&it); e = mavliter_get(&it);
new_elem.key = cw_strdup(e->key); new_elem.key = cw_strdup(e->key);
new_elem.val = cw_strdup(e->val); new_elem.val = cw_strdup(e->val);
/* if (1){
const char *ov;
ov = cw_cfg_get(dst,e->key,NULL);
cw_dbg(DBG_X, " REAL OV HERE: %s",ov);
}
*/
old_elem = mavl_insert(dst,&new_elem,&exists); old_elem = mavl_insert(dst,&new_elem,&exists);
/* cw_dbg(DBG_X, "CPY: %s: %s -> %s [%d]",new_elem.key,new_elem.val,old_elem->val,exists);
if (exists){
const char *ov;
ov = cw_cfg_get(dst,e->key,NULL);
cw_dbg(DBG_X, " OV HERE: %s",ov);
}
*/
if (!exists){ if (!exists){
cw_dbg(DBG_X, "New: %s: %s",new_elem.key,new_elem.val);
cw_dbg(DBG_CFG_SET, "New: %s: %s",new_elem.key,new_elem.val);
continue; continue;
} }
if (strcmp(new_elem.val,old_elem->val)==0){ if (strcmp(new_elem.val,old_elem->val)==0){
free((void*)new_elem.key); free((void*)new_elem.key);
free((void*)new_elem.val); free((void*)new_elem.val);
continue; continue;
} }
cw_dbg(DBG_X, "Replace: %s: %s (old: %s)",new_elem.key, new_elem.val, old_elem->val); cw_dbg(DBG_CFG_SET, "Replace: %s: %s (old: %s)",new_elem.key, new_elem.val, old_elem->val);
if(dst->del){ if(dst->del){
dst->del(old_elem); dst->del(old_elem);
} }
@ -753,7 +782,7 @@ int cw_cfg_base_exists_l(cw_Cfg_t ** cfgs, const char *key)
if (cw_cfg_base_exists(cfgs[i],key)) if (cw_cfg_base_exists(cfgs[i],key))
return 1; return 1;
} }
cw_dbg(DBG_X,"NOX EXISIS: %s in %d",key,i); // cw_dbg(DBG_X,"NOX EXISIS: %s in %d",key,i);
return 0; return 0;
} }

View File

@ -28,7 +28,7 @@ struct cw_Cfg_iter{
const char * cw_cfg_get(cw_Cfg_t * cfg, const char *key, const char *def); const char * cw_cfg_get(cw_Cfg_t * cfg, const char *key, const char *def);
const char *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key); struct cw_Cfg_entry *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key);
void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base); void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base);
int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, int def); int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, int def);
@ -46,7 +46,7 @@ int cw_cfg_base_exists(cw_Cfg_t * cfg, const char *key);
uint8_t cw_cfg_get_byte_l(cw_Cfg_t ** cfgs, char *key, uint8_t def); uint8_t cw_cfg_get_byte_l(cw_Cfg_t ** cfgs, char *key, uint8_t def);
cw_Val_t * cw_cfg_get_val_l(cw_Cfg_t ** cfgs, const char *key, const struct cw_Type *type); cw_Val_t * cw_cfg_get_val_l(cw_Cfg_t ** cfgs, const char *key, const struct cw_Type *type);
int cw_cfg_base_exists_l(cw_Cfg_t ** cfgs, const char *key); int cw_cfg_base_exists_l(cw_Cfg_t ** cfgs, const char *key);
int cw_cfg_save(const char *filename, cw_Cfg_t *cfg); int cw_cfg_save(const char *filename, cw_Cfg_t *cfg, const char *format, ...);

View File

@ -59,7 +59,6 @@ void cw_conn_init(struct cw_Conn * conn)
conn->msg_callbacks = mavl_create(msg_callback_cmp,NULL,sizeof(struct msg_callback)); conn->msg_callbacks = mavl_create(msg_callback_cmp,NULL,sizeof(struct msg_callback));
conn->update_cfg = cw_cfg_create(); conn->update_cfg = cw_cfg_create();
cw_dbg(DBG_X,"Update CFG ist %p",conn->update_cfg);
conn->remote_cfg = cw_cfg_create(); conn->remote_cfg = cw_cfg_create();
conn->local_cfg = cw_cfg_create(); conn->local_cfg = cw_cfg_create();
} }

View File

@ -7,12 +7,11 @@ int cw_in_generic_with_index(struct cw_ElemHandler *eh,
{ {
char key[CW_CFG_MAX_KEY_LEN]; char key[CW_CFG_MAX_KEY_LEN];
int idx; int idx;
struct cw_Type * type = (struct cw_Type*)eh->type;
cw_dbg(DBG_X,"Fix cw_in_generic_with_index");
stop();
idx = cw_get_byte(data); idx = cw_get_byte(data);
sprintf(key,"%s.%d",eh->key,idx); sprintf(key,"%s.%d",eh->key,idx);
// cw_cfg_add(params->cfg,key,eh->type,NULL,data+1,len-1); // cw_cfg_add(params->cfg,key,eh->type,NULL,data+1,len-1);
type->read(params->cfg,key,data+1,len-1,eh->param);
return 1; return 1;
} }

View File

@ -1,43 +0,0 @@
#include "val.h"
#include "cw.h"
#include "log.h"
#include "dbg.h"
cw_Val_t * cw_ktv_add(mavl_t kvtstore, const char *key, const struct cw_Type *type,
const void * valguard,
const uint8_t * data, int len)
{
cw_Val_t mdata, *mresult;
int exists;
mdata.key=cw_strdup(key);
mdata.valguard=valguard;
if (!mdata.key){
cw_log(LOG_ERR, "Can't allocate memory for KTV key %s: %s",
key,strerror(errno));
return NULL;
}
mresult = type->get(&mdata,data,len);
if (!mresult){
cw_log(LOG_ERR, "Can't create kvstore element for key %s of type %s: %s",
key,type->name, strerror(errno));
free(mdata.key);
return NULL;
}
mavl_del(kvtstore,&mdata);
mresult = mavl_insert(kvtstore, &mdata, &exists);
if (exists){
cw_log(LOG_ERR, "Element already exists %s", key);
/* element already exists */
free(mdata.key);
if (type->del)
type->del(&mdata);
return mresult;
}
return mresult;
}

View File

@ -1,45 +0,0 @@
#include "val.h"
#include "cw.h"
#include "log.h"
#include "dbg.h"
const char * cw_ktv_add_from_str(mavl_t kvtstore, const char *key,
const struct cw_Type *type,
const void * valguard,
const char * str)
{
cw_Val_t mdata, *mresult;
int exists;
/* cw_dbg(DBG_ELEM,"KVStore (%p,%d) add elem (%s): %s", kvstore, kvstore->count,
type->name, key );
*/
mdata.key=cw_strdup(key);
mdata.valguard=valguard;
if (!mdata.key){
cw_log(LOG_ERR, "Can't allocate memory for key %s: %s",
key,strerror(errno));
return NULL;
}
mresult = type->from_str(&mdata,str);
if (!mresult){
cw_log(LOG_ERR, "Can't create kvstore element for key %s of type %s: %s",
key,type->name, strerror(errno));
free(mdata.key);
return NULL;
}
mresult = mavl_insert(kvtstore, &mdata, &exists);
if (exists){
cw_log(LOG_ERR, "Element already exists %s", key);
/* element already exists */
free(mdata.key);
if (type->del)
type->del(&mdata);
return key;
}
return mdata.key;
}

View File

@ -1,29 +0,0 @@
#include "val.h"
/**
* @file
* @description Implementation of cw_ktv_base_exisits
*/
/**
* @brief Check if elements with e certain baskey can be found in
* in ktvstore.
* @param ktvstore ktvstore to search in
* @param basekey basekey to search for
* @return The first ktv element belonging to the base eky,
* otherwise NULL if no element was found.
*
*/
cw_Val_t * cw_ktv_base_exists(mavl_t ktvstore, const char *basekey)
{
cw_Val_t * result, search;
search.key=(char*)basekey;
result = mavl_get_first(ktvstore,&search);
if (result == NULL)
return NULL;
if (strncmp(result->key,basekey,strlen(basekey))==0)
return result;
return NULL;
}

View File

@ -1,14 +0,0 @@
#include "val.h"
cw_Val_t * cw_ktv_cast(cw_Val_t *v,const cw_Type_t * type)
{
if (strcmp(v->type->name,type->name)==0)
return v;
if (type->cast==NULL)
return NULL;
if (!type->cast(v))
return NULL;
return v;
}

View File

@ -1,32 +0,0 @@
#include "val.h"
#include "mavl.h"
/**
* @brief Get a ktv value from a ktv store
* @param ktv ktv store
* @param key key to search for
* @param type type to match
* @return A pointer to a #cw_Val_t element, found in the ktv store or
* NULL if no element with matching key/type is found.
*/
cw_Val_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type)
{
cw_Val_t search, *result;
/* we can safely cast from const char * to char *, because
* we never will use the search varaiable to store ktv values */
search.key=(char*)key;
result = mavl_get(ktv,&search);
if (result == NULL){
return NULL;
}
if (type == NULL){
return result;
}
if (strcmp(type->name,result->type->name)==0){
return result;
}
return NULL;
}

View File

@ -1,11 +0,0 @@
#include "val.h"
uint8_t cw_ktv_get_bool(mavl_t ktv,const char *key, uint8_t def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_BOOL);
if (k != NULL){
return k->val.boolean;
}
return def;
}

View File

@ -1,13 +0,0 @@
#include "val.h"
#include "bstr.h"
bstr16_t cw_ktv_get_bstr16(mavl_t ktv,const char *key, bstr16_t def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_BSTR16);
if (k != NULL){
return bstr16_create(k->type->data(k),k->type->len(k));
}
return def;
}

View File

@ -1,11 +0,0 @@
#include "val.h"
uint8_t cw_ktv_get_byte(mavl_t ktv,const char *key, uint8_t def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_BYTE);
if (k != NULL){
return k->val.byte;
}
return def;
}

View File

@ -1,11 +0,0 @@
#include "val.h"
uint32_t cw_ktv_get_dword(mavl_t ktv,const char *key, uint32_t def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_DWORD);
if (k != NULL){
return k->val.dword;
}
return def;
}

View File

@ -1,11 +0,0 @@
#include "val.h"
char * cw_ktv_get_str(mavl_t ktv,const char *key, char * def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_STR);
if (k != NULL){
return k->val.ptr;
}
return def;
}

View File

@ -1,11 +0,0 @@
#include "val.h"
void * cw_ktv_get_sysptr(mavl_t ktv,const char *key, void * def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_SYSPTR);
if (k != NULL){
return k->val.ptr;
}
return def;
}

View File

@ -1,11 +0,0 @@
#include "val.h"
uint16_t cw_ktv_get_word(mavl_t ktv,const char *key, uint16_t def)
{
cw_Val_t * k;
k = cw_ktv_get(ktv,key,CW_TYPE_WORD);
if (k != NULL){
return k->val.word;
}
return def;
}

View File

@ -1,126 +0,0 @@
#include "val.h"
#include "cfg.h"
void * ktvn(struct mavl *t ,const void *search)
{
struct mavlnode *n,/**lastl,*/*lastb;
lastb = NULL; /*lastl=NULL;*/
n = t->root;
while(n){
int rc;
/* const cw_Val_t;*//* *c1,*c2;*/
/*c1=search;
c2=mavlnode_dataptr(n);
*/
rc = t->cmp(search,mavlnode_dataptr(n));
/*printf("Compare: %s %s = %d\n",c1->key,c2->key, rc);*/
if (rc==0){
return NULL;
}
if (rc<0){
/*lastl = n;*/
if (n->s[0]==NULL){
return mavlnode_dataptr(lastb);
}
n=n->s[0];
}
else{
lastb=n;
if(n->s[1]==NULL){
return mavlnode_dataptr(lastb);
}
n=n->s[1];
}
}
return NULL;
}
int cw_ktv_idx_get(mavl_t ktv, const char *key)
{
char ikey[CW_CFG_MAX_KEY_LEN];
cw_Val_t search, * result;
char *d;
sprintf(ikey,"%s.%d",key,65536);
search.key=ikey;
/*//result = ktvn(ktv,&search);*/
result = mavl_get_last(ktv,&search);
if (result == NULL){
return -1;
}
d = strchr(result->key,'.');
if (d==NULL){
return -1;
}
if (strncmp(result->key,ikey,d-result->key)!=0)
return -1;
return atoi(d+1);
}
int cw_ktv_idx_get_next(mavl_t ktv, const char *key, int n)
{
char ikey[CW_CFG_MAX_KEY_LEN];
cw_Val_t search, * result;
char *d;
int i;
sprintf(ikey,"%s.%d",key,n);
search.key=ikey;
/*//result = ktvn(ktv,&search);*/
result = mavl_get_first(ktv,&search);
if (result == NULL){
return -1;
}
/*d = strchr(result->key,'.');*/
d=NULL;
/* for (i = strlen(result->key); i>=0; i--){
if (result->key[i]=='/')
break;
}
*/ for (i = strlen(ikey); i>=0; i--){
if (ikey[i]=='.'){
d = result->key+i;
break;
}
}
if (d==NULL){
return -1;
}
if(result->key[i]!='.'){
return -1;
}
/* if (strncmp(result->key,ikey,d-result->key)!=0)
return -1;
*/
if (strncmp(result->key,ikey,i)!=0)
return -1;
return atoi(result->key+i+1);
}

View File

@ -1,67 +0,0 @@
#include <ctype.h>
#include "val.h"
/**
* @brief Default function to compare two values of type #cw_Val_t.
*
* @param v1
* @param v2
* @return
*/
int cw_ktv_mavlcmp (const void *v1, const void *v2)
{
char *d1, *d2, *k1, *k2;
int l1, l2, rc, i1, i2;
k1 = ( (cw_Val_t *) v1)->key;
k2 = ( (cw_Val_t *) v2)->key;
while (1) {
/* Find dots in both keys */
d1 = strchr (k1, '.');
d2 = strchr (k2, '.');
/* if there are no dots, compare keys as normal */
if (d1 == NULL || d2 == NULL)
return strcmp (k1, k2);
/* calculate the length of the key till dots */
l1 = d1 - k1; /*((cw_Val_t *) v1)->key;*/
l2 = d2 - k2; /*((cw_Val_t *) v2)->key;*/
/* if length differs do a normal compare */
if (l1 != l2) {
return strcmp (k1, k2); /*((cw_Val_t *) v1)->key, ((cw_Val_t *) v2)->key);*/
}
rc = strncmp (k1, k2, l1); /*((cw_Val_t *) v1)->key,((cw_Val_t *) v2)->key,l1);*/
if (rc != 0) {
return rc;
}
d1++;
d2++;
i1 = atoi (d1);
i2 = atoi (d2);
rc = i1 - i2;
if (rc != 0)
return rc;
while (isdigit (*d1))
d1++;
while (isdigit (*d2))
d2++;
k1=d1;
k2=d2;
/*return strcmp(d1,d2);*/
/*return cw_ktv_mavlcmp(d1,d2);*/
}
}

View File

@ -1,8 +0,0 @@
#include "val.h"
int cw_ktv_mavlcmp_type_by_name (const void *v1, const void *v2)
{
return strcmp ( (*((struct cw_Type**) v1))->name,
(*((struct cw_Type**) v2))->name);
}

View File

@ -1,14 +0,0 @@
#include <stdlib.h>
#include "val.h"
void cw_ktv_mavldel(void *data)
{
struct cw_Val *ktv = data;
if (ktv->type->del) {
ktv->type->del(data);
}
free(ktv->key);
}

View File

@ -1,359 +0,0 @@
#include <stdint.h>
#include "val.h"
static int str_getc(struct cw_Val_Reader * r)
{
if (r->next==r->maxlen)
return EOF;
return *((uint8_t*)(r->data)+r->next++);
}
static void str_ungetc(struct cw_Val_Reader * r, int c)
{
if (r->next>0)
r->next--;
}
void cw_ktv_init_str_reader(struct cw_Val_Reader *r, const char * str, int len)
{
memset(r,0,sizeof(struct cw_Val_Reader));
r->data = str;
r->xgetchar=str_getc;
r->ungetchar=str_ungetc;
r->maxlen=len;
}
#include <ctype.h>
#include "val.h"
/*
struct parser {
int line;
int pos;
int prevpos;
char error[256];
int quote;
FILE *f;
int (*getc)(struct parser *);
void (*ungetc)(struct parser *)
};
*/
static int get_char(struct cw_Val_Reader *r)
{
int c;
c = r->xgetchar (r);
r->pos++;
if (c=='\n'){
r->prevpos=r->pos;
r->line ++;
r->pos=0;
}
return c;
}
static void unget_char(struct cw_Val_Reader * r,int c){
r->ungetchar(r,c);
if (c=='\n'){
r->line--;
r->pos=r->prevpos;
}
else
r->pos--;
}
static int get_char_q(struct cw_Val_Reader *p)
{
int c;
while(1) {
c = get_char(p);
if (c==EOF || c=='\n')
return c;
if(c=='"' && !p->quote){
p->quote=1;
continue;
}
if(c=='"' && p->quote){
p->quote=0;
continue;
}
break;
}
if (!p->quote)
return c;
if (c!='\\')
return c;
c = get_char(p);
switch(c){
case EOF:
return c;
case 'n':
return '\n';
case '\\':
return '\\';
case '"':
return '"';
default:
unget_char(p,c);
return '\\';
}
/* We will never reach here */
/* return c;*/
}
static int skip_chars (struct cw_Val_Reader *r, const char * chars)
{
int c;
while ( (c = get_char (r)) != EOF) {
if (strchr (chars, c))
continue;
return c;
}
return c;
}
static int skip_to_chars (struct cw_Val_Reader *r, const char *chars)
{
int c;
while ( (c = get_char (r)) != EOF) {
if (strchr (chars, c))
return c;
}
return c;
}
static int read_key (struct cw_Val_Reader *r, char *key, int max_len)
{
int c,n;
do {
c = skip_chars (r, " \t\n\a\v");
if (c == '#') {
c = skip_to_chars (r, "\n\a");
} else {
break;
}
} while (c != EOF);
unget_char(r,c);
c=get_char_q(r);
n=0;
while(c!=EOF && n<max_len){
if (!r->quote && !isalnum(c) && !strchr("._/-()@#|{}[]\\",c)){
unget_char(r,c);
break;
}
key[n]=c;
c=get_char_q(r);
n++;
}
key[n]=0;
return n;
}
static int skip_to_colon(struct cw_Val_Reader * r)
{
int c;
c = skip_chars (r, " \t");
if (c!=':' && c!='='){
if (c=='\n'){
unget_char(r,c);
sprintf(r->error,"Unexpected EOL, colon or equal sign expected.");
return -1;
}
sprintf(r->error,"Colon or equal sign expected.");
return -1;
}
return c;
}
static int read_type(struct cw_Val_Reader * r, char *type, int max_len)
{
int c,n;
c = skip_to_colon(r);
if (c==-1)
return -1;
if (c=='='){
unget_char(r,c);
return sprintf(type,"%s","Str");
}
c = skip_chars (r, " \t");
if (c==':'){
unget_char(r,c);
sprintf(type,"%s","Str");
return 0;
}
if (!isalpha(c)){
if (c=='\n'){
unget_char(r,c);
/*sprintf(p->error,"Error at line %d, pos %d: Unexpected EOL.", p->line, p->pos);*/
return -1;
}
/*sprintf(p->error,"Error at line %d, pos %d: Letter expected.", p->line, p->pos);*/
return -1;
}
n=0;
while(c!=EOF && n<max_len){
if (!isalnum(c) && !strchr("_/-.()@#|{}[]",c)/*strchr(": \t\n\a",c)*/){
unget_char(r,c);
break;
}
type[n]=c;
c=get_char(r);
n++;
}
type[n]=0;
return n;
}
static int read_val(struct cw_Val_Reader *r, char *val, int max_len){
int c,n,quote;
c = skip_to_colon(r);
if (c==-1)
return -1;
c = skip_chars (r, " \t");
if (c=='"'){
quote=1;
c=get_char(r);
}
else{
quote=0;
}
n=0;
while(c!=EOF && n<max_len){
if (quote && c=='"'){
break;
}
if (c=='\n'){
break;
}
if (quote){
if (c=='\\'){
c = get_char(r);
switch(c){
case 'n':
c='\n';
break;
case '\\':
break;
case '"':
break;
default:
unget_char(r,c);
c='\\';
}
}
}
val[n++]=c;
c=get_char(r);
}
if(!quote && n>0){
while(n>0){
if (isspace(val[n-1]))
n--;
else
break;
}
}
val[n]=0;
return n;
}
/*
int cw_ktv_parse_line (FILE *f, char * key, char * type, char *val)
{
int n;
struct parser p;
p.line=1;
p.pos=0;
p.prevpos=0;
p.quote=0;
p.f=f;
n = read_key (&p,key,CW_KTV_MAX_KEY_LEN);
n = read_type (&p,type,CW_KTV_MAX_KEY_LEN);
if (n==-1){
return -1;
}
n = read_val (&p,val,CW_KTV_MAX_KEY_LEN);
if (n==-1){
return -1;
}
return 0;
}
*/
int cw_ktv_parse_line(struct cw_Val_Reader * r)
{
}
int cw_ktv_parse_string(struct cw_Val_Reader *r, char *key, char *type, char *val)
{
int n;
n = read_key (r,key,CW_KTV_MAX_KEY_LEN);
n = read_type(r,type,200);
if (n==1)
return -1;
n = read_val(r,val,200);
return n;
}

View File

@ -1,40 +0,0 @@
#include "val.h"
#include "cfg.h"
int cw_ktv_read_file(FILE * file, mavl_t ktv, mavl_t types)
{
char key[CW_CFG_MAX_KEY_LEN];
char type[256];
char val[2048];
int rc;
struct cw_Type typesearch, *cwtype;
do {
rc = cw_ktv_read_line(file,key,type,val);
if (rc != 0){
continue;
}
typesearch.name=type;
cwtype = mavl_get_ptr(types,&typesearch);
if (cwtype != NULL){
/*// printf("Yes! I know the type: %s\n",cwtype->name);*/
}
else {
printf("Unknown type: %s\n",typesearch.name);
continue;
}
cw_ktv_add_from_str(ktv,key,cwtype,NULL,val);
}while(rc==0);
return 0;
}

View File

@ -1,62 +0,0 @@
#include "val.h"
#include "dbg.h"
#include "cfg.h"
int cw_ktv_read_struct(mavl_t ktv,const cw_ValStruct_t * stru, const char *pkey,
uint8_t * data, int len)
{
char key[CW_CFG_MAX_KEY_LEN];
int pos, i,l;
cw_Val_t * result;
pos=0; i=0;
while (stru[i].type != NULL){
char dbstr[100];
if(stru[i].position!=-1)
pos=stru[i].position;
if (stru[i].key!=NULL)
sprintf(key,"%s/%s",pkey,stru[i].key);
else
sprintf(key,"%s",pkey);
switch (stru[i].len){
case CW_KTVSTRUCT_L8:
l = cw_get_byte(data+pos);
pos ++;
break;
case CW_KTVSTRUCT_L16:
l = cw_get_word(data+pos);
pos ++;
break;
case -1:
l = len-pos;
break;
default:
l = stru[i].len;
if (pos+l > len){
l = len-pos;
}
}
result = cw_ktv_add(ktv,key,stru[i].type,stru[i].valguard,data+pos,l);
stru[i].type->to_str(result,dbstr,100);
cw_dbg(DBG_ELEM_DETAIL, "Read (%d): %s: %s",pos,key,dbstr);
printf("READ STRUCT (%d): %s: %s\n",pos,key,dbstr);
if (stru[i].len==-1)
l = result->type->len(result);
else
l = stru[i].len;
if(stru[i].position == -1)
pos+=l;
i++;
}
return pos;
}

View File

@ -1,306 +0,0 @@
#include <ctype.h>
#include "val.h"
#include "cfg.h"
struct parser {
int line;
int pos;
int prevpos;
char error[256];
int quote;
FILE *f;
int (*getc)(struct parser *);
void (*ungetc)(struct parser *);
};
/*
static int pgetc(struct parser *parser)
{
return fgetc(parser->f);
}*/
static int get_char(struct parser *p)
{
int c;
c = fgetc (p->f);
p->pos++;
if (c=='\n'){
p->prevpos=p->pos;
p->line ++;
p->pos=0;
}
return c;
}
static void unget_char(struct parser *p,int c){
ungetc(c,p->f);
if (c=='\n'){
p->line--;
p->pos=p->prevpos;
}
else
p->pos--;
}
static int get_char_q(struct parser *p)
{
int c;
while(1) {
c = get_char(p);
if (c==EOF || c=='\n')
return c;
if(c=='"' && !p->quote){
p->quote=1;
continue;
}
if(c=='"' && p->quote){
p->quote=0;
continue;
}
break;
}
if (!p->quote)
return c;
if (c!='\\')
return c;
c = get_char(p);
switch(c){
case EOF:
return c;
case 'n':
return '\n';
case '\\':
return '\\';
case '"':
return '"';
default:
unget_char(p,c);
return '\\';
}
/* We will never reach here */
/* return c;*/
}
static int skip_chars (struct parser *p, const char * chars)
{
int c;
while ( (c = get_char (p)) != EOF) {
if (strchr (chars, c))
continue;
return c;
}
return c;
}
static int skip_to_chars (struct parser *p, const char *chars)
{
int c;
while ( (c = get_char (p)) != EOF) {
if (strchr (chars, c))
return c;
}
return c;
}
static int read_key (struct parser *p, char *key, int max_len)
{
int c,n;
do {
c = skip_chars (p, " \t\n\a\v");
if (c == '#') {
c = skip_to_chars (p, "\n\a");
} else {
break;
}
} while (c != EOF);
unget_char(p,c);
c=get_char_q(p);
n=0;
while(c!=EOF && n<max_len){
if (!p->quote && !isalnum(c) && !strchr("._/-()@#|{}[]\\",c)/*strchr(": \t\n\a",c)*/){
unget_char(p,c);
break;
}
key[n]=c;
c=get_char_q(p);
n++;
}
key[n]=0;
return n;
}
static int skip_to_colon(FILE *f,struct parser * p)
{
int c;
c = skip_chars (p, " \t");
if (c!=':'){
if (c=='\n'){
unget_char(p,c);
sprintf(p->error,"Error at line %d, pos %d: Unexpected EOL, collon expected.", p->line, p->pos);
return 0;
}
sprintf(p->error,"Error at line %d, pos %d: Collon expected.", p->line, p->pos);
return 0;
}
return 1;
}
static int read_type(struct parser *p, char *type, int max_len)
{
int c,n;
if (!skip_to_colon(p->f,p))
return -1;
c = skip_chars (p, " \t");
if (c==':'){
unget_char(p,c);
sprintf(type,"%s","");
return 0;
}
if (!isalpha(c)){
if (c=='\n'){
unget_char(p,c);
sprintf(p->error,"Error at line %d, pos %d: Unexpected EOL.", p->line, p->pos);
return -1;
}
sprintf(p->error,"Error at line %d, pos %d: Letter expected.", p->line, p->pos);
return -1;
}
n=0;
while(c!=EOF && n<max_len){
if (!isalnum(c) && !strchr("_/-.()@#|{}[]",c)/*strchr(": \t\n\a",c)*/){
unget_char(p,c);
break;
}
type[n]=c;
c=get_char(p);
n++;
}
type[n]=0;
return n;
}
static int read_val(struct parser *p, char *val, int max_len){
int c,n,quote;
if (!skip_to_colon(p->f,p))
return -1;
c = skip_chars (p, " \t");
if (c=='"'){
quote=1;
c=get_char(p);
}
else{
quote=0;
}
n=0;
while(c!=EOF && n<max_len){
if (quote && c=='"'){
break;
}
if (c=='\n'){
break;
}
if (quote){
if (c=='\\'){
c = get_char(p);
switch(c){
case 'n':
c='\n';
break;
case '\\':
break;
case '"':
break;
default:
unget_char(p,c);
c='\\';
}
}
}
val[n++]=c;
c=get_char(p);
}
if(!quote && n>0){
while(n>0){
if (isspace(val[n-1]))
n--;
else
break;
}
}
val[n]=0;
return n;
}
int cw_ktv_read_line (FILE *f, char * key, char * type, char *val)
{
int n;
struct parser p;
p.line=1;
p.pos=0;
p.prevpos=0;
p.quote=0;
p.f=f;
n = read_key (&p,key,CW_CFG_MAX_KEY_LEN);
n = read_type (&p,type,CW_CFG_MAX_KEY_LEN);
if (n==-1){
return -1;
}
n = read_val (&p,val,CW_CFG_MAX_KEY_LEN);
if (n==-1){
return -1;
}
return 0;
}

View File

@ -1,32 +0,0 @@
#include "val.h"
#include "cw.h"
#include "log.h"
#include "dbg.h"
cw_Val_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type,
const void * valguard,
const uint8_t * data, int len)
{
cw_Val_t mdata, *mresult;
int exists;
mdata.key=cw_strdup(key);
if (!mdata.key){
cw_log(LOG_ERR, "Can't allocate memory for KTV key %s: %s",
key,strerror(errno));
return NULL;
}
mresult = type->get(&mdata,data,len);
if (!mresult){
cw_log(LOG_ERR, "Can't create kvstore element for key %s of type %s: %s",
key,type->name, strerror(errno));
free(mdata.key);
return NULL;
}
mresult = mavl_replace(kvtstore, &mdata, &exists);
return mresult;
}

View File

@ -1,58 +0,0 @@
#include "val.h"
static int write_str(FILE *outfile,const char *str)
{
if ( (strchr(str,'\\')!=NULL) || (strchr(str,'"')!=NULL) || (strchr(str,'\n')!=NULL)){
fprintf(outfile,"\"");
while (*str != 0){
switch(*str){
case '\n':
fprintf(outfile,"\\n");
break;
case '\\':
fprintf(outfile,"\\\\");
break;
case '"':
fprintf(outfile,"\\\"");
break;
default:
fprintf(outfile,"%c",*str);
break;
}
str++;
}
fprintf(outfile,"\"");
return 1;
}
fprintf(outfile,"%s",str);
return 1;
}
int cw_ktv_save(mavl_t ktvstore, const char * filename){
mavliter_t it;
FILE * outfile;
outfile = fopen(filename,"w");
if (outfile == NULL)
return 0;
mavliter_init(&it,ktvstore);
mavliter_foreach(&it){
cw_Val_t * val;
char buf[4000];
val = mavliter_get(&it);
val->type->to_str(val,buf,4000);
write_str(outfile,val->key);
fprintf(outfile," :%s: ",val->type->name);
write_str(outfile,buf);
fprintf(outfile,"\n");
}
fclose(outfile);
return 1;
}

View File

@ -1,6 +0,0 @@
#include "val.h"
cw_Val_t * cw_ktv_set_byte(mavl_t ktv,const char * key, uint8_t byte)
{
return cw_ktv_replace(ktv,key,CW_TYPE_BYTE,NULL,&byte,1);
}

View File

@ -1,6 +0,0 @@
#include "val.h"
cw_Val_t * cw_ktv_set_dword(mavl_t ktv,const char * key, uint32_t dword)
{
return cw_ktv_replace(ktv,key,CW_TYPE_DWORD,NULL,(void*)&dword,4);
}

View File

@ -1,6 +0,0 @@
#include "val.h"
cw_Val_t * cw_ktv_set_word(mavl_t ktv,const char * key, uint16_t word)
{
return cw_ktv_replace(ktv,key,CW_TYPE_WORD,NULL,(void*)&word,2);
}

View File

@ -1,13 +0,0 @@
#include "val.h"
const cw_Type_t * cw_ktv_std_types[] = {
CW_TYPE_BYTE,
CW_TYPE_WORD,
CW_TYPE_DWORD,
CW_TYPE_BSTR16,
CW_TYPE_IPADDRESS,
CW_TYPE_STR,
CW_TYPE_SYSPTR,
CW_TYPE_BOOL,
NULL
};

View File

@ -1,77 +0,0 @@
#include "val.h"
#include "dbg.h"
#include "log.h"
#include "cfg.h"
int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_ValStruct_t * stru, const char *pkey,
uint8_t * dst)
{
char key[CW_CFG_MAX_KEY_LEN];
int pos, i;
cw_Val_t * result;
pos=0; i=0;
for(i=0; stru[i].type != NULL;i++){
if (stru[i].position!=-1){
pos=stru[i].position;
}
if (stru[i].len!=-1)
memset(dst+pos,0,stru[i].len);
if (stru[i].key!=NULL)
sprintf(key,"%s/%s",pkey,stru[i].key);
else
sprintf(key,"%s",pkey);
printf("Get Key: %s\n",key);
result = cw_ktv_get(ktv,key,NULL);
if(result)
{
char s[129];
result->type->to_str(result,s,128);
printf("Content: '%s'\n",s);
}
if (result == NULL && def != NULL){
result = cw_ktv_get(def,key,NULL);
}
if (result == NULL){
cw_log(LOG_ERR,"Can't put %s, no value found, filling zero.",key);
memset(dst+pos,0,stru[i].len);
}
else{
result->valguard=stru[i].valguard;
if (cw_ktv_cast(result,stru[i].type)==NULL){
cw_log(LOG_ERR,"Can't cast key '%s' from %s to %s",key,result->type->name,stru[i].type->name);
}
/* if (strcmp(stru[i].type->name,result->type->name)){
printf("Type mismatch: %s != %s\n",stru[i].type->name,result->type->name);
if (stru[i].type->cast != NULL){
if (!stru[i].type->cast(result)){
cw_log(LOG_ERR,"Can't cast '%s' from %s to %s",key,result->type->name,stru[i].type->name);
exit(0);
}
}
}
*/
result->type->put(result,dst+pos);
}
if (stru[i].len!=-1)
pos+=stru[i].len;
else
pos+=result->type->len(result);
}
return pos;
}

View File

@ -1,22 +1,52 @@
#include "cw.h" #include "cw.h"
#include "dbg.h" #include "dbg.h"
#include "cfg.h"
int cw_out_generic_with_index(struct cw_ElemHandler * eh, int cw_out_generic_with_index(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst) struct cw_ElemHandlerParams * params, uint8_t * dst)
{ {
stop();
char key[CW_CFG_MAX_KEY_LEN]; char key[CW_CFG_MAX_KEY_LEN];
int idx; int idx;
cw_Val_t * result, search; cw_Val_t * result, search;
int len,start; int len,start;
uint8_t * ob; uint8_t * ob;
struct cw_Cfg_entry *e;
struct cw_Cfg_iter cfi;
struct cw_Type * type = (struct cw_Type *)eh->type;
int i,l;
idx = 0; idx = 0;
ob = dst; ob = dst;
cw_cfg_iter_init(params->cfg_list[0], &cfi, eh->key);
for (i=0; (e = cw_cfg_iter_next(&cfi, NULL)) != NULL; i++){
start = params->msgset->header_len(eh);
len = cw_put_byte(ob+start,i);
cw_dbg(DBG_X,"KV: %s - %s",e->key,e->val);
// int bwrite(cw_Cfg_t ** cfgs, const char *key, uint8_t *dst, const void * param)
l = type->write(params->cfg_list,e->key,ob+start+len,eh->param);
if (l==-1)
continue;
len += l;
//len += result->type->put(result,ob+start+len);
ob += params->msgset->write_header(eh,ob,len);
}
return ob-dst;
stop();
return 0;
do { do {
sprintf(key,"%s.%d",eh->key,idx); sprintf(key,"%s.%d",eh->key,idx);
search.key=key; search.key=key;

View File

@ -10,7 +10,8 @@ static int get_psk(struct cw_Conn *conn, const char *username, uint8_t ** psk,
char key[CW_CFG_MAX_KEY_LEN]; char key[CW_CFG_MAX_KEY_LEN];
cw_Val_t *result; cw_Val_t *result;
sprintf(key, "%s/%s", "psk", username); sprintf(key, "%s/%s", "psk", username);
result = cw_ktv_get(conn->local_cfg, key, CW_TYPE_BSTR16); stop();
// result = cw_ktv_get(conn->local_cfg, key, CW_TYPE_BSTR16);
if (result == NULL) { if (result == NULL) {
if (conn->dtls_psk != NULL) { if (conn->dtls_psk != NULL) {
*psk = bstr16_data(conn->dtls_psk); *psk = bstr16_data(conn->dtls_psk);

View File

@ -96,7 +96,7 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
dst = msgptr+8; dst = msgptr+8;
len =0; len =0;
cw_dbg(DBG_X,"setting with update CFG"); //cw_dbg(DBG_X,"setting with update CFG");
params.conn=conn; params.conn=conn;
params.cfg_list[0]=conn->update_cfg; params.cfg_list[0]=conn->update_cfg;
params.cfg_list[1]=conn->local_cfg; params.cfg_list[1]=conn->local_cfg;

View File

@ -217,6 +217,33 @@ static int update_msgdata(struct cw_MsgSet *set, struct cw_MsgData *msgdata,
ed.vendor = elemdef->vendor; ed.vendor = elemdef->vendor;
ed.mand = elemdef->mand; ed.mand = elemdef->mand;
/* add/delete/replace message elemeent to/from/in the elements list */
switch ( elemdef->op & 0xff){
case CW_IGNORE:
break;
continue;
case CW_DELETE:
cw_dbg(DBG_MOD, " deleting message element %d %d %d - %s",
elemdef->proto,
elemdef->vendor, elemdef->id, handler->name);
mlist_delete(msgdata->elements_list, &ed);
mavl_del(msgdata->elements_tree,&ed);
continue;
break;
case CW_APPEND:
mlist_append(msgdata->elements_list, &ed);
break;
default:
case CW_REPLACE:
if (mlist_replace(msgdata->elements_list, &ed)==NULL){
mlist_append(msgdata->elements_list, &ed);
}
break;
}
/* add message element to the elements tree */ /* add message element to the elements tree */
result = mavl_replace(msgdata->elements_tree, &ed, &replaced); result = mavl_replace(msgdata->elements_tree, &ed, &replaced);
@ -230,23 +257,6 @@ static int update_msgdata(struct cw_MsgSet *set, struct cw_MsgData *msgdata,
elemdef->vendor, elemdef->id, handler->name); elemdef->vendor, elemdef->id, handler->name);
} }
/* add/delete/replace message elemeent to/from/in the elements list */
switch ( elemdef->op & 0xff){
case CW_IGNORE:
break;
case CW_DELETE:
mlist_delete(msgdata->elements_list, &ed);
break;
case CW_APPEND:
mlist_append(msgdata->elements_list, &ed);
break;
default:
case CW_REPLACE:
if (mlist_replace(msgdata->elements_list, &ed)==NULL){
mlist_append(msgdata->elements_list, &ed);
}
break;
}
} }

View File

@ -58,9 +58,9 @@ static cw_ValStruct_t radio_operational_state[] = {
static cw_ValValRange_t radio_admin_state_valguard[]={ static cw_ValValRange_t radio_admin_state_valguard[]={
{0,0,"reserved"}, {0,0,"0 - reserved"},
{1,1,"enabled"}, {1,1,"1 - enabled"},
{2,2,"disabled"}, {2,2,"2 - disabled"},
{0,0,NULL} {0,0,NULL}
}; };

View File

@ -49,7 +49,8 @@ int static setup_cfg(struct cw_Conn * conn)
int security; int security;
security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER); security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security); stop();
// cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
return 0; return 0;
} }

View File

@ -46,7 +46,7 @@
#define CISCO_ELEM_TX_POWER LW_ELEM_80211_TX_POWER /* 12 */ #define CISCO_ELEM_TX_POWER LW_ELEM_80211_TX_POWER /* 12 */
#define CISCO_ELEM_TX_POWER_LEVELS LW_ELEM_80211_TX_POWER_LEVELS /* 13 */ #define CISCO_ELEM_TX_POWER_LEVELS LW_ELEM_80211_TX_POWER_LEVELS /* 13 */
#define CW_CISCO_DIRECT_SEQUENCE_CONTROL LW_ELEM_DIRECT_SEQUENCE_CONTROL /* 14 */ #define CISCO_ELEM_DIRECT_SEQUENCE_CONTROL LW_ELEM_DIRECT_SEQUENCE_CONTROL /* 14 */
#define CW_CISCO_SUPPORTED_RATES LW_ELEM_80211_RATE_SET /* 16 */ #define CW_CISCO_SUPPORTED_RATES LW_ELEM_80211_RATE_SET /* 16 */
#define CISCO_ELEM_15 15 /* 15 */ #define CISCO_ELEM_15 15 /* 15 */
@ -57,6 +57,9 @@
#define CW_CISCO_80211_DELETE_WLAN LW_ELEM_80211_DELETE_WLAN /* 28 */ #define CW_CISCO_80211_DELETE_WLAN LW_ELEM_80211_DELETE_WLAN /* 28 */
#define CW_CISCO_MWAR_NAME LW_ELEM_AC_NAME /* 31 */ #define CW_CISCO_MWAR_NAME LW_ELEM_AC_NAME /* 31 */
#define CISCO_ELEM_33 33
#define CISCO_ELEM_39 39
#define CISCO_ELEM_LOCATION_DATA LW_ELEM_LOCATION_DATA /* 35 */ #define CISCO_ELEM_LOCATION_DATA LW_ELEM_LOCATION_DATA /* 35 */
#define CISCO_ELEM_STATISTICS_TIMER LW_ELEM_STATISTICS_TIMER /* 37 */ #define CISCO_ELEM_STATISTICS_TIMER LW_ELEM_STATISTICS_TIMER /* 37 */
@ -66,6 +69,8 @@
#define CW_CISCO_CERTIFICATE LW_ELEM_CERTIFICATE /* 44 */ #define CW_CISCO_CERTIFICATE LW_ELEM_CERTIFICATE /* 44 */
#define CISCO_ELEM_47 47 /* 47 */ #define CISCO_ELEM_47 47 /* 47 */
#define CISCO_ELEM_48 48 /* 47 */
#define CISCO_ELEM_WTP_BOARD_DATA LW_ELEM_WTP_BOARD_DATA /* 50 */ #define CISCO_ELEM_WTP_BOARD_DATA LW_ELEM_WTP_BOARD_DATA /* 50 */
#define CW_CISCO_BCAST_SSID_MODE LW_BCAST_SSID_MODE #define CW_CISCO_BCAST_SSID_MODE LW_BCAST_SSID_MODE
@ -103,10 +108,22 @@
#define CISCO_ELEM_AP_PRE_STD_SWITCH_CONFIG 137 #define CISCO_ELEM_AP_PRE_STD_SWITCH_CONFIG 137
#define CISCO_ELEM_AP_POWER_INJECTOR_CONFIG 138 #define CISCO_ELEM_AP_POWER_INJECTOR_CONFIG 138
#define CISCO_ELEM_145 145
#define CISCO_ELEM_146 146
#define CISCO_ELEM_AP_MIN_IOS_VERSION 149 #define CISCO_ELEM_AP_MIN_IOS_VERSION 149
#define CISCO_ELEM_AP_TIMESYNC 151 #define CISCO_ELEM_AP_TIMESYNC 151
#define CW_CISCO_AP_DOMAIN 169
#define CW_CISCO_AP_DNS 170 #define CISCO_ELEM_153 153
#define CISCO_ELEM_154 154
#define CISCO_ELEM_156 156
#define CISCO_ELEM_AP_DOMAIN 169
#define CISCO_ELEM_AP_DNS 170
#define CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION 183 #define CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION 183
#define CW_CISCO_BOARD_DATA_OPTIONS 207 #define CW_CISCO_BOARD_DATA_OPTIONS 207

View File

@ -166,12 +166,27 @@ static cw_ValStruct_t cisco_ap_static_ip_addr[]={
{CW_TYPE_IPADDRESS,"address", 4,-1}, {CW_TYPE_IPADDRESS,"address", 4,-1},
{CW_TYPE_IPADDRESS,"netmask", 4,-1}, {CW_TYPE_IPADDRESS,"netmask", 4,-1},
{CW_TYPE_IPADDRESS,"gateway", 4,-1}, {CW_TYPE_IPADDRESS,"gateway", 4,-1},
{CW_TYPE_IPADDRESS,"unknown", 4,-1},
{CW_TYPE_BOOL,"enabled", 1,-1}, {CW_TYPE_BOOL,"enabled", 1,-1},
{CW_TYPE_IPADDRESS,"unknown", 4,-1},
{NULL,NULL,0,0} {NULL,NULL,0,0}
}; };
static cw_ValStruct_t cisco_ap_static_dns[]={
{CW_TYPE_BOOL,"enable", 1,-1},
{CW_TYPE_IPADDRESS,"ip", 4,-1},
{NULL,NULL,0,0}
};
static cw_ValStruct_t cisco_ap_static_domain[]={
{CW_TYPE_BOOL,"enable", 1,-1},
{CW_TYPE_BSTR16,"name", -1,-1},
{NULL,NULL,0,0}
};
static cw_ValStruct_t cisco_ap_regulatory_domain4[]={ static cw_ValStruct_t cisco_ap_regulatory_domain4[]={
{CW_TYPE_BOOL,"set",1,-1}, {CW_TYPE_BOOL,"set",1,-1},
{CW_TYPE_BYTE,"slot",1,-1}, {CW_TYPE_BYTE,"slot",1,-1},
@ -268,7 +283,7 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
if(result->type->len(result)==4){ if(result->type->len(result)==4){
uint32_t rv; uint32_t rv;
rv = cw_get_dword(result->type->data(result)); rv = cw_get_dword(result->type->data(result));
cw_dbg(DBG_X,"Version is %08X",rv); //cw_dbg(DBG_X,"Version is %08X",rv);
if (rv >= 0x07056600){ if (rv >= 0x07056600){
type = cisco_ap_regulatory_domain5; type = cisco_ap_regulatory_domain5;
} }
@ -926,7 +941,7 @@ static struct cw_ElemHandler handlers70[] = {
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/ap-uptime", /* Key */ "cisco/ap-uptime", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
cw_out_generic_struct, /* put */ cw_out_generic, /* put */
NULL, NULL,
NULL, NULL,
cisco_ap_uptime, cisco_ap_uptime,
@ -970,7 +985,7 @@ static struct cw_ElemHandler handlers70[] = {
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/ap-led-state-config", /* Key */ "cisco/ap-led-state-config", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
cw_out_generic_struct, /* put */ cw_out_generic, /* put */
NULL, NULL,
NULL, NULL,
cisco_ap_led_state_config70 cisco_ap_led_state_config70
@ -1023,7 +1038,7 @@ static struct cw_ElemHandler handlers70[] = {
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/wtp-board-data", /* Key */ "cisco/wtp-board-data", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
cw_out_generic_struct, /* put */ cw_out_generic, /* put */
NULL, NULL,
NULL, NULL,
cisco_wtp_board_data, cisco_wtp_board_data,
@ -1108,6 +1123,36 @@ static struct cw_ElemHandler handlers70[] = {
cisco_ap_static_ip_addr, cisco_ap_static_ip_addr,
}, },
{
"AP Static DNS", /* name */
CISCO_ELEM_AP_DNS, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,5, /* min/max length */
CW_TYPE_STRUCT, /* type */
"cisco/ap-static-dns", /* Key */
cw_in_generic, /* get */
cw_out_generic, /* put */
NULL,
NULL,
cisco_ap_static_dns,
},
{
"AP Static Domain", /* name */
CISCO_ELEM_AP_DOMAIN, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,128, /* min/max length */
CW_TYPE_STRUCT, /* type */
"cisco/ap-static-domain", /* Key */
cw_in_generic, /* get */
cw_out_generic, /* put */
NULL,
NULL,
cisco_ap_static_domain,
},
{ {
"AP Min IOS Version", /* name */ "AP Min IOS Version", /* name */
@ -1200,7 +1245,7 @@ static struct cw_ElemHandler handlers70[] = {
{ /* WTP Direct Sequence Control for AC/WPT with version 7.0 */ { /* WTP Direct Sequence Control for AC/WPT with version 7.0 */
"Direct Sequence Control (v7.0)", /* name */ "Direct Sequence Control (v7.0)", /* name */
CW_CISCO_DIRECT_SEQUENCE_CONTROL, /* Element ID */ CISCO_ELEM_DIRECT_SEQUENCE_CONTROL, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
9,9, /* min/max length */ 9,9, /* min/max length */
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
@ -1305,7 +1350,7 @@ static struct cw_ElemHandler handlers70[] = {
"Spam Domain Secret", /* name */ "Spam Domain Secret", /* name */
CISCO_ELEM_SPAM_DOMAIN_SECRET, /* Element ID */ CISCO_ELEM_SPAM_DOMAIN_SECRET, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/spam-domain-secret", /* Key */ "cisco/spam-domain-secret", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
@ -1317,42 +1362,152 @@ static struct cw_ElemHandler handlers70[] = {
"Cisco Elem 132", /* name */ "Cisco Elem 132", /* name */
CISCO_ELEM_132, /* Element ID */ CISCO_ELEM_132, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem132", /* Key */ "cisco/elem132", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
cw_out_generic /* put */ cw_out_generic /* put */
}, },
{
"Cisco Elem 33", /* name */
CISCO_ELEM_33, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem33", /* Key */
cw_in_generic, /* get */
cw_out_generic /* put */
},
{ {
"Cisco Elem 15", /* name */ "Cisco Elem 15", /* name */
CISCO_ELEM_15, /* Element ID */ CISCO_ELEM_15, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem15", /* Key */ "cisco/elem15", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */ cw_out_radio_generic /* put */
}, },
{
"Cisco Elem 39", /* name */
CISCO_ELEM_39, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem39", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{
"Cisco Elem 145", /* name */
CISCO_ELEM_145, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem145", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{
"Cisco Elem 146", /* name */
CISCO_ELEM_146, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem146", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{
"Cisco Elem 153", /* name */
CISCO_ELEM_153, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem153", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{
"Cisco Elem 156", /* name */
CISCO_ELEM_156, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem156", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{
"Cisco Elem 48", /* name */
CISCO_ELEM_48, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/elem48", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{ {
"Cisco LWAP Elem 9", /* name */ "Cisco LWAP Elem 9", /* name */
CISCO_LWELEM_9, /* Element ID */ CISCO_LWELEM_9, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/lwelem9", /* Key */ "cisco/lwelem9", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */ cw_out_radio_generic /* put */
}, },
{
"Cisco LWAP Elem 33", /* name */
CISCO_LWELEM_33, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/lwelem33", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{
"Cisco LWAP Elem 48", /* name */
CISCO_LWELEM_48, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/lwelem48", /* Key */
cw_in_radio_generic, /* get */
cw_out_radio_generic /* put */
},
{ {
"Cisco Elem 24", /* name */ "Cisco Elem 24", /* name */
CISCO_ELEM_24, /* Element ID */ CISCO_ELEM_24, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem24", /* Key */ "cisco/elem24", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
@ -1366,7 +1521,7 @@ static struct cw_ElemHandler handlers70[] = {
"Cisco Elem 19", /* name */ "Cisco Elem 19", /* name */
CISCO_ELEM_19, /* Element ID */ CISCO_ELEM_19, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem19", /* Key */ "cisco/elem19", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
@ -1379,7 +1534,7 @@ static struct cw_ElemHandler handlers70[] = {
"Cisco Elem 22", /* name */ "Cisco Elem 22", /* name */
CISCO_ELEM_22, /* Element ID */ CISCO_ELEM_22, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem22", /* Key */ "cisco/elem22", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
@ -1390,7 +1545,7 @@ static struct cw_ElemHandler handlers70[] = {
"Cisco Elem 47", /* name */ "Cisco Elem 47", /* name */
CISCO_ELEM_47, /* Element ID */ CISCO_ELEM_47, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem47", /* Key */ "cisco/elem47", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
@ -1404,7 +1559,7 @@ static struct cw_ElemHandler handlers70[] = {
"Cisco Elem 81", /* name */ "Cisco Elem 81", /* name */
CISCO_ELEM_81, /* Element ID */ CISCO_ELEM_81, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 1,1024, /* min/max length */
CW_TYPE_BSTR16, /* type */ CW_TYPE_BSTR16, /* type */
"cisco/elem81", /* Key */ "cisco/elem81", /* Key */
cw_in_radio_generic, /* get */ cw_in_radio_generic, /* get */
@ -1455,10 +1610,14 @@ static struct cw_ElemHandler handlers70[] = {
CISCO_ELEM_AP_CORE_DUMP, /* Element ID */ CISCO_ELEM_AP_CORE_DUMP, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
0,1024, /* min/max length */ 0,1024, /* min/max length */
cisco_ap_core_dump, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/ap-core-dump", /* Key */ "cisco/ap-core-dump", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_ap_core_dump /* param */
}, },
{ {
@ -1513,10 +1672,13 @@ static struct cw_ElemHandler handlers70[] = {
CISCO_LWELEM_VLAN, /* Element ID */ CISCO_LWELEM_VLAN, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
3,3, /* min/max length */ 3,3, /* min/max length */
cisco_vlan, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/vlan", /* Key */ "cisco/vlan", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_vlan
} }
, ,
@ -1529,7 +1691,7 @@ static struct cw_ElemHandler handlers70[] = {
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/rouge-and-mss", /* Key */ "cisco/rouge-and-mss", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
cw_out_generic_struct, /* put */ cw_out_generic, /* put */
NULL, NULL,
NULL, NULL,
cisco_rouge_and_mss, cisco_rouge_and_mss,
@ -1545,7 +1707,7 @@ static struct cw_ElemHandler handlers70[] = {
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/rouge-detection", /* Key */ "cisco/rouge-detection", /* Key */
cw_in_generic, /* get */ cw_in_generic, /* get */
cw_out_generic_struct, /* put */ cw_out_generic, /* put */
NULL, NULL,
NULL, NULL,
cisco_rouge_detection70, cisco_rouge_detection70,
@ -1598,10 +1760,13 @@ static struct cw_ElemHandler handlers70[] = {
CISCO_LWELEM_SSC_HASH, /* Element ID */ CISCO_LWELEM_SSC_HASH, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
1,331, /* min/max length */ 1,331, /* min/max length */
cisco_ssc_hash, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/hash", /* Key */ "cisco/hash", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_ssc_hash,
} }
, ,
{ {
@ -1672,14 +1837,14 @@ static struct cw_ElemHandler handlers70[] = {
13,13, /* min/max length */ 13,13, /* min/max length */
cisco_rad_extended_config, /* type */ cisco_rad_extended_config, /* type */
"cisco/rad-extended-config", /* Key */ "cisco/rad-extended-config", /* Key */
cw_in_radio_generic_struct, /* get */ cw_in_radio_generic_struct, /* get */
cw_out_radio_generic_struct /* put */ cw_out_radio_generic_struct /* put */
}, },
{ {
"CAPWAP Timers (Cisco)", /* name */ "CAPWAP Timers (Cisco)", /* name */
CISCO_ELEM_CAPWAP_TIMERS, /* Element ID */ CISCO_ELEM_CAPWAP_TIMERS, /* Element ID */
0, 0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO, 0, /* Vendor / Proto */
2, 2, /* min/max length */ 2, 2, /* min/max length */
CW_TYPE_STRUCT, /* type */ CW_TYPE_STRUCT, /* type */
"capwap-timers", /* Key */ "capwap-timers", /* Key */
@ -1723,10 +1888,13 @@ static struct cw_ElemHandler handlers70[] = {
CISCO_LWELEM_DOT11R_WLC_MAC_AND_IP, /* Element ID */ CISCO_LWELEM_DOT11R_WLC_MAC_AND_IP, /* Element ID */
0, 0, /* Vendor / Proto */ 0, 0, /* Vendor / Proto */
4, 4, /* min/max length */ 4, 4, /* min/max length */
cisco_dot11r_wlc_mac_and_ip, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/dot11r-wlc-mac-and-ip", /* Key */ "cisco/dot11r-wlc-mac-and-ip", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_dot11r_wlc_mac_and_ip
} }
, ,
@ -1833,6 +2001,27 @@ static cw_State_t configuration_status_request_states[] = {
static struct cw_ElemDef configuration_status_request_elements[] ={ static struct cw_ElemDef configuration_status_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_19, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_22, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_24, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_33, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_39, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_47, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_48, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_81, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_132, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_145, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_146, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_153, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_156, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_33, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_48, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CAPWAP_TIMERS, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_DIRECT_SEQUENCE_CONTROL, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_UPTIME, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_UPTIME, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_STATE_CONFIG, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_STATE_CONFIG, 0, 0},
@ -1844,6 +2033,9 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_POWER_INJECTOR_CONFIG, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_POWER_INJECTOR_CONFIG, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MODE_AND_TYPE, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MODE_AND_TYPE, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_DOMAIN, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_DNS, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 1, 0},
@ -1851,7 +2043,6 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_RESET_BUTTON_STATE, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_RESET_BUTTON_STATE, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 1, 0},
{0, CW_VENDOR_ID_CISCO, CW_CISCO_DIRECT_SEQUENCE_CONTROL, 1, 0},
{0, CW_VENDOR_ID_CISCO, CW_CISCO_ANTENNA_PAYLOAD, 1, 0}, {0, CW_VENDOR_ID_CISCO, CW_CISCO_ANTENNA_PAYLOAD, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AC_NAME_WITH_INDEX, 0, CW_IGNORE}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AC_NAME_WITH_INDEX, 0, CW_IGNORE},
@ -1863,16 +2054,7 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_TX_POWER_LEVELS, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_TX_POWER_LEVELS, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CHANNEL_POWER, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CHANNEL_POWER, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_132, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_19, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_22, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_47, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_81, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_24, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 1, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 1, 0},
@ -1892,6 +2074,31 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
/*static uint16_t configuration_status_response_states[] = {CAPWAP_STATE_JOIN,0};*/ /*static uint16_t configuration_status_response_states[] = {CAPWAP_STATE_JOIN,0};*/
static struct cw_ElemDef configuration_status_response_elements[] ={ static struct cw_ElemDef configuration_status_response_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_19, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_22, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_24, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_33, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_39, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_47, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_48, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_81, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_132, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_145, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_146, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_153, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_156, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_33, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_48, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CAPWAP_TIMERS, 0, 0},
{0,0, CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1,0}, {0,0, CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1,0},
{0,0, CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 1,0}, {0,0, CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 1,0},
@ -1899,7 +2106,7 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_MULTI_DOMAIN_CAPABILITY, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_MULTI_DOMAIN_CAPABILITY, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 1, 0},
{0, CW_VENDOR_ID_CISCO, CW_CISCO_DIRECT_SEQUENCE_CONTROL, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_DIRECT_SEQUENCE_CONTROL, 0, 0},
{0, CW_VENDOR_ID_CISCO, CW_CISCO_ANTENNA_PAYLOAD, 1, 0}, {0, CW_VENDOR_ID_CISCO, CW_CISCO_ANTENNA_PAYLOAD, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_STATE_CONFIG, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_STATE_CONFIG, 0, 0},
@ -1910,9 +2117,7 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AIRSPACE_CAPABILITY, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AIRSPACE_CAPABILITY, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_132, 1, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_DOMAIN_SECRET, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_DOMAIN_SECRET, 1, 0},
@ -1925,7 +2130,30 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
/*static uint16_t configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};*/ /*static uint16_t configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};*/
static struct cw_ElemDef configuration_update_request_elements[] ={ static struct cw_ElemDef configuration_update_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_19, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_22, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_24, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_33, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_39, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_47, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_48, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_81, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_132, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_145, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_146, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_153, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_156, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_33, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_48, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CAPWAP_TIMERS, 0, 0},
{0,0, CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 0,0}, {0,0, CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 0,0},
@ -1939,6 +2167,11 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_POWER_INJECTOR_CONFIG, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_POWER_INJECTOR_CONFIG, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MODE_AND_TYPE, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MODE_AND_TYPE, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_DOMAIN, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_DNS, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_DIRECT_SEQUENCE_CONTROL, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 0, 0},
@ -1960,14 +2193,6 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
/* {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CHANNEL_POWER, 1, 0}, */ /* {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_CHANNEL_POWER, 1, 0}, */
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_24, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_19, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_22, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_47, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_81, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 0, 0},
@ -2007,7 +2232,8 @@ static struct cw_ElemDef wtp_event_request_elements[] ={
/*static uint16_t wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};*/ /*static uint16_t wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};*/
static struct cw_ElemDef wtp_event_response_elements[] ={ static struct cw_ElemDef wtp_event_response_elements[] ={
/* {0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},*/ /* Cisco APs don't like a result code in event responses */
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, CW_DELETE},
{0,0,0,0,0} {0,0,0,0,0}
}; };
@ -2181,10 +2407,13 @@ static struct cw_ElemHandler handlers73[] = {
CISCO_LWELEM_ROUGE_DETECTION, /* Element ID */ CISCO_LWELEM_ROUGE_DETECTION, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
7,7, /* min/max length */ 7,7, /* min/max length */
cisco_rouge_detections, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/rouge-detection", /* Key */ "cisco/rouge-detection", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_rouge_detections,
} }
, ,
@ -2194,10 +2423,13 @@ static struct cw_ElemHandler handlers73[] = {
CISCO_ELEM_AP_LED_STATE_CONFIG, /* Element ID */ CISCO_ELEM_AP_LED_STATE_CONFIG, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,1, /* min/max length */ 1,1, /* min/max length */
cisco_ap_led_state_config73, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/ap-led-state-config", /* Key */ "cisco/ap-led-state-config", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_ap_led_state_config73,
}, },
{ /* WTP Radio Configuration for AC/WPT with version 7.3 */ { /* WTP Radio Configuration for AC/WPT with version 7.3 */
@ -2218,10 +2450,13 @@ static struct cw_ElemHandler handlers73[] = {
CISCO_ELEM_AP_VENUE_SETTINGS, /* Element ID */ CISCO_ELEM_AP_VENUE_SETTINGS, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
5,1024, /* min/max length */ 5,1024, /* min/max length */
cisco_ap_venue_settings, /* type */ CW_TYPE_STRUCT, /* type */
"cisco/ap-venue-settings", /* Key */ "cisco/ap-venue-settings", /* Key */
cw_in_generic_struct, /* get */ cw_in_generic, /* get */
cw_out_generic_struct /* put */ cw_out_generic, /* put */
NULL,
NULL,
cisco_ap_venue_settings,
} }
, ,

View File

@ -32,13 +32,15 @@
#define CISCO_LWELEM_AP_USERNAME_PASSWORD 18 #define CISCO_LWELEM_AP_USERNAME_PASSWORD 18
#define LW_CISCO_MANAGER_IP_ADDR 19 #define LW_CISCO_MANAGER_IP_ADDR 19
#define CISCO_LWELEM_DISCOVERY_PROTOCOL 20 #define CISCO_LWELEM_DISCOVERY_PROTOCOL 20
#define LW_CISCO_RADIO_MODULE_INFO 21 #define CISCO_LWELEM_RADIO_MODULE_INFO 21
#define CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX 32 #define CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX 32
#define CISCO_LWELEM_33 33
#define CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE 34 #define CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE 34
#define CISCO_LWELEM_AP_LOGHOST_CONFIG 36 #define CISCO_LWELEM_AP_LOGHOST_CONFIG 36
#define CISCO_LWELEM_MCAST_MGID_INFO 39 #define CISCO_LWELEM_MCAST_MGID_INFO 39
#define CISCO_LWELEM_AP_TELNET_SSH 44 #define CISCO_LWELEM_AP_TELNET_SSH 44
#define CISCO_LWELEM_48 48
#define CISCO_LWELEM_AP_SUBMODE 67 #define CISCO_LWELEM_AP_SUBMODE 67
#define LW_CISCO_AP_HEARTBEAT_TIMEOUT 68 #define LW_CISCO_AP_HEARTBEAT_TIMEOUT 68

View File

@ -1,13 +1,24 @@
#
# This file is igenerated by WAT
# If you edit this, your cahnges might be overwritten
#
capwap-local-ip-address: 192.168.0.14
capwap-timers/echo-interval: 30
capwap-timers/max-discovery-interval: 10
capwap/ac-name: capwap/ac-name:
cisco-8011-assoc-limit/enable: false
cisco-8011-assoc-limit/interval: 500
cisco-8011-assoc-limit/limit: 25
cisco/ap-backup-software-version: .x00000000 cisco/ap-backup-software-version: .x00000000
cisco/ap-ethernet-port-type: .x000000 cisco/ap-ethernet-port-type: .x000000
cisco/ap-led-state-config/led-state: 2 cisco/ap-group-name: default-group
cisco/ap-led-state-config/led-state: 1
cisco/ap-log-facility: 0 cisco/ap-log-facility: 0
cisco/ap-min-ios-version: .x08036f00 cisco/ap-min-ios-version: .x08036f00
cisco/ap-mode-and-type/mode: 0 cisco/ap-mode-and-type/mode: 0
cisco/ap-mode-and-type/type: 15 cisco/ap-mode-and-type/type: 15
cisco/ap-model/image: 12.4(23c)JA2 cisco/ap-model/image: 12.4(23c)JA2
cisco/ap-model/model: AIR-LAP1142N-E-K9 cisco/ap-model/model: "AIR-LAP1142N-E-K9 "
cisco/ap-power-injector-config/selection: 0 cisco/ap-power-injector-config/selection: 0
cisco/ap-power-injector-config/state: 17 cisco/ap-power-injector-config/state: 17
cisco/ap-power-injector-config/switch-mac-address: .x000000000000 cisco/ap-power-injector-config/switch-mac-address: .x000000000000
@ -20,40 +31,55 @@ cisco/ap-regulatory-domain.1/code0: 0
cisco/ap-regulatory-domain.1/code1: 1 cisco/ap-regulatory-domain.1/code1: 1
cisco/ap-regulatory-domain.1/set: true cisco/ap-regulatory-domain.1/set: true
cisco/ap-regulatory-domain.1/slot: 1 cisco/ap-regulatory-domain.1/slot: 1
cisco/ap-static-ip-addr/address: 192.168.0.13 cisco/ap-static-ip-addr/address: 192.168.0.14
cisco/ap-static-ip-addr/enabled: false cisco/ap-static-ip-addr/enabled: false
cisco/ap-static-ip-addr/gateway: 192.168.0.1 cisco/ap-static-ip-addr/gateway: 192.168.0.1
cisco/ap-static-ip-addr/netmask: 255.255.255.0 cisco/ap-static-ip-addr/netmask: 255.255.255.0
cisco/ap-static-ip-addr/unknown: 0.0.0.0 cisco/ap-static-ip-addr/unknown: 0.0.0.0
cisco/ap-sub-mode: 0 cisco/ap-sub-mode: 0
cisco/ap-telnet-ssh/ssh: true cisco/ap-telnet-ssh/ssh: false
cisco/ap-telnet-ssh/telnet: true cisco/ap-telnet-ssh/telnet: false
cisco/ap-uptime/current-uptime: 411251 cisco/ap-uptime/current-uptime: 120
cisco/ap-uptime/last-uptime: 411128 cisco/ap-uptime/last-uptime: 1
cisco/ap-username-and-password/login-credentials/enable-password: $1$SL3y$sc6giltX5bNe5mzHT8Gwy1 cisco/ap-username-and-password/login-credentials/enable-password: $1$IMuO$BHTjaFsUF.X3g3Q9YDmcS0
cisco/ap-username-and-password/login-credentials/option: 1 cisco/ap-username-and-password/login-credentials/option: 1
cisco/ap-username-and-password/login-credentials/password: $1$1Md9$y3hPcRV4nSg7iNJy4mwVt. cisco/ap-username-and-password/login-credentials/password: $1$SL3y$sc6giltX5bNe5mzHT8Gwy1
cisco/ap-username-and-password/login-credentials/username: Cisco cisco/ap-username-and-password/login-credentials/username: Cisco
cisco/cisco-discovery-protocol/data: 513 cisco/cisco-discovery-protocol/data: 513
cisco/cisco-discovery-protocol/enabled: false cisco/cisco-discovery-protocol/enabled: false
cisco/loghost-config/last-joined-ap: actube cisco/elem132: .x0100000000
cisco/loghost-config/last-joined-ap: None
cisco/loghost-config/loghost: 255.255.255.255 cisco/loghost-config/loghost: 255.255.255.255
cisco/mcast-mgid-info: .x0000000d0000000000000000000000000000000101000000
cisco/mwar-addr/address: 192.168.0.162
cisco/mwar-addr/mwar-type: 0
cisco/mwar-addr/unknown: 0
cisco/reset-button-state: true cisco/reset-button-state: true
cisco/rouge-and-mss/enable: false cisco/rouge-and-mss/enable: false
cisco/rouge-and-mss/tcp-adjust-mss: 0 cisco/rouge-and-mss/tcp-adjust-mss: 0
cisco/rouge-detection/rest: .x0000000a cisco/rouge-detection/rest: .x0000000a
cisco/rouge-detection/rouge-detection: true cisco/rouge-detection/rouge-detection: true
cisco/sig-toogle: true
cisco/spam-domain-secret: .xe1ffd18a8f15b3b59c0a47a7f17a96e7cb36174f00
cisco/ssl-certfile: ../../ssl/certs/wtpc.crt
cisco/ssl-cipher: SHA1
cisco/ssl-keyfile: ../../ssl/certs/wtpc.key
cisco/wtp-board-data/card-id: 0 cisco/wtp-board-data/card-id: 0
cisco/wtp-board-data/card-revision: 0 cisco/wtp-board-data/card-revision: 0
cisco/wtp-board-data/ethernet-mac-address: .xc47d4f3af8a6 cisco/wtp-board-data/ethernet-mac-address: .xc47d4f3af8a6
cisco/wtp-board-data/options/ant-type: 1 cisco/wtp-board-data/options/ant-type: 1
cisco/wtp-board-data/options/ap-type: 1 cisco/wtp-board-data/options/ap-type: 0
cisco/wtp-board-data/options/failover-priority: 0 cisco/wtp-board-data/options/failover-priority: 1
cisco/wtp-board-data/options/flex-connect: 1 cisco/wtp-board-data/options/flex-connect: 0
cisco/wtp-board-data/wtp-model-hi: 0 cisco/wtp-board-data/wtp-model-hi: 0
cisco/wtp-board-data/wtp-model-lo: 0 cisco/wtp-board-data/wtp-model-lo: 0
cisco/wtp-board-data/wtp-serial-number: FCZ1406W232 cisco/wtp-board-data/wtp-serial-number: FCZ1406W232
radio.0/admin-state: enabled cisco/wtp-use-ac-version: true
idle-timeout: 300
location-data: default location
maximum-message-length: 14000
radio.0/admin-state: 1 - enabled
radio.0/cisco/air-space-capability: 0
radio.0/cisco/antenna-payload/802-11n-rx-antennas: 7 radio.0/cisco/antenna-payload/802-11n-rx-antennas: 7
radio.0/cisco/antenna-payload/802-11n-tx-antennas: 0 radio.0/cisco/antenna-payload/802-11n-tx-antennas: 0
radio.0/cisco/antenna-payload/antenna-1: 1 radio.0/cisco/antenna-payload/antenna-1: 1
@ -63,31 +89,53 @@ radio.0/cisco/antenna-payload/diversity-selection: 255
radio.0/cisco/antenna-payload/number-of-antennas: 2 radio.0/cisco/antenna-payload/number-of-antennas: 2
radio.0/cisco/antenna-payload/unknown: 3 radio.0/cisco/antenna-payload/unknown: 3
radio.0/cisco/channel-power: .x08080d0108221c16100a04fefe0208221c16100a04fefe0308221c16100a04fefe0408221c16100a04fefe0508221c16100a04fefe0608221c16100a04fefe0708221c16100a04fefe0808221c16100a04fefe0908221c16100a04fefe0a08221c16100a04fefe0b08221c16100a04fefe0c08221c16100a04fefe0d08221c16100a04fefe radio.0/cisco/channel-power: .x08080d0108221c16100a04fefe0208221c16100a04fefe0308221c16100a04fefe0408221c16100a04fefe0508221c16100a04fefe0608221c16100a04fefe0708221c16100a04fefe0808221c16100a04fefe0908221c16100a04fefe0a08221c16100a04fefe0b08221c16100a04fefe0c08221c16100a04fefe0d08221c16100a04fefe
radio.0/cisco/direct-sequence-control/cfg-type: 1
radio.0/cisco/direct-sequence-control/current-cca-mode: 0
radio.0/cisco/direct-sequence-control/current-channel: 1
radio.0/cisco/direct-sequence-control/energy-detect-threshold: -50
radio.0/cisco/direct-sequence-control/unknown: 1
radio.0/cisco/elem145: .x01
radio.0/cisco/elem146: .x690f
radio.0/cisco/elem153: .x00
radio.0/cisco/elem156: .x020100
radio.0/cisco/elem19: .xc0a800a10001000cc0a800a103000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
radio.0/cisco/elem22: .x0d00b400320102030405060708090a0b0c0d
radio.0/cisco/elem24: .x003c000c
radio.0/cisco/elem47: .x0100000000000000000000000000000000 radio.0/cisco/elem47: .x0100000000000000000000000000000000
radio.0/cisco/elem48: .x00
radio.0/cisco/elem81: .x00000000010101010a001e0a02051cbfffbfff0a00
radio.0/cisco/lwelem48: .x01055a0101a6c405b06432b03232
radio.0/cisco/lwelem9: .x0100000000000000000000000000000000
radio.0/cisco/mac-operation/fragmentation-threshold: 2346 radio.0/cisco/mac-operation/fragmentation-threshold: 2346
radio.0/cisco/mac-operation/long-retry: 4 radio.0/cisco/mac-operation/long-retry: 4
radio.0/cisco/mac-operation/reserved: 1 radio.0/cisco/mac-operation/reserved: 1
radio.0/cisco/mac-operation/rts-threshold: 2347 radio.0/cisco/mac-operation/rts-threshold: 2347
radio.0/cisco/mac-operation/rx-msdu-lifetime: 1000 radio.0/cisco/mac-operation/rx-msdu-lifetime: 512
radio.0/cisco/mac-operation/short-retry: 7 radio.0/cisco/mac-operation/short-retry: 7
radio.0/cisco/mac-operation/tx-msdu-lifetime: 5000 radio.0/cisco/mac-operation/tx-msdu-lifetime: 512
radio.0/cisco/multi-domain-capability/first-channel: 1 radio.0/cisco/multi-domain-capability/first-channel: 1
radio.0/cisco/multi-domain-capability/max-tx-power-level: 65535 radio.0/cisco/multi-domain-capability/max-tx-power-level: 20
radio.0/cisco/multi-domain-capability/number-of-channels: 13 radio.0/cisco/multi-domain-capability/number-of-channels: 13
radio.0/cisco/multi-domain-capability/reserved: 1 radio.0/cisco/multi-domain-capability/reserved: 1
radio.0/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000 radio.0/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000
radio.0/cisco/tx-power/current-tx-power: 6 radio.0/cisco/tx-power/current-tx-power: 1
radio.0/cisco/tx-power/reserved: 0 radio.0/cisco/tx-power/reserved: 1
radio.0/cisco/wtp-radio-config/beacon-period: 100 radio.0/cisco/wtp-radio-config/beacon-period: 100
radio.0/cisco/wtp-radio-config/bss-id: .x04fe7f499b90 radio.0/cisco/wtp-radio-config/bss-id: .x04fe7f499b90
radio.0/cisco/wtp-radio-config/cfg-period: 0 radio.0/cisco/wtp-radio-config/cfg-period: 4
radio.0/cisco/wtp-radio-config/cfg-type: 1 radio.0/cisco/wtp-radio-config/cfg-type: 1
radio.0/cisco/wtp-radio-config/cfp-maximum-duration: 0 radio.0/cisco/wtp-radio-config/cfp-maximum-duration: 60
radio.0/cisco/wtp-radio-config/country-str1: "DE " radio.0/cisco/wtp-radio-config/country-str1: "DE "
radio.0/cisco/wtp-radio-config/country-str2: "DE " radio.0/cisco/wtp-radio-config/country-str2: "DE "
radio.0/cisco/wtp-radio-config/occupancy-limit: 0 radio.0/cisco/wtp-radio-config/occupancy-limit: 100
radio.0/cisco/wtp-radio-config/reg: 768 radio.0/cisco/wtp-radio-config/reg: 167772416
radio.1/admin-state: reserved radio.0/decryption-error-report-period: 120
radio.0/operational-state/cause: Normal
radio.0/operational-state/state: enabled
radio.0/rate_set: .x82848b960c1218243048606c
radio.0/wtp-radio-information: 1
radio.1/admin-state: 1 - enabled
radio.1/cisco/air-space-capability: 0
radio.1/cisco/antenna-payload/802-11n-rx-antennas: 7 radio.1/cisco/antenna-payload/802-11n-rx-antennas: 7
radio.1/cisco/antenna-payload/802-11n-tx-antennas: 0 radio.1/cisco/antenna-payload/802-11n-tx-antennas: 0
radio.1/cisco/antenna-payload/antenna-1: 1 radio.1/cisco/antenna-payload/antenna-1: 1
@ -97,49 +145,61 @@ radio.1/cisco/antenna-payload/diversity-selection: 255
radio.1/cisco/antenna-payload/number-of-antennas: 2 radio.1/cisco/antenna-payload/number-of-antennas: 2
radio.1/cisco/antenna-payload/unknown: 3 radio.1/cisco/antenna-payload/unknown: 3
radio.1/cisco/channel-power: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe radio.1/cisco/channel-power: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe
radio.1/cisco/elem145: .x01
radio.1/cisco/elem15: .x012407ffffffce000000
radio.1/cisco/elem153: .x00
radio.1/cisco/elem156: .x020100
radio.1/cisco/elem19: .xc0a800a10001000bc0a800a110000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
radio.1/cisco/elem22: .x1000b4003224282c3034383c4064686c707484888c
radio.1/cisco/elem24: .x003c000c
radio.1/cisco/elem47: .x0100000000000000000000000000000000 radio.1/cisco/elem47: .x0100000000000000000000000000000000
radio.1/cisco/elem48: .x00
radio.1/cisco/elem81: .x00000000010101010a001e0a02050fbfffbfff0a00
radio.1/cisco/lwelem33: .x00
radio.1/cisco/lwelem48: .x01055a0101a6c405b06432b03232
radio.1/cisco/lwelem9: .x0100000000000000000000000000000000
radio.1/cisco/mac-operation/fragmentation-threshold: 2346 radio.1/cisco/mac-operation/fragmentation-threshold: 2346
radio.1/cisco/mac-operation/long-retry: 4 radio.1/cisco/mac-operation/long-retry: 4
radio.1/cisco/mac-operation/reserved: 1 radio.1/cisco/mac-operation/reserved: 1
radio.1/cisco/mac-operation/rts-threshold: 2347 radio.1/cisco/mac-operation/rts-threshold: 2347
radio.1/cisco/mac-operation/rx-msdu-lifetime: 1000 radio.1/cisco/mac-operation/rx-msdu-lifetime: 512
radio.1/cisco/mac-operation/short-retry: 7 radio.1/cisco/mac-operation/short-retry: 7
radio.1/cisco/mac-operation/tx-msdu-lifetime: 5000 radio.1/cisco/mac-operation/tx-msdu-lifetime: 512
radio.1/cisco/multi-domain-capability/first-channel: 36 radio.1/cisco/multi-domain-capability/first-channel: 36
radio.1/cisco/multi-domain-capability/max-tx-power-level: 65535 radio.1/cisco/multi-domain-capability/max-tx-power-level: 20
radio.1/cisco/multi-domain-capability/number-of-channels: 16 radio.1/cisco/multi-domain-capability/number-of-channels: 4
radio.1/cisco/multi-domain-capability/reserved: 1 radio.1/cisco/multi-domain-capability/reserved: 1
radio.1/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000 radio.1/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000
radio.1/cisco/tx-power/current-tx-power: 1 radio.1/cisco/tx-power/current-tx-power: 1
radio.1/cisco/tx-power/reserved: 1 radio.1/cisco/tx-power/reserved: 1
radio.1/cisco/wtp-radio-config/beacon-period: 100 radio.1/cisco/wtp-radio-config/beacon-period: 100
radio.1/cisco/wtp-radio-config/bss-id: .x04fe7f499b90 radio.1/cisco/wtp-radio-config/bss-id: .x04fe7f499b90
radio.1/cisco/wtp-radio-config/cfg-period: 0 radio.1/cisco/wtp-radio-config/cfg-period: 4
radio.1/cisco/wtp-radio-config/cfg-type: 1 radio.1/cisco/wtp-radio-config/cfg-type: 1
radio.1/cisco/wtp-radio-config/cfp-maximum-duration: 0 radio.1/cisco/wtp-radio-config/cfp-maximum-duration: 60
radio.1/cisco/wtp-radio-config/country-str1: "DE " radio.1/cisco/wtp-radio-config/country-str1: "DE "
radio.1/cisco/wtp-radio-config/country-str2: "DE " radio.1/cisco/wtp-radio-config/country-str2: "DE "
radio.1/cisco/wtp-radio-config/occupancy-limit: 0 radio.1/cisco/wtp-radio-config/occupancy-limit: 100
radio.1/cisco/wtp-radio-config/reg: 768 radio.1/cisco/wtp-radio-config/reg: 167772416
radio.255/admin-state: enabled radio.1/decryption-error-report-period: 120
radio.1/operational-state/cause: Normal
radio.1/operational-state/state: enabled
radio.1/rate_set: .x8c129824b048606c
radio.1/wtp-radio-information: 2
radio.2/cisco/lwelem33: .x00
radio.255/admin-state: 1 - enabled
radio.255/operational-state/cause: Normal
radio.255/operational-state/state: enabled
session-id: .xd328ad6c
statistics-timer: 180 statistics-timer: 180
wtp-reboot-statistics/ac-initiated-count: 335
wtp-reboot-statistics/hw-failure-count: 0
wtp-reboot-statistics/last-failure-type: 1
wtp-reboot-statistics/link-failure-count: 0
wtp-reboot-statistics/other-failure-count: 1
wtp-reboot-statistics/reboot-count: 0
wtp-reboot-statistics/sw-failure-count: 0
wtp-reboot-statistics/unknown-failure-count: 0
wtp-board-data/board-id: .x0000 wtp-board-data/board-id: .x0000
wtp-board-data/mac-address: .x0800276edf58 wtp-board-data/mac-address: .x0800276edf58
wtp-board-data/model-no: AIR-LAP1131AG-E-K9 wtp-board-data/model-no: "AIR-LAP1142N-E-K9 "
wtp-board-data/revision: B0 wtp-board-data/revision: A0
wtp-board-data/serial-no: FCZ1441Q0XZ wtp-board-data/serial-no: FCZ1406W232
wtp-board-data/vendor: 4232704 wtp-board-data/vendor: 4232704
wtp-descriptor/bootloader/vendor: 4232704 wtp-descriptor/bootloader/vendor: 4232704
wtp-descriptor/bootloader/version: .x0c030800 wtp-descriptor/bootloader/version: .x0c041200
wtp-descriptor/hardware/vendor: 4232704 wtp-descriptor/hardware/vendor: 4232704
wtp-descriptor/hardware/version: .x01000000 wtp-descriptor/hardware/version: .x01000000
wtp-descriptor/max-radios: 2 wtp-descriptor/max-radios: 2
@ -148,24 +208,13 @@ wtp-descriptor/software/vendor: 4232704
wtp-descriptor/software/version: .x07007400 wtp-descriptor/software/version: .x07007400
wtp-fallback: 1 wtp-fallback: 1
wtp-frame-tunnel-mode: 4 wtp-frame-tunnel-mode: 4
wtp-mac-type: 1 wtp-mac-type: 1 - Split MAC
wtp-name: Supertube wtp-name: SoftWTP-Tube
wtp-fallback: 1 wtp-reboot-statistics/ac-initiated-count: 1
wtp-frame-tunnel-mode: 4 wtp-reboot-statistics/hw-failure-count: 0
wtp-mac-type: 1 wtp-reboot-statistics/last-failure-type: 1
capwap-timers/max-discovery-interval: 2 wtp-reboot-statistics/link-failure-count: 0
capwap-timers/min-discovery-interval: 0 wtp-reboot-statistics/other-failure-count: 17
discovery-type: 0 wtp-reboot-statistics/reboot-count: 0
idle-timeout: 300 wtp-reboot-statistics/sw-failure-count: 0
location-data: Berlin wtp-reboot-statistics/unknown-failure-count: 0
radio.0/wtp-radio-information: 1
radio.1/wtp-radio-information: 2
cisco/ssl-certfile: ../../ssl/certs/wtpc.crt
cisco/ssl-cipher:SHA1
cisco/ssl-keyfile: ../../ssl/certs/wtpc.key
cisco/wtp-use-ac-version: true
session-id :Bstr16: .x00006215

View File

@ -7,14 +7,17 @@
#include "cw/dbg.h" #include "cw/dbg.h"
#include "wtp_interface.h" #include "wtp_interface.h"
#include "cfg.h" #include "wtp.h"
static int config_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len) static int config_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
{ {
struct cw_DiscoveryResults *results = (struct cw_DiscoveryResults *)params->conn->data; cw_dbg(DBG_X,"*** Configurations Status Response received ****");
cw_dbg(DBG_X,"Configurations status response received"); cw_cfg_copy(params->cfg, params->conn->global_cfg);
cw_cfg_dump(params->cfg); cw_cfg_save(bootcfg.cfgfilename, params->conn->global_cfg,
"#\n# This file is igenerated by WAT\n# If you edit this, your cahnges might be overwritten\n#\n");
cw_dbg(DBG_X,"*** Cnofig Saved ***");
return 0; return 0;
} }
@ -24,12 +27,13 @@ int configure(struct cw_Conn * conn)
{ {
char sockbuff[SOCK_ADDR_BUFSIZE]; char sockbuff[SOCK_ADDR_BUFSIZE];
// cw_dbg_ktv_dump(conn->local_cfg,DBG_INFO,"KTV DUMP ----------------","LOCAL:", "DUMP done -------");
cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,config_cb); cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,config_cb);
int rc; int rc;
cw_cfg_copy(conn->global_cfg,conn->update_cfg);
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST); rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
cw_cfg_clear(conn->update_cfg);
if (!cw_result_is_ok(rc)) { if (!cw_result_is_ok(rc)) {
if (rc > 0) { if (rc > 0) {
@ -47,9 +51,5 @@ int configure(struct cw_Conn * conn)
return 0; return 0;
} }
// cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"Config ***","CFG: ", "End config ***");
// cw_ktv_set_byte(conn->remote_cfg,"
/*exit(0);*/
return 1; return 1;
} }

View File

@ -154,10 +154,7 @@ static int run_join_d(struct cw_Conn * conn, struct sockaddr *sa,cw_Cfg_t * cfg)
cw_dbg(DBG_DTLS, "DTLS Connection successful established with %s", cw_dbg(DBG_DTLS, "DTLS Connection successful established with %s",
sock_addr2str(sa,addrstr)); sock_addr2str(sa,addrstr));
// conn->remote_cfg=cfg; return run_join(conn);
rc = run_join(conn);
// conn->remote_cfg=NULL;
return rc;
} }
@ -221,8 +218,6 @@ int join(struct cw_Conn * conn, struct cw_DiscoveryResults * results)
if (rc) if (rc)
return 1; return 1;
} }
return 0; return 0;

View File

@ -18,7 +18,7 @@
#include "cw/timer.h" #include "cw/timer.h"
#include "wtp.h"
#include "cw/capwap.h" #include "cw/capwap.h"
@ -30,32 +30,20 @@
int update =1; int update =1;
/*
int handle_update_req(struct cw_Conn *conn, struct cw_action_in *a, uint8_t * data,
int len, struct sockaddr *from) static int update_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
{ {
if (a->msg_id == CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST){ cw_dbg(DBG_X," **** Configuration Update Request Received ***");
update =1; // cw_cfg_dump(params->conn->global_cfg);
cw_cfg_copy(params->cfg, params->conn->global_cfg);
} cw_cfg_save(bootcfg.cfgfilename, params->conn->global_cfg,
"#\n# This file is igenerated by WAT\n# If you edit this, your cahnges might be overwritten\n#\n");
cw_dbg(DBG_X," **** Configuration Update Request Received Saved ***");
return 0; return 0;
MAVLITER_DEFINE(it, conn->incomming);
mavliter_foreach(&it) {
mbag_item_t *item = mavliter_get(&it);
}
cw_dbg(DBG_X,"Saving configuration ...");
cfg_to_json();
return 0;
} }
*/
/* /*
@ -88,66 +76,15 @@ static void update_radios(struct cw_Conn * conn, mbag_t result)
} }
*/ */
static void do_update(struct cw_Conn * conn)
{
int rc;
cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:", "DUMP done -------");
// if (!update)
// return;
// update=0;
/* mbag_t result = mbag_create();
update_radios(conn,result);
*/ cw_dbg(DBG_INFO, "Saving configuration ...");
/* cfg_to_json();*/
/* Change State ... */
/*
rc = cw_send_request(conn,CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST);
if ( !cw_result_is_ok(rc) ) {
cw_strresult(rc);
return ;
}
*/
}
void clean_cfg(mavl_t cfg)
{
char key[CW_CFG_MAX_KEY_LEN];
cw_Val_t search;
int i;
int max;
max = cw_ktv_idx_get(cfg,"radio");
for (i=0;i<max+1;i++){
sprintf(key,"radio.%d/wtp-radio-information",i);
search.key = key;
mavl_del(cfg,&search);
}
}
int run(struct cw_Conn * conn) int run(struct cw_Conn * conn)
{ {
cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,update_cb);
conn->capwap_state = CAPWAP_STATE_RUN; conn->capwap_state = CAPWAP_STATE_RUN;
/* conn->msg_end=handle_update_req;*/
do { do {
int echo_interval = cw_cfg_get_byte(conn->global_cfg,"capwap-timers/echo-interval",CAPWAP_ECHO_INTERVAL); int echo_interval = cw_cfg_get_byte(conn->global_cfg,"capwap-timers/echo-interval",CAPWAP_ECHO_INTERVAL);
@ -166,14 +103,14 @@ int run(struct cw_Conn * conn)
if (rc < 0 && errno == EAGAIN) { if (rc < 0 && errno == EAGAIN) {
continue; continue;
} }
printf("--------------------------------------------------------------------------------------\n"); //printf("--------------------------------------------------------------------------------------\n");
if ( !cw_result_is_ok(rc)) { if ( !cw_result_is_ok(rc)) {
printf("---------------------- cwrsult is not ok\n"); //printf("---------------------- cwrsult is not ok\n");
break; break;
} }
printf("lalalala\n"); //printf("lalalala\n");
//cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:", "DUMP done -------"); //cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:", "DUMP done -------");
// printf("Saving Config\n"); // printf("Saving Config\n");
@ -181,9 +118,7 @@ printf("lalalala\n");
// cw_ktv_save(conn->local_cfg,"cisco.ktv"); // cw_ktv_save(conn->local_cfg,"cisco.ktv");
// clean_cfg(conn->remote_cfg); // clean_cfg(conn->remote_cfg);
cw_dbg(DBG_X,"We hav a message processed"); // cw_dbg(DBG_X,"We hav a message processed");
update=1;
do_update(conn);
} }
if (rc<0 && errno == EAGAIN){ if (rc<0 && errno == EAGAIN){
@ -217,133 +152,3 @@ printf("lalalala\n");
/*
static int echo_interval_timer;
struct cwrmsg * get_response(struct cw_Conn * conn, int type,int seqnum)
{
struct cwrmsg * cwrmsg;
int i;
for(i=0; i<conf_retransmit_interval; i++){
cwrmsg = conn_get_message(conn);
if ( cwrmsg==0){
//printf("null message \n");
continue;
}
if (cwrmsg->type==type && cwrmsg->seqnum==seqnum)
return cwrmsg;
printf("another message was detected %i %i\n",cwrmsg->type,cwrmsg->seqnum);
}
return 0;
}
*/
/*
struct cwrmsg * send_request(struct cw_Conn * conn,struct cwmsg *cwmsg)
{
int i;
for (i=0; i<conf_max_retransmit; i++){
#ifdef WITH_CW_LOG_DEBUG
if (i>0){
// cw_log_debug1("Retransmitting request, type=%i,seqnum=%i",cwmsg->type,cwmsg->seqnum);
}
#endif
int rc = conn_send_cwmsg(conn,cwmsg);
if (rc<0){
// cw_log_debug1("Error sending request, type=%i, seqnum %i, %s",cwmsg->type,cwmsg->seqnum,strerror(errno));
return 0;
}
struct cwrmsg * r = get_response(conn,cwmsg->type+1,cwmsg->seqnum);
if (r)
return r;
}
return 0;
}
*/
/*//extern struct cw_Conn * get_conn();*/
/*
int run(struct cw_Conn * conn)
{
conn = get_conn();
printf("Running with conn %p\n");
struct radioinfo radioinfo;
memset(&radioinfo,0,sizeof(radioinfo));
struct cwrmsg * cwrmsg;
echo_interval_timer=time(NULL);
while (1){
if (time(NULL)-echo_interval_timer >= conf_echo_interval)
{
// struct cwmsg cwmsg;
// uint8_t buffer[CWMSG_MAX_SIZE];
// cwsend_echo_request(conn,&radioinfo);
// cw_log_debug1("Sending echo request");
struct cwmsg *cwmsg=&conn->req_msg;
uint8_t * buffer = conn->req_buffer;
struct wtpinfo * wtpinfo = get_wtpinfo();
struct radioinfo *rip = &(wtpinfo->radioinfo[0]);
cwmsg_init_echo_request(cwmsg,buffer,conn,rip);
printf("Echo ->>>>>>>>>>>>>>>>>>>>> Seqnum %d\n",conn->req_msg.seqnum);
printf("Conn target is %s",sock_addr2str(&conn->addr));
printf("Calling conn send req\n");
printf("conn max retrans: %d\n",conn->max_retransmit);
struct cwrmsg * rc = conn_send_request(conn);
printf("Back from conn send req\n");
// printf("conn->seqnum %i\n",conn->seqnum);
// struct cwrmsg * rc = get_response(conn,CWMSG_ECHO_RESPONSE,conn->seqnum);
if (rc==0){
printf("Error !\n");
// dtls_shutdown(conn);
// cw_log_debug1("Connection lost, no echo response");
// return 0;
}
echo_interval_timer=time(NULL);
}
time_t rt = cw_timer_start(5);
cwrmsg = conn_wait_for_request(conn,0,rt);
struct wtpinfo * wtpinfo = get_wtpinfo();
struct radioinfo *rip = &(wtpinfo->radioinfo[0]);
if(cwrmsg){
cw_readmsg_configuration_update_request(cwrmsg->msgelems,cwrmsg->msgelems_len);
cw_send_configuration_update_response(conn,cwrmsg->seqnum,rip);
}
sleep(1);
}
exit(0);
}
*/

View File

@ -21,4 +21,16 @@ int join(struct cw_Conn * conn, struct cw_DiscoveryResults * dis);
struct cw_Conn * get_conn(); struct cw_Conn * get_conn();
#define MAX_MODS 32
struct bootcfg{
const char * modnames[MAX_MODS];
int nmods;
const char * modpath;
const char * cfgfilename;
};
extern struct bootcfg bootcfg;
#endif #endif

View File

@ -17,14 +17,6 @@
#include "cw/cfg.h" #include "cw/cfg.h"
#define MAX_MODS 32
struct bootcfg{
const char * modnames[MAX_MODS];
int nmods;
const char * modpath;
const char * cfgfilename;
};
bstr_t get_base_rmac() bstr_t get_base_rmac()
{ {
@ -40,7 +32,7 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg)
int c; int c;
opterr = 1; opterr = 1;
bootcfg->cfgfilename = "config.ktv"; bootcfg->cfgfilename = "config.ckv";
while ( (c = getopt (argc, argv, "p:d:vc:m:h")) != -1) { while ( (c = getopt (argc, argv, "p:d:vc:m:h")) != -1) {
@ -83,9 +75,12 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg)
#include "cw/rand.h" #include "cw/rand.h"
struct bootcfg bootcfg;
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
struct bootcfg bootcfg;
struct cw_Mod * mod; struct cw_Mod * mod;
struct cw_MsgSet * msgset=NULL; struct cw_MsgSet * msgset=NULL;
struct cw_Conn * conn=NULL; struct cw_Conn * conn=NULL;
@ -145,7 +140,6 @@ int main (int argc, char **argv)
conn->dtls_mtu = 1200; conn->dtls_mtu = 1200;
conn->msgset=msgset; conn->msgset=msgset;
conn->global_cfg = global_cfg; conn->global_cfg = global_cfg;
//conn->remote_cfg = cw_cfg_create();
conn->role = CW_ROLE_WTP; conn->role = CW_ROLE_WTP;
conn->wbid=1; conn->wbid=1;
@ -181,7 +175,6 @@ int main (int argc, char **argv)
// cw_run_discovery(conn, "192.168.0.255","192.168.0.14", &dis); // cw_run_discovery(conn, "192.168.0.255","192.168.0.14", &dis);
results = cw_run_discovery(conn, "255.255.255.255","192.168.0.14"); results = cw_run_discovery(conn, "255.255.255.255","192.168.0.14");
// mavl_del_all(conn->remote_cfg);
if (!join(conn,results)){ if (!join(conn,results)){
cw_discovery_results_destroy(results); cw_discovery_results_destroy(results);
goto errX; goto errX;
@ -191,8 +184,6 @@ int main (int argc, char **argv)
cw_discovery_results_destroy(results); cw_discovery_results_destroy(results);
// clean_cfg(conn->remote_cfg);
// mavl_merge(conn->local_cfg,conn->remote_cfg);
changestate(conn); changestate(conn);