Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: net/spdy/spdy_protocol.h

Issue 2544343003: Use wire values in SpdySettingsIds. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains some protocol structures for use with SPDY 3 and HTTP 2 5 // This file contains some protocol structures for use with SPDY 3 and HTTP 2
6 // The SPDY 3 spec can be found at: 6 // The SPDY 3 spec can be found at:
7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3
8 8
9 #ifndef NET_SPDY_SPDY_PROTOCOL_H_ 9 #ifndef NET_SPDY_SPDY_PROTOCOL_H_
10 #define NET_SPDY_SPDY_PROTOCOL_H_ 10 #define NET_SPDY_SPDY_PROTOCOL_H_
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 SETTINGS_FLAG_ACK = 0x01, 127 SETTINGS_FLAG_ACK = 0x01,
128 }; 128 };
129 129
130 // Flags for settings within a SETTINGS frame. 130 // Flags for settings within a SETTINGS frame.
131 enum SpdySettingsFlags { 131 enum SpdySettingsFlags {
132 SETTINGS_FLAG_NONE = 0x00, 132 SETTINGS_FLAG_NONE = 0x00,
133 SETTINGS_FLAG_PLEASE_PERSIST = 0x01, 133 SETTINGS_FLAG_PLEASE_PERSIST = 0x01,
134 SETTINGS_FLAG_PERSISTED = 0x02, 134 SETTINGS_FLAG_PERSISTED = 0x02,
135 }; 135 };
136 136
137 // List of known settings. Avoid changing these enum values, as persisted
138 // settings are keyed on them, and they are also exposed in net-internals.
139 enum SpdySettingsIds { 137 enum SpdySettingsIds {
140 SETTINGS_UPLOAD_BANDWIDTH = 0x1, 138 // HPACK header table maximum size.
141 SETTINGS_DOWNLOAD_BANDWIDTH = 0x2, 139 SETTINGS_HEADER_TABLE_SIZE = 0x1,
142 // Network round trip time in milliseconds. 140 SETTINGS_MIN = SETTINGS_HEADER_TABLE_SIZE,
143 SETTINGS_ROUND_TRIP_TIME = 0x3, 141 // Whether or not server push (PUSH_PROMISE) is enabled.
142 SETTINGS_ENABLE_PUSH = 0x2,
144 // The maximum number of simultaneous live streams in each direction. 143 // The maximum number of simultaneous live streams in each direction.
145 SETTINGS_MAX_CONCURRENT_STREAMS = 0x4, 144 SETTINGS_MAX_CONCURRENT_STREAMS = 0x3,
146 // TCP congestion window in packets.
147 SETTINGS_CURRENT_CWND = 0x5,
148 // Downstream byte retransmission rate in percentage.
149 SETTINGS_DOWNLOAD_RETRANS_RATE = 0x6,
150 // Initial window size in bytes 145 // Initial window size in bytes
151 SETTINGS_INITIAL_WINDOW_SIZE = 0x7, 146 SETTINGS_INITIAL_WINDOW_SIZE = 0x4,
152 // HPACK header table maximum size.
153 SETTINGS_HEADER_TABLE_SIZE = 0x8,
154 // Whether or not server push (PUSH_PROMISE) is enabled.
155 SETTINGS_ENABLE_PUSH = 0x9,
156 // The size of the largest frame payload that a receiver is willing to accept. 147 // The size of the largest frame payload that a receiver is willing to accept.
157 SETTINGS_MAX_FRAME_SIZE = 0xa, 148 SETTINGS_MAX_FRAME_SIZE = 0x5,
158 // The maximum size of header list that the sender is prepared to accept. 149 // The maximum size of header list that the sender is prepared to accept.
159 SETTINGS_MAX_HEADER_LIST_SIZE = 0xb, 150 SETTINGS_MAX_HEADER_LIST_SIZE = 0x6,
151 SETTINGS_MAX = SETTINGS_MAX_HEADER_LIST_SIZE
160 }; 152 };
161 153
162 // Status codes for RST_STREAM frames. 154 // Status codes for RST_STREAM frames.
163 enum SpdyRstStreamStatus { 155 enum SpdyRstStreamStatus {
164 RST_STREAM_NO_ERROR = 0, 156 RST_STREAM_NO_ERROR = 0,
165 RST_STREAM_PROTOCOL_ERROR = 1, 157 RST_STREAM_PROTOCOL_ERROR = 1,
166 RST_STREAM_INVALID_STREAM = 2, 158 RST_STREAM_INVALID_STREAM = 2,
167 RST_STREAM_STREAM_CLOSED = 2, // Equivalent to INVALID_STREAM 159 RST_STREAM_STREAM_CLOSED = 2, // Equivalent to INVALID_STREAM
168 RST_STREAM_REFUSED_STREAM = 3, 160 RST_STREAM_REFUSED_STREAM = 3,
169 RST_STREAM_UNSUPPORTED_VERSION = 4, 161 RST_STREAM_UNSUPPORTED_VERSION = 4,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Serializes a given frame type to the on-the-wire enumeration value. 253 // Serializes a given frame type to the on-the-wire enumeration value.
262 // Returns -1 on failure (I.E. Invalid frame type). 254 // Returns -1 on failure (I.E. Invalid frame type).
263 static int SerializeFrameType(SpdyFrameType frame_type); 255 static int SerializeFrameType(SpdyFrameType frame_type);
264 256
265 // (HTTP/2) All standard frame types except WINDOW_UPDATE are 257 // (HTTP/2) All standard frame types except WINDOW_UPDATE are
266 // (stream-specific xor connection-level). Returns false iff we know 258 // (stream-specific xor connection-level). Returns false iff we know
267 // the given frame type does not align with the given streamID. 259 // the given frame type does not align with the given streamID.
268 static bool IsValidHTTP2FrameStreamId(SpdyStreamId current_frame_stream_id, 260 static bool IsValidHTTP2FrameStreamId(SpdyStreamId current_frame_stream_id,
269 SpdyFrameType frame_type_field); 261 SpdyFrameType frame_type_field);
270 262
271 // Returns true if a given on-the-wire enumeration of a setting id is valid 263 // If |wire_setting_id| is the on-the-wire representation of a defined
272 // false otherwise. 264 // SETTINGS parameter, parse it to |*setting_id| and return true.
273 static bool IsValidSettingId(int setting_id_field); 265 static bool ParseSettingsId(int wire_setting_id, SpdySettingsIds* setting_id);
274 266
275 // Parses a setting id from an on-the-wire enumeration 267 // Return if |id| corresponds to a defined setting; stringify |id| to
276 // Behavior is undefined for invalid setting id fields; consumers should first 268 // |*settings_id_string| regardless.
277 // use IsValidSettingId() to verify validity of setting id fields. 269 static bool SettingsIdToString(SpdySettingsIds id,
278 static SpdySettingsIds ParseSettingId(int setting_id_field); 270 const char** settings_id_string);
279
280 // Serializes a given setting id to the on-the-wire enumeration value.
281 // Returns -1 on failure (I.E. Invalid setting id).
282 static int SerializeSettingId(SpdySettingsIds id);
283 271
284 // Returns true if a given on-the-wire enumeration of a RST_STREAM status code 272 // Returns true if a given on-the-wire enumeration of a RST_STREAM status code
285 // is valid, false otherwise. 273 // is valid, false otherwise.
286 static bool IsValidRstStreamStatus(int rst_stream_status_field); 274 static bool IsValidRstStreamStatus(int rst_stream_status_field);
287 275
288 // Parses a RST_STREAM status code from an on-the-wire enumeration. 276 // Parses a RST_STREAM status code from an on-the-wire enumeration.
289 // Behavior is undefined for invalid RST_STREAM status code fields; consumers 277 // Behavior is undefined for invalid RST_STREAM status code fields; consumers
290 // should first use IsValidRstStreamStatus() to verify validity of RST_STREAM 278 // should first use IsValidRstStreamStatus() to verify validity of RST_STREAM
291 // status code fields.. 279 // status code fields..
292 static SpdyRstStreamStatus ParseRstStreamStatus(int rst_stream_status_field); 280 static SpdyRstStreamStatus ParseRstStreamStatus(int rst_stream_status_field);
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 SpdyFrameVisitor() {} 974 SpdyFrameVisitor() {}
987 virtual ~SpdyFrameVisitor() {} 975 virtual ~SpdyFrameVisitor() {}
988 976
989 private: 977 private:
990 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); 978 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor);
991 }; 979 };
992 980
993 } // namespace net 981 } // namespace net
994 982
995 #endif // NET_SPDY_SPDY_PROTOCOL_H_ 983 #endif // NET_SPDY_SPDY_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698