EII ConfigMgr C/C++ Reference
cfgmgr_util.h
Go to the documentation of this file.
1 // Copyright (c) 2020 Intel Corporation.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 // IN THE SOFTWARE.
20 
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <cjson/cJSON.h>
29 #include <safe_lib.h>
30 #include <eii/utils/logger.h>
31 #include <eii/utils/string.h>
32 #include <stdbool.h>
33 #include <ctype.h>
34 #include "eii/utils/json_config.h"
35 #include "eii/config_manager/kv_store_plugin/kv_store_plugin.h"
36 #define BROKERED "brokered"
37 #define SOCKET_FILE "socket_file"
38 #define ENDPOINT "EndPoint"
39 #define TOPICS "Topics"
40 #define NAME "Name"
41 #define ALLOWED_CLIENTS "AllowedClients"
42 #define PUBLIC_KEYS "/Publickeys/"
43 #define PRIVATE_KEY "/private_key"
44 
45 #define MAX_CONFIG_KEY_LENGTH 250
46 #define MAX_ENDPOINT_LENGTH 40
47 #define MAX_MODE_LENGTH 10
48 
49 #ifndef _EII_C_BASE_CFG_H
50 #define _EII_C_BASE_CFG_H
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
59 typedef enum {
60  CFGMGR_PUBLISHER = 0,
61  CFGMGR_SUBSCRIBER = 1,
62  CFGMGR_SERVER = 2,
63  CFGMGR_CLIENT = 3,
65 
71 char* cvt_to_char(config_value_t* config);
72 
78 char* configt_to_char(config_t* config);
79 
88 bool get_ipc_config(config_t* c_json, config_value_t* config, const char* end_point, cfgmgr_iface_type_t type);
89 
95 char* cvt_obj_str_to_char(config_value_t* cvt);
96 
107 bool construct_tcp_publisher_prod(char* app_name, config_t* c_json, config_t* inner_json, void* handle, config_value_t* config, kv_store_client_t* kv_store_client);
108 
119 bool add_keys_to_config(config_t* sub_topic, char* app_name, kv_store_client_t* kv_store_client, void* handle, config_value_t* publisher_appname, config_value_t* sub_config);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif
cfgmgr_iface_type_t
cfgmgr_iface_type_t
Definition: cfgmgr_util.h:59
configt_to_char
char * configt_to_char(config_t *config)
cvt_obj_str_to_char
char * cvt_obj_str_to_char(config_value_t *cvt)
get_ipc_config
bool get_ipc_config(config_t *c_json, config_value_t *config, const char *end_point, cfgmgr_iface_type_t type)
cvt_to_char
char * cvt_to_char(config_value_t *config)
construct_tcp_publisher_prod
bool construct_tcp_publisher_prod(char *app_name, config_t *c_json, config_t *inner_json, void *handle, config_value_t *config, kv_store_client_t *kv_store_client)
add_keys_to_config
bool add_keys_to_config(config_t *sub_topic, char *app_name, kv_store_client_t *kv_store_client, void *handle, config_value_t *publisher_appname, config_value_t *sub_config)