EII ConfigMgr C/C++ Reference
Classes | Macros | Typedefs | Functions
cfgmgr.h File Reference

Configuration Manager C APIs. More...

#include <ctype.h>
#include "eii/config_manager/kv_store_plugin/kv_store_plugin.h"
#include "eii/config_manager/cfgmgr_util.h"

Go to the source code of this file.

Classes

struct  cfgmgr_ctx_t
 
struct  cfgmgr_interface_t
 

Macros

#define PUBLISHERS   "Publishers"
 
#define SUBSCRIBERS   "Subscribers"
 
#define SERVERS   "Servers"
 
#define CLIENTS   "Clients"
 
#define SOCKET_FILE   "socket_file"
 
#define ENDPOINT   "EndPoint"
 
#define TOPICS   "Topics"
 
#define NAME   "Name"
 
#define ALLOWED_CLIENTS   "AllowedClients"
 
#define TYPE   "Type"
 
#define PUBLIC_KEYS   "/Publickeys/"
 
#define PRIVATE_KEY   "/private_key"
 
#define ZMQ_RECV_HWM   "zmq_recv_hwm"
 
#define BROKER_APPNAME   "BrokerAppName"
 
#define BROKERED   "brokered"
 
#define PUBLISHER_APPNAME   "PublisherAppName"
 
#define SERVER_APPNAME   "ServerAppName"
 

Typedefs

typedef kv_store_watch_callback_t cfgmgr_watch_callback_t
 

Functions

bool cfgmgr_is_dev_mode (cfgmgr_ctx_t *cfgmgr)
 
config_value_t * cfgmgr_get_appname (cfgmgr_ctx_t *cfgmgr)
 
config_t * cfgmgr_get_app_config (cfgmgr_ctx_t *cfgmgr)
 
config_t * cfgmgr_get_app_interface (cfgmgr_ctx_t *cfgmgr)
 
config_value_t * cfgmgr_get_app_config_value (cfgmgr_ctx_t *cfgmgr, const char *key)
 
config_value_t * cfgmgr_get_app_interface_value (cfgmgr_ctx_t *cfgmgr, const char *key)
 
config_t * cfgmgr_get_msgbus_config (cfgmgr_interface_t *ctx)
 
config_value_t * cfgmgr_get_endpoint (cfgmgr_interface_t *ctx)
 
config_value_t * cfgmgr_get_topics (cfgmgr_interface_t *ctx)
 
bool cfgmgr_set_topics (cfgmgr_interface_t *ctx, char const *const *topics_list, int len)
 
config_value_t * cfgmgr_get_allowed_clients (cfgmgr_interface_t *ctx)
 
int cfgmgr_get_num_publishers (cfgmgr_ctx_t *cfgmgr)
 
int cfgmgr_get_num_subscribers (cfgmgr_ctx_t *cfgmgr)
 
int cfgmgr_get_num_servers (cfgmgr_ctx_t *cfgmgr)
 
int cfgmgr_get_num_clients (cfgmgr_ctx_t *cfgmgr)
 
void cfgmgr_watch (cfgmgr_ctx_t *cfgmgr, const char *key, cfgmgr_watch_callback_t watch_callback, void *user_data)
 
void cfgmgr_watch_prefix (cfgmgr_ctx_t *cfgmgr, char *prefix, cfgmgr_watch_callback_t watch_callback, void *user_data)
 
config_value_t * cfgmgr_get_interface_value (cfgmgr_interface_t *cfgmgr_interface, const char *key)
 
cfgmgr_interface_tcfgmgr_get_publisher_by_name (cfgmgr_ctx_t *cfgmgr, const char *name)
 
cfgmgr_interface_tcfgmgr_get_publisher_by_index (cfgmgr_ctx_t *cfgmgr, int index)
 
cfgmgr_interface_tcfgmgr_get_subscriber_by_name (cfgmgr_ctx_t *cfgmgr, const char *name)
 
cfgmgr_interface_tcfgmgr_get_subscriber_by_index (cfgmgr_ctx_t *cfgmgr, int index)
 
cfgmgr_interface_tcfgmgr_get_server_by_name (cfgmgr_ctx_t *cfgmgr, const char *name)
 
cfgmgr_interface_tcfgmgr_get_server_by_index (cfgmgr_ctx_t *cfgmgr, int index)
 
cfgmgr_interface_tcfgmgr_get_client_by_name (cfgmgr_ctx_t *cfgmgr, const char *name)
 
cfgmgr_interface_tcfgmgr_get_client_by_index (cfgmgr_ctx_t *cfgmgr, int index)
 
cfgmgr_ctx_tcfgmgr_initialize ()
 
void cfgmgr_destroy (cfgmgr_ctx_t *cfg_mgr)
 
cfgmgr_interface_tcfgmgr_interface_initialize ()
 
void cfgmgr_interface_destroy (cfgmgr_interface_t *cfg_mgr_interface)
 

Detailed Description

Configuration Manager C APIs.

Function Documentation

◆ cfgmgr_destroy()

void cfgmgr_destroy ( cfgmgr_ctx_t cfg_mgr)

Destroy cfgmgr_ctx_t* object.

Parameters
cfg_mgr- configuration to destroy

◆ cfgmgr_get_allowed_clients()

config_value_t* cfgmgr_get_allowed_clients ( cfgmgr_interface_t ctx)

cfgmgr_get_allowed_clients function to fetch allowed clients

Get Allowed Clients returns the value mapped to AllowedClients key in the Applications Interface. If "*" is mentioned in the allowed clients, the return value will still be "*" notifying user that all the provisioned applications are allowed to get the topics.

Parameters
ctx- cfgmgr_interface_t object
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_app_config()

config_t* cfgmgr_get_app_config ( cfgmgr_ctx_t cfgmgr)

cfgmgr_get_app_config function to return app config

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
NULL for any errors occured or config_t* on success

◆ cfgmgr_get_app_config_value()

config_value_t* cfgmgr_get_app_config_value ( cfgmgr_ctx_t cfgmgr,
const char *  key 
)

cfgmgr_get_app_config_value function to fetch config value

Parameters
cfgmgr- cfgmgr_ctx_t object
key- value of key to be fetched
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_app_interface()

config_t* cfgmgr_get_app_interface ( cfgmgr_ctx_t cfgmgr)

cfgmgr_get_app_interface function to return app interface

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
NULL for any errors occured or config_t* on success

◆ cfgmgr_get_app_interface_value()

config_value_t* cfgmgr_get_app_interface_value ( cfgmgr_ctx_t cfgmgr,
const char *  key 
)

cfgmgr_get_app_interface_value function to fetch app interface value

Parameters
cfgmgr- cfgmgr_ctx_t object
key- value of key to be fetched
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_appname()

config_value_t* cfgmgr_get_appname ( cfgmgr_ctx_t cfgmgr)

To fetch appname of any service

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_client_by_index()

cfgmgr_interface_t* cfgmgr_get_client_by_index ( cfgmgr_ctx_t cfgmgr,
int  index 
)

cfgmgr_get_client_by_index function to fetch a client config using its index

Parameters
cfgmgr- cfgmgr_ctx_t object
index- index of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_client_by_name()

cfgmgr_interface_t* cfgmgr_get_client_by_name ( cfgmgr_ctx_t cfgmgr,
const char *  name 
)

cfgmgr_get_client_by_name function to fetch a client config using its name

Parameters
cfgmgr- cfgmgr_ctx_t object
name- name of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_endpoint()

config_value_t* cfgmgr_get_endpoint ( cfgmgr_interface_t ctx)

get_endpoint_base function to fetch endpoint

Parameters
ctx- cfgmgr_interface_t object
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_interface_value()

config_value_t* cfgmgr_get_interface_value ( cfgmgr_interface_t cfgmgr_interface,
const char *  key 
)

cfgmgr_get_interface_value function to fetch interface value

Parameters
cfgmgr_interface- cfgmgr_interface_t object
key- value of key to be fetched
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_msgbus_config()

config_t* cfgmgr_get_msgbus_config ( cfgmgr_interface_t ctx)

cfgmgr_get_msgbus_config function to fetch msgbus config

Parameters
ctx- cfgmgr_interface_t object
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_get_num_clients()

int cfgmgr_get_num_clients ( cfgmgr_ctx_t cfgmgr)

To fetch number of clients in an interface

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
number of clients if success or -1 for any errors

◆ cfgmgr_get_num_publishers()

int cfgmgr_get_num_publishers ( cfgmgr_ctx_t cfgmgr)

To fetch number of publishers in an interface

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
number of publishers if success or -1 for any errors

◆ cfgmgr_get_num_servers()

int cfgmgr_get_num_servers ( cfgmgr_ctx_t cfgmgr)

To fetch number of servers in an interface

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
number of servers if success or -1 for any errors

◆ cfgmgr_get_num_subscribers()

int cfgmgr_get_num_subscribers ( cfgmgr_ctx_t cfgmgr)

To fetch number of subscribers in an interface

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
number of subscribers if success or -1 for any errors

◆ cfgmgr_get_publisher_by_index()

cfgmgr_interface_t* cfgmgr_get_publisher_by_index ( cfgmgr_ctx_t cfgmgr,
int  index 
)

cfgmgr_get_publisher_by_index function to fetch a publisher config using its index

Parameters
cfgmgr- cfgmgr_ctx_t object
index- index of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_publisher_by_name()

cfgmgr_interface_t* cfgmgr_get_publisher_by_name ( cfgmgr_ctx_t cfgmgr,
const char *  name 
)

cfgmgr_get_publisher_by_name function to fetch a publisher config using its name

Parameters
cfgmgr- cfgmgr_ctx_t object
name- name of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_server_by_index()

cfgmgr_interface_t* cfgmgr_get_server_by_index ( cfgmgr_ctx_t cfgmgr,
int  index 
)

cfgmgr_get_server_by_index function to fetch a server config using its index

Parameters
cfgmgr- cfgmgr_ctx_t object
index- index of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_server_by_name()

cfgmgr_interface_t* cfgmgr_get_server_by_name ( cfgmgr_ctx_t cfgmgr,
const char *  name 
)

cfgmgr_get_server_by_name function to fetch a server config using its name

Parameters
cfgmgr- cfgmgr_ctx_t object
name- name of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_subscriber_by_index()

cfgmgr_interface_t* cfgmgr_get_subscriber_by_index ( cfgmgr_ctx_t cfgmgr,
int  index 
)

cfgmgr_get_subscriber_by_index function to fetch a subscriber config using its index

Parameters
cfgmgr- cfgmgr_ctx_t object
index- index of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_subscriber_by_name()

cfgmgr_interface_t* cfgmgr_get_subscriber_by_name ( cfgmgr_ctx_t cfgmgr,
const char *  name 
)

cfgmgr_get_subscriber_by_name function to fetch a subscriber config using its name

Parameters
cfgmgr- cfgmgr_ctx_t object
name- name of config to be fetched
Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_get_topics()

config_value_t* cfgmgr_get_topics ( cfgmgr_interface_t ctx)

cfgmgr_get_topics function to fetch topics

Returns the value mapped to Topics key in the Applications Interface. If "*" is mentioned in topics, then it is replaced by empty string , as our EIIMessageBus supports the prefix approach, empty prefix considers all/any the topics.

Parameters
ctx- cfgmgr_interface_t object
Returns
NULL for any errors occured or config_value_t* on success

◆ cfgmgr_initialize()

cfgmgr_ctx_t* cfgmgr_initialize ( )

cfgmgr_initialize function to create a new cfgmgr_ctx_t instance

Returns
NULL for any errors occured or cfgmgr_ctx_t* on success

◆ cfgmgr_interface_destroy()

void cfgmgr_interface_destroy ( cfgmgr_interface_t cfg_mgr_interface)

Destroy cfgmgr_ctx_t* object.

Parameters
cfg_mgr_interface- configuration to destroy

◆ cfgmgr_interface_initialize()

cfgmgr_interface_t* cfgmgr_interface_initialize ( )

cfgmgr_interface_initialize function to create a new cfgmgr_interface_t instance

Returns
NULL for any errors occured or cfgmgr_interface_t* on success

◆ cfgmgr_is_dev_mode()

bool cfgmgr_is_dev_mode ( cfgmgr_ctx_t cfgmgr)

To check whether environment is dev mode or prod mode

Parameters
cfgmgr- cfgmgr_ctx_t object
Returns
0 if dev_mode or any errors, prod mode otherwise

◆ cfgmgr_set_topics()

bool cfgmgr_set_topics ( cfgmgr_interface_t ctx,
char const *const *  topics_list,
int  len 
)

set_topics_base function to set topics

Parameters
ctx- cfgmgr_interface_t object
topics_list- list of topics to be set
len- total number of topics
Returns
false for any errors occured or true on success

◆ cfgmgr_watch()

void cfgmgr_watch ( cfgmgr_ctx_t cfgmgr,
const char *  key,
cfgmgr_watch_callback_t  watch_callback,
void *  user_data 
)

function to register a callback for a specific key

Parameters
cfgmgr- cfgmgr_ctx_t object
key- key to watch on
watch_callback- cfgmgr_watch_callback_t object
user_data- user_data to be sent to callback

◆ cfgmgr_watch_prefix()

void cfgmgr_watch_prefix ( cfgmgr_ctx_t cfgmgr,
char *  prefix,
cfgmgr_watch_callback_t  watch_callback,
void *  user_data 
)

function to register a callback for a specific key prefix

Parameters
cfgmgr- cfgmgr_ctx_t object
prefix- key prefix to watch on
watch_callback- cfgmgr_watch_callback_t object
user_data- user_data to be sent to callback