Json module implementation file. More...
#include "json.h"
#include "json_util.h"
#include "memory.h"
#include "log_util.h"
#include "definitions.h"
#include "event.h"
#include "mcl/mcl_event.h"
Go to the source code of this file.
Json module implementation file.
Definition in file json.c.
|
static |
Definition at line 571 of file json.c.
References _add_string_field_to_object(), ASSERT_CODE_MESSAGE, string_t::buffer, data_point_t::custom_data, mcl_list_node_t::data, DEBUG_LEAVE, data_point_t::description, data_point_t::id, JSON_OBJECT, json_util_add_item_to_array(), json_util_add_object(), json_util_add_string(), json_util_destroy(), json_util_duplicate(), json_util_finish_array(), json_util_finish_object(), json_util_initialize(), json_util_start_array(), list_next(), list_reset(), MCL_FALSE, MCL_NULL, MCL_OK, MCL_TRUE, data_point_t::name, PAYLOAD_FIELD_CUSTOM_DATA, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_ID, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_NAME, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_TYPE, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_UNIT, PAYLOAD_FIELD_DESCRIPTION, payload_field_names, data_point_t::type, and data_point_t::unit.
Referenced by _add_data_source_configuration_data_sources().
|
static |
Definition at line 505 of file json.c.
References _add_data_source_configuration_data_points(), _add_string_field_to_object(), ASSERT_CODE_MESSAGE, string_t::buffer, data_source_t::custom_data, mcl_list_node_t::data, data_source_t::data_points, DEBUG_ENTRY, DEBUG_LEAVE, data_source_t::description, JSON_OBJECT, json_util_add_item_to_array(), json_util_add_object(), json_util_add_string(), json_util_destroy(), json_util_duplicate(), json_util_finish_array(), json_util_finish_object(), json_util_initialize(), json_util_start_array(), list_next(), list_reset(), MCL_FALSE, MCL_NULL, MCL_OK, MCL_TRUE, data_source_t::name, PAYLOAD_FIELD_CUSTOM_DATA, PAYLOAD_FIELD_DATA_SOURCES, PAYLOAD_FIELD_DATA_SOURCES_NAME, PAYLOAD_FIELD_DESCRIPTION, and payload_field_names.
Referenced by json_from_data_source_configuration_payload().
|
static |
Definition at line 170 of file json.c.
References _add_string_field_to_object(), ASSERT_CODE_MESSAGE, string_t::buffer, event_payload_t::correlation_id, DEBUG_ENTRY, DEBUG_LEAVE, event_payload_t::description, event_payload_t::details, event_payload_t::id, JSON_OBJECT, json_util_add_item_to_array(), json_util_add_object(), json_util_add_string(), json_util_add_uint(), json_util_destroy(), json_util_duplicate(), json_util_finish_object(), json_util_initialize(), MCL_FALSE, MCL_NULL, MCL_OK, MCL_TRUE, event_t::payload, PAYLOAD_FIELD_CORRELATION_ID, PAYLOAD_FIELD_DESCRIPTION, PAYLOAD_FIELD_DETAILS, PAYLOAD_FIELD_ID, payload_field_names, PAYLOAD_FIELD_SEVERITY, PAYLOAD_FIELD_TIMESTAMP, PAYLOAD_FIELD_TYPE, PAYLOAD_FIELD_VERSION, event_payload_t::severity, event_payload_t::timestamp, event_payload_t::type, and event_payload_t::version.
Referenced by _add_event_list().
|
static |
Definition at line 154 of file json.c.
References _add_event(), ASSERT_CODE_MESSAGE, mcl_list_node_t::data, DEBUG_ENTRY, DEBUG_LEAVE, list_next(), list_reset(), MCL_NULL, and MCL_OK.
Referenced by json_from_event_payload().
|
static |
Definition at line 354 of file json.c.
References _add_string_field_to_object(), ASSERT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, item_meta_t::details, JSON_OBJECT, json_util_add_object(), json_util_destroy(), json_util_finish_object(), json_util_has_child(), json_util_initialize(), MCL_FALSE, MCL_NULL, MCL_OK, MCL_TRUE, META_FIELD_DETAILS, META_FIELD_DETAILS_ROUTING, meta_field_names, and item_meta_details_t::routing.
Referenced by json_from_item_meta().
|
static |
Definition at line 473 of file json.c.
References _add_item_meta_payload_details(), ASSERT_CODE_MESSAGE, string_t::buffer, DEBUG_ENTRY, DEBUG_LEAVE, json_util_add_string(), json_util_finish_object(), json_util_start_object(), MCL_NULL, MCL_OK, meta_field_names, META_FIELD_PAYLOAD, META_FIELD_PAYLOAD_TYPE, META_FIELD_PAYLOAD_VERSION, item_meta_t::payload, item_meta_payload_t::type, and item_meta_payload_t::version.
Referenced by json_from_item_meta().
|
static |
Definition at line 391 of file json.c.
References _add_string_field_to_object(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, item_meta_payload_details_time_series_t::configuration_id, item_meta_payload_details_file_t::creation_date, item_meta_payload_details_union_t::custom_details, DEBUG_ENTRY, DEBUG_LEAVE, item_meta_payload_t::details, item_meta_payload_details_custom_t::details_json, item_meta_payload_details_union_t::file_details, item_meta_payload_details_file_t::file_name, item_meta_payload_details_file_t::file_type, JSON_OBJECT, json_util_add_object(), json_util_destroy(), json_util_duplicate(), json_util_finish_object(), json_util_has_child(), json_util_initialize(), MCL_DEBUG, MCL_FALSE, MCL_NULL, MCL_OK, MCL_TRUE, META_FIELD_DETAILS, meta_field_names, META_FIELD_PAYLOAD_DETAILS_CONFIGURATION_ID, META_FIELD_PAYLOAD_DETAILS_CREATION_DATE, META_FIELD_PAYLOAD_DETAILS_FILE_NAME, META_FIELD_PAYLOAD_DETAILS_FILE_TYPE, META_FIELD_PAYLOAD_TYPE_BUSINESS_EVENT, META_FIELD_PAYLOAD_TYPE_DATA_SOURCE_CONFIGURATION, META_FIELD_PAYLOAD_TYPE_FILE, META_FIELD_PAYLOAD_TYPE_TIME_SERIES, meta_field_values, item_meta_t::payload, string_compare(), item_meta_payload_details_union_t::time_series_details, and item_meta_payload_t::type.
Referenced by _add_item_meta_payload().
|
static |
Definition at line 627 of file json.c.
References string_t::buffer, DEBUG_ENTRY, DEBUG_LEAVE, json_util_add_string(), MCL_DEBUG, MCL_FAIL, MCL_NULL, MCL_NULL_CHAR, and MCL_OK.
Referenced by _add_data_source_configuration_data_points(), _add_data_source_configuration_data_sources(), _add_event(), _add_item_meta_details(), _add_item_meta_payload_details(), and json_from_item_meta().
|
static |
Definition at line 305 of file json.c.
References _add_time_series_payload_values_objects(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, mcl_list_node_t::data, DEBUG_ENTRY, DEBUG_LEAVE, json_util_finish_array(), json_util_start_array(), list_next(), list_reset(), MCL_NULL, MCL_OK, payload_field_names, and PAYLOAD_FIELD_VALUES.
Referenced by _add_time_series_value_set().
|
static |
Definition at line 329 of file json.c.
References ASSERT_STATEMENT_CODE_MESSAGE, string_t::buffer, time_series_value_t::data_point_id, DEBUG_ENTRY, DEBUG_LEAVE, JSON_OBJECT, json_util_add_item_to_array(), json_util_add_string(), json_util_destroy(), json_util_finish_object(), json_util_initialize(), MCL_NULL, MCL_OK, payload_field_names, PAYLOAD_FIELD_VALUES_DATA_POINT_ID, PAYLOAD_FIELD_VALUES_QUALITY_CODE, PAYLOAD_FIELD_VALUES_VALUE, time_series_value_t::quality_code, and time_series_value_t::value.
Referenced by _add_time_series_payload_values_array().
|
static |
Definition at line 280 of file json.c.
References _add_time_series_payload_values_array(), ASSERT_STATEMENT_CODE, string_t::buffer, DEBUG_ENTRY, DEBUG_LEAVE, JSON_OBJECT, json_util_add_item_to_array(), json_util_add_string(), json_util_destroy(), json_util_finish_object(), json_util_initialize(), MCL_NULL, MCL_OK, payload_field_names, PAYLOAD_FIELD_TIMESTAMP, time_series_value_set_t::timestamp, and time_series_value_set_t::values.
Referenced by _add_time_series_value_sets().
|
static |
Definition at line 263 of file json.c.
References _add_time_series_value_set(), ASSERT_CODE_MESSAGE, mcl_list_node_t::data, DEBUG_ENTRY, DEBUG_LEAVE, list_next(), list_reset(), MCL_NULL, and MCL_OK.
Referenced by json_from_time_series_payload().
E_MCL_ERROR_CODE json_from_data_source_configuration_payload | ( | data_source_configuration_payload_t * | payload, |
string_t ** | json_string | ||
) |
Creates payload part of data source configuration in json format.
[in] | payload | Payload fields of data source configuration is stored in this struct. |
[out] | json_string | Json string filled with meta part of the related item. |
Definition at line 104 of file json.c.
References _add_data_source_configuration_data_sources(), string_t::buffer, data_source_configuration_payload_t::configuration_id, data_source_configuration_payload_t::data_sources, DEBUG_ENTRY, DEBUG_LEAVE, JSON_OBJECT, json_util_add_string(), json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, PAYLOAD_FIELD_CONFIGURATION_ID, payload_field_names, and string_initialize_dynamic().
Referenced by _exchange_prepare_data().
E_MCL_ERROR_CODE json_from_event_payload | ( | list_t * | event_list_payload, |
string_t ** | json_string | ||
) |
Creates payload part of event set in json format.
[in] | event_list_payload | Payload fields of event list is stored in this list. |
[in] | json_string | Json string filled with meta part of the related item. |
Definition at line 129 of file json.c.
References _add_event_list(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, JSON_ARRAY, json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, and string_initialize_dynamic().
Referenced by _exchange_prepare_data().
E_MCL_ERROR_CODE json_from_item_meta | ( | item_meta_t * | item_meta, |
string_t ** | json_string | ||
) |
Creates item meta part of all types in json format.
[in] | item_meta | Meta fields of the item are stored in this struct. |
[out] | json_string | Json string filled with meta part of the related item. |
Definition at line 37 of file json.c.
References _add_item_meta_details(), _add_item_meta_payload(), _add_string_field_to_object(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, JSON_OBJECT, json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, MCL_TRUE, meta_field_names, META_FIELD_TYPE, META_FIELD_VERSION, string_initialize_dynamic(), item_meta_t::type, and item_meta_t::version.
Referenced by _exchange_prepare_data().
E_MCL_ERROR_CODE json_from_time_series_payload | ( | time_series_payload_t * | payload, |
string_t ** | json_string | ||
) |
Creates payload part of time series in json format.
[in] | payload | Payload fields of time series is stored in this struct. |
[out] | json_string | Json string filled with meta part of the related item. |
Definition at line 76 of file json.c.
References _add_time_series_value_sets(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, JSON_ARRAY, json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, string_initialize_dynamic(), and time_series_payload_t::value_sets.
Referenced by _exchange_prepare_data().