Renamed KTV to Val.

This commit is contained in:
7u83 2022-07-31 17:15:32 +02:00
parent 996446d115
commit a05bbf5fd6
86 changed files with 365 additions and 347 deletions

View File

@ -123,7 +123,7 @@ extern struct cw_Mod * cw_get_mod_ac (const char *name);
extern void test_sets();
#include "cw/file.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "discovery_cache.h"
@ -154,7 +154,7 @@ void tester1()
static void show_cfg (FILE *out, mavl_t ktv)
{
char value[500];
struct cw_KTV * data;
struct cw_Val * data;
mavliter_t it;
const struct cw_Type * type;
@ -173,21 +173,7 @@ static void show_cfg (FILE *out, mavl_t ktv)
}
/*
{
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[])
{
@ -197,7 +183,32 @@ int main (int argc, char *argv[])
mavl_t types_tree, global_cfg;
const cw_Type_t **ti;
/*
{
cw_Cfg_t * cfg;
cfg=cw_cfg_create();
char *val;
cw_cfg_load("tube.akv",cfg);
// cw_cfg_set(cfg,"cisco/tube","99");
// cw_cfg_set(cfg,"Hello","30");
cw_cfg_dump(cfg);
val = cw_cfg_get(cfg,"birth");
if (val){
printf("Birts: %s\n",val);
}
mavl_destroy(cfg);
}
cw_Val_t x;
CW_TYPE_STR->from_str(&x,"hallo");
x.type->del(&x);
return 0;
*/
/* parse arguments */

View File

