Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
http3.h File Reference

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

#include <glib.h>
#include "../imquic/imquic.h"
#include "qpack.h"
#include "buffer.h"
#include "stream.h"
#include "refcount.h"
Include dependency graph for http3.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  imquic_http3_connection
 HTTP/3 connection abstraction. More...
 

Typedefs

typedef enum imquic_http3_stream_type imquic_http3_stream_type
 HTTP/3 stream type.
 
typedef enum imquic_http3_frame_type imquic_http3_frame_type
 HTTP/3 frame type.
 
typedef enum imquic_http3_settings_type imquic_http3_settings_type
 HTTP/3 SETTINGS type.
 
typedef enum imquic_http3_error_code imquic_http3_error_code
 HTTP/3 error codes.
 
typedef struct imquic_http3_connection imquic_http3_connection
 HTTP/3 connection abstraction.
 

Enumerations

enum  imquic_http3_stream_type { IMQUIC_HTTP3_CONTROL_STREAM = 0x00 , IMQUIC_HTTP3_PUSH_STREAM = 0x01 , IMQUIC_HTTP3_QPACK_ENCODER_STREAM = 0x02 , IMQUIC_HTTP3_QPACK_DECODER_STREAM = 0x03 }
 HTTP/3 stream type. More...
 
enum  imquic_http3_frame_type {
  IMQUIC_HTTP3_DATA = 0x00 , IMQUIC_HTTP3_HEADERS = 0x01 , IMQUIC_HTTP3_CANCEL_PUSH = 0x03 , IMQUIC_HTTP3_SETTINGS = 0x04 ,
  IMQUIC_HTTP3_PUSH_PROMISE = 0x05 , IMQUIC_HTTP3_GOAWAY = 0x07 , IMQUIC_HTTP3_MAX_PUSH_ID = 0x0d , IMQUIC_HTTP3_WEBTRANSPORT_UNI_STREAM = 0x54 ,
  IMQUIC_HTTP3_WEBTRANSPORT_STREAM = 0x41
}
 HTTP/3 frame type. More...
 
enum  imquic_http3_settings_type {
  IMQUIC_HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY = 0x01 , IMQUIC_HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE = 0x06 , IMQUIC_HTTP3_SETTINGS_QPACK_BLOCKED_STREAMS = 0x07 , IMQUIC_HTTP3_SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x08 ,
  IMQUIC_HTTP3_SETTINGS_H3_DATAGRAM = 0x33 , IMQUIC_HTTP3_SETTINGS_ENABLE_WEBTRANSPORT = 0x2b603742 , IMQUIC_HTTP3_SETTINGS_WEBTRANSPORT_MAX_SESSIONS = 0xc671706a
}
 HTTP/3 SETTINGS type. More...
 
enum  imquic_http3_error_code {
  IMQUIC_HTTP3_H3_DATAGRAM_ERROR = 0x33 , IMQUIC_HTTP3_H3_NO_ERROR = 0x0100 , IMQUIC_HTTP3_H3_GENERAL_PROTOCOL_ERROR = 0x0101 , IMQUIC_HTTP3_H3_INTERNAL_ERROR = 0x0102 ,
  IMQUIC_HTTP3_H3_STREAM_CREATION_ERROR = 0x0103 , IMQUIC_HTTP3_H3_CLOSED_CRITICAL_STREAM = 0x0104 , IMQUIC_HTTP3_H3_FRAME_UNEXPECTED = 0x0105 , IMQUIC_HTTP3_H3_FRAME_ERROR = 0x0106 ,
  IMQUIC_HTTP3_H3_EXCESSIVE_LOAD = 0x0107 , IMQUIC_HTTP3_H3_ID_ERROR = 0x0108 , IMQUIC_HTTP3_H3_SETTINGS_ERROR = 0x0109 , IMQUIC_HTTP3_H3_MISSING_SETTINGS = 0x010a ,
  IMQUIC_HTTP3_H3_REQUEST_REJECTED = 0x010b , IMQUIC_HTTP3_H3_REQUEST_CANCELLED = 0x010c , IMQUIC_HTTP3_H3_REQUEST_INCOMPLETE = 0x010d , IMQUIC_HTTP3_H3_MESSAGE_ERROR = 0x010e ,
  IMQUIC_HTTP3_H3_CONNECT_ERROR = 0x010f , IMQUIC_HTTP3_H3_VERSION_FALLBACK = 0x0110 , IMQUIC_HTTP3_QPACK_DECOMPRESSION_FAILED = 0x0200 , IMQUIC_HTTP3_QPACK_ENCODER_STREAM_ERROR = 0x0201 ,
  IMQUIC_HTTP3_QPACK_DECODER_STREAM_ERROR = 0x0202
}
 HTTP/3 error codes. More...
 

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.
 
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.
 
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.
 
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.
 
Parsing HTTP/3 messages
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_parse_settings (imquic_http3_connection *h3c, uint8_t *bytes, size_t blen)
 
Creating and sending HTTP/3 messages
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.
 
int imquic_http3_prepare_settings (imquic_http3_connection *h3c)
 Helper to prepare a new SETTINGS frame.
 
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.
 
void imquic_http3_check_send_connect (imquic_http3_connection *h3c)
 Helper to send a new HTTP/3 CONNECT request to establish a WebTransport session.
 

Detailed Description

HTTP/3 stack (WebTransport only) (headers)

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.

Typedef Documentation

◆ imquic_http3_connection

typedef struct imquic_http3_connection imquic_http3_connection

HTTP/3 connection abstraction.

◆ imquic_http3_error_code

HTTP/3 error codes.

◆ imquic_http3_frame_type

HTTP/3 frame type.

◆ imquic_http3_settings_type

HTTP/3 SETTINGS type.

◆ imquic_http3_stream_type

HTTP/3 stream type.

Enumeration Type Documentation

◆ imquic_http3_error_code

HTTP/3 error codes.

Enumerator
IMQUIC_HTTP3_H3_DATAGRAM_ERROR 

DATAGRAM_ERROR.

IMQUIC_HTTP3_H3_NO_ERROR 

NO_ERROR.

IMQUIC_HTTP3_H3_GENERAL_PROTOCOL_ERROR 

GENERAL_PROTOCOL_ERROR.

IMQUIC_HTTP3_H3_INTERNAL_ERROR 

IMQUIC_HTTP3_H3_INTERNAL_ERROR.

IMQUIC_HTTP3_H3_STREAM_CREATION_ERROR 

H3_STREAM_CREATION_ERROR.

IMQUIC_HTTP3_H3_CLOSED_CRITICAL_STREAM 

H3_CLOSED_CRITICAL_STREAM.

IMQUIC_HTTP3_H3_FRAME_UNEXPECTED 

H3_FRAME_UNEXPECTED.

IMQUIC_HTTP3_H3_FRAME_ERROR 

H3_FRAME_ERROR.

IMQUIC_HTTP3_H3_EXCESSIVE_LOAD 

H3_EXCESSIVE_LOAD.

IMQUIC_HTTP3_H3_ID_ERROR 

H3_ID_ERROR.

IMQUIC_HTTP3_H3_SETTINGS_ERROR 

H3_SETTINGS_ERROR.

IMQUIC_HTTP3_H3_MISSING_SETTINGS 

H3_MISSING_SETTINGS.

IMQUIC_HTTP3_H3_REQUEST_REJECTED 

H3_REQUEST_REJECTED.

IMQUIC_HTTP3_H3_REQUEST_CANCELLED 

H3_REQUEST_CANCELLED.

IMQUIC_HTTP3_H3_REQUEST_INCOMPLETE 

H3_REQUEST_INCOMPLETE.

IMQUIC_HTTP3_H3_MESSAGE_ERROR 

H3_MESSAGE_ERROR.

IMQUIC_HTTP3_H3_CONNECT_ERROR 

H3_CONNECT_ERROR.

IMQUIC_HTTP3_H3_VERSION_FALLBACK 

H3_VERSION_FALLBACK.

IMQUIC_HTTP3_QPACK_DECOMPRESSION_FAILED 

QPACK_DECOMPRESSION_FAILED.

IMQUIC_HTTP3_QPACK_ENCODER_STREAM_ERROR 

QPACK_ENCODER_STREAM_ERROR.

IMQUIC_HTTP3_QPACK_DECODER_STREAM_ERROR 

QPACK_DECODER_STREAM_ERROR.

◆ imquic_http3_frame_type

HTTP/3 frame type.

Enumerator
IMQUIC_HTTP3_DATA 

DATA.

IMQUIC_HTTP3_HEADERS 

HEADERS.

IMQUIC_HTTP3_CANCEL_PUSH 

CANCEL_PUSH.

IMQUIC_HTTP3_SETTINGS 

SETTINGS.

IMQUIC_HTTP3_PUSH_PROMISE 

PUSH_PROMISE.

IMQUIC_HTTP3_GOAWAY 

GOAWAY.

IMQUIC_HTTP3_MAX_PUSH_ID 

MAX_PUSH_ID.

IMQUIC_HTTP3_WEBTRANSPORT_UNI_STREAM 

WebTransport unidirectional stream.

IMQUIC_HTTP3_WEBTRANSPORT_STREAM 

WebTransport bidirectional stream.

◆ imquic_http3_settings_type

HTTP/3 SETTINGS type.

Enumerator
IMQUIC_HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY 

QPACK_MAX_TABLE_CAPACITY.

IMQUIC_HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE 

MAX_FIELD_SECTION_SIZE.

IMQUIC_HTTP3_SETTINGS_QPACK_BLOCKED_STREAMS 

QPACK_BLOCKED_STREAMS.

IMQUIC_HTTP3_SETTINGS_ENABLE_CONNECT_PROTOCOL 

ENABLE_CONNECT_PROTOCOL.

IMQUIC_HTTP3_SETTINGS_H3_DATAGRAM 

H3_DATAGRAM.

IMQUIC_HTTP3_SETTINGS_ENABLE_WEBTRANSPORT 

ENABLE_WEBTRANSPORT.

IMQUIC_HTTP3_SETTINGS_WEBTRANSPORT_MAX_SESSIONS 

WEBTRANSPORT_MAX_SESSIONS.

◆ imquic_http3_stream_type

HTTP/3 stream type.

Enumerator
IMQUIC_HTTP3_CONTROL_STREAM 

Control stream.

IMQUIC_HTTP3_PUSH_STREAM 

Push stream.

IMQUIC_HTTP3_QPACK_ENCODER_STREAM 

QPACK encoder stream.

IMQUIC_HTTP3_QPACK_DECODER_STREAM 

QPACK decoder stream.

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