Compare commits
No commits in common. "a2e8e77468bb54b914dc7ccf0c64088a935f9e12" and "15d0205f899251a5f23610ceaf12d43eac3f936b" have entirely different histories.
a2e8e77468
...
15d0205f89
@ -1,5 +1,5 @@
|
|||||||
#include ../Config.default.mak
|
#include ../Config.default.mak
|
||||||
#-include ../Config.mak
|
-include ../Config.mak
|
||||||
include ../Defs.mak
|
include ../Defs.mak
|
||||||
|
|
||||||
OBJS = \
|
OBJS = \
|
||||||
@ -23,10 +23,10 @@ LIBS+=-lconfuse
|
|||||||
LIBS+=-lsqlite3
|
LIBS+=-lsqlite3
|
||||||
LIBS+=-lc
|
LIBS+=-lc
|
||||||
LIBS+=-lnettle
|
LIBS+=-lnettle
|
||||||
LIBS+=-lssl
|
|
||||||
LIBS+=$(OPENSSL_LIBS)
|
LIBS+=$(OPENSSL_LIBS)
|
||||||
|
|
||||||
INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include
|
|
||||||
|
INCL_DIRS=-I../ -I/usr/local/include -I./ -I/home/tube/v/rsrch/libmavl/
|
||||||
#FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX"
|
#FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX"
|
||||||
FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(ARCH)"'
|
FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(ARCH)"'
|
||||||
|
|
||||||
|
@ -197,31 +197,31 @@ ssl_cert="../../ssl/certs/ac-xcisco.pem"
|
|||||||
# dbg
|
# dbg
|
||||||
# Set debug level
|
# Set debug level
|
||||||
#
|
#
|
||||||
# dbg = info # Show all kind of infos
|
dbg = info # Show all kind of infos
|
||||||
# dbg += all
|
# dbg += all
|
||||||
# dbg += msg_in # Incomming CAPWAP messages
|
dbg += msg_in # Incomming CAPWAP messages
|
||||||
# dbg += msg_out # Outgoing CAPWAP messages
|
dbg += msg_out # Outgoing CAPWAP messages
|
||||||
# dbg += msg_err # Be verbose about capwap message errors like re-transmission
|
dbg += msg_err # Be verbose about capwap message errors like re-transmission
|
||||||
# dbg += msg_dmp
|
dbg += msg_dmp
|
||||||
# dbg += elem_in # CAPWAP message elements
|
dbg += elem_in # CAPWAP message elements
|
||||||
# dbg += elem_out
|
dbg += elem_out
|
||||||
# dbg += subelem #
|
dbg += subelem #
|
||||||
# dbg += elem_err # Errors in message elements
|
dbg += elem_err # Errors in message elements
|
||||||
# dbg += elem_dmp # Print hex dump for capwap messages elements
|
dbg += elem_dmp # Print hex dump for capwap messages elements
|
||||||
# dbg += rfc # Show warnings if CAPWAP messages don't conform to RFC
|
dbg += rfc # Show warnings if CAPWAP messages don't conform to RFC
|
||||||
# dbg += pkt_in # CAPWAP packets received
|
dbg += pkt_in # CAPWAP packets received
|
||||||
# dbg += pkt_out # CAPWAP packets sent
|
dbg += pkt_out # CAPWAP packets sent
|
||||||
# dbg += pkt # CAPWAP packets both sent and received
|
dbg += pkt # CAPWAP packets both sent and received
|
||||||
# dbg += pkt_dmp # Hex dump CAPWAP packets.
|
dbg += pkt_dmp # Hex dump CAPWAP packets.
|
||||||
# dbg += pkt_err # Show messages about malformed packets when detected
|
dbg += pkt_err # Show messages about malformed packets when detected
|
||||||
# dbg += dtls # Messages concerning DTLS
|
dbg += dtls # Messages concerning DTLS
|
||||||
# dbg += dtls_detail # DTLS in more detail
|
# dbg += dtls_detail # DTLS in more detail
|
||||||
# dbg += dtls_bio # DTLS BIO operations
|
dbg += dtls_bio # DTLS BIO operations
|
||||||
# dbg += dtls_bio_dmp # HeXy dump data in BIO operations
|
# dbg += dtls_bio_dmp # HeXy dump data in BIO operations
|
||||||
# dbg += warn # misc warnings
|
dbg += warn # misc warnings
|
||||||
# dbg = mod # Debugs specific to mod
|
dbg += mod # Debugs specific to mod
|
||||||
# dbg += cfg_dmp
|
dbg += cfg_dmp
|
||||||
# dbg += state
|
dbg += state
|
||||||
#
|
#
|
||||||
# dbg += all # all of the above
|
# dbg += all # all of the above
|
||||||
# dbg += err # Same as dbg_err and pkt_err
|
# dbg += err # Same as dbg_err and pkt_err
|
||||||
@ -239,7 +239,7 @@ ssl_cert="../../ssl/certs/ac-xcisco.pem"
|
|||||||
#
|
#
|
||||||
|
|
||||||
#mods = { cisco, capwap }
|
#mods = { cisco, capwap }
|
||||||
mods = { cisco,capwap, capwap80211 }
|
mods = { cisco, capwap, capwap80211 }
|
||||||
#, capwap80211 }
|
#, capwap80211 }
|
||||||
|
|
||||||
mods_dir = ../../lib/Linux/x86_64/
|
mods_dir = ../../lib/Linux/x86_64/
|
||||||
|
144
src/ac/ac_main.c
144
src/ac/ac_main.c
@ -46,11 +46,21 @@
|
|||||||
|
|
||||||
#include "dataman.h"
|
#include "dataman.h"
|
||||||
|
|
||||||
#include "cw/cfg.h"
|
|
||||||
|
|
||||||
int ac_run();
|
int ac_run();
|
||||||
|
|
||||||
|
|
||||||
|
static void *alive_thread (void *data)
|
||||||
|
{
|
||||||
|
/* Ping the database every 5 seconds */
|
||||||
|
while (1) {
|
||||||
|
sleep (5);
|
||||||
|
db_ping();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
|
|
||||||
@ -126,6 +136,70 @@ extern void test_sets();
|
|||||||
#include "cw/ktv.h"
|
#include "cw/ktv.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct mykv {
|
||||||
|
int key;
|
||||||
|
int value;
|
||||||
|
};
|
||||||
|
|
||||||
|
int mycmp (void *e1, void *e2)
|
||||||
|
{
|
||||||
|
struct mykv * k1 = e1;
|
||||||
|
struct mykv * k2 = e2;
|
||||||
|
|
||||||
|
/*//printf("My CMP: %d and %d\n", k1->key, k2->key);
|
||||||
|
*/
|
||||||
|
if (k1->key > k2->key)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (k1->key < k2->key)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void mavl_walk (struct mavlnode * node)
|
||||||
|
{
|
||||||
|
struct mykv * kv;
|
||||||
|
|
||||||
|
if (!node) {
|
||||||
|
printf ("\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kv = mavlnode_dataptr (node);
|
||||||
|
printf ("KV %d\n", kv->key);
|
||||||
|
|
||||||
|
printf ("go left:");
|
||||||
|
mavl_walk (node->left);
|
||||||
|
printf ("go right:");
|
||||||
|
mavl_walk (node->right);
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
int stcmp (const void * sa1, const void *sa2)
|
||||||
|
{
|
||||||
|
const char **s1 = sa1;
|
||||||
|
const char **s2 = sa2;
|
||||||
|
int rc;
|
||||||
|
rc = strcmp (*s1, *s2);
|
||||||
|
|
||||||
|
printf ("CMP %s, %s = %d\n", *s1, *s2, rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
static int ibcmp(const void *v1, const void *v2)
|
||||||
|
{
|
||||||
|
int *i1,*i2;
|
||||||
|
i1=v1;i2=v2;
|
||||||
|
|
||||||
|
return *i1-*i2;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#include "discovery_cache.h"
|
#include "discovery_cache.h"
|
||||||
void tester1()
|
void tester1()
|
||||||
{
|
{
|
||||||
@ -151,44 +225,6 @@ void tester1()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void show_cfg (FILE *out, mavl_t ktv)
|
|
||||||
{
|
|
||||||
char value[500];
|
|
||||||
struct cw_KTV * data;
|
|
||||||
mavliter_t it;
|
|
||||||
const struct cw_Type * type;
|
|
||||||
|
|
||||||
|
|
||||||
mavliter_init(&it,ktv);
|
|
||||||
|
|
||||||
mavliter_foreach(&it){
|
|
||||||
|
|
||||||
data = mavliter_get(&it);
|
|
||||||
type = data->type;
|
|
||||||
type->to_str(data,value,0);
|
|
||||||
|
|
||||||
fprintf(out,"%s :%s: %s\n",data->key,type->get_type_name(data), value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
cw_Cfg_t * cfg;
|
|
||||||
cfg=cw_cfg_create();
|
|
||||||
|
|
||||||
cw_cfg_load("tube.akv",cfg);
|
|
||||||
|
|
||||||
// cw_cfg_set(cfg,"cisco/tube","99");
|
|
||||||
// cw_cfg_set(cfg,"Hello","30");
|
|
||||||
|
|
||||||
cw_cfg_dump(cfg);
|
|
||||||
mavl_destroy(cfg);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -196,9 +232,7 @@ int main (int argc, char *argv[])
|
|||||||
FILE * file;
|
FILE * file;
|
||||||
mavl_t types_tree, global_cfg;
|
mavl_t types_tree, global_cfg;
|
||||||
const cw_Type_t **ti;
|
const cw_Type_t **ti;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* parse arguments */
|
/* parse arguments */
|
||||||
parse_args (argc, argv, &bootcfg);
|
parse_args (argc, argv, &bootcfg);
|
||||||
@ -211,7 +245,6 @@ int main (int argc, char *argv[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* create types tree with default types */
|
/* create types tree with default types */
|
||||||
types_tree = cw_ktv_create_types_tree();
|
types_tree = cw_ktv_create_types_tree();
|
||||||
for (ti=CW_KTV_STD_TYPES;*ti;ti++){
|
for (ti=CW_KTV_STD_TYPES;*ti;ti++){
|
||||||
@ -228,18 +261,28 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
|
|
||||||
actube_global_cfg = global_cfg;
|
actube_global_cfg = global_cfg;
|
||||||
|
|
||||||
|
/* cw_dbg_opt_level=0xffffffff;*/
|
||||||
|
cw_dbg(DBG_INFO,"Hello world");
|
||||||
|
|
||||||
|
|
||||||
cw_dbg_ktv_dump(global_cfg,DBG_INFO,NULL,"CFG:",NULL);
|
cw_dbg_ktv_dump(global_cfg,DBG_INFO,NULL,"CFG:",NULL);
|
||||||
|
|
||||||
|
/* int idx;
|
||||||
|
idx = cw_ktv_idx_get(global_cfg,"capwap-control-ip-address/address",0,CW_TYPE_IPADDRESS);
|
||||||
|
printf("IDX: %d\n");
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
*/
|
||||||
cw_log_name = "AC-Tube";
|
cw_log_name = "AC-Tube";
|
||||||
|
|
||||||
if (!read_config ("ac.conf"))
|
if (!read_config ("ac.conf"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
start_shell();
|
start_shell();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Show debug options if there are any set */
|
/* Show debug options if there are any set */
|
||||||
@ -247,7 +290,7 @@ int main (int argc, char *argv[])
|
|||||||
cw_log (LOG_INFO, "Debug Options: %08X", cw_dbg_opt_level);
|
cw_log (LOG_INFO, "Debug Options: %08X", cw_dbg_opt_level);
|
||||||
|
|
||||||
/* XXX Hard coded debug settigns, set it by config in the future */
|
/* XXX Hard coded debug settigns, set it by config in the future */
|
||||||
// cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
||||||
|
|
||||||
/* Warn, if the "secret" debugging feature for
|
/* Warn, if the "secret" debugging feature for
|
||||||
developers is turned on ;) */
|
developers is turned on ;) */
|
||||||
@ -274,7 +317,12 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
db_ping();
|
db_ping();
|
||||||
|
|
||||||
|
|
||||||
|
/* Start a database "pinger thread", which inserts
|
||||||
|
every xx seconds a timestamp into the DB */
|
||||||
|
pthread_t alth;
|
||||||
|
pthread_create (&alth, NULL, alive_thread, NULL);
|
||||||
|
|
||||||
/* Init DTLS library */
|
/* Init DTLS library */
|
||||||
dtls_init();
|
dtls_init();
|
||||||
|
|
||||||
|
@ -197,6 +197,48 @@ static int init_vendor_id()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static int init_version()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Init hardware version
|
||||||
|
if (!conf_hardware_version) {
|
||||||
|
struct utsname u;
|
||||||
|
int rc = uname(&u);
|
||||||
|
if (rc < 0)
|
||||||
|
conf_hardware_version =
|
||||||
|
(bstr_t) strdup(CONF_DEFAULT_HARDWARE_VERSION);
|
||||||
|
else {
|
||||||
|
char str[265];
|
||||||
|
sprintf(str, "%s / %s %s", u.machine, u.sysname, u.release);
|
||||||
|
conf_hardware_version = (bstr_t) strdup(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
bstr_replace(&conf_hardware_version,
|
||||||
|
bstr_create_from_cfgstr((char *) conf_hardware_version));
|
||||||
|
|
||||||
|
// software version
|
||||||
|
if (!conf_software_version)
|
||||||
|
conf_software_version = (bstr_t) strdup(CONF_DEFAULT_SOFTWARE_VERSION);
|
||||||
|
bstr_replace(&conf_software_version,
|
||||||
|
bstr_create_from_cfgstr((char *) conf_software_version));
|
||||||
|
|
||||||
|
|
||||||
|
// Cisco hardware version
|
||||||
|
if (!conf_cisco_hardware_version)
|
||||||
|
conf_cisco_hardware_version =
|
||||||
|
(bstr_t) strdup(CONF_DEFAULT_CISCO_HARDWARE_VERSION);
|
||||||
|
bstr_replace(&conf_cisco_hardware_version,
|
||||||
|
bstr_create_from_cfgstr((char *) conf_cisco_hardware_version));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static int init_control_port()
|
static int init_control_port()
|
||||||
{
|
{
|
||||||
char str[30];
|
char str[30];
|
||||||
@ -239,8 +281,10 @@ static int init_listen_addrs()
|
|||||||
|
|
||||||
if (ifa->ifa_addr->sa_family == AF_INET && conf_ipv4)
|
if (ifa->ifa_addr->sa_family == AF_INET && conf_ipv4)
|
||||||
ctr++;
|
ctr++;
|
||||||
|
#ifdef WITH_IPV6
|
||||||
if (ifa->ifa_addr->sa_family == AF_INET6 && conf_ipv6)
|
if (ifa->ifa_addr->sa_family == AF_INET6 && conf_ipv6)
|
||||||
ctr++;
|
ctr++;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
conf_listen_addrs = malloc(sizeof(char *) * ctr);
|
conf_listen_addrs = malloc(sizeof(char *) * ctr);
|
||||||
@ -493,6 +537,14 @@ static int conf_read_strings(cfg_t * cfg, char *name, char ***dst, int *len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct conf_dbg_level_names{
|
||||||
|
const char *name;
|
||||||
|
int level;
|
||||||
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static int conf_read_dbg_level(cfg_t * cfg)
|
static int conf_read_dbg_level(cfg_t * cfg)
|
||||||
{
|
{
|
||||||
@ -519,7 +571,6 @@ char *conf_mods_dir = NULL;
|
|||||||
* Read the module names from config file
|
* Read the module names from config file
|
||||||
*/
|
*/
|
||||||
static int conf_read_mods(cfg_t *cfg){
|
static int conf_read_mods(cfg_t *cfg){
|
||||||
|
|
||||||
int n, i;
|
int n, i;
|
||||||
n = cfg_size(cfg,CFG_ENTRY_MODS);
|
n = cfg_size(cfg,CFG_ENTRY_MODS);
|
||||||
|
|
||||||
@ -539,6 +590,24 @@ static int conf_read_mods(cfg_t *cfg){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void conf_init_capwap_mode()
|
||||||
|
{
|
||||||
|
if (conf_capwap_mode_str == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (0 == strcmp(conf_capwap_mode_str, "cipwap")) {
|
||||||
|
conf_capwap_mode = CW_MODE_CIPWAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == strcmp(conf_capwap_mode_str, "capwap")) {
|
||||||
|
conf_capwap_mode = CW_MODE_CAPWAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
int conf_parse_listen_addr(const char *addrstr, char *saddr, char *port, int *proto)
|
int conf_parse_listen_addr(const char *addrstr, char *saddr, char *port, int *proto)
|
||||||
{
|
{
|
||||||
@ -690,7 +759,7 @@ int read_config(const char *filename)
|
|||||||
cfg_t *cfg;
|
cfg_t *cfg;
|
||||||
|
|
||||||
conf_mods_dir=cw_strdup("");
|
conf_mods_dir=cw_strdup("");
|
||||||
|
|
||||||
if (!init_control_port())
|
if (!init_control_port())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -731,8 +800,7 @@ int read_config(const char *filename)
|
|||||||
perror(str);
|
perror(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!conf_read_mods(cfg)){
|
if (!conf_read_mods(cfg)){
|
||||||
cfg_free(cfg);
|
cfg_free(cfg);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -32,7 +32,6 @@ void ucfg_cmd(struct shelldata *sd, const char * cmd);
|
|||||||
void set_cmd(struct shelldata *sd, const char * cmd);
|
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 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);
|
||||||
|
|
||||||
@ -51,7 +50,6 @@ static struct command cmdlist[]={
|
|||||||
{"select", select_cmd },
|
{"select", select_cmd },
|
||||||
{"send", send_cmd},
|
{"send", send_cmd},
|
||||||
{"set", set_cmd },
|
{"set", set_cmd },
|
||||||
{"wlan0",wlan0_cmd},
|
|
||||||
|
|
||||||
|
|
||||||
{NULL,NULL}
|
{NULL,NULL}
|
||||||
@ -108,25 +106,6 @@ send_cmd(struct shelldata * sd, const char *cmd)
|
|||||||
wtplist_unlock();
|
wtplist_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
wlan0_cmd(struct shelldata * sd, const char *cmd)
|
|
||||||
{
|
|
||||||
struct conn * conn;
|
|
||||||
wtplist_lock();
|
|
||||||
conn = find_ap(sd->prompt);
|
|
||||||
if (conn==NULL){
|
|
||||||
fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
FILE *f=fopen("wlan0.ktv","r");
|
|
||||||
cw_ktv_read_file(f,sd->update_cfg,conn->msgset->types_tree);
|
|
||||||
//conn->update_cfg=sd->update_cfg;
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
wtplist_unlock();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_cmd(struct shelldata *sd, const char *str)
|
void set_cmd(struct shelldata *sd, const char *str)
|
||||||
{
|
{
|
||||||
struct conn * conn;
|
struct conn * conn;
|
||||||
@ -391,7 +370,6 @@ void shell_loop (FILE *file)
|
|||||||
{
|
{
|
||||||
struct shelldata sd;
|
struct shelldata sd;
|
||||||
int c;
|
int c;
|
||||||
c=0;
|
|
||||||
/* setvbuf(file,NULL,_IONBF,0);
|
/* setvbuf(file,NULL,_IONBF,0);
|
||||||
fflush(file);
|
fflush(file);
|
||||||
*/
|
*/
|
||||||
@ -426,11 +404,9 @@ void * run_shell (void * arg)
|
|||||||
const char * addr = "127.0.0.1:5000";
|
const char * addr = "127.0.0.1:5000";
|
||||||
int sockfd, clientsock;
|
int sockfd, clientsock;
|
||||||
int yes;
|
int yes;
|
||||||
|
while(1){
|
||||||
|
|
||||||
|
|
||||||
cw_dbg(DBG_INFO,"Staring shelli listening at: %s",addr);
|
|
||||||
|
|
||||||
|
|
||||||
rc = sock_strtoaddr (addr, (struct sockaddr*) &server);
|
rc = sock_strtoaddr (addr, (struct sockaddr*) &server);
|
||||||
|
|
||||||
if (! rc) {
|
if (! rc) {
|
||||||
@ -459,17 +435,16 @@ void * run_shell (void * arg)
|
|||||||
|
|
||||||
|
|
||||||
client_size = sizeof (client);
|
client_size = sizeof (client);
|
||||||
while(1){
|
|
||||||
|
|
||||||
clientsock = accept (sockfd, (struct sockaddr*) &client, &client_size);
|
clientsock = accept (sockfd, (struct sockaddr*) &client, &client_size);
|
||||||
|
|
||||||
if (clientsock > 0) {
|
if (clientsock > 0) {
|
||||||
sock_addr2str_p (&client, sockstr);
|
sock_addr2str_p (&client, sockstr);
|
||||||
cw_dbg (DBG_INFO, "Acceptiong session from %s", sockstr);
|
cw_dbg (DBG_INFO, "Acceptiong session from %s", sockstr);
|
||||||
cw_dbg (DBG_INFO, "Start shell");
|
printf("New shell lopp\n");
|
||||||
shell_loop (fdopen (clientsock, "a+"));
|
shell_loop (fdopen (clientsock, "a+"));
|
||||||
cw_dbg (DBG_INFO, "Stop shell");
|
printf("end shell lopp\n");
|
||||||
close (clientsock);
|
close (clientsock);
|
||||||
|
printf("close clsock\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +114,23 @@ static void wtpman_run_discovery(void *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
int xprocess_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||||
|
struct sockaddr *from)
|
||||||
|
{
|
||||||
|
uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||||
|
uint32_t type = cw_get_msg_type(msgptr);
|
||||||
|
cw_log(LOG_ERR, "Hey: %d", type);
|
||||||
|
if (type == CAPWAP_MSG_DISCOVERY_REQUEST)
|
||||||
|
conn->capwap_state = CAPWAP_STATE_DISCOVERY;
|
||||||
|
|
||||||
|
|
||||||
|
return process_message(conn, rawmsg, rawlen, from);
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static int wtpman_dtls_setup(void *arg)
|
static int wtpman_dtls_setup(void *arg)
|
||||||
{
|
{
|
||||||
char cipherstr[512];
|
char cipherstr[512];
|
||||||
@ -369,6 +386,62 @@ static void * wtpman_main(void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
switch (conn->capwap_transition){
|
||||||
|
case CW_TRANSITION(CAPWAP_STATE_DTLS_SETUP, CAPWAP_STATE_JOIN):
|
||||||
|
{
|
||||||
|
|
||||||
|
wait_join = cw_ktv_get_word(conn->global_cfg,"wait-join",CAPWAP_WAIT_JOIN);
|
||||||
|
timer = cw_timer_start(wait_join);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_JOIN):
|
||||||
|
{
|
||||||
|
char wtpname[CAPWAP_MAX_WTP_NAME_LEN];
|
||||||
|
cw_KTV_t * result;
|
||||||
|
result = cw_ktv_get(conn->remote_cfg,"wtp-name",NULL);
|
||||||
|
result->type->to_str(result,wtpname,CAPWAP_MAX_WTP_NAME_LEN);
|
||||||
|
cw_dbg(DBG_INFO, "WTP joined: '%s', IP %s.",
|
||||||
|
wtpname,
|
||||||
|
sock_addr2str(&conn->addr,sock_buf)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CW_TRANSITION(CAPWAP_STATE_JOIN,CAPWAP_STATE_TIMEOUT):
|
||||||
|
{
|
||||||
|
cw_dbg(DBG_MSG_ERR, "No join request from %s after %d seconds, WTP died.",
|
||||||
|
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_join);
|
||||||
|
wtpman_remove(wtpman);
|
||||||
|
return NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CW_TRANSITION(CAPWAP_STATE_JOIN, CAPWAP_STATE_CONFIGURE):
|
||||||
|
{
|
||||||
|
|
||||||
|
wait_change_state = cw_ktv_get_word(conn->global_cfg,
|
||||||
|
"capwap-timers/change-state-pending-timer",
|
||||||
|
CAPWAP_TIMER_CHANGE_STATE_PENDING_TIMER);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CW_TRANSITION(CAPWAP_STATE_CONFIGURE,CAPWAP_STATE_TIMEOUT):
|
||||||
|
{
|
||||||
|
cw_dbg(DBG_MSG_ERR, "No Change State Event Request %s after %d seconds, WTP died.",
|
||||||
|
sock_addr2str(&wtpman->conn->addr,sock_buf), wait_change_state);
|
||||||
|
wtpman_remove(wtpman);
|
||||||
|
return NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (!cw_timer_timeout(timer)) {
|
while (!cw_timer_timeout(timer)) {
|
||||||
if (conn->update_cfg != NULL){
|
if (conn->update_cfg != NULL){
|
||||||
@ -378,7 +451,7 @@ static void * wtpman_main(void *arg)
|
|||||||
tmp = conn->local_cfg;
|
tmp = conn->local_cfg;
|
||||||
|
|
||||||
mavl_merge(conn->default_cfg, conn->local_cfg);
|
mavl_merge(conn->default_cfg, conn->local_cfg);
|
||||||
/* mavl_merge(conn->default_cfg, conn->remote_cfg);*/
|
mavl_merge(conn->default_cfg, conn->remote_cfg);
|
||||||
|
|
||||||
conn->local_cfg=conn->update_cfg;
|
conn->local_cfg=conn->update_cfg;
|
||||||
|
|
||||||
@ -389,8 +462,6 @@ static void * wtpman_main(void *arg)
|
|||||||
cw_dbg(DBG_INFO, "Updating WTP %s",sock_addr2str(&conn->addr,sock_buf));
|
cw_dbg(DBG_INFO, "Updating WTP %s",sock_addr2str(&conn->addr,sock_buf));
|
||||||
|
|
||||||
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST);
|
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST);
|
||||||
mavl_merge(conn->remote_cfg,conn->update_cfg);
|
|
||||||
|
|
||||||
conn->update_cfg=NULL;
|
conn->update_cfg=NULL;
|
||||||
conn->local_cfg=tmp;
|
conn->local_cfg=tmp;
|
||||||
}
|
}
|
||||||
@ -507,7 +578,7 @@ cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"-------------dump------------","DMP",
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*// cw_dbg(DBG_X, "Time left: %d",
|
/*// cw_dbg(DBG_X, "Time left: %d",
|
||||||
// */
|
//*/
|
||||||
/*cw_timer_timeleft(wtpman->echointerval_timer);*/
|
/*cw_timer_timeleft(wtpman->echointerval_timer);*/
|
||||||
|
|
||||||
if (cw_timer_timeout(wtpman->echointerval_timer)) {
|
if (cw_timer_timeout(wtpman->echointerval_timer)) {
|
||||||
|
@ -3,6 +3,7 @@ MFDEPS=../Defs.mak ../LocalDefs.mak
|
|||||||
|
|
||||||
|
|
||||||
CWSRC=\
|
CWSRC=\
|
||||||
|
cw_write_header.c\
|
||||||
cw_check_missing_mand.c\
|
cw_check_missing_mand.c\
|
||||||
cw_clock_lap.c\
|
cw_clock_lap.c\
|
||||||
cw_dbg_elem.c\
|
cw_dbg_elem.c\
|
||||||
@ -105,8 +106,6 @@ KTVSRC=\
|
|||||||
cw_ktv_base_exists.c\
|
cw_ktv_base_exists.c\
|
||||||
cw_ktv_save.c\
|
cw_ktv_save.c\
|
||||||
cw_ktv_del_sub.c\
|
cw_ktv_del_sub.c\
|
||||||
cfg.c\
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LWSRC=\
|
LWSRC=\
|
||||||
@ -232,7 +231,7 @@ DTLSSRC += dtls_openssl.c \
|
|||||||
dtls_openssl_connect.c \
|
dtls_openssl_connect.c \
|
||||||
dtls_openssl_get_cipher.c \
|
dtls_openssl_get_cipher.c \
|
||||||
dtls_openssl_bio.c
|
dtls_openssl_bio.c
|
||||||
LIBS=
|
LIBS+=-lssl
|
||||||
|
|
||||||
#DTLSSRC+= dtls_gnutls.c \
|
#DTLSSRC+= dtls_gnutls.c \
|
||||||
# dtls_gnutls_accept.c \
|
# dtls_gnutls_accept.c \
|
||||||
@ -264,5 +263,6 @@ all: $(SNAME) $(DNAME)
|
|||||||
static: $(SNAME)
|
static: $(SNAME)
|
||||||
dynamic: $(DNAME)
|
dynamic: $(DNAME)
|
||||||
|
|
||||||
|
|
||||||
include ../lib.mk
|
include ../lib.mk
|
||||||
|
|
||||||
|
355
src/cw/cfg.c
355
src/cw/cfg.c
@ -1,355 +0,0 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include <mavl.h>
|
|
||||||
|
|
||||||
#include "cw.h"
|
|
||||||
#include "cfg.h"
|
|
||||||
|
|
||||||
struct cfg_entry{
|
|
||||||
char *key;
|
|
||||||
char *val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int cmp(const void *k1,const void*k2){
|
|
||||||
struct cfg_entry * e1,*e2;
|
|
||||||
e1=(struct cfg_entry *)k1;
|
|
||||||
e2=(struct cfg_entry *)k2;
|
|
||||||
return strcmp(e1->key,e2->key);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void del(void *ptr)
|
|
||||||
{
|
|
||||||
struct cfg_entry * e;
|
|
||||||
e=(struct cfg_entry *)ptr;
|
|
||||||
free(e->key);
|
|
||||||
free(e->val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cw_Cfg_t * cw_cfg_create()
|
|
||||||
{
|
|
||||||
return mavl_create(cmp, del, sizeof(struct cfg_entry));
|
|
||||||
}
|
|
||||||
|
|
||||||
int cw_cfg_set(cw_Cfg_t * cfg,const char *key, const char *val)
|
|
||||||
{
|
|
||||||
struct cfg_entry e;
|
|
||||||
int replaced;
|
|
||||||
|
|
||||||
e.key = cw_strdup(key);
|
|
||||||
if (!e.key)
|
|
||||||
return 0;
|
|
||||||
e.val = cw_strdup(val);
|
|
||||||
if (!e.val){
|
|
||||||
free(e.key);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
void * rc = mavl_replace(cfg,&e,&replaced);
|
|
||||||
if (!rc){
|
|
||||||
del(&e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!replaced)
|
|
||||||
return 1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cw_cfg_dump(cw_Cfg_t *cfg)
|
|
||||||
{
|
|
||||||
mavliter_t it;
|
|
||||||
struct cfg_entry *e;
|
|
||||||
mavliter_init(&it,cfg);
|
|
||||||
mavliter_foreach(&it){
|
|
||||||
|
|
||||||
e = mavliter_get(&it);
|
|
||||||
printf("%s: '%s'\n",e->key,e->val);
|
|
||||||
//cw_dbg(dbglevel,"%s%s :%s: %s",prefix,data->key,type->get_type_name(data), value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 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_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_cfg_read_line (FILE *f, struct parser *p, char * key, char *val)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
|
|
||||||
n = read_key (p,key,CW_CFG_MAX_KEY_LEN);
|
|
||||||
if (n==0)
|
|
||||||
return 1;
|
|
||||||
if (n==-1){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
n = read_val (p,val,CW_CFG_MAX_KEY_LEN);
|
|
||||||
if (n==-1){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cw_cfg_read_from_file(FILE * f, cw_Cfg_t * cfg)
|
|
||||||
{
|
|
||||||
char key[CW_CFG_MAX_KEY_LEN];
|
|
||||||
char val[2048];
|
|
||||||
struct parser p;
|
|
||||||
|
|
||||||
p.line=1;
|
|
||||||
p.pos=0;
|
|
||||||
p.prevpos=0;
|
|
||||||
p.quote=0;
|
|
||||||
p.f=f;
|
|
||||||
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
|
|
||||||
do {
|
|
||||||
|
|
||||||
rc = cw_cfg_read_line(f,&p,key,val);
|
|
||||||
if (rc==-1){
|
|
||||||
fprintf(stderr,"Error: %s",p.error);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (rc != 0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
cw_cfg_set(cfg,key,val);
|
|
||||||
|
|
||||||
|
|
||||||
}while(rc==0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int cw_cfg_load(const char *filename,cw_Cfg_t * cfg)
|
|
||||||
{
|
|
||||||
FILE *f = fopen(filename,"rb");
|
|
||||||
if (!f)
|
|
||||||
return errno;
|
|
||||||
cw_cfg_read_from_file(f,cfg);
|
|
||||||
return 0;
|
|
||||||
}
|
|
18
src/cw/cfg.h
18
src/cw/cfg.h
@ -1,18 +0,0 @@
|
|||||||
#ifndef _CFG_H
|
|
||||||
#define _CFG_H
|
|
||||||
|
|
||||||
#include <mavl.h>
|
|
||||||
|
|
||||||
#define CW_CFG_MAX_KEY_LEN 1024
|
|
||||||
|
|
||||||
typedef struct mavl cw_Cfg_t;
|
|
||||||
|
|
||||||
cw_Cfg_t * cw_cfg_create();
|
|
||||||
int cw_cfg_set(cw_Cfg_t *cfg,const char *key, const char *val);
|
|
||||||
void cw_cfg_dump(cw_Cfg_t *cfg);
|
|
||||||
int cw_cfg_read_from_file(FILE * file, cw_Cfg_t * cfg);
|
|
||||||
int cw_cfg_load(const char *filename,cw_Cfg_t * cfg);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -90,7 +90,7 @@ struct conn * conn_create(int sock, struct sockaddr * addr, int qsize)
|
|||||||
/* conn->send_data_packet = conn_send_data_packet;*/
|
/* conn->send_data_packet = conn_send_data_packet;*/
|
||||||
|
|
||||||
conn->last_seqnum_received=-1;
|
conn->last_seqnum_received=-1;
|
||||||
conn->mtu=600;
|
conn->mtu=500;
|
||||||
|
|
||||||
|
|
||||||
conn->cur_packet=0;
|
conn->cur_packet=0;
|
||||||
@ -102,7 +102,7 @@ struct conn * conn_create(int sock, struct sockaddr * addr, int qsize)
|
|||||||
|
|
||||||
/* conn->write_data = conn->send_data_packet; */
|
/* conn->write_data = conn->send_data_packet; */
|
||||||
|
|
||||||
conn->dtls_mtu = 600;
|
conn->dtls_mtu = 500;
|
||||||
|
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,6 @@ int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
|||||||
if ((sd > 0 && sd < 128) || (sd < 0 && sd < -128) || s1 < 0) {
|
if ((sd > 0 && sd < 128) || (sd < 0 && sd < -128) || s1 < 0) {
|
||||||
/* seqnum is ok, normal message processing */
|
/* seqnum is ok, normal message processing */
|
||||||
conn->last_seqnum_received = seqnum;
|
conn->last_seqnum_received = seqnum;
|
||||||
|
|
||||||
return process_elements(conn, rawmsg, rawlen, from);
|
return process_elements(conn, rawmsg, rawlen, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,8 +65,6 @@ int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
|
|||||||
handler->name);
|
handler->name);
|
||||||
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("USING HANDLERi TO DECODE: %d %s\n",handler->id,handler->name);
|
|
||||||
rc = handler->get(handler, params, data, len);
|
rc = handler->get(handler, params, data, len);
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@ int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
|
|||||||
key = handler->key;
|
key = handler->key;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("CW_IN_GENERIC STRUCT: %s\n",key);
|
|
||||||
|
|
||||||
/* int (*mkkey)(struct cw_ElemHandler * handler, char *dst, struct cw_ElemHandlerParams * params,
|
/* int (*mkkey)(struct cw_ElemHandler * handler, char *dst, struct cw_ElemHandlerParams * params,
|
||||||
uint8_t*data, int len);
|
uint8_t*data, int len);
|
||||||
*/
|
*/
|
||||||
|
@ -8,6 +8,9 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
|
|||||||
int pos, i,l;
|
int pos, i,l;
|
||||||
cw_KTV_t * result;
|
cw_KTV_t * result;
|
||||||
|
|
||||||
|
if (strcmp(pkey,"radio.0/cisco/wtp-radio-config")==0)
|
||||||
|
i = 99;
|
||||||
|
|
||||||
|
|
||||||
pos=0; i=0;
|
pos=0; i=0;
|
||||||
while (stru[i].type != NULL){
|
while (stru[i].type != NULL){
|
||||||
@ -44,7 +47,6 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
|
|||||||
|
|
||||||
stru[i].type->to_str(result,dbstr,100);
|
stru[i].type->to_str(result,dbstr,100);
|
||||||
cw_dbg(DBG_ELEM_DETAIL, "Read (%d): %s: %s",pos,key,dbstr);
|
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)
|
if (stru[i].len==-1)
|
||||||
l = result->type->len(result);
|
l = result->type->len(result);
|
||||||
|
@ -24,15 +24,9 @@ int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_KTVStruct_t * stru, con
|
|||||||
else
|
else
|
||||||
sprintf(key,"%s",pkey);
|
sprintf(key,"%s",pkey);
|
||||||
|
|
||||||
printf("Get Key: %s\n",key);
|
|
||||||
result = cw_ktv_get(ktv,key,NULL);
|
|
||||||
|
|
||||||
if(result)
|
result = cw_ktv_get(ktv,key,NULL);
|
||||||
{
|
|
||||||
char s[129];
|
|
||||||
result->type->to_str(result,s,128);
|
|
||||||
printf("Content: '%s'\n",s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == NULL && def != NULL){
|
if (result == NULL && def != NULL){
|
||||||
result = cw_ktv_get(def,key,NULL);
|
result = cw_ktv_get(def,key,NULL);
|
||||||
|
@ -12,7 +12,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
, uint8_t * dst)
|
, uint8_t * dst)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct cw_KTV * elem;
|
struct cw_KTV * elem, search;
|
||||||
int start, len, l;
|
int start, len, l;
|
||||||
|
|
||||||
/* Get the element */
|
/* Get the element */
|
||||||
@ -49,7 +49,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
/* Size for msg elem header depends on
|
/* Size for msg elem header depends on
|
||||||
vendor specific payload */
|
vendor specific payload */
|
||||||
/* start = handler->vendor ? 10 : 4; */
|
/* start = handler->vendor ? 10 : 4; */
|
||||||
start = params->msgset->header_len(handler);
|
start = cw_header_len(handler);
|
||||||
|
|
||||||
if (cw_ktv_cast(elem,handler->type)==NULL){
|
if (cw_ktv_cast(elem,handler->type)==NULL){
|
||||||
cw_log(LOG_ERR,"Can't put element '%s'- can't cast from %s to %s for key: %s", handler->name,
|
cw_log(LOG_ERR,"Can't put element '%s'- can't cast from %s to %s for key: %s", handler->name,
|
||||||
@ -67,7 +67,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
l = len + cw_put_elem_hdr(dst, handler->id, len); */
|
l = len + cw_put_elem_hdr(dst, handler->id, len); */
|
||||||
l = params->msgset->write_header(handler,dst,len);
|
l = cw_write_header(handler,dst,len);
|
||||||
|
|
||||||
cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,handler,dst,l);
|
cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,handler,dst,l);
|
||||||
/* cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);*/
|
/* cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);*/
|
||||||
|
@ -10,6 +10,7 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
|
|||||||
uint8_t * ob;
|
uint8_t * ob;
|
||||||
const cw_KTVIndexed_t *ie;
|
const cw_KTVIndexed_t *ie;
|
||||||
cw_KTVEnum_t * e;
|
cw_KTVEnum_t * e;
|
||||||
|
struct cw_ElemHandler thandler;
|
||||||
|
|
||||||
ie = handler->type;
|
ie = handler->type;
|
||||||
|
|
||||||
@ -21,13 +22,10 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
|
|||||||
|
|
||||||
for(i=0; e[i].name!=NULL; i++) {
|
for(i=0; e[i].name!=NULL; i++) {
|
||||||
sprintf(key,"%s/%s",handler->key,e[i].name);
|
sprintf(key,"%s/%s",handler->key,e[i].name);
|
||||||
|
|
||||||
//printf("Her is the Key: %s - %s\n",key, );
|
|
||||||
|
|
||||||
result = cw_ktv_base_exists(params->local_cfg,key);
|
result = cw_ktv_base_exists(params->local_cfg,key);
|
||||||
if (result==NULL)
|
if (result==NULL)
|
||||||
continue;
|
continue;
|
||||||
start = params->msgset->header_len(handler);
|
start = cw_header_len(handler);
|
||||||
len = 0;
|
len = 0;
|
||||||
if (ie->idxpos==0)
|
if (ie->idxpos==0)
|
||||||
len = 1;
|
len = 1;
|
||||||
@ -38,11 +36,17 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
|
|||||||
len += cw_ktv_write_struct(params->local_cfg,
|
len += cw_ktv_write_struct(params->local_cfg,
|
||||||
NULL,e[i].type,key,ob+start+len);
|
NULL,e[i].type,key,ob+start+len);
|
||||||
|
|
||||||
|
/* thandler.type=e[i].type;
|
||||||
|
thandler.key=key;
|
||||||
|
len += e->fun_out(&thandler,params,ob+start+len);
|
||||||
|
*/
|
||||||
cw_set_byte(ob+start+ie->idxpos,e[i].value);
|
cw_set_byte(ob+start+ie->idxpos,e[i].value);
|
||||||
if (ie->idxpos==len)
|
if (ie->idxpos==len)
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
ob += params->msgset->write_header(handler,ob,len);
|
ob += cw_write_header(handler,ob,len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
start = params->msgset->header_len(handler);
|
start = cw_header_len(handler);
|
||||||
|
|
||||||
len = cw_ktv_write_struct(params->local_cfg,
|
len = cw_ktv_write_struct(params->local_cfg,
|
||||||
params->default_cfg,
|
params->default_cfg,
|
||||||
handler->type,handler->key,dst+start);
|
handler->type,handler->key,dst+start);
|
||||||
|
|
||||||
return params->msgset->write_header(handler,dst,len);
|
return cw_write_header(handler,dst,len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ int cw_out_generic_with_index(struct cw_ElemHandler * eh,
|
|||||||
if (strncmp(result->key,key,strlen(key))!=0)
|
if (strncmp(result->key,key,strlen(key))!=0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
start = params->msgset->header_len(eh);
|
start = cw_header_len(eh);
|
||||||
len = cw_put_byte(ob+start,idx);
|
len = cw_put_byte(ob+start,idx);
|
||||||
|
|
||||||
len += result->type->put(result,ob+start+len);
|
len += result->type->put(result,ob+start+len);
|
||||||
|
|
||||||
ob += params->msgset->write_header(eh,ob,len);
|
ob += cw_write_header(eh,ob,len);
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
|
@ -37,13 +37,15 @@ int cw_out_idx_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHan
|
|||||||
|
|
||||||
sprintf(key,handler->key,idx);
|
sprintf(key,handler->key,idx);
|
||||||
|
|
||||||
|
printf("Here we are '%s'! --> %d\n",key,idx);
|
||||||
|
|
||||||
len =0;
|
len =0;
|
||||||
start = mdst + params->msgset->header_len(handler);
|
start = mdst + cw_header_len(handler);
|
||||||
|
|
||||||
len += cw_put_byte(start+len,idx);
|
len += cw_put_byte(start+len,idx);
|
||||||
len += cw_ktv_write_struct(params->local_cfg,NULL, handler->type,key,start+len);
|
len += cw_ktv_write_struct(params->local_cfg,NULL, handler->type,key,start+len);
|
||||||
|
|
||||||
mdst += params->msgset->write_header(handler,mdst,len);
|
mdst += cw_write_header(handler,mdst,len);
|
||||||
|
|
||||||
|
|
||||||
i=idx+1;
|
i=idx+1;
|
||||||
|
@ -14,7 +14,7 @@ int cw_out_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemH
|
|||||||
cdst = dst;
|
cdst = dst;
|
||||||
|
|
||||||
|
|
||||||
offset = params->msgset->header_len(handler);
|
offset = cw_header_len(handler);
|
||||||
|
|
||||||
i=-1;
|
i=-1;
|
||||||
while(1){
|
while(1){
|
||||||
@ -37,7 +37,7 @@ int cw_out_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemH
|
|||||||
l+= cw_ktv_write_struct(params->local_cfg,NULL, handler->type,basekey,cdst+offset+l);
|
l+= cw_ktv_write_struct(params->local_cfg,NULL, handler->type,basekey,cdst+offset+l);
|
||||||
|
|
||||||
|
|
||||||
cdst+=params->msgset->write_header(handler,cdst,l);
|
cdst+=cw_write_header(handler,cdst,l);
|
||||||
}
|
}
|
||||||
return cdst-dst;
|
return cdst-dst;
|
||||||
}
|
}
|
||||||
@ -52,18 +52,16 @@ int cw_out_traverse0(struct cw_ElemHandler * handler, struct cw_ElemHandlerParam
|
|||||||
char key[CW_KTV_MAX_KEY_LEN];
|
char key[CW_KTV_MAX_KEY_LEN];
|
||||||
int len;
|
int len;
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
||||||
printf("Next: %s\n", next);
|
|
||||||
|
|
||||||
sl = strchr(next,'/');
|
sl = strchr(next,'/');
|
||||||
if (sl==NULL){
|
if (sl==NULL){
|
||||||
cw_KTV_t * result;
|
cw_KTV_t * result;
|
||||||
sprintf(key,"%s/%s",current,next);
|
sprintf(key,"%s/%s",current,next);
|
||||||
result = cw_ktv_base_exists(params->local_cfg,key);
|
result = cw_ktv_base_exists(params->local_cfg,key);
|
||||||
if (result != NULL){
|
if (result != NULL){
|
||||||
int offset;
|
int offset;
|
||||||
int i,l;
|
int i,l;
|
||||||
offset = params->msgset->header_len(handler);
|
offset = cw_header_len(handler);
|
||||||
printf("Yea! We can do it: %s\n",result->key);
|
printf("Yea! We can do it: %s\n",result->key);
|
||||||
for (i=0;i<stack[0];i++){
|
for (i=0;i<stack[0];i++){
|
||||||
printf("I=%i\n",stack[i+1]);
|
printf("I=%i\n",stack[i+1]);
|
||||||
@ -73,7 +71,7 @@ printf("Next: %s\n", next);
|
|||||||
|
|
||||||
printf("Write struct len %i\n",l);
|
printf("Write struct len %i\n",l);
|
||||||
|
|
||||||
l=params->msgset->write_header(handler,dst,l);
|
l=cw_write_header(handler,dst,l);
|
||||||
printf("header wr len %d\n",l);
|
printf("header wr len %d\n",l);
|
||||||
if (handler->patch){
|
if (handler->patch){
|
||||||
handler->patch(dst+offset,stack);
|
handler->patch(dst+offset,stack);
|
||||||
@ -86,9 +84,6 @@ printf("Next: %s\n", next);
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcpy(key,current);
|
strcpy(key,current);
|
||||||
|
|
||||||
printf("current is %s\n", current);
|
|
||||||
|
|
||||||
if (key[0!=0])
|
if (key[0!=0])
|
||||||
strcat(key,"/");
|
strcat(key,"/");
|
||||||
l = sl - next;
|
l = sl - next;
|
||||||
@ -103,7 +98,6 @@ printf("current is %s\n", current);
|
|||||||
cw_KTV_t * result;
|
cw_KTV_t * result;
|
||||||
|
|
||||||
i = cw_ktv_idx_get_next(params->local_cfg,key,i+1);
|
i = cw_ktv_idx_get_next(params->local_cfg,key,i+1);
|
||||||
|
|
||||||
if (i==-1)
|
if (i==-1)
|
||||||
break;
|
break;
|
||||||
sprintf(basekey,"%s.%d",key,i);
|
sprintf(basekey,"%s.%d",key,i);
|
||||||
@ -133,8 +127,6 @@ int cw_out_traverse(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
|||||||
stack[0]=0;
|
stack[0]=0;
|
||||||
|
|
||||||
current[0]=0;
|
current[0]=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return cw_out_traverse0(handler,params,dst,-1,current,handler->key, stack);
|
return cw_out_traverse0(handler,params,dst,-1,current,handler->key, stack);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,6 @@ printf("Elem: %d %d %d %s\n", data->proto, data->vendor, data->id, handler->name
|
|||||||
|
|
||||||
cw_decode_elements( ¶ms, elems_ptr,elems_len);
|
cw_decode_elements( ¶ms, elems_ptr,elems_len);
|
||||||
|
|
||||||
printf ("----------------------------------- end redecode -----------------------------\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ int cw_write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
|||||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cw_header_len(struct cw_ElemHandler * handler)
|
int cw_header_len(struct cw_ElemHandler * handler)
|
||||||
{
|
{
|
||||||
return handler->vendor ? 10 : 4;
|
return handler->vendor ? 10 : 4;
|
||||||
|
@ -5,7 +5,7 @@ struct mlistelem * mlist_get(mlist_t list, const void *data){
|
|||||||
mlist_foreach(elem,list){
|
mlist_foreach(elem,list){
|
||||||
void *tdata = mlistelem_dataptr(elem);
|
void *tdata = mlistelem_dataptr(elem);
|
||||||
if (list->cmp(tdata,data)==0){
|
if (list->cmp(tdata,data)==0){
|
||||||
return elem;
|
return tdata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -105,7 +105,7 @@ struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
|||||||
struct cw_MsgSet *set;
|
struct cw_MsgSet *set;
|
||||||
|
|
||||||
if (!msgset_cache) {
|
if (!msgset_cache) {
|
||||||
msgset_cache = mavl_create(cmp, NULL, sizeof(struct cache_item*));
|
msgset_cache = mavl_create(cmp, NULL, 1312);
|
||||||
if (!msgset_cache) {
|
if (!msgset_cache) {
|
||||||
cw_log(LOG_ERR, "Can't initialize msgset cache: %s",
|
cw_log(LOG_ERR, "Can't initialize msgset cache: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
@ -213,7 +213,7 @@ struct cw_Mod *cw_mod_load(const char *mod_name, mavl_t global_cfg, int role)
|
|||||||
|
|
||||||
/* if modlist is not initialized, initialize ... */
|
/* if modlist is not initialized, initialize ... */
|
||||||
if (mods_loaded == NULL) {
|
if (mods_loaded == NULL) {
|
||||||
mods_loaded = mavl_create(mod_cmp_mavl, NULL, sizeof(struct cw_Mod*));
|
mods_loaded = mavl_create(mod_cmp_mavl, NULL, 1312);
|
||||||
if (mods_loaded == NULL) {
|
if (mods_loaded == NULL) {
|
||||||
cw_log(LOG_ERROR, "Can't init modlist, no memory");
|
cw_log(LOG_ERROR, "Can't init modlist, no memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -272,10 +272,8 @@ struct cw_Mod *cw_mod_load(const char *mod_name, mavl_t global_cfg, int role)
|
|||||||
cw_log(LOG_ERR, "Can' add module %s", mod_name);
|
cw_log(LOG_ERR, "Can' add module %s", mod_name);
|
||||||
goto errX;
|
goto errX;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_dbg(DBG_MOD, "MOD: %s sucessfull loaded, calling init now.", filename);
|
cw_dbg(DBG_MOD, "MOD: %s sucessfull loaded, calling init now.", filename);
|
||||||
mod->init(mod, global_cfg, role);
|
mod->init(mod, global_cfg, role);
|
||||||
|
|
||||||
errX:
|
errX:
|
||||||
free(filename);
|
free(filename);
|
||||||
return mod;
|
return mod;
|
||||||
|
@ -114,7 +114,6 @@ void cw_msgset_destroy(struct cw_MsgSet *set)
|
|||||||
*/
|
*/
|
||||||
struct cw_MsgSet *cw_msgset_create()
|
struct cw_MsgSet *cw_msgset_create()
|
||||||
{
|
{
|
||||||
const cw_Type_t **ti;
|
|
||||||
|
|
||||||
/* allocate memory for a message_set */
|
/* allocate memory for a message_set */
|
||||||
struct cw_MsgSet *set = malloc(sizeof(struct cw_MsgSet));
|
struct cw_MsgSet *set = malloc(sizeof(struct cw_MsgSet));
|
||||||
@ -150,15 +149,13 @@ struct cw_MsgSet *cw_msgset_create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
set->types_tree = cw_ktv_create_types_tree();
|
set->types_tree = cw_ktv_create_types_tree();
|
||||||
|
|
||||||
|
printf("TYPES TREE %p\n",set->types_tree);
|
||||||
|
|
||||||
if (set->types_tree == NULL){
|
if (set->types_tree == NULL){
|
||||||
cw_msgset_destroy(set);
|
cw_msgset_destroy(set);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* insert default types */
|
|
||||||
for (ti=CW_KTV_STD_TYPES;*ti;ti++){
|
|
||||||
mavl_insert_ptr(set->types_tree,*ti);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
set->state_machine = mavl_create(cmp_machinestate,NULL,sizeof(cw_StateMachineState_t));
|
set->state_machine = mavl_create(cmp_machinestate,NULL,sizeof(cw_StateMachineState_t));
|
||||||
if (set->state_machine == NULL)
|
if (set->state_machine == NULL)
|
||||||
@ -339,6 +336,10 @@ int cw_msgset_add(struct cw_MsgSet *set,
|
|||||||
{
|
{
|
||||||
mavliter_t it;
|
mavliter_t it;
|
||||||
cw_dbg(DBG_MOD," Known types:");
|
cw_dbg(DBG_MOD," Known types:");
|
||||||
|
|
||||||
|
printf("TYPES TREE ITER %p\n",set->types_tree);
|
||||||
|
|
||||||
|
|
||||||
mavliter_init(&it,set->types_tree);
|
mavliter_init(&it,set->types_tree);
|
||||||
mavliter_foreach(&it){
|
mavliter_foreach(&it){
|
||||||
struct cw_Type * t = mavliter_get_ptr(&it);
|
struct cw_Type * t = mavliter_get_ptr(&it);
|
||||||
|
@ -7,6 +7,13 @@
|
|||||||
|
|
||||||
#include "ktv.h"
|
#include "ktv.h"
|
||||||
|
|
||||||
|
struct cw_MsgSet {
|
||||||
|
mavl_t msgdata;
|
||||||
|
mavl_t handlers_by_id;
|
||||||
|
mavl_t handlers_by_key;
|
||||||
|
mavl_t types_tree;
|
||||||
|
mavl_t state_machine;
|
||||||
|
};
|
||||||
|
|
||||||
struct cw_ElemDef{
|
struct cw_ElemDef{
|
||||||
int proto;
|
int proto;
|
||||||
@ -61,19 +68,6 @@ struct cw_ElemHandler {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct cw_MsgSet {
|
|
||||||
mavl_t msgdata;
|
|
||||||
mavl_t handlers_by_id;
|
|
||||||
mavl_t handlers_by_key;
|
|
||||||
mavl_t types_tree;
|
|
||||||
mavl_t state_machine;
|
|
||||||
int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len);
|
|
||||||
int (*header_len)(struct cw_ElemHandler *handler);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct cw_State{
|
struct cw_State{
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
uint8_t next;
|
uint8_t next;
|
||||||
|
@ -826,19 +826,6 @@ static cw_StateMachineState_t statemachine_states[]={
|
|||||||
{0,0,0}
|
{0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
|
||||||
{
|
|
||||||
if (handler->vendor)
|
|
||||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
|
||||||
|
|
||||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int header_len(struct cw_ElemHandler * handler)
|
|
||||||
{
|
|
||||||
return handler->vendor ? 10 : 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||||
@ -851,8 +838,10 @@ struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
|||||||
|
|
||||||
cw_msgset_add_states(set,statemachine_states);
|
cw_msgset_add_states(set,statemachine_states);
|
||||||
|
|
||||||
set->write_header = write_header;
|
mavl_insert_ptr(set->types_tree,CW_TYPE_BSTR16);
|
||||||
set->header_len = header_len;
|
mavl_insert_ptr(set->types_tree,CW_TYPE_BYTE);
|
||||||
|
mavl_insert_ptr(set->types_tree,CW_TYPE_DWORD);
|
||||||
|
mavl_insert_ptr(set->types_tree,CW_TYPE_WORD);
|
||||||
|
|
||||||
cw_dbg(DBG_INFO,"CAPWAP: Done register messages");
|
cw_dbg(DBG_INFO,"CAPWAP: Done register messages");
|
||||||
return set;
|
return set;
|
||||||
|
@ -297,9 +297,9 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start = params->msgset->header_len(eh);
|
start = cw_header_len(eh);
|
||||||
len = cw_ktv_write_struct(params->local_cfg,NULL,type,key,ob+start);
|
len = cw_ktv_write_struct(params->local_cfg,NULL,type,key,ob+start);
|
||||||
ob += params->msgset->write_header(eh,ob,len);
|
ob += cw_write_header(eh,ob,len);
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
@ -513,17 +513,18 @@ static cw_KTVStruct_t cisco_add_wlan70[]={
|
|||||||
{CW_TYPE_BOOL,"wep-encryption",1,42},
|
{CW_TYPE_BOOL,"wep-encryption",1,42},
|
||||||
|
|
||||||
{CW_TYPE_BYTE,"qos",1,324},
|
{CW_TYPE_BYTE,"qos",1,324},
|
||||||
{CW_TYPE_WORD,"scan-defer-period",1,328},
|
|
||||||
{CW_TYPE_WORD,"scan-defer-time",1,330},
|
{CW_TYPE_WORD,"scan-defer-time",1,330},
|
||||||
{CW_TYPE_BOOL,"broadcast-ssid",1,332},
|
{CW_TYPE_BOOL,"broadcast-ssid",1,332},
|
||||||
{CW_TYPE_BOOL,"aironet-ie",1,333},
|
|
||||||
{CW_TYPE_BYTE,"hreap-local-switch",1,378},
|
|
||||||
{CW_TYPE_WORD,"session-timout",2,381},
|
{CW_TYPE_WORD,"session-timout",2,381},
|
||||||
|
|
||||||
{CW_TYPE_BYTE, "dtim-period",1,440},
|
{CW_TYPE_BYTE, "dtim-period",1,440},
|
||||||
{CW_TYPE_STR,"profile-name",30,441},
|
{CW_TYPE_STR,"profile-name",30,441},
|
||||||
{CW_TYPE_STR, "ssid",33,474},
|
{CW_TYPE_STR, "ssid",-1,480},
|
||||||
|
|
||||||
|
/* {CW_TYPE_BYTE, "dtim-period",1,541},
|
||||||
|
{CW_TYPE_STR, "ssid-a",30,545},
|
||||||
|
{CW_TYPE_BYTE, "allow-aaa-override",1,578},
|
||||||
|
{CW_TYPE_BYTE, "max-stations",1,580},*/
|
||||||
|
|
||||||
{NULL,NULL,0,0}
|
{NULL,NULL,0,0}
|
||||||
};
|
};
|
||||||
@ -560,25 +561,6 @@ static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int cisoc_add_wlan_mkkey70(const char *pkey, uint8_t*data, int len, char *dst)
|
|
||||||
{
|
|
||||||
int wlan_id,radio_id;
|
|
||||||
|
|
||||||
radio_id = cw_get_byte(data);
|
|
||||||
wlan_id = cw_get_byte(data+4);
|
|
||||||
sprintf(dst,"radio.%d/wlan.%d/add-wlan",radio_id,wlan_id);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cisco_patch_add_wlan70(uint8_t * data, void * st)
|
|
||||||
{
|
|
||||||
int * stack = st;
|
|
||||||
cw_set_byte(data,stack[1]);
|
|
||||||
cw_set_byte(data+3, stack[2]);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static cw_KTVStruct_t cisco_add_lwwlan[]={
|
static cw_KTVStruct_t cisco_add_lwwlan[]={
|
||||||
{CW_TYPE_BSTR16, "misc", 8, 2},
|
{CW_TYPE_BSTR16, "misc", 8, 2},
|
||||||
@ -1445,11 +1427,10 @@ static struct cw_ElemHandler handlers70[] = {
|
|||||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||||
7,1117, /* min/max length */
|
7,1117, /* min/max length */
|
||||||
cisco_add_wlan70, /* type */
|
cisco_add_wlan70, /* type */
|
||||||
"radio/wlan/add-wlan", /* Key */
|
"radio/wlan", /* Key */
|
||||||
cw_in_generic_struct, /* get */
|
cw_in_generic_struct, /* get */
|
||||||
cw_out_traverse, /* put */
|
cw_out_generic_struct, /* put */
|
||||||
cisoc_add_wlan_mkkey70,
|
cisoc_add_wlan_mkkey
|
||||||
cisco_patch_add_wlan70
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
@ -1838,7 +1819,7 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
|
|||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_9, 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, CW_IGNORE},
|
||||||
|
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_MCAST_MGID_INFO, 0, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_MCAST_MGID_INFO, 0, 0},
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 0, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 0, 0},
|
||||||
@ -1888,11 +1869,8 @@ static struct cw_ElemDef change_state_event_request_elements[] ={
|
|||||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 1, CW_IGNORE},
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 1, CW_IGNORE},
|
||||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_OPER_STATE_DETAIL_CAUSE, 1, CW_IGNORE},
|
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_OPER_STATE_DETAIL_CAUSE, 1, CW_IGNORE},
|
||||||
|
|
||||||
{0, 0, CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1, 0},
|
|
||||||
|
|
||||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_HARDWARE_INFO, 1, 0},
|
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_HARDWARE_INFO, 1, 0},
|
||||||
|
|
||||||
|
|
||||||
{0,0,0,0,0}
|
{0,0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,31 +26,6 @@ static struct cw_Mod * capwap_mod = NULL;
|
|||||||
static struct cw_Mod * capwap80211_mod = NULL;
|
static struct cw_Mod * capwap80211_mod = NULL;
|
||||||
|
|
||||||
|
|
||||||
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
|
||||||
{
|
|
||||||
if (handler->proto == 0){
|
|
||||||
if (handler->vendor)
|
|
||||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
|
||||||
|
|
||||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
|
||||||
}
|
|
||||||
/* put the lwap elem header */
|
|
||||||
lw_set_dword(dst + 10, handler->vendor);
|
|
||||||
lw_set_word(dst + 14, handler->id);
|
|
||||||
return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor,
|
|
||||||
CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static int header_len(struct cw_ElemHandler * handler)
|
|
||||||
{
|
|
||||||
if (handler->proto==0)
|
|
||||||
return handler->vendor ? 10 : 4;
|
|
||||||
|
|
||||||
return 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
||||||
{
|
{
|
||||||
cw_dbg(DBG_INFO,"CISCO: Register messages");
|
cw_dbg(DBG_INFO,"CISCO: Register messages");
|
||||||
@ -60,8 +35,6 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
|||||||
capwap_mod->register_messages(set, CW_MOD_MODE_CAPWAP);
|
capwap_mod->register_messages(set, CW_MOD_MODE_CAPWAP);
|
||||||
capwap80211_mod->register_messages(set, CW_MOD_MODE_BINDINGS);
|
capwap80211_mod->register_messages(set, CW_MOD_MODE_BINDINGS);
|
||||||
cisco_register_msg_set(set,CW_MOD_MODE_CAPWAP);
|
cisco_register_msg_set(set,CW_MOD_MODE_CAPWAP);
|
||||||
set->write_header = write_header;
|
|
||||||
set->header_len = header_len;
|
|
||||||
|
|
||||||
|
|
||||||
/* cw_dbg(DBG_MOD,"Cisco: loading cisco message set");*/
|
/* cw_dbg(DBG_MOD,"Cisco: loading cisco message set");*/
|
||||||
@ -220,6 +193,31 @@ static struct cw_Mod capwap_ac = {
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||||
|
{
|
||||||
|
if (handler->proto == 0){
|
||||||
|
if (handler->vendor)
|
||||||
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||||
|
|
||||||
|
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||||
|
}
|
||||||
|
/* put the lwap elem header */
|
||||||
|
lw_set_dword(dst + 10, handler->vendor);
|
||||||
|
lw_set_word(dst + 14, handler->id);
|
||||||
|
return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor,
|
||||||
|
CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int header_len(struct cw_ElemHandler * handler)
|
||||||
|
{
|
||||||
|
if (handler->proto==0)
|
||||||
|
return handler->vendor ? 10 : 4;
|
||||||
|
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int static setup_cfg(struct conn * conn)
|
int static setup_cfg(struct conn * conn)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ cisco/ap-regulatory-domain.1/slot :Byte: 0
|
|||||||
cisco/ap-sub-mode :Byte: 0
|
cisco/ap-sub-mode :Byte: 0
|
||||||
cisco/ap-telnet-ssh/ssh :Bool: false
|
cisco/ap-telnet-ssh/ssh :Bool: false
|
||||||
cisco/ap-telnet-ssh/telnet :Bool: false
|
cisco/ap-telnet-ssh/telnet :Bool: false
|
||||||
cisco/ap-timesync/timestamp :Dword: 1469886778
|
cisco/ap-timesync/timestamp :Dword: 1469722147
|
||||||
cisco/ap-timesync/type :Byte: 0
|
cisco/ap-timesync/type :Byte: 0
|
||||||
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
|
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
|
||||||
cisco/ap-username-and-password/802.1x-credentials/password :Str:
|
cisco/ap-username-and-password/802.1x-credentials/password :Str:
|
||||||
@ -85,7 +85,7 @@ cisco/loghost-config/loghost.0 :IPAddress: 7.7.1.3
|
|||||||
cisco/loghost-config/loghost.1 :IPAddress: 0.0.0.0
|
cisco/loghost-config/loghost.1 :IPAddress: 0.0.0.0
|
||||||
cisco/loghost-config/loghost.2 :IPAddress: 0.0.0.0
|
cisco/loghost-config/loghost.2 :IPAddress: 0.0.0.0
|
||||||
cisco/loghost-config/loghost.3 :IPAddress: 0.0.0.0
|
cisco/loghost-config/loghost.3 :IPAddress: 0.0.0.0
|
||||||
cisco/mcast-mgid-info :Bstr16: .x0000000d0000000000000000000000000000000101000000
|
cisco/mcast-mgid-info :Bstr16: .x000000010000000000000000000000000000000101000000
|
||||||
cisco/mwar-addr/address :IPAddress: 192.168.0.162
|
cisco/mwar-addr/address :IPAddress: 192.168.0.162
|
||||||
cisco/mwar-addr/mwar-type :Byte: 0
|
cisco/mwar-addr/mwar-type :Byte: 0
|
||||||
cisco/mwar-addr/unknown :Word: 0
|
cisco/mwar-addr/unknown :Word: 0
|
||||||
@ -97,7 +97,7 @@ cisco/rouge-and-mss/roge-detection :Bool: true
|
|||||||
cisco/rouge-and-mss/tcp-adjust-mss :Word: 0
|
cisco/rouge-and-mss/tcp-adjust-mss :Word: 0
|
||||||
cisco/rouge-detection/rest :Bstr16: .x000aff800000
|
cisco/rouge-detection/rest :Bstr16: .x000aff800000
|
||||||
cisco/rouge-detection/rouge-detection :Bool: false
|
cisco/rouge-detection/rouge-detection :Bool: false
|
||||||
cisco/sig-toogle :Bool: true
|
cisco/sig-toogle :Bool: false
|
||||||
cisco/spam-domain-secret :Bstr16: .xe1ffd18a8f15b3b59c0a47a7f17a96e7cb36174f00
|
cisco/spam-domain-secret :Bstr16: .xe1ffd18a8f15b3b59c0a47a7f17a96e7cb36174f00
|
||||||
cisco/ssl-certfile :Str: ../../ssl/certs/wtpc.crt
|
cisco/ssl-certfile :Str: ../../ssl/certs/wtpc.crt
|
||||||
cisco/ssl-cipher :Str: RSA:AES-128-CBC:SHA1
|
cisco/ssl-cipher :Str: RSA:AES-128-CBC:SHA1
|
||||||
@ -141,7 +141,7 @@ radio.0/cisco/direct-sequence-control/current-cca-mode :Byte: 0
|
|||||||
radio.0/cisco/direct-sequence-control/current-channel :Byte: 1
|
radio.0/cisco/direct-sequence-control/current-channel :Byte: 1
|
||||||
radio.0/cisco/direct-sequence-control/energy-detect-threshold :Dword: -50
|
radio.0/cisco/direct-sequence-control/energy-detect-threshold :Dword: -50
|
||||||
radio.0/cisco/direct-sequence-control/unknown :Byte: 1
|
radio.0/cisco/direct-sequence-control/unknown :Byte: 1
|
||||||
radio.0/cisco/elem19 :Bstr16: .xc0a800a10001000bc0a800a103000101001ecd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
|
radio.0/cisco/elem19 :Bstr16: .xc0a800a10001000bc0a800a103000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
|
||||||
radio.0/cisco/elem22 :Bstr16: .x0d00b400320102030405060708090a0b0c0d
|
radio.0/cisco/elem22 :Bstr16: .x0d00b400320102030405060708090a0b0c0d
|
||||||
radio.0/cisco/elem24 :Bstr16: .x003c000c
|
radio.0/cisco/elem24 :Bstr16: .x003c000c
|
||||||
radio.0/cisco/elem81 :Bstr16: .x00000000010101010a001e0a02051cbfffbfff0a00
|
radio.0/cisco/elem81 :Bstr16: .x00000000010101010a001e0a02051cbfffbfff0a00
|
||||||
@ -196,7 +196,7 @@ radio.0/wlan.0/add-wlan/scan-defer-time :Word: 100
|
|||||||
radio.0/wlan.0/add-wlan/session-timout :Word: 1800
|
radio.0/wlan.0/add-wlan/session-timout :Word: 1800
|
||||||
radio.0/wlan.0/add-wlan/ssid :Str:
|
radio.0/wlan.0/add-wlan/ssid :Str:
|
||||||
radio.0/wlan.0/add-wlan/wep-encryption :Bool: false
|
radio.0/wlan.0/add-wlan/wep-encryption :Bool: false
|
||||||
radio.0/wlan.0/add-wlan/wep-key :Bstr16: .x25c544f95684f1f8687a411ca5
|
radio.0/wlan.0/add-wlan/wep-key :Bstr16: .x61d4be12e22feb1135d1be6d3f
|
||||||
radio.0/wlan.0/add-wlan/wep-key-index :Byte: 1
|
radio.0/wlan.0/add-wlan/wep-key-index :Byte: 1
|
||||||
radio.0/wlan.0/add-wlan/wlan-capability :Word: 1073
|
radio.0/wlan.0/add-wlan/wlan-capability :Word: 1073
|
||||||
radio.0/wlan.0/add-wlan/wlan-id :Byte: 1
|
radio.0/wlan.0/add-wlan/wlan-id :Byte: 1
|
||||||
@ -212,40 +212,6 @@ radio.0/wlan.0/ssid-a :Str: Schlosspark
|
|||||||
radio.0/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
|
radio.0/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
|
||||||
radio.0/wlan.0/wlan-capability :Word: 1057
|
radio.0/wlan.0/wlan-capability :Word: 1057
|
||||||
radio.0/wlan.0/wlan-id :Byte: 0
|
radio.0/wlan.0/wlan-id :Byte: 0
|
||||||
radio.0/wlan.1/add-wlan/aironet-ie :Bool: true
|
|
||||||
radio.0/wlan.1/add-wlan/broadcast-ssid :Bool: true
|
|
||||||
radio.0/wlan.1/add-wlan/dtim-period :Byte: 1
|
|
||||||
radio.0/wlan.1/add-wlan/encryption-policy :Dword: 4
|
|
||||||
radio.0/wlan.1/add-wlan/hreap-local-switch :Byte: 0
|
|
||||||
radio.0/wlan.1/add-wlan/profile-name :Str: tubeC
|
|
||||||
radio.0/wlan.1/add-wlan/qos :Byte: 0
|
|
||||||
radio.0/wlan.1/add-wlan/radio-id :Byte: 0
|
|
||||||
radio.0/wlan.1/add-wlan/scan-defer-period :Word: 28784
|
|
||||||
radio.0/wlan.1/add-wlan/scan-defer-time :Word: 100
|
|
||||||
radio.0/wlan.1/add-wlan/session-timout :Word: 1800
|
|
||||||
radio.0/wlan.1/add-wlan/ssid :Str: tubeC
|
|
||||||
radio.0/wlan.1/add-wlan/wep-encryption :Bool: false
|
|
||||||
radio.0/wlan.1/add-wlan/wep-key :Bstr16: .xc3616fee42fcf74fa02bff3d87
|
|
||||||
radio.0/wlan.1/add-wlan/wep-key-index :Byte: 1
|
|
||||||
radio.0/wlan.1/add-wlan/wlan-capability :Word: 1073
|
|
||||||
radio.0/wlan.1/add-wlan/wlan-id :Byte: 1
|
|
||||||
radio.0/wlan.13/add-wlan/aironet-ie :Bool: true
|
|
||||||
radio.0/wlan.13/add-wlan/broadcast-ssid :Bool: true
|
|
||||||
radio.0/wlan.13/add-wlan/dtim-period :Byte: 19
|
|
||||||
radio.0/wlan.13/add-wlan/encryption-policy :Dword: 1
|
|
||||||
radio.0/wlan.13/add-wlan/hreap-local-switch :Byte: 16
|
|
||||||
radio.0/wlan.13/add-wlan/profile-name :Str: SuerWLAN
|
|
||||||
radio.0/wlan.13/add-wlan/qos :Byte: 0
|
|
||||||
radio.0/wlan.13/add-wlan/radio-id :Byte: 0
|
|
||||||
radio.0/wlan.13/add-wlan/scan-defer-period :Word: 15420
|
|
||||||
radio.0/wlan.13/add-wlan/scan-defer-time :Word: 100
|
|
||||||
radio.0/wlan.13/add-wlan/session-timout :Word: 1800
|
|
||||||
radio.0/wlan.13/add-wlan/ssid :Str: SuperSSID
|
|
||||||
radio.0/wlan.13/add-wlan/wep-encryption :Bool: false
|
|
||||||
radio.0/wlan.13/add-wlan/wep-key :Bstr16: .x00000000000000000000000000
|
|
||||||
radio.0/wlan.13/add-wlan/wep-key-index :Byte: 1
|
|
||||||
radio.0/wlan.13/add-wlan/wlan-capability :Word: 1057
|
|
||||||
radio.0/wlan.13/add-wlan/wlan-id :Byte: 13
|
|
||||||
radio.0/wtp-radio-information :Dword: 1
|
radio.0/wtp-radio-information :Dword: 1
|
||||||
radio.1/admin-state :Byte: reserved
|
radio.1/admin-state :Byte: reserved
|
||||||
radio.1/cisco-multi-domain-capability/first-channel :Word: 36
|
radio.1/cisco-multi-domain-capability/first-channel :Word: 36
|
||||||
@ -263,7 +229,7 @@ radio.1/cisco/antenna-payload/number-of-antennas :Byte: 2
|
|||||||
radio.1/cisco/antenna-payload/unknown :Byte: 3
|
radio.1/cisco/antenna-payload/unknown :Byte: 3
|
||||||
radio.1/cisco/channel-power :Bstr16: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe
|
radio.1/cisco/channel-power :Bstr16: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe
|
||||||
radio.1/cisco/elem15 :Bstr16: .x027007ffffffce010001
|
radio.1/cisco/elem15 :Bstr16: .x027007ffffffce010001
|
||||||
radio.1/cisco/elem19 :Bstr16: .xc0a800a10001000ac0a800a110000101001ecd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
|
radio.1/cisco/elem19 :Bstr16: .xc0a800a10001000ac0a800a110000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
|
||||||
radio.1/cisco/elem22 :Bstr16: .x1000b4003224282c3034383c4064686c707484888c
|
radio.1/cisco/elem22 :Bstr16: .x1000b4003224282c3034383c4064686c707484888c
|
||||||
radio.1/cisco/elem24 :Bstr16: .x003c000c
|
radio.1/cisco/elem24 :Bstr16: .x003c000c
|
||||||
radio.1/cisco/elem47 :Bstr16: .x01ccb0000c000f42401999ba1040000003
|
radio.1/cisco/elem47 :Bstr16: .x01ccb0000c000f42401999ba1040000003
|
||||||
@ -282,7 +248,7 @@ radio.1/cisco/multi-domain-capability/max-tx-power-level :Word: 20
|
|||||||
radio.1/cisco/multi-domain-capability/number-of-channels :Word: 4
|
radio.1/cisco/multi-domain-capability/number-of-channels :Word: 4
|
||||||
radio.1/cisco/multi-domain-capability/reserved :Byte: 1
|
radio.1/cisco/multi-domain-capability/reserved :Byte: 1
|
||||||
radio.1/cisco/tx-power-levels :Bstr16: .x070011000e000b000800050002ffff0000
|
radio.1/cisco/tx-power-levels :Bstr16: .x070011000e000b000800050002ffff0000
|
||||||
radio.1/cisco/tx-power/current-tx-power :Word: 1
|
radio.1/cisco/tx-power/current-tx-power :Word: 6
|
||||||
radio.1/cisco/tx-power/reserved :Byte: 1
|
radio.1/cisco/tx-power/reserved :Byte: 1
|
||||||
radio.1/cisco/wtp-radio-config/beacon-period :Word: 100
|
radio.1/cisco/wtp-radio-config/beacon-period :Word: 100
|
||||||
radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90
|
radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90
|
||||||
@ -300,40 +266,23 @@ radio.1/decryption-error-report-period :Word: 120
|
|||||||
radio.1/operational-state/cause :Byte: Normal
|
radio.1/operational-state/cause :Byte: Normal
|
||||||
radio.1/operational-state/state :Byte: enabled
|
radio.1/operational-state/state :Byte: enabled
|
||||||
radio.1/rate_set :Bstr16: .x8c129824b048606c
|
radio.1/rate_set :Bstr16: .x8c129824b048606c
|
||||||
radio.1/wlan.1/add-wlan/aironet-ie :Bool: true
|
radio.1/wlan.0/add-lw-wlan/misc :Bstr16: .x3e9904fac0000100
|
||||||
radio.1/wlan.1/add-wlan/broadcast-ssid :Bool: true
|
radio.1/wlan.0/add-lw-wlan/misc2 :Word: 4
|
||||||
radio.1/wlan.1/add-wlan/dtim-period :Byte: 1
|
radio.1/wlan.0/add-lw-wlan/ssid :Str: TubeSSID
|
||||||
radio.1/wlan.1/add-wlan/encryption-policy :Dword: 4
|
radio.1/wlan.0/add-wlan/broadcast-ssid :Bool: true
|
||||||
radio.1/wlan.1/add-wlan/hreap-local-switch :Byte: 0
|
radio.1/wlan.0/add-wlan/dtim-period :Byte: 1
|
||||||
radio.1/wlan.1/add-wlan/profile-name :Str: tubeC
|
radio.1/wlan.0/add-wlan/encryption-policy :Dword: 4
|
||||||
radio.1/wlan.1/add-wlan/qos :Byte: 0
|
radio.1/wlan.0/add-wlan/profile-name :Str: tubeC
|
||||||
radio.1/wlan.1/add-wlan/radio-id :Byte: 1
|
radio.1/wlan.0/add-wlan/qos :Byte: 0
|
||||||
radio.1/wlan.1/add-wlan/scan-defer-period :Word: 28784
|
radio.1/wlan.0/add-wlan/radio-id :Byte: 1
|
||||||
radio.1/wlan.1/add-wlan/scan-defer-time :Word: 100
|
radio.1/wlan.0/add-wlan/scan-defer-time :Word: 100
|
||||||
radio.1/wlan.1/add-wlan/session-timout :Word: 1800
|
radio.1/wlan.0/add-wlan/session-timout :Word: 1800
|
||||||
radio.1/wlan.1/add-wlan/ssid :Str: tubeC
|
radio.1/wlan.0/add-wlan/ssid :Str:
|
||||||
radio.1/wlan.1/add-wlan/wep-encryption :Bool: false
|
radio.1/wlan.0/add-wlan/wep-encryption :Bool: false
|
||||||
radio.1/wlan.1/add-wlan/wep-key :Bstr16: .xcac80297ec10e7a8da2c9b1f03
|
radio.1/wlan.0/add-wlan/wep-key :Bstr16: .xf0571b63dc70fdf913e2bd0806
|
||||||
radio.1/wlan.1/add-wlan/wep-key-index :Byte: 1
|
radio.1/wlan.0/add-wlan/wep-key-index :Byte: 1
|
||||||
radio.1/wlan.1/add-wlan/wlan-capability :Word: 17
|
radio.1/wlan.0/add-wlan/wlan-capability :Word: 17
|
||||||
radio.1/wlan.1/add-wlan/wlan-id :Byte: 1
|
radio.1/wlan.0/add-wlan/wlan-id :Byte: 1
|
||||||
radio.1/wlan.13/add-wlan/aironet-ie :Bool: true
|
|
||||||
radio.1/wlan.13/add-wlan/broadcast-ssid :Bool: true
|
|
||||||
radio.1/wlan.13/add-wlan/dtim-period :Byte: 19
|
|
||||||
radio.1/wlan.13/add-wlan/encryption-policy :Dword: 1
|
|
||||||
radio.1/wlan.13/add-wlan/hreap-local-switch :Byte: 16
|
|
||||||
radio.1/wlan.13/add-wlan/profile-name :Str: SuerWLAN
|
|
||||||
radio.1/wlan.13/add-wlan/qos :Byte: 0
|
|
||||||
radio.1/wlan.13/add-wlan/radio-id :Byte: 1
|
|
||||||
radio.1/wlan.13/add-wlan/scan-defer-period :Word: 15420
|
|
||||||
radio.1/wlan.13/add-wlan/scan-defer-time :Word: 100
|
|
||||||
radio.1/wlan.13/add-wlan/session-timout :Word: 1800
|
|
||||||
radio.1/wlan.13/add-wlan/ssid :Str: SuperSSID
|
|
||||||
radio.1/wlan.13/add-wlan/wep-encryption :Bool: false
|
|
||||||
radio.1/wlan.13/add-wlan/wep-key :Bstr16: .x00000000000000000000000000
|
|
||||||
radio.1/wlan.13/add-wlan/wep-key-index :Byte: 1
|
|
||||||
radio.1/wlan.13/add-wlan/wlan-capability :Word: 1
|
|
||||||
radio.1/wlan.13/add-wlan/wlan-id :Byte: 13
|
|
||||||
radio.1/wtp-radio-information :Dword: 2
|
radio.1/wtp-radio-information :Dword: 2
|
||||||
radio.255/admin-state :Byte: reserved
|
radio.255/admin-state :Byte: reserved
|
||||||
radio.255/operational-state/cause :Byte: Normal
|
radio.255/operational-state/cause :Byte: Normal
|
||||||
|
@ -97,24 +97,21 @@ static void do_update(struct conn * conn)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (!update)
|
if (!update)
|
||||||
// return;
|
return;
|
||||||
// update=0;
|
update=0;
|
||||||
|
|
||||||
/* mbag_t result = mbag_create();
|
/* mbag_t result = mbag_create();
|
||||||
update_radios(conn,result);
|
update_radios(conn,result);
|
||||||
*/ cw_dbg(DBG_INFO, "Saving configuration ...");
|
*/ cw_dbg(DBG_INFO, "Saving configuration ...");
|
||||||
/* cfg_to_json();*/
|
/* cfg_to_json();*/
|
||||||
/* Change State ... */
|
/* Change State ... */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
rc = cw_send_request(conn,CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST);
|
rc = cw_send_request(conn,CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST);
|
||||||
if ( !cw_result_is_ok(rc) ) {
|
if ( !cw_result_is_ok(rc) ) {
|
||||||
cw_strresult(rc);
|
cw_strresult(rc);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -165,26 +162,24 @@ int run(struct conn * conn)
|
|||||||
if (rc < 0 && errno == EAGAIN) {
|
if (rc < 0 && errno == EAGAIN) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("--------------------------------------------------------------------------------------\n");
|
|
||||||
|
|
||||||
if ( !cw_result_is_ok(rc)) {
|
|
||||||
printf("---------------------- cwrsult is not ok\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("lalalala\n");
|
|
||||||
cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:", "DUMP done -------");
|
|
||||||
|
if ( !cw_result_is_ok(rc))
|
||||||
|
break;
|
||||||
|
|
||||||
printf("Saving Config\n");
|
printf("Saving Config\n");
|
||||||
mavl_merge(conn->local_cfg,conn->remote_cfg);
|
mavl_merge(conn->local_cfg,conn->remote_cfg);
|
||||||
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;
|
update=1;
|
||||||
do_update(conn);
|
do_update(conn);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
if (rc<0 && errno == EAGAIN){
|
if (rc<0 && errno == EAGAIN){
|
||||||
rc = cw_send_request(conn,CAPWAP_MSG_ECHO_REQUEST);
|
rc = cw_send_request(conn,CAPWAP_MSG_ECHO_REQUEST);
|
||||||
|
|
||||||
@ -199,6 +194,9 @@ cw_dbg_ktv_dump(conn->remote_cfg,DBG_INFO,"KTV DUMP ----------------","Remote:",
|
|||||||
cw_log(LOG_ERR,"Error in run state: %d %s",rc,cw_strrc(rc));
|
cw_log(LOG_ERR,"Error in run state: %d %s",rc,cw_strrc(rc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} while (conn->capwap_state == CAPWAP_STATE_RUN);
|
} while (conn->capwap_state == CAPWAP_STATE_RUN);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user