VLC  3.0.15
hpack.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * hpack.h: HPACK Header Compression for HTTP/2
3  *****************************************************************************
4  * Copyright (C) 2015 RĂ©mi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20 
21 /**
22  * \defgroup hpack HPACK compression
23  * HTTP/2 header compression (HPACK)
24  * \ingroup h2
25  * @{
26  */
27 
28 struct hpack_decoder;
29 
30 struct hpack_decoder *hpack_decode_init(size_t header_table_size);
31 void hpack_decode_destroy(struct hpack_decoder *);
32 
33 int hpack_decode(struct hpack_decoder *dec, const uint8_t *data,
34  size_t length, char *headers[][2], unsigned max);
35 
36 size_t hpack_encode_hdr_neverindex(uint8_t *restrict buf, size_t size,
37  const char *name, const char *value);
38 size_t hpack_encode(uint8_t *restrict buf, size_t size,
39  const char *const headers[][2], unsigned count);
40 
41 /** @} */
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)
Definition: hpack.c:526
hpack_decode_init
struct hpack_decoder * hpack_decode_init(size_t header_table_size)
Definition: hpack.c:71
hpack_decoder::max_size
size_t max_size
Definition: hpack.c:68
count
size_t count
Definition: core.c:461
hpack_decoder::size
size_t size
Definition: hpack.c:67
hpack_decode_byte_huffman
static int hpack_decode_byte_huffman(const uint8_t *restrict end, int *restrict bit_offset)
Definition: hpack.c:155
hpack_decoder
Definition: hpack.c:63
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)
Definition: hpack.c:495
hpack_decode_evict
static void hpack_decode_evict(struct hpack_decoder *dec)
Definition: hpack.c:376
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)
Definition: hpack.c:548
hpack_names
static const char hpack_names[][28]
Static Table header names.
Definition: hpack.c:39
hpack_lookup_value
static char * hpack_lookup_value(const struct hpack_decoder *dec, uint_fast32_t idx)
Definition: hpack.c:350
hpack_encode_hdr_neverindex
size_t hpack_encode_hdr_neverindex(uint8_t *restrict buf, size_t size, const char *name, const char *value)
Definition: hpackenc.c:119
hpack_decode_str_raw
static char * hpack_decode_str_raw(const uint8_t *data, size_t length)
Decodes a raw string literal.
Definition: hpack.c:144
hpack.h
hpack_decode_destroy
void hpack_decode_destroy(struct hpack_decoder *dec)
Definition: hpack.c:84
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)
Definition: hpack.c:457
hpack_decoder::table
char ** table
Definition: hpack.c:65
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)
Definition: hpack.c:431
hpack_decode
int hpack_decode(struct hpack_decoder *dec, const uint8_t *data, size_t length, char *headers[][2], unsigned max)
Definition: hpack.c:574
hpack_lookup_name
static char * hpack_lookup_name(const struct hpack_decoder *dec, uint_fast32_t idx)
Definition: hpack.c:326
hpack_decode_int
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.
Definition: hpack.c:96
strdup
char * strdup(const char *)
name
const char name[16]
Definition: httpd.c:1249
entry
Definition: fourcc_gen.c:50
hpack_decode_str
static char * hpack_decode_str(const uint8_t **restrict datap, size_t *restrict lengthp)
Decodes a string literal.
Definition: hpack.c:291
hpack_decoder::entries
size_t entries
Definition: hpack.c:66
hpack_append_hdr
static int hpack_append_hdr(struct hpack_decoder *dec, const char *name, const char *value)
Definition: hpack.c:404
hpack_values
static const char hpack_values[][14]
Static Table header values.
Definition: hpack.c:57
main
int main(void)
Definition: fourcc_gen.c:134
hpack_decode_str_huffman
static char * hpack_decode_str_huffman(const uint8_t *data, size_t length)
Decodes an Huffman-encoded string literal.
Definition: hpack.c:253
hpack_encode
size_t hpack_encode(uint8_t *restrict buf, size_t size, const char *const headers[][2], unsigned count)
Definition: hpackenc.c:153
p
#define p(t)