Chromium Code Reviews| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 SETTINGS_HEADER_TABLE_SIZE = 0x8, | 353 SETTINGS_HEADER_TABLE_SIZE = 0x8, |
| 354 // Whether or not server push (PUSH_PROMISE) is enabled. | 354 // Whether or not server push (PUSH_PROMISE) is enabled. |
| 355 SETTINGS_ENABLE_PUSH = 0x9, | 355 SETTINGS_ENABLE_PUSH = 0x9, |
| 356 }; | 356 }; |
| 357 | 357 |
| 358 // Status codes for RST_STREAM frames. | 358 // Status codes for RST_STREAM frames. |
| 359 enum SpdyRstStreamStatus { | 359 enum SpdyRstStreamStatus { |
| 360 RST_STREAM_INVALID = 0, | 360 RST_STREAM_INVALID = 0, |
| 361 RST_STREAM_PROTOCOL_ERROR = 1, | 361 RST_STREAM_PROTOCOL_ERROR = 1, |
| 362 RST_STREAM_INVALID_STREAM = 2, | 362 RST_STREAM_INVALID_STREAM = 2, |
| 363 RST_STREAM_STREAM_CLOSED = 2, // Equivalent to INVALID_STREAM | |
| 363 RST_STREAM_REFUSED_STREAM = 3, | 364 RST_STREAM_REFUSED_STREAM = 3, |
| 364 RST_STREAM_UNSUPPORTED_VERSION = 4, | 365 RST_STREAM_UNSUPPORTED_VERSION = 4, |
| 365 RST_STREAM_CANCEL = 5, | 366 RST_STREAM_CANCEL = 5, |
| 366 RST_STREAM_INTERNAL_ERROR = 6, | 367 RST_STREAM_INTERNAL_ERROR = 6, |
| 367 RST_STREAM_FLOW_CONTROL_ERROR = 7, | 368 RST_STREAM_FLOW_CONTROL_ERROR = 7, |
| 368 RST_STREAM_STREAM_IN_USE = 8, | 369 RST_STREAM_STREAM_IN_USE = 8, |
| 369 RST_STREAM_STREAM_ALREADY_CLOSED = 9, | 370 RST_STREAM_STREAM_ALREADY_CLOSED = 9, |
| 370 RST_STREAM_INVALID_CREDENTIALS = 10, | 371 RST_STREAM_INVALID_CREDENTIALS = 10, |
| 371 RST_STREAM_FRAME_TOO_LARGE = 11, | 372 RST_STREAM_FRAME_TOO_LARGE = 11, |
| 372 RST_STREAM_NUM_STATUS_CODES = 12 | 373 RST_STREAM_FRAME_SIZE_ERROR = 11, // Equivalent to FRAME_TOO_LARGE |
|
jar (doing other things)
2014/04/22 00:02:59
nit: If you're not going to distigiush them... why
Johnny
2014/04/22 00:31:27
Yea, this is not optimal, but: FRAME_TOO_LARGE is
jar (doing other things)
2014/04/25 16:03:45
OK... good enough. Might be worth a comment... bu
| |
| 374 RST_STREAM_SETTINGS_TIMEOUT = 12, | |
| 375 RST_STREAM_CONNECT_ERROR = 13, | |
| 376 RST_STREAM_ENHANCE_YOUR_CALM = 14, | |
| 377 RST_STREAM_NUM_STATUS_CODES = 15 | |
| 373 }; | 378 }; |
| 374 | 379 |
| 375 // Status codes for GOAWAY frames. | 380 // Status codes for GOAWAY frames. |
| 376 enum SpdyGoAwayStatus { | 381 enum SpdyGoAwayStatus { |
| 377 GOAWAY_INVALID = -1, | 382 GOAWAY_INVALID = -1, |
| 378 GOAWAY_OK = 0, | 383 GOAWAY_OK = 0, |
| 379 GOAWAY_PROTOCOL_ERROR = 1, | 384 GOAWAY_PROTOCOL_ERROR = 1, |
| 380 GOAWAY_INTERNAL_ERROR = 2, | 385 GOAWAY_INTERNAL_ERROR = 2, |
| 381 GOAWAY_NUM_STATUS_CODES = 3 // Must be last. | 386 GOAWAY_NUM_STATUS_CODES = 3 // Must be last. |
| 382 }; | 387 }; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 // version. | 424 // version. |
| 420 // Behavior is undefined for invalid setting id fields; consumers should first | 425 // Behavior is undefined for invalid setting id fields; consumers should first |
| 421 // use IsValidSettingId() to verify validity of setting id fields. | 426 // use IsValidSettingId() to verify validity of setting id fields. |
| 422 static SpdySettingsIds ParseSettingId(SpdyMajorVersion version, | 427 static SpdySettingsIds ParseSettingId(SpdyMajorVersion version, |
| 423 int setting_id_field); | 428 int setting_id_field); |
| 424 | 429 |
| 425 // Serializes a given setting id to the on-the-wire enumeration value for the | 430 // Serializes a given setting id to the on-the-wire enumeration value for the |
| 426 // given protocol version. | 431 // given protocol version. |
| 427 // Returns -1 on failure (I.E. Invalid setting id for the given version). | 432 // Returns -1 on failure (I.E. Invalid setting id for the given version). |
| 428 static int SerializeSettingId(SpdyMajorVersion version, SpdySettingsIds id); | 433 static int SerializeSettingId(SpdyMajorVersion version, SpdySettingsIds id); |
| 434 | |
| 435 // Returns true if a given on-the-wire enumeration of a RST_STREAM status code | |
| 436 // is valid for a given protocol version, false otherwise. | |
| 437 static bool IsValidRstStreamStatus(SpdyMajorVersion version, | |
| 438 int rst_stream_status_field); | |
| 439 | |
| 440 // Parses a RST_STREAM status code from an on-the-wire enumeration of a given | |
| 441 // protocol version. | |
| 442 // Behavior is undefined for invalid RST_STREAM status code fields; consumers | |
| 443 // should first use IsValidRstStreamStatus() to verify validity of RST_STREAM | |
| 444 // status code fields.. | |
| 445 static SpdyRstStreamStatus ParseRstStreamStatus(SpdyMajorVersion version, | |
| 446 int rst_stream_status_field); | |
| 447 | |
| 448 // Serializes a given RST_STREAM status code to the on-the-wire enumeration | |
| 449 // value for the given protocol version. | |
| 450 // Returns -1 on failure (I.E. Invalid RST_STREAM status code for the given | |
| 451 // version). | |
| 452 static int SerializeRstStreamStatus(SpdyMajorVersion version, | |
| 453 SpdyRstStreamStatus rst_stream_status); | |
| 429 }; | 454 }; |
| 430 | 455 |
| 431 class SpdyFrame; | 456 class SpdyFrame; |
| 432 typedef SpdyFrame SpdySerializedFrame; | 457 typedef SpdyFrame SpdySerializedFrame; |
| 433 | 458 |
| 434 class SpdyFrameVisitor; | 459 class SpdyFrameVisitor; |
| 435 | 460 |
| 436 // Intermediate representation for SPDY frames. | 461 // Intermediate representation for SPDY frames. |
| 437 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is | 462 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is |
| 438 // gone. | 463 // gone. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 public: | 654 public: |
| 630 SpdyRstStreamIR(SpdyStreamId stream_id, SpdyRstStreamStatus status, | 655 SpdyRstStreamIR(SpdyStreamId stream_id, SpdyRstStreamStatus status, |
| 631 base::StringPiece description); | 656 base::StringPiece description); |
| 632 | 657 |
| 633 virtual ~SpdyRstStreamIR(); | 658 virtual ~SpdyRstStreamIR(); |
| 634 | 659 |
| 635 SpdyRstStreamStatus status() const { | 660 SpdyRstStreamStatus status() const { |
| 636 return status_; | 661 return status_; |
| 637 } | 662 } |
| 638 void set_status(SpdyRstStreamStatus status) { | 663 void set_status(SpdyRstStreamStatus status) { |
| 639 DCHECK_NE(status, RST_STREAM_INVALID); | |
| 640 DCHECK_LT(status, RST_STREAM_NUM_STATUS_CODES); | |
| 641 status_ = status; | 664 status_ = status; |
| 642 } | 665 } |
| 643 | 666 |
| 644 base::StringPiece description() const { return description_; } | 667 base::StringPiece description() const { return description_; } |
| 645 | 668 |
| 646 void set_description(base::StringPiece description) { | 669 void set_description(base::StringPiece description) { |
| 647 description_ = description; | 670 description_ = description; |
| 648 } | 671 } |
| 649 | 672 |
| 650 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; | 673 virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 915 SpdyFrameVisitor() {} | 938 SpdyFrameVisitor() {} |
| 916 virtual ~SpdyFrameVisitor() {} | 939 virtual ~SpdyFrameVisitor() {} |
| 917 | 940 |
| 918 private: | 941 private: |
| 919 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 942 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
| 920 }; | 943 }; |
| 921 | 944 |
| 922 } // namespace net | 945 } // namespace net |
| 923 | 946 |
| 924 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 947 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |