24 #include "ccsp_base_api.h"
25 #include "ccsp_message_bus.h"
26 #include "ccsp_memory.h"
30 #include "safec_lib.h"
36 #define print_message(...) LOG(__VA_ARGS__)
38 #define print_message(...)
47 #define CCSP_BUS_CLIENT "ccsp.busclient"
48 #define CCSP_BUS_CFG CCSP_MSG_BUS_CFG
49 #define DST_COMP_CR "com.cisco.spvtg.ccsp.CR"
50 #define DST_COMP_SUBSYS "eRT."
51 #define DST_COMP_ID DST_COMP_SUBSYS DST_COMP_CR
55 void *ccsp_bus_handle = NULL;
72 if ( NULL == ccsp_bus_handle )
74 ret = CCSP_Message_Bus_Init(CCSP_BUS_CLIENT, CCSP_BUS_CFG, &ccsp_bus_handle, (CCSP_MESSAGE_BUS_MALLOC)Ansc_AllocateMemory_Callback, Ansc_FreeMemory_Callback);
77 print_message(
"[%s]:CCSP_Message_Bus_Init() failed ret_val = %d\n", __FUNCTION__, ret);
78 ccsp_bus_handle = NULL;
91 CCSP_Message_Bus_Exit(ccsp_bus_handle);
92 ccsp_bus_handle = NULL;
103 UNREFERENCED_PARAMETER(len);
107 char* dst_pathname = NULL;
108 char* dst_compid = NULL;
109 char* parameter_name[1] = {NULL};
110 parameterValStruct_t** param_val = NULL;
111 componentStruct_t** components = NULL;
114 if( NULL == ccsp_bus_handle || NULL == path_namespace || NULL == parm_value)
116 print_message(
"[%s]:Invalid input arguments\n", __FUNCTION__);
121 ret = CcspBaseIf_discComponentSupportingNamespace(ccsp_bus_handle, DST_COMP_ID, path_namespace, DST_COMP_SUBSYS, &components, &comp_size);
122 if ( CCSP_SUCCESS != ret || 1 > comp_size )
124 print_message(
"[%s]:Unable to find the destination component namespace ret_val = %d comp_size = %d\n", __FUNCTION__, ret, comp_size);
128 dst_compid = components[0]->componentName;
129 dst_pathname = components[0]->dbusPath;
130 parameter_name[0] = (
char*)path_namespace;
133 ret = CcspBaseIf_getParameterValues(ccsp_bus_handle, dst_compid, dst_pathname, parameter_name, 1, &val_size, ¶m_val);
134 if( CCSP_SUCCESS != ret || 1 > val_size )
136 print_message(
"[%s]:Unable get param values ret_val = %d size = %d\n", __FUNCTION__, ret, val_size);
137 free_componentStruct_t(ccsp_bus_handle, comp_size, components);
141 rc = sprintf_s(parm_value,len,
"%s", param_val[0]->parameterValue);
145 free_componentStruct_t(ccsp_bus_handle, comp_size, components);
146 free_parameterValStruct_t(ccsp_bus_handle, val_size, param_val);
149 free_componentStruct_t(ccsp_bus_handle, comp_size, components);
150 free_parameterValStruct_t(ccsp_bus_handle, val_size, param_val);