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

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

Issue 23464033: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix valgrind error Created 7 years, 3 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_packet_generator.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/net_export.h" 22 #include "net/base/net_export.h"
23 #include "net/quic/quic_bandwidth.h" 23 #include "net/quic/quic_bandwidth.h"
24 #include "net/quic/quic_time.h" 24 #include "net/quic/quic_time.h"
25 25
26 namespace net { 26 namespace net {
27 27
28 using ::operator<<; 28 using ::operator<<;
29 29
30 class QuicAckNotifier;
30 class QuicPacket; 31 class QuicPacket;
31 struct QuicPacketHeader; 32 struct QuicPacketHeader;
32 33
33 typedef uint64 QuicGuid; 34 typedef uint64 QuicGuid;
34 typedef uint32 QuicStreamId; 35 typedef uint32 QuicStreamId;
35 typedef uint64 QuicStreamOffset; 36 typedef uint64 QuicStreamOffset;
36 typedef uint64 QuicPacketSequenceNumber; 37 typedef uint64 QuicPacketSequenceNumber;
37 typedef QuicPacketSequenceNumber QuicFecGroupNumber; 38 typedef QuicPacketSequenceNumber QuicFecGroupNumber;
38 typedef uint64 QuicPublicResetNonceProof; 39 typedef uint64 QuicPublicResetNonceProof;
39 typedef uint8 QuicPacketEntropyHash; 40 typedef uint8 QuicPacketEntropyHash;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 HAS_RETRANSMITTABLE_DATA, 93 HAS_RETRANSMITTABLE_DATA,
93 }; 94 };
94 95
95 enum IsHandshake { 96 enum IsHandshake {
96 NOT_HANDSHAKE, 97 NOT_HANDSHAKE,
97 IS_HANDSHAKE 98 IS_HANDSHAKE
98 }; 99 };
99 100
100 enum QuicFrameType { 101 enum QuicFrameType {
101 PADDING_FRAME = 0, 102 PADDING_FRAME = 0,
103 RST_STREAM_FRAME,
104 CONNECTION_CLOSE_FRAME,
105 GOAWAY_FRAME,
102 STREAM_FRAME, 106 STREAM_FRAME,
103 ACK_FRAME, 107 ACK_FRAME,
104 CONGESTION_FEEDBACK_FRAME, 108 CONGESTION_FEEDBACK_FRAME,
105 RST_STREAM_FRAME,
106 CONNECTION_CLOSE_FRAME,
107 GOAWAY_FRAME,
108 NUM_FRAME_TYPES 109 NUM_FRAME_TYPES
109 }; 110 };
110 111
111 enum QuicGuidLength { 112 enum QuicGuidLength {
112 PACKET_0BYTE_GUID = 0, 113 PACKET_0BYTE_GUID = 0,
113 PACKET_1BYTE_GUID = 1, 114 PACKET_1BYTE_GUID = 1,
114 PACKET_4BYTE_GUID = 4, 115 PACKET_4BYTE_GUID = 4,
115 PACKET_8BYTE_GUID = 8 116 PACKET_8BYTE_GUID = 8
116 }; 117 };
117 118
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // When adding a new version to this enum you should add it to 184 // When adding a new version to this enum you should add it to
184 // kSupportedQuicVersions (if appropriate), and also add a new case to the 185 // kSupportedQuicVersions (if appropriate), and also add a new case to the
185 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and 186 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and
186 // QuicVersionToString. 187 // QuicVersionToString.
187 enum QuicVersion { 188 enum QuicVersion {
188 // Special case to indicate unknown/unsupported QUIC version. 189 // Special case to indicate unknown/unsupported QUIC version.
189 QUIC_VERSION_UNSUPPORTED = 0, 190 QUIC_VERSION_UNSUPPORTED = 0,
190 191
191 QUIC_VERSION_7 = 7, 192 QUIC_VERSION_7 = 7,
192 QUIC_VERSION_8 = 8, 193 QUIC_VERSION_8 = 8,
193 QUIC_VERSION_9 = 9, // Current version. 194 QUIC_VERSION_9 = 9,
195 QUIC_VERSION_10 = 10, // Current version.
194 }; 196 };
195 197
196 // This vector contains QUIC versions which we currently support. 198 // This vector contains QUIC versions which we currently support.
197 // This should be ordered such that the highest supported version is the first 199 // This should be ordered such that the highest supported version is the first
198 // element, with subsequent elements in descending order (versions can be 200 // element, with subsequent elements in descending order (versions can be
199 // skipped as necessary). 201 // skipped as necessary).
200 static const QuicVersion kSupportedQuicVersions[] = 202 static const QuicVersion kSupportedQuicVersions[] =
201 {QUIC_VERSION_9}; 203 {QUIC_VERSION_10, QUIC_VERSION_9};
202 204
203 typedef std::vector<QuicVersion> QuicVersionVector; 205 typedef std::vector<QuicVersion> QuicVersionVector;
204 206
205 // Upper limit on versions we support. 207 // Upper limit on versions we support.
206 NET_EXPORT_PRIVATE QuicVersion QuicVersionMax(); 208 NET_EXPORT_PRIVATE QuicVersion QuicVersionMax();
207 209
208 // Lower limit on versions we support. 210 // Lower limit on versions we support.
209 NET_EXPORT_PRIVATE QuicVersion QuicVersionMin(); 211 NET_EXPORT_PRIVATE QuicVersion QuicVersionMin();
210 212
211 // QuicTag is written to and read from the wire, but we prefer to use 213 // QuicTag is written to and read from the wire, but we prefer to use
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 QuicStreamFrame(); 467 QuicStreamFrame();
466 QuicStreamFrame(QuicStreamId stream_id, 468 QuicStreamFrame(QuicStreamId stream_id,
467 bool fin, 469 bool fin,
468 QuicStreamOffset offset, 470 QuicStreamOffset offset,
469 base::StringPiece data); 471 base::StringPiece data);
470 472
471 QuicStreamId stream_id; 473 QuicStreamId stream_id;
472 bool fin; 474 bool fin;
473 QuicStreamOffset offset; // Location of this data in the stream. 475 QuicStreamOffset offset; // Location of this data in the stream.
474 base::StringPiece data; 476 base::StringPiece data;
477
478 // If this is set, then when this packet is ACKed the AckNotifier will be
479 // informed.
480 QuicAckNotifier* notifier;
475 }; 481 };
476 482
477 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing 483 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing
478 // is finalized. 484 // is finalized.
479 typedef std::set<QuicPacketSequenceNumber> SequenceNumberSet; 485 typedef std::set<QuicPacketSequenceNumber> SequenceNumberSet;
480 // TODO(pwestin): Add a way to enforce the max size of this map. 486 // TODO(pwestin): Add a way to enforce the max size of this map.
481 typedef std::map<QuicPacketSequenceNumber, QuicTime> TimeMap; 487 typedef std::map<QuicPacketSequenceNumber, QuicTime> TimeMap;
482 488
483 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { 489 struct NET_EXPORT_PRIVATE ReceivedPacketInfo {
484 ReceivedPacketInfo(); 490 ReceivedPacketInfo();
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 std::vector<std::string*> stream_data_; 826 std::vector<std::string*> stream_data_;
821 827
822 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames); 828 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames);
823 }; 829 };
824 830
825 struct NET_EXPORT_PRIVATE SerializedPacket { 831 struct NET_EXPORT_PRIVATE SerializedPacket {
826 SerializedPacket(QuicPacketSequenceNumber sequence_number, 832 SerializedPacket(QuicPacketSequenceNumber sequence_number,
827 QuicSequenceNumberLength sequence_number_length, 833 QuicSequenceNumberLength sequence_number_length,
828 QuicPacket* packet, 834 QuicPacket* packet,
829 QuicPacketEntropyHash entropy_hash, 835 QuicPacketEntropyHash entropy_hash,
830 RetransmittableFrames* retransmittable_frames) 836 RetransmittableFrames* retransmittable_frames);
831 : sequence_number(sequence_number), 837 ~SerializedPacket();
832 sequence_number_length(sequence_number_length),
833 packet(packet),
834 entropy_hash(entropy_hash),
835 retransmittable_frames(retransmittable_frames) {}
836 838
837 QuicPacketSequenceNumber sequence_number; 839 QuicPacketSequenceNumber sequence_number;
838 QuicSequenceNumberLength sequence_number_length; 840 QuicSequenceNumberLength sequence_number_length;
839 QuicPacket* packet; 841 QuicPacket* packet;
840 QuicPacketEntropyHash entropy_hash; 842 QuicPacketEntropyHash entropy_hash;
841 RetransmittableFrames* retransmittable_frames; 843 RetransmittableFrames* retransmittable_frames;
844
845 // If set, these will be called when this packet is ACKed by the peer.
846 std::set<QuicAckNotifier*> notifiers;
842 }; 847 };
843 848
844 // A struct for functions which consume data payloads and fins. 849 // A struct for functions which consume data payloads and fins.
845 // The first member of the pair indicates bytes consumed.
846 // The second member of the pair indicates if an incoming fin was consumed.
847 struct QuicConsumedData { 850 struct QuicConsumedData {
848 QuicConsumedData(size_t bytes_consumed, bool fin_consumed) 851 QuicConsumedData(size_t bytes_consumed, bool fin_consumed)
849 : bytes_consumed(bytes_consumed), 852 : bytes_consumed(bytes_consumed),
850 fin_consumed(fin_consumed) {} 853 fin_consumed(fin_consumed) {}
851
852 // By default, gtest prints the raw bytes of an object. The bool data 854 // By default, gtest prints the raw bytes of an object. The bool data
853 // member causes this object to have padding bytes, which causes the 855 // member causes this object to have padding bytes, which causes the
854 // default gtest object printer to read uninitialize memory. So we need 856 // default gtest object printer to read uninitialize memory. So we need
855 // to teach gtest how to print this object. 857 // to teach gtest how to print this object.
856 NET_EXPORT_PRIVATE friend std::ostream& operator<<( 858 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
857 std::ostream& os, const QuicConsumedData& s); 859 std::ostream& os, const QuicConsumedData& s);
858 860
861 // How many bytes were consumed.
859 size_t bytes_consumed; 862 size_t bytes_consumed;
863
864 // True if an incoming fin was consumed.
860 bool fin_consumed; 865 bool fin_consumed;
861 }; 866 };
862 867
863 } // namespace net 868 } // namespace net
864 869
865 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 870 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_generator.cc ('k') | net/quic/quic_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698