Commit c1bd0b6b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add H2 table includes

parent fb58772d
......@@ -2,8 +2,8 @@
# API headers
nobase_pkginclude_HEADERS = \
tbl/acct_fields_req.h \
tbl/acct_fields_bereq.h \
tbl/acct_fields_req.h \
tbl/backend_poll.h \
tbl/ban_vars.h \
tbl/bo_flags.h \
......@@ -12,6 +12,10 @@ nobase_pkginclude_HEADERS = \
tbl/cli_cmds.h \
tbl/debug_bits.h \
tbl/feature_bits.h \
tbl/h2_error.h \
tbl/h2_frames.h \
tbl/h2_settings.h \
tbl/h2_stream.h \
tbl/http_headers.h \
tbl/http_response.h \
tbl/locks.h \
......@@ -27,12 +31,17 @@ nobase_pkginclude_HEADERS = \
tbl/symbol_kind.h \
tbl/vcc_types.h \
tbl/vcl_returns.h \
tbl/vhd_fsm.h \
tbl/vhd_fsm_funcs.h \
tbl/vhd_return.h \
tbl/vhp_huffman.h \
tbl/vhp_static.h \
tbl/vrt_stv_var.h \
tbl/vsc_types.h \
tbl/vsc_all.h \
tbl/vsc_f_main.h \
tbl/vsc_fields.h \
tbl/vsc_levels.h \
tbl/vsc_f_main.h \
tbl/vsc_types.h \
tbl/vsl_tags.h \
tbl/vsl_tags_http.h \
vapi/vsm.h \
......
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* RFC7540 section 11.4
*/
/*lint -save -e525 -e539 */
H2_ERROR(NO_ERROR, 0x0, "Graceful shutdown")
H2_ERROR(PROTOCOL_ERROR, 0x1, "Protocol error detected")
H2_ERROR(INTERNAL_ERROR, 0x2, "Implementation fault")
H2_ERROR(FLOW_CONTROL_ERROR, 0x3, "Flow-control limits exceeded")
H2_ERROR(SETTINGS_TIMEOUT, 0x4, "Settings not acknowledged")
H2_ERROR(STREAM_CLOSED, 0x5, "Frame received for closed stream")
H2_ERROR(FRAME_SIZE_ERROR, 0x6, "Frame size incorrect")
H2_ERROR(REFUSED_STREAM, 0x7, "Stream not processed")
H2_ERROR(CANCEL, 0x8, "Stream cancelled")
H2_ERROR(COMPRESSION_ERROR, 0x9, "Compression state not updated")
H2_ERROR(CONNECT_ERROR, 0xa, "TCP connection error for CONNECT method")
H2_ERROR(ENHANCE_YOUR_CALM, 0xb, "Processing capacity exceeded")
H2_ERROR(INADEQUATE_SECURITY, 0xc, "Negotiated TLS parameters not acceptable")
H2_ERROR(HTTP_1_1_REQUIRED, 0xd, "Use HTTP/1.1 for the request")
#undef H2_ERROR
/*lint -restore */
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* RFC7540 section 11.2
*/
/*lint -save -e525 -e539 */
#ifdef H2_FRAME
/* lower, upper, type, valid flags */
H2_FRAME(data, DATA, 0x0, 0x09)
H2_FRAME(headers, HEADERS, 0x1, 0x2d)
H2_FRAME(priority, PRIORITY, 0x2, 0x00)
H2_FRAME(rst_stream, RST_STREAM, 0x3, 0x00)
H2_FRAME(settings, SETTINGS, 0x4, 0x01)
H2_FRAME(push_promise, PUSH_PROMISE, 0x5, 0x0c)
H2_FRAME(ping, PING, 0x6, 0x01)
H2_FRAME(goaway, GOAWAY, 0x7, 0x00)
H2_FRAME(window_update, WINDOW_UPDATE, 0x8, 0x00)
H2_FRAME(continuation, CONTINUATION, 0x9, 0x04)
#undef H2_FRAME
#endif
#ifdef H2_FRAME_FLAGS
H2_FRAME_FLAGS(none, NONE, 0x00)
H2_FRAME_FLAGS(data_end_stream, DATA_END_STREAM, 0x01)
H2_FRAME_FLAGS(data_padded, DATA_PADDED, 0x08)
H2_FRAME_FLAGS(headers_end_stream, HEADERS_END_STREAM, 0x01)
H2_FRAME_FLAGS(headers_end_headers, HEADERS_END_HEADERS, 0x04)
H2_FRAME_FLAGS(headers_padded, HEADERS_PADDED, 0x08)
H2_FRAME_FLAGS(headers_priority, HEADERS_PRIORITY, 0x20)
H2_FRAME_FLAGS(settings_ack, SETTINGS_ACK, 0x01)
H2_FRAME_FLAGS(push_promise_end_headers,PUSH_PROMISE_END_HEADERS, 0x04)
H2_FRAME_FLAGS(push_promise_padded, PUSH_PROMISE_PADDED, 0x08)
H2_FRAME_FLAGS(ping_ack, PING_ACK, 0x01)
H2_FRAME_FLAGS(continuation_end_headers,CONTINUATION_END_HEADERS, 0x04)
#undef H2_FRAME_FLAGS
#endif
/*lint -restore */
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* RFC7540 section 11.3
*/
/*lint -save -e525 -e539 */
H2_SETTINGS(HEADER_TABLE_SIZE, 0x1, 4096)
H2_SETTINGS(ENABLE_PUSH, 0x2, 1)
H2_SETTINGS(MAX_CONCURRENT_STREAMS, 0x3, 0xffffffff)
H2_SETTINGS(INITIAL_WINDOW_SIZE, 0x4, 65535)
H2_SETTINGS(MAX_FRAME_SIZE, 0x5, 16384)
H2_SETTINGS(MAX_HEADER_LIST_SIZE, 0x6, 0xffffffff)
#undef H2_SETTINGS
/*lint -restore */
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* RFC7540 section 11.4
*/
/*lint -save -e525 -e539 */
H2_STREAM(IDLE, "idle", "idle")
H2_STREAM(RESV_LOC, "r-loc", "reserved (local)")
H2_STREAM(RESV_REM, "r-rem", "reserved (remote)")
H2_STREAM(OPEN, "open", "open")
H2_STREAM(CLOS_LOC, "c-loc", "half closed (local)")
H2_STREAM(CLOS_REM, "c-rem", "half closed (remote)")
H2_STREAM(CLOSED, "closed", "closed")
#undef H2_STREAM
/*lint -restore */
/*-
* Copyright (c) 2016 Varnish Software
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* Decode integer with prefix */
#define VHD_FSM_INTEGER(STATE, pfx) \
VHD_FSM(STATE, INTEGER, pfx, 0)
/* Goto */
#define VHD_FSM_GOTO(STATE, TO) \
VHD_FSM(STATE, GOTO, VHD_S_##TO, 0)
/* Label */
#define VHD_FSM_LABEL(STATE) \
VHD_FSM(STATE, SKIP, 0, 0)
/* Set max table size */
#define VHD_FSM_SET_MAX(STATE) \
VHD_FSM(STATE, SET_MAX, 0, 0)
/* Set index */
#define VHD_FSM_SET_IDX(STATE) \
VHD_FSM(STATE, SET_IDX, 0, 0)
/* Table lookup from index */
#define VHD_FSM_LOOKUP(STATE, type) \
VHD_FSM(STATE, LOOKUP, type, 0)
/* New table entry */
#define VHD_FSM_NEW(STATE) \
VHD_FSM(STATE, NEW, 0, 0)
/* New table entry, name from index */
#define VHD_FSM_NEW_IDX(STATE) \
VHD_FSM(STATE, NEW_IDX, 0, 0)
/* Branch if index is zero */
#define VHD_FSM_BRANCH_ZIDX(STATE, BRANCH) \
VHD_FSM(STATE, BRANCH_ZIDX, VHD_S_##BRANCH, 0)
/* Branch if bit 0 */
#define VHD_FSM_BRANCH_BIT0(STATE, BRANCH) \
VHD_FSM(STATE, BRANCH_BIT0, VHD_S_##BRANCH, 0)
/* Decode a literal:
* 0 1 2 3 4 5 6 7
* +---+---+-----------------------+
* | H | Length (7+) |
* +---+---------------------------+
* | String (Length octets) |
* +-------------------------------+
*/
#define VHD_FSM_LITERAL(STATE, type, flags) \
VHD_FSM_BRANCH_BIT0(STATE, STATE##_HUFFMAN_LEN) \
VHD_FSM_INTEGER(STATE##_RAW_LEN, 7) \
VHD_FSM(STATE##_RAW, RAW, type, flags) \
VHD_FSM_GOTO(STATE##_RAW_FINISH, STATE##_EXIT) \
VHD_FSM_INTEGER(STATE##_HUFFMAN_LEN, 7) \
VHD_FSM(STATE##_HUFFMAN, HUFFMAN, type, flags) \
VHD_FSM_LABEL(STATE##_EXIT)
/* The idle state */
VHD_FSM(IDLE, IDLE, 0, 0)
/* Indexed header field
* (RFC 7541 section 6.1)
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 1 | Index(7+) |
* +---+---------------------------+
*/
VHD_FSM_LABEL(HP61_START)
VHD_FSM_INTEGER(HP61_IDX, 7)
VHD_FSM_SET_IDX(HP61_SET_IDX)
VHD_FSM_LOOKUP(HP61_NAME, VHD_NAME)
VHD_FSM_LOOKUP(HP61_VAL, VHD_VALUE)
VHD_FSM_GOTO(HP61_FINISH, IDLE)
/* Literal header field with incremental indexing
* (RFC 7541 section 6.2.1)
*
* HP621_IN - Indexed name
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 1 | Index (6+) |
* +---+---+-----------------------+
* | H | Value Length (7+) |
* +---+---------------------------+
* | Value String (Length octets) |
* +-------------------------------+
*
* HP621_NN - New name
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 1 | 0 |
* +---+---+-----------------------+
* | H | Name Length (7+) |
* +---+---------------------------+
* | Name String (Length octets) |
* +---+---------------------------+
* | H | Value Length (7+) |
* +---+---------------------------+
* | Value String (Length octets) |
* +-------------------------------+
*/
VHD_FSM_LABEL(HP621_START)
VHD_FSM_INTEGER(HP621_IDX, 6)
VHD_FSM_SET_IDX(HP621_SET_IDX)
VHD_FSM_BRANCH_ZIDX(HP621_BRANCH_ZIDX, HP621_NN_NEW)
/* HP621_IN - Indexed name */
VHD_FSM_LOOKUP(HP621_IN_NAME, VHD_NAME)
VHD_FSM_NEW_IDX(HP621_IN_NEW)
VHD_FSM_LITERAL(HP621_IN_VAL, VHD_VALUE, VHD_INCREMENTAL)
VHD_FSM_GOTO(HP621_IN_FINISH, IDLE)
/* HP621_NN - New name */
VHD_FSM_NEW(HP621_NN_NEW)
VHD_FSM_LITERAL(HP621_NN_NAME, VHD_NAME, VHD_INCREMENTAL)
VHD_FSM_LITERAL(HP621_NN_VAL, VHD_VALUE, VHD_INCREMENTAL)
VHD_FSM_GOTO(HP621_NN_FINISH, IDLE)
/* Literal header field without indexing
* (RFC 7541 section 622)
*
* HP622_IN - Indexed name
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 0 | 0 | 0 | Index (4+) |
* +---+---+-----------------------+
* | H | Value Length (7+) |
* +---+---------------------------+
* | Value String (Length octets) |
* +-------------------------------+
*
* HP622_NN - New name
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 0 | 0 | 0 | 0 |
* +---+---+-----------------------+
* | H | Name Length (7+) |
* +---+---------------------------+
* | Name String (Length octets) |
* +---+---------------------------+
* | H | Value Length (7+) |
* +---+---------------------------+
* | Value String (Length octets) |
* +-------------------------------+
*/
VHD_FSM_LABEL(HP622_START)
VHD_FSM_INTEGER(HP622_IDX, 4)
VHD_FSM_SET_IDX(HP622_SET_IDX)
VHD_FSM_BRANCH_ZIDX(HP622_BR_ZIDX, HP622_NN_NAME)
/* HP622_IN - Indexed name */
VHD_FSM_LOOKUP(HP622_IN_NAME, VHD_NAME)
VHD_FSM_LITERAL(HP622_IN_VAL, VHD_VALUE, 0)
VHD_FSM_GOTO(HP622_IN_FINISH, IDLE)
/* HP622_NN - New name */
VHD_FSM_LITERAL(HP622_NN_NAME, VHD_NAME, 0)
VHD_FSM_LITERAL(HP622_NN_VAL, VHD_VALUE, 0)
VHD_FSM_GOTO(HP622_NN_FINISH, IDLE)
/* Literal header field never indexed
* (RFC 7541 section 6.2.3)
*
* HP623_IN - Indexed name
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 0 | 0 | 1 | Index (4+) |
* +---+---+-----------------------+
* | H | Value Length (7+) |
* +---+---------------------------+
* | Value String (Length octets) |
* +-------------------------------+
*
* HP623_NN - New name
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 0 | 0 | 1 | 0 |
* +---+---+-----------------------+
* | H | Name Length (7+) |
* +---+---------------------------+
* | Name String (Length octets) |
* +---+---------------------------+
* | H | Value Length (7+) |
* +---+---------------------------+
* | Value String (Length octets) |
* +-------------------------------+
*/
VHD_FSM_LABEL(HP623_START)
VHD_FSM_INTEGER(HP623_IDX, 4)
VHD_FSM_SET_IDX(HP623_SET_IDX)
VHD_FSM_BRANCH_ZIDX(HP623_BR_ZIDX, HP623_NN_NAME)
/* HP623_IN - Indexed name */
VHD_FSM_LOOKUP(HP623_IN_NAME, VHD_NAME_SEC)
VHD_FSM_LITERAL(HP623_IN_VAL, VHD_VALUE_SEC, 0)
VHD_FSM_GOTO(HP623_IN_FINISH, IDLE)
/* HP623_NN - New name */
VHD_FSM_LITERAL(HP623_NN_NAME, VHD_NAME_SEC, 0)
VHD_FSM_LITERAL(HP623_NN_VAL, VHD_VALUE_SEC, 0)
VHD_FSM_GOTO(HP623_NN_FINISH, IDLE)
/* Dynamic table size update
* (RFC 7541 section 6.3)
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | 0 | 0 | 1 | Max size (5+) |
* +---+---------------------------+
*/
VHD_FSM_LABEL(HP63_START)
VHD_FSM_INTEGER(HP63_SIZE, 5)
VHD_FSM_SET_MAX(HP63_SET_MAX)
VHD_FSM_GOTO(HP63_FINISH, IDLE)
/*---------------------------------------------------------------------*/
/* States used for unit testing */
#ifdef DECODE_TEST_DRIVER
/* Test integer prefix 5 */
VHD_FSM_LABEL(TEST_INT5)
VHD_FSM_INTEGER(TEST_INT5_INT, 5)
VHD_FSM_GOTO(TEST_INT5_FINISH, IDLE)
/* Test literal decoding */
VHD_FSM_LABEL(TEST_LITERAL)
VHD_FSM_LITERAL(TEST_LITERAL_NAME, VHD_NAME, 0)
VHD_FSM_LITERAL(TEST_LITERAL_VALUE, VHD_VALUE, 0)
VHD_FSM_GOTO(TEST_LITERAL_FINISH, IDLE)
#endif /* DECODE_TEST_DRIVER */
/*---------------------------------------------------------------------*/
/* Clean up macro namespace */
#undef VHD_FSM_INTEGER
#undef VHD_FSM_GOTO
#undef VHD_FSM_LABEL
#undef VHD_FSM_SET_MAX
#undef VHD_FSM_SET_IDX
#undef VHD_FSM_LOOKUP
#undef VHD_FSM_NEW
#undef VHD_FSM_NEW_IDX
#undef VHD_FSM_BRANCH_ZIDX
#undef VHD_FSM_BRANCH_BIT0
#undef VHD_FSM_LITERAL
/*-
* Copyright (c) 2016 Varnish Software
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
VHD_FSM_FUNC(SKIP, vhd_skip)
VHD_FSM_FUNC(GOTO, vhd_goto)
VHD_FSM_FUNC(IDLE, vhd_idle)
VHD_FSM_FUNC(INTEGER, vhd_integer)
VHD_FSM_FUNC(SET_MAX, vhd_set_max)
VHD_FSM_FUNC(SET_IDX, vhd_set_idx)
VHD_FSM_FUNC(LOOKUP, vhd_lookup)
VHD_FSM_FUNC(NEW, vhd_new)
VHD_FSM_FUNC(NEW_IDX, vhd_new_idx)
VHD_FSM_FUNC(BRANCH_ZIDX, vhd_branch_zidx)
VHD_FSM_FUNC(BRANCH_BIT0, vhd_branch_bit0)
VHD_FSM_FUNC(RAW, vhd_raw)
VHD_FSM_FUNC(HUFFMAN, vhd_huffman)
/*-
* Copyright (c) 2016 Varnish Software
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
VHD_RET(ERR_ARG, -1, "Invalid HPACK instruction")
VHD_RET(ERR_INT, -2, "Integer overflow")
VHD_RET(ERR_IDX, -3, "Invalid table index")
VHD_RET(ERR_LEN, -4, "Invalid length")
VHD_RET(ERR_HUF, -5, "Invalid huffman code")
VHD_RET(ERR_UPD, -6, "Spurious update")
VHD_RET(OK, 0, "OK")
VHD_RET(MORE, 1, "Feed me")
VHD_RET(NAME, 2, "Name")
VHD_RET(VALUE, 3, "Value")
VHD_RET(NAME_SEC, 4, "Name never index")
VHD_RET(VALUE_SEC, 5, "Value never index")
VHD_RET(BUF, 6, "Stuffed")
VHD_RET(AGAIN, 7, "Call again")
/*-
* Written by Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
*
* This file is in the public domain.
*
* HPACK Huffman table, but sorted by codes (RFC 7541 Appendix B)
*/
HPH(0x30, 0x00000000, 5) /* '0' */
HPH(0x31, 0x00000001, 5) /* '1' */
HPH(0x32, 0x00000002, 5) /* '2' */
HPH(0x61, 0x00000003, 5) /* 'a' */
HPH(0x63, 0x00000004, 5) /* 'c' */
HPH(0x65, 0x00000005, 5) /* 'e' */
HPH(0x69, 0x00000006, 5) /* 'i' */
HPH(0x6f, 0x00000007, 5) /* 'o' */
HPH(0x73, 0x00000008, 5) /* 's' */
HPH(0x74, 0x00000009, 5) /* 't' */
HPH(0x20, 0x00000014, 6) /* ' ' */
HPH(0x25, 0x00000015, 6) /* '%' */
HPH(0x2d, 0x00000016, 6) /* '-' */
HPH(0x2e, 0x00000017, 6) /* '.' */
HPH(0x2f, 0x00000018, 6) /* '/' */
HPH(0x33, 0x00000019, 6) /* '3' */
HPH(0x34, 0x0000001a, 6) /* '4' */
HPH(0x35, 0x0000001b, 6) /* '5' */
HPH(0x36, 0x0000001c, 6) /* '6' */
HPH(0x37, 0x0000001d, 6) /* '7' */
HPH(0x38, 0x0000001e, 6) /* '8' */
HPH(0x39, 0x0000001f, 6) /* '9' */
HPH(0x3d, 0x00000020, 6) /* '=' */
HPH(0x41, 0x00000021, 6) /* 'A' */
HPH(0x5f, 0x00000022, 6) /* '_' */
HPH(0x62, 0x00000023, 6) /* 'b' */
HPH(0x64, 0x00000024, 6) /* 'd' */
HPH(0x66, 0x00000025, 6) /* 'f' */
HPH(0x67, 0x00000026, 6) /* 'g' */
HPH(0x68, 0x00000027, 6) /* 'h' */
HPH(0x6c, 0x00000028, 6) /* 'l' */
HPH(0x6d, 0x00000029, 6) /* 'm' */
HPH(0x6e, 0x0000002a, 6) /* 'n' */
HPH(0x70, 0x0000002b, 6) /* 'p' */
HPH(0x72, 0x0000002c, 6) /* 'r' */
HPH(0x75, 0x0000002d, 6) /* 'u' */
HPH(0x3a, 0x0000005c, 7) /* ':' */
HPH(0x42, 0x0000005d, 7) /* 'B' */
HPH(0x43, 0x0000005e, 7) /* 'C' */
HPH(0x44, 0x0000005f, 7) /* 'D' */
HPH(0x45, 0x00000060, 7) /* 'E' */
HPH(0x46, 0x00000061, 7) /* 'F' */
HPH(0x47, 0x00000062, 7) /* 'G' */
HPH(0x48, 0x00000063, 7) /* 'H' */
HPH(0x49, 0x00000064, 7) /* 'I' */
HPH(0x4a, 0x00000065, 7) /* 'J' */
HPH(0x4b, 0x00000066, 7) /* 'K' */
HPH(0x4c, 0x00000067, 7) /* 'L' */
HPH(0x4d, 0x00000068, 7) /* 'M' */
HPH(0x4e, 0x00000069, 7) /* 'N' */
HPH(0x4f, 0x0000006a, 7) /* 'O' */
HPH(0x50, 0x0000006b, 7) /* 'P' */
HPH(0x51, 0x0000006c, 7) /* 'Q' */
HPH(0x52, 0x0000006d, 7) /* 'R' */
HPH(0x53, 0x0000006e, 7) /* 'S' */
HPH(0x54, 0x0000006f, 7) /* 'T' */
HPH(0x55, 0x00000070, 7) /* 'U' */
HPH(0x56, 0x00000071, 7) /* 'V' */
HPH(0x57, 0x00000072, 7) /* 'W' */
HPH(0x59, 0x00000073, 7) /* 'Y' */
HPH(0x6a, 0x00000074, 7) /* 'j' */
HPH(0x6b, 0x00000075, 7) /* 'k' */
HPH(0x71, 0x00000076, 7) /* 'q' */
HPH(0x76, 0x00000077, 7) /* 'v' */
HPH(0x77, 0x00000078, 7) /* 'w' */
HPH(0x78, 0x00000079, 7) /* 'x' */
HPH(0x79, 0x0000007a, 7) /* 'y' */
HPH(0x7a, 0x0000007b, 7) /* 'z' */
HPH(0x26, 0x000000f8, 8) /* '&' */
HPH(0x2a, 0x000000f9, 8) /* '*' */
HPH(0x2c, 0x000000fa, 8) /* ',' */
HPH(0x3b, 0x000000fb, 8) /* ';' */
HPH(0x58, 0x000000fc, 8) /* 'X' */
HPH(0x5a, 0x000000fd, 8) /* 'Z' */
HPH(0x21, 0x000003f8, 10) /* '!' */
HPH(0x22, 0x000003f9, 10) /* '"' */
HPH(0x28, 0x000003fa, 10) /* '(' */
HPH(0x29, 0x000003fb, 10) /* ')' */
HPH(0x3f, 0x000003fc, 10) /* '?' */
HPH(0x27, 0x000007fa, 11) /* ''' */
HPH(0x2b, 0x000007fb, 11) /* '+' */
HPH(0x7c, 0x000007fc, 11) /* '|' */
HPH(0x23, 0x00000ffa, 12) /* '#' */
HPH(0x3e, 0x00000ffb, 12) /* '>' */
HPH(0x00, 0x00001ff8, 13)
HPH(0x24, 0x00001ff9, 13) /* '$' */
HPH(0x40, 0x00001ffa, 13) /* '@' */
HPH(0x5b, 0x00001ffb, 13) /* '[' */
HPH(0x5d, 0x00001ffc, 13) /* ']' */
HPH(0x7e, 0x00001ffd, 13) /* '~' */
HPH(0x5e, 0x00003ffc, 14) /* '^' */
HPH(0x7d, 0x00003ffd, 14) /* '}' */
HPH(0x3c, 0x00007ffc, 15) /* '<' */
HPH(0x60, 0x00007ffd, 15) /* '`' */
HPH(0x7b, 0x00007ffe, 15) /* '{' */
HPH(0x5c, 0x0007fff0, 19) /* '\' */
HPH(0xc3, 0x0007fff1, 19)
HPH(0xd0, 0x0007fff2, 19)
HPH(0x80, 0x000fffe6, 20)
HPH(0x82, 0x000fffe7, 20)
HPH(0x83, 0x000fffe8, 20)
HPH(0xa2, 0x000fffe9, 20)
HPH(0xb8, 0x000fffea, 20)
HPH(0xc2, 0x000fffeb, 20)
HPH(0xe0, 0x000fffec, 20)
HPH(0xe2, 0x000fffed, 20)
HPH(0x99, 0x001fffdc, 21)
HPH(0xa1, 0x001fffdd, 21)
HPH(0xa7, 0x001fffde, 21)
HPH(0xac, 0x001fffdf, 21)
HPH(0xb0, 0x001fffe0, 21)
HPH(0xb1, 0x001fffe1, 21)
HPH(0xb3, 0x001fffe2, 21)
HPH(0xd1, 0x001fffe3, 21)
HPH(0xd8, 0x001fffe4, 21)
HPH(0xd9, 0x001fffe5, 21)
HPH(0xe3, 0x001fffe6, 21)
HPH(0xe5, 0x001fffe7, 21)
HPH(0xe6, 0x001fffe8, 21)
HPH(0x81, 0x003fffd2, 22)
HPH(0x84, 0x003fffd3, 22)
HPH(0x85, 0x003fffd4, 22)
HPH(0x86, 0x003fffd5, 22)
HPH(0x88, 0x003fffd6, 22)
HPH(0x92, 0x003fffd7, 22)
HPH(0x9a, 0x003fffd8, 22)
HPH(0x9c, 0x003fffd9, 22)
HPH(0xa0, 0x003fffda, 22)
HPH(0xa3, 0x003fffdb, 22)
HPH(0xa4, 0x003fffdc, 22)
HPH(0xa9, 0x003fffdd, 22)
HPH(0xaa, 0x003fffde, 22)
HPH(0xad, 0x003fffdf, 22)
HPH(0xb2, 0x003fffe0, 22)
HPH(0xb5, 0x003fffe1, 22)
HPH(0xb9, 0x003fffe2, 22)
HPH(0xba, 0x003fffe3, 22)
HPH(0xbb, 0x003fffe4, 22)
HPH(0xbd, 0x003fffe5, 22)
HPH(0xbe, 0x003fffe6, 22)
HPH(0xc4, 0x003fffe7, 22)
HPH(0xc6, 0x003fffe8, 22)
HPH(0xe4, 0x003fffe9, 22)
HPH(0xe8, 0x003fffea, 22)
HPH(0xe9, 0x003fffeb, 22)
HPH(0x01, 0x007fffd8, 23)
HPH(0x87, 0x007fffd9, 23)
HPH(0x89, 0x007fffda, 23)
HPH(0x8a, 0x007fffdb, 23)
HPH(0x8b, 0x007fffdc, 23)
HPH(0x8c, 0x007fffdd, 23)
HPH(0x8d, 0x007fffde, 23)
HPH(0x8f, 0x007fffdf, 23)
HPH(0x93, 0x007fffe0, 23)
HPH(0x95, 0x007fffe1, 23)
HPH(0x96, 0x007fffe2, 23)
HPH(0x97, 0x007fffe3, 23)
HPH(0x98, 0x007fffe4, 23)
HPH(0x9b, 0x007fffe5, 23)
HPH(0x9d, 0x007fffe6, 23)
HPH(0x9e, 0x007fffe7, 23)
HPH(0xa5, 0x007fffe8, 23)
HPH(0xa6, 0x007fffe9, 23)
HPH(0xa8, 0x007fffea, 23)
HPH(0xae, 0x007fffeb, 23)
HPH(0xaf, 0x007fffec, 23)
HPH(0xb4, 0x007fffed, 23)
HPH(0xb6, 0x007fffee, 23)
HPH(0xb7, 0x007fffef, 23)
HPH(0xbc, 0x007ffff0, 23)
HPH(0xbf, 0x007ffff1, 23)
HPH(0xc5, 0x007ffff2, 23)
HPH(0xe7, 0x007ffff3, 23)
HPH(0xef, 0x007ffff4, 23)
HPH(0x09, 0x00ffffea, 24)
HPH(0x8e, 0x00ffffeb, 24)
HPH(0x90, 0x00ffffec, 24)
HPH(0x91, 0x00ffffed, 24)
HPH(0x94, 0x00ffffee, 24)
HPH(0x9f, 0x00ffffef, 24)
HPH(0xab, 0x00fffff0, 24)
HPH(0xce, 0x00fffff1, 24)
HPH(0xd7, 0x00fffff2, 24)
HPH(0xe1, 0x00fffff3, 24)
HPH(0xec, 0x00fffff4, 24)
HPH(0xed, 0x00fffff5, 24)
HPH(0xc7, 0x01ffffec, 25)
HPH(0xcf, 0x01ffffed, 25)
HPH(0xea, 0x01ffffee, 25)
HPH(0xeb, 0x01ffffef, 25)
HPH(0xc0, 0x03ffffe0, 26)
HPH(0xc1, 0x03ffffe1, 26)
HPH(0xc8, 0x03ffffe2, 26)
HPH(0xc9, 0x03ffffe3, 26)
HPH(0xca, 0x03ffffe4, 26)
HPH(0xcd, 0x03ffffe5, 26)
HPH(0xd2, 0x03ffffe6, 26)
HPH(0xd5, 0x03ffffe7, 26)
HPH(0xda, 0x03ffffe8, 26)
HPH(0xdb, 0x03ffffe9, 26)
HPH(0xee, 0x03ffffea, 26)
HPH(0xf0, 0x03ffffeb, 26)
HPH(0xf2, 0x03ffffec, 26)
HPH(0xf3, 0x03ffffed, 26)
HPH(0xff, 0x03ffffee, 26)
HPH(0xcb, 0x07ffffde, 27)
HPH(0xcc, 0x07ffffdf, 27)
HPH(0xd3, 0x07ffffe0, 27)
HPH(0xd4, 0x07ffffe1, 27)
HPH(0xd6, 0x07ffffe2, 27)
HPH(0xdd, 0x07ffffe3, 27)
HPH(0xde, 0x07ffffe4, 27)
HPH(0xdf, 0x07ffffe5, 27)
HPH(0xf1, 0x07ffffe6, 27)
HPH(0xf4, 0x07ffffe7, 27)
HPH(0xf5, 0x07ffffe8, 27)
HPH(0xf6, 0x07ffffe9, 27)
HPH(0xf7, 0x07ffffea, 27)
HPH(0xf8, 0x07ffffeb, 27)
HPH(0xfa, 0x07ffffec, 27)
HPH(0xfb, 0x07ffffed, 27)
HPH(0xfc, 0x07ffffee, 27)
HPH(0xfd, 0x07ffffef, 27)
HPH(0xfe, 0x07fffff0, 27)
HPH(0x02, 0x0fffffe2, 28)
HPH(0x03, 0x0fffffe3, 28)
HPH(0x04, 0x0fffffe4, 28)
HPH(0x05, 0x0fffffe5, 28)
HPH(0x06, 0x0fffffe6, 28)
HPH(0x07, 0x0fffffe7, 28)
HPH(0x08, 0x0fffffe8, 28)
HPH(0x0b, 0x0fffffe9, 28)
HPH(0x0c, 0x0fffffea, 28)
HPH(0x0e, 0x0fffffeb, 28)
HPH(0x0f, 0x0fffffec, 28)
HPH(0x10, 0x0fffffed, 28)
HPH(0x11, 0x0fffffee, 28)
HPH(0x12, 0x0fffffef, 28)
HPH(0x13, 0x0ffffff0, 28)
HPH(0x14, 0x0ffffff1, 28)
HPH(0x15, 0x0ffffff2, 28)
HPH(0x17, 0x0ffffff3, 28)
HPH(0x18, 0x0ffffff4, 28)
HPH(0x19, 0x0ffffff5, 28)
HPH(0x1a, 0x0ffffff6, 28)
HPH(0x1b, 0x0ffffff7, 28)
HPH(0x1c, 0x0ffffff8, 28)
HPH(0x1d, 0x0ffffff9, 28)
HPH(0x1e, 0x0ffffffa, 28)
HPH(0x1f, 0x0ffffffb, 28)
HPH(0x7f, 0x0ffffffc, 28)
HPH(0xdc, 0x0ffffffd, 28)
HPH(0xf9, 0x0ffffffe, 28)
HPH(0x0a, 0x3ffffffc, 30)
HPH(0x0d, 0x3ffffffd, 30)
HPH(0x16, 0x3ffffffe, 30)
/*-
* Written by Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
*
* This file is in the public domain.
*
* HPACK: Static Table Definition (RFC 7540 Appendix A)
*/
HPS( 1, ":authority", "")
HPS( 2, ":method", "GET")
HPS( 3, ":method", "POST")
HPS( 4, ":path", "/")
HPS( 5, ":path", "/index.html")
HPS( 6, ":scheme", "http")
HPS( 7, ":scheme", "https")
HPS( 8, ":status", "200")
HPS( 9, ":status", "204")
HPS(10, ":status", "206")
HPS(11, ":status", "304")
HPS(12, ":status", "400")
HPS(13, ":status", "404")
HPS(14, ":status", "500")
HPS(15, "accept-charset", "")
HPS(16, "accept-encoding", "gzip, deflate")
HPS(17, "accept-language", "")
HPS(18, "accept-ranges", "")
HPS(19, "accept", "")
HPS(20, "access-control-allow-origin", "")
HPS(21, "age", "")
HPS(22, "allow", "")
HPS(23, "authorization", "")
HPS(24, "cache-control", "")
HPS(25, "content-disposition", "")
HPS(26, "content-encoding", "")
HPS(27, "content-language", "")
HPS(28, "content-length", "")
HPS(29, "content-location", "")
HPS(30, "content-range", "")
HPS(31, "content-type", "")
HPS(32, "cookie", "")
HPS(33, "date", "")
HPS(34, "etag", "")
HPS(35, "expect", "")
HPS(36, "expires", "")
HPS(37, "from", "")
HPS(38, "host", "")
HPS(39, "if-match", "")
HPS(40, "if-modified-since", "")
HPS(41, "if-none-match", "")
HPS(42, "if-range", "")
HPS(43, "if-unmodified-since", "")
HPS(44, "last-modified", "")
HPS(45, "link", "")
HPS(46, "location", "")
HPS(47, "max-forwards", "")
HPS(48, "proxy-authenticate", "")
HPS(49, "proxy-authorization", "")
HPS(50, "range", "")
HPS(51, "referer", "")
HPS(52, "refresh", "")
HPS(53, "retry-after", "")
HPS(54, "server", "")
HPS(55, "set-cookie", "")
HPS(56, "strict-transport-security", "")
HPS(57, "transfer-encoding", "")
HPS(58, "user-agent", "")
HPS(59, "vary", "")
HPS(60, "via", "")
HPS(61, "www-authenticate", "")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment