14#ifndef IMQUIC_NETWORK_H
15#define IMQUIC_NETWORK_H
18#include <sys/socket.h>
36 struct sockaddr_storage
addr;
92 uint8_t *bytes, uint64_t length, gboolean complete);
QUIC cryptographic utilities (headers)
imquic public interface (headers)
Media Over QUIC (MoQ) stack (headers)
RTP Over QUIC (RoQ) stack (headers)
GMutex imquic_mutex
imquic mutex implementation
Definition mutex.h:18
char * imquic_network_address_str(imquic_network_address *address, char *output, size_t outlen, gboolean add_port)
Helper to serialize a network address to a string.
Definition network.c:58
void imquic_network_endpoint_remove_connection(imquic_network_endpoint *ne, imquic_connection *conn, gboolean lock_mutex)
Helper to remove an existing connection from the list of connections originated by this endpoint.
Definition network.c:145
imquic_network_endpoint * imquic_network_endpoint_create(imquic_configuration *config)
Helper to create a new imquic_network_endpoint instance from a imquic_configuration object.
Definition network.c:190
void imquic_network_init(void)
Initialize the network stack at startup.
Definition network.c:35
uint16_t imquic_network_address_port(imquic_network_address *address)
Helper to return the port used by a network address.
Definition network.c:93
int imquic_network_send(imquic_connection *conn, uint8_t *bytes, size_t blen)
Helper to send data on a connection.
Definition network.c:488
void imquic_network_endpoint_shutdown(imquic_network_endpoint *ne)
Helper to shutdown an existing endpoint.
Definition network.c:161
void imquic_network_deinit(void)
Uninitialize the network stack.
Definition network.c:52
void imquic_network_endpoint_destroy(imquic_network_endpoint *ne)
Helper to destroy an existing endpoint instance.
Definition network.c:168
void imquic_network_endpoint_add_connection(imquic_network_endpoint *ne, imquic_connection *conn, gboolean lock_mutex)
Helper to add a new connection to the list of connections originated by this endpoint.
Definition network.c:134
Reference counter mechanism.
A client/server configuration.
Definition configuration.h:27
QUIC Connection.
Definition connection.h:114
MoQ public callbacks.
Definition internal/moq.h:1336
Abstraction of a network address.
Definition network.h:34
struct sockaddr_storage addr
Network address.
Definition network.h:36
socklen_t addrlen
Size of the network address.
Definition network.h:38
Abstraction of a network endpoint (client or server)
Definition network.h:53
void(* connection_failed)(void *user_data)
Callback to invoke when a client connection attempt fails.
Definition network.h:100
uint64_t protocol
(Sub-)Protocol this endpoint uses, in case imquic is handling a protocol natively
Definition network.h:104
union imquic_network_endpoint::@174160051024204156321124113115044216377074317140 callbacks
(Sub-)Protocol specific callbacks (at the time of writing, RoQ and MoQ only)
void(* reset_stream_incoming)(imquic_connection *conn, uint64_t stream_id, uint64_t error_code)
Callback to invoke when a RESET_STREAM arrives on one of the connections handled by this endpoint.
Definition network.h:96
gboolean qlog_sequential
Whether sequential JSON should be used for the QLOG file, instead of regular JSON.
Definition network.h:113
volatile gint started
Whether this connection has been started.
Definition network.h:123
uint16_t port
Local and remote ports.
Definition network.h:63
gboolean qlog_http3
Definition network.h:115
void(* stream_incoming)(imquic_connection *conn, uint64_t stream_id, uint8_t *bytes, uint64_t length, gboolean complete)
Callback to invoke when new STREAM data is available on one of the connections handled by this endpoi...
Definition network.h:91
imquic_moq_callbacks moq
Definition network.h:107
imquic_roq_callbacks roq
Definition network.h:108
uint64_t conns_num
Number of connections handled by this socket (may be more than one for servers)
Definition network.h:85
void * source
Definition network.h:55
imquic_tls * tls
TLS stack.
Definition network.h:69
imquic_mutex mutex
Mutex.
Definition network.h:121
gboolean raw_quic
Whether raw QUIC should be supported.
Definition network.h:73
GHashTable * connections
List of connections handled by this socket (may be more than one for servers)
Definition network.h:83
uint32_t moq_version
Definition network.h:119
char * qlog_path
Path to save QLOG files to, if needed/supported: a filename for clients, a folder for servers.
Definition network.h:111
gboolean qlog_quic_stream
Definition network.h:115
char * h3_path
For WebTransport clients, the path to CONNECT to (/ by default)
Definition network.h:79
imquic_network_address remote_address
Remote address of the peer (clients only)
Definition network.h:67
gboolean internal_callbacks
Whether this endpoint has internal generic callbacks (true for the native RoQ and MoQ stacks)
Definition network.h:87
char * name
Name of this endpoint.
Definition network.h:57
void(* datagram_incoming)(imquic_connection *conn, uint8_t *bytes, uint64_t length)
Callback to invoke when new DATAGRAM data is available on one of the connections handled by this endp...
Definition network.h:94
char * sni
SNI the client will use.
Definition network.h:71
void(* new_connection)(imquic_connection *conn, void *user_data)
Callback to invoke when a new connection is available on this endpoint.
Definition network.h:89
void(* connection_gone)(imquic_connection *conn)
Callback to invoke when new one of the connections handled by this endpoint is closed.
Definition network.h:98
void * user_data
User data to pass in the new_connection callback, to correlate a connection to the endpoint it's comi...
Definition network.h:102
gboolean qlog_quic
Whether QUIC and/or HTTP/3 and/or RoQ and/or MoQT events should be saved to QLOG, if supported.
Definition network.h:115
int fd
Socket.
Definition network.h:61
gboolean qlog_roq
Definition network.h:116
uint16_t remote_port
Definition network.h:63
gboolean webtransport
Whether WebTransport should be supported.
Definition network.h:77
volatile gint shutting
Whether this connection is being shut down.
Definition network.h:125
gboolean qlog_roq_packets
Definition network.h:116
imquic_network_address local_address
Local address.
Definition network.h:65
volatile gint destroyed
Whether this instance has been destroyed (reference counting)
Definition network.h:127
imquic_refcount ref
Reference counter.
Definition network.h:129
gboolean qlog_moq_messages
Definition network.h:117
char ** alpn
Array of ALPN this endpoint will negotiate, when using raw QUIC.
Definition network.h:75
char ** wt_protocols
In case WebTransport is used, array of protocols to negotiate.
Definition network.h:81
gboolean qlog_moq_objects
Definition network.h:117
gboolean qlog_moq
Definition network.h:117
gboolean is_server
Whether this is a client or a server.
Definition network.h:59
RoQ public callbacks.
Definition internal/roq.h:61
TLS context.
Definition crypto.h:47