varnish-cache/include/tbl/h2_frames.h
1
/*-
2
 * Copyright (c) 2016 Varnish Software AS
3
 * All rights reserved.
4
 *
5
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
6
 *
7
 * Redistribution and use in source and binary forms, with or without
8
 * modification, are permitted provided that the following conditions
9
 * are met:
10
 * 1. Redistributions of source code must retain the above copyright
11
 *    notice, this list of conditions and the following disclaimer.
12
 * 2. Redistributions in binary form must reproduce the above copyright
13
 *    notice, this list of conditions and the following disclaimer in the
14
 *    documentation and/or other materials provided with the distribution.
15
 *
16
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
20
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
 * SUCH DAMAGE.
27
 *
28
 * RFC7540 section 11.2
29
 */
30
31
/*lint -save -e525 -e539 */
32
33
#ifdef H2_FRAME
34
/*         lower,               upper,         type, flags
35
 *      rx_stream-zero
36
 *      rx_stream-nonzero
37
 *      rx_stream-idle
38
 *      tx_flow-control                 // rfc7540,l,1265,1270
39
 *      tx_continuation
40
 *      tx_final-flags
41
 *      overhead
42
 */
43 8
  H2_FRAME(data,                DATA,           0x0, 0x09,
44
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,1758,1761
45
        0,
46
        H2CE_PROTOCOL_ERROR,
47
        1,
48
        H2_F_DATA,
49
        0x01,                           // rfc7540,l,1750,1753
50
        0
51
  )
52 47
  H2_FRAME(headers,             HEADERS,        0x1, 0x2d,
53
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,1876,1879
54
        0,
55
        0,                              // rfc7540,l,938,940
56
        0,
57
        H2_F_CONTINUATION,
58
        0x04,                           // rfc7540,l,1855,1857
59
        0
60
  )
61 13
  H2_FRAME(priority,            PRIORITY,       0x2, 0x00,
62
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,1933,1936
63
        0,
64
        0,                              // rfc7540,l,938,940
65
        0,
66
        0,
67
        0,
68
        1
69
  )
70 7
  H2_FRAME(rst_stream,          RST_STREAM,     0x3, 0x00,
71
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,1993,1996
72
        0,
73
        H2CE_PROTOCOL_ERROR,
74
        0,
75
        0,
76
        0,
77
        1
78
  )
79 111
  H2_FRAME(settings,            SETTINGS,       0x4, 0x01,
80
        0,
81
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,2052,2056
82
        H2CE_PROTOCOL_ERROR,
83
        0,
84
        0,
85
        0,
86
        1
87
  )
88 1
  H2_FRAME(push_promise,        PUSH_PROMISE,   0x5, 0x0c,
89
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,2262,2263
90
        0,
91
        H2CE_PROTOCOL_ERROR,
92
        0,
93
        H2_F_CONTINUATION,
94
        0x04,                           // rfc7540,l,2249,2251
95
        2
96
  )
97 6
  H2_FRAME(ping,                PING,           0x6, 0x01,
98
        0,
99
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,2359,2362
100
        H2CE_PROTOCOL_ERROR,
101
        0,
102
        0,
103
        0,
104
        1
105
  )
106 3
  H2_FRAME(goaway,              GOAWAY,         0x7, 0x00,
107
        0,
108
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,2432,2435
109
        H2CE_PROTOCOL_ERROR,
110
        0,
111
        0,
112
        0,
113
        1
114
  )
115 7
  H2_FRAME(window_update,       WINDOW_UPDATE,  0x8, 0x00,
116
        0,
117
        0,
118
        H2CE_PROTOCOL_ERROR,
119
        0,
120
        0,
121
        0,
122
        1
123
  )
124 7
  H2_FRAME(continuation,        CONTINUATION,   0x9, 0x04,
125
        H2CE_PROTOCOL_ERROR,            // rfc7540,l,2764,2767
126
        0,
127
        H2CE_PROTOCOL_ERROR,
128
        0,
129
        H2_F_CONTINUATION,
130
        0x04,                           // rfc7540,l,2753,2754
131
        0
132
  )
133
  #undef H2_FRAME
134
#endif
135
136
#ifdef H2_FRAME_FLAGS
137
/*               lower,                 upper,                          flag */
138
  H2_FRAME_FLAGS(none,                  NONE,                           0x00)
139
  H2_FRAME_FLAGS(data_end_stream,       DATA_END_STREAM,                0x01)
140
  H2_FRAME_FLAGS(data_padded,           DATA_PADDED,                    0x08)
141
  H2_FRAME_FLAGS(headers_end_stream,    HEADERS_END_STREAM,             0x01)
142
  H2_FRAME_FLAGS(headers_end_headers,   HEADERS_END_HEADERS,            0x04)
143
  H2_FRAME_FLAGS(headers_padded,        HEADERS_PADDED,                 0x08)
144
  H2_FRAME_FLAGS(headers_priority,      HEADERS_PRIORITY,               0x20)
145
  H2_FRAME_FLAGS(settings_ack,          SETTINGS_ACK,                   0x01)
146
  H2_FRAME_FLAGS(push_promise_end_headers,PUSH_PROMISE_END_HEADERS,     0x04)
147
  H2_FRAME_FLAGS(push_promise_padded,   PUSH_PROMISE_PADDED,            0x08)
148
  H2_FRAME_FLAGS(ping_ack,              PING_ACK,                       0x01)
149
  H2_FRAME_FLAGS(continuation_end_headers,CONTINUATION_END_HEADERS,     0x04)
150
  #undef H2_FRAME_FLAGS
151
#endif
152
153
/*lint -restore */