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

Opaque handle representing message metadata to pass to sending protocol. More...

#include <ctaps.h>

Detailed Description

Opaque handle representing message metadata to pass to sending protocol.

Message Context Ownership Model

Passing to Sending Functions

When you pass a message context to ct_send_message_full() or similar functions:

  • You retain ownership of your original message_context
  • CTaps makes a deep copy internally if it needs to store the context
  • You can free your message_context after the function returns

Receiving in Callbacks

When a message context is passed to your receive callback:

  • The message context is only valid during the callback execution, you must take a deep copy if you need to use it after the callback returns
ct_send_message_full(connection, msg, msg_ctx);
ct_message_context_free(msg_ctx); // Safe to free immediately after send
ct_message_context_t * ct_message_context_new(void)
Initialize a message context with default values.
void ct_message_context_free(ct_message_context_t *message_context)
Free resources in a message context.
int ct_send_message_full(ct_connection_t *connection, const ct_message_t *message, const ct_message_context_t *message_context)
Send a message with custom message context and 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 message metadata to pass to sending protocol.
Opaque handle representing a single message to be sent or received.

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