145#ifndef IMQUIC_IMQUIC_H
146#define IMQUIC_IMQUIC_H
375 uint8_t *bytes, uint64_t offset, uint64_t length, gboolean complete));
423 uint8_t *bytes, uint64_t offset, uint64_t length, gboolean complete);
466void imquic_stream_id_parse(uint64_t stream_id, uint64_t *
id, gboolean *client_initiated, gboolean *bidirectional);
void imquic_set_stream_incoming_cb(imquic_endpoint *endpoint, void(*stream_incoming)(imquic_connection *conn, uint64_t stream_id, uint8_t *bytes, uint64_t offset, uint64_t length, gboolean complete))
Configure the callback function to be notified about incoming STREAM data on an existing connection h...
Definition imquic.c:363
uint64_t imquic_uint64_random(void)
Helper to generate random 64 bit unsigned integers.
Definition imquic.c:461
const char * imquic_get_build_time(void)
Get info on when this shared object was built.
Definition imquic.c:108
const char * imquic_get_connection_alpn(imquic_connection *conn)
Helper function to get the ALPN of a connection.
Definition imquic.c:414
int imquic_init(const char *secrets_log)
Initialize the imquic library.
Definition imquic.c:40
const char * imquic_get_version_string_full(void)
Get the current version of the library, including release type, as a string.
Definition imquic.c:105
int imquic_send_on_stream(imquic_connection *conn, uint64_t stream_id, uint8_t *bytes, uint64_t offset, uint64_t length, gboolean complete)
Helper method to send data on a QUIC STREAM.
Definition imquic.c:398
void imquic_connection_unref(imquic_connection *conn)
Decrease a reference to a imquic_connection instance.
Definition imquic.c:437
void imquic_set_connection_gone_cb(imquic_endpoint *endpoint, void(*connection_gone)(imquic_connection *conn))
Configure the callback function to be notified when an existing connection handled by this endpoint h...
Definition imquic.c:386
int imquic_get_version_minor(void)
Get the current minor version of the library as a number.
Definition imquic.c:93
void imquic_stream_id_parse(uint64_t stream_id, uint64_t *id, gboolean *client_initiated, gboolean *bidirectional)
Parse a QUIC stream ID to its actual ID and its other properties.
Definition imquic.c:443
void imquic_start_endpoint(imquic_endpoint *endpoint)
Start a QUIC stack previously created with imquic_create_server or imquic_create_client....
Definition imquic.c:329
void imquic_set_lock_debugging(gboolean enabled)
Enable or disable lock/mutex debugging.
Definition imquic.c:128
const char * imquic_get_endpoint_name(imquic_endpoint *endpoint)
Helper function to get the endpoint name of a local client or server.
Definition imquic.c:309
uint32_t imquic_get_version(void)
Get the current version of the library as a number.
Definition imquic.c:84
int imquic_get_version_major(void)
Get the current major version of the library as a number.
Definition imquic.c:90
const char * imquic_get_build_sha(void)
Get info on the git commit was compiled in this build.
Definition imquic.c:111
imquic_client * imquic_create_client(const char *name,...)
Method to create a new QUIC client, using variable arguments to dictate what the client should do (e....
Definition imquic.c:244
const char * imquic_get_endpoint_alpn(imquic_endpoint *endpoint)
Helper function to get the ALPN a local client or server is configured to negotiate.
Definition imquic.c:317
const char * imquic_get_version_release(void)
Get the current release type of the library as a string.
Definition imquic.c:99
imquic_server * imquic_create_server(const char *name,...)
Method to create a new QUIC server, using variable arguments to dictate what the server should do (e....
Definition imquic.c:174
void imquic_set_log_level(int level)
Set the log level for the library.
Definition imquic.c:116
void imquic_set_datagram_incoming_cb(imquic_endpoint *endpoint, void(*datagram_incoming)(imquic_connection *conn, uint8_t *bytes, uint64_t length))
Configure the callback function to be notified about incoming DATAGRAM data on an existing connection...
Definition imquic.c:375
void imquic_close_connection(imquic_connection *conn, uint64_t error, const char *reason)
Helper method to close a QUIC connection.
Definition imquic.c:426
uint16_t imquic_get_endpoint_port(imquic_endpoint *endpoint)
Helper function to get the local port a client or server is bound to.
Definition imquic.c:325
uint64_t imquic_stream_id_build(uint64_t id, gboolean client_initiated, gboolean bidirectional)
Build a QUIC stream ID out of its actual ID and its other properties.
Definition imquic.c:447
int imquic_send_on_datagram(imquic_connection *conn, uint8_t *bytes, uint64_t length)
Helper method to send data on a QUIC DATAGRAM.
Definition imquic.c:408
void imquic_set_new_connection_cb(imquic_endpoint *endpoint, void(*new_connection)(imquic_connection *conn, void *user_data))
Configure the callback function to be notified about new connections on the configured endpoint....
Definition imquic.c:352
gboolean imquic_is_endpoint_server(imquic_endpoint *endpoint)
Helper function to check whether a local endpoint is a server.
Definition imquic.c:313
const char * imquic_get_connection_name(imquic_connection *conn)
Helper function to get the display name of a connection.
Definition imquic.c:418
uint64_t * imquic_uint64_dup(uint64_t num)
Helper to generate an allocated copy of a uint64_t number.
Definition imquic.c:465
void imquic_shutdown_endpoint(imquic_endpoint *endpoint)
Shutdown a previously started QUIC endpoint (client or server) In case of a server,...
Definition imquic.c:343
void imquic_set_refcount_debugging(gboolean enabled)
Enable or disable debugging of reference counters.
Definition imquic.c:132
const char * imquic_get_endpoint_subprotocol(imquic_endpoint *endpoint)
Helper function to get the WebTransport protocol a local client or server is configured to negotiate.
Definition imquic.c:321
int imquic_new_stream_id(imquic_connection *conn, gboolean bidirectional, uint64_t *stream_id)
Helper method to ask for the next usable locally originated stream ID on this connection.
Definition imquic.c:422
uint8_t imquic_varint_write(uint64_t number, uint8_t *bytes, size_t blen)
Write a variable size integer to a buffer.
Definition imquic.c:456
const char * imquic_get_version_string(void)
Get the current version of the library as a string.
Definition imquic.c:102
void imquic_deinit(void)
Uninitialize the imquic library.
Definition imquic.c:60
imquic_config
Configuration properties when creating servers/clients.
Definition imquic.h:224
@ IMQUIC_CONFIG_SNI
SNI to use, for clients (string)
Definition imquic.h:246
@ IMQUIC_CONFIG_WEBTRANSPORT
Whether WebTransport should be offered (boolean)
Definition imquic.h:252
@ IMQUIC_CONFIG_REMOTE_HOST
Remote host to connect to (string, clients only)
Definition imquic.h:232
@ IMQUIC_CONFIG_RAW_QUIC
Whether raw QUIC should be offered (boolean)
Definition imquic.h:250
@ IMQUIC_CONFIG_TLS_KEY
TLS certificate key to use, if any (file path)
Definition imquic.h:238
@ IMQUIC_CONFIG_USER_DATA
Generic user data, if any (void pointer)
Definition imquic.h:258
@ IMQUIC_CONFIG_TICKET_FILE
If early data is supported, path to file to write/read the session ticket to/from (client only)
Definition imquic.h:244
@ IMQUIC_CONFIG_REMOTE_PORT
Remote host to connect to (clients only)
Definition imquic.h:234
@ IMQUIC_CONFIG_SUBPROTOCOL
Subprotocol to negotiate on the main ALPN, if any (string)
Definition imquic.h:256
@ IMQUIC_CONFIG_TLS_CERT
TLS certificate to use, if any (file path)
Definition imquic.h:236
@ IMQUIC_CONFIG_ALPN
ALPN to negotiate (string, raw QUIC only)
Definition imquic.h:248
@ IMQUIC_CONFIG_HTTP3_PATH
For WebTransport, path to respond to (defaults to "/")
Definition imquic.h:254
@ IMQUIC_CONFIG_TLS_PASSWORD
TLS certificate password to use, if any (string)
Definition imquic.h:240
@ IMQUIC_CONFIG_EARLY_DATA
Whether early data should be supported (boolean)
Definition imquic.h:242
@ IMQUIC_CONFIG_DONE
Must be the last property, followed by NULL.
Definition imquic.h:260
@ IMQUIC_CONFIG_LOCAL_BIND
Local IP address to bind to (default=all interfaces)
Definition imquic.h:228
@ IMQUIC_CONFIG_LOCAL_PORT
Local port to bind to (0=random)
Definition imquic.h:230
@ IMQUIC_CONFIG_INIT
Must be the first property (no arguments)
Definition imquic.h:226
const char * imquic_config_str(imquic_config type)
Helper function to serialize to string the name of a imquic_config property.
Definition imquic.c:137
int imquic_get_version_patch(void)
Get the current patch version of the library as a number.
Definition imquic.c:96
uint64_t imquic_varint_read(uint8_t *bytes, size_t blen, uint8_t *length)
Read a variable size integer from a buffer.
Definition imquic.c:452
void imquic_connection_ref(imquic_connection *conn)
Increase a reference to a imquic_connection instance.
Definition imquic.c:432
QUIC Connection.
Definition connection.h:101
Abstraction of a network endpoint (client or server)
Definition network.h:43
void(* stream_incoming)(imquic_connection *conn, uint64_t stream_id, uint8_t *bytes, uint64_t offset, 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:79
char * name
Name of this endpoint.
Definition network.h:47
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:82
void(* new_connection)(imquic_connection *conn, void *user_data)
Callback to invoke when a new connection is available on this endpoint.
Definition network.h:77
void(* connection_gone)(imquic_connection *conn)
Callback to invoke when new one of the connections handled by this endpoint is closed.
Definition network.h:84
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:88