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"
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_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. | |
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, imquic_stream *stream, 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. | |
void | imquic_http3_qlog_parameters_set (imquic_qlog *qlog, gboolean local, gboolean extended_connect, gboolean h3_datagram) |
Add a parameters_set event. | |
json_t * | imquic_qlog_http3_prepare_content (json_t *parent, const char *name, gboolean array) |
Helper to prepare a frame or an object/array, and add it to a parent if it's specified. | |
void | imquic_qlog_http3_append_object (json_t *parent, const char *name, const char *value) |
Helper to append a name/value object to an array. | |
void | imquic_http3_qlog_stream_type_set (imquic_qlog *qlog, gboolean local, uint64_t stream_id, const char *type) |
Add a stream_type_set . | |
void | imquic_http3_qlog_frame_created (imquic_qlog *qlog, uint64_t stream_id, uint64_t length, json_t *frame) |
Add a frame_created . | |
void | imquic_http3_qlog_frame_parsed (imquic_qlog *qlog, uint64_t stream_id, uint64_t length, json_t *frame) |
Add a frame_parsed . | |
HTTP/3 stack (WebTransport only)
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.
void imquic_http3_check_send_connect | ( | imquic_http3_connection * | h3c | ) |
Helper to send a new HTTP/3 CONNECT
request to establish a WebTransport session.
h3c | The imquic_http3_connection instance to send the CONNECT on |
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.
conn | The QUIC core connection to associate this HTTP/3 instance to |
subprotocol | The subprotocol to negotiate on WebTransport, if any (currently unused) |
void imquic_http3_connection_destroy | ( | imquic_http3_connection * | h3c | ) |
Helper method to destroy an existing HTTP/3 connection associated with a QUIC core connection.
h3c | The imquic_http3_connection to destroy |
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.
type | The imquic_http3_error_code 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.
type | The imquic_http3_frame_type value |
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
h3c | The imquic_http3_connection instance to parse the request for |
stream | The imquic_stream instance in the connection the data has been received on |
bytes | Data to process |
blen | Size of the data to process |
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
h3c | The imquic_http3_connection instance to parse the DATA for |
stream | The imquic_stream instance in the connection the data has been received on |
bytes | Data to process |
blen | Size of the data to process |
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
h3c | The imquic_http3_connection instance to parse the HEADERS for |
stream | The imquic_stream instance in the connection the data has been received on |
bytes | Data to process |
blen | Size of the data to process |
int imquic_http3_parse_settings | ( | imquic_http3_connection * | h3c, |
imquic_stream * | stream, | ||
uint8_t * | bytes, | ||
size_t | blen ) |
brief Helper method to parse an incoming SETTINGS
frame
h3c | The imquic_http3_connection instance to parse the SETTINGS for |
stream | The imquic_stream instance in the connection the data has been received on |
bytes | Data to process |
blen | Size of the data to process |
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.
h3c | The imquic_http3_connection instance to prepare the request for |
es | Buffer to use for the QPACK encoder stream, if needed |
es_len | Size of the encoder stream buffer |
rs | Buffer to use for the HTTP/3 request |
rs_len | Size of the request buffer |
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.
h3c | The imquic_http3_connection instance to prepare the response for |
es | Buffer to use for the QPACK encoder stream, if needed |
es_len | Size of the encoder stream buffer |
rs | Buffer to use for the HTTP/3 request |
rs_len | Size of the request buffer |
int imquic_http3_prepare_settings | ( | imquic_http3_connection * | h3c | ) |
Helper to prepare a new SETTINGS
frame.
h3c | The imquic_http3_connection instance to prepare the SETTINGS frame for |
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.
conn | The imquic_connection instance the data has been received on |
stream | The imquic_stream instance in the connection the data has been received on |
chunk | The imquic_buffer_chunk instance containing the new data |
new_stream | Whether this data opened a new stream |
void imquic_http3_qlog_frame_created | ( | imquic_qlog * | qlog, |
uint64_t | stream_id, | ||
uint64_t | length, | ||
json_t * | frame ) |
Add a frame_created
.
qlog | The imquic_qlog instance to add the event to |
stream_id | The Stream ID used for this message |
length | The size of the frame |
frame | The frame that was created |
void imquic_http3_qlog_frame_parsed | ( | imquic_qlog * | qlog, |
uint64_t | stream_id, | ||
uint64_t | length, | ||
json_t * | frame ) |
Add a frame_parsed
.
qlog | The imquic_qlog instance to add the event to |
stream_id | The Stream ID used for this message |
length | The size of the frame |
frame | The frame that was parsed |
void imquic_http3_qlog_parameters_set | ( | imquic_qlog * | qlog, |
gboolean | local, | ||
gboolean | extended_connect, | ||
gboolean | h3_datagram ) |
Add a parameters_set
event.
qlog | The imquic_qlog instance to add the event to |
local | Whether this is a local or remote parameters set |
extended_connect | Whether SETTINGS_ENABLE_CONNECT_PROTOCOL is set |
h3_datagram | Whether SETTINGS_H3_DATAGRAM is set |
void imquic_http3_qlog_stream_type_set | ( | imquic_qlog * | qlog, |
gboolean | local, | ||
uint64_t | stream_id, | ||
const char * | type ) |
Add a stream_type_set
.
qlog | The imquic_qlog instance to add the event to |
local | Whether this is a local or remote stream |
stream_id | The Stream ID used for this message |
type | The stream type |
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.
bytes | Buffer to add the property to |
blen | Size of the buffer |
type | The imquic_http3_settings_type type to add to the frame |
number | The numeric value of the property to add |
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.
type | The imquic_http3_settings_type value |
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.
type | The imquic_http3_stream_type value |
void imquic_qlog_http3_append_object | ( | json_t * | parent, |
const char * | name, | ||
const char * | value ) |
Helper to append a name/value object to an array.
parent | The array to append the new name/value obect to |
name | The object name |
value | The object value |
json_t * imquic_qlog_http3_prepare_content | ( | json_t * | parent, |
const char * | name, | ||
gboolean | array ) |
Helper to prepare a frame or an object/array, and add it to a parent if it's specified.
frame_type
property is set in the new object automatically; if it is, the object/array will be empty and added to the parent with the provided name parent | The object/array to add the object to, if any |
name | The object/array name, or the frame_type property in the object |
array | Whether to create an array or an object (ignored if parent is NULL) |