Added lots of RPC cmds added. send is possible.
This commit is contained in:
parent
62616b5e7b
commit
a77023165b
154
src/ac/rpc.c
154
src/ac/rpc.c
@ -2,6 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -16,6 +17,7 @@
|
||||
#include "cw/log.h"
|
||||
#include "cw/dbg.h"
|
||||
|
||||
#include "wtpman.h"
|
||||
|
||||
#include "cw/connlist.h"
|
||||
|
||||
@ -64,6 +66,9 @@ int wlan0_cmd(struct rpcdata *sd, const char * cmd);
|
||||
int exit_cmd(struct rpcdata *sd, const char * cmd);
|
||||
int prompt_cmd(struct rpcdata *sd, const char * cmd);
|
||||
int global_cfg_cmd(struct rpcdata *sd, const char * cmd);
|
||||
int status_cmd(struct rpcdata *sd, const char * cmd);
|
||||
void print_mw(FILE *f, int w, const char * str);
|
||||
int clear_cmd(struct rpcdata *sd, const char *cmd);
|
||||
|
||||
//void show_cfg (FILE *out, mavl_t ktv);
|
||||
int show_aps (FILE *out);
|
||||
@ -88,6 +93,9 @@ static struct command cmdlist[]={
|
||||
{"set", set_cmd },
|
||||
{"wlan0",wlan0_cmd},
|
||||
{"global_cfg", global_cfg_cmd},
|
||||
{"status",status_cmd},
|
||||
{"clear",clear_cmd},
|
||||
|
||||
|
||||
{"@prompt",prompt_cmd},
|
||||
|
||||
@ -112,9 +120,18 @@ int prompt_cmd(struct rpcdata *sd, const char *cmd)
|
||||
}
|
||||
|
||||
|
||||
int global_cfg_cmd(struct rpcdata *sd, const char *cmd)
|
||||
int global_cfg_cmd(struct rpcdata *sd, const char *str)
|
||||
{
|
||||
cw_cfg_fdump(sd->out,sd->global_cfg);
|
||||
char *s;
|
||||
while( isspace( *str ) )
|
||||
str++;
|
||||
s=(char*)str;
|
||||
while (!isspace(*s) && *s!=0)
|
||||
s++;
|
||||
*s=0;
|
||||
|
||||
|
||||
cw_cfg_fdump(sd->out,sd->global_cfg,str);
|
||||
finish_cmd(sd->out);
|
||||
return 0;
|
||||
}
|
||||
@ -149,8 +166,18 @@ int exit_cmd(struct rpcdata *sd, const char *cmd)
|
||||
|
||||
|
||||
|
||||
int cfg_cmd(struct rpcdata *sd, const char *cmd)
|
||||
int cfg_cmd(struct rpcdata *sd, const char *str)
|
||||
{
|
||||
char *s;
|
||||
while( isspace( *str ) )
|
||||
str++;
|
||||
s=(char*)str;
|
||||
while (!isspace(*s) && *s!=0)
|
||||
s++;
|
||||
*s=0;
|
||||
|
||||
|
||||
|
||||
struct cw_Conn * conn;
|
||||
wtplist_lock();
|
||||
conn = find_ap(sd->prompt);
|
||||
@ -158,37 +185,112 @@ int cfg_cmd(struct rpcdata *sd, const char *cmd)
|
||||
fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
|
||||
}
|
||||
else {
|
||||
cw_cfg_fdump(sd->out,conn->remote_cfg);
|
||||
cw_cfg_fdump(sd->out,conn->remote_cfg,str);
|
||||
}
|
||||
finish_cmd(sd->out);
|
||||
wtplist_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucfg_cmd(struct rpcdata *sd, const char *cmd)
|
||||
|
||||
int status_cmd(struct rpcdata *sd, const char *cmd)
|
||||
{
|
||||
// struct cw_Conn * conn;
|
||||
stop();
|
||||
// show_cfg(sd->out,sd->update_cfg);
|
||||
struct cw_Conn * conn;
|
||||
int i;
|
||||
char key[CW_CFG_MAX_KEY_LEN];
|
||||
|
||||
wtplist_lock();
|
||||
print_mw(sd->out,8,"Radio");
|
||||
print_mw(sd->out,15,"Admin State");
|
||||
print_mw(sd->out,15,"Oper State");
|
||||
print_mw(sd->out,13,"Cause");
|
||||
fprintf(sd->out,"\n");
|
||||
|
||||
conn = find_ap(sd->prompt);
|
||||
if (conn==NULL){
|
||||
fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
|
||||
goto errX;
|
||||
}
|
||||
|
||||
i=0;
|
||||
do {
|
||||
char tmp[128];
|
||||
sprintf(key,"radio.%d",i);
|
||||
if (!cw_cfg_base_exists(conn->remote_cfg,key))
|
||||
break;
|
||||
|
||||
sprintf(tmp,"%d",i);
|
||||
print_mw(sd->out,8,tmp);
|
||||
|
||||
sprintf(key,"radio.%d/capwap/admin-state",i);
|
||||
print_mw(sd->out,15, cw_cfg_get(conn->remote_cfg,key,"?"));
|
||||
sprintf(key,"radio.%d/capwap/operational-state/state",i);
|
||||
print_mw(sd->out,15, cw_cfg_get(conn->remote_cfg,key,"?"));
|
||||
sprintf(key,"radio.%d/capwap/operational-state/cause",i);
|
||||
print_mw(sd->out,13, cw_cfg_get(conn->remote_cfg,key,"?"));
|
||||
fprintf(sd->out,"\n");
|
||||
|
||||
i++;
|
||||
}while(1);
|
||||
|
||||
errX:
|
||||
finish_cmd(sd->out);
|
||||
wtplist_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ucfg_cmd(struct rpcdata *sd, const char *str)
|
||||
{
|
||||
char *s;
|
||||
while( isspace( *str ) )
|
||||
str++;
|
||||
s=(char*)str;
|
||||
while (!isspace(*s) && *s!=0)
|
||||
s++;
|
||||
*s=0;
|
||||
|
||||
|
||||
cw_cfg_fdump(sd->out,sd->update_cfg,str);
|
||||
finish_cmd(sd->out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int clear_cmd(struct rpcdata *sd, const char *cmd)
|
||||
{
|
||||
cw_cfg_clear(sd->update_cfg);
|
||||
fprintf(sd->out,"ucfg cleard\n");
|
||||
finish_cmd(sd->out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "wtpman.h"
|
||||
|
||||
int
|
||||
send_cmd(struct rpcdata * sd, const char *cmd)
|
||||
{
|
||||
|
||||
struct wtpman * wtpman;
|
||||
struct cw_Conn * conn;
|
||||
wtplist_lock();
|
||||
conn = find_ap(sd->prompt);
|
||||
if (conn==NULL){
|
||||
fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
|
||||
goto errX;
|
||||
}
|
||||
else {
|
||||
conn->update_cfg=sd->update_cfg;
|
||||
wtpman=conn->data;
|
||||
cw_cfg_copy(sd->update_cfg,conn->update_cfg,0,NULL);
|
||||
wtpman->update=1;
|
||||
|
||||
fprintf(sd->out, "Sending update cmd\n");
|
||||
|
||||
// conn->update_cfg=sd->update_cfg;
|
||||
}
|
||||
errX:
|
||||
wtplist_unlock();
|
||||
finish_cmd(sd->out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -221,29 +323,30 @@ int set_cmd(struct rpcdata *sd, const char *str)
|
||||
|
||||
cw_cfg_read_from_string(str,cfg);
|
||||
|
||||
cw_cfg_fdump(sd->out,cfg);
|
||||
cw_cfg_fdump(sd->out,cfg,NULL);
|
||||
cw_cfg_copy(cfg,sd->update_cfg,DBG_CFG_UPDATES,"rpc ucfg");
|
||||
|
||||
cw_cfg_destroy(cfg);
|
||||
|
||||
finish_cmd(sd->out);
|
||||
|
||||
// cw_ktv_init_str_reader(&r,str,strlen(str));
|
||||
|
||||
// cw_ktv_parse_string(&r,key,type,val);
|
||||
/*cw_ktv_parse_string(key,type,val, 2048);*/
|
||||
|
||||
// fprintf(sd->out,"%s %s\n",key,val);
|
||||
// cw_ktv_add(sd->update_cfg,key,CW_TYPE_STR,NULL,val,strlen(val));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int del_cmd(struct rpcdata *sd, const char *str)
|
||||
{
|
||||
char key[CW_CFG_MAX_KEY_LEN];
|
||||
sscanf(str,"%s",key);
|
||||
stop();
|
||||
// cw_ktv_del_sub(sd->update_cfg,key);
|
||||
//
|
||||
char *s;
|
||||
|
||||
while( isspace( *str ) )
|
||||
str++;
|
||||
s=(char*)str;
|
||||
while (!isspace(*s) && *s!=0)
|
||||
s++;
|
||||
*s=0;
|
||||
|
||||
|
||||
fprintf(sd->out,"DEL: '%s'\n",str);
|
||||
cw_cfg_del(sd->update_cfg,str);
|
||||
finish_cmd(sd->out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -540,6 +643,7 @@ void rpc_loop (FILE *file, cw_Cfg_t *global_cfg)
|
||||
sd.in = file;
|
||||
sd.out = file;
|
||||
sd.global_cfg=global_cfg;
|
||||
sd.update_cfg=cw_cfg_create();
|
||||
|
||||
|
||||
sprintf(sd.prompt,"%s","*");
|
||||
|
@ -298,6 +298,18 @@ int cw_run_state_machine(struct cw_Conn *conn, time_t * timer)
|
||||
|
||||
/*#define CW_TRANSITION(prestate,state) (prestate<<16|state)*/
|
||||
|
||||
|
||||
int run_update(struct wtpman *wtpman)
|
||||
{
|
||||
int rc;
|
||||
if (!wtpman->update)
|
||||
return EAGAIN;
|
||||
rc = cw_send_request(wtpman->conn, CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST);
|
||||
cw_cfg_clear(wtpman->conn->update_cfg);
|
||||
wtpman->update=0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void *wtpman_main(void *arg)
|
||||
{
|
||||
//mavl_t r;
|
||||
@ -343,6 +355,7 @@ static void *wtpman_main(void *arg)
|
||||
conn->capwap_prevstate = CAPWAP_STATE_DTLS_SETUP;
|
||||
conn->capwap_state = CAPWAP_STATE_JOIN;
|
||||
rc = 0;
|
||||
wtpman->update=0;
|
||||
|
||||
while (1) {
|
||||
|
||||
@ -359,15 +372,19 @@ static void *wtpman_main(void *arg)
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer)) {
|
||||
rc = run_update(wtpman);
|
||||
if (rc !=EAGAIN)
|
||||
break;
|
||||
|
||||
rc = cw_read_messages(wtpman->conn);
|
||||
|
||||
if (rc < 0) {
|
||||
if (errno == EAGAIN)
|
||||
if (errno == EAGAIN){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc < 0) {
|
||||
conn->capwap_prevstate = conn->capwap_state;
|
||||
conn->capwap_state = CAPWAP_STATE_TIMEOUT;
|
||||
@ -463,6 +480,24 @@ static int event_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, i
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int change_state_event_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
|
||||
{
|
||||
struct cw_Conn * conn = (struct cw_Conn*)params->conn;
|
||||
struct wtpman * wtpman = (struct wtpman *)conn->data;
|
||||
|
||||
char filename[200];
|
||||
|
||||
|
||||
|
||||
cw_dbg(DBG_X,"WTP EVENT Callback");
|
||||
copy(params);
|
||||
|
||||
const char * wtpname = cw_cfg_get(conn->remote_cfg,"capwap/wtp-name","default");
|
||||
sprintf(filename,"wtp-change-event-%d-%s.ckv",wtpman->ctr++,wtpname);
|
||||
cw_cfg_save(filename,params->cfg,NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -552,6 +587,10 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
||||
CAPWAP_MSG_WTP_EVENT_REQUEST,
|
||||
event_cb);
|
||||
|
||||
cw_conn_set_msg_cb(wtpman->conn,
|
||||
CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST,
|
||||
change_state_event_cb);
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ struct wtpman {
|
||||
|
||||
cw_Cfg_t * wtp_cfg;
|
||||
|
||||
|
||||
int update;
|
||||
int ctr;
|
||||
};
|
||||
|
||||
|
@ -59,6 +59,7 @@ CWSRC=\
|
||||
cw_type_ipaddress.c\
|
||||
cw_type_word.c\
|
||||
cw_type_sysptr.c\
|
||||
cw_type_array.c\
|
||||
cw_write_descriptor_subelem.c\
|
||||
cw_write_radio_element.c\
|
||||
cw_detect_nat.c\
|
||||
|
@ -86,12 +86,12 @@ enum radioelems {
|
||||
};
|
||||
|
||||
|
||||
/** IEEE 802.11 Radio Information Message Element */
|
||||
#define CAPWAP80211_ELEM_WTP_RADIO_INFORMATION 1048
|
||||
/** IEEE 802.11 Antenna Message element */
|
||||
#define CAPWAP80211_ELEM_ANTENNA 1025
|
||||
|
||||
|
||||
/** IEEE 802.11 WTP Radio Configuration */
|
||||
#define CAPWAP80211_ELEM_WTP_RADIO_CONFIGURATION 1046
|
||||
/** IEEE 802.11 Radio Information Message Element */
|
||||
#define CAPWAP80211_ELEM_WTP_RADIO_INFORMATION 1048
|
||||
|
||||
|
||||
/**
|
||||
|
68
src/cw/cfg.c
68
src/cw/cfg.c
@ -129,6 +129,16 @@ int cw_cfg_set(cw_Cfg_t * cfg, const char *key, const char *val)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void cw_cfg_del(cw_Cfg_t * cfg, const char *key)
|
||||
{
|
||||
struct cw_Cfg_entry e;
|
||||
e.key = key;
|
||||
e.val=NULL;
|
||||
mavl_del(cfg->cfg,&e);
|
||||
}
|
||||
|
||||
|
||||
const char *cw_cfg_get(cw_Cfg_t * cfg, const char *key, const char *def)
|
||||
{
|
||||
struct cw_Cfg_entry e, *r;
|
||||
@ -193,7 +203,7 @@ void cw_cfg_dump(cw_Cfg_t * cfg)
|
||||
}
|
||||
}
|
||||
|
||||
void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg)
|
||||
void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg, const char *filter)
|
||||
{
|
||||
mavliter_t it;
|
||||
struct cw_Cfg_entry *e;
|
||||
@ -201,6 +211,13 @@ void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg)
|
||||
mavliter_foreach(&it) {
|
||||
|
||||
e = mavliter_get(&it);
|
||||
if (filter != NULL){
|
||||
if (strlen(filter)){
|
||||
if (strstr(e->key,filter)==NULL){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(f,"%s: '%s'\n", e->key, e->val);
|
||||
}
|
||||
}
|
||||
@ -814,22 +831,43 @@ void cw_cfg_clear(cw_Cfg_t *cfg)
|
||||
int cw_cfg_base_exists(cw_Cfg_t * cfg, const char *key)
|
||||
{
|
||||
struct cw_Cfg_entry e, *result;
|
||||
//cw_dbg(DBG_X,"LOOX FOR: %s",key);
|
||||
e.key=key;
|
||||
result = mavl_get_first(cfg->cfg,&e);
|
||||
if (result == NULL)
|
||||
return 0;
|
||||
//cw_dbg(DBG_X,"BASEXXX: %s",result->key);
|
||||
int rl,kl;
|
||||
char skey[CW_CFG_MAX_KEY_LEN];
|
||||
char * delimiters = "/.";
|
||||
char * d;
|
||||
|
||||
if (strlen(result->key)<strlen(key))
|
||||
return 0;
|
||||
//cw_dbg(DBG_X,"BASEXXX1: %d",strlen(key));
|
||||
if (result->key[strlen(key)]!='/' && result->key[strlen(key)]!='.')
|
||||
return 0;
|
||||
//cw_dbg(DBG_X,"BASEXXX2: ");
|
||||
if (strncmp(result->key,key,strlen(key))==0)
|
||||
/* can we find the base exactly ?*/
|
||||
if (cw_cfg_get(cfg,key,NULL)!=NULL)
|
||||
return 1;
|
||||
cw_dbg(DBG_X,"BASEXXX3: ");
|
||||
|
||||
|
||||
for(d=delimiters; *d!=0; d++){
|
||||
sprintf(skey,"%s%c",key,*d);
|
||||
|
||||
e.key=skey;
|
||||
result = mavl_get_first(cfg->cfg,&e);
|
||||
|
||||
|
||||
/* if we've found nothing, we can't check more */
|
||||
if (result == NULL)
|
||||
continue;
|
||||
|
||||
rl = strlen(result->key);
|
||||
kl = strlen(skey);
|
||||
|
||||
/* if result key is shorter than key */
|
||||
if (rl<kl)
|
||||
continue;
|
||||
|
||||
/* both keys are identical in length */
|
||||
if (rl==kl){
|
||||
if (strcmp(result->key,key)==0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strncmp(result->key,skey,kl)==0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -81,8 +81,10 @@ int cw_cfg_base_exists_l(cw_Cfg_t ** cfgs, const char *key);
|
||||
int cw_cfg_save(const char *filename, cw_Cfg_t *cfg, const char *format, ...);
|
||||
|
||||
uint16_t cw_cfg_get_word_l(cw_Cfg_t ** cfg, const char *key, uint16_t def);
|
||||
void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg);
|
||||
void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg, const char *filter);
|
||||
|
||||
int cw_cfg_read_from_string(const char *str, cw_Cfg_t *cfg);
|
||||
void cw_cfg_del(cw_Cfg_t * cfg, const char *key);
|
||||
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ cw_dbg(DBG_X,"Her is the Key: %s %s\n",key,e[i].name);
|
||||
|
||||
b = cw_cfg_base_exists_l(params->cfg_list,handler->key);
|
||||
if (!b){
|
||||
stop();
|
||||
//stop();
|
||||
continue;
|
||||
}
|
||||
start = params->msgset->header_len(handler);
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "cw.h"
|
||||
#include "val.h"
|
||||
#include "dbg.h"
|
||||
|
||||
static cw_Val_t *get(cw_Val_t * data, const uint8_t * src, int len)
|
||||
{
|
||||
@ -126,38 +127,47 @@ static int cast(cw_Val_t * data)
|
||||
|
||||
static int bread(cw_Cfg_t *cfg, const char * key, const uint8_t *src, int len, const void *param)
|
||||
{
|
||||
uint8_t n,l;
|
||||
char skey[MAX_KEY_LEN];
|
||||
uint8_t n,i;
|
||||
int l;
|
||||
char skey[CW_CFG_MAX_KEY_LEN];
|
||||
const struct cw_ValArrayDef * def = param;
|
||||
|
||||
n = cw_get_byte(src);
|
||||
l=1;
|
||||
for (i=0; i<n; i++){
|
||||
// struct cw_Type *type=(struct cw_Type*)param;
|
||||
|
||||
const int (*fun)(cw_Cfg_t*,const char *k,const uint8_t *s,int len,const void *p,int *l) = def->get_count;
|
||||
|
||||
n = fun(cfg,key,src,len,param,&l);
|
||||
|
||||
for (i=0; i<n && l<len; i++){
|
||||
sprintf(skey,"%s.%d",key,i);
|
||||
l+=CW_TYPE_STRUCT->read(cfg,skey,src,len,param);
|
||||
// printf("SKEY: %s\n",skey);
|
||||
l+=def->type->read(cfg,skey,src,len,def->param);
|
||||
}
|
||||
|
||||
return l;
|
||||
|
||||
/*
|
||||
uint8_t val;
|
||||
cw_ValValRange_t * valrange = (cw_ValValRange_t *) param;
|
||||
const char *str;
|
||||
|
||||
val = cw_get_byte(src);
|
||||
str = get_guardstr(val, valrange);
|
||||
if (str != NULL)
|
||||
cw_cfg_set(cfg,key,str);
|
||||
else
|
||||
cw_cfg_set_int(cfg,key,val);
|
||||
|
||||
return 1;
|
||||
*/
|
||||
}
|
||||
|
||||
static int bwrite(cw_Cfg_t ** cfgs, const char *key, uint8_t *dst, const void * param)
|
||||
{
|
||||
return cw_generic_write_l(cfgs,CW_TYPE_BYTE,key,dst,param);
|
||||
int i,l;
|
||||
char skey[CW_CFG_MAX_KEY_LEN];
|
||||
const struct cw_ValArrayDef * def = param;
|
||||
const int (*fun)(cw_Cfg_t**,const char *k, uint8_t *s,const void *p,int l) = def->put_count;
|
||||
|
||||
|
||||
i=0,l=0;
|
||||
do {
|
||||
sprintf(skey,"%s.%d",key,i);
|
||||
i++;
|
||||
if (cw_cfg_get_l(cfgs,skey,NULL)==NULL){
|
||||
break;
|
||||
}
|
||||
l+=def->type->write(cfgs,skey,dst,def->param);
|
||||
}while(1);
|
||||
|
||||
// printf("LEN: %d pl: %d\n",l,n);
|
||||
fun(cfgs,key,dst,param,l);
|
||||
return l;
|
||||
}
|
||||
|
||||
const struct cw_Type cw_type_array = {
|
||||
|
@ -81,6 +81,7 @@ static int write_struct(cw_Cfg_t ** cfgs, const cw_ValStruct_t * stru, const ch
|
||||
int pos, i;
|
||||
const char * result;
|
||||
int wrlen;
|
||||
int rc;
|
||||
|
||||
cw_Val_t val;
|
||||
memset(&val,0,sizeof(cw_Val_t));
|
||||
@ -100,7 +101,9 @@ static int write_struct(cw_Cfg_t ** cfgs, const cw_ValStruct_t * stru, const ch
|
||||
else
|
||||
sprintf(key,"%s",pkey);
|
||||
|
||||
result = cw_cfg_get_l(cfgs,key,NULL);
|
||||
// result = cw_cfg_get_l(cfgs,key,NULL);
|
||||
rc = cw_cfg_base_exists_l(cfgs,key);
|
||||
// printf("Base? :%s, %d\n",key,rc);
|
||||
if(result) {
|
||||
// char s[2048];
|
||||
// result->type->to_str(result,s,2048);
|
||||
@ -108,9 +111,14 @@ static int write_struct(cw_Cfg_t ** cfgs, const cw_ValStruct_t * stru, const ch
|
||||
}
|
||||
|
||||
|
||||
if (result == NULL){
|
||||
if (!rc){
|
||||
int l;
|
||||
cw_log(LOG_ERR,"Can't put %s, no value found, filling wth zeros.",key);
|
||||
memset(dst+pos,0,stru[i].len);
|
||||
l = stru[i].len;
|
||||
if (l==-1)
|
||||
l = 0;
|
||||
|
||||
memset(dst+pos,0,l);
|
||||
}
|
||||
else{
|
||||
struct cw_Type * type;
|
||||
|
22
src/cw/dbg.c
22
src/cw/dbg.c
@ -90,7 +90,8 @@ static struct cw_StrListElem theme0[] = {
|
||||
{DBG_RFC, ANSI_BRED},
|
||||
{DBG_X, "\x1b[31m"},
|
||||
{DBG_WARN, ANSI_CYAN},
|
||||
{DBG_MOD, ANSI_WHITE},
|
||||
{DBG_MOD_DETAIL, ANSI_WHITE},
|
||||
{DBG_MOD, ANSI_BBLACK ANSI_BOLD },
|
||||
// {DBG_CFG_DMP, ANSI_BCYAN },
|
||||
{DBG_CFG_UPDATES,ANSI_GREEN},
|
||||
|
||||
@ -117,23 +118,24 @@ static struct cw_StrListElem color_off[] = {
|
||||
*/
|
||||
|
||||
static struct cw_StrListElem prefix[] = {
|
||||
{DBG_INFO, "Info -"},
|
||||
{DBG_PKT_IN, "Pkt In -"},
|
||||
{DBG_PKT_OUT, "Pkt Out -"},
|
||||
{DBG_INFO, "Info - "},
|
||||
{DBG_PKT_IN, "Pkt In - "},
|
||||
{DBG_PKT_OUT, "Pkt Out - "},
|
||||
{DBG_MSG_IN, "Msg In - "},
|
||||
{DBG_MSG_OUT, "Msg Out - "},
|
||||
|
||||
{DBG_ELEM_IN, " Msg Element -"},
|
||||
{DBG_ELEM_OUT, " Msg Element -"},
|
||||
{DBG_ELEM_IN, " Msg Element - "},
|
||||
{DBG_ELEM_OUT, " Msg Element - "},
|
||||
|
||||
{DBG_MSG_ERR, " Msg Error -"},
|
||||
{DBG_PKT_ERR, " Pkt Error -"},
|
||||
{DBG_ELEM_ERR, " Elem Error -"},
|
||||
{DBG_RFC, " RFC -"},
|
||||
{DBG_MSG_ERR, " Msg Error - "},
|
||||
{DBG_PKT_ERR, " Pkt Error - "},
|
||||
{DBG_ELEM_ERR, " Elem Error - "},
|
||||
{DBG_RFC, " RFC - "},
|
||||
{DBG_DTLS, "DTLS - "},
|
||||
{DBG_DTLS_DETAIL, "DTLS - "},
|
||||
{DBG_WARN, " Warning - "},
|
||||
{DBG_MOD, "Mod - "},
|
||||
{DBG_MOD_DETAIL, "Mod - "},
|
||||
{DBG_STATE, "STATEMACHINE - "},
|
||||
{DBG_CFG_UPDATES, "Cfg - "},
|
||||
|
||||
|
@ -125,6 +125,9 @@ enum cw_dbg_levels{
|
||||
|
||||
|
||||
DBG_X = (1<<30),
|
||||
|
||||
DBG_MOD_DETAIL = (1<<31),
|
||||
|
||||
DBG_ALL = (0x7fffffff),
|
||||
|
||||
|
||||
|
@ -65,6 +65,7 @@ struct cw_StrListElem cw_dbg_strings[] = {
|
||||
{ DBG_DTLS_DETAIL, "dtls_detail"},
|
||||
|
||||
{ DBG_CFG_UPDATES, "cfg_updates" },
|
||||
{ DBG_X, "x" },
|
||||
|
||||
|
||||
// {DBG_CFG_DMP, "cfg_dmp" },
|
||||
|
@ -41,8 +41,8 @@ int cw_encode_elements(struct cw_ElemHandlerParams *params, mlist_t elements_lis
|
||||
|
||||
if (!data->mand){
|
||||
if (!cw_cfg_base_exists(params->cfg_list[0],handler->key)){
|
||||
cw_dbg(DBG_MSG_COMPOSE," Add Elem: %d %d %d %s - (skip)",
|
||||
data->proto, data->vendor, data->id, handler->name);
|
||||
cw_dbg(DBG_MSG_COMPOSE," Add Elem: %d %d %d %s %s - (skip)",
|
||||
data->proto, data->vendor, data->id, handler->name, handler->key);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -139,14 +139,14 @@ struct cw_Mod *cw_mod_load(const char *mod_name, cw_Cfg_t * global_cfg, int role
|
||||
/* Search for the module in mods_loaded, to see if it is
|
||||
* already loaded or was statically linked */
|
||||
|
||||
cw_dbg(DBG_MOD, "MOD: Load module '%s'", mod_name);
|
||||
cw_dbg(DBG_MOD, "Loading module '%s'.", mod_name);
|
||||
|
||||
memset(&search, 0, sizeof(search));
|
||||
search.name = mod_name;
|
||||
|
||||
mod = mavl_get_ptr(mods_loaded, &search);
|
||||
if (mod) {
|
||||
cw_dbg(DBG_MOD, "MOD: Module already loaded '%s'", mod_name);
|
||||
cw_dbg(DBG_MOD, "Module already loaded: '%s'.", mod_name);
|
||||
return mod;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ struct cw_Mod *cw_mod_load(const char *mod_name, cw_Cfg_t * global_cfg, int role
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
|
||||
cw_dbg(DBG_MOD, "MOD: loading module from file: %s", filename);
|
||||
cw_dbg(DBG_MOD, "Loading module from file: %s", filename);
|
||||
|
||||
/* Open the DLL */
|
||||
handle = dlopen(filename, RTLD_NOW);
|
||||
@ -189,7 +189,7 @@ struct cw_Mod *cw_mod_load(const char *mod_name, cw_Cfg_t * global_cfg, int role
|
||||
goto errX;
|
||||
}
|
||||
|
||||
cw_dbg(DBG_MOD, "MOD: %s sucessfull loaded, calling init now.", filename);
|
||||
cw_dbg(DBG_MOD, "Module %s sucessfull loaded, calling init now.", filename);
|
||||
if (!mod->init(mod, global_cfg, role)){
|
||||
dlclose(handle);
|
||||
mod=NULL;
|
||||
|
@ -223,7 +223,7 @@ static int update_msgdata(struct cw_MsgSet *set, struct cw_MsgData *msgdata,
|
||||
break;
|
||||
continue;
|
||||
case CW_DELETE:
|
||||
cw_dbg(DBG_MOD, " deleting message element %d %d %d - %s",
|
||||
cw_dbg(DBG_MOD_DETAIL, " deleting message element %d %d %d - %s",
|
||||
elemdef->proto,
|
||||
elemdef->vendor, elemdef->id, handler->name);
|
||||
|
||||
@ -248,11 +248,11 @@ static int update_msgdata(struct cw_MsgSet *set, struct cw_MsgData *msgdata,
|
||||
result = mavl_replace(msgdata->elements_tree, &ed, &replaced);
|
||||
|
||||
if (!replaced) {
|
||||
cw_dbg(DBG_MOD, " adding message element %d %d %d - %s",
|
||||
cw_dbg(DBG_MOD_DETAIL, " adding message element %d %d %d - %s",
|
||||
elemdef->proto,
|
||||
elemdef->vendor, elemdef->id, handler->name);
|
||||
} else {
|
||||
cw_dbg(DBG_MOD, " replacing message element %d %d %d - %s",
|
||||
cw_dbg(DBG_MOD_DETAIL, " replacing message element %d %d %d - %s",
|
||||
elemdef->proto,
|
||||
elemdef->vendor, elemdef->id, handler->name);
|
||||
}
|
||||
@ -275,7 +275,7 @@ static int update_msgdata(struct cw_MsgSet *set, struct cw_MsgData *msgdata,
|
||||
result->vendor, result->id);
|
||||
if (result->mand){
|
||||
mlist_append_ptr(msgdata->mand_keys,(void*)handler->key);
|
||||
cw_dbg(DBG_MOD," Add mandatory key: %s",handler->key);
|
||||
cw_dbg(DBG_MOD_DETAIL," Add mandatory key: %s",handler->key);
|
||||
}
|
||||
/*//printf("Have Result %d %d - %s\n",result->id,result->mand, handler->key);*/
|
||||
}
|
||||
@ -294,7 +294,7 @@ int cw_msgset_add(struct cw_MsgSet *set,
|
||||
struct cw_MsgDef *msgdef;
|
||||
/* Create mavl for all handlers */
|
||||
for (handler = handlers; handler->id; handler++) {
|
||||
cw_dbg(DBG_MOD, "Adding handler for element %d - %s - with key: %s",
|
||||
cw_dbg(DBG_MOD_DETAIL, "Adding handler for element %d - %s - with key: %s",
|
||||
handler->id, handler->name, handler->key);
|
||||
mavl_replace(set->handlers_by_id, handler, NULL);
|
||||
mavl_replace(set->handlers_by_key, handler, NULL);
|
||||
@ -339,7 +339,7 @@ int cw_msgset_add(struct cw_MsgSet *set,
|
||||
msg->receiver = msgdef->receiver;
|
||||
|
||||
|
||||
cw_dbg(DBG_MOD, "Add message Type:%d - %s ", msgdef->type, msgdef->name);
|
||||
cw_dbg(DBG_MOD_DETAIL, "Add message Type:%d - %s ", msgdef->type, msgdef->name);
|
||||
|
||||
|
||||
update_msgdata(set, msg, msgdef);
|
||||
@ -376,7 +376,7 @@ int cw_msgset_add_states(struct cw_MsgSet * set, cw_StateMachineState_t * states
|
||||
else{
|
||||
repstr = "Adding";
|
||||
}
|
||||
cw_dbg(DBG_MOD,"%s machine state : [%s->%s]",repstr,
|
||||
cw_dbg(DBG_MOD_DETAIL,"%s machine state : [%s->%s]",repstr,
|
||||
cw_strstate(s->prevstate),
|
||||
cw_strstate(s->state));
|
||||
s++;
|
||||
|
10
src/cw/val.h
10
src/cw/val.h
@ -157,6 +157,7 @@ extern const struct cw_Type cw_type_ipaddress;
|
||||
extern const struct cw_Type cw_type_sysptr;
|
||||
extern const struct cw_Type cw_type_bool;
|
||||
extern const struct cw_Type cw_type_struct;
|
||||
extern const struct cw_Type cw_type_array;
|
||||
|
||||
#define CW_TYPE_BYTE (&cw_type_byte)
|
||||
#define CW_TYPE_WORD (&cw_type_word)
|
||||
@ -168,6 +169,15 @@ extern const struct cw_Type cw_type_struct;
|
||||
#define CW_TYPE_STR (&cw_type_str)
|
||||
#define CW_TYPE_BOOL (&cw_type_bool)
|
||||
#define CW_TYPE_STRUCT (&cw_type_struct)
|
||||
#define CW_TYPE_ARRAY (&cw_type_array)
|
||||
|
||||
struct cw_ValArrayDef{
|
||||
void * get_count;
|
||||
void * put_count;
|
||||
const struct cw_Type * type;
|
||||
void *param;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
void cw_kvstore_mavl_delete(const void *data);
|
||||
|
@ -28,6 +28,20 @@ static cw_ValStruct_t capwap80211_antenna_stru[]={
|
||||
};
|
||||
|
||||
|
||||
static cw_ValStruct_t capwap80211_wtp_radio_cfg_stru[]={
|
||||
{CW_TYPE_BYTE,"short-preamble",1,-1},
|
||||
{CW_TYPE_BYTE,"num-of-bssids",1,-1},
|
||||
{CW_TYPE_BYTE,"dtim-period",1,-1},
|
||||
{CW_TYPE_BSTR16,"bssid",6,-1},
|
||||
{CW_TYPE_WORD,"beacon-period",2,-1},
|
||||
{CW_TYPE_STR,"country-string",2,-1,},
|
||||
{CW_TYPE_BSTR16,"country-string-attr",1,-1,},
|
||||
{CW_TYPE_BYTE,"country-string-reserved",1,-1,},
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static struct cw_ElemHandler handlers[] = {
|
||||
{
|
||||
"IEEE 802.11 WTP Radio Information", /* name */
|
||||
@ -66,6 +80,22 @@ static struct cw_ElemHandler handlers[] = {
|
||||
|
||||
}
|
||||
,
|
||||
|
||||
{
|
||||
"IEEE 802.11 WTP Radio Configuration", /* name */
|
||||
CAPWAP80211_ELEM_WTP_RADIO_CONFIGURATION, /* Element ID */
|
||||
0, 0, /* Vendor / Proto */
|
||||
16, 16, /* min/max length */
|
||||
CW_TYPE_STRUCT, /* type */
|
||||
"capwap80211/wtp-radio-config", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic, /* put */
|
||||
NULL,
|
||||
NULL,
|
||||
capwap80211_wtp_radio_cfg_stru
|
||||
|
||||
},
|
||||
|
||||
{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL}
|
||||
|
||||
};
|
||||
|
@ -306,8 +306,10 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
|
||||
if(result->type->len(result)==4){
|
||||
uint32_t rv;
|
||||
rv = cw_get_dword(result->type->data(result));
|
||||
//cw_dbg(DBG_X,"Version is %08X",rv);
|
||||
if (rv >= 0x07056600){
|
||||
cw_dbg(DBG_X,"Version is %08X",rv);
|
||||
//stop();
|
||||
// if (rv >= 0x07056600){
|
||||
if (rv > 0x07036500){
|
||||
type = cisco_ap_regulatory_domain5;
|
||||
}
|
||||
else{
|
||||
@ -371,7 +373,47 @@ static cw_ValStruct_t cisco_direct_sequence_control70[]={
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
|
||||
|
||||
static int get_num_antennas70(cw_Cfg_t *cfg,
|
||||
const char * key, const uint8_t *src, int len, const void *param, int *l)
|
||||
{
|
||||
*l=0;
|
||||
return cw_get_byte(src-4);
|
||||
};
|
||||
|
||||
static int put_num_antennas70(cw_Cfg_t *cfg,
|
||||
const char * key, uint8_t *dst, const void *param, int l)
|
||||
{
|
||||
return cw_put_byte((dst-4),l);
|
||||
};
|
||||
|
||||
static cw_ValValRange_t antenna_type[]={
|
||||
{1,1,"1 - Internal Antenna"},
|
||||
{2,2,"2 - External Antenna"},
|
||||
{0,0,NULL}
|
||||
};
|
||||
|
||||
|
||||
struct cw_ValArrayDef ant_array = {
|
||||
get_num_antennas70,
|
||||
put_num_antennas70,
|
||||
CW_TYPE_BYTE,
|
||||
&antenna_type
|
||||
};
|
||||
|
||||
static cw_ValStruct_t cisco_antenna_payload70[]={
|
||||
{CW_TYPE_BYTE,"diversity-selection",1,-1},
|
||||
{CW_TYPE_BYTE,"antenna-mode",1,-1},
|
||||
{CW_TYPE_BYTE,"antenna-cnt",1,-1},
|
||||
{CW_TYPE_BYTE,"unknown",1,-1},
|
||||
{CW_TYPE_BYTE,"802-11n-tx-antennas",1,-1},
|
||||
{CW_TYPE_BYTE,"802-11n-rx-antennas",1,-1},
|
||||
{CW_TYPE_ARRAY,"antenna",-1,-1,&ant_array},
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
|
||||
/*
|
||||
static cw_ValStruct_t cisco_antenna_payload73[]={
|
||||
{CW_TYPE_BYTE,"diversity-selection",1,-1},
|
||||
{CW_TYPE_BYTE,"antenna-mode",1,-1},
|
||||
{CW_TYPE_BYTE,"number-of-antennas",1,-1},
|
||||
@ -383,6 +425,11 @@ static cw_ValStruct_t cisco_antenna_payload70[]={
|
||||
{CW_TYPE_BYTE,"antenna-2",1,-1},
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static cw_ValStruct_t cisco_wtp_radio_config70[]={
|
||||
@ -390,7 +437,7 @@ static cw_ValStruct_t cisco_wtp_radio_config70[]={
|
||||
{CW_TYPE_WORD,"occupancy-limit",2,-1},
|
||||
{CW_TYPE_BYTE,"cfg-period",1,-1},
|
||||
{CW_TYPE_WORD,"cfp-maximum-duration",2,-1},
|
||||
{CW_TYPE_BSTR16,"bss-id",6,-1},
|
||||
{CW_TYPE_BSTR16,"bssid",6,-1},
|
||||
{CW_TYPE_WORD,"beacon-period",2,-1},
|
||||
{CW_TYPE_STR,"country-str1",3,-1},
|
||||
{CW_TYPE_STR,"country-str2",3,-1},
|
||||
@ -403,17 +450,18 @@ static cw_ValStruct_t cisco_wtp_radio_config70[]={
|
||||
|
||||
|
||||
static cw_ValStruct_t cisco_wtp_radio_config73[]={
|
||||
{CW_TYPE_BYTE,"cfg-type",1,-1},
|
||||
{CW_TYPE_WORD,"occupancy-limit",2,-1},
|
||||
{CW_TYPE_BYTE,"cfg-period",1,-1},
|
||||
{CW_TYPE_WORD,"cfp-maximum-duration",2,-1},
|
||||
{CW_TYPE_BSTR16,"bss-id",6,-1},
|
||||
{CW_TYPE_BYTE,"@cisco/cfg-type",1,-1,cfg_type},
|
||||
{CW_TYPE_WORD,"@cisco/occupancy-limit",2,-1},
|
||||
{CW_TYPE_BYTE,"@cisco/cfg-period",1,-1},
|
||||
{CW_TYPE_WORD,"@cisco/cfp-maximum-duration",2,-1},
|
||||
{CW_TYPE_BSTR16,"bssid",6,-1},
|
||||
{CW_TYPE_WORD,"beacon-period",2,-1},
|
||||
{CW_TYPE_STR,"country-str1",3,-1},
|
||||
{CW_TYPE_STR,"country-str2",3,-1},
|
||||
{CW_TYPE_BYTE,"gpr-period",1,-1},
|
||||
{CW_TYPE_DWORD,"reg",4,-1},
|
||||
{CW_TYPE_BYTE,"max-stations",1,-1},
|
||||
{CW_TYPE_STR,"@cisco/country-string",3,-1},
|
||||
{CW_TYPE_STR,"country-string",2,-1},
|
||||
{CW_TYPE_BSTR16,"country-string-attr",1,-1},
|
||||
{CW_TYPE_BYTE,"@cisco/gpr-period",1,-1},
|
||||
{CW_TYPE_DWORD,"@cisco/reg",4,-1},
|
||||
{CW_TYPE_BYTE,"@cisco/max-stations",1,-1},
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
|
||||
@ -1326,7 +1374,7 @@ static struct cw_ElemHandler handlers70[] = {
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
25,25, /* min/max length */
|
||||
CW_TYPE_STRUCT, /* type */
|
||||
"cisco/wtp-radio-config", /* Key */
|
||||
"capwap80211/wtp-radio-config", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic, /* put */
|
||||
NULL,
|
||||
@ -1358,7 +1406,7 @@ static struct cw_ElemHandler handlers70[] = {
|
||||
"Antenna Payload (v7.0)", /* name */
|
||||
CW_CISCO_ANTENNA_PAYLOAD, /* Element ID */
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
9,9, /* min/max length */
|
||||
9,100, /* min/max length */
|
||||
CW_TYPE_STRUCT, /* type */
|
||||
"cisco/antenna-payload", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
@ -1480,7 +1528,7 @@ static struct cw_ElemHandler handlers70[] = {
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
1,1024, /* min/max length */
|
||||
CW_TYPE_STRUCT, /* type */
|
||||
"cisco/elem15", /* Key */
|
||||
"cisco/channel-setting", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic, /* put */
|
||||
NULL,
|
||||
@ -2413,6 +2461,10 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
|
||||
|
||||
/*static uint16_t configuration_update_request_states[] = {CAPWAP_STATE_RUN,0};*/
|
||||
static struct cw_ElemDef configuration_update_request_elements[] ={
|
||||
|
||||
{0, 0, CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 0, 0},
|
||||
{0, 0, CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, 0, 0},
|
||||
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_15, 0, 0},
|
||||
@ -2740,9 +2792,9 @@ static struct cw_ElemHandler handlers73[] = {
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
27,27, /* min/max length */
|
||||
CW_TYPE_STRUCT, /* type */
|
||||
"cisco/wtp-radio-config", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic, /* put */
|
||||
"capwap80211/wtp-radio-config", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic, /* put */
|
||||
NULL,
|
||||
NULL,
|
||||
cisco_wtp_radio_config73,
|
||||
@ -2776,7 +2828,7 @@ static struct cw_ElemHandler handlers75[] = {
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
28,28, /* min/max length */
|
||||
CW_TYPE_STRUCT, /* type */
|
||||
"cisco/wtp-radio-config", /* Key */
|
||||
"capwap80211/wtp-radio-config", /* Key */
|
||||
cw_in_radio_generic, /* get */
|
||||
cw_out_radio_generic, /* put */
|
||||
NULL,
|
||||
@ -2848,6 +2900,24 @@ struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||
return set;
|
||||
}
|
||||
|
||||
static void update_msgset(struct cw_MsgSet *msgset, bstr_t version)
|
||||
{
|
||||
if(bstr16_len(version)==4){
|
||||
uint32_t rv;
|
||||
rv = cw_get_dword(bstr16_data(version));
|
||||
|
||||
if (rv >= 0x07030000){
|
||||
cw_dbg(DBG_MOD, "CISCO - Loading messages for 0x%08X >= 0x07030000", rv);
|
||||
cw_msgset_add(msgset,messages73, handlers73);
|
||||
}
|
||||
if (rv >= 0x07056600){
|
||||
cw_dbg(DBG_MOD, "CISCO - Loading messages for 0x.x%08X >= 0x07056600", rv);
|
||||
cw_msgset_add(msgset,messages75, handlers75);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void set_ac_version(struct cw_ElemHandlerParams * params)
|
||||
@ -2864,23 +2934,11 @@ static void set_ac_version(struct cw_ElemHandlerParams * params)
|
||||
cw_cfg_set_bstr16(params->conn->local_cfg,"capwap/ac-descriptor/software/version",wtpver);
|
||||
cw_cfg_set_int(params->conn->local_cfg,"capwap/ac-descriptor/software/vendor",CW_VENDOR_ID_CISCO);
|
||||
|
||||
if(bstr16_len(wtpver)==4){
|
||||
uint32_t rv;
|
||||
rv = cw_get_dword(bstr16_data(wtpver));
|
||||
|
||||
if (rv >= 0x07030000){
|
||||
cw_msgset_add(params->msgset,messages73, handlers73);
|
||||
}
|
||||
if (rv >= 0x07056600){
|
||||
cw_msgset_add(params->msgset,messages75, handlers75);
|
||||
}
|
||||
}
|
||||
|
||||
update_msgset(params->msgset,wtpver);
|
||||
free(wtpver);
|
||||
}
|
||||
|
||||
static int postprocess_discovery(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
|
||||
//static int postprocess_discovery(struct cw_Conn *conn)
|
||||
{
|
||||
if (params->conn->role == CW_ROLE_AC ){
|
||||
set_ac_version(params);
|
||||
@ -2890,7 +2948,6 @@ static int postprocess_discovery(struct cw_ElemHandlerParams * params, uint8_t *
|
||||
}
|
||||
|
||||
static int postprocess_join_request(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
|
||||
//static int postprocess_join_request(struct cw_Conn *conn)
|
||||
{
|
||||
if (postprocess_join_request_parent!=NULL){
|
||||
postprocess_join_request_parent(params,elems_ptr,elems_len);
|
||||
@ -2908,13 +2965,14 @@ static int preprocess_join_request(struct cw_Conn *conn)
|
||||
if (conn->role != CW_ROLE_WTP)
|
||||
return 0;
|
||||
|
||||
use_ac_version = cw_cfg_get_bool(conn->global_cfg,"cisco/wtp-use-ac-version",0);
|
||||
use_ac_version = cw_cfg_get_bool(conn->global_cfg,"mod/cisco/wtp-use-ac-version",0);
|
||||
if (use_ac_version){
|
||||
ver = cw_cfg_get_bstr16(conn->remote_cfg,"capwap/ac-descriptor/software/version",NULL );
|
||||
if (ver != NULL){
|
||||
cw_cfg_set_bstr16(conn->local_cfg,"capwap/wtp-descriptor/software/version",ver);
|
||||
cw_format_version(verstr,bstr16_data(ver),bstr16_len(ver));
|
||||
cw_dbg(DBG_INFO, "Cisco WTP - Using AC's software version: %s", verstr);
|
||||
cw_dbg(DBG_MOD, "CISCO WTP - Using AC's software version: %s", verstr);
|
||||
update_msgset(conn->msgset,ver);
|
||||
free(ver);
|
||||
}
|
||||
else{
|
||||
@ -2922,33 +2980,5 @@ static int preprocess_join_request(struct cw_Conn *conn)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// stop();
|
||||
|
||||
/*
|
||||
|
||||
if (use_ac_version){
|
||||
ver = cw_ktv_get(conn->remote_cfg,"ac-descriptor/software/version", CW_TYPE_BSTR16);
|
||||
cw_ktv_replace(conn->local_cfg,"wtp-descriptor/software/version",CW_TYPE_BSTR16, NULL,
|
||||
ver->type->data(ver),ver->type->len(ver));
|
||||
|
||||
cw_format_version(verstr,ver->type->data(ver),ver->type->len(ver));
|
||||
cw_dbg(DBG_INFO, "Cisco WTP - Using AC's software version: %s", verstr);
|
||||
|
||||
}
|
||||
else{
|
||||
ver = cw_ktv_get(conn->local_cfg,"wtp-descriptor/software/version", CW_TYPE_BSTR16);
|
||||
cw_format_version(verstr,ver->type->data(ver),ver->type->len(ver));
|
||||
cw_dbg(DBG_INFO, "Cisco - WTP Using own software version: %s", verstr);
|
||||
}
|
||||
|
||||
if(ver->type->len(ver)==4){
|
||||
uint32_t rv;
|
||||
rv = cw_get_dword(ver->type->data(ver));
|
||||
if (rv >= 0x07056600){
|
||||
cw_msgset_add(conn->msgset,messages75, handlers75);
|
||||
}
|
||||
}
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
|
||||
static int init(struct cw_Mod *mod, cw_Cfg_t * global_cfg, int role)
|
||||
{
|
||||
/* uint8_t * str;*/
|
||||
static char * hardware_version; /*strdup(".x01000001");*/
|
||||
static char * software_version; /* = NULL; */
|
||||
// static char * hardware_version; /*strdup(".x01000001");* /
|
||||
// static char * software_version; /* = NULL; * /
|
||||
/* cfg_t *cfg;*/
|
||||
|
||||
int rc = 1;
|
||||
@ -120,12 +120,15 @@ static int init(struct cw_Mod *mod, cw_Cfg_t * global_cfg, int role)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cw_dbg(DBG_MOD, "CISCO: Loading base module: capwap80211");
|
||||
capwap80211_mod = cw_mod_load("capwap80211", global_cfg,role);
|
||||
if (capwap_mod == NULL){
|
||||
cw_log(LOG_ERR, "CISCO: failed to load base module 'capwap80211");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cw_dbg(DBG_MOD, "CISCO: All base modules are sucessfully loaded.");
|
||||
|
||||
/*cisco_config = mbag_create();*/
|
||||
|
||||
|
||||
@ -164,10 +167,10 @@ static int init(struct cw_Mod *mod, cw_Cfg_t * global_cfg, int role)
|
||||
}
|
||||
*/
|
||||
/*errX:*/
|
||||
if (hardware_version)
|
||||
/* if (hardware_version)
|
||||
free (hardware_version);
|
||||
if (software_version)
|
||||
free(software_version);
|
||||
free(software_version);*/
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,10 @@ int main (int argc, char **argv)
|
||||
bootcfg.nmods=2;
|
||||
}
|
||||
|
||||
cw_dbg_set_level(DBG_X,0);
|
||||
/*
|
||||
* set ths for production
|
||||
* cw_dbg_set_level(DBG_X,0);
|
||||
* */
|
||||
|
||||
|
||||
/* create an empty message set */
|
||||
|
@ -7,7 +7,7 @@ then
|
||||
fi
|
||||
|
||||
|
||||
#echo clock set $(date "+%H:%M:%S %d %b %Y")
|
||||
echo clock set $(date "+%H:%M:%S %d %b %Y")
|
||||
echo debug capwap console cli
|
||||
echo configure terminal
|
||||
echo crypto ca profile enrollment ACTube
|
||||
|
Loading…
Reference in New Issue
Block a user