2015-04-17 07:38:44 +02:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "jsmn.h"
|
|
|
|
#include "wtp.h"
|
2016-03-03 19:51:42 +01:00
|
|
|
#include "cw/bstr.h"
|
|
|
|
|
|
|
|
#include "cw/mavl.h"
|
|
|
|
#include "cw/format.h"
|
|
|
|
#include "cw/file.h"
|
|
|
|
#include "cw/sock.h"
|
|
|
|
#include "cw/item.h"
|
|
|
|
#include "cw/action.h"
|
2016-03-05 14:12:49 +01:00
|
|
|
#include "cw/mbag.h"
|
|
|
|
#include "cw/capwap_items.h"
|
|
|
|
#include "cw/radio.h"
|
|
|
|
#include "cw/conn.h"
|
|
|
|
#include "cw/bstr.h"
|
2015-04-19 23:27:44 +02:00
|
|
|
|
2016-04-18 07:40:30 +02:00
|
|
|
#include "cw/dbg.h"
|
2015-04-18 11:20:24 +02:00
|
|
|
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
static int skip(jsmntok_t * t)
|
2015-04-18 11:20:24 +02:00
|
|
|
{
|
2015-04-26 08:41:12 +02:00
|
|
|
switch (t->type) {
|
2015-04-18 11:20:24 +02:00
|
|
|
case JSMN_OBJECT:
|
2015-05-04 07:46:36 +02:00
|
|
|
{
|
|
|
|
int e = t->end;
|
|
|
|
int n = 1;
|
|
|
|
while (e > t->start) {
|
|
|
|
t++;
|
|
|
|
n++;
|
2015-04-18 11:20:24 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
return n;
|
|
|
|
}
|
2015-04-18 11:20:24 +02:00
|
|
|
default:
|
2015-04-26 08:41:12 +02:00
|
|
|
return t->size + 2;
|
2015-04-18 11:20:24 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
void set_cfg(mbag_t mbag, cw_itemdefheap_t defs, const char *id, const char *subid,const char *val)
|
2015-04-24 07:13:54 +02:00
|
|
|
{
|
2015-05-04 07:46:36 +02:00
|
|
|
//printf("Setting: %s/%s: %s\n",id,subid,val);
|
|
|
|
const cw_itemdef_t *idef;
|
2015-04-24 07:13:54 +02:00
|
|
|
|
2018-02-16 01:23:54 +01:00
|
|
|
//printf("Looking for def of: %s\n",id);
|
2015-05-04 07:46:36 +02:00
|
|
|
int dyn=0;
|
|
|
|
if (!subid) {
|
|
|
|
idef = cw_itemdef_get(defs,id,subid);
|
2015-04-24 07:13:54 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
else {
|
|
|
|
idef = cw_itemdef_get(defs,id,subid);
|
|
|
|
if (!idef){
|
|
|
|
idef = cw_itemdef_get(defs,id,CW_ITEM_ANY);
|
|
|
|
if (idef)
|
|
|
|
dyn=1;
|
|
|
|
}
|
2015-04-24 07:13:54 +02:00
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
if (!idef) {
|
2016-03-31 08:00:43 +02:00
|
|
|
fprintf(stderr,"CFG: No definition for item %s/%s not found\n",id,subid);
|
2015-05-04 07:46:36 +02:00
|
|
|
return ;
|
|
|
|
}
|
2015-04-24 07:13:54 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
mbag_item_t * item;
|
|
|
|
if (idef->type->from_str){
|
|
|
|
item=idef->type->from_str(val);
|
|
|
|
if (dyn){
|
|
|
|
item->id=strdup(subid);
|
|
|
|
item->dynid=1;
|
2015-04-24 07:13:54 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
else{
|
|
|
|
if (subid)
|
|
|
|
item->id=idef->sub_id;
|
|
|
|
else
|
|
|
|
item->id=idef->id;
|
2015-04-24 07:13:54 +02:00
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
item->type=idef->type;
|
|
|
|
|
|
|
|
|
2015-04-24 07:13:54 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
else{
|
|
|
|
fprintf(stderr,"Can't read item '%s' - no from_str method defined\n",id);
|
|
|
|
exit(0);
|
2015-04-19 16:44:20 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
|
2015-04-19 16:44:20 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
mbag_t wmbag;
|
|
|
|
if (!subid) {
|
|
|
|
wmbag=mbag;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
wmbag=mbag_get_mbag_c(mbag,id,mbag_create);
|
2015-04-28 10:23:03 +02:00
|
|
|
}
|
2015-04-19 16:44:20 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
//printf("Adding to Mbag %s:%s\n",item->id,val);
|
|
|
|
mavl_replace(wmbag,item);
|
2015-04-19 16:44:20 +02:00
|
|
|
|
2015-04-20 02:26:24 +02:00
|
|
|
}
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
static int scn_obj(char *js, jsmntok_t * t,
|
|
|
|
mbag_t mbag,
|
|
|
|
cw_itemdefheap_t defs,
|
|
|
|
const char *objkey);
|
2015-04-20 02:26:24 +02:00
|
|
|
|
|
|
|
|
2015-04-19 16:44:20 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
static int scn_radios(char *js, jsmntok_t * t)
|
2015-04-21 08:24:59 +02:00
|
|
|
{
|
2015-05-04 07:46:36 +02:00
|
|
|
int i;
|
2015-04-21 08:24:59 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
struct conn * conn = get_conn();
|
2015-04-21 08:24:59 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
if (t->type != JSMN_OBJECT) {
|
|
|
|
fprintf(stderr,"Error reading json cfgp: Not an object\n");
|
2015-04-21 08:24:59 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
int j = 1;
|
|
|
|
for (i = 0; i < t->size; i++) {
|
2015-04-18 11:20:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
jsmntok_t * to=t+j;
|
2015-04-18 11:20:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
*(js + to->end) = 0;
|
|
|
|
const char *key = js + to->start;
|
|
|
|
*(js + (to + 1)->end) = 0;
|
|
|
|
const char * val = js+(to+1)->start;
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
//printf("Radio Key: %s Val: %s\n",key,val);
|
2015-04-18 11:20:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
if ((to+1)->type == JSMN_OBJECT) {
|
|
|
|
int rid = atoi(key);
|
|
|
|
|
|
|
|
printf("Radio id %d\n",rid);
|
|
|
|
mbag_t radio=mbag_i_get_mbag_c(conn->radios,rid,mbag_create);
|
2016-04-02 09:05:07 +02:00
|
|
|
scn_obj(js,to+1,radio,conn->actions->radioitems /*radioitems*/,NULL);
|
2015-04-19 23:27:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
2015-04-19 23:27:44 +02:00
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
if ((to+1)->type == JSMN_OBJECT) {
|
|
|
|
if (objkey) {
|
|
|
|
fprintf(stderr,"Too deep: %s %s\n",objkey,key);
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
|
|
|
else{
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
if (strcmp(key,"radios")==0){
|
|
|
|
printf("Radios found\n");
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
2015-04-19 16:44:20 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
j+=skip(to+1);
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-04-19 16:44:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
static int scn_obj(char *js, jsmntok_t * t,
|
|
|
|
mbag_t mbag,
|
|
|
|
cw_itemdefheap_t defs,
|
|
|
|
const char *objkey)
|
2015-04-28 10:23:03 +02:00
|
|
|
{
|
2015-05-04 07:46:36 +02:00
|
|
|
int i;
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
if (t->type != JSMN_OBJECT) {
|
|
|
|
fprintf(stderr,"Error reading json cfgp: Not an object\n");
|
2015-04-19 23:27:44 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
int j = 1;
|
|
|
|
for (i = 0; i < t->size; i++) {
|
2015-04-20 02:26:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
// j += scn_obj0(js, t + j, defs, mbag,objkey,type);
|
2015-04-21 08:24:59 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
jsmntok_t * to=t+j;
|
2015-04-21 08:24:59 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
*(js + to->end) = 0;
|
|
|
|
const char *key = js + to->start;
|
|
|
|
*(js + (to + 1)->end) = 0;
|
|
|
|
const char * val = js+(to+1)->start;
|
2015-04-20 02:26:24 +02:00
|
|
|
|
2016-04-18 07:40:30 +02:00
|
|
|
printf("Key: %s Val: %s\n",key,val);
|
2015-05-04 07:46:36 +02:00
|
|
|
|
2015-04-20 02:26:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
if ((to+1)->type == JSMN_OBJECT) {
|
|
|
|
if (objkey) {
|
|
|
|
fprintf(stderr,"Too deep: %s %s\n",objkey,key);
|
2015-04-20 02:26:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
|
|
|
else{
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
/* special case: radios */
|
|
|
|
if (strcmp(key,"radios")==0){
|
|
|
|
printf("Radios found\n");
|
|
|
|
scn_radios(js,to+1);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
scn_obj(js,to+1,mbag,defs,key);
|
|
|
|
}
|
|
|
|
}
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
if (objkey)
|
|
|
|
set_cfg(mbag,defs,objkey,key,val);
|
|
|
|
else
|
|
|
|
set_cfg(mbag,defs,key,NULL,val);
|
2015-04-19 23:27:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
j+=skip(to+1);
|
2015-04-19 23:27:44 +02:00
|
|
|
|
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
return 0;
|
2015-04-19 23:27:44 +02:00
|
|
|
}
|
2015-04-26 08:41:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
int cfg_json_put_radios(char *dst, const char *name, mbag_item_t * i, int n)
|
2015-04-20 02:26:24 +02:00
|
|
|
{
|
2015-05-04 07:46:36 +02:00
|
|
|
struct conn *conn = get_conn();
|
2015-04-20 02:26:24 +02:00
|
|
|
char *d = dst;
|
2015-04-26 08:41:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
|
|
|
d += sprintf(d, "\"radios\":{\n");
|
2015-05-04 07:46:36 +02:00
|
|
|
|
|
|
|
MAVLITER_DEFINE(radios, conn->radios);
|
|
|
|
const char *comma = "";
|
2015-04-26 08:41:12 +02:00
|
|
|
mavliter_foreach(&radios) {
|
|
|
|
mbag_item_t *i = mavliter_get(&radios);
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
d += sprintf(d, "%s", comma);
|
|
|
|
comma = ",\n";
|
|
|
|
memset(d, '\t', n + 1);
|
|
|
|
d += n + 1;
|
2015-05-01 00:16:54 +02:00
|
|
|
d += sprintf(d, "\"%d\":", i->iid);
|
2015-04-26 08:41:12 +02:00
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
d += sprintf(d, "\n");
|
2015-04-26 08:41:12 +02:00
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
|
|
|
d += sprintf(d, "}");
|
2015-05-04 07:46:36 +02:00
|
|
|
return d - dst;
|
2015-04-20 02:26:24 +02:00
|
|
|
}
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
/*
|
2015-04-26 08:41:12 +02:00
|
|
|
int cfg_json_put_acobj(char *dst, const char *name, mbag_item_t * i, int n)
|
|
|
|
{
|
|
|
|
char *d = dst;
|
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
|
|
|
d += sprintf(d, "\"%s\":{\n", name);
|
|
|
|
|
|
|
|
MAVLITER_DEFINE(it, i->data);
|
|
|
|
char *comma = "";
|
|
|
|
mavliter_foreach(&it) {
|
|
|
|
cw_acprio_t *acprio = mavliter_get(&it);
|
|
|
|
d += sprintf(d, "%s", comma);
|
|
|
|
comma = ",\n";
|
|
|
|
memset(d, '\t', n + 1);
|
|
|
|
d += n + 1;
|
|
|
|
d += sprintf(d, "\"%s\":\"%d\"", acprio->name, acprio->prio);
|
|
|
|
|
|
|
|
}
|
|
|
|
d += sprintf(d, "\n");
|
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
|
|
|
d += sprintf(d, "}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// d+=mbag_tojson(d,i->data,board_data_cfg,n);
|
|
|
|
return d - dst;
|
|
|
|
|
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
*/
|
2015-04-26 08:41:12 +02:00
|
|
|
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
int mbag_tojson(char *dst, mbag_t m, cw_itemdef_t *defs, int n)
|
2015-04-19 23:27:44 +02:00
|
|
|
{
|
|
|
|
char *d;
|
|
|
|
d = dst;
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
d += sprintf(d, "%s", "{\n");
|
|
|
|
|
|
|
|
MAVLITER_DEFINE(it, m);
|
2015-04-19 23:27:44 +02:00
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
const char *delim = "";
|
2015-04-19 23:27:44 +02:00
|
|
|
mavliter_foreach(&it) {
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
mbag_item_t *i = mavliter_get(&it);
|
2015-04-26 08:41:12 +02:00
|
|
|
d += sprintf(d, "%s", delim);
|
|
|
|
delim = ",\n";
|
2015-05-04 07:46:36 +02:00
|
|
|
//
|
|
|
|
memset(d,'\t',n+1);
|
|
|
|
d+=n+1;
|
|
|
|
d+=sprintf(d,"\"%s\":",i->id);
|
|
|
|
// d+=sprintf(d,"\"%s(%s)\":",i->id,i->type->name);
|
|
|
|
|
|
|
|
if (i->type==MBAG_MBAG){
|
|
|
|
d+=mbag_tojson(d,i->data,defs,n+1);
|
2015-04-17 07:38:44 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
else{
|
|
|
|
d+=sprintf(d,"\"");
|
|
|
|
if (i->type->to_str){
|
|
|
|
d+=i->type->to_str(i,d);
|
2016-04-18 07:40:30 +02:00
|
|
|
|
|
|
|
// char bu[1000];
|
|
|
|
// i->type->to_str(i,bu);
|
|
|
|
// cw_dbg(DBG_X,"Put: %s::: %s",i->id,bu);
|
|
|
|
}
|
|
|
|
else{
|
2016-11-14 19:26:56 +01:00
|
|
|
cw_dbg(DBG_X,"No to_str method for %s",i->id);
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
|
|
|
d+=sprintf(d,"\"");
|
2016-04-18 07:40:30 +02:00
|
|
|
|
|
|
|
|
2015-04-18 11:20:24 +02:00
|
|
|
}
|
2015-04-17 07:38:44 +02:00
|
|
|
}
|
2015-05-04 07:46:36 +02:00
|
|
|
if (n==0){
|
|
|
|
struct conn * conn;
|
|
|
|
conn = get_conn();
|
|
|
|
MAVLITER_DEFINE(ir,conn->radios);
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
|
|
|
d += sprintf(d, "%s", delim);
|
2015-04-18 11:20:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
d+=sprintf(d,"\t\"radios\":{\n");
|
2015-04-18 11:20:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
char *delim="";
|
|
|
|
mavliter_foreach(&ir){
|
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
|
|
|
d += sprintf(d, "%s", delim);
|
|
|
|
delim = ",\n";
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
mbag_item_t *radio = mavliter_get(&ir);
|
|
|
|
d+=sprintf(d,"\t\t\"%d\":",radio->iid);
|
|
|
|
d+=mbag_tojson(d,radio->data,defs,n+2);
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
}
|
|
|
|
d += sprintf(d, "\n\t}");
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-04-28 14:30:59 +02:00
|
|
|
|
2015-04-20 02:26:24 +02:00
|
|
|
}
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
d += sprintf(d, "\n");
|
|
|
|
memset(d, '\t', n);
|
|
|
|
d += n;
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-04-20 02:26:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
d += sprintf(d, "%s", "}");
|
2015-04-20 02:26:24 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
return d - dst;
|
2015-04-18 11:20:24 +02:00
|
|
|
}
|
2015-04-17 07:38:44 +02:00
|
|
|
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
int cfg_to_json()
|
2015-04-26 08:41:12 +02:00
|
|
|
{
|
|
|
|
struct conn *conn = get_conn();
|
2015-05-04 07:46:36 +02:00
|
|
|
char dst[4096];
|
|
|
|
// mbag_set_byte(conn->config, CW_ITEM_RADIOS, 1);
|
2015-04-26 08:41:12 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
int n = mbag_tojson(dst, conn->config, NULL, 0);
|
2015-05-08 06:51:52 +02:00
|
|
|
//printf("DST: %s\n",dst);
|
2015-05-04 07:46:36 +02:00
|
|
|
//exit(0);
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
cw_save_file("cfg.json", dst, n);
|
|
|
|
return 1;
|
2015-04-17 07:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
int cfg_from_json(struct conn *conn)
|
2015-04-17 07:38:44 +02:00
|
|
|
{
|
2015-04-20 02:26:24 +02:00
|
|
|
size_t size;
|
2015-04-26 08:41:12 +02:00
|
|
|
char *jstr = cw_load_file("cfg.json", &size);
|
2015-04-20 02:26:24 +02:00
|
|
|
if (!jstr) {
|
2015-04-26 08:41:12 +02:00
|
|
|
fprintf(stderr, "Can't load cfg %s: %s\n", "cfg.json", strerror(errno));
|
2015-04-20 02:26:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2015-04-17 07:38:44 +02:00
|
|
|
|
|
|
|
jsmn_parser p;
|
|
|
|
jsmntok_t t[1200];
|
|
|
|
jsmn_init(&p);
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
int rc = jsmn_parse(&p, jstr, size, t, sizeof(t) / sizeof(t[0]));
|
|
|
|
if (rc < 0) {
|
2015-04-17 07:38:44 +02:00
|
|
|
printf("Parser failed\n");
|
2015-05-04 07:46:36 +02:00
|
|
|
return 1;
|
2015-04-17 07:38:44 +02:00
|
|
|
}
|
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
printf("Number of items %d\n",conn->actions->items->count);
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
scn_obj(jstr, t, conn->config, conn->actions->items,NULL);
|
2015-04-17 07:38:44 +02:00
|
|
|
|
2015-05-04 07:46:36 +02:00
|
|
|
return 1;
|
2015-04-17 07:38:44 +02:00
|
|
|
}
|