Merge pull request #667 from eeff/eeff/dev

chore: remove persistence json parser code
This commit is contained in:
fengzeroz
2022-07-26 18:04:30 +08:00
committed by GitHub
10 changed files with 1 additions and 944 deletions
+1 -5
View File
@@ -82,11 +82,7 @@ add_dependencies(neuron-base neuron-version)
set(PERSIST_SOURCES
src/persist/persist.c
src/persist/json/persist_json_adapter.c
src/persist/json/persist_json_datatags.c
src/persist/json/persist_json_group_configs.c
src/persist/json/persist_json_plugin.c
src/persist/json/persist_json_subs.c)
src/persist/json/persist_json_plugin.c)
set(NEURON_SOURCES
src/main.c
src/argparse.c
-226
View File
@@ -1,226 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#include <stdlib.h>
#include <string.h>
#include "json/json.h"
#include "persist_json_adapter.h"
int neu_json_encode_node_resp_node(void *json_object, void *param)
{
int ret = 0;
neu_json_node_resp_node_t *resp = (neu_json_node_resp_node_t *) param;
neu_json_elem_t resp_elems[] = {
{
.name = "type",
.t = NEU_JSON_INT,
.v.val_int = resp->type,
},
{
.name = "state",
.t = NEU_JSON_INT,
.v.val_int = resp->state,
},
{
.name = "plugin_name",
.t = NEU_JSON_STR,
.v.val_str = resp->plugin_name,
},
{
.name = "name",
.t = NEU_JSON_STR,
.v.val_str = resp->name,
},
};
ret = neu_json_encode_field(json_object, resp_elems,
NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
int neu_json_encode_node_resp(void *json_object, void *param)
{
int ret = 0;
neu_json_node_resp_t *resp = (neu_json_node_resp_t *) param;
void * node_array = neu_json_array();
neu_json_node_resp_node_t *p_node = resp->nodes;
for (int i = 0; i < resp->n_node; i++) {
neu_json_elem_t node_elems[] = {
{
.name = "type",
.t = NEU_JSON_INT,
.v.val_int = p_node->type,
},
{
.name = "state",
.t = NEU_JSON_INT,
.v.val_int = p_node->state,
},
{
.name = "plugin_name",
.t = NEU_JSON_STR,
.v.val_str = p_node->plugin_name,
},
{
.name = "name",
.t = NEU_JSON_STR,
.v.val_str = p_node->name,
},
};
node_array = neu_json_encode_array(node_array, node_elems,
NEU_JSON_ELEM_SIZE(node_elems));
p_node++;
}
neu_json_elem_t resp_elems[] = { {
.name = "nodes",
.t = NEU_JSON_OBJECT,
.v.val_object = node_array,
} };
ret = neu_json_encode_field(json_object, resp_elems,
NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
int neu_json_decode_node_req_node(char *buf, neu_json_node_req_node_t **result)
{
int ret = 0;
neu_json_node_req_node_t *req = calloc(1, sizeof(neu_json_node_req_node_t));
neu_json_elem_t req_elems[] = {
{
.name = "type",
.t = NEU_JSON_INT,
},
{
.name = "state",
.t = NEU_JSON_INT,
},
{
.name = "plugin_name",
.t = NEU_JSON_STR,
},
{
.name = "name",
.t = NEU_JSON_STR,
},
};
ret = neu_json_decode(buf, NEU_JSON_ELEM_SIZE(req_elems), req_elems);
if (ret != 0) {
free(req);
return -1;
}
req->type = req_elems[0].v.val_int;
req->state = req_elems[1].v.val_int;
req->plugin_name = req_elems[2].v.val_str;
req->name = req_elems[3].v.val_str;
*result = req;
return ret;
}
void neu_json_decode_node_req_node_free(neu_json_node_req_node_t *req)
{
if (NULL != req) {
free(req->plugin_name);
free(req->name);
free(req);
}
}
int neu_json_decode_node_req(char *buf, neu_json_node_req_t **result)
{
int ret = 0;
neu_json_node_req_t *req = calloc(1, sizeof(neu_json_node_req_t));
req->n_node = neu_json_decode_array_size(buf, "nodes");
req->nodes = calloc(req->n_node, sizeof(neu_json_node_req_node_t));
neu_json_node_req_node_t *p_node = req->nodes;
for (int i = 0; i < req->n_node; i++) {
neu_json_elem_t node_elems[] = {
{
.name = "type",
.t = NEU_JSON_INT,
},
{
.name = "state",
.t = NEU_JSON_INT,
},
{
.name = "plugin_name",
.t = NEU_JSON_STR,
},
{
.name = "name",
.t = NEU_JSON_STR,
},
};
ret = neu_json_decode_array(buf, "nodes", i,
NEU_JSON_ELEM_SIZE(node_elems), node_elems);
if (ret != 0) {
goto decode_fail;
}
p_node->type = node_elems[0].v.val_int;
p_node->state = node_elems[1].v.val_int;
p_node->plugin_name = node_elems[2].v.val_str;
p_node->name = node_elems[3].v.val_str;
p_node++;
}
*result = req;
return ret;
decode_fail:
if (req->nodes != NULL) {
free(req->nodes);
}
if (req != NULL) {
free(req);
}
return -1;
}
void neu_json_decode_node_req_free(neu_json_node_req_t *req)
{
neu_json_node_req_node_t *p_node = req->nodes;
for (int i = 0; i < req->n_node; i++) {
free(p_node->plugin_name);
free(p_node->name);
p_node++;
}
free(req->nodes);
free(req);
}
-72
View File
@@ -1,72 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#ifndef _NEU_JSON_API_PERSIST_JSON_ADAPTER_H_
#define _NEU_JSON_API_PERSIST_JSON_ADAPTER_H_
#include "json/json.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char * name;
int64_t type;
char * plugin_name;
int64_t state;
} neu_json_node_resp_node_t;
int neu_json_encode_node_resp_node(void *json_object, void *param);
typedef struct {
int n_node;
neu_json_node_resp_node_t *nodes;
} neu_json_node_resp_t;
int neu_json_encode_node_resp(void *json_object, void *param);
typedef struct {
char * name;
int64_t type;
char * plugin_name;
int64_t state;
} neu_json_node_req_node_t;
int neu_json_decode_node_req_node(char *buf, neu_json_node_req_node_t **result);
void neu_json_decode_node_req_node_free(neu_json_node_req_node_t *req);
typedef struct {
int n_node;
neu_json_node_req_node_t *nodes;
} neu_json_node_req_t;
int neu_json_decode_node_req(char *buf, neu_json_node_req_t **result);
void neu_json_decode_node_req_free(neu_json_node_req_t *req);
#ifdef __cplusplus
}
#endif
#endif
-171
View File
@@ -1,171 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#include <stdlib.h>
#include <string.h>
#include "json/json.h"
#include "persist_json_datatags.h"
int neu_json_decode_datatag_req(char *buf, neu_json_datatag_req_t **result)
{
int ret = 0;
void * json_obj = NULL;
neu_json_datatag_req_t *req = calloc(1, sizeof(neu_json_datatag_req_t));
if (req == NULL) {
return -1;
}
json_obj = neu_json_decode_new(buf);
req->n_tag = neu_json_decode_array_size_by_json(json_obj, "tags");
if (req->n_tag <= 0) {
goto decode_fail;
}
req->tags = calloc(req->n_tag, sizeof(neu_json_datatag_req_tag_t));
neu_json_datatag_req_tag_t *p_tag = req->tags;
for (int i = 0; i < req->n_tag; i++) {
neu_json_elem_t tag_elems[] = {
{
.name = "type",
.t = NEU_JSON_INT,
},
{
.name = "name",
.t = NEU_JSON_STR,
},
{
.name = "attribute",
.t = NEU_JSON_INT,
},
{
.name = "address",
.t = NEU_JSON_STR,
},
{
.name = "description",
.t = NEU_JSON_STR,
},
};
ret = neu_json_decode_array_by_json(
json_obj, "tags", i, NEU_JSON_ELEM_SIZE(tag_elems), tag_elems);
if (ret != 0) {
goto decode_fail;
}
p_tag->type = tag_elems[0].v.val_int;
p_tag->name = tag_elems[1].v.val_str;
p_tag->attribute = tag_elems[2].v.val_int;
p_tag->address = tag_elems[3].v.val_str;
p_tag->description = tag_elems[4].v.val_str;
p_tag++;
}
*result = req;
goto decode_exit;
decode_fail:
if (req->tags != NULL) {
free(req->tags);
}
if (req != NULL) {
free(req);
}
ret = -1;
decode_exit:
if (json_obj != NULL) {
neu_json_decode_free(json_obj);
}
return ret;
}
void neu_json_decode_datatag_req_free(neu_json_datatag_req_t *req)
{
neu_json_datatag_req_tag_t *p_tag = req->tags;
for (int i = 0; i < req->n_tag; i++) {
free(p_tag->name);
free(p_tag->address);
free(p_tag->description);
p_tag++;
}
free(req->tags);
free(req);
}
int neu_json_encode_datatag_resp(void *json_object, void *param)
{
int ret = 0;
neu_json_datatag_resp_t *resp = (neu_json_datatag_resp_t *) param;
void * tag_array = neu_json_array();
neu_json_datatag_resp_tag_t *p_tag = resp->tags;
for (int i = 0; i < resp->n_tag; i++) {
neu_json_elem_t tag_elems[] = {
{
.name = "type",
.t = NEU_JSON_INT,
.v.val_int = p_tag->type,
},
{
.name = "name",
.t = NEU_JSON_STR,
.v.val_str = p_tag->name,
},
{
.name = "attribute",
.t = NEU_JSON_INT,
.v.val_int = p_tag->attribute,
},
{
.name = "address",
.t = NEU_JSON_STR,
.v.val_str = p_tag->address,
},
{
.name = "description",
.t = NEU_JSON_STR,
.v.val_str = p_tag->description,
},
};
tag_array = neu_json_encode_array(tag_array, tag_elems,
NEU_JSON_ELEM_SIZE(tag_elems));
p_tag++;
}
neu_json_elem_t resp_elems[] = { {
.name = "tags",
.t = NEU_JSON_OBJECT,
.v.val_object = tag_array,
} };
ret = neu_json_encode_field(json_object, resp_elems,
NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
-69
View File
@@ -1,69 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#ifndef _NEU_JSON_API_PERSIST_JSON_DATATAGS_H_
#define _NEU_JSON_API_PERSIST_JSON_DATATAGS_H_
#include "json/json.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char * address;
char * name;
char * description;
int64_t type;
int64_t attribute;
} neu_json_datatag_req_tag_t;
typedef struct {
int n_tag;
neu_json_datatag_req_tag_t *tags;
} neu_json_datatag_req_t;
int neu_json_decode_datatag_req(char *buf, neu_json_datatag_req_t **result);
void neu_json_decode_datatag_req_free(neu_json_datatag_req_t *req);
typedef struct {
char * address;
char * name;
char * description;
int64_t type;
int64_t attribute;
} neu_json_datatag_resp_tag_t;
typedef struct {
int n_tag;
neu_json_datatag_resp_tag_t *tags;
} neu_json_datatag_resp_t;
int neu_json_encode_datatag_resp(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,115 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#include <stdlib.h>
#include <string.h>
#include "json/json.h"
#include "persist_json_group_configs.h"
int neu_json_decode_group_configs_req(char * buf,
neu_json_group_configs_req_t **result)
{
int ret = 0;
void * json_obj = NULL;
neu_json_group_configs_req_t *req =
calloc(1, sizeof(neu_json_group_configs_req_t));
if (req == NULL) {
return -1;
}
json_obj = neu_json_decode_new(buf);
neu_json_elem_t req_elems[] = { {
.name = "read_interval",
.t = NEU_JSON_INT,
},
{
.name = "group_config_name",
.t = NEU_JSON_STR,
},
{
.name = "adapter_name",
.t = NEU_JSON_STR,
} };
ret = neu_json_decode_by_json(json_obj, NEU_JSON_ELEM_SIZE(req_elems),
req_elems);
if (ret != 0) {
goto decode_fail;
}
req->read_interval = req_elems[0].v.val_int;
req->group_config_name = req_elems[1].v.val_str;
req->adapter_name = req_elems[2].v.val_str;
*result = req;
goto decode_exit;
decode_fail:
free(req);
ret = -1;
decode_exit:
if (json_obj != NULL) {
neu_json_decode_free(json_obj);
}
return ret;
}
void neu_json_decode_group_configs_req_free(neu_json_group_configs_req_t *req)
{
free(req->group_config_name);
free(req->adapter_name);
free(req);
}
int neu_json_encode_group_configs_resp(void *json_object, void *param)
{
int ret = 0;
neu_json_group_configs_resp_t *resp =
(neu_json_group_configs_resp_t *) param;
neu_json_elem_t resp_elems[] = { {
.name = "read_interval",
.t = NEU_JSON_INT,
.v.val_int = resp->read_interval,
},
{
.name = "group_config_name",
.t = NEU_JSON_STR,
.v.val_str = resp->group_config_name,
},
{
.name = "adapter_name",
.t = NEU_JSON_STR,
.v.val_str = resp->adapter_name,
} };
ret = neu_json_encode_field(json_object, resp_elems,
NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
@@ -1,56 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#ifndef _NEU_JSON_API_PERSIST_JSON_GROUP_CONFIGS_H_
#define _NEU_JSON_API_PERSIST_JSON_GROUP_CONFIGS_H_
#include "json/json.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char * group_config_name;
char * adapter_name;
int64_t read_interval;
} neu_json_group_configs_req_t;
int neu_json_decode_group_configs_req(char * buf,
neu_json_group_configs_req_t **result);
void neu_json_decode_group_configs_req_free(neu_json_group_configs_req_t *req);
typedef struct {
char * group_config_name;
char * adapter_name;
int64_t read_interval;
} neu_json_group_configs_resp_t;
int neu_json_encode_group_configs_resp(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
-160
View File
@@ -1,160 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#include <stdlib.h>
#include <string.h>
#include "json/json.h"
#include "persist_json_subs.h"
int neu_json_decode_subscriptions_req(char * buf,
neu_json_subscriptions_req_t **result)
{
int ret = 0;
void * json_obj = NULL;
neu_json_subscriptions_req_t *req =
calloc(1, sizeof(neu_json_subscriptions_req_t));
if (req == NULL) {
return -1;
}
json_obj = neu_json_decode_new(buf);
req->n_subscription =
neu_json_decode_array_size_by_json(json_obj, "subscriptions");
if (req->n_subscription <= 0) {
goto decode_fail;
}
req->subscriptions = calloc(
req->n_subscription, sizeof(neu_json_subscriptions_req_subscription_t));
neu_json_subscriptions_req_subscription_t *p_subscription =
req->subscriptions;
for (int i = 0; i < req->n_subscription; i++) {
neu_json_elem_t subscription_elems[] = { {
.name = "sub_adapter_name",
.t = NEU_JSON_STR,
},
{
.name = "src_adapter_name",
.t = NEU_JSON_STR,
},
{
.name =
"group_config_name",
.t = NEU_JSON_STR,
} };
ret = neu_json_decode_array_by_json(
json_obj, "subscriptions", i,
NEU_JSON_ELEM_SIZE(subscription_elems), subscription_elems);
if (ret != 0) {
goto decode_fail;
}
p_subscription->sub_adapter_name = subscription_elems[0].v.val_str;
p_subscription->src_adapter_name = subscription_elems[1].v.val_str;
p_subscription->group_config_name = subscription_elems[2].v.val_str;
p_subscription++;
}
*result = req;
goto decode_exit;
decode_fail:
if (req->subscriptions != NULL) {
free(req->subscriptions);
}
if (req != NULL) {
free(req);
}
ret = -1;
decode_exit:
if (json_obj != NULL) {
neu_json_decode_free(json_obj);
}
return ret;
}
void neu_json_decode_subscriptions_req_free(neu_json_subscriptions_req_t *req)
{
neu_json_subscriptions_req_subscription_t *p_subscription =
req->subscriptions;
for (int i = 0; i < req->n_subscription; i++) {
free(p_subscription->sub_adapter_name);
free(p_subscription->src_adapter_name);
free(p_subscription->group_config_name);
p_subscription++;
}
free(req->subscriptions);
free(req);
}
int neu_json_encode_subscriptions_resp(void *json_object, void *param)
{
int ret = 0;
neu_json_subscriptions_resp_t *resp =
(neu_json_subscriptions_resp_t *) param;
void *subscription_array = neu_json_array();
neu_json_subscriptions_resp_subscription_t *p_subscription =
resp->subscriptions;
for (int i = 0; i < resp->n_subscription; i++) {
neu_json_elem_t subscription_elems[] = {
{
.name = "sub_adapter_name",
.t = NEU_JSON_STR,
.v.val_str = p_subscription->sub_adapter_name,
},
{
.name = "src_adapter_name",
.t = NEU_JSON_STR,
.v.val_str = p_subscription->src_adapter_name,
},
{
.name = "group_config_name",
.t = NEU_JSON_STR,
.v.val_str = p_subscription->group_config_name,
}
};
subscription_array =
neu_json_encode_array(subscription_array, subscription_elems,
NEU_JSON_ELEM_SIZE(subscription_elems));
p_subscription++;
}
neu_json_elem_t resp_elems[] = { {
.name = "subscriptions",
.t = NEU_JSON_OBJECT,
.v.val_object = subscription_array,
} };
ret = neu_json_encode_field(json_object, resp_elems,
NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
-66
View File
@@ -1,66 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#ifndef _NEU_JSON_API_PERSIST_JSON_SUBS_H_
#define _NEU_JSON_API_PERSIST_JSON_SUBS_H_
#include "json/json.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char *group_config_name;
char *sub_adapter_name;
char *src_adapter_name;
} neu_json_subscriptions_req_subscription_t;
typedef struct {
int n_subscription;
neu_json_subscriptions_req_subscription_t *subscriptions;
} neu_json_subscriptions_req_t;
int neu_json_decode_subscriptions_req(char * buf,
neu_json_subscriptions_req_t **result);
void neu_json_decode_subscriptions_req_free(neu_json_subscriptions_req_t *req);
typedef struct {
char *group_config_name;
char *sub_adapter_name;
char *src_adapter_name;
} neu_json_subscriptions_resp_subscription_t;
typedef struct {
int n_subscription;
neu_json_subscriptions_resp_subscription_t *subscriptions;
} neu_json_subscriptions_resp_t;
int neu_json_encode_subscriptions_resp(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
-4
View File
@@ -34,11 +34,7 @@
#include "errcodes.h"
#include "utils/log.h"
#include "persist/json/persist_json_adapter.h"
#include "persist/json/persist_json_datatags.h"
#include "persist/json/persist_json_group_configs.h"
#include "persist/json/persist_json_plugin.h"
#include "persist/json/persist_json_subs.h"
#include "persist/persist.h"
#include "json/neu_json_fn.h"