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

Callback functions for listener events. More...

#include <ctaps.h>

Data Fields

void(* listener_ready )(ct_listener_t *listener)
 
void(* connection_received )(ct_listener_t *listener, ct_connection_t *new_conn)
 Called when a new connection is received.
 
void(* establishment_error )(ct_listener_t *listener, int error_code)
 Called when connection establishment fails for an incoming connection.
 
void(* listener_closed )(ct_listener_t *listener)
 Called when the listener has been closed and will accept no more connections.
 
void * per_listener_context
 

Detailed Description

Callback functions for listener events.

Set these callbacks via ct_preconnection_listen().

Definition at line 1205 of file ctaps.h.

Field Documentation

◆ connection_received

void(* ct_listener_callbacks_t::connection_received) (ct_listener_t *listener, ct_connection_t *new_conn)

Called when a new connection is received.

Definition at line 1216 of file ctaps.h.

◆ establishment_error

void(* ct_listener_callbacks_t::establishment_error) (ct_listener_t *listener, int error_code)

Called when connection establishment fails for an incoming connection.

Parameters
[in]listenerThe listener which failed, or NULL if a listener could not be created
[in]reasonError code

Definition at line 1223 of file ctaps.h.

◆ listener_closed

void(* ct_listener_callbacks_t::listener_closed) (ct_listener_t *listener)

Called when the listener has been closed and will accept no more connections.

Definition at line 1226 of file ctaps.h.

◆ listener_ready

void(* ct_listener_callbacks_t::listener_ready) (ct_listener_t *listener)

Definition at line 1213 of file ctaps.h.

◆ per_listener_context

void* ct_listener_callbacks_t::per_listener_context

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

Can be fetched with ct_listener_get_callback_context(listener)

void count_num_received_connections(ct_listener_t* listener,
ct_connection_t* new_connection) {
my_custom_struct* recv_ctx = ct_listener_get_callback_context(listener);
recv_ctx->num_received_messages++;
}
void * ct_listener_get_callback_context(const ct_listener_t *listener)
Get the callback context associated with a listener.
Opaque handle representing a connection.
Opaque handle representing a listener.

Definition at line 1244 of file ctaps.h.


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