GRPC Core 0.10.0.0

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
frame_settings.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34 #ifndef GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H
35 #define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H
36
37 #include <grpc/support/port_platform.h>
38 #include <grpc/support/slice.h>
39 #include "src/core/transport/chttp2/frame.h"
40
41 typedef enum {
42 GRPC_CHTTP2_SPS_ID0,
43 GRPC_CHTTP2_SPS_ID1,
44 GRPC_CHTTP2_SPS_VAL0,
45 GRPC_CHTTP2_SPS_VAL1,
46 GRPC_CHTTP2_SPS_VAL2,
47 GRPC_CHTTP2_SPS_VAL3
48 } grpc_chttp2_settings_parse_state;
49
50 /* The things HTTP/2 defines as connection level settings */
51 typedef enum {
52 GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,
53 GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 2,
54 GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 3,
55 GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 4,
56 GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 5,
57 GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 6,
58 GRPC_CHTTP2_NUM_SETTINGS
59 } grpc_chttp2_setting_id;
60
61 typedef struct {
62 grpc_chttp2_settings_parse_state state;
63 gpr_uint32 *target_settings;
64 gpr_uint8 is_ack;
65 gpr_uint16 id;
66 gpr_uint32 value;
67 gpr_uint32 incoming_settings[GRPC_CHTTP2_NUM_SETTINGS];
68 } grpc_chttp2_settings_parser;
69
70 typedef enum {
71 GRPC_CHTTP2_CLAMP_INVALID_VALUE,
72 GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE
73 } grpc_chttp2_invalid_value_behavior;
74
75 typedef struct {
76 const char *name;
77 gpr_uint32 default_value;
78 gpr_uint32 min_value;
79 gpr_uint32 max_value;
80 grpc_chttp2_invalid_value_behavior invalid_value_behavior;
81 } grpc_chttp2_setting_parameters;
82
83 /* HTTP/2 mandated connection setting parameters */
84 extern const grpc_chttp2_setting_parameters
85 grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS];
86
87 /* Create a settings frame by diffing old & new, and updating old to be new */
88 gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new,
89 gpr_uint32 force_mask, size_t count);
90 /* Create an ack settings frame */
91 gpr_slice grpc_chttp2_settings_ack_create(void);
92
93 grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame(
94 grpc_chttp2_settings_parser *parser, gpr_uint32 length, gpr_uint8 flags,
95 gpr_uint32 *settings);
96 grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
97 void *parser, grpc_chttp2_transport_parsing *transport_parsing,
98 grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
99
100 #endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H */
grpc_chttp2_settings_parameters
const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]
Definition: frame_settings.c:47
GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE
Definition: frame_settings.h:56
port_platform.h
gpr_uint8
uint8_t gpr_uint8
Definition: port_platform.h:307
GRPC_CHTTP2_SPS_ID1
Definition: frame_settings.h:43
GRPC_CHTTP2_CLAMP_INVALID_VALUE
Definition: frame_settings.h:71
GRPC_CHTTP2_SETTINGS_ENABLE_PUSH
Definition: frame_settings.h:53
grpc_chttp2_setting_parameters::invalid_value_behavior
grpc_chttp2_invalid_value_behavior invalid_value_behavior
Definition: frame_settings.h:80
grpc_chttp2_setting_parameters::name
const char * name
Definition: frame_settings.h:76
grpc_chttp2_settings_parser_begin_frame
grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame(grpc_chttp2_settings_parser *parser, gpr_uint32 length, gpr_uint8 flags, gpr_uint32 *settings)
Definition: frame_settings.c:114
GRPC_CHTTP2_SPS_VAL2
Definition: frame_settings.h:46
grpc_chttp2_settings_parser::target_settings
gpr_uint32 * target_settings
Definition: frame_settings.h:63
grpc_chttp2_parse_error
grpc_chttp2_parse_error
Definition: frame.h:42
gpr_uint32
uint32_t gpr_uint32
Definition: port_platform.h:309
GRPC_CHTTP2_SPS_VAL0
Definition: frame_settings.h:44
grpc_chttp2_settings_ack_create
gpr_slice grpc_chttp2_settings_ack_create(void)
Definition: frame_settings.c:108
grpc_chttp2_settings_parse_state
grpc_chttp2_settings_parse_state
Definition: frame_settings.h:41
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
Definition: frame_settings.h:55
grpc_chttp2_settings_parser::is_ack
gpr_uint8 is_ack
Definition: frame_settings.h:64
frame.h
grpc_chttp2_setting_parameters::default_value
gpr_uint32 default_value
Definition: frame_settings.h:77
GRPC_CHTTP2_SPS_ID0
Definition: frame_settings.h:42
GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE
Definition: frame_settings.h:52
grpc_chttp2_settings_parser::id
gpr_uint16 id
Definition: frame_settings.h:65
GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
Definition: frame_settings.h:54
grpc_chttp2_transport_parsing
Definition: internal.h:215
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE
Definition: frame_settings.h:72
gpr_uint16
uint16_t gpr_uint16
Definition: port_platform.h:308
GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
Definition: frame_settings.h:57
grpc_chttp2_setting_parameters::max_value
gpr_uint32 max_value
Definition: frame_settings.h:79
grpc_chttp2_settings_create
gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new, gpr_uint32 force_mask, size_t count)
Definition: frame_settings.c:76
GRPC_CHTTP2_NUM_SETTINGS
Definition: frame_settings.h:58
grpc_chttp2_stream_parsing
Definition: internal.h:412
grpc_chttp2_settings_parser::value
gpr_uint32 value
Definition: frame_settings.h:66
grpc_chttp2_setting_parameters
Definition: frame_settings.h:75
grpc_chttp2_settings_parser
Definition: frame_settings.h:61
slice.h
GRPC_CHTTP2_SPS_VAL1
Definition: frame_settings.h:45
grpc_chttp2_setting_parameters::min_value
gpr_uint32 min_value
Definition: frame_settings.h:78
grpc_chttp2_setting_id
grpc_chttp2_setting_id
Definition: frame_settings.h:51
grpc_chttp2_invalid_value_behavior
grpc_chttp2_invalid_value_behavior
Definition: frame_settings.h:70
grpc_chttp2_settings_parser_parse
grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(void *parser, grpc_chttp2_transport_parsing *transport_parsing, grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last)
Definition: frame_settings.c:140
grpc_chttp2_settings_parser::state
grpc_chttp2_settings_parse_state state
Definition: frame_settings.h:62
GRPC_CHTTP2_SPS_VAL3
Definition: frame_settings.h:47
gpr_slice
Definition: slice.h:79