Loading...
Searching...
No Matches
Functions
http3.c File Reference

HTTP/3 stack (WebTransport only) More...

#include <stddef.h>
#include <stdint.h>
#include "internal/http3.h"
#include "internal/quic.h"
#include "internal/utils.h"
#include "internal/version.h"
#include "imquic/debug.h"
Include dependency graph for http3.c:

Functions

const char * imquic_http3_stream_type_str (imquic_http3_stream_type type)
 Helper function to serialize to string the name of a imquic_http3_stream_type value.
 
const char * imquic_http3_frame_type_str (imquic_http3_frame_type type)
 Helper function to serialize to string the name of a imquic_http3_frame_type value.
 
const char * imquic_http3_settings_type_str (imquic_http3_settings_type type)
 Helper function to serialize to string the name of a imquic_http3_settings_type value.
 
imquic_http3_connectionimquic_http3_connection_create (imquic_connection *conn, char *subprotocol)
 Helper method to create a new HTTP/3 connection associated with a new QUIC core connection.
 
void imquic_http3_connection_destroy (imquic_http3_connection *h3c)
 Helper method to destroy an existing HTTP/3 connection associated with a QUIC core connection.
 
int imquic_http3_parse_settings (imquic_http3_connection *h3c, uint8_t *bytes, size_t blen)
 
size_t imquic_http3_settings_add_int (uint8_t *bytes, size_t blen, imquic_http3_settings_type type, uint64_t number)
 Helper to add a new SETTINGS property to a buffer.
 
const char * imquic_http3_error_code_str (imquic_http3_error_code type)
 Helper function to serialize to string the name of a imquic_http3_error_code value.
 
void imquic_http3_process_stream_data (imquic_connection *conn, imquic_stream *stream, imquic_buffer_chunk *chunk, gboolean new_stream)
 Callback invoked by the core when there's incoming STREAM data to process on an existing connection.
 
int imquic_http3_parse_request (imquic_http3_connection *h3c, imquic_stream *stream, uint8_t *bytes, size_t blen)
 
size_t imquic_http3_parse_request_headers (imquic_http3_connection *h3c, imquic_stream *stream, uint8_t *bytes, size_t blen)
 
size_t imquic_http3_parse_request_data (imquic_http3_connection *h3c, imquic_stream *stream, uint8_t *bytes, size_t blen)
 
int imquic_http3_prepare_headers_request (imquic_http3_connection *h3c, uint8_t *es, size_t *es_len, uint8_t *rs, size_t *rs_len)
 Helper to prepare a new HTTP/3 request.
 
int imquic_http3_prepare_headers_response (imquic_http3_connection *h3c, uint8_t *es, size_t *es_len, uint8_t *rs, size_t *rs_len)
 Helper to prepare a new HTTP/3 response.
 
void imquic_http3_check_send_connect (imquic_http3_connection *h3c)
 Helper to send a new HTTP/3 CONNECT request to establish a WebTransport session.
 
int imquic_http3_prepare_settings (imquic_http3_connection *h3c)
 Helper to prepare a new SETTINGS frame.
 

Detailed Description

HTTP/3 stack (WebTransport only)

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation of the required set of features need to establish a WebTransport connection, when needed. It explicitly only deals with WebTransport, meaning it will fail with anything else that is not a CONNECT request.

Function Documentation

◆ imquic_http3_check_send_connect()

void imquic_http3_check_send_connect ( imquic_http3_connection * h3c)

Helper to send a new HTTP/3 CONNECT request to establish a WebTransport session.

Parameters
h3cThe imquic_http3_connection instance to send the CONNECT on

◆ imquic_http3_connection_create()

imquic_http3_connection * imquic_http3_connection_create ( imquic_connection * conn,
char * subprotocol )

Helper method to create a new HTTP/3 connection associated with a new QUIC core connection.

Parameters
connThe QUIC core connection to associate this HTTP/3 instance to
subprotocolThe subprotocol to negotiate on WebTransport, if any (currently unused)
Returns
A pointer to a new imquic_http3_connection instance, if successful, or NULL otherwise

◆ imquic_http3_connection_destroy()

void imquic_http3_connection_destroy ( imquic_http3_connection * h3c)

Helper method to destroy an existing HTTP/3 connection associated with a QUIC core connection.

Parameters
h3cThe imquic_http3_connection to destroy

◆ imquic_http3_error_code_str()

const char * imquic_http3_error_code_str ( imquic_http3_error_code type)

Helper function to serialize to string the name of a imquic_http3_error_code value.

Parameters
typeThe imquic_http3_error_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_http3_frame_type_str()

const char * imquic_http3_frame_type_str ( imquic_http3_frame_type type)

Helper function to serialize to string the name of a imquic_http3_frame_type value.

Parameters
typeThe imquic_http3_frame_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_http3_parse_request()

