| OLD | NEW |
| 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 2 and 3 | 5 // This file contains some protocol structures for use with SPDY 2 and 3 |
| 6 // The SPDY 2 spec can be found at: | 6 // The SPDY 2 spec can be found at: |
| 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 | 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 |
| 8 // The SPDY 3 spec can be found at: | 8 // The SPDY 3 spec can be found at: |
| 9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 | 9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 |
| 10 | 10 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 const char kHttp2ConnectionHeaderPrefix[] = { | 265 const char kHttp2ConnectionHeaderPrefix[] = { |
| 266 0x50, 0x52, 0x49, 0x20, 0x2a, 0x20, 0x48, 0x54, // PRI * HT | 266 0x50, 0x52, 0x49, 0x20, 0x2a, 0x20, 0x48, 0x54, // PRI * HT |
| 267 0x54, 0x50, 0x2f, 0x32, 0x2e, 0x30, 0x0d, 0x0a, // TP/2.0.. | 267 0x54, 0x50, 0x2f, 0x32, 0x2e, 0x30, 0x0d, 0x0a, // TP/2.0.. |
| 268 0x0d, 0x0a, 0x53, 0x4d, 0x0d, 0x0a, 0x0d, 0x0a // ..SM.... | 268 0x0d, 0x0a, 0x53, 0x4d, 0x0d, 0x0a, 0x0d, 0x0a // ..SM.... |
| 269 }; | 269 }; |
| 270 const int kHttp2ConnectionHeaderPrefixSize = | 270 const int kHttp2ConnectionHeaderPrefixSize = |
| 271 arraysize(kHttp2ConnectionHeaderPrefix); | 271 arraysize(kHttp2ConnectionHeaderPrefix); |
| 272 | 272 |
| 273 // Types of SPDY frames. | 273 // Types of SPDY frames. |
| 274 enum SpdyFrameType { | 274 enum SpdyFrameType { |
| 275 DATA = 0, | 275 DATA, |
| 276 SYN_STREAM = 1, | 276 SYN_STREAM, |
| 277 FIRST_CONTROL_TYPE = SYN_STREAM, | |
| 278 SYN_REPLY, | 277 SYN_REPLY, |
| 279 RST_STREAM, | 278 RST_STREAM, |
| 280 SETTINGS, | 279 SETTINGS, |
| 281 NOOP, // Because it is valid in SPDY/2, kept for identifiability/enum order. | |
| 282 PING, | 280 PING, |
| 283 GOAWAY, | 281 GOAWAY, |
| 284 HEADERS, | 282 HEADERS, |
| 285 WINDOW_UPDATE, | 283 WINDOW_UPDATE, |
| 286 CREDENTIAL, // No longer valid. Kept for identifiability/enum order. | 284 CREDENTIAL = 10, // No longer valid. Kept for identifiability. |
| 287 BLOCKED, | 285 BLOCKED, |
| 288 PUSH_PROMISE, | 286 PUSH_PROMISE, |
| 289 CONTINUATION, | 287 CONTINUATION, |
| 290 ALTSVC, | 288 ALTSVC, |
| 291 PRIORITY, | 289 PRIORITY |
| 292 LAST_CONTROL_TYPE = PRIORITY | |
| 293 }; | 290 }; |
| 294 | 291 |
| 295 // Flags on data packets. | 292 // Flags on data packets. |
| 296 enum SpdyDataFlags { | 293 enum SpdyDataFlags { |
| 297 DATA_FLAG_NONE = 0x00, | 294 DATA_FLAG_NONE = 0x00, |
| 298 DATA_FLAG_FIN = 0x01, | 295 DATA_FLAG_FIN = 0x01, |
| 299 DATA_FLAG_END_SEGMENT = 0x02, | 296 DATA_FLAG_END_SEGMENT = 0x02, |
| 300 DATA_FLAG_PAD_LOW = 0x08, | 297 DATA_FLAG_PAD_LOW = 0x08, |
| 301 DATA_FLAG_PAD_HIGH = 0x10, | 298 DATA_FLAG_PAD_HIGH = 0x10, |
| 302 DATA_FLAG_COMPRESSED = 0x20, | 299 DATA_FLAG_COMPRESSED = 0x20, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 // use IsValidFrameType() to verify validity of frame type fields. | 430 // use IsValidFrameType() to verify validity of frame type fields. |
| 434 static SpdyFrameType ParseFrameType(SpdyMajorVersion version, | 431 static SpdyFrameType ParseFrameType(SpdyMajorVersion version, |
| 435 int frame_type_field); | 432 int frame_type_field); |
| 436 | 433 |
| 437 // Serializes a given frame type to the on-the-wire enumeration value for the | 434 // Serializes a given frame type to the on-the-wire enumeration value for the |
| 438 // given protocol version. | 435 // given protocol version. |
| 439 // Returns -1 on failure (I.E. Invalid frame type for the given version). | 436 // Returns -1 on failure (I.E. Invalid frame type for the given version). |
| 440 static int SerializeFrameType(SpdyMajorVersion version, | 437 static int SerializeFrameType(SpdyMajorVersion version, |
| 441 SpdyFrameType frame_type); | 438 SpdyFrameType frame_type); |
| 442 | 439 |
| 440 // Returns the frame type for non-control (i.e. data) frames |
| 441 // in the given SPDY version. |
| 442 static int DataFrameType(SpdyMajorVersion version); |
| 443 |
| 443 // Returns true if a given on-the-wire enumeration of a setting id is valid | 444 // Returns true if a given on-the-wire enumeration of a setting id is valid |
| 444 // for a given protocol version, false otherwise. | 445 // for a given protocol version, false otherwise. |
| 445 static bool IsValidSettingId(SpdyMajorVersion version, int setting_id_field); | 446 static bool IsValidSettingId(SpdyMajorVersion version, int setting_id_field); |
| 446 | 447 |
| 447 // Parses a setting id from an on-the-wire enumeration of a given protocol | 448 // Parses a setting id from an on-the-wire enumeration of a given protocol |
| 448 // version. | 449 // version. |
| 449 // Behavior is undefined for invalid setting id fields; consumers should first | 450 // Behavior is undefined for invalid setting id fields; consumers should first |
| 450 // use IsValidSettingId() to verify validity of setting id fields. | 451 // use IsValidSettingId() to verify validity of setting id fields. |
| 451 static SpdySettingsIds ParseSettingId(SpdyMajorVersion version, | 452 static SpdySettingsIds ParseSettingId(SpdyMajorVersion version, |
| 452 int setting_id_field); | 453 int setting_id_field); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 SpdyFrameVisitor() {} | 1029 SpdyFrameVisitor() {} |
| 1029 virtual ~SpdyFrameVisitor() {} | 1030 virtual ~SpdyFrameVisitor() {} |
| 1030 | 1031 |
| 1031 private: | 1032 private: |
| 1032 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 1033 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
| 1033 }; | 1034 }; |
| 1034 | 1035 |
| 1035 } // namespace net | 1036 } // namespace net |
| 1036 | 1037 |
| 1037 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 1038 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |