13#ifndef IMQUIC_CONNECTION_H
14#define IMQUIC_CONNECTION_H
281 uint8_t *bytes, uint64_t offset, uint64_t length, gboolean complete);
Buffer abstraction (headers)
void imquic_connection_notify_stream_incoming(imquic_connection *conn, imquic_stream *stream, uint8_t *data, uint64_t offset, uint64_t length)
Helper to notify incoming STREAM data to the application.
Definition connection.c:567
void imquic_connection_change_level(imquic_connection *conn, enum ssl_encryption_level_t level)
Helper to change the current encryption level of a connection.
Definition connection.c:224
struct imquic_connection_parameters imquic_connection_parameters
QUIC Transport parameters.
void imquic_connection_destroy(imquic_connection *conn)
Helper method to destroy an existing imquic_connection instance.
Definition connection.c:200
const char * imquic_connection_id_str(imquic_connection_id *cid, char *buffer, size_t blen)
Helper method to stringify a imquic_connection_id instance.
Definition connection.c:20
int imquic_connection_send_on_datagram(imquic_connection *conn, uint8_t *bytes, uint64_t length)
Helper method to send data on a QUIC DATAGRAM.
Definition connection.c:503
int imquic_connection_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 connection.c:524
struct imquic_connection_rtt imquic_connection_rtt
Round Trip Time (RTT) tracking.
GList * imquic_connection_detect_lost(imquic_connection *conn)
Helper method to detect lost packets.
Definition connection.c:426
void imquic_connection_update_rtt(imquic_connection *conn, int64_t sent_time, uint16_t ack_delay)
Helper method to update the RTT of a connection, when parsing ACKs.
Definition connection.c:243
gboolean imquic_connection_id_equal(const void *a, const void *b)
Helper method to check if two imquic_connection_id instances are actually the same Connection ID.
Definition connection.c:45
void imquic_connection_flush_stream(imquic_connection *conn, uint64_t stream_id)
Helper to flush a stream, in order to send data right away.
Definition connection.c:595
guint imquic_connection_id_hash(gconstpointer v)
Helper method to return a hash associated to a imquic_connection_id instance.
Definition connection.c:57
imquic_connection * imquic_connection_create(imquic_network_endpoint *socket)
Helper method to create a new imquic_connection instance owned by a specific imquic_network_endpoint ...
Definition connection.c:126
void imquic_connection_close(imquic_connection *conn, uint64_t error_code, uint64_t frame_type, const char *reason)
Helpers to close connections.
Definition connection.c:608
struct imquic_connection_id imquic_connection_id
QUIC Connection ID.
int imquic_connection_new_stream_id(imquic_connection *conn, gboolean bidirectional, uint64_t *stream_id)
Helper to generate a new stream ID for this connection.
Definition connection.c:470
void imquic_connection_parameters_init(imquic_connection_parameters *params)
Helper method to reset/initialize a imquic_connection_parameters instance.
Definition connection.c:67
gboolean imquic_connection_loss_detection_timeout(gpointer user_data)
Callback invoked when the loss detection timer fires.
Definition connection.c:357
void imquic_connection_notify_datagram_incoming(imquic_connection *conn, uint8_t *data, uint64_t length)
Helper to notify incoming DATAGRAM data to the application.
Definition connection.c:557
void imquic_connection_update_loss_timer(imquic_connection *conn)
Helper method to update the loss detection timer.
Definition connection.c:305
imquic_connection_id * imquic_connection_id_dup(imquic_connection_id *cid)
Helper method to duplicate (copy) a imquic_connection_id instance.
Definition connection.c:37
QUIC cryptographic utilities (headers)
QUIC errors definitions (headers)
HTTP/3 stack (WebTransport only) (headers)
Combined list and map utility (headers)
GMutex imquic_mutex
imquic mutex implementation
Definition mutex.h:18
Networking utilities (headers)
Reference counter mechanism.
QUIC STREAM abstraction (headers)
Buffer made of multiple chunks (possibly with gaps)
Definition buffer.h:35
QUIC Connection ID.
Definition connection.h:31
size_t len
Size of the Connection ID.
Definition connection.h:37
uint8_t token[16]
Stateless reset token (FIXME currently unused)
Definition connection.h:39
uint64_t seq
Sequence number (FIXME currently unused)
Definition connection.h:33
QUIC Transport parameters.
Definition connection.h:66
gboolean disable_active_migration
Definition connection.h:78
uint16_t max_datagram_frame_size
Definition connection.h:69
uint16_t max_ack_delay
Definition connection.h:77
uint8_t ack_delay_exponent
Definition connection.h:76
uint64_t initial_max_stream_data_uni
Definition connection.h:73
uint64_t initial_max_data
Definition connection.h:70
uint64_t initial_max_stream_data_bidi_local
Definition connection.h:71
uint64_t initial_max_streams_uni
Definition connection.h:75
uint64_t initial_max_streams_bidi
Definition connection.h:74
uint32_t max_idle_timeout
Definition connection.h:67
uint64_t initial_max_stream_data_bidi_remote
Definition connection.h:72
uint16_t active_connection_id_limit
Definition connection.h:79
uint16_t max_udp_payload_size
Definition connection.h:68
Round Trip Time (RTT) tracking.
Definition connection.h:87
uint16_t latest
Latest RTT, in milliseconds.
Definition connection.h:89
uint16_t smoothed
Smoothed RTT.
Definition connection.h:91
uint16_t min
Minimum RTT.
Definition connection.h:95
int64_t first_sample
Monotonic time of when we we obtained the first RTT sample.
Definition connection.h:97
uint16_t rttvar
RTT variation.
Definition connection.h:93
QUIC Connection.
Definition connection.h:101
GHashTable * streams_done
Definition connection.h:134
int64_t loss_time[4]
Monotonic time of when the next packet can be considered, lost, per each encryption level.
Definition connection.h:169
gboolean current_phase
Current value of the key phase bit.
Definition connection.h:179
imquic_data alpn
ALPN.
Definition connection.h:128
imquic_source * ld_timer
Loss detection timer.
Definition connection.h:198
gboolean connected
Whether this connection has been established.
Definition connection.h:190
gboolean alpn_negotiated
Whether an ALPN has been negotiated.
Definition connection.h:188
GList * connection_ids
List of Connection IDs our peer has used.
Definition connection.h:118
imquic_source * loop_source
Loop source.
Definition connection.h:206
size_t ack_eliciting_in_flight[4]
Number of ACK eliciting packets in flight, for each encryption level.
Definition connection.h:161
imquic_network_endpoint * socket
Networking instance for this connection.
Definition connection.h:192
imquic_listmap * sent_pkts[4]
Sent packets, per each encryption level.
Definition connection.h:171
imquic_network_address peer
Network address of the peer.
Definition connection.h:194
imquic_http3_connection * http3
WebTransport context, if any.
Definition connection.h:196
enum ssl_encryption_level_t level
Current encryption level.
Definition connection.h:120
gboolean max_streams_bidi_updated
Definition connection.h:141
imquic_connection_parameters local_params
Transport parameters (local and remote)
Definition connection.h:126
imquic_connection_id remote_cid
Definition connection.h:113
uint64_t stream_next_bidi
Definition connection.h:130
imquic_buffer * crypto_out[4]
Definition connection.h:184
uint64_t largest[4]
Largest received packet numbers, for each encryption level.
Definition connection.h:159
imquic_refcount ref
Reference counter.
Definition connection.h:212
uint64_t largest_acked[4]
Largest acked packet numbers, for each encryption level.
Definition connection.h:173
gboolean have_params
Whether we already received the peer QUIC transport parameters.
Definition connection.h:109
GHashTable * streams
Map of streams we're handling, and map of streams that are now done.
Definition connection.h:134
volatile gint wakeup
Trigger to wake the loop for this connection as part of the imquic_connection_source management.
Definition connection.h:151
imquic_connection_id new_remote_cid
New remote Connection ID.
Definition connection.h:116
imquic_protection keys[4]
Keys (protection, encryption) for each encryption level.
Definition connection.h:177
imquic_buffer * crypto_in[4]
Buffers for incoming and outgoing CRYPTO exchanges, at each encryption level.
Definition connection.h:184
uint64_t pkn[4]
Current outgoing packet number for each encryption level.
Definition connection.h:124
gboolean is_server
Whether this is a server or a client connection (inherited from the endpoint)
Definition connection.h:105
GQueue * outgoing_data
Queued data to send.
Definition connection.h:148
GList * recvd[4]
List of received packet numbers, for each encryption level.
Definition connection.h:157
gboolean max_streams_uni_updated
Whether our QUIC stack just updated the cap for the maximum number of unidirectional and bidirectiona...
Definition connection.h:141
int64_t largest_time[4]
Monotonic time of when we received the largest packet numbers, per each encryption level (for ACK del...
Definition connection.h:166
SSL * ssl
Encryption instance.
Definition connection.h:181
volatile gint destroyed
Whether this instance has been destroyed (reference counting)
Definition connection.h:210
uint64_t stream_next_uni
Next unidirectional and bidirectional stream we can create (as actual ID, not QUIC one)
Definition connection.h:130
imquic_data_fixed retry_token
Retry token, if any.
Definition connection.h:122
gboolean send_ack[5]
Whether we have ACKs to send for a specific encryption level.
Definition connection.h:175
gboolean send_crypto
Whether we have CRYPTO frames to send.
Definition connection.h:186
uint64_t current_max_streams_uni
Current cap for the maximum number of unidirectional and bidirectional streams we're prepared to acce...
Definition connection.h:137
char * name
Name of this connection (for logging purposes)
Definition connection.h:103
imquic_connection_id initial_cid
Initial Connection ID.
Definition connection.h:111
imquic_connection_parameters remote_params
Definition connection.h:126
gboolean just_started
Whether this connection has just started (e.g., to decide whether we need to derive initial secrets)
Definition connection.h:107
imquic_connection_id local_cid
Local and remote Connection ID.
Definition connection.h:113
GQueue * incoming_data
Queued streams to process.
Definition connection.h:143
GQueue * outgoing_datagram
Definition connection.h:148
int64_t last_ack_eliciting_time[4]
Monotonic time of when we sent the last ACK eliciting packet, for each encryption level.
Definition connection.h:163
imquic_connection_rtt rtt
Different RTTs for this connection.
Definition connection.h:153
imquic_mutex mutex
Mutex.
Definition connection.h:208
imquic_source * idle_timer
Idle timer.
Definition connection.h:202
int64_t last_activity
Monotonic time of when we last got activity.
Definition connection.h:200
uint8_t pto_count
PTO count.
Definition connection.h:204
uint64_t current_max_streams_bidi
Definition connection.h:137
Generic fixed size data buffer.
Definition utils.h:154
Generic data buffer.
Definition utils.h:133
HTTP/3 connection abstraction.
Definition http3.h:139
Utility that implements a list and a map at the same time.
Definition listmap.h:30
Abstraction of a network address.
Definition network.h:29
Abstraction of a network endpoint (client or server)
Definition network.h:43
Protection context in both directions for a specific encryption level in a QUIC connection.
Definition crypto.h:98
Event source base.
Definition loop.h:34
QUIC stream.
Definition stream.h:41
Generic utilities (headers)