Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
quic.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_NET_QUIC_H_
14#define ZEPHYR_INCLUDE_NET_QUIC_H_
15
28
29#include <zephyr/types.h>
30#include <stddef.h>
31#include <stdbool.h>
32#include <zephyr/net/net_ip.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
71
93
99
105
107#define ZSOCK_SOL_QUIC 284
108
110enum {
113
123
133
136
151
160
176
185};
186
188#define QUIC_SESSION_STATE_VERSION 2U
189
191#define QUIC_MAX_SESSION_TICKET_LEN 256U
192
194#define QUIC_MAX_RESUMPTION_PSK_LEN 48U
195
223
258
275int quic_connection_open(const struct net_sockaddr *remote_addr,
276 const struct net_sockaddr *local_addr);
277
289
304int quic_stream_open(int connection_sock,
305 enum quic_stream_initiator initiator,
306 enum quic_stream_direction direction,
307 uint8_t priority);
308
319int quic_stream_close(int sock);
320
329
338
347int quic_stream_get_id(int sock, uint64_t *stream_id);
348
349
350#ifdef __cplusplus
351}
352#endif
353
357
358#endif /* ZEPHYR_INCLUDE_NET_QUIC_H_ */
bool quic_is_connection_socket(int sock)
Checks if the given socket is a QUIC connection socket.
quic_stream_direction
Stream direction.
Definition quic.h:95
int quic_stream_open(int connection_sock, enum quic_stream_initiator initiator, enum quic_stream_direction direction, uint8_t priority)
Creates a new QUIC stream socket within an established QUIC connection.
bool quic_is_stream_socket(int sock)
Checks if the given socket is a QUIC stream socket.
int quic_stream_get_id(int sock, uint64_t *stream_id)
Return the stream id associated with the given QUIC stream socket.
#define QUIC_MAX_RESUMPTION_PSK_LEN
Maximum resumable PSK length exported through struct quic_session_state.
Definition quic.h:194
quic_stream_initiator
Stream initiator.
Definition quic.h:101
#define QUIC_MAX_SESSION_TICKET_LEN
Maximum serialized ticket length exported through struct quic_session_state.
Definition quic.h:191
int quic_connection_open(const struct net_sockaddr *remote_addr, const struct net_sockaddr *local_addr)
Creates a new QUIC connection socket.
int quic_connection_close(int sock)
Closes the QUIC socket.
int quic_stream_close(int sock)
Closes the QUIC stream socket.
@ ZSOCK_QUIC_SO_SESSION_TICKET_ENABLE
Enable or disable server-side session ticket issuance.
Definition quic.h:159
@ ZSOCK_QUIC_SO_STOP_SENDING_CODE
Set the error code to use when sending STOP_SENDING frame on stream close.
Definition quic.h:135
@ ZSOCK_QUIC_SO_STREAM_TYPE
Get stream type (returns combination of direction | initiator bits).
Definition quic.h:112
@ ZSOCK_QUIC_SO_MAX_EARLY_DATA_SIZE
Enable 0-RTT early data on tickets this server issues.
Definition quic.h:175
@ ZSOCK_QUIC_SO_CERT_CHAIN_DEL
Delete an intermediate certificate from the certificate chain.
Definition quic.h:132
@ ZSOCK_QUIC_SO_CERT_CHAIN_ADD
Add an intermediate certificate to the certificate chain.
Definition quic.h:122
@ ZSOCK_QUIC_SO_SESSION_STATE
Export or import resumable client session state.
Definition quic.h:150
@ ZSOCK_QUIC_SO_STREAM_EARLY_DATA
Query whether a QUIC stream has received accepted 0-RTT data.
Definition quic.h:184
@ QUIC_STREAM_UNIDIRECTIONAL
Unidirectional stream.
Definition quic.h:97
@ QUIC_STREAM_BIDIRECTIONAL
Bidirectional stream.
Definition quic.h:96
@ QUIC_STREAM_CLIENT
Client initiated stream.
Definition quic.h:102
@ QUIC_STREAM_SERVER
Server initiated stream.
Definition quic.h:103
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Generic sockaddr struct.
Definition net_ip.h:455
Quic global statistics.
Definition quic.h:73
uint32_t streams_closed
Total number of streams closed.
Definition quic.h:83
uint32_t connection_close_failed
Total number of connection close failures.
Definition quic.h:89
uint32_t stream_close_failed
Total number of stream close failures.
Definition quic.h:91
uint32_t connections_closed
Total number of connections closed.
Definition quic.h:79
uint32_t stream_open_failed
Total number of stream open failures.
Definition quic.h:87
uint32_t connection_open_failed
Total number of connection open failures.
Definition quic.h:85
uint32_t connections_opened
Total number of connections opened.
Definition quic.h:77
uint32_t streams_opened
Total number of streams opened.
Definition quic.h:81
uint32_t packets_rx
Number of any (valid or invalid) packets received.
Definition quic.h:75
Quic statistics.
Definition quic.h:39
uint32_t handshake_init_rx
Number of handshake init packets received.
Definition quic.h:41
uint32_t decrypt_failed
Number of decrypt failed errors.
Definition quic.h:59
uint32_t drop_tx
Number of dropped TX packets.
Definition quic.h:63
uint32_t invalid_packet_len
Number of invalid packet length errors.
Definition quic.h:57
uint32_t drop_rx
Number of dropped RX packets.
Definition quic.h:61
uint32_t alloc_failed
Number of allocation failures.
Definition quic.h:65
uint32_t valid_rx
Number of valid packets received.
Definition quic.h:67
uint32_t invalid_packet
Number of invalid packets.
Definition quic.h:53
uint32_t handshake_resp_rx
Number of handshake response packets received.
Definition quic.h:45
uint32_t peer_not_found
Number of peer not found errors.
Definition quic.h:51
uint32_t invalid_key
Number of invalid key errors.
Definition quic.h:55
uint32_t handshake_init_tx
Number of handshake init packets sent.
Definition quic.h:43
uint32_t valid_tx
Number of valid packets sent.
Definition quic.h:69
uint32_t handshake_resp_tx
Number of handshake response packets sent.
Definition quic.h:47
uint32_t invalid_handshake
Number of invalid handshake errors.
Definition quic.h:49
Resumable QUIC client session state.
Definition quic.h:230
uint8_t psk[48U]
Derived resumption PSK used for the next resumed handshake.
Definition quic.h:254
uint8_t ticket[256U]
Opaque ticket identity from NewSessionTicket.
Definition quic.h:252
uint32_t max_early_data_size
Early-data allowance from NewSessionTicket: 0 when 0-RTT is not permitted, otherwise the RFC 9001 4....
Definition quic.h:244
struct quic_session_transport_params transport_params
Remembered peer transport parameters associated with the ticket.
Definition quic.h:256
uint32_t ticket_age_add
Random ticket_age_add value from NewSessionTicket.
Definition quic.h:238
uint16_t ticket_len
Length of the opaque ticket identity.
Definition quic.h:248
uint16_t version
Structure format version, must be QUIC_SESSION_STATE_VERSION.
Definition quic.h:232
uint16_t cipher_suite
TLS 1.3 cipher suite associated with the resumable state.
Definition quic.h:234
uint32_t ticket_lifetime
Ticket lifetime in seconds from NewSessionTicket.
Definition quic.h:236
uint64_t issue_time_ms
Local monotonic timestamp in milliseconds when the ticket was received.
Definition quic.h:246
uint16_t psk_len
Length of the derived resumption PSK.
Definition quic.h:250
Remembered peer transport parameters for resumption.
Definition quic.h:203
uint64_t initial_max_stream_data_uni
Remembered initial_max_stream_data_uni.
Definition quic.h:213
uint64_t initial_max_stream_data_bidi_remote
Remembered initial_max_stream_data_bidi_remote.
Definition quic.h:211
uint64_t initial_max_streams_uni
Remembered initial_max_streams_uni.
Definition quic.h:217
bool valid
True when the remembered transport-parameter snapshot is present.
Definition quic.h:205
uint64_t initial_max_streams_bidi
Remembered initial_max_streams_bidi.
Definition quic.h:215
uint64_t max_idle_timeout
Remembered max_idle_timeout in milliseconds.
Definition quic.h:219
uint64_t initial_max_stream_data_bidi_local
Remembered initial_max_stream_data_bidi_local.
Definition quic.h:209
uint16_t max_udp_payload_size
Remembered max_udp_payload_size.
Definition quic.h:221
uint64_t initial_max_data
Remembered initial_max_data.
Definition quic.h:207