int imquic_http3_parse_request ( imquic_http3_connection * h3c,
imquic_stream * stream,
uint8_t * bytes,
size_t blen )

brief Helper method to parse an incoming HTTP/3 request

Parameters
h3cThe imquic_http3_connection instance to parse the request for
streamThe imquic_stream instance in the connection the data has been received on
bytesData to process
blenSize of the data to process
Returns
0 in case of success, a negative integer otherwise

◆ imquic_http3_parse_request_data()

size_t imquic_http3_parse_request_data ( imquic_http3_connection * h3c,
imquic_stream * stream,
uint8_t * bytes,
size_t blen )

brief Helper method to parse a DATA frame in an HTTP/3 message

Parameters
h3cThe imquic_http3_connection instance to parse the DATA for
streamThe imquic_stream instance in the connection the data has been received on
bytesData to process
blenSize of the data to process
Returns
The number of processed bytes, if successful, or 0 otherwise

◆ imquic_http3_parse_request_headers()

size_t imquic_http3_parse_request_headers ( imquic_http3_connection * h3c,
imquic_stream * stream,
uint8_t * bytes,
size_t blen )

brief Helper method to parse a HEADERS frame in an HTTP/3 message

Parameters
h3cThe imquic_http3_connection instance to parse the HEADERS for
streamThe imquic_stream instance in the connection the data has been received on
bytesData to process
blenSize of the data to process
Returns
The number of processed bytes, if successful, or 0 otherwise

◆ imquic_http3_parse_settings()

int imquic_http3_parse_settings ( imquic_http3_connection * h3c,
uint8_t * bytes,
size_t blen )

brief Helper method to parse an incoming SETTINGS frame

Parameters
h3cThe imquic_http3_connection instance to parse the SETTINGS for
bytesData to process
blenSize of the data to process
Returns
0 in case of success, a negative integer otherwise

◆ imquic_http3_prepare_headers_request()

int imquic_http3_prepare_headers_request ( imquic_http3_connection * h3c,
uint8_t * es,
size_t * es_len,
uint8_t * rs,
size_t * rs_len )

Helper to prepare a new HTTP/3 request.

Parameters
h3cThe imquic_http3_connection instance to prepare the request for
esBuffer to use for the QPACK encoder stream, if needed
es_lenSize of the encoder stream buffer
rsBuffer to use for the HTTP/3 request
rs_lenSize of the request buffer
Returns
0 in case of success, a negative integer otherwise

◆ imquic_http3_prepare_headers_response()

int imquic_http3_prepare_headers_response ( imquic_http3_connection * h3c,
uint8_t * es,
size_t * es_len,
uint8_t * rs,
size_t * rs_len )

Helper to prepare a new HTTP/3 response.

Parameters
h3cThe imquic_http3_connection instance to prepare the response for
esBuffer to use for the QPACK encoder stream, if needed
es_lenSize of the encoder stream buffer
rsBuffer to use for the HTTP/3 request
rs_lenSize of the request buffer
Returns
0 in case of success, a negative integer otherwise

◆ imquic_http3_prepare_settings()

int imquic_http3_prepare_settings ( imquic_http3_connection * h3c)

Helper to prepare a new SETTINGS frame.

Parameters
h3cThe imquic_http3_connection instance to prepare the SETTINGS frame for
Returns
0 in case of success, a negative integer otherwise

◆ imquic_http3_process_stream_data()

void imquic_http3_process_stream_data ( imquic_connection * conn,
imquic_stream * stream,
imquic_buffer_chunk * chunk,
gboolean new_stream )

Callback invoked by the core when there's incoming STREAM data to process on an existing connection.

Parameters
connThe imquic_connection instance the data has been received on
streamThe imquic_stream instance in the connection the data has been received on
chunkThe imquic_buffer_chunk instance containing the new data
new_streamWhether this data opened a new stream

◆ imquic_http3_settings_add_int()

size_t imquic_http3_settings_add_int ( uint8_t * bytes,
size_t blen,
imquic_http3_settings_type type,
uint64_t number )

Helper to add a new SETTINGS property to a buffer.

Parameters
bytesBuffer to add the property to
blenSize of the buffer
typeThe imquic_http3_settings_type type to add to the frame
numberThe numeric value of the property to add
Returns
0 in case of success, a negative integer otherwise

◆ imquic_http3_settings_type_str()

const char * imquic_http3_settings_type_str ( imquic_http3_settings_type type)

Helper function to serialize to string the name of a imquic_http3_settings_type value.

Parameters
typeThe imquic_http3_settings_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_http3_stream_type_str()

const char * imquic_http3_stream_type_str ( imquic_http3_stream_type type)

Helper function to serialize to string the name of a imquic_http3_stream_type value.

Parameters
typeThe imquic_http3_stream_type value
Returns
The type name as a string, if valid, or NULL otherwise