@ -130,7 +130,7 @@ wlan0_cmd(struct shelldata * sd, const char *cmd)
void set_cmd(struct shelldata *sd, const char *str)
{
struct conn * conn;
struct cw_KTV_Reader r;
struct cw_Val_Reader r;
char key[CW_KTV_MAX_KEY_LEN];
char type[CW_KTV_MAX_KEY_LEN];
char val[2048];
@ -155,7 +155,7 @@ void del_cmd(struct shelldata *sd, const char *str)
void show_cfg (FILE *out, mavl_t ktv)
{
char value[500];
struct cw_KTV * data;
struct cw_Val * data;
mavliter_t it;
const struct cw_Type * type;
@ -186,7 +186,7 @@ void show_aps (FILE *out)
mavliter_init (&it, cl->by_addr);
fprintf (out, "IP\t\t\twtp-name\n");
mavliter_foreach (&it) {
cw_KTV_t * result;
cw_Val_t * result;
char addr[SOCK_ADDR_BUFSIZE];
char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
struct conn * conn;
@ -222,7 +222,7 @@ struct conn * find_ap(const char *name)
mavliter_init (&it, cl->by_addr);
mavliter_foreach (&it) {
cw_KTV_t * result;
cw_Val_t * result;
char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
struct conn * conn;
conn = mavliter_get_ptr (&it);
@ -263,7 +263,7 @@ void con (FILE *out)
mavliter_init (&it, cl->by_addr);
fprintf (out, "IP\t\t\twtp-name\n");
mavliter_foreach (&it) {
cw_KTV_t * result;
cw_Val_t * result;
char addr[SOCK_ADDR_BUFSIZE];
char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
struct conn * conn;
@ -318,7 +318,7 @@ void execute_cmd (struct shelldata * sd, const char *str)
char cmd[1024];
char args[1024];
int n;
struct cw_KTV_Reader reader;
struct cw_Val_Reader reader;
struct command * searchcmd;
args[0]=0;

View File

@ -41,7 +41,7 @@
#include "socklist.h"
#include "wtpman.h"
#include "wtplist.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "actube.h"

View File

@ -92,7 +92,6 @@ KTVSRC=\
cw_ktv_get_dword.c\
cw_ktv_get_sysptr.c\
cw_ktv_get_str.c\
cw_ktv_parser.c\
cw_ktv_idx_get.c\
cw_ktv_mavlcmp.c\
cw_ktv_mavlcmp_type_by_name.c\
@ -105,10 +104,10 @@ KTVSRC=\
cw_ktv_base_exists.c\
cw_ktv_save.c\
cw_ktv_del_sub.c\
cw_ktv_parser.c\
cfg.c\
LWSRC=\
lw_addelem.c\
lw_checksum.c\

View File

@ -5,6 +5,7 @@
#include "cw.h"
#include "cfg.h"
#include "val.h"
static int cmp(const void *k1,const void*k2){
struct cw_Cfg_entry * e1,*e2;
@ -61,6 +62,13 @@ char * cw_cfg_get(cw_Cfg_t * cfg, char *key)
return r->val;
}
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key)
{
}
void cw_cfg_dump(cw_Cfg_t *cfg)
{
mavliter_t it;

View File

@ -32,7 +32,7 @@
#include "mod.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"

View File

@ -12,7 +12,7 @@
*/
int cw_detect_nat(struct conn *conn)
{
cw_KTV_t * result;
cw_Val_t * result;
char local_str[128];
char remote_str[128];

View File

@ -1,13 +1,13 @@
#include "capwap.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
#include "log.h"
int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len)
{
cw_KTV_t * result;
cw_Val_t * result;
if (!handler->type){
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);

View File

@ -1,7 +1,7 @@
#include "cw.h"
static const cw_KTVEnum_t * get_enum(const cw_KTVEnum_t * e, int val){
static const cw_ValEnum_t * get_enum(const cw_ValEnum_t * e, int val){
int i;
for (i=0; e[i].type != NULL; i++ ){
if (e[i].value==val){
@ -16,7 +16,7 @@ int cw_in_generic_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerPar
uint8_t * elem_data, int elem_len)
{
int val;
const cw_KTVEnum_t * e;
const cw_ValEnum_t * e;
char key[CW_KTV_MAX_KEY_LEN];
struct cw_ElemHandler thandler;
@ -33,4 +33,4 @@ int cw_in_generic_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerPar
thandler.key=key;
return e->fun_in(&thandler,params,elem_data,elem_len-1);
}
}

View File

@ -3,7 +3,7 @@
#include "cw.h"
static const cw_KTVEnum_t * get_enum(const cw_KTVEnum_t * e, int val){
static const cw_ValEnum_t * get_enum(const cw_ValEnum_t * e, int val){
int i;
for (i=0; e[i].type != NULL; i++ ){
if (e[i].value==val){
@ -18,8 +18,8 @@ int cw_in_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemHa
{
int val;
int l,f;
const cw_KTVEnum_t * e;
const cw_KTVIndexed_t * ie;
const cw_ValEnum_t * e;
const cw_ValIndexed_t * ie;
char key[CW_KTV_MAX_KEY_LEN];
struct cw_ElemHandler thandler;
@ -50,4 +50,4 @@ int cw_in_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemHa
thandler.key=key;
return e->fun_in(&thandler,params,elem_data+f,elem_len-l);
}
}

View File

@ -1,7 +1,7 @@
#include "capwap.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
#include "log.h"
int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,

View File

@ -5,7 +5,7 @@ int cw_in_idx_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerPara
uint8_t * elem_data, int elem_len)
{
char key[CW_KTV_MAX_KEY_LEN];
cw_KTV_t * result;
cw_Val_t * result;
int idx;
if (!handler->type){

View File

@ -1,7 +1,7 @@
#include "capwap.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
#include "log.h"
#include "cw.h"

View File

@ -1,7 +1,7 @@
#include "capwap.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
#include "log.h"
#include "cw.h"

View File

@ -1,14 +1,14 @@
#include "ktv.h"
#include "val.h"
#include "cw.h"
#include "log.h"
#include "dbg.h"
cw_KTV_t * cw_ktv_add(mavl_t kvtstore, const char *key, const struct cw_Type *type,
cw_Val_t * cw_ktv_add(mavl_t kvtstore, const char *key, const struct cw_Type *type,
const void * valguard,
const uint8_t * data, int len)
{
cw_KTV_t mdata, *mresult;
cw_Val_t mdata, *mresult;
int exists;
mdata.key=cw_strdup(key);

View File

@ -1,4 +1,4 @@
#include "ktv.h"
#include "val.h"
#include "cw.h"
#include "log.h"
@ -9,7 +9,7 @@ const char * cw_ktv_add_from_str(mavl_t kvtstore, const char *key,
const void * valguard,
const char * str)
{
cw_KTV_t mdata, *mresult;
cw_Val_t mdata, *mresult;
int exists;
/* cw_dbg(DBG_ELEM,"KVStore (%p,%d) add elem (%s): %s", kvstore, kvstore->count,

View File

@ -1,4 +1,4 @@
#include "ktv.h"
#include "val.h"
/**
* @file
* @description Implementation of cw_ktv_base_exisits
@ -14,9 +14,9 @@
* otherwise NULL if no element was found.
*
*/
cw_KTV_t * cw_ktv_base_exists(mavl_t ktvstore, const char *basekey)
cw_Val_t * cw_ktv_base_exists(mavl_t ktvstore, const char *basekey)
{
cw_KTV_t * result, search;
cw_Val_t * result, search;
search.key=(char*)basekey;
result = mavl_get_first(ktvstore,&search);
if (result == NULL)

View File

@ -1,6 +1,6 @@
#include "ktv.h"
#include "val.h"
cw_KTV_t * cw_ktv_cast(cw_KTV_t *v,const cw_Type_t * type)
cw_Val_t * cw_ktv_cast(cw_Val_t *v,const cw_Type_t * type)
{
if (strcmp(v->type->name,type->name)==0)
return v;

View File

@ -1,10 +1,10 @@
#include "ktv.h"
#include "val.h"
void cw_ktv_del_sub(mavl_t ktvstore, const char *basekey)
{
cw_KTV_t * result, search;
cw_Val_t * result, search;
while (1){

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
#include "ktv.h"
#include "val.h"
void * ktvn(struct mavl *t ,const void *search)
{
@ -8,7 +8,7 @@ void * ktvn(struct mavl *t ,const void *search)
n = t->root;
while(n){
int rc;
/* const cw_KTV_t;*//* *c1,*c2;*/
/* const cw_Val_t;*//* *c1,*c2;*/
/*c1=search;
c2=mavlnode_dataptr(n);
*/
@ -46,7 +46,7 @@ void * ktvn(struct mavl *t ,const void *search)
int cw_ktv_idx_get(mavl_t ktv, const char *key)
{
char ikey[CW_KTV_MAX_KEY_LEN];
cw_KTV_t search, * result;
cw_Val_t search, * result;
char *d;
sprintf(ikey,"%s.%d",key,65536);
@ -76,7 +76,7 @@ int cw_ktv_idx_get(mavl_t ktv, const char *key)
int cw_ktv_idx_get_next(mavl_t ktv, const char *key, int n)
{
char ikey[CW_KTV_MAX_KEY_LEN];
cw_KTV_t search, * result;
cw_Val_t search, * result;
char *d;
int i;

View File

@ -1,9 +1,9 @@
#include <ctype.h>
#include "ktv.h"
#include "val.h"
/**
* @brief Default function to compare two values of type #cw_KTV_t.
* @brief Default function to compare two values of type #cw_Val_t.
*
* @param v1
* @param v2
@ -14,8 +14,8 @@ int cw_ktv_mavlcmp (const void *v1, const void *v2)
char *d1, *d2, *k1, *k2;
int l1, l2, rc, i1, i2;
k1 = ( (cw_KTV_t *) v1)->key;
k2 = ( (cw_KTV_t *) v2)->key;
k1 = ( (cw_Val_t *) v1)->key;
k2 = ( (cw_Val_t *) v2)->key;
while (1) {
/* Find dots in both keys */
@ -28,16 +28,16 @@ int cw_ktv_mavlcmp (const void *v1, const void *v2)
/* calculate the length of the key till dots */
l1 = d1 - k1; /*((cw_KTV_t *) v1)->key;*/
l2 = d2 - k2; /*((cw_KTV_t *) v2)->key;*/
l1 = d1 - k1; /*((cw_Val_t *) v1)->key;*/
l2 = d2 - k2; /*((cw_Val_t *) v2)->key;*/
/* if length differs do a normal compare */
if (l1 != l2) {
return strcmp (k1, k2); /*((cw_KTV_t *) v1)->key, ((cw_KTV_t *) v2)->key);*/
return strcmp (k1, k2); /*((cw_Val_t *) v1)->key, ((cw_Val_t *) v2)->key);*/
}
rc = strncmp (k1, k2, l1); /*((cw_KTV_t *) v1)->key,((cw_KTV_t *) v2)->key,l1);*/
rc = strncmp (k1, k2, l1); /*((cw_Val_t *) v1)->key,((cw_Val_t *) v2)->key,l1);*/
if (rc != 0) {
return rc;

View File

@ -1,5 +1,5 @@
#include "ktv.h"
#include "val.h"
int cw_ktv_mavlcmp_type_by_name (const void *v1, const void *v2)
{

View File

@ -2,11 +2,11 @@
#include <stdlib.h>
#include "ktv.h"
#include "val.h"
void cw_ktv_mavldel(void *data)
{
struct cw_KTV *ktv = data;
struct cw_Val *ktv = data;
if (ktv->type->del) {
ktv->type->del(data);
}

View File

@ -1,9 +1,9 @@
#include <stdint.h>
#include "ktv.h"
#include "val.h"
static int str_getc(struct cw_KTV_Reader * r)
static int str_getc(struct cw_Val_Reader * r)
{
if (r->next==r->maxlen)
return EOF;
@ -11,15 +11,15 @@ static int str_getc(struct cw_KTV_Reader * r)
return *((uint8_t*)(r->data)+r->next++);
}
static void str_ungetc(struct cw_KTV_Reader * r, int c)
static void str_ungetc(struct cw_Val_Reader * r, int c)
{
if (r->next>0)
r->next--;
}
void cw_ktv_init_str_reader(struct cw_KTV_Reader *r, const char * str, int len)
void cw_ktv_init_str_reader(struct cw_Val_Reader *r, const char * str, int len)
{
memset(r,0,sizeof(struct cw_KTV_Reader));
memset(r,0,sizeof(struct cw_Val_Reader));
r->data = str;
r->xgetchar=str_getc;
r->ungetchar=str_ungetc;
@ -28,7 +28,7 @@ void cw_ktv_init_str_reader(struct cw_KTV_Reader *r, const char * str, int len)
#include <ctype.h>
#include "ktv.h"
#include "val.h"
/*
struct parser {
int line;
@ -44,7 +44,7 @@ struct parser {
static int get_char(struct cw_KTV_Reader *r)
static int get_char(struct cw_Val_Reader *r)
{
int c;
c = r->xgetchar (r);
@ -58,7 +58,7 @@ static int get_char(struct cw_KTV_Reader *r)
}
static void unget_char(struct cw_KTV_Reader * r,int c){
static void unget_char(struct cw_Val_Reader * r,int c){
r->ungetchar(r,c);
if (c=='\n'){
r->line--;
@ -70,7 +70,7 @@ static void unget_char(struct cw_KTV_Reader * r,int c){
static int get_char_q(struct cw_KTV_Reader *p)
static int get_char_q(struct cw_Val_Reader *p)
{
int c;
@ -128,7 +128,7 @@ static int get_char_q(struct cw_KTV_Reader *p)
static int skip_chars (struct cw_KTV_Reader *r, const char * chars)
static int skip_chars (struct cw_Val_Reader *r, const char * chars)
{
int c;
@ -140,7 +140,7 @@ static int skip_chars (struct cw_KTV_Reader *r, const char * chars)
return c;
}
static int skip_to_chars (struct cw_KTV_Reader *r, const char *chars)
static int skip_to_chars (struct cw_Val_Reader *r, const char *chars)
{
int c;
@ -153,7 +153,7 @@ static int skip_to_chars (struct cw_KTV_Reader *r, const char *chars)
static int read_key (struct cw_KTV_Reader *r, char *key, int max_len)
static int read_key (struct cw_Val_Reader *r, char *key, int max_len)
{
int c,n;
@ -186,7 +186,7 @@ static int read_key (struct cw_KTV_Reader *r, char *key, int max_len)
}
static int skip_to_colon(struct cw_KTV_Reader * r)
static int skip_to_colon(struct cw_Val_Reader * r)
{
int c;
c = skip_chars (r, " \t");
@ -203,7 +203,7 @@ static int skip_to_colon(struct cw_KTV_Reader * r)
}
static int read_type(struct cw_KTV_Reader * r, char *type, int max_len)
static int read_type(struct cw_Val_Reader * r, char *type, int max_len)
{
int c,n;
@ -251,7 +251,7 @@ static int read_type(struct cw_KTV_Reader * r, char *type, int max_len)
}
static int read_val(struct cw_KTV_Reader *r, char *val, int max_len){
static int read_val(struct cw_Val_Reader *r, char *val, int max_len){
int c,n,quote;
c = skip_to_colon(r);
if (c==-1)
@ -337,12 +337,12 @@ int cw_ktv_parse_line (FILE *f, char * key, char * type, char *val)
*/
int cw_ktv_parse_line(struct cw_KTV_Reader * r)
int cw_ktv_parse_line(struct cw_Val_Reader * r)
{
}
int cw_ktv_parse_string(struct cw_KTV_Reader *r, char *key, char *type, char *val)
int cw_ktv_parse_string(struct cw_Val_Reader *r, char *key, char *type, char *val)
{
int n;

View File

@ -1,5 +1,5 @@
#include "ktv.h"
#include "val.h"
int cw_ktv_read_file(FILE * file, mavl_t ktv, mavl_t types)

View File

@ -1,12 +1,12 @@
#include "ktv.h"
#include "val.h"
#include "dbg.h"
int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
int cw_ktv_read_struct(mavl_t ktv,const cw_ValStruct_t * stru, const char *pkey,
uint8_t * data, int len)
{
char key[CW_KTV_MAX_KEY_LEN];
int pos, i,l;
cw_KTV_t * result;
cw_Val_t * result;
pos=0; i=0;

View File

@ -1,6 +1,6 @@
#include <ctype.h>
#include "ktv.h"
#include "val.h"
struct parser {
int line;

View File

@ -1,14 +1,14 @@
#include "ktv.h"
#include "val.h"
#include "cw.h"
#include "log.h"
#include "dbg.h"
cw_KTV_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type,
cw_Val_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type,
const void * valguard,
const uint8_t * data, int len)
{
cw_KTV_t mdata, *mresult;
cw_Val_t mdata, *mresult;
int exists;
mdata.key=cw_strdup(key);

View File

@ -1,5 +1,5 @@
#include "ktv.h"
#include "val.h"
static int write_str(FILE *outfile,const char *str)
@ -43,7 +43,7 @@ int cw_ktv_save(mavl_t ktvstore, const char * filename){
mavliter_init(&it,ktvstore);
mavliter_foreach(&it){
cw_KTV_t * val;
cw_Val_t * val;
char buf[4000];
val = mavliter_get(&it);
val->type->to_str(val,buf,4000);
@ -55,4 +55,4 @@ int cw_ktv_save(mavl_t ktvstore, const char * filename){
}
fclose(outfile);
return 1;
}
}

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
#include "ktv.h"
#include "val.h"
const cw_Type_t * cw_ktv_std_types[] = {
CW_TYPE_BYTE,

View File

@ -1,13 +1,13 @@
#include "ktv.h"
#include "val.h"
#include "dbg.h"
#include "log.h"
int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_KTVStruct_t * stru, const char *pkey,
int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_ValStruct_t * stru, const char *pkey,
uint8_t * dst)
{
char key[CW_KTV_MAX_KEY_LEN];
int pos, i;
cw_KTV_t * result;
cw_Val_t * result;
pos=0; i=0;
for(i=0; stru[i].type != NULL;i++){

View File

@ -5,14 +5,14 @@
#include "dbg.h"
#include "log.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
, uint8_t * dst)
{
struct cw_KTV * elem;
struct cw_Val * elem;
int start, len, l;
/* Get the element */

View File

@ -5,11 +5,11 @@ int cw_out_generic_indexed_enum(struct cw_ElemHandler * handler, struct cw_ElemH
{
char key[CW_KTV_MAX_KEY_LEN];
int i;
cw_KTV_t * result;
cw_Val_t * result;
int len,start;
uint8_t * ob;
const cw_KTVIndexed_t *ie;
cw_KTVEnum_t * e;
const cw_ValIndexed_t *ie;
cw_ValEnum_t * e;
ie = handler->type;

View File

@ -1,6 +1,6 @@
#include "capwap.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
#include "log.h"
#include "cw.h"
@ -9,7 +9,7 @@ int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandler
{
int start;
int len;
cw_KTV_t search, *result;
cw_Val_t search, *result;
if (!handler->type){
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);

View File

@ -7,7 +7,7 @@ int cw_out_generic_with_index(struct cw_ElemHandler * eh,
{
char key[CW_KTV_MAX_KEY_LEN];
int idx;
cw_KTV_t * result, search;
cw_Val_t * result, search;
int len,start;
uint8_t * ob;

View File

@ -6,7 +6,7 @@ int cw_out_idx_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHan
, uint8_t * dst)
{
char key[CW_KTV_MAX_KEY_LEN];
struct cw_KTV * elem, search;
struct cw_Val * elem, search;
int i;
int idx, sr;
int len;

View File

@ -19,7 +19,7 @@ int cw_out_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemH
i=-1;
while(1){
char basekey[CW_KTV_MAX_KEY_LEN];
cw_KTV_t * result;
cw_Val_t * result;
i = cw_ktv_idx_get_next(params->local_cfg,"radio",i+1);
if (i==-1)
@ -57,7 +57,7 @@ printf("Next: %s\n", next);
sl = strchr(next,'/');
if (sl==NULL){
cw_KTV_t * result;
cw_Val_t * result;
sprintf(key,"%s/%s",current,next);
result = cw_ktv_base_exists(params->local_cfg,key);
if (result != NULL){
@ -100,7 +100,7 @@ printf("current is %s\n", current);
i=-1;
while(1){
char basekey[CW_KTV_MAX_KEY_LEN];
cw_KTV_t * result;
cw_Val_t * result;
i = cw_ktv_idx_get_next(params->local_cfg,key,i+1);

View File

@ -1,7 +1,7 @@
#include "cw.h"
#include "dbg.h"
#include "ktv.h"
#include "val.h"
static struct cw_DescriptorSubelemDef allowed_default[] = {
{0,CAPWAP_SUBELEM_AC_HARDWARE_VERSION, "hardware", 1024,1},
@ -9,7 +9,7 @@ static struct cw_DescriptorSubelemDef allowed_default[] = {
{0,0, NULL,0, 0}
};
cw_KTVStruct_t acstatus [] = {
cw_ValStruct_t acstatus [] = {
/* type key len, pos */
{CW_TYPE_WORD, "stations", 2, -1},
{CW_TYPE_WORD, "station-limit", 2, -1},

View File

@ -17,7 +17,7 @@
*/
#include "cw.h"
#include "ktv.h"
#include "val.h"
#include "dbg.h"
#include "keys.h"

View File

@ -1,6 +1,6 @@
#include "capwap.h"
#include "ktv.h"
#include "val.h"
#include "msgset.h"
#include "log.h"
#include "cw.h"
@ -10,7 +10,7 @@ int cw_in_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerPa
uint8_t * elem_data, int elem_len)
{
char key[CW_KTV_MAX_KEY_LEN];
cw_KTV_t * result;
cw_Val_t * result;
int radio;
if (!handler->type){

View File

@ -3,7 +3,7 @@
#include "capwap.h"
#include "dbg.h"
#include "ktv.h"
#include "val.h"
#include "keys.h"

View File

@ -2,7 +2,7 @@
#include "capwap.h"
#include "ktv.h"
#include "val.h"
#include "keys.h"

View File

@ -5,7 +5,7 @@
static int get_psk(struct conn * conn,const char * username, uint8_t **psk, unsigned int *len)
{
char key[CW_KTV_MAX_KEY_LEN];
cw_KTV_t * result;
cw_Val_t * result;
sprintf(key,"%s/%s","psk",username);
result = cw_ktv_get(conn->local_cfg,key,CW_TYPE_BSTR16);
if (result == NULL){
@ -76,4 +76,4 @@ int cw_setup_dtls(struct conn * conn, mavl_t cfg, const char *prefix, char * de
conn->dtls_get_psk = get_psk;
return security;
}
}

View File

@ -19,21 +19,21 @@
#include <stdio.h>
#include "cw.h"
#include "ktv.h"
#include "val.h"
static cw_KTV_t *get(cw_KTV_t * data, const uint8_t * src, int len)
static cw_Val_t *get(cw_Val_t * data, const uint8_t * src, int len)
{
data->type = &cw_type_bool;
data->val.boolean = cw_get_byte(src);
return data;
}
static int put(const cw_KTV_t *data, uint8_t * dst)
static int put(const cw_Val_t *data, uint8_t * dst)
{
return cw_put_byte(dst, data->val.boolean);
}
static int to_str(const cw_KTV_t *data, char *dst, int max_len)
static int to_str(const cw_Val_t *data, char *dst, int max_len)
{
/*if (max_len<3){
return 0;
@ -44,7 +44,7 @@ static int to_str(const cw_KTV_t *data, char *dst, int max_len)
return sprintf(dst, "%s", "false");
}
static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
static cw_Val_t *from_str(cw_Val_t * data, const char *src)
{
data->type = &cw_type_bool;
if (cw_stricmp(src,"true") == 0){
@ -69,17 +69,17 @@ static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
return data;
}
static int len (cw_KTV_t * data)
static int len (cw_Val_t * data)
{
return sizeof(int);
}
static void * data( cw_KTV_t * data)
static void * data( cw_Val_t * data)
{
return & data->val.boolean;
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_BOOL->name;
}

View File

@ -20,15 +20,15 @@
#include "format.h"
#include "cw.h"
#include "ktv.h"
#include "val.h"
static void del ( struct cw_KTV * data )
static void del ( struct cw_Val * data )
{
free ( data->val.ptr );
}
static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
static struct cw_Val *get ( struct cw_Val * data, const uint8_t * src, int len )
{
uint8_t * s;
s = bstr16_create ( src, len );
@ -41,12 +41,12 @@ static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
return data;
}
static int put ( const struct cw_KTV *data, uint8_t * dst )
static int put ( const struct cw_Val *data, uint8_t * dst )
{
return cw_put_bstr16 ( dst, data->val.ptr );
}
static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
static int to_str ( const struct cw_Val *data, char *dst, int max_len )
{
char *d;
d = dst;
@ -63,7 +63,7 @@ static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
return d - dst;
}
static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
static struct cw_Val *from_str ( struct cw_Val * data, const char *src )
{
uint8_t * s;
s = bstr16_create_from_str(src);
@ -77,21 +77,21 @@ static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
}
static int len (cw_KTV_t * data ){
static int len (cw_Val_t * data ){
return bstr16_len(data->val.ptr);
}
static void * data(cw_KTV_t * data)
static void * data(cw_Val_t * data)
{
return bstr16_data(data->val.ptr);
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_BSTR16->name;
}
static int cast(cw_KTV_t * data)
static int cast(cw_Val_t * data)
{
if (strcmp(data->type->name,CW_TYPE_BSTR16->name)==0)
return 1;

View File

@ -20,7 +20,7 @@
#include "format.h"
#include "cw.h"
#include "ktv.h"
#include "val.h"
/*typedef uint16_t* bwstr_type;*/
@ -38,12 +38,12 @@ static uint16_t * bwstr_create(const uint8_t *data, uint16_t len)
static void del ( struct cw_KTV * data )
static void del ( struct cw_Val * data )
{
free ( data->val.ptr );
}
static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
static struct cw_Val *get ( struct cw_Val * data, const uint8_t * src, int len )
{
uint16_t * s;
s = bwstr_create ( src, len );
@ -56,7 +56,7 @@ static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
return data;
}
static int put ( const struct cw_KTV *data, uint8_t * dst )
static int put ( const struct cw_Val *data, uint8_t * dst )
{
uint16_t len;
len = bstr16_len(data->val.ptr);
@ -64,7 +64,7 @@ static int put ( const struct cw_KTV *data, uint8_t * dst )
return lw_put_data ( dst, data->val.ptr+2,len*2 );
}
static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
static int to_str ( const struct cw_Val *data, char *dst, int max_len )
{
char *d;
uint16_t *s;
@ -82,7 +82,7 @@ static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
return d - dst;
}
static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
static struct cw_Val *from_str ( struct cw_Val * data, const char *src )
{
uint8_t * s;
s = bstr16_create_from_str(src);
@ -96,21 +96,21 @@ static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
}
static int len (cw_KTV_t * data ){
static int len (cw_Val_t * data ){
return bstr16_len(data->val.ptr);
}
static void * data(cw_KTV_t * data)
static void * data(cw_Val_t * data)
{
return bstr16_data(data->val.ptr);
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_BSTR16->name;
}
static int cast(cw_KTV_t * data)
static int cast(cw_Val_t * data)
{
if (strcmp(data->type->name,CW_TYPE_BSTR16->name)==0)
return 1;

View File

@ -19,21 +19,21 @@
#include <stdio.h>
#include "cw.h"
#include "ktv.h"
#include "val.h"
static cw_KTV_t *get(cw_KTV_t * data, const uint8_t * src, int len)
static cw_Val_t *get(cw_Val_t * data, const uint8_t * src, int len)
{
data->type = &cw_type_byte;
data->val.byte = cw_get_byte(src);
return data;
}
static int put(const cw_KTV_t *data, uint8_t * dst)
static int put(const cw_Val_t *data, uint8_t * dst)
{
return cw_put_byte(dst, data->val.byte);
}
static const char * get_guardstr(int val, const cw_KTVValRange_t * valrange)
static const char * get_guardstr(int val, const cw_ValValRange_t * valrange)
{
while(valrange->name!=NULL){
if(val>=valrange->min && val<=valrange->max)
@ -44,7 +44,7 @@ static const char * get_guardstr(int val, const cw_KTVValRange_t * valrange)
}
static int to_str(const cw_KTV_t *data, char *dst, int max_len)
static int to_str(const cw_Val_t *data, char *dst, int max_len)
{
if (data->valguard!=NULL){
const char * name;
@ -61,7 +61,7 @@ static int to_str(const cw_KTV_t *data, char *dst, int max_len)
}
static int get_guardval(const char *str, const cw_KTVValRange_t * valrange)
static int get_guardval(const char *str, const cw_ValValRange_t * valrange)
{
while(valrange->name!=NULL){
if(strcmp(str,valrange->name)==0)
@ -72,7 +72,7 @@ static int get_guardval(const char *str, const cw_KTVValRange_t * valrange)
}
static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
static cw_Val_t *from_str(cw_Val_t * data, const char *src)
{
data->type = &cw_type_byte;
if (data->valguard != NULL){
@ -90,17 +90,17 @@ static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
return data;
}
static int len (cw_KTV_t * data)
static int len (cw_Val_t * data)
{
return sizeof(data->val.byte);
}
static void * data(cw_KTV_t * data)
static void * data(cw_Val_t * data)
{
return &data->val.byte;
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
if (data->valguard != NULL){
return CW_TYPE_STR->name;
@ -108,7 +108,7 @@ static const char * get_type_name(cw_KTV_t *data)
return CW_TYPE_BYTE->name;
}
static int cast(cw_KTV_t * data)
static int cast(cw_Val_t * data)
{
if (strcmp(data->type->name,CW_TYPE_BYTE->name)==0)
return 1;

View File

@ -19,40 +19,40 @@
#include <stdio.h>
#include "cw.h"
#include "ktv.h"
#include "val.h"
static struct cw_KTV *get(struct cw_KTV * data, const uint8_t * src, int len)
static struct cw_Val *get(struct cw_Val * data, const uint8_t * src, int len)
{
data->type = &cw_type_dword;
data->val.dword = cw_get_dword(src);
return data;
}
static int put(const struct cw_KTV *data, uint8_t * dst)
static int put(const struct cw_Val *data, uint8_t * dst)
{
return cw_put_dword(dst, data->val.dword);
}
static int to_str(const struct cw_KTV *data, char *dst, int max_len)
static int to_str(const struct cw_Val *data, char *dst, int max_len)
{
return sprintf(dst, "%d", data->val.dword);
}
static struct cw_KTV *from_str(struct cw_KTV * data, const char *src)
static struct cw_Val *from_str(struct cw_Val * data, const char *src)
{
data->type = &cw_type_dword;
data->val.dword = atoi(src);
return data;
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_DWORD->name;
}
static int cast(cw_KTV_t * data)
static int cast(cw_Val_t * data)
{
if (strcmp(data->type->name,CW_TYPE_BYTE->name)==0)
return 1;

View File

@ -8,17 +8,17 @@
#include "format.h"
#include "cw.h"
#include "ktv.h"
#include "val.h"
#include "sock.h"
static void del ( struct cw_KTV * data )
static void del ( struct cw_Val * data )
{
free ( data->val.ptr );
}
static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
static struct cw_Val *get ( struct cw_Val * data, const uint8_t * src, int len )
{
uint8_t * s;
s = bstr_create ( src, len );
@ -33,12 +33,12 @@ static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
return data;
}
static int put ( const struct cw_KTV *data, uint8_t * dst )
static int put ( const struct cw_Val *data, uint8_t * dst )
{
return cw_put_bstr ( dst, data->val.ptr );
}
static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
static int to_str ( const struct cw_Val *data, char *dst, int max_len )
{
int l;
@ -63,7 +63,7 @@ static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
}
static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
static struct cw_Val *from_str ( struct cw_Val * data, const char *src )
{
struct sockaddr_storage addr;
uint8_t * s, * addrptr;
@ -98,15 +98,15 @@ static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
}
static int len ( struct cw_KTV * data ){
static int len ( struct cw_Val * data ){
return bstr_len(data->val.ptr);
}
static void * data(cw_KTV_t * data)
static void * data(cw_Val_t * data)
{
return bstr_data(data->val.ptr);
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_IPADDRESS->name;
}

View File

@ -20,15 +20,15 @@
#include "format.h"
#include "cw.h"
#include "ktv.h"
#include "val.h"
static void del ( struct cw_KTV * data )
static void del ( struct cw_Val * data )
{
free ( data->val.str );
}
static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
static struct cw_Val *get ( struct cw_Val * data, const uint8_t * src, int len )
{
uint8_t * s;
s = malloc (len+1);
@ -43,12 +43,12 @@ static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
return data;
}
static int put ( const struct cw_KTV *data, uint8_t * dst )
static int put ( const struct cw_Val *data, uint8_t * dst )
{
return cw_put_str ( dst, (uint8_t*)data->val.str );
}
static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
static int to_str ( const struct cw_Val *data, char *dst, int max_len )
{
@ -68,7 +68,7 @@ static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
return max_len;
}
static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
static struct cw_Val *from_str ( struct cw_Val * data, const char *src )
{
char * s;
s = cw_strdup(src);
@ -81,11 +81,11 @@ static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
return data;
}
static int len ( struct cw_KTV * data ){
static int len ( struct cw_Val * data ){
return strlen (data->val.str);
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_STR->name;
}

View File

@ -20,33 +20,33 @@
#include "format.h"
#include "cw.h"
#include "ktv.h"
#include "val.h"
static void del ( struct cw_KTV * data )
static void del ( struct cw_Val * data )
{
return;
}
static struct cw_KTV *get ( struct cw_KTV * data, const uint8_t * src, int len )
static struct cw_Val *get ( struct cw_Val * data, const uint8_t * src, int len )
{
data->type = &cw_type_sysptr;
data->val.ptr = ((void**)(src))[0];
return data;
}
static int put ( const struct cw_KTV *data, uint8_t * dst )
static int put ( const struct cw_Val *data, uint8_t * dst )
{
((void**)dst)[0] = data->val.ptr ;
return sizeof(void*);
}
static int to_str ( const struct cw_KTV *data, char *dst, int max_len )
static int to_str ( const struct cw_Val *data, char *dst, int max_len )
{
return sprintf(dst,"%p",data->val.ptr);
}
static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
static struct cw_Val *from_str ( struct cw_Val * data, const char *src )
{
uint8_t * s;
s = bstr16_create_from_str(src);
@ -60,11 +60,11 @@ static struct cw_KTV *from_str ( struct cw_KTV * data, const char *src )
}
static int len ( struct cw_KTV * data ){
static int len ( struct cw_Val * data ){
return sizeof(void*);
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_SYSPTR->name;
}

View File

@ -18,39 +18,39 @@
#include <stdio.h>
#include "ktv.h"
#include "val.h"
#include "cw.h"
static struct cw_KTV *get(struct cw_KTV * data, const uint8_t * src, int len)
static struct cw_Val *get(struct cw_Val * data, const uint8_t * src, int len)
{
data->type = &cw_type_word;
data->val.word = cw_get_word(src);
return data;
}
static int put(const cw_KTV_t *data, uint8_t * dst)
static int put(const cw_Val_t *data, uint8_t * dst)
{
return cw_put_word(dst, data->val.word);
}
static int to_str(const cw_KTV_t *data, char *dst, int max_len)
static int to_str(const cw_Val_t *data, char *dst, int max_len)
{
return sprintf(dst, "%d", data->val.word);
}
static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
static cw_Val_t *from_str(cw_Val_t * data, const char *src)
{
data->type = &cw_type_word;
data->val.word = atoi(src);
return data;
}
static const char * get_type_name(cw_KTV_t *data)
static const char * get_type_name(cw_Val_t *data)
{
return CW_TYPE_WORD->name;
}
static int cast(cw_KTV_t * data)
static int cast(cw_Val_t * data)
{
if (strcmp(data->type->name,CW_TYPE_WORD->name)==0)
return 1;

View File

@ -1,4 +1,4 @@
#include "ktv.h"
#include "val.h"
#include "keys.h"
#include "log.h"
#include "cw.h"
@ -8,7 +8,7 @@ int cw_write_descriptor_subelem (uint8_t *dst, mavl_t ktvstore,
int subelem_id, const char * parent_key )
{
char key[256];
cw_KTV_t * vendor, *version ;
cw_Val_t * vendor, *version ;
uint8_t *d;

View File

@ -5,7 +5,7 @@ int cw_write_radio_element(struct cw_ElemHandler * handler, struct cw_ElemHandle
, uint8_t * dst)
{
char key[CW_KTV_MAX_KEY_LEN];
cw_KTV_t *elem, search;
cw_Val_t *elem, search;
int len;
uint8_t * d;

View File

@ -509,7 +509,7 @@ void cw_dbg_ktv_dump(mavl_t ktv, uint32_t dbglevel,
const char *header, const char *prefix, const char *footer )
{
char value[500];
struct cw_KTV * data;
struct cw_Val * data;
mavliter_t it;
const struct cw_Type * type;

View File

@ -7,7 +7,7 @@
#include "log.h"
#include "msgset.h"
#include "ktv.h"
#include "val.h"
#include "mavltypes.h"
static int cmp_cw_elemhandler_by_id(const void *elem1, const void *elem2)

View File

@ -5,7 +5,7 @@
#include "sock.h"
#include "mavl.h"
#include "ktv.h"
#include "val.h"
struct cw_ElemDef{
@ -29,7 +29,7 @@ struct cw_ElemHandlerParams {
struct cw_ElemData * elemdata;
struct sockaddr *from;
mavl_t mand_found;
cw_KTV_t * elem;
cw_Val_t * elem;
char * debug_details;
mavl_t remote_cfg;
mavl_t local_cfg;

View File

@ -24,11 +24,11 @@
#define CW_KTV_MAX_KEY_LEN 1024
/**
* @struct cw_KTV
* @struct cw_Val
* @file ktv.h
* @brief Structure to store a key-type-value element.
*/
struct cw_KTV {
struct cw_Val {
/** The key for this element. A string. */
char *key;
/** Teh type of this element. */
@ -45,7 +45,7 @@ struct cw_KTV {
} val;
const void * valguard;
};
typedef struct cw_KTV cw_KTV_t;
typedef struct cw_Val cw_Val_t;
@ -61,13 +61,13 @@ struct cw_Type {
const char *name;
/** A pointer to a function to delete elements of this type */
void (*del) (struct cw_KTV * data);
void (*del) (struct cw_Val * data);
/** A method to put this object to a buffer */
int (*put) (const struct cw_KTV * data, uint8_t * dst);
int (*put) (const struct cw_Val * data, uint8_t * dst);
/** The get method */
struct cw_KTV *(*get) (struct cw_KTV * data, const uint8_t * src, int len);
struct cw_Val *(*get) (struct cw_Val * data, const uint8_t * src, int len);
/** A pointer to a function to convert elements of this type to a string.
* This function is mainly used to store elements to an SQL database
@ -77,39 +77,39 @@ struct cw_Type {
* @param max_len maximum length of buffer
* @return The number of bytes written to dst
*/
int (*to_str) (const struct cw_KTV * data, char *dst, int max_len);
int (*to_str) (const struct cw_Val * data, char *dst, int max_len);
/** Cereate an item of this type from a string, which was previously
created by the #del function. */
struct cw_KTV *(*from_str) (struct cw_KTV * data, const char *src);
struct cw_Val *(*from_str) (struct cw_Val * data, const char *src);
int (*len)(cw_KTV_t *);
int (*len)(cw_Val_t *);
void *(*data)(cw_KTV_t *);
const char * (*get_type_name)(cw_KTV_t*);
void *(*data)(cw_Val_t *);
const char * (*get_type_name)(cw_Val_t*);
int (*cast)(cw_KTV_t *);
int (*cast)(cw_Val_t *);
};
typedef struct cw_Type cw_Type_t;
struct cw_KTVValRange {
struct cw_ValValRange {
int min,max;
const char * name;
};
typedef struct cw_KTVValRange cw_KTVValRange_t;
typedef struct cw_ValValRange cw_ValValRange_t;
struct cw_KTVStruct {
struct cw_ValStruct {
const struct cw_Type * type;
const char * key;
int len;
int position;
const void * valguard;
};
typedef struct cw_KTVStruct cw_KTVStruct_t;
typedef struct cw_ValStruct cw_ValStruct_t;
@ -120,25 +120,25 @@ typedef struct cw_KTVStruct cw_KTVStruct_t;
#define CW_KTVSTRUCT_L16 -2
#define CW_KTVSTRUCT_L8 -3
struct cw_KTVEnum{
struct cw_ValEnum{
int value;
const char * name;
const void * type;
int (*fun_in)();
int (*fun_out)();
};
typedef struct cw_KTVEnum cw_KTVEnum_t;
typedef struct cw_ValEnum cw_ValEnum_t;
struct cw_KTVIndexed{
struct cw_ValIndexed{
int idxpos;
void *type;
};
typedef struct cw_KTVIndexed cw_KTVIndexed_t;
typedef struct cw_ValIndexed cw_ValIndexed_t;
int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
int cw_ktv_read_struct(mavl_t ktv,const cw_ValStruct_t * stru, const char *pkey,
uint8_t * data, int len);
int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_KTVStruct_t * stru, const char *pkey,
int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_ValStruct_t * stru, const char *pkey,
uint8_t * dst);
@ -165,13 +165,13 @@ extern const struct cw_Type cw_type_bool;
/*
void cw_kvstore_mavl_delete(const void *data);
*/
cw_KTV_t *cw_ktv_add(mavl_t kvstore, const char *key, const struct cw_Type *type,
cw_Val_t *cw_ktv_add(mavl_t kvstore, const char *key, const struct cw_Type *type,
const void * valguard,
const uint8_t * data, int len);
void cw_ktv_del_sub(mavl_t ktvstore, const char *basekey);
cw_KTV_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type,
cw_Val_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type,
const void * valguard,
const uint8_t * data, int len);
@ -189,19 +189,19 @@ void cw_ktv_mavldel(void *data);
* @return a #mavl_t object representing the KTV store
*/
#define cw_ktv_create()\
mavl_create(cw_ktv_mavlcmp, cw_ktv_mavldel, sizeof(cw_KTV_t))
mavl_create(cw_ktv_mavlcmp, cw_ktv_mavldel, sizeof(cw_Val_t))
#define cw_ktv_create_types_tree()\
mavl_create(cw_ktv_mavlcmp_type_by_name,NULL,sizeof(struct cw_Type *))
int cw_ktv_read_line (FILE *f, char * key, char * type, char *val);
int cw_ktv_read_file(FILE * file, mavl_t ktv, mavl_t types);
cw_KTV_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type);
cw_Val_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type);
uint8_t cw_ktv_get_byte(mavl_t ktv,const char *key, uint8_t def);
uint8_t cw_ktv_get_bool(mavl_t ktv,const char *key, uint8_t def);
cw_KTV_t * cw_ktv_set_byte(mavl_t ktv,const char * key, uint8_t byte);
cw_KTV_t * cw_ktv_set_dword(mavl_t ktv,const char * key, uint32_t dword);
cw_KTV_t * cw_ktv_set_word(mavl_t ktv,const char * key, uint16_t word);
cw_Val_t * cw_ktv_set_byte(mavl_t ktv,const char * key, uint8_t byte);
cw_Val_t * cw_ktv_set_dword(mavl_t ktv,const char * key, uint32_t dword);
cw_Val_t * cw_ktv_set_word(mavl_t ktv,const char * key, uint16_t word);
bstr16_t cw_ktv_get_bstr16(mavl_t ktv,const char *key, bstr16_t def);
@ -211,19 +211,19 @@ void * cw_ktv_get_sysptr(mavl_t ktv,const char *key, void * def);
char * cw_ktv_get_str(mavl_t ktv,const char *key, char * def);
int cw_ktv_idx_get(mavl_t ktv, const char *key);
cw_KTV_t * cw_ktv_base_exists(mavl_t ktvstore, const char *basekey);
cw_Val_t * cw_ktv_base_exists(mavl_t ktvstore, const char *basekey);
int cw_ktv_save(mavl_t ktvstore, const char * filename);
cw_KTV_t * cw_ktv_cast(cw_KTV_t *v,const cw_Type_t * type);
cw_Val_t * cw_ktv_cast(cw_Val_t *v,const cw_Type_t * type);
extern const cw_Type_t * cw_ktv_std_types[];
#define CW_KTV_STD_TYPES cw_ktv_std_types
struct cw_KTV_Reader {
struct cw_Val_Reader {
const void * data;
int (*xgetchar)(struct cw_KTV_Reader *);
void (*ungetchar)(struct cw_KTV_Reader *, int c);
int (*xgetchar)(struct cw_Val_Reader *);
void (*ungetchar)(struct cw_Val_Reader *, int c);
int quote;
int line;
int pos;
@ -233,8 +233,8 @@ struct cw_KTV_Reader {
char error[256];
};
void cw_ktv_init_str_reader(struct cw_KTV_Reader *r, const char * str, int len);
int cw_ktv_parse_string(struct cw_KTV_Reader *r, char *key, char *type, char *val);
void cw_ktv_init_str_reader(struct cw_Val_Reader *r, const char * str, int len);
int cw_ktv_parse_string(struct cw_Val_Reader *r, char *key, char *type, char *val);
/**
* @} KTV

View File

@ -31,7 +31,7 @@ $(MF): Makefile $(MFDEPS)
@echo "" >> $(MF)
@echo "$(DNAME) : \$$(OBJS)" >> $(MF)
@echo " @echo Creating dynamic library: $(DNAME)" >> $(MF)
@echo " $(V)\$$(LD) \$$(LDFLAGS) -shared -o $(DNAME) \$$(OBJS) $(LIBS)" >> $(MF)
@echo " $(V)\$$(LD) \$$(LDFLAGS) -shared -o $(DNAME) \$$(OBJS)" >> $(MF)
@echo "" >> $(MF)
# @echo " \$$(CC) -o $(PROGTARGET) \$$(LDFLAGS) \$$(OBJS) $(LIBS)" >> $(MF)
@for f in $(SOURCES) ; do \

View File

@ -18,7 +18,7 @@
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/log.h"
#include "cw/dbg.h"
@ -32,7 +32,7 @@
static int postprocess_join_request(struct conn *conn);
static cw_KTVStruct_t wtp_reboot_statistics[] = {
static cw_ValStruct_t wtp_reboot_statistics[] = {
{CW_TYPE_WORD, "reboot-count", 2,-1},
{CW_TYPE_WORD, "ac-initiated-count", 2,-1},
{CW_TYPE_WORD, "link-failure-count", 2,-1},
@ -44,27 +44,27 @@ static cw_KTVStruct_t wtp_reboot_statistics[] = {
{NULL,NULL,0,0}
};
static cw_KTVStruct_t capwap_timers[] = {
static cw_ValStruct_t capwap_timers[] = {
{CW_TYPE_BYTE, "max-discovery-interval", 1,-1},
{CW_TYPE_BYTE, "echo-interval", 1,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t radio_operational_state[] = {
static cw_ValStruct_t radio_operational_state[] = {
{CW_TYPE_BYTE, "state", 1,-1},
{CW_TYPE_BYTE, "cause", 1,-1},
{NULL,NULL,0,0}
};
static cw_KTVValRange_t radio_admin_state_valguard[]={
static cw_ValValRange_t radio_admin_state_valguard[]={
{0,0,"reserved"},
{1,1,"enabled"},
{2,2,"disabled"},
{0,0,NULL}
};
static cw_KTVStruct_t radio_admin_state[] = {
static cw_ValStruct_t radio_admin_state[] = {
{CW_TYPE_BYTE, NULL, 1,-1, radio_admin_state_valguard},
{NULL,NULL,0,0}
};
@ -748,7 +748,7 @@ static struct cw_MsgDef messages[] = {
static int postprocess_join_request(struct conn *conn)
{
cw_KTV_t * result;
cw_Val_t * result;
result = cw_ktv_get(conn->remote_cfg,"session-id",CW_TYPE_BSTR16);
if (result != NULL){

View File

@ -25,7 +25,7 @@
#include "cw/dbg.h"
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"

View File

@ -7,7 +7,7 @@
#include "cw/capwap.h"
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"

View File

@ -53,7 +53,7 @@ int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
char key[CW_KTV_MAX_KEY_LEN];
int i;
int wtps;
cw_KTV_t * address;
cw_Val_t * address;
uint8_t *d;
d = dst;

View File

@ -5,7 +5,7 @@
int capwap_out_capwap_local_ip_address(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
cw_KTV_t * ip;
cw_Val_t * ip;
ip = cw_ktv_get(params->local_cfg,eh->key,CW_TYPE_IPADDRESS);
if (ip==NULL){
return 0;

View File

@ -1,7 +1,7 @@
#include "cw/conn.h"
#include "cw/log.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/msgset.h"
#include "cw/keys.h"
#include "cw/cw.h"
@ -11,7 +11,7 @@ static int write_boarddata_subelem(uint8_t * dst, mavl_t ktv, const char * paren
const char *skey, int type){
char key[256];
cw_KTV_t * val;
cw_Val_t * val;
uint8_t *d;
d=dst;
@ -40,7 +40,7 @@ static int write_boarddata_subelem(uint8_t * dst, mavl_t ktv, const char * paren
int capwap_out_wtp_board_data(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
cw_KTV_t * val;
cw_Val_t * val;
mavl_t cfg;
uint8_t * d;
char key[256];

View File

@ -1,7 +1,7 @@
#include "cw/log.h"
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"
#include "cw/dbg.h"
@ -31,7 +31,7 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
int len,l;
/* // XXX Dummy WTP Descriptor Header */
uint8_t *d;
cw_KTV_t * val;
cw_Val_t * val;
d = dst+4;

View File

@ -2,7 +2,7 @@
#include "cw/mod.h"
#include "cw/log.h"
#include "cw/dbg.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"
#include "cw/dtls.h"

View File

@ -20,7 +20,7 @@
#include "cw/capwap.h"
#include "cw/capwap80211.h"
#include "cw/msgset.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"
#include "cw/proto.h"
#include "lwapp_cisco.h"
@ -35,32 +35,32 @@ static int preprocess_join_request();
static int postprocess_join_request();
static cw_KTVStruct_t ap_time_sync[] = {
static cw_ValStruct_t ap_time_sync[] = {
{CW_TYPE_DWORD, "timestamp", 4,-1},
{CW_TYPE_BYTE, "type", 1,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t mwar_addr[] = {
static cw_ValStruct_t mwar_addr[] = {
{CW_TYPE_BYTE, "mwar-type", 1,-1},
{CW_TYPE_IPADDRESS, "address", 4,-1},
{CW_TYPE_WORD, "unknown", 2,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_lw_path_mtu[] = {
static cw_ValStruct_t cisco_lw_path_mtu[] = {
{CW_TYPE_WORD, "max", 2,-1},
{CW_TYPE_WORD, "len", 2,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_uptime[] = {
static cw_ValStruct_t cisco_ap_uptime[] = {
{CW_TYPE_DWORD, "current-uptime", 4,-1},
{CW_TYPE_DWORD, "last-uptime", 4,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_login[] = {
static cw_ValStruct_t cisco_login[] = {
{CW_TYPE_STR, "username", 33, -1 },
{CW_TYPE_STR, "password", 121, -1 },
{CW_TYPE_STR, "enable-password", 121, 33+121 },
@ -68,7 +68,7 @@ static cw_KTVStruct_t cisco_login[] = {
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_8021xlogin[] = {
static cw_ValStruct_t cisco_8021xlogin[] = {
{CW_TYPE_STR, "username", 33, -1 },
{CW_TYPE_STR, "password", 121, -1 },
{CW_TYPE_WORD, "option", 2, 275 },
@ -76,7 +76,7 @@ static cw_KTVStruct_t cisco_8021xlogin[] = {
};
static cw_KTVEnum_t cisco_ap_username_and_password_enum[] ={
static cw_ValEnum_t cisco_ap_username_and_password_enum[] ={
{2, "802.1x-credentials", cisco_8021xlogin, cw_in_generic_struct, cw_ktv_write_struct },
{1, "login-credentials", cisco_login, cw_in_generic_struct, cw_ktv_write_struct },
@ -85,41 +85,41 @@ static cw_KTVEnum_t cisco_ap_username_and_password_enum[] ={
};
static cw_KTVIndexed_t cisco_ap_username_and_password = {
static cw_ValIndexed_t cisco_ap_username_and_password = {
276,cisco_ap_username_and_password_enum
};
static cw_KTVStruct_t cisco_loghost_config[] = {
static cw_ValStruct_t cisco_loghost_config[] = {
{CW_TYPE_IPADDRESS, "loghost", 4, -1},
{CW_TYPE_STR, "last-joined-ap", 32, -1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_led_state_config70[] = {
static cw_ValStruct_t cisco_ap_led_state_config70[] = {
{CW_TYPE_BYTE, "led-state", 1, -1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_led_state_config73[] = {
static cw_ValStruct_t cisco_ap_led_state_config73[] = {
{CW_TYPE_BYTE, "led-state", 1, -1},
{CW_TYPE_BYTE, "save-flag", 1, -1},
{NULL,NULL,0,0}
};
static cw_KTVEnum_t cisco_ap_telnet_ssh_enum[] ={
static cw_ValEnum_t cisco_ap_telnet_ssh_enum[] ={
{0, "telnet", CW_TYPE_BOOL, cw_in_generic, NULL },
{1, "ssh", CW_TYPE_BOOL, cw_in_generic, NULL },
{0,0,0,0}
};
static cw_KTVIndexed_t cisco_ap_telnet_ssh = {
static cw_ValIndexed_t cisco_ap_telnet_ssh = {
1,cisco_ap_telnet_ssh_enum
};
static cw_KTVStruct_t cisco_multi_domain_cabability[]={
static cw_ValStruct_t cisco_multi_domain_cabability[]={
{CW_TYPE_BYTE, "reserved", 1, -1},
{CW_TYPE_WORD, "first-channel", 2, -1},
{CW_TYPE_WORD, "number-of-channels", 2, -1},
@ -130,7 +130,7 @@ static cw_KTVStruct_t cisco_multi_domain_cabability[]={
static cw_KTVStruct_t cisco_wtp_board_data[]={
static cw_ValStruct_t cisco_wtp_board_data[]={
{CW_TYPE_WORD, "card-id", 2, -1},
{CW_TYPE_WORD, "card-revision", 2, -1},
{CW_TYPE_DWORD, "wtp-model-lo", 4, -1},
@ -144,7 +144,7 @@ static cw_KTVStruct_t cisco_wtp_board_data[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_wtp_board_data_options[]={
static cw_ValStruct_t cisco_wtp_board_data_options[]={
{CW_TYPE_BYTE, "ant-type", 1, -1},
{CW_TYPE_BYTE, "flex-connect", 1, -1},
{CW_TYPE_BYTE, "ap-type", 1, -1},
@ -154,7 +154,7 @@ static cw_KTVStruct_t cisco_wtp_board_data_options[]={
};
static cw_KTVStruct_t cisco_ap_led_flash_config[]={
static cw_ValStruct_t cisco_ap_led_flash_config[]={
{CW_TYPE_BYTE, "flash-enable", 1, 0},
{CW_TYPE_DWORD, "flash-sec", 4, 4},
{CW_TYPE_BYTE, "save-flag", 4, 8},
@ -162,7 +162,7 @@ static cw_KTVStruct_t cisco_ap_led_flash_config[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_static_ip_addr[]={
static cw_ValStruct_t cisco_ap_static_ip_addr[]={
{CW_TYPE_IPADDRESS,"address", 4,-1},
{CW_TYPE_IPADDRESS,"netmask", 4,-1},
{CW_TYPE_IPADDRESS,"gateway", 4,-1},
@ -172,7 +172,7 @@ static cw_KTVStruct_t cisco_ap_static_ip_addr[]={
};
static cw_KTVStruct_t cisco_ap_regulatory_domain4[]={
static cw_ValStruct_t cisco_ap_regulatory_domain4[]={
{CW_TYPE_BOOL,"set",1,-1},
{CW_TYPE_BYTE,"slot",1,-1},
{CW_TYPE_BYTE,"code0",1,-1},
@ -180,7 +180,7 @@ static cw_KTVStruct_t cisco_ap_regulatory_domain4[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_regulatory_domain5[]={
static cw_ValStruct_t cisco_ap_regulatory_domain5[]={
{CW_TYPE_BYTE,"band-id",1,-1},
{CW_TYPE_BOOL,"set",1,-1},
{CW_TYPE_BYTE,"slot",1,-1},
@ -190,7 +190,7 @@ static cw_KTVStruct_t cisco_ap_regulatory_domain5[]={
};
static cw_KTVStruct_t cisco_mac_operation73[]={
static cw_ValStruct_t cisco_mac_operation73[]={
{CW_TYPE_BYTE,"reserved",1,-1},
{CW_TYPE_WORD,"rts-threshold",2,-1},
{CW_TYPE_BYTE,"short-retry",1,-1},
@ -201,7 +201,7 @@ static cw_KTVStruct_t cisco_mac_operation73[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_mac_operation75[]={
static cw_ValStruct_t cisco_mac_operation75[]={
{CW_TYPE_WORD,"reserved",2,-1},
{CW_TYPE_WORD,"rts-threshold",2,-1},
{CW_TYPE_BYTE,"short-retry",1,-1},
@ -213,7 +213,7 @@ static cw_KTVStruct_t cisco_mac_operation75[]={
};
static cw_KTVStruct_t cisco_ap_power_injector_config[]={
static cw_ValStruct_t cisco_ap_power_injector_config[]={
{CW_TYPE_BYTE,"state",1,-1},
{CW_TYPE_BYTE,"selection",1,-1},
{CW_TYPE_BSTR16,"sitch-mac-address",6,-1},
@ -251,7 +251,7 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
char testkey[CW_KTV_MAX_KEY_LEN];
int idx;
void * type;
cw_KTV_t * result, search;
cw_Val_t * result, search;
int len,start;
uint8_t * ob;
@ -310,7 +310,7 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
return ob-dst;
}
static cw_KTVStruct_t cisco_ap_model[]={
static cw_ValStruct_t cisco_ap_model[]={
{CW_TYPE_STR,"model",30,-1},
{CW_TYPE_STR,"image",30,30},
{NULL,NULL,0,0}
@ -318,7 +318,7 @@ static cw_KTVStruct_t cisco_ap_model[]={
static cw_KTVStruct_t cisco_direct_sequence_control70[]={
static cw_ValStruct_t cisco_direct_sequence_control70[]={
{CW_TYPE_BYTE,"cfg-type",1,-1},
{CW_TYPE_BYTE,"current-channel",1,-1},
{CW_TYPE_BYTE,"current-cca-mode",1,-1},
@ -327,7 +327,7 @@ static cw_KTVStruct_t cisco_direct_sequence_control70[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_antenna_payload70[]={
static cw_ValStruct_t cisco_antenna_payload70[]={
{CW_TYPE_BYTE,"diversity-selection",1,-1},
{CW_TYPE_BYTE,"antenna-mode",1,-1},
{CW_TYPE_BYTE,"number-of-antennas",1,-1},
@ -340,7 +340,7 @@ static cw_KTVStruct_t cisco_antenna_payload70[]={
};
static cw_KTVStruct_t cisco_wtp_radio_config70[]={
static cw_ValStruct_t cisco_wtp_radio_config70[]={
{CW_TYPE_BYTE,"cfg-type",1,-1},
{CW_TYPE_WORD,"occupancy-limit",2,-1},
{CW_TYPE_BYTE,"cfg-period",1,-1},
@ -357,7 +357,7 @@ static cw_KTVStruct_t cisco_wtp_radio_config70[]={
static cw_KTVStruct_t cisco_wtp_radio_config73[]={
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},
@ -372,7 +372,7 @@ static cw_KTVStruct_t cisco_wtp_radio_config73[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_wtp_radio_config75[]={
static cw_ValStruct_t cisco_wtp_radio_config75[]={
{CW_TYPE_BYTE,"cfg-type",1,-1},
{CW_TYPE_WORD,"occupancy-limit",2,-1},
{CW_TYPE_BYTE,"cfg-period",1,-1},
@ -391,13 +391,13 @@ static cw_KTVStruct_t cisco_wtp_radio_config75[]={
static cw_KTVStruct_t cisco_tx_power[]={
static cw_ValStruct_t cisco_tx_power[]={
{CW_TYPE_BYTE,"reserved",1,-1},
{CW_TYPE_WORD,"current-tx-power",2,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_qos[]={
static cw_ValStruct_t cisco_ap_qos[]={
{CW_TYPE_BYTE,"tag-packets",1,-1},
{CW_TYPE_BYTE,"uranium-queue-depth",1,-1},
{CW_TYPE_WORD,"uranium-cwmin",2,-1},
@ -442,32 +442,32 @@ static cw_KTVStruct_t cisco_ap_qos[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_core_dump[]={
static cw_ValStruct_t cisco_ap_core_dump[]={
{CW_TYPE_IPADDRESS,"tftp-server",4,-1},
{CW_TYPE_BOOL,"compression",1,16},
{CW_TYPE_STR,"filename",199,17},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_vlan[]={
static cw_ValStruct_t cisco_vlan[]={
{CW_TYPE_BOOL,"tagging",1,-1},
{CW_TYPE_WORD,"id",2,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_rouge_and_mss[]={
static cw_ValStruct_t cisco_rouge_and_mss[]={
{CW_TYPE_BOOL,"enable",1,-1},
{CW_TYPE_WORD,"tcp-adjust-mss",2,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_rouge_detections[]={
static cw_ValStruct_t cisco_rouge_detections[]={
{CW_TYPE_BOOL,"rouge-detection",1,-1},
{CW_TYPE_BSTR16,"rest",6,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_ap_venue_settings[]={
static cw_ValStruct_t cisco_ap_venue_settings[]={
{CW_TYPE_WORD,"group",2,-1},
{CW_TYPE_BYTE,"type",1,-1},
{CW_TYPE_STR,"language",3,-1},
@ -476,13 +476,13 @@ static cw_KTVStruct_t cisco_ap_venue_settings[]={
};
static cw_KTVStruct_t cisco_ap_mode_and_type[]={
static cw_ValStruct_t cisco_ap_mode_and_type[]={
{CW_TYPE_BYTE,"mode",1,-1},
{CW_TYPE_BYTE,"type",1,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_add_wlan[]={
static cw_ValStruct_t cisco_add_wlan[]={
{CW_TYPE_BYTE,"radio-id",1,-1},
{CW_TYPE_WORD,"wlan-capability",2,-1},
{CW_TYPE_BYTE,"wlan-id",1,-1},
@ -502,7 +502,7 @@ static cw_KTVStruct_t cisco_add_wlan[]={
};
static cw_KTVStruct_t cisco_add_wlan70[]={
static cw_ValStruct_t cisco_add_wlan70[]={
{CW_TYPE_BYTE,"radio-id",1,-1},
{CW_TYPE_WORD,"wlan-capability",2,-1},
{CW_TYPE_BYTE,"wlan-id",1,4},
@ -580,20 +580,20 @@ static int cisco_patch_add_wlan70(uint8_t * data, void * st)
static cw_KTVStruct_t cisco_add_lwwlan[]={
static cw_ValStruct_t cisco_add_lwwlan[]={
{CW_TYPE_BSTR16, "misc", 8, 2},
{CW_TYPE_STR, "ssid",-1,10},
{CW_TYPE_WORD, "misc2", 2, 48 },
{NULL,NULL,0,0}
};
static cw_KTVValRange_t oper_val_state[]={
static cw_ValValRange_t oper_val_state[]={
{1,1,"disabled"},
{2,2,"enabled"},
{0,0,NULL}
};
static cw_KTVValRange_t oper_val_cause[]={
static cw_ValValRange_t oper_val_cause[]={
{0,0,"Normal"},
{1,1,"Radio Failure"},
{2,2,"Software Failure"},
@ -601,13 +601,13 @@ static cw_KTVValRange_t oper_val_cause[]={
{0,0,NULL}
};
static cw_KTVStruct_t cisco_radio_oper_state[]={
static cw_ValStruct_t cisco_radio_oper_state[]={
{CW_TYPE_BYTE, "state", 1, -1, oper_val_state},
{CW_TYPE_BYTE, "cause", 1, -1,oper_val_cause},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_capwap_timers[] = {
static cw_ValStruct_t cisco_capwap_timers[] = {
{CW_TYPE_BYTE, "max-discovery-interval", 1,-1},
{CW_TYPE_BYTE, "echo-interval", 1,-1},
{NULL,NULL,0,0}
@ -636,7 +636,7 @@ static int cisco_patch_add_lwwlan(uint8_t * data, void * st)
static cw_KTVStruct_t cisco_ssc_hash[]={
static cw_ValStruct_t cisco_ssc_hash[]={
{CW_TYPE_BOOL,"validate",1,-1},
{CW_TYPE_BSTR16,"hash",-1,-1},
{NULL,NULL,0,0}
@ -644,19 +644,19 @@ static cw_KTVStruct_t cisco_ssc_hash[]={
static cw_KTVStruct_t cisco_hardware_info[]={
static cw_ValStruct_t cisco_hardware_info[]={
{CW_TYPE_STR, "ram-type",20,-1},
{CW_TYPE_STR, "cpu",40,40},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_discovery_protocol[]={
static cw_ValStruct_t cisco_discovery_protocol[]={
{CW_TYPE_WORD, "data",2,-1},
{CW_TYPE_BOOL, "enabled",1,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_rad_extended_config[]={
static cw_ValStruct_t cisco_rad_extended_config[]={
{CW_TYPE_WORD, "beacon-interval",2,-1},
{CW_TYPE_WORD, "beacon-range",2,-1},
{CW_TYPE_WORD, "multicast-buffer",2,-1},
@ -670,14 +670,14 @@ static cw_KTVStruct_t cisco_rad_extended_config[]={
int cw_out_traverse(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
, uint8_t * dst);
static cw_KTVStruct_t cisco_80211_assoc_limit[]={
static cw_ValStruct_t cisco_80211_assoc_limit[]={
{CW_TYPE_BOOL, "enable",1,-1},
{CW_TYPE_BYTE, "limit",1,-1},
{CW_TYPE_WORD, "interval",1,-1},
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_dot11r_wlc_mac_and_ip[]={
static cw_ValStruct_t cisco_dot11r_wlc_mac_and_ip[]={
{CW_TYPE_IPADDRESS, "ip-address",4,-1},
{CW_TYPE_BSTR16, ",ac-address",6,-1},
{NULL,NULL,0,0}
@ -2163,7 +2163,7 @@ struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){
static void set_ac_version(struct conn * conn)
{
cw_KTV_t * wtpver;
cw_Val_t * wtpver;
char verstr[512];
wtpver = cw_ktv_get(conn->remote_cfg,"wtp-descriptor/software/version", CW_TYPE_BSTR16);
if (wtpver){
@ -2208,7 +2208,7 @@ static int postprocess_join_request(struct conn *conn)
static int preprocess_join_request(struct conn *conn)
{
cw_KTV_t * ver;
cw_Val_t * ver;
int use_ac_version;
char verstr[512];

View File

@ -7,7 +7,7 @@
#include "cw/capwap.h"
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"

View File

@ -6,7 +6,7 @@
int cisco_out_capwap_local_ip_address(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
cw_KTV_t * ip;
cw_Val_t * ip;
ip = cw_ktv_get(params->local_cfg,eh->key,CW_TYPE_IPADDRESS);
if (ip==NULL){
return 0;

View File

@ -1,6 +1,6 @@
#include "cw/log.h"
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/keys.h"
#include "cw/dbg.h"
@ -11,7 +11,7 @@ int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh,
int len;
/* // XXX Dummy WTP Descriptor Header */
uint8_t *d;
cw_KTV_t * val;
cw_Val_t * val;
d = dst+4;

View File

@ -7,7 +7,7 @@
#include "cw/capwap.h"
#include "cw/conn.h"
#include "cw/sock.h"
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/log.h"
#include "cw/dbg.h"
#include "cw/timer.h"
@ -40,7 +40,7 @@ int cw_select_ac(mavl_t local_cfg, struct cw_DiscoveryResult * dis)
char acname[CAPWAP_MAX_AC_NAME_LEN + 1];
char key[CW_KTV_MAX_KEY_LEN];
mavl_t remote_cfg;
cw_KTV_t *val, *ipval;
cw_Val_t *val, *ipval;
int prio, i;
remote_cfg = mlistelem_get_ptr(e);

View File

@ -206,7 +206,7 @@ int join(struct conn * conn, struct cw_DiscoveryResult * dis)
mavliter_foreach(&ii){
int rc;
cw_KTV_t * val,*ac;
cw_Val_t * val,*ac;
mavl_t rcfg;
char * rk;
char ipstr[100];

View File

@ -122,7 +122,7 @@ static void do_update(struct conn * conn)
void clean_cfg(mavl_t cfg)
{
char key[CW_KTV_MAX_KEY_LEN];
cw_KTV_t search;
cw_Val_t search;
int i;
int max;
max = cw_ktv_idx_get(cfg,"radio");

View File

@ -5,7 +5,7 @@
#include <unistd.h>
\
#include "cw/ktv.h"
#include "cw/val.h"
#include "cw/dbg.h"
#include "cw/log.h"
#include "cw/msgset.h"
@ -206,7 +206,7 @@ exit(0);
mavliter_foreach(&i) {
char ipstr[100];
char *rk;
cw_KTV_t *val;
cw_Val_t *val;
mavl_t cfg;
val = mavliter_get(&i);