| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 RST_STREAM_FRAME_TOO_LARGE = 11, | 372 RST_STREAM_FRAME_TOO_LARGE = 11, |
| 373 RST_STREAM_FRAME_SIZE_ERROR = 11, // Equivalent to FRAME_TOO_LARGE | 373 RST_STREAM_FRAME_SIZE_ERROR = 11, // Equivalent to FRAME_TOO_LARGE |
| 374 RST_STREAM_SETTINGS_TIMEOUT = 12, | 374 RST_STREAM_SETTINGS_TIMEOUT = 12, |
| 375 RST_STREAM_CONNECT_ERROR = 13, | 375 RST_STREAM_CONNECT_ERROR = 13, |
| 376 RST_STREAM_ENHANCE_YOUR_CALM = 14, | 376 RST_STREAM_ENHANCE_YOUR_CALM = 14, |
| 377 RST_STREAM_NUM_STATUS_CODES = 15 | 377 RST_STREAM_NUM_STATUS_CODES = 15 |
| 378 }; | 378 }; |
| 379 | 379 |
| 380 // Status codes for GOAWAY frames. | 380 // Status codes for GOAWAY frames. |
| 381 enum SpdyGoAwayStatus { | 381 enum SpdyGoAwayStatus { |
| 382 GOAWAY_INVALID = -1, | |
| 383 GOAWAY_OK = 0, | 382 GOAWAY_OK = 0, |
| 383 GOAWAY_NO_ERROR = GOAWAY_OK, |
| 384 GOAWAY_PROTOCOL_ERROR = 1, | 384 GOAWAY_PROTOCOL_ERROR = 1, |
| 385 GOAWAY_INTERNAL_ERROR = 2, | 385 GOAWAY_INTERNAL_ERROR = 2, |
| 386 GOAWAY_NUM_STATUS_CODES = 3 // Must be last. | 386 GOAWAY_FLOW_CONTROL_ERROR = 3, |
| 387 GOAWAY_SETTINGS_TIMEOUT = 4, |
| 388 GOAWAY_STREAM_CLOSED = 5, |
| 389 GOAWAY_FRAME_SIZE_ERROR = 6, |
| 390 GOAWAY_REFUSED_STREAM = 7, |
| 391 GOAWAY_CANCEL = 8, |
| 392 GOAWAY_COMPRESSION_ERROR = 9, |
| 393 GOAWAY_CONNECT_ERROR = 10, |
| 394 GOAWAY_ENHANCE_YOUR_CALM = 11, |
| 395 GOAWAY_INADEQUATE_SECURITY = 12 |
| 387 }; | 396 }; |
| 388 | 397 |
| 389 // A SPDY priority is a number between 0 and 7 (inclusive). | 398 // A SPDY priority is a number between 0 and 7 (inclusive). |
| 390 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a | 399 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a |
| 391 // number between 0 and 3. | 400 // number between 0 and 3. |
| 392 typedef uint8 SpdyPriority; | 401 typedef uint8 SpdyPriority; |
| 393 | 402 |
| 394 typedef std::map<std::string, std::string> SpdyNameValueBlock; | 403 typedef std::map<std::string, std::string> SpdyNameValueBlock; |
| 395 | 404 |
| 396 typedef uint64 SpdyPingId; | 405 typedef uint64 SpdyPingId; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 // status code fields.. | 453 // status code fields.. |
| 445 static SpdyRstStreamStatus ParseRstStreamStatus(SpdyMajorVersion version, | 454 static SpdyRstStreamStatus ParseRstStreamStatus(SpdyMajorVersion version, |
| 446 int rst_stream_status_field); | 455 int rst_stream_status_field); |
| 447 | 456 |
| 448 // Serializes a given RST_STREAM status code to the on-the-wire enumeration | 457 // Serializes a given RST_STREAM status code to the on-the-wire enumeration |
| 449 // value for the given protocol version. | 458 // value for the given protocol version. |
| 450 // Returns -1 on failure (I.E. Invalid RST_STREAM status code for the given | 459 // Returns -1 on failure (I.E. Invalid RST_STREAM status code for the given |
| 451 // version). | 460 // version). |
| 452 static int SerializeRstStreamStatus(SpdyMajorVersion version, | 461 static int SerializeRstStreamStatus(SpdyMajorVersion version, |
| 453 SpdyRstStreamStatus rst_stream_status); | 462 SpdyRstStreamStatus rst_stream_status); |
| 463 |
| 464 // Returns true if a given on-the-wire enumeration of a GOAWAY status code is |
| 465 // valid for the given protocol version, false otherwise. |
| 466 static bool IsValidGoAwayStatus(SpdyMajorVersion version, |
| 467 int goaway_status_field); |
| 468 |
| 469 // Parses a GOAWAY status from an on-the-wire enumeration of a given protocol |
| 470 // version. |
| 471 // Behavior is undefined for invalid GOAWAY status fields; consumers should |
| 472 // first use IsValidGoAwayStatus() to verify validity of GOAWAY status fields. |
| 473 static SpdyGoAwayStatus ParseGoAwayStatus(SpdyMajorVersion version, |
| 474 int goaway_status_field); |
| 475 |
| 476 // Serializes a given GOAWAY status to the on-the-wire enumeration value for |
| 477 // the given protocol version. |
| 478 // Returns -1 on failure (I.E. Invalid GOAWAY status for the given version). |
| 479 static int SerializeGoAwayStatus(SpdyMajorVersion version, |
| 480 SpdyGoAwayStatus status); |
| 454 }; | 481 }; |
| 455 | 482 |
| 456 class SpdyFrame; | 483 class SpdyFrame; |
| 457 typedef SpdyFrame SpdySerializedFrame; | 484 typedef SpdyFrame SpdySerializedFrame; |
| 458 | 485 |
| 459 class SpdyFrameVisitor; | 486 class SpdyFrameVisitor; |
| 460 | 487 |
| 461 // Intermediate representation for SPDY frames. | 488 // Intermediate representation for SPDY frames. |
| 462 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is | 489 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is |
| 463 // gone. | 490 // gone. |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 SpdyFrameVisitor() {} | 965 SpdyFrameVisitor() {} |
| 939 virtual ~SpdyFrameVisitor() {} | 966 virtual ~SpdyFrameVisitor() {} |
| 940 | 967 |
| 941 private: | 968 private: |
| 942 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 969 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
| 943 }; | 970 }; |
| 944 | 971 |
| 945 } // namespace net | 972 } // namespace net |
| 946 | 973 |
| 947 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 974 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |