Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: net/spdy/spdy_protocol.h

Issue 1561203003: Remove SPDY/2 code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #3. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3 and HTTP 2
6 // The SPDY 2 spec can be found at:
7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2
8 // The SPDY 3 spec can be found at: 6 // The SPDY 3 spec can be found at:
9 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3
10 8
11 #ifndef NET_SPDY_SPDY_PROTOCOL_H_ 9 #ifndef NET_SPDY_SPDY_PROTOCOL_H_
12 #define NET_SPDY_SPDY_PROTOCOL_H_ 10 #define NET_SPDY_SPDY_PROTOCOL_H_
13 11
14 #include <stddef.h> 12 #include <stddef.h>
15 #include <stdint.h> 13 #include <stdint.h>
16 14
17 #include <limits> 15 #include <limits>
18 #include <map> 16 #include <map>
19 #include <string> 17 #include <string>
20 18
21 #include "base/compiler_specific.h" 19 #include "base/compiler_specific.h"
22 #include "base/logging.h" 20 #include "base/logging.h"
23 #include "base/macros.h" 21 #include "base/macros.h"
24 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
25 #include "base/strings/string_piece.h" 23 #include "base/strings/string_piece.h"
26 #include "base/sys_byteorder.h" 24 #include "base/sys_byteorder.h"
27 #include "net/base/net_export.h" 25 #include "net/base/net_export.h"
28 #include "net/spdy/spdy_alt_svc_wire_format.h" 26 #include "net/spdy/spdy_alt_svc_wire_format.h"
29 #include "net/spdy/spdy_bitmasks.h" 27 #include "net/spdy/spdy_bitmasks.h"
30 #include "net/spdy/spdy_header_block.h" 28 #include "net/spdy/spdy_header_block.h"
31 29
32 namespace net { 30 namespace net {
33 31
34 // The major versions of SPDY. Major version differences indicate 32 // The major versions of SPDY. Major version differences indicate
35 // framer-layer incompatibility, as opposed to minor version numbers 33 // framer-layer incompatibility, as opposed to minor version numbers
36 // which indicate application-layer incompatibility. Do not rely on 34 // which indicate application-layer incompatibility. It is NOT guaranteed
37 // the mapping from enum value SPDYn to the integer n. 35 // that the enum value SPDYn maps to the integer n.
38 enum SpdyMajorVersion { 36 enum SpdyMajorVersion {
39 SPDY2 = 2, 37 SPDY3 = 1,
40 SPDY_MIN_VERSION = SPDY2, 38 SPDY_MIN_VERSION = SPDY3,
41 SPDY3 = 3, 39 HTTP2,
42 HTTP2 = 4,
43 SPDY_MAX_VERSION = HTTP2 40 SPDY_MAX_VERSION = HTTP2
44 }; 41 };
45 42
46 // A SPDY stream id is a 31 bit entity. 43 // A SPDY stream id is a 31 bit entity.
47 typedef uint32_t SpdyStreamId; 44 typedef uint32_t SpdyStreamId;
48 45
49 // Specifies the stream ID used to denote the current session (for 46 // Specifies the stream ID used to denote the current session (for
50 // flow control). 47 // flow control).
51 const SpdyStreamId kSessionFlowControlStreamId = 0; 48 const SpdyStreamId kSessionFlowControlStreamId = 0;
52 49
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_t kSpdyMaxControlFrameSize = (1 << 24) - 1; 51 const int32_t 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_t kControlFrameSizeLimit = 1 << 14; 54 const int32_t kControlFrameSizeLimit = 1 << 14;
58 55
59 // Maximum window size for a Spdy stream or session. 56 // Maximum window size for a Spdy stream or session.
60 const int32_t kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int 57 const int32_t kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int
61 58
62 // 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.
63 const int32_t kPaddingSizePerFrame = 256; 60 const int32_t kPaddingSizePerFrame = 256;
64 61
65 // SPDY 2 dictionary.
66 // This is just a hacked dictionary to use for shrinking HTTP-like headers.
67 const char kV2Dictionary[] =
68 "optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-"
69 "languageauthorizationexpectfromhostif-modified-sinceif-matchif-none-matchi"
70 "f-rangeif-unmodifiedsincemax-forwardsproxy-authorizationrangerefererteuser"
71 "-agent10010120020120220320420520630030130230330430530630740040140240340440"
72 "5406407408409410411412413414415416417500501502503504505accept-rangesageeta"
73 "glocationproxy-authenticatepublicretry-afterservervarywarningwww-authentic"
74 "ateallowcontent-basecontent-encodingcache-controlconnectiondatetrailertran"
75 "sfer-encodingupgradeviawarningcontent-languagecontent-lengthcontent-locati"
76 "oncontent-md5content-rangecontent-typeetagexpireslast-modifiedset-cookieMo"
77 "ndayTuesdayWednesdayThursdayFridaySaturdaySundayJanFebMarAprMayJunJulAugSe"
78 "pOctNovDecchunkedtext/htmlimage/pngimage/jpgimage/gifapplication/xmlapplic"
79 "ation/xhtmltext/plainpublicmax-agecharset=iso-8859-1utf-8gzipdeflateHTTP/1"
80 ".1statusversionurl";
81 const int kV2DictionarySize = arraysize(kV2Dictionary);
82
83 // SPDY 3 dictionary. 62 // SPDY 3 dictionary.
84 const char kV3Dictionary[] = { 63 const char kV3Dictionary[] = {
85 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // ....opti 64 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // ....opti
86 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // ons....h 65 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // ons....h
87 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // ead....p 66 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // ead....p
88 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // ost....p 67 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // ost....p
89 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // ut....de 68 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // ut....de
90 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // lete.... 69 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // lete....
91 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // trace... 70 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // trace...
92 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // .accept. 71 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // .accept.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 GOAWAY_REFUSED_STREAM = 7, 390 GOAWAY_REFUSED_STREAM = 7,
412 GOAWAY_CANCEL = 8, 391 GOAWAY_CANCEL = 8,
413 GOAWAY_COMPRESSION_ERROR = 9, 392 GOAWAY_COMPRESSION_ERROR = 9,
414 GOAWAY_CONNECT_ERROR = 10, 393 GOAWAY_CONNECT_ERROR = 10,
415 GOAWAY_ENHANCE_YOUR_CALM = 11, 394 GOAWAY_ENHANCE_YOUR_CALM = 11,
416 GOAWAY_INADEQUATE_SECURITY = 12, 395 GOAWAY_INADEQUATE_SECURITY = 12,
417 GOAWAY_HTTP_1_1_REQUIRED = 13 396 GOAWAY_HTTP_1_1_REQUIRED = 13
418 }; 397 };
419 398
420 // A SPDY priority is a number between 0 and 7 (inclusive). 399 // A SPDY priority is a number between 0 and 7 (inclusive).
421 // SPDY priority range is version-dependent. For SPDY 2 and below, priority is a
422 // number between 0 and 3.
423 typedef uint8_t SpdyPriority; 400 typedef uint8_t SpdyPriority;
424 401
425 // Lowest and Highest here refer to SPDY priorities as described in 402 // Lowest and Highest here refer to SPDY priorities as described in
426 403
427 // https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1#TOC-2.3.3- Stream-priority 404 // https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1#TOC-2.3.3- Stream-priority
428 const SpdyPriority kV3HighestPriority = 0; 405 const SpdyPriority kV3HighestPriority = 0;
429 const SpdyPriority kV3LowestPriority = 7; 406 const SpdyPriority kV3LowestPriority = 7;
430 407
431 typedef uint64_t SpdyPingId; 408 typedef uint64_t SpdyPingId;
432 409
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // for this value as opposed to a constant. 499 // for this value as opposed to a constant.
523 static size_t GetDataFrameMinimumSize(SpdyMajorVersion version); 500 static size_t GetDataFrameMinimumSize(SpdyMajorVersion version);
524 501
525 // Size, in bytes, of the control frame header. 502 // Size, in bytes, of the control frame header.
526 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version); 503 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version);
527 504
528 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version); 505 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version);
529 506
530 static size_t GetFrameMaximumSize(SpdyMajorVersion version); 507 static size_t GetFrameMaximumSize(SpdyMajorVersion version);
531 508
532 // Returns the size of a header block size field. Valid only for SPDY 509 // Returns the size of a header block size field. Valid only for SPDY 3.
533 // versions <= 3. 510 static size_t GetSizeOfSizeField();
534 static size_t GetSizeOfSizeField(SpdyMajorVersion version);
535 511
536 // Returns the size (in bytes) of a wire setting ID and value. 512 // Returns the size (in bytes) of a wire setting ID and value.
537 static size_t GetSettingSize(SpdyMajorVersion version); 513 static size_t GetSettingSize(SpdyMajorVersion version);
538 514
539 // Initial window size for a stream in bytes. 515 // Initial window size for a stream in bytes.
540 static int32_t GetInitialStreamWindowSize(SpdyMajorVersion version); 516 static int32_t GetInitialStreamWindowSize(SpdyMajorVersion version);
541 517
542 // Initial window size for a session in bytes. 518 // Initial window size for a session in bytes.
543 static int32_t GetInitialSessionWindowSize(SpdyMajorVersion version); 519 static int32_t GetInitialSessionWindowSize(SpdyMajorVersion version);
544 520
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 SpdyFrameVisitor() {} 1058 SpdyFrameVisitor() {}
1083 virtual ~SpdyFrameVisitor() {} 1059 virtual ~SpdyFrameVisitor() {}
1084 1060
1085 private: 1061 private:
1086 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); 1062 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor);
1087 }; 1063 };
1088 1064
1089 } // namespace net 1065 } // namespace net
1090 1066
1091 #endif // NET_SPDY_SPDY_PROTOCOL_H_ 1067 #endif // NET_SPDY_SPDY_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698