json.h File Reference

Json module header file. More...

Include dependency graph for json.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

MCL_LOCAL mcl_error_t json_from_item_meta (void *item, char **json_string)
 
MCL_LOCAL mcl_error_t json_from_item_payload (void *item, char **json_string)
 
MCL_LOCAL mcl_size_t json_get_item_size (void *item)
 
MCL_LOCAL mcl_error_t json_parse_item (const char *json_string, mcl_size_t string_length, void **item)
 

Detailed Description

Json module header file.

This module creates json strings for all data types.

Definition in file json.h.

Function Documentation

MCL_LOCAL mcl_error_t json_from_item_meta ( void *  item,
char **  json_string 
)

This function creates json representation of an item meta.

Parameters
[in]itemMCL item (Event, Timeseries, etc.).
[out]json_stringJson string representation of item meta.
Returns

Definition at line 326 of file json.c.

References _add_item_meta_details(), _add_item_meta_payload(), ITEM_TYPE, ITEM_VERSION, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_JSON_OBJECT, mcl_json_util_add_string(), mcl_json_util_destroy(), mcl_json_util_initialize(), mcl_json_util_to_string(), MCL_NULL, MCL_OK, meta_field_names, META_FIELD_TYPE, and META_FIELD_VERSION.

Referenced by _add_item_meta_json().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_error_t json_from_item_payload ( void *  item,
char **  json_string 
)

This function creates json representation of an item payload in a json array.

Parameters
[in]itemItem which will be used to create json string.
[out]json_stringJson string representation of item payload.
Returns

Definition at line 370 of file json.c.

References _json_from_data_source_configuration_payload(), _json_from_event_payload(), _json_from_timeseries_payload(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_ITEM_TYPE_DATA_SOURCE_CONFIGURATION, MCL_ITEM_TYPE_EVENT, and MCL_ITEM_TYPE_TIMESERIES.

Referenced by _add_item_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_size_t json_get_item_size ( void *  item)

This function calculates the item size.

Parameters
[in]itemItem to calculate its size.
Returns
Size of the item.

Definition at line 429 of file json.c.

References _item_meta_size(), _item_payload_size_for_data_source_configuration(), _item_payload_size_for_event(), _item_payload_size_for_timeseries(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_ITEM_TYPE_CUSTOM_DATA, MCL_ITEM_TYPE_DATA_SOURCE_CONFIGURATION, MCL_ITEM_TYPE_EVENT, MCL_ITEM_TYPE_FILE, and MCL_ITEM_TYPE_TIMESERIES.

Referenced by multipart_get_tuple_size().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_LOCAL mcl_error_t json_parse_item ( const char *  json_string,
mcl_size_t  string_length,
void **  item 
)

This function parses json representation of an item to its struct (Currently, only for data source configuration).

Parameters
[in]json_stringJson string.
[in]string_lengthLength of json string.
[out]itemItem struct.
Returns

Definition at line 467 of file json.c.

References _parse_data_source_configuration(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_json_util_destroy(), mcl_json_util_parse(), MCL_NULL, and MCL_OK.

Referenced by connectivity_processor_get_data_source_configuration().

Here is the call graph for this function:

Here is the caller graph for this function: