Message and message context creation, and accessors.
More...
Message and message context creation, and accessors.
◆ ct_message_deep_copy()
Create a deep copy of a message, including its content.
- Parameters
-
| [in] | message | Message to copy |
- Returns
- Pointer to newly allocated copy of the message, or NULL on failure
◆ ct_message_free()
Free all resources in a message including the structure.
- Parameters
-
| [in] | message | Message to free |
◆ ct_message_get_content()
| const char * ct_message_get_content |
( |
const ct_message_t * |
message | ) |
|
Get the content buffer of a message.
- Parameters
-
| [in] | message | Message to query |
- Returns
- Pointer to message content, or NULL if message is NULL
◆ ct_message_get_length()
| size_t ct_message_get_length |
( |
const ct_message_t * |
message | ) |
|
Get the length of a message.
- Parameters
-
| [in] | message | Message to query |
- Returns
- Length of message in bytes, or 0 if message is NULL
◆ ct_message_new()
Allocate a new message on the heap.
- Note
- The caller maintains ownership even after passing to send functions, CTaps makes deep copies internally.
- Returns
- Pointer to newly allocated message, or NULL on failure
◆ ct_message_new_with_content()
| ct_message_t * ct_message_new_with_content |
( |
const char * |
content, |
|
|
size_t |
length |
|
) |
| |
Allocate a new message with content.
- Parameters
-
| [in] | content | Data buffer for the message |
| [in] | length | Length of data in bytes |
- Returns
- Pointer to newly allocated message with content, or NULL on failure
◆ ct_message_set_content()
| void ct_message_set_content |
( |
ct_message_t * |
message, |
|
|
const void * |
content, |
|
|
size_t |
length |
|
) |
| |
Set the content of a message, replacing any existing content.
- Parameters
-
| [in,out] | message | Message to modify |
| [in] | content | New data buffer for the message |
| [in] | length | Length of new data in bytes |