Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
nghttp2_hd_huffman.h
1/* @file
2 * nghttp2 - HTTP/2 C Library
3 *
4 * Copyright (c) 2013 Tatsuhiro Tsujikawa
5 *
6 * SPDX-License-Identifier: MIT
7 */
8#ifndef NGHTTP2_HD_HUFFMAN_H
9#define NGHTTP2_HD_HUFFMAN_H
10
11#include <config.h>
12
13#include <stdlib.h>
14#include <stdint.h>
15
16typedef enum {
17 /* FSA accepts this state as the end of huffman encoding
18 sequence. */
19 NGHTTP2_HUFF_ACCEPTED = 1 << 14,
20 /* This state emits symbol */
21 NGHTTP2_HUFF_SYM = 1 << 15,
22} nghttp2_huff_decode_flag;
23
24typedef struct {
25 /* fstate is the current huffman decoding state, which is actually
26 the node ID of internal huffman tree with
27 nghttp2_huff_decode_flag OR-ed. We have 257 leaf nodes, but they
28 are identical to root node other than emitting a symbol, so we
29 have 256 internal nodes [1..255], inclusive. The node ID 256 is
30 a special node and it is a terminal state that means decoding
31 failed. */
32 uint16_t fstate;
33 /* symbol if NGHTTP2_HUFF_SYM flag set */
34 uint8_t sym;
36
37typedef nghttp2_huff_decode huff_decode_table_type[16];
38
39typedef struct {
40 /* fstate is the current huffman decoding state. */
41 uint16_t fstate;
43
44typedef struct {
45 /* The number of bits in this code */
46 uint32_t nbits;
47 /* Huffman code aligned to LSB */
48 uint32_t code;
50
51extern const nghttp2_huff_sym huff_sym_table[];
52extern const nghttp2_huff_decode huff_decode_table[][16];
53
54#endif /* NGHTTP2_HD_HUFFMAN_H */
Definition nghttp2_hd_huffman.h:39
Definition nghttp2_hd_huffman.h:24
Definition nghttp2_hd_huffman.h:44