CTaps 0.3.0
A C implementation of the Transport Services API (RFC 9621 - 9623)
Loading...
Searching...
No Matches
ct_message_t Struct Reference

Opaque handle representing a single message to be sent or received. More...

#include <ctaps.h>

Detailed Description

Opaque handle representing a single message to be sent or received.

Use ct_message_new()/ct_message_new_with_content() to create, and ct_message_free() to free.

Message Ownership Model

Sending Messages

When you send a message using ct_send_message() or ct_send_message_full():

  • You retain ownership of your original message
  • CTaps makes a deep copy internally for transmission
  • You can free your message immediately after the send function returns
  • CTaps manages the lifecycle of its internal copy

Receiving Messages

When you receive a message in a receive callback:

  • The message is only valid during the callback execution, you must take a deep copy if you need to use it after the callback returns

Example

ct_send_message(connection, msg);
ct_message_free(msg); // Safe to free immediately after send
int ct_send_message(ct_connection_t *connection, const ct_message_t *message)
Send a message over a connection with default properties.
ct_message_t * ct_message_new_with_content(const char *content, size_t length)
Allocate a new message with content.
void ct_message_free(ct_message_t *message)
Free all resources in a message including the structure.
Opaque handle representing a single message to be sent or received.

The documentation for this struct was generated from the following file: