Data source configuration module implementation file. More...
#include "mcl/mcl_data_source_configuration.h"
#include "data_source_configuration.h"
#include "log_util.h"
#include "memory.h"
#include "random.h"
#include "json_util.h"
#include "definitions.h"
Go to the source code of this file.
Data source configuration module implementation file.
Definition in file data_source_configuration.c.
|
static |
Definition at line 266 of file data_source_configuration.c.
References DEBUG_ENTRY, DEBUG_LEAVE, json_util_destroy(), MCL_FREE, and string_destroy().
Referenced by _destroy_data_source(), and mcl_data_source_configuration_add_data_point().
|
static |
Definition at line 253 of file data_source_configuration.c.
References _destroy_data_point(), DEBUG_ENTRY, DEBUG_LEAVE, json_util_destroy(), list_destroy_with_content(), MCL_FREE, and string_destroy().
Referenced by data_source_configuration_destroy(), and mcl_data_source_configuration_add_data_source().
|
static |
Definition at line 218 of file data_source_configuration.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_OK, data_source_configuration_t::meta, META_FIELD_PAYLOAD_TYPE_DATA_SOURCE_CONFIGURATION, META_FIELD_TYPE_ITEM, meta_field_values, META_FIELD_VERSION_CURRENT, item_meta_t::payload, string_initialize_new(), string_initialize_static(), item_meta_payload_t::type, item_meta_t::type, item_meta_payload_t::version, and item_meta_t::version.
Referenced by data_source_configuration_initialize().
|
static |
Definition at line 239 of file data_source_configuration.c.
References data_source_configuration_payload_t::configuration_id, data_source_configuration_payload_t::data_sources, DEBUG_ENTRY, DEBUG_LEAVE, list_initialize(), MCL_OK, data_source_configuration_t::payload, and random_generate_guid().
Referenced by data_source_configuration_initialize().
void data_source_configuration_destroy | ( | data_source_configuration_t ** | data_source_configuration | ) |
Destroys data_source_configuration
.
[in] | data_source_configuration |
Definition at line 199 of file data_source_configuration.c.
References _destroy_data_source(), DEBUG_ENTRY, DEBUG_LEAVE, list_destroy_with_content(), MCL_FREE, MCL_NULL, and string_destroy().
Referenced by _store_list_destroy_callback(), data_source_configuration_initialize(), and mcl_store_new_data_source_configuration().
E_MCL_ERROR_CODE data_source_configuration_initialize | ( | const char * | version, |
data_source_configuration_t ** | data_source_configuration | ||
) |
Initializes data_source_configuration
.
[in] | version | Meta version. |
[out] | data_source_configuration | Initialized data_source_configuration_t object handle. |
Definition at line 28 of file data_source_configuration.c.
References _initialize_meta(), _initialize_payload(), ASSERT_CODE_MESSAGE, data_source_configuration_destroy(), DEBUG_ENTRY, DEBUG_LEAVE, MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.
Referenced by mcl_store_new_data_source_configuration().
E_MCL_ERROR_CODE mcl_data_source_configuration_add_data_point | ( | mcl_data_source_t * | data_source, |
const char * | id, | ||
const char * | name, | ||
const char * | description, | ||
const char * | type, | ||
const char * | unit, | ||
mcl_json_t * | custom_data | ||
) |
Sets the list of data points held by the data_source
.
[in] | data_source | Data source the data_source_configuration encloses. |
[in] | id | Agent-unique identifier of the data point. |
[in] | name | Name of the data point. |
[in] | description | Description of the data point. This parameter is optional and can be NULL. |
[in] | type | Data type of the data point. |
[in] | unit | Measurement unit of the data point. |
[in] | custom_data | Custom data of the data point. New memory space will be allocated for this parameter. Ownership passed to caller. Caller must free the space. This parameter is optional and can be NULL. |
data_source
, id
, name
, type
or unit
is NULL. data_source
has no space for a new data point. Definition at line 113 of file data_source_configuration.c.
References _destroy_data_point(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, data_point_t::custom_data, DEBUG_ENTRY, DEBUG_LEAVE, data_point_t::description, data_point_t::id, json_util_duplicate(), list_add(), MCL_DEBUG, MCL_FALSE, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, MCL_TRUE, data_point_t::name, string_initialize_new(), data_point_t::type, and data_point_t::unit.
E_MCL_ERROR_CODE mcl_data_source_configuration_add_data_source | ( | mcl_data_source_configuration_t * | data_source_configuration, |
const char * | name, | ||
const char * | description, | ||
mcl_json_t * | custom_data, | ||
mcl_data_source_t ** | data_source | ||
) |
Sets the list of data sources the data_source_configuration
encloses.
[in] | data_source_configuration | Data source configuration object handle. |
[in] | name | Name of the data_source . |
[in] | description | Description of the data_source . This parameter is optional and can be NULL. |
[in] | custom_data | Custom data of the data_source . New memory space will be allocated for this parameter. Ownership passed to caller. Caller must free the space. This parameter is optional and can be NULL. |
[out] | data_source | Data source the data_source_configuration encloses. |
data_source_configuration
, name
or data_source
is NULL. data_source
. Definition at line 60 of file data_source_configuration.c.
References _destroy_data_source(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, DEBUG_ENTRY, DEBUG_LEAVE, json_util_duplicate(), list_add(), list_initialize(), MCL_DEBUG, MCL_FALSE, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, MCL_TRUE, and string_initialize_new().
E_MCL_ERROR_CODE mcl_data_source_configuration_get_id | ( | mcl_data_source_configuration_t * | data_source_configuration, |
char ** | id | ||
) |
Returns id
of data_source_configuration
.
Memory allocation of id
is done by the function. But the responsibility of freeing id
is on the user.
[in] | data_source_configuration | Data source configuration object handle. |
[out] | id | Unique identifier of the configuration. |
data_model
or configuration_id
is NULL. Definition at line 177 of file data_source_configuration.c.
References ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, string_t::buffer, DEBUG_ENTRY, DEBUG_LEAVE, MCL_FREE, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, and string_initialize().