Some improvemts for the ktv file parser

FossilOrigin-Name: 51c8ae52f86aa8fc824e07fe22d35b7ba5e82f5e4d7506cb5ff9c302ef87056a
This commit is contained in:
7u83@mail.ru
2018-03-17 15:21:23 +00:00
parent 6722bb159c
commit 5edd4ab621
16 changed files with 61 additions and 160 deletions

View File

@ -10,6 +10,7 @@
#include "cw/log.h"
#include "cw/dbg.h"
#include "cw/timer.h"
#include "cw/cw.h"
#include "wtp.h"

View File

@ -24,7 +24,7 @@ int image_update()
int rc = cw_send_request(conn, CAPWAP_MSG_IMAGE_DATA_REQUEST);
if (rc < 0) {
if (rc < 0) {h
}
if (rc != 0) {

View File

@ -76,23 +76,32 @@ int main (int argc, char **argv)
mavl_t global_cfg, types_tree;
const cw_Type_t ** ti;
/* read command line args, results are in bootcfg */
parse_args(argc,argv, &bootcfg);
/* create an empty message set */
msgset = cw_msgset_create();
if (msgset==NULL){
cw_log(LOG_ERR, "Error creating msgset: %s", strerror(errno));
exit(EXIT_FAILURE);
}
global_cfg=cw_ktv_create();
/* create types tree with default types */
/* create an empty global config */
global_cfg=cw_ktv_create();
if (msgset==NULL){
cw_log(LOG_ERR, "Error creating global_cfg: %s", strerror(errno));
exit(EXIT_FAILURE);
}
/* create a types tree with default types */
types_tree = cw_ktv_create_types_tree();
for (ti=CW_KTV_STD_TYPES;*ti;ti++){
mavl_add_ptr(types_tree,*ti);
}
/* read the initial config file */
file = fopen(bootcfg.cfgfilename,"r");
if (file == NULL){
cw_log(LOG_ERR,"Cant open file '%s':%s", strerror(errno));
@ -100,6 +109,7 @@ int main (int argc, char **argv)
}
cw_ktv_read_file(file,global_cfg,types_tree);
cw_ktv_dump(global_cfg,DBG_INFO,"----- global cfg start -----","","----- global cfg end -----");
@ -119,6 +129,7 @@ int main (int argc, char **argv)
exit(EXIT_FAILURE);
}
conn->detected = 1;
conn->dtls_verify_peer=0;
conn->dtls_mtu = 12000;