custom_data.c File Reference

Custom data module implementation file. More...

#include "custom_data.h"
#include "memory.h"
#include "log_util.h"
#include "definitions.h"
#include "mcl/mcl_custom_data.h"
#include "json_util.h"
Include dependency graph for custom_data.c:

Go to the source code of this file.

Functions

static E_MCL_ERROR_CODE _initialize_custom_data_meta_fields (custom_data_t *custom_data, const char *type, const char *version, const char *routing)
 
E_MCL_ERROR_CODE custom_data_initialize (const char *version, const char *type, const char *routing, custom_data_t **custom_data)
 Initializes custom_data. More...
 
E_MCL_ERROR_CODE mcl_custom_data_set_meta_details (mcl_custom_data_t *custom_data, const mcl_json_t *details)
 Adds a custom details object to custom_data. More...
 
E_MCL_ERROR_CODE mcl_custom_data_set_payload (mcl_custom_data_t *custom_data, const mcl_uint8_t *content, mcl_size_t content_size)
 Sets payload contents. More...
 
void custom_data_destroy (custom_data_t **custom_data)
 Destroys custom_data. More...
 

Detailed Description

Custom data module implementation file.


Date
Jul 27, 2016

Definition in file custom_data.c.

Function Documentation

void custom_data_destroy ( custom_data_t **  custom_data)

Destroys custom_data.

Parameters
[in]custom_dataAll meta and payload details, content etc. stored in this data struct.

Definition at line 72 of file custom_data.c.

References DEBUG_ENTRY, DEBUG_LEAVE, json_util_destroy(), MCL_FREE, MCL_NULL, and string_destroy().

Referenced by _store_list_destroy_callback(), custom_data_initialize(), mcl_store_new_custom_data(), and stream_data_destroy().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE custom_data_initialize ( const char *  version,
const char *  type,
const char *  routing,
custom_data_t **  custom_data 
)

Initializes custom_data.

Parameters
[in]versionMeta version.
[in]typeMeta type.
[in]routingRouting information in meta description of custom_data. This parameter is optional and can be NULL.
[out]custom_dataCustom data handle to operate on.
Returns

Definition at line 24 of file custom_data.c.

References _initialize_custom_data_meta_fields(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, custom_data_destroy(), DEBUG_ENTRY, DEBUG_LEAVE, MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.

Referenced by mcl_store_new_custom_data(), and stream_data_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE mcl_custom_data_set_meta_details ( mcl_custom_data_t custom_data,
const mcl_json_t details 
)

Adds a custom details object to custom_data.

Parameters
[in]custom_dataAll meta and payload details, content etc. stored in this data struct.
[in]detailsA custom json object to form meta details of custom_data. New memory space will be allocated for this parameter. Ownership passed to caller. Caller must free the space.
Returns

Definition at line 42 of file custom_data.c.

References ASSERT_NOT_NULL, DEBUG_ENTRY, DEBUG_LEAVE, json_util_duplicate(), and MCL_TRUE.

Referenced by mcl_stream_data_set_meta_details().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE mcl_custom_data_set_payload ( mcl_custom_data_t custom_data,
const mcl_uint8_t content,
mcl_size_t  content_size 
)

Sets payload contents.

Warning
Destroying content is user's own responsibility. Avoid destroying content unless at least one of the following conditions are met.
  • Successful exchange.
  • Destroying store (mcl_store_destroy(&store)).
  • Destroying communication (mcl_communication_destroy(&communication)).
Parameters
[in]custom_dataAll meta and payload details, content etc. stored in this data struct.
[in]contentPayload content. Payload can contain binary data as well
[in]content_sizePayload content size.
Returns

Definition at line 57 of file custom_data.c.

References ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, DEBUG_ENTRY, DEBUG_LEAVE, MCL_INVALID_PARAMETER, and MCL_OK.