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

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

Issue 485833002: HTTP2 draft 14 support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ignore_result(). Created 6 years, 4 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_framer_test.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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // A SPDY stream id is a 31 bit entity. 42 // A SPDY stream id is a 31 bit entity.
43 typedef uint32 SpdyStreamId; 43 typedef uint32 SpdyStreamId;
44 44
45 // Specifies the stream ID used to denote the current session (for 45 // Specifies the stream ID used to denote the current session (for
46 // flow control). 46 // flow control).
47 const SpdyStreamId kSessionFlowControlStreamId = 0; 47 const SpdyStreamId kSessionFlowControlStreamId = 0;
48 48
49 // Initial window size for a Spdy stream in bytes. 49 // Initial window size for a Spdy stream in bytes.
50 const int32 kSpdyStreamInitialWindowSize = 64 * 1024; // 64 KBytes 50 const int32 kSpdyStreamInitialWindowSize = 64 * 1024; // 64 KBytes
51 51
52 // The maxmium possible control frame size allowed by the spec.
53 const int32 kSpdyMaxControlFrameSize = (1 << 24) - 1;
54
55 // The maximum control frame size we actually send/accept.
56 const int32 kControlFrameSizeLimit = 1 << 14;
57
52 // Initial window size for a Spdy session in bytes. 58 // Initial window size for a Spdy session in bytes.
53 const int32 kSpdySessionInitialWindowSize = 64 * 1024; // 64 KBytes 59 const int32 kSpdySessionInitialWindowSize = 64 * 1024; // 64 KBytes
54 60
55 // Maximum window size for a Spdy stream or session. 61 // Maximum window size for a Spdy stream or session.
56 const int32 kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int 62 const int32 kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int
57 63
58 // Maximum padding size in octets for one DATA or HEADERS or PUSH_PROMISE frame. 64 // Maximum padding size in octets for one DATA or HEADERS or PUSH_PROMISE frame.
59 const int32 kPaddingSizePerFrame = 256; 65 const int32 kPaddingSizePerFrame = 256;
60 66
61 // SPDY 2 dictionary. 67 // SPDY 2 dictionary.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Equivalent to the string "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" 272 // Equivalent to the string "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
267 // (without the null terminator). 273 // (without the null terminator).
268 const char kHttp2ConnectionHeaderPrefix[] = { 274 const char kHttp2ConnectionHeaderPrefix[] = {
269 0x50, 0x52, 0x49, 0x20, 0x2a, 0x20, 0x48, 0x54, // PRI * HT 275 0x50, 0x52, 0x49, 0x20, 0x2a, 0x20, 0x48, 0x54, // PRI * HT
270 0x54, 0x50, 0x2f, 0x32, 0x2e, 0x30, 0x0d, 0x0a, // TP/2.0.. 276 0x54, 0x50, 0x2f, 0x32, 0x2e, 0x30, 0x0d, 0x0a, // TP/2.0..
271 0x0d, 0x0a, 0x53, 0x4d, 0x0d, 0x0a, 0x0d, 0x0a // ..SM.... 277 0x0d, 0x0a, 0x53, 0x4d, 0x0d, 0x0a, 0x0d, 0x0a // ..SM....
272 }; 278 };
273 const int kHttp2ConnectionHeaderPrefixSize = 279 const int kHttp2ConnectionHeaderPrefixSize =
274 arraysize(kHttp2ConnectionHeaderPrefix); 280 arraysize(kHttp2ConnectionHeaderPrefix);
275 281
282 const char kHttp2VersionString[] = "HTTP/1.1";
283
276 // Types of SPDY frames. 284 // Types of SPDY frames.
277 enum SpdyFrameType { 285 enum SpdyFrameType {
278 DATA, 286 DATA,
279 SYN_STREAM, 287 SYN_STREAM,
280 SYN_REPLY, 288 SYN_REPLY,
281 RST_STREAM, 289 RST_STREAM,
282 SETTINGS, 290 SETTINGS,
283 PING, 291 PING,
284 GOAWAY, 292 GOAWAY,
285 HEADERS, 293 HEADERS,
286 WINDOW_UPDATE, 294 WINDOW_UPDATE,
287 CREDENTIAL = 10, // No longer valid. Kept for identifiability. 295 CREDENTIAL = 10, // No longer valid. Kept for identifiability.
288 BLOCKED,
289 PUSH_PROMISE, 296 PUSH_PROMISE,
290 CONTINUATION, 297 CONTINUATION,
298 PRIORITY,
299 // BLOCKED and ALTSVC are recognized extensions.
300 BLOCKED,
291 ALTSVC, 301 ALTSVC,
292 PRIORITY
293 }; 302 };
294 303
295 // Flags on data packets. 304 // Flags on data packets.
296 enum SpdyDataFlags { 305 enum SpdyDataFlags {
297 DATA_FLAG_NONE = 0x00, 306 DATA_FLAG_NONE = 0x00,
298 DATA_FLAG_FIN = 0x01, 307 DATA_FLAG_FIN = 0x01,
299 DATA_FLAG_END_SEGMENT = 0x02, 308 DATA_FLAG_END_SEGMENT = 0x02,
300 DATA_FLAG_PADDED = 0x08, 309 DATA_FLAG_PADDED = 0x08,
301 DATA_FLAG_COMPRESSED = 0x20, 310 DATA_FLAG_COMPRESSED = 0x20,
302 }; 311 };
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // TCP congestion window in packets. 362 // TCP congestion window in packets.
354 SETTINGS_CURRENT_CWND = 0x5, 363 SETTINGS_CURRENT_CWND = 0x5,
355 // Downstream byte retransmission rate in percentage. 364 // Downstream byte retransmission rate in percentage.
356 SETTINGS_DOWNLOAD_RETRANS_RATE = 0x6, 365 SETTINGS_DOWNLOAD_RETRANS_RATE = 0x6,
357 // Initial window size in bytes 366 // Initial window size in bytes
358 SETTINGS_INITIAL_WINDOW_SIZE = 0x7, 367 SETTINGS_INITIAL_WINDOW_SIZE = 0x7,
359 // HPACK header table maximum size. 368 // HPACK header table maximum size.
360 SETTINGS_HEADER_TABLE_SIZE = 0x8, 369 SETTINGS_HEADER_TABLE_SIZE = 0x8,
361 // Whether or not server push (PUSH_PROMISE) is enabled. 370 // Whether or not server push (PUSH_PROMISE) is enabled.
362 SETTINGS_ENABLE_PUSH = 0x9, 371 SETTINGS_ENABLE_PUSH = 0x9,
372 // The size of the largest frame payload that a receiver is willing to accept.
373 SETTINGS_MAX_FRAME_SIZE = 0xa,
374 // The maximum size of header list that the sender is prepared to accept.
375 SETTINGS_MAX_HEADER_LIST_SIZE = 0xb,
363 }; 376 };
364 377
365 // Status codes for RST_STREAM frames. 378 // Status codes for RST_STREAM frames.
366 enum SpdyRstStreamStatus { 379 enum SpdyRstStreamStatus {
367 RST_STREAM_INVALID = 0, 380 RST_STREAM_INVALID = 0,
368 RST_STREAM_PROTOCOL_ERROR = 1, 381 RST_STREAM_PROTOCOL_ERROR = 1,
369 RST_STREAM_INVALID_STREAM = 2, 382 RST_STREAM_INVALID_STREAM = 2,
370 RST_STREAM_STREAM_CLOSED = 2, // Equivalent to INVALID_STREAM 383 RST_STREAM_STREAM_CLOSED = 2, // Equivalent to INVALID_STREAM
371 RST_STREAM_REFUSED_STREAM = 3, 384 RST_STREAM_REFUSED_STREAM = 3,
372 RST_STREAM_UNSUPPORTED_VERSION = 4, 385 RST_STREAM_UNSUPPORTED_VERSION = 4,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 504
492 // Serializes a given GOAWAY status to the on-the-wire enumeration value for 505 // Serializes a given GOAWAY status to the on-the-wire enumeration value for
493 // the given protocol version. 506 // the given protocol version.
494 // Returns -1 on failure (I.E. Invalid GOAWAY status for the given version). 507 // Returns -1 on failure (I.E. Invalid GOAWAY status for the given version).
495 static int SerializeGoAwayStatus(SpdyMajorVersion version, 508 static int SerializeGoAwayStatus(SpdyMajorVersion version,
496 SpdyGoAwayStatus status); 509 SpdyGoAwayStatus status);
497 510
498 // Size, in bytes, of the data frame header. Future versions of SPDY 511 // Size, in bytes, of the data frame header. Future versions of SPDY
499 // will likely vary this, so we allow for the flexibility of a function call 512 // will likely vary this, so we allow for the flexibility of a function call
500 // for this value as opposed to a constant. 513 // for this value as opposed to a constant.
501 static size_t GetDataFrameMinimumSize(); 514 static size_t GetDataFrameMinimumSize(SpdyMajorVersion version);
502 515
503 // Size, in bytes, of the control frame header. 516 // Size, in bytes, of the control frame header.
504 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version); 517 static size_t GetControlFrameHeaderSize(SpdyMajorVersion version);
505 518
506 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version); 519 static size_t GetPrefixLength(SpdyFrameType type, SpdyMajorVersion version);
507 520
508 static size_t GetFrameMaximumSize(SpdyMajorVersion version); 521 static size_t GetFrameMaximumSize(SpdyMajorVersion version);
509 522
510 // 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
511 // versions <= 3. 524 // versions <= 3.
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 SpdyFrameVisitor() {} 1057 SpdyFrameVisitor() {}
1045 virtual ~SpdyFrameVisitor() {} 1058 virtual ~SpdyFrameVisitor() {}
1046 1059
1047 private: 1060 private:
1048 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); 1061 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor);
1049 }; 1062 };
1050 1063
1051 } // namespace net 1064 } // namespace net
1052 1065
1053 #endif // NET_SPDY_SPDY_PROTOCOL_H_ 1066 #endif // NET_SPDY_SPDY_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698