Renamed KTV to Val.

shell
7u83 1 year ago
parent 996446d115
commit a05bbf5fd6
  1. 37
      src/ac/ac_main.c
  2. 12
      src/ac/shell.c
  3. 2
      src/ac/wtpman.c
  4. 3
      src/cw/Makefile
  5. 8
      src/cw/cfg.c
  6. 2
      src/cw/conn_process_packet.c
  7. 2
      src/cw/cw_detect_nat.c
  8. 4
      src/cw/cw_in_generic.c
  9. 6
      src/cw/cw_in_generic_enum.c
  10. 8
      src/cw/cw_in_generic_indexed_enum.c
  11. 2
      src/cw/cw_in_generic_struct.c
  12. 2
      src/cw/cw_in_idx_generic.c
  13. 2
      src/cw/cw_in_idx_generic_struct.c
  14. 2
      src/cw/cw_in_radio_generic_struct.c
  15. 6
      src/cw/cw_ktv_add.c
  16. 4
      src/cw/cw_ktv_add_from_str.c
  17. 6
      src/cw/cw_ktv_base_exists.c
  18. 4
      src/cw/cw_ktv_cast.c
  19. 4
      src/cw/cw_ktv_del_sub.c
  20. 8
      src/cw/cw_ktv_get.c
  21. 4
      src/cw/cw_ktv_get_bool.c
  22. 4
      src/cw/cw_ktv_get_bstr16.c
  23. 4
      src/cw/cw_ktv_get_byte.c
  24. 4
      src/cw/cw_ktv_get_dword.c
  25. 4
      src/cw/cw_ktv_get_str.c
  26. 4
      src/cw/cw_ktv_get_sysptr.c
  27. 4
      src/cw/cw_ktv_get_word.c
  28. 8
      src/cw/cw_ktv_idx_get.c
  29. 16
      src/cw/cw_ktv_mavlcmp.c
  30. 2
      src/cw/cw_ktv_mavlcmp_type_by_name.c
  31. 4
      src/cw/cw_ktv_mavldel.c
  32. 34
      src/cw/cw_ktv_parser.c
  33. 2
      src/cw/cw_ktv_read_file.c
  34. 6
      src/cw/cw_ktv_read_struct.c
  35. 2
      src/cw/cw_ktv_readline.c
  36. 6
      src/cw/cw_ktv_replace.c
  37. 6
      src/cw/cw_ktv_save.c
  38. 4
      src/cw/cw_ktv_set_byte.c
  39. 4
      src/cw/cw_ktv_set_dword.c
  40. 4
      src/cw/cw_ktv_set_word.c
  41. 2
      src/cw/cw_ktv_std_types.c
  42. 6
      src/cw/cw_ktv_write_struct.c
  43. 4
      src/cw/cw_out_generic.c
  44. 6
      src/cw/cw_out_generic_indexed_enum.c
  45. 4
      src/cw/cw_out_generic_struct.c
  46. 2
      src/cw/cw_out_generic_with_index.c
  47. 2
      src/cw/cw_out_idx_generic_struct.c
  48. 6
      src/cw/cw_out_radio_generic_struct.c
  49. 4
      src/cw/cw_read_ac_descriptor.c
  50. 2
      src/cw/cw_read_descriptor_subelems.c
  51. 4
      src/cw/cw_read_radio_generic.c
  52. 2
      src/cw/cw_read_wtp_descriptor.c
  53. 2
      src/cw/cw_read_wtp_descriptor_7.c
  54. 4
      src/cw/cw_setup_dtls.c
  55. 16
      src/cw/cw_type_bool.c
  56. 20
      src/cw/cw_type_bstr16.c
  57. 20
      src/cw/cw_type_bwstr.c
  58. 22
      src/cw/cw_type_byte.c
  59. 14
      src/cw/cw_type_dword.c
  60. 18
      src/cw/cw_type_ipaddress.c
  61. 16
      src/cw/cw_type_str.c
  62. 16
      src/cw/cw_type_sysptr.c
  63. 14
      src/cw/cw_type_word.c
  64. 4
      src/cw/cw_write_descriptor_subelem.c
  65. 2
      src/cw/cw_write_radio_element.c
  66. 2
      src/cw/dbg.c
  67. 2
      src/cw/msgset.c
  68. 4
      src/cw/msgset.h
  69. 72
      src/cw/val.h
  70. 2
      src/lib.mk
  71. 14
      src/mod/capwap/capwap_actions_ac.c
  72. 2
      src/mod/capwap/capwap_in_wtp_board_data.c
  73. 2
      src/mod/capwap/capwap_out_ac_descriptor.c
  74. 2
      src/mod/capwap/capwap_out_capwap_control_ip_address.c
  75. 2
      src/mod/capwap/capwap_out_capwap_local_ip_address.c
  76. 6
      src/mod/capwap/capwap_out_wtp_board_data.c
  77. 4
      src/mod/capwap/capwap_out_wtp_descriptor.c
  78. 2
      src/mod/capwap/mod_capwap_ac.c
  79. 108
      src/mod/cisco/cisco_actions_ac.c
  80. 2
      src/mod/cisco/cisco_out_ac_descriptor.c
  81. 2
      src/mod/cisco/cisco_out_capwap_local_ip_address.c
  82. 4
      src/mod/cisco/cisco_out_wtp_descriptor.c
  83. 4
      src/wtp/discovery.c
  84. 2
      src/wtp/join.c
  85. 2
      src/wtp/run.c
  86. 4
      src/wtp/wtp_main.c

@ -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,10 +173,21 @@ static void show_cfg (FILE *out, mavl_t ktv)
}
int main (int argc, char *argv[])
{
int rc = 0;
struct bootcfg bootcfg;
FILE * file;
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);
@ -184,20 +195,20 @@ static void show_cfg (FILE *out, mavl_t ktv)
// cw_cfg_set(cfg,"Hello","30");
cw_cfg_dump(cfg);
mavl_destroy(cfg);
}
*/
int main (int argc, char *argv[])
{
int rc = 0;
struct bootcfg bootcfg;
FILE * file;
mavl_t types_tree, global_cfg;
const cw_Type_t **ti;
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 */

@ -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;

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

@ -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\

@ -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;

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

@ -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];

@ -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);

@ -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);
}
}

@ -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);
}
}

@ -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,

@ -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){

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

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

@ -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);

@ -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,

@ -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)

@ -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;

@ -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){

@ -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;

@ -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;

@ -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));

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

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

@ -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);
}

@ -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;

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

@ -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;

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

@ -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);

@ -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;
}
}

@ -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);
}

@ -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);
}

@ -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);
}

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

@ -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++){

@ -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 */

@ -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;

@ -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);

@ -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;

@ -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;

@ -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);

@ -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},

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

@ -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){

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

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

@ -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;
}
}

@ -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,