Wireshark 4.7.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 <stdlib.h>
12#include <stdint.h>
13
14typedef enum {
15 /* FSA accepts this state as the end of huffman encoding
16 sequence. */
17 NGHTTP2_HUFF_ACCEPTED = 1 << 14,
18 /* This state emits symbol */
19 NGHTTP2_HUFF_SYM = 1 << 15,
20} nghttp2_huff_decode_flag;
21
22typedef struct {
23 /* fstate is the current huffman decoding state, which is actually
24 the node ID of internal huffman tree with
25 nghttp2_huff_decode_flag OR-ed. We have 257 leaf nodes, but they
26 are identical to root node other than emitting a symbol, so we
27 have 256 internal nodes [1..255], inclusive. The node ID 256 is
28 a special node and it is a terminal state that means decoding
29 failed. */
30 uint16_t fstate;
31 /* symbol if NGHTTP2_HUFF_SYM flag set */
32 uint8_t sym;
34
35typedef nghttp2_huff_decode huff_decode_table_type[16];
36
37typedef struct {
38 /* fstate is the current huffman decoding state. */
39 uint16_t fstate;
41
42typedef struct {
43 /* The number of bits in this code */
44 uint32_t nbits;
45 /* Huffman code aligned to LSB */
46 uint32_t code;
48
49extern const nghttp2_huff_sym huff_sym_table[];
50extern const nghttp2_huff_decode huff_decode_table[][16];
51
52#endif /* NGHTTP2_HD_HUFFMAN_H */
Definition nghttp2_hd_huffman.h:37
Definition nghttp2_hd_huffman.h:22
Definition nghttp2_hd_huffman.h:42