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

Callback functions for connection lifecycle events. More...

#include <ctaps.h>

Data Fields

void(* connection_error )(ct_connection_t *connection)
 Called when a connection error occurs after establishment.
 
void(* establishment_error )(ct_connection_t *connection)
 Called when connection establishment fails.
 
void(* expired )(ct_connection_t *connection)
 Called when a connection expires (e.g., timeout).
 
void(* path_change )(ct_connection_t *connection)
 Called when the connection's network path changes, local or remote.
 
void(* ready )(ct_connection_t *connection)
 Called when connection is established and ready for data transfer.
 
void(* closed )(ct_connection_t *connection)
 Called when connection is closed and can be safely freed.
 
void(* send_error )(ct_connection_t *connection, ct_message_context_t *message_context, int reason_code)
 Called when a message send operation fails.
 
void(* sent )(ct_connection_t *connection, ct_message_context_t *message_context)
 Called when a message is passed to the transport protocol.
 
void(* soft_error )(ct_connection_t *connection)
 Called when a non-fatal error occurs (e.g., congestion).
 
void * per_connection_context
 User-provided context for the connection lifetime.
 

Detailed Description

Callback functions for connection lifecycle events.

Set these callbacks via ct_preconnection_initiate() or ct_preconnection_listen(). All callbacks are invoked from the event loop thread.

Definition at line 1152 of file ctaps.h.

Field Documentation

◆ closed

void(* ct_connection_callbacks_t::closed) (ct_connection_t *connection)

Called when connection is closed and can be safely freed.

Definition at line 1169 of file ctaps.h.

◆ connection_error

void(* ct_connection_callbacks_t::connection_error) (ct_connection_t *connection)

Called when a connection error occurs after establishment.

Definition at line 1154 of file ctaps.h.

◆ establishment_error

void(* ct_connection_callbacks_t::establishment_error) (ct_connection_t *connection)

Called when connection establishment fails.

Definition at line 1157 of file ctaps.h.

◆ expired

void(* ct_connection_callbacks_t::expired) (ct_connection_t *connection)

Called when a connection expires (e.g., timeout).

Definition at line 1160 of file ctaps.h.

◆ path_change

void(* ct_connection_callbacks_t::path_change) (ct_connection_t *connection)

Called when the connection's network path changes, local or remote.

Definition at line 1163 of file ctaps.h.

◆ per_connection_context

void* ct_connection_callbacks_t::per_connection_context

User-provided context for the connection lifetime.

Per connection context accessible whenever a given connection is passed to a callback.

Can be fetched with ct_connection_get_callback_context(connection)

void count_number_of_received_messages(ct_connection_t* connection,
ct_message_t* received_message,
ct_message_context_t* message_context) {
my_custom_struct* recv_ctx = ct_connection_get_callback_context(connection);
recv_ctx->num_received_messages++;
}
void * ct_connection_get_callback_context(const ct_connection_t *connection)
Get the connection's callback 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 1196 of file ctaps.h.

◆ ready

void(* ct_connection_callbacks_t::ready) (ct_connection_t *connection)

Called when connection is established and ready for data transfer.

Definition at line 1166 of file ctaps.h.

◆ send_error

void(* ct_connection_callbacks_t::send_error) (ct_connection_t *connection, ct_message_context_t *message_context, int reason_code)

Called when a message send operation fails.

Definition at line 1172 of file ctaps.h.

◆ sent

void(* ct_connection_callbacks_t::sent) (ct_connection_t *connection, ct_message_context_t *message_context)

Called when a message is passed to the transport protocol.

Definition at line 1176 of file ctaps.h.

◆ soft_error

void(* ct_connection_callbacks_t::soft_error) (ct_connection_t *connection)

Called when a non-fatal error occurs (e.g., congestion).

Definition at line 1179 of file ctaps.h.


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