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

Callback functions for receiving messages on a connection. More...

#include <ctaps.h>

Data Fields

void(* receive_callback )(ct_connection_t *connection, ct_message_t *received_message, ct_message_context_t *ctx)
 Called when a complete message is received.
 
void(* receive_error )(ct_connection_t *connection, ct_message_context_t *ctx, const char *reason)
 Called when a receive error occurs.
 
void * per_receive_context
 Per-receive user context accessible when this specific callback is invoked. Can be fetched within ct_message_context_get_receive_context(ctx)
 

Detailed Description

Callback functions for receiving messages on a connection.

Set these callbacks via ct_receive_message() to handle incoming data.

Definition at line 1111 of file ctaps.h.

Field Documentation

◆ per_receive_context

void* ct_receive_callbacks_t::per_receive_context

Per-receive user context accessible when this specific callback is invoked. Can be fetched within ct_message_context_get_receive_context(ctx)

void check_specific_callback_was_invoked(ct_connection_t* connection,
ct_message_t* received_message,
ct_message_context_t* message_context) {
my_custom_struct* recv_ctx = ct_message_context_get_receive_context(message_context);
recv_ctx->was_invoked = true;
}
void * ct_message_context_get_receive_context(const ct_message_context_t *message_context)
Get the receive context from a message context.
Opaque handle representing a connection.
Opaque handle representing message metadata to pass to sending protocol.
Opaque handle representing a single message to be sent or received.

Definition at line 1142 of file ctaps.h.

◆ receive_callback

void(* ct_receive_callbacks_t::receive_callback) (ct_connection_t *connection, ct_message_t *received_message, ct_message_context_t *ctx)

Called when a complete message is received.

Parameters
[in]connectionThe connection that received the message
[in]received_messagePointer to received message. Only valid during callback execution - copy if needed after return.
[in]ctxMessage context with properties and endpoints

Definition at line 1117 of file ctaps.h.

◆ receive_error

void(* ct_receive_callbacks_t::receive_error) (ct_connection_t *connection, ct_message_context_t *ctx, const char *reason)

Called when a receive error occurs.

Parameters
[in]connectionThe connection that experienced the error
[in]ctxMessage context
[in]reasonError description string

Definition at line 1125 of file ctaps.h.


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