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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // The major versions of SPDY. Major version differences indicate | 30 // The major versions of SPDY. Major version differences indicate |
31 // framer-layer incompatibility, as opposed to minor version numbers | 31 // framer-layer incompatibility, as opposed to minor version numbers |
32 // which indicate application-layer incompatibility. Do not rely on | 32 // which indicate application-layer incompatibility. Do not rely on |
33 // the mapping from enum value SPDYn to the integer n. | 33 // the mapping from enum value SPDYn to the integer n. |
34 enum SpdyMajorVersion { | 34 enum SpdyMajorVersion { |
35 SPDY2 = 2, | 35 SPDY2 = 2, |
36 SPDY_MIN_VERSION = SPDY2, | 36 SPDY_MIN_VERSION = SPDY2, |
37 SPDY3 = 3, | 37 SPDY3 = 3, |
38 SPDY4 = 4, | 38 SPDY4 = 4, |
39 SPDY5 = 5, | 39 HTTP2 = SPDY4, |
40 SPDY_MAX_VERSION = SPDY5 | 40 SPDY_MAX_VERSION = SPDY4 |
41 }; | 41 }; |
42 | 42 |
43 // A SPDY stream id is a 31 bit entity. | 43 // A SPDY stream id is a 31 bit entity. |
44 typedef uint32 SpdyStreamId; | 44 typedef uint32 SpdyStreamId; |
45 | 45 |
46 // Specifies the stream ID used to denote the current session (for | 46 // Specifies the stream ID used to denote the current session (for |
47 // flow control). | 47 // flow control). |
48 const SpdyStreamId kSessionFlowControlStreamId = 0; | 48 const SpdyStreamId kSessionFlowControlStreamId = 0; |
49 | 49 |
50 // Initial window size for a Spdy stream in bytes. | |
51 const int32 kSpdyStreamInitialWindowSize = 64 * 1024; // 64 KBytes | |
52 | |
53 // The maxmium possible control frame size allowed by the spec. | 50 // The maxmium possible control frame size allowed by the spec. |
54 const int32 kSpdyMaxControlFrameSize = (1 << 24) - 1; | 51 const int32 kSpdyMaxControlFrameSize = (1 << 24) - 1; |
55 | 52 |
56 // The maximum control frame size we accept. | 53 // The maximum control frame size we accept. |
57 const int32 kControlFrameSizeLimit = 1 << 14; | 54 const int32 kControlFrameSizeLimit = 1 << 14; |
58 | 55 |
59 // Initial window size for a Spdy session in bytes. | |
60 const int32 kSpdySessionInitialWindowSize = 64 * 1024; // 64 KBytes | |
61 | |
62 // Maximum window size for a Spdy stream or session. | 56 // Maximum window size for a Spdy stream or session. |
63 const int32 kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int | 57 const int32 kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int |
64 | 58 |
65 // Maximum padding size in octets for one DATA or HEADERS or PUSH_PROMISE frame. | 59 // Maximum padding size in octets for one DATA or HEADERS or PUSH_PROMISE frame. |
66 const int32 kPaddingSizePerFrame = 256; | 60 const int32 kPaddingSizePerFrame = 256; |
67 | 61 |
68 // SPDY 2 dictionary. | 62 // SPDY 2 dictionary. |
69 // This is just a hacked dictionary to use for shrinking HTTP-like headers. | 63 // This is just a hacked dictionary to use for shrinking HTTP-like headers. |
70 const char kV2Dictionary[] = | 64 const char kV2Dictionary[] = |
71 "optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-" | 65 "optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 520 |
527 static size_t GetFrameMaximumSize(SpdyMajorVersion version); | 521 static size_t GetFrameMaximumSize(SpdyMajorVersion version); |
528 | 522 |
529 // Returns the size of a header block size field. Valid only for SPDY | 523 // Returns the size of a header block size field. Valid only for SPDY |
530 // versions <= 3. | 524 // versions <= 3. |
531 static size_t GetSizeOfSizeField(SpdyMajorVersion version); | 525 static size_t GetSizeOfSizeField(SpdyMajorVersion version); |
532 | 526 |
533 // Returns the size (in bytes) of a wire setting ID and value. | 527 // Returns the size (in bytes) of a wire setting ID and value. |
534 static size_t GetSettingSize(SpdyMajorVersion version); | 528 static size_t GetSettingSize(SpdyMajorVersion version); |
535 | 529 |
| 530 // Initial window size for a stream in bytes. |
| 531 static int32 GetInitialStreamWindowSize(SpdyMajorVersion version); |
| 532 |
| 533 // Initial window size for a session in bytes. |
| 534 static int32 GetInitialSessionWindowSize(SpdyMajorVersion version); |
| 535 |
536 static SpdyMajorVersion ParseMajorVersion(int version_number); | 536 static SpdyMajorVersion ParseMajorVersion(int version_number); |
537 | 537 |
538 static int SerializeMajorVersion(SpdyMajorVersion version); | 538 static int SerializeMajorVersion(SpdyMajorVersion version); |
539 | 539 |
540 static std::string GetVersionString(SpdyMajorVersion version); | 540 static std::string GetVersionString(SpdyMajorVersion version); |
541 }; | 541 }; |
542 | 542 |
543 class SpdyFrame; | 543 class SpdyFrame; |
544 typedef SpdyFrame SpdySerializedFrame; | 544 typedef SpdyFrame SpdySerializedFrame; |
545 | 545 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 SpdyFrameVisitor() {} | 1091 SpdyFrameVisitor() {} |
1092 virtual ~SpdyFrameVisitor() {} | 1092 virtual ~SpdyFrameVisitor() {} |
1093 | 1093 |
1094 private: | 1094 private: |
1095 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 1095 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
1096 }; | 1096 }; |
1097 | 1097 |
1098 } // namespace net | 1098 } // namespace net |
1099 | 1099 |
1100 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 1100 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
OLD | NEW |