Diffusion C API  5.9.24
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
content.h File Reference

Defines functions that operate on the CONTENT_T data structure, which is used to wrap data used in updates to topics. More...

Functions

CONTENT_Tcontent_create (const CONTENT_ENCODING_T encoding, const BUF_T *data)
 Create a new CONTENT_T structure. More...
 
void content_free (CONTENT_T *content)
 Free all memory associated with a CONTENT_T. More...
 
BUF_Tcontent_marshal (const CONTENT_T *content)
 Serialise a CONTENT_T to bytes for transmission to Diffusion. More...
 
char * buf_read_content (const char *data, CONTENT_T **const content)
 Read a CONTENT_T structure from a char array. More...
 
char * buf_read_into_content (const char *data, CONTENT_T *content)
 Read a CONTENT_T structure from a char array. More...
 
CONTENT_Tcontent_unmarshal (const char *str)
 Deserialise bytes from Diffusion to a CONTENT_T structure. More...
 
CONTENT_Tcontent_dup (const CONTENT_T *src)
 Create a deep-copy duplicate of a CONTENT_T structure. More...
 
char * content_to_string (const CONTENT_T *content)
 Utility function for taking a copy of the data in a CONTENT_T, and returning it as a NULL-terminated string. More...
 

Detailed Description

Defines functions that operate on the CONTENT_T data structure, which is used to wrap data used in updates to topics.

Copyright © 2014, 2015 Push Technology Ltd., All Rights Reserved.

Use is subject to license terms.

NOTICE: All information contained herein is, and remains the property of Push Technology. The intellectual and technical concepts contained herein are proprietary to Push Technology and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.

Function Documentation

char* buf_read_content ( const char *  data,
CONTENT_T **const  content 
)

Read a CONTENT_T structure from a char array.

If content is NULL the data will be serialised but omitted.

Parameters
dataThe char array containing the serialised CONTENT_T
contentThe location to store a newly allocated CONTENT_T
Returns
A pointer to the first char following the serialised CONTENT_T in the char array, or NULL on error.
char* buf_read_into_content ( const char *  data,
CONTENT_T content 
)

Read a CONTENT_T structure from a char array.

The destination CONTENT_T structure must exist (ie, cannot be NULL) and will be replaced with the deserialised data.

Parameters
dataThe char darray containing the serialised CONTENT_T
contentThe location of an existing CONTENT_T structure.
Returns
A pointer to the first char following the serialised CONTENT_T in the char array, or NULL on error.
CONTENT_T* content_create ( const CONTENT_ENCODING_T  encoding,
const BUF_T data 
)

Create a new CONTENT_T structure.

Parameters
encodingThe encoding type (only NONE is supported at the moment).
dataA pointer to a BUF_T containing data to be wrapped in the CONTENT_T. The BUF_T is copied, so the source can be freed by the caller.
Returns
A new CONTENT_T structure, or NULL on error.
CONTENT_T* content_dup ( const CONTENT_T src)

Create a deep-copy duplicate of a CONTENT_T structure.

Parameters
srcThe CONTENT_T to be copied.
Returns
A newly allocated CONTENT_T, or NULL if in error occurs.
void content_free ( CONTENT_T content)

Free all memory associated with a CONTENT_T.

Parameters
contentThe CONTENT_T to be freed.
BUF_T* content_marshal ( const CONTENT_T content)

Serialise a CONTENT_T to bytes for transmission to Diffusion.

Parameters
contentThe CONTENT_T to be marshalled.
Returns
A pointer to a newly allocated BUF_T containing the serialised data, or NULL if an error occurs.
char* content_to_string ( const CONTENT_T content)

Utility function for taking a copy of the data in a CONTENT_T, and returning it as a NULL-terminated string.

Parameters
contentThe source CONTENT_T
Returns
A newly allocated pointer to a NULL-terminated string of characters.
CONTENT_T* content_unmarshal ( const char *  str)

Deserialise bytes from Diffusion to a CONTENT_T structure.

Parameters
strThe bytes to be unmarshalled.
Returns
A pointer to a newly allocated CONTENT_T, or NULL if an error occurs.