2 * nghttp2 - HTTP/2 C Library
4 * Copyright (c) 2013 Tatsuhiro Tsujikawa
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef NGHTTP2_HD_HUFFMAN_H
26 #define NGHTTP2_HD_HUFFMAN_H
30 #endif /* HAVE_CONFIG_H */
35 /* FSA accepts this state as the end of huffman encoding
37 NGHTTP2_HUFF_ACCEPTED = 1,
38 /* This state emits symbol */
39 NGHTTP2_HUFF_SYM = (1 << 1),
40 /* If state machine reaches this state, decoding fails. */
41 NGHTTP2_HUFF_FAIL = (1 << 2)
42 } nghttp2_huff_decode_flag;
45 /* huffman decoding state, which is actually the node ID of internal
46 huffman tree. We have 257 leaf nodes, but they are identical to
47 root node other than emitting a symbol, so we have 256 internal
48 nodes [1..255], inclusive. */
50 /* bitwise OR of zero or more of the nghttp2_huff_decode_flag */
52 /* symbol if NGHTTP2_HUFF_SYM flag set */
54 } nghttp2_huff_decode;
56 typedef nghttp2_huff_decode huff_decode_table_type[16];
59 /* Current huffman decoding state. We stripped leaf nodes, so the
60 value range is [0..255], inclusive. */
62 /* nonzero if we can say that the decoding process succeeds at this
65 } nghttp2_hd_huff_decode_context;
68 /* The number of bits in this code */
70 /* Huffman code aligned to LSB */
74 #endif /* NGHTTP2_HD_HUFFMAN_H */