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

Side by Side Diff: net/quic/quic_protocol.h

Issue 147763009: Add the client address to the Public Reset packet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove crypto_handshake_message.* from the CL; they were committed separately Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_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 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_
6 #define NET_QUIC_QUIC_PROTOCOL_H_ 6 #define NET_QUIC_QUIC_PROTOCOL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
11 #include <ostream> 11 #include <ostream>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/containers/hash_tables.h" 18 #include "base/containers/hash_tables.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/strings/string_piece.h" 20 #include "base/strings/string_piece.h"
21 #include "net/base/int128.h" 21 #include "net/base/int128.h"
22 #include "net/base/ip_endpoint.h"
22 #include "net/base/net_export.h" 23 #include "net/base/net_export.h"
23 #include "net/quic/iovector.h" 24 #include "net/quic/iovector.h"
24 #include "net/quic/quic_bandwidth.h" 25 #include "net/quic/quic_bandwidth.h"
25 #include "net/quic/quic_time.h" 26 #include "net/quic/quic_time.h"
26 27
27 namespace net { 28 namespace net {
28 29
29 using ::operator<<; 30 using ::operator<<;
30 31
31 class QuicAckNotifier; 32 class QuicAckNotifier;
32 class QuicPacket; 33 class QuicPacket;
33 struct QuicPacketHeader; 34 struct QuicPacketHeader;
34 35
35 typedef uint64 QuicGuid; 36 typedef uint64 QuicGuid;
36 typedef uint32 QuicStreamId; 37 typedef uint32 QuicStreamId;
37 typedef uint64 QuicStreamOffset; 38 typedef uint64 QuicStreamOffset;
38 typedef uint64 QuicPacketSequenceNumber; 39 typedef uint64 QuicPacketSequenceNumber;
39 typedef QuicPacketSequenceNumber QuicFecGroupNumber; 40 typedef QuicPacketSequenceNumber QuicFecGroupNumber;
40 typedef uint64 QuicPublicResetNonceProof; 41 typedef uint64 QuicPublicResetNonceProof;
41 typedef uint8 QuicPacketEntropyHash; 42 typedef uint8 QuicPacketEntropyHash;
42 typedef uint32 QuicHeaderId; 43 typedef uint32 QuicHeaderId;
43 // QuicTag is the type of a tag in the wire protocol. 44 // QuicTag is the type of a tag in the wire protocol.
44 typedef uint32 QuicTag; 45 typedef uint32 QuicTag;
45 typedef std::vector<QuicTag> QuicTagVector; 46 typedef std::vector<QuicTag> QuicTagVector;
47 typedef std::map<QuicTag, std::string> QuicTagValueMap;
46 // TODO(rtenneti): Didn't use SpdyPriority because SpdyPriority is uint8 and 48 // TODO(rtenneti): Didn't use SpdyPriority because SpdyPriority is uint8 and
47 // QuicPriority is uint32. Use SpdyPriority when we change the QUIC_VERSION. 49 // QuicPriority is uint32. Use SpdyPriority when we change the QUIC_VERSION.
48 typedef uint32 QuicPriority; 50 typedef uint32 QuicPriority;
49 51
50 // TODO(rch): Consider Quic specific names for these constants. 52 // TODO(rch): Consider Quic specific names for these constants.
51 // Default and initial maximum size in bytes of a QUIC packet. 53 // Default and initial maximum size in bytes of a QUIC packet.
52 const QuicByteCount kDefaultMaxPacketSize = 1200; 54 const QuicByteCount kDefaultMaxPacketSize = 1200;
53 // The maximum packet size of any QUIC packet, based on ethernet's max size, 55 // The maximum packet size of any QUIC packet, based on ethernet's max size,
54 // minus the IP and UDP headers. IPv6 has a 40 byte header, UPD adds an 56 // minus the IP and UDP headers. IPv6 has a 40 byte header, UPD adds an
55 // additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's 57 // additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's
(...skipping 17 matching lines...) Expand all
73 const size_t kDefaultMaxStreamsPerConnection = 100; 75 const size_t kDefaultMaxStreamsPerConnection = 100;
74 76
75 // Number of bytes reserved for public flags in the packet header. 77 // Number of bytes reserved for public flags in the packet header.
76 const size_t kPublicFlagsSize = 1; 78 const size_t kPublicFlagsSize = 1;
77 // Number of bytes reserved for version number in the packet header. 79 // Number of bytes reserved for version number in the packet header.
78 const size_t kQuicVersionSize = 4; 80 const size_t kQuicVersionSize = 4;
79 // Number of bytes reserved for private flags in the packet header. 81 // Number of bytes reserved for private flags in the packet header.
80 const size_t kPrivateFlagsSize = 1; 82 const size_t kPrivateFlagsSize = 1;
81 // Number of bytes reserved for FEC group in the packet header. 83 // Number of bytes reserved for FEC group in the packet header.
82 const size_t kFecGroupSize = 1; 84 const size_t kFecGroupSize = 1;
85 // TODO(wtc): remove this when we drop support for QUIC_VERSION_13.
83 // Number of bytes reserved for the nonce proof in public reset packet. 86 // Number of bytes reserved for the nonce proof in public reset packet.
84 const size_t kPublicResetNonceSize = 8; 87 const size_t kPublicResetNonceSize = 8;
85 88
86 // Signifies that the QuicPacket will contain version of the protocol. 89 // Signifies that the QuicPacket will contain version of the protocol.
87 const bool kIncludeVersion = true; 90 const bool kIncludeVersion = true;
88 91
89 // Index of the first byte in a QUIC packet which is used in hash calculation. 92 // Index of the first byte in a QUIC packet which is used in hash calculation.
90 const size_t kStartOfHashData = 0; 93 const size_t kStartOfHashData = 0;
91 94
92 // Limit on the delta between stream IDs. 95 // Limit on the delta between stream IDs.
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // the client hello tag (CHLO) will be written as the 290 // the client hello tag (CHLO) will be written as the
288 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is 291 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is
289 // stored in memory as a little endian uint32, we need 292 // stored in memory as a little endian uint32, we need
290 // to reverse the order of the bytes. 293 // to reverse the order of the bytes.
291 294
292 // MakeQuicTag returns a value given the four bytes. For example: 295 // MakeQuicTag returns a value given the four bytes. For example:
293 // MakeQuicTag('C', 'H', 'L', 'O'); 296 // MakeQuicTag('C', 'H', 'L', 'O');
294 NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d); 297 NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d);
295 298
296 // Size in bytes of the data or fec packet header. 299 // Size in bytes of the data or fec packet header.
297 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(QuicPacketHeader header); 300 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header);
298 301
299 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize( 302 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(
300 QuicGuidLength guid_length, 303 QuicGuidLength guid_length,
301 bool include_version, 304 bool include_version,
302 QuicSequenceNumberLength sequence_number_length, 305 QuicSequenceNumberLength sequence_number_length,
303 InFecGroup is_in_fec_group); 306 InFecGroup is_in_fec_group);
304 307
305 // Size in bytes of the public reset packet.
306 NET_EXPORT_PRIVATE size_t GetPublicResetPacketSize();
307
308 // Index of the first byte in a QUIC packet of FEC protected data. 308 // Index of the first byte in a QUIC packet of FEC protected data.
309 NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData( 309 NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData(
310 QuicGuidLength guid_length, 310 QuicGuidLength guid_length,
311 bool include_version, 311 bool include_version,
312 QuicSequenceNumberLength sequence_number_length); 312 QuicSequenceNumberLength sequence_number_length);
313 // Index of the first byte in a QUIC packet of encrypted data. 313 // Index of the first byte in a QUIC packet of encrypted data.
314 NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData( 314 NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData(
315 QuicGuidLength guid_length, 315 QuicGuidLength guid_length,
316 bool include_version, 316 bool include_version,
317 QuicSequenceNumberLength sequence_number_length); 317 QuicSequenceNumberLength sequence_number_length);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 QuicFecGroupNumber fec_group; 500 QuicFecGroupNumber fec_group;
501 }; 501 };
502 502
503 struct NET_EXPORT_PRIVATE QuicPublicResetPacket { 503 struct NET_EXPORT_PRIVATE QuicPublicResetPacket {
504 QuicPublicResetPacket() {} 504 QuicPublicResetPacket() {}
505 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header) 505 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header)
506 : public_header(header) {} 506 : public_header(header) {}
507 QuicPacketPublicHeader public_header; 507 QuicPacketPublicHeader public_header;
508 QuicPublicResetNonceProof nonce_proof; 508 QuicPublicResetNonceProof nonce_proof;
509 QuicPacketSequenceNumber rejected_sequence_number; 509 QuicPacketSequenceNumber rejected_sequence_number;
510 IPEndPoint client_address;
510 }; 511 };
511 512
512 enum QuicVersionNegotiationState { 513 enum QuicVersionNegotiationState {
513 START_NEGOTIATION = 0, 514 START_NEGOTIATION = 0,
514 // Server-side this implies we've sent a version negotiation packet and are 515 // Server-side this implies we've sent a version negotiation packet and are
515 // waiting on the client to select a compatible version. Client-side this 516 // waiting on the client to select a compatible version. Client-side this
516 // implies we've gotten a version negotiation packet, are retransmitting the 517 // implies we've gotten a version negotiation packet, are retransmitting the
517 // initial packets with a supported version and are waiting for our first 518 // initial packets with a supported version and are waiting for our first
518 // packet from the server. 519 // packet from the server.
519 NEGOTIATION_IN_PROGRESS, 520 NEGOTIATION_IN_PROGRESS,
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 WriteStatus status; 975 WriteStatus status;
975 union { 976 union {
976 int bytes_written; // only valid when status is OK 977 int bytes_written; // only valid when status is OK
977 int error_code; // only valid when status is ERROR 978 int error_code; // only valid when status is ERROR
978 }; 979 };
979 }; 980 };
980 981
981 } // namespace net 982 } // namespace net
982 983
983 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 984 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698