mirror of
https://github.com/emqx/neuron.git
synced 2026-10-29 07:06:32 +08:00
add(schema):add schema field in getting plugins api
This commit is contained in:
@@ -187,6 +187,7 @@ typedef struct neu_req_get_plugin {
|
||||
} neu_req_get_plugin_t;
|
||||
|
||||
typedef struct neu_resp_plugin_info {
|
||||
char schema[NEU_PLUGIN_NAME_LEN];
|
||||
char name[NEU_PLUGIN_NAME_LEN];
|
||||
char description[NEU_PLUGIN_DESCRIPTION_LEN];
|
||||
char description_zh[NEU_PLUGIN_DESCRIPTION_LEN];
|
||||
|
||||
@@ -86,6 +86,7 @@ typedef struct neu_plugin_intf_funs {
|
||||
|
||||
typedef struct neu_plugin_module {
|
||||
const uint32_t version;
|
||||
const char * schema;
|
||||
const char * module_name;
|
||||
const char * module_descr;
|
||||
const char * module_descr_zh;
|
||||
|
||||
@@ -195,6 +195,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "ekuiper.json",
|
||||
.module_name = "ekuiper",
|
||||
.module_descr = "Neuron and LF Edge eKuiper integration plugin",
|
||||
.module_descr_zh = "Neuron 和 LF Edge eKuiper 一体化插件",
|
||||
|
||||
@@ -52,6 +52,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "file.json",
|
||||
.module_name = "file",
|
||||
.module_descr = "The plugin is used to read and write files.",
|
||||
.module_descr_zh = "该插件用于读写文件。",
|
||||
|
||||
@@ -56,6 +56,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "modbus-tcp.json",
|
||||
.module_name = "modbus-tcp",
|
||||
.module_descr = "The modbus-tcp plugin is used for devices connected using "
|
||||
"the modbus protocol tcp mode.",
|
||||
|
||||
@@ -469,6 +469,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "monitor.json",
|
||||
.module_name = "monitor",
|
||||
.module_descr = DEFAULT_MONITOR_PLUGIN_DESCR,
|
||||
.module_descr_zh = DEFAULT_MONITOR_PLUGIN_DESCR_ZH,
|
||||
|
||||
@@ -375,6 +375,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "mqtt.json",
|
||||
.module_name = "mqtt",
|
||||
.module_descr = DESCRIPTION,
|
||||
.module_descr_zh = DESCRIPTION_ZH,
|
||||
|
||||
@@ -106,6 +106,7 @@ void handle_get_plugin_resp(nng_aio *aio, neu_resp_get_plugin_t *plugins)
|
||||
|
||||
plugin_res.plugin_libs[index].node_type = info->type;
|
||||
plugin_res.plugin_libs[index].kind = info->kind;
|
||||
plugin_res.plugin_libs[index].schema = (char *) info->schema;
|
||||
plugin_res.plugin_libs[index].name = (char *) info->name;
|
||||
plugin_res.plugin_libs[index].library = (char *) info->library;
|
||||
plugin_res.plugin_libs[index].description = (char *) info->description;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "plugin_manager.h"
|
||||
|
||||
typedef struct plugin_entity {
|
||||
char *schema;
|
||||
char *name;
|
||||
char *lib_name;
|
||||
char *description;
|
||||
@@ -125,6 +126,7 @@ int neu_plugin_manager_add(neu_plugin_manager_t *mgr,
|
||||
plugin->display = pm->display;
|
||||
plugin->type = pm->type;
|
||||
plugin->kind = pm->kind;
|
||||
plugin->schema = strdup(pm->schema);
|
||||
plugin->name = strdup(pm->module_name);
|
||||
plugin->lib_name = strdup(plugin_lib_name);
|
||||
plugin->description = strdup(pm->module_descr);
|
||||
@@ -178,6 +180,7 @@ UT_array *neu_plugin_manager_get(neu_plugin_manager_t *mgr)
|
||||
};
|
||||
|
||||
info.display = el->display;
|
||||
strncpy(info.schema, el->schema, sizeof(info.schema));
|
||||
strncpy(info.name, el->name, sizeof(info.name));
|
||||
strncpy(info.library, el->lib_name, sizeof(info.library));
|
||||
strncpy(info.description, el->description, sizeof(info.description));
|
||||
@@ -208,6 +211,7 @@ UT_array *neu_plugin_manager_get_single(neu_plugin_manager_t *mgr)
|
||||
info.display = el->display;
|
||||
info.single = el->single;
|
||||
|
||||
strncpy(info.schema, el->schema, sizeof(info.schema));
|
||||
strncpy(info.single_name, el->single_name,
|
||||
sizeof(info.single_name));
|
||||
strncpy(info.name, el->name, sizeof(info.name));
|
||||
@@ -305,6 +309,7 @@ static void entity_free(plugin_entity_t *entity)
|
||||
if (entity->single) {
|
||||
free(entity->single_name);
|
||||
}
|
||||
free(entity->schema);
|
||||
free(entity->name);
|
||||
free(entity->lib_name);
|
||||
free(entity->description);
|
||||
|
||||
@@ -140,6 +140,11 @@ int neu_json_encode_get_plugin_resp(void *json_object, void *param)
|
||||
.t = NEU_JSON_STR,
|
||||
.v.val_str = p_plugin_lib->name,
|
||||
},
|
||||
{
|
||||
.name = "schema",
|
||||
.t = NEU_JSON_STR,
|
||||
.v.val_str = p_plugin_lib->schema,
|
||||
},
|
||||
{
|
||||
.name = "library",
|
||||
.t = NEU_JSON_STR,
|
||||
|
||||
@@ -49,6 +49,7 @@ void neu_json_decode_del_plugin_req_free(neu_json_del_plugin_req_t *req);
|
||||
|
||||
typedef struct {
|
||||
char * name;
|
||||
char * schema;
|
||||
char * library;
|
||||
char * description;
|
||||
char * description_zh;
|
||||
|
||||
Reference in New Issue
Block a user