VLC 4.0.0-dev
Loading...
Searching...
No Matches
hpack.c File Reference
Include dependency graph for hpack.c:

Data Structures

struct  hpack_decoder
 

Functions

struct hpack_decoderhpack_decode_init (size_t header_table_size)
 
void hpack_decode_destroy (struct hpack_decoder *dec)
 
static int_fast32_t hpack_decode_int (unsigned n, const uint8_t **restrict datap, size_t *restrict lengthp)
 Decodes an HPACK unsigned variable length integer.
 
static char * hpack_decode_str_raw (const uint8_t *data, size_t length)
 Decodes a raw string literal.
 
static int hpack_decode_byte_huffman (const uint8_t *restrict end, int *restrict bit_offset)
 
static char * hpack_decode_str_huffman (const uint8_t *data, size_t length)
 Decodes an Huffman-encoded string literal.
 
static char * hpack_decode_str (const uint8_t **restrict datap, size_t *restrict lengthp)
 Decodes a string literal.
 
static char * hpack_lookup_name (const struct hpack_decoder *dec, uint_fast32_t idx)
 
static char * hpack_lookup_value (const struct hpack_decoder *dec, uint_fast32_t idx)
 
static void hpack_decode_evict (struct hpack_decoder *dec)
 
static int hpack_append_hdr (struct hpack_decoder *dec, const char *name, const char *value)
 
static int hpack_decode_hdr_indexed (struct hpack_decoder *dec, const uint8_t **restrict datap, size_t *restrict lengthp, char **restrict namep, char **restrict valuep)
 
static int hpack_decode_hdr_index (struct hpack_decoder *dec, const uint8_t **restrict datap, size_t *restrict lengthp, char **restrict namep, char **restrict valuep)
 
static int hpack_decode_hdr_noindex (struct hpack_decoder *dec, const uint8_t **restrict datap, size_t *restrict lengthp, char **restrict namep, char **restrict valuep)
 
static int hpack_decode_tbl_update (struct hpack_decoder *dec, const uint8_t **restrict datap, size_t *restrict lengthp, char **restrict name, char **restrict value)
 
static int hpack_decode_hdr (struct hpack_decoder *dec, const uint8_t **restrict datap, size_t *restrict lengthp, char **restrict namep, char **restrict valuep)
 
int hpack_decode (struct hpack_decoder *dec, const uint8_t *data, size_t length, char *headers[][2], unsigned max)
 

Variables

static const char hpack_names [][28]
 Static Table header names.
 
static const char hpack_values [][14]
 Static Table header values.
 

Function Documentation

◆ hpack_append_hdr()

static int hpack_append_hdr ( struct hpack_decoder dec,
const char *  name,
const char *  value 
)
static

◆ hpack_decode_byte_huffman()

static int hpack_decode_byte_huffman ( const uint8_t *restrict  end,
int *restrict  bit_offset 
)
static

References p.

Referenced by hpack_decode_str_huffman().

◆ hpack_decode_evict()

static void hpack_decode_evict ( struct hpack_decoder dec)
static

◆ hpack_decode_hdr()

static int hpack_decode_hdr ( struct hpack_decoder dec,
const uint8_t **restrict  datap,
size_t *restrict  lengthp,
char **restrict  namep,
char **restrict  valuep 
)
static

◆ hpack_decode_hdr_index()

static int hpack_decode_hdr_index ( struct hpack_decoder dec,
const uint8_t **restrict  datap,
size_t *restrict  lengthp,
char **restrict  namep,
char **restrict  valuep 
)
static

◆ hpack_decode_hdr_indexed()

static int hpack_decode_hdr_indexed ( struct hpack_decoder dec,
const uint8_t **restrict  datap,
size_t *restrict  lengthp,
char **restrict  namep,
char **restrict  valuep 
)
static

◆ hpack_decode_hdr_noindex()

static int hpack_decode_hdr_noindex ( struct hpack_decoder dec,
const uint8_t **restrict  datap,
size_t *restrict  lengthp,
char **restrict  namep,
char **restrict  valuep 
)
static

◆ hpack_decode_int()

static int_fast32_t hpack_decode_int ( unsigned  n,
const uint8_t **restrict  datap,
size_t *restrict  lengthp 
)
static

Decodes an HPACK unsigned variable length integer.

Returns
the value on success, -1 on error (and sets errno).

References p.

Referenced by hpack_decode_hdr_index(), hpack_decode_hdr_indexed(), hpack_decode_hdr_noindex(), hpack_decode_str(), and hpack_decode_tbl_update().

◆ hpack_decode_str()

static char * hpack_decode_str ( const uint8_t **restrict  datap,
size_t *restrict  lengthp 
)
static

Decodes a string literal.

Returns
a heap-allocated nul-terminated string success, NULL on error (and sets errno).

References hpack_decode_int(), hpack_decode_str_huffman(), and hpack_decode_str_raw().

Referenced by hpack_decode_hdr_index(), and hpack_decode_hdr_noindex().

◆ hpack_decode_str_huffman()

static char * hpack_decode_str_huffman ( const uint8_t *  data,
size_t  length 
)
static

Decodes an Huffman-encoded string literal.

References hpack_decode_byte_huffman().

Referenced by hpack_decode_str().

◆ hpack_decode_str_raw()

static char * hpack_decode_str_raw ( const uint8_t *  data,
size_t  length 
)
static

Decodes a raw string literal.

Referenced by hpack_decode_str().

◆ hpack_decode_tbl_update()

static int hpack_decode_tbl_update ( struct hpack_decoder dec,
const uint8_t **restrict  datap,
size_t *restrict  lengthp,
char **restrict  name,
char **restrict  value 
)
static

◆ hpack_lookup_name()

static char * hpack_lookup_name ( const struct hpack_decoder dec,
uint_fast32_t  idx 
)
static

◆ hpack_lookup_value()

static char * hpack_lookup_value ( const struct hpack_decoder dec,
uint_fast32_t  idx 
)
static

Variable Documentation

◆ hpack_names

const char hpack_names[][28]
static
Initial value:
=
{
":authority", ":method", ":method", ":path", ":path", ":scheme", ":scheme",
":status", ":status", ":status", ":status", ":status", ":status",
":status", "accept-charset", "accept-encoding", "accept-language",
"accept-ranges", "accept", "access-control-allow-origin", "age", "allow",
"authorization", "cache-control", "content-disposition",
"content-encoding", "content-language", "content-length",
"content-location", "content-range", "content-type", "cookie", "date",
"etag", "expect", "expires", "from", "host", "if-match",
"if-modified-since", "if-none-match", "if-range", "if-unmodified-since",
"last-modified", "link", "location", "max-forwards", "proxy-authenticate",
"proxy-authorization", "range", "referer", "refresh", "retry-after",
"server", "set-cookie", "strict-transport-security", "transfer-encoding",
"user-agent", "vary", "via", "www-authenticate",
}

Static Table header names.

Referenced by hpack_lookup_name(), and hpack_lookup_value().

◆ hpack_values

const char hpack_values[][14]
static
Initial value:
=
{
"", "GET", "POST", "/", "/index.html", "http", "https", "200", "204",
"206", "304", "400", "404", "500", "", "gzip, deflate"
}

Static Table header values.

Referenced by hpack_lookup_value().