Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
QUIC Library

QUIC library. More...

Data Structures

struct  net_stats_quic
 Quic statistics. More...
struct  net_stats_quic_global
 Quic global statistics. More...

Macros

#define ZSOCK_SOL_QUIC   284
 QUIC socket option level for getsockopt/setsockopt.

Enumerations

enum  quic_stream_direction { QUIC_STREAM_BIDIRECTIONAL = 0x00 , QUIC_STREAM_UNIDIRECTIONAL = 0x02 }
 Stream direction. More...
enum  quic_stream_initiator { QUIC_STREAM_CLIENT = 0x00 , QUIC_STREAM_SERVER = 0x01 }
 Stream initiator. More...
enum  { ZSOCK_QUIC_SO_STREAM_TYPE = 1 , ZSOCK_QUIC_SO_CERT_CHAIN_ADD = 2 , ZSOCK_QUIC_SO_CERT_CHAIN_DEL = 3 , ZSOCK_QUIC_SO_STOP_SENDING_CODE = 4 }
 QUIC socket options for use with getsockopt/setsockopt at ZSOCK_SOL_QUIC level. More...

Functions

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_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.
int quic_stream_close (int sock)
 Closes the QUIC stream socket.
bool quic_is_stream_socket (int sock)
 Checks if the given socket is a QUIC stream socket.
bool quic_is_connection_socket (int sock)
 Checks if the given socket is a QUIC connection socket.
int quic_stream_get_id (int sock, uint64_t *stream_id)
 Return the stream id associated with the given QUIC stream socket.

Detailed Description

QUIC library.

Since
4.5
Version
0.1.0
Note
Server mode sends Version Negotiation for unsupported versions and can enforce the RFC 9000 anti-amplification limit before peer address validation. Retry and NEW_TOKEN-based address-validation tokens are not yet implemented.

Macro Definition Documentation

◆ ZSOCK_SOL_QUIC

#define ZSOCK_SOL_QUIC   284

#include <zephyr/net/quic.h>

QUIC socket option level for getsockopt/setsockopt.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <zephyr/net/quic.h>

QUIC socket options for use with getsockopt/setsockopt at ZSOCK_SOL_QUIC level.

Enumerator
ZSOCK_QUIC_SO_STREAM_TYPE 

Get stream type (returns combination of direction | initiator bits).

ZSOCK_QUIC_SO_CERT_CHAIN_ADD 

Add an intermediate certificate to the certificate chain.

Option value is a pointer to a sec_tag_t referencing a credential previously registered via tls_credential_add() (with type TLS_CREDENTIAL_CA_CERTIFICATE or TLS_CREDENTIAL_PUBLIC_CERTIFICATE). Option length must be sizeof(sec_tag_t). Call multiple times to add multiple intermediate certificates.

ZSOCK_QUIC_SO_CERT_CHAIN_DEL 

Delete an intermediate certificate from the certificate chain.

Option value is a pointer to a sec_tag_t referencing a credential previously added by ZSOCK_QUIC_SO_CERT_CHAIN_ADD option. Option length must be sizeof(sec_tag_t) or set to 0. If set to 0, the option value can be omitted by setting it to NULL. If set to 0, all intermediate certificates are removed.

ZSOCK_QUIC_SO_STOP_SENDING_CODE 

Set the error code to use when sending STOP_SENDING frame on stream close.

◆ quic_stream_direction

#include <zephyr/net/quic.h>

Stream direction.

Enumerator
QUIC_STREAM_BIDIRECTIONAL 

Bidirectional stream.

QUIC_STREAM_UNIDIRECTIONAL 

Unidirectional stream.

◆ quic_stream_initiator

#include <zephyr/net/quic.h>

Stream initiator.

Enumerator
QUIC_STREAM_CLIENT 

Client initiated stream.

QUIC_STREAM_SERVER 

Server initiated stream.

Function Documentation

◆ quic_connection_close()

int quic_connection_close ( int sock)

#include <zephyr/net/quic.h>

Closes the QUIC socket.

Closes the connection and terminates the TLS session. Does the same thing as zsock_close for a connection socket.

Parameters
sockQUIC connection socket to close.
Returns
0 success, <0 on failure.

◆ quic_connection_open()

int quic_connection_open ( const struct net_sockaddr * remote_addr,
const struct net_sockaddr * local_addr )

#include <zephyr/net/quic.h>

Creates a new QUIC connection socket.

Creates a new QUIC connection context. This serves as a foundation for all subsequent communication.

Parameters
remote_addrRemote connection endpoint address. In client mode, this is the server address to connect to. In server mode, this is NULL or unspecified if binding a listener.
local_addrLocal connection endpoint address. In client mode, if set to NULL, the system will auto-bind the socket to an ephemeral port and select the local address. In server mode, this is the address to listen on.
Returns
New QUIC connection socket on success, <0 on failure.

◆ quic_is_connection_socket()

bool quic_is_connection_socket ( int sock)

#include <zephyr/net/quic.h>

Checks if the given socket is a QUIC connection socket.

Parameters
sockSocket to check.
Returns
true if the socket is a QUIC connection socket, false otherwise.

◆ quic_is_stream_socket()

bool quic_is_stream_socket ( int sock)

#include <zephyr/net/quic.h>

Checks if the given socket is a QUIC stream socket.

Parameters
sockSocket to check.
Returns
true if the socket is a QUIC stream socket, false otherwise.

◆ quic_stream_close()

int quic_stream_close ( int sock)

#include <zephyr/net/quic.h>

Closes the QUIC stream socket.

Parameters
sockQUIC stream socket to close.

Closes a specific stream without closing the underlying connection. Does the same thing as zsock_close for a stream socket.

Returns
0 success, <0 on failure.

◆ quic_stream_get_id()

int quic_stream_get_id ( int sock,
uint64_t * stream_id )

#include <zephyr/net/quic.h>

Return the stream id associated with the given QUIC stream socket.

Parameters
sockSocket to check.
stream_idPointer to store the stream id.
Returns
0 on success, <0 on failure.

◆ quic_stream_open()

int quic_stream_open ( int connection_sock,
enum quic_stream_initiator initiator,
enum quic_stream_direction direction,
uint8_t priority )

#include <zephyr/net/quic.h>

Creates a new QUIC stream socket within an established QUIC connection.

Parameters
connection_sockConnection to create the stream on. This is the socket id returned by quic_connection_open().
initiatorStream initiator (client or server). This is either QUIC_STREAM_CLIENT or QUIC_STREAM_SERVER.
directionStream direction (uni- or bidirectional). If set to QUIC_STREAM_BIDIRECTIONAL, then both sides can read/write. If set to QUIC_STREAM_UNIDIRECTIONAL, then only the initiator can write.
priorityPriority level (0-255) for scheduling stream data.
Returns
New QUIC stream socket on success, <0 on failure.