Loading...
Searching...
No Matches
Functions | Variables
qpack.c File Reference

QPACK stack (WebTransport only) More...

#include "internal/qpack.h"
#include "internal/huffman.h"
#include "internal/utils.h"
#include "imquic/debug.h"
Include dependency graph for qpack.c:

Functions

imquic_qpack_entryimquic_qpack_entry_create (const char *name, const char *value)
 Create a new entry out of provided name and value.
 
void imquic_qpack_entry_destroy (imquic_qpack_entry *entry)
 Destroy an existing entry.
 
size_t imquic_qpack_entry_size (imquic_qpack_entry *entry)
 Helper to calculate the size of this entry.
 
imquic_qpack_dynamic_tableimquic_qpack_dynamic_table_create (size_t capacity)
 Create a new dynamic table.
 
void imquic_qpack_dynamic_table_destroy (imquic_qpack_dynamic_table *table)
 Destroy an existing dynamic table.
 
imquic_qpack_contextimquic_qpack_context_create (size_t capacity)
 Create a new QPACK context.
 
void imquic_qpack_context_destroy (imquic_qpack_context *ctx)
 Destroy an existing QPACK context.
 
size_t imquic_qpack_decode (imquic_qpack_context *ctx, uint8_t *bytes, size_t blen)
 Decode incoming QPACK encoder data.
 
GList * imquic_qpack_process (imquic_qpack_context *ctx, uint8_t *bytes, size_t blen, size_t *bread)
 Decode an incoming QPACK request.
 
int imquic_qpack_encode (imquic_qpack_context *ctx, GList *headers, uint8_t *bytes, size_t *blen, uint8_t *qenc, size_t *qenclen)
 Encode outgoing QPACK encoder data.
 

Variables

imquic_qpack_entry imquic_qpack_static_table []
 Static table.
 

Detailed Description

QPACK stack (WebTransport only)

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

Naive implementation of QPACK, which implements static and dynamic tables, and Huffman encoding/decoding via static tables. This code is only used for the WebTransport establishment via HTTP/3.

Function Documentation

◆ imquic_qpack_context_create()

imquic_qpack_context * imquic_qpack_context_create ( size_t capacity)

Create a new QPACK context.

Parameters
capacityThe capacity of the dynamic table, as advertized
Returns
A pointer to a new imquic_qpack_context instance, if successful, or NULL otherwise

◆ imquic_qpack_context_destroy()

void imquic_qpack_context_destroy ( imquic_qpack_context * ctx)

Destroy an existing QPACK context.

Parameters
ctxContext instance to destroy

◆ imquic_qpack_decode()

size_t imquic_qpack_decode ( imquic_qpack_context * ctx,
uint8_t * bytes,
size_t blen )

Decode incoming QPACK encoder data.

Note
This is data coming from the encoder stream of our peer
Parameters
ctxThe imquic_qpack_context to update with the new encoder data
bytesThe buffer containing the encoder data
blenSize of the encoder data
Returns
The amount of processed encoder data

◆ imquic_qpack_dynamic_table_create()

imquic_qpack_dynamic_table * imquic_qpack_dynamic_table_create ( size_t capacity)

Create a new dynamic table.

Parameters
capacityThe capacity of the dynamic table, as advertized
Returns
A pointer to a new imquic_qpack_dynamic_table instance, if successful, or NULL otherwise

◆ imquic_qpack_dynamic_table_destroy()

void imquic_qpack_dynamic_table_destroy ( imquic_qpack_dynamic_table * table)

Destroy an existing dynamic table.

Parameters
tableDynamic table instance to destroy

◆ imquic_qpack_encode()

int imquic_qpack_encode ( imquic_qpack_context * ctx,
GList * headers,
uint8_t * bytes,
size_t * blen,
uint8_t * qenc,
size_t * qenclen )

Encode outgoing QPACK encoder data.

Note
This is data we'll send on our encoder stream
Parameters
[in]ctxThe imquic_qpack_context to use to encode the data
[in]headersList of headers to encode
[in]bytesThe buffer to put the encoded data in
[out]blenSize of the encoded data buffer
[in]qencThe buffer to put the QPACK encoder info in, if any
[out]qenclenSize of the QPACK encoder info buffer
Returns
0 in case of success, a negative integer otherwise

◆ imquic_qpack_entry_create()

imquic_qpack_entry * imquic_qpack_entry_create ( const char * name,
const char * value )

Create a new entry out of provided name and value.

Parameters
nameName of the new entry
valueValue of the new entry
Returns
A pointer to a new imquic_qpack_entry instance, if successful, or NULL otherwise

◆ imquic_qpack_entry_destroy()

void imquic_qpack_entry_destroy ( imquic_qpack_entry * entry)

Destroy an existing entry.

Parameters
entryEntry instance to destroy

◆ imquic_qpack_entry_size()

size_t imquic_qpack_entry_size ( imquic_qpack_entry * entry)

Helper to calculate the size of this entry.

Parameters
entryEntry instance to calculate the size for
Returns
The size of the entry, as needed for the dynamic table size

◆ imquic_qpack_process()

GList * imquic_qpack_process ( imquic_qpack_context * ctx,
uint8_t * bytes,
size_t blen,
size_t * bread )

Decode an incoming QPACK request.

Note
This is data coming from a request. The GList and its contents are owned by the caller, and so should be freed when not needed anymore.
Parameters
[in]ctxThe imquic_qpack_context to refer to
[in]bytesThe buffer containing the request data
[in]blenSize of the request data
[out]breadThe amount of processed request data
Returns
A list of imquic_qpack_entry entries obtained from the request

Variable Documentation

◆ imquic_qpack_static_table

imquic_qpack_entry imquic_qpack_static_table[]

Static table.