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 10 matching lines...) Expand all Loading... |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "base/strings/string_piece.h" | 22 #include "base/strings/string_piece.h" |
23 #include "base/sys_byteorder.h" | 23 #include "base/sys_byteorder.h" |
24 #include "net/base/net_export.h" | 24 #include "net/base/net_export.h" |
25 #include "net/spdy/spdy_bitmasks.h" | 25 #include "net/spdy/spdy_bitmasks.h" |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 | 28 |
29 // The major versions of SPDY. Major version differences indicate | 29 // The major versions of SPDY. Major version differences indicate |
30 // framer-layer incompatibility, as opposed to minor version numbers | 30 // framer-layer incompatibility, as opposed to minor version numbers |
31 // which indicate application-layer incompatibility. It is guaranteed | 31 // which indicate application-layer incompatibility. Do not rely on |
32 // that the enum value SPDYn maps to the integer n. | 32 // the mapping from enum value SPDYn to the integer n. |
33 enum SpdyMajorVersion { | 33 enum SpdyMajorVersion { |
34 SPDY2 = 2, | 34 SPDY2 = 2, |
35 SPDY_MIN_VERSION = SPDY2, | 35 SPDY_MIN_VERSION = SPDY2, |
36 SPDY3 = 3, | 36 SPDY3 = 3, |
37 SPDY4 = 4, | 37 SPDY4 = 4, |
38 SPDY_MAX_VERSION = SPDY4 | 38 SPDY5 = 5, |
| 39 SPDY_MAX_VERSION = SPDY5 |
39 }; | 40 }; |
40 | 41 |
41 // A SPDY stream id is a 31 bit entity. | 42 // A SPDY stream id is a 31 bit entity. |
42 typedef uint32 SpdyStreamId; | 43 typedef uint32 SpdyStreamId; |
43 | 44 |
44 // Specifies the stream ID used to denote the current session (for | 45 // Specifies the stream ID used to denote the current session (for |
45 // flow control). | 46 // flow control). |
46 const SpdyStreamId kSessionFlowControlStreamId = 0; | 47 const SpdyStreamId kSessionFlowControlStreamId = 0; |
47 | 48 |
48 // Initial window size for a Spdy stream in bytes. | 49 // Initial window size for a Spdy stream in bytes. |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // will likely vary this, so we allow for the flexibility of a function call | 484 // will likely vary this, so we allow for the flexibility of a function call |
484 // for this value as opposed to a constant. | 485 // for this value as opposed to a constant. |
485 static size_t GetDataFrameMinimumSize(); | 486 static size_t GetDataFrameMinimumSize(); |
486 | 487 |
487 // Size, in bytes, of the control frame header. | 488 // Size, in bytes, of the control frame header. |
488 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version); | 489 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version); |
489 | 490 |
490 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version); | 491 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version); |
491 | 492 |
492 static size_t GetFrameMaximumSize(SpdyMajorVersion version); | 493 static size_t GetFrameMaximumSize(SpdyMajorVersion version); |
| 494 |
| 495 static SpdyMajorVersion ParseMajorVersion(int version_number); |
| 496 |
| 497 static int SerializeMajorVersion(SpdyMajorVersion version); |
| 498 |
| 499 static std::string GetVersionString(SpdyMajorVersion version); |
493 }; | 500 }; |
494 | 501 |
495 class SpdyFrame; | 502 class SpdyFrame; |
496 typedef SpdyFrame SpdySerializedFrame; | 503 typedef SpdyFrame SpdySerializedFrame; |
497 | 504 |
498 class SpdyFrameVisitor; | 505 class SpdyFrameVisitor; |
499 | 506 |
500 // Intermediate representation for SPDY frames. | 507 // Intermediate representation for SPDY frames. |
501 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is | 508 // TODO(hkhalil): Rename this class to SpdyFrame when the existing SpdyFrame is |
502 // gone. | 509 // gone. |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 SpdyFrameVisitor() {} | 984 SpdyFrameVisitor() {} |
978 virtual ~SpdyFrameVisitor() {} | 985 virtual ~SpdyFrameVisitor() {} |
979 | 986 |
980 private: | 987 private: |
981 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 988 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
982 }; | 989 }; |
983 | 990 |
984 } // namespace net | 991 } // namespace net |
985 | 992 |
986 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 993 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |