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

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

Issue 103973007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for android compile error Created 7 years 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_network_transaction_unittest.cc ('k') | net/quic/quic_packet_creator.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 // Accumulates frames for the next packet until more frames no longer fit or 5 // Accumulates frames for the next packet until more frames no longer fit or
6 // it's time to create a packet from them. Also provides packet creation of 6 // it's time to create a packet from them. Also provides packet creation of
7 // FEC packets based on previously created packets. 7 // FEC packets based on previously created packets.
8 8
9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ 9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_
10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ 10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_
11 11
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "net/quic/quic_fec_group.h" 17 #include "net/quic/quic_fec_group.h"
18 #include "net/quic/quic_framer.h" 18 #include "net/quic/quic_framer.h"
19 #include "net/quic/quic_protocol.h" 19 #include "net/quic/quic_protocol.h"
20 20
21 NET_EXPORT_PRIVATE extern bool FLAGS_pad_quic_handshake_packets; 21 NET_EXPORT_PRIVATE extern bool FLAGS_pad_quic_handshake_packets;
22 22
23 namespace net { 23 namespace net {
24 namespace test { 24 namespace test {
25 class QuicPacketCreatorPeer; 25 class QuicPacketCreatorPeer;
26 } 26 }
27 27
28 class QuicAckNotifier; 28 class QuicAckNotifier;
29 class QuicRandom; 29 class QuicRandom;
30 class QuicRandomBoolSource;
30 31
31 class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { 32 class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
32 public: 33 public:
33 // Options for controlling how packets are created. 34 // Options for controlling how packets are created.
34 struct Options { 35 struct Options {
35 Options() 36 Options()
36 : max_packet_length(kDefaultMaxPacketSize), 37 : max_packet_length(kDefaultMaxPacketSize),
37 max_packets_per_fec_group(0), 38 max_packets_per_fec_group(0),
38 send_guid_length(PACKET_8BYTE_GUID), 39 send_guid_length(PACKET_8BYTE_GUID),
39 send_sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER) {} 40 send_sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER) {}
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames); 196 bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames);
196 197
197 // Adds a padding frame to the current packet only if the current packet 198 // Adds a padding frame to the current packet only if the current packet
198 // contains a handshake message, and there is sufficient room to fit a 199 // contains a handshake message, and there is sufficient room to fit a
199 // padding frame. 200 // padding frame.
200 void MaybeAddPadding(); 201 void MaybeAddPadding();
201 202
202 Options options_; 203 Options options_;
203 QuicGuid guid_; 204 QuicGuid guid_;
204 QuicFramer* framer_; 205 QuicFramer* framer_;
205 QuicRandom* random_generator_; 206 scoped_ptr<QuicRandomBoolSource> random_bool_source_;
206 QuicPacketSequenceNumber sequence_number_; 207 QuicPacketSequenceNumber sequence_number_;
207 QuicFecGroupNumber fec_group_number_; 208 QuicFecGroupNumber fec_group_number_;
208 scoped_ptr<QuicFecGroup> fec_group_; 209 scoped_ptr<QuicFecGroup> fec_group_;
209 // bool to keep track if this packet creator is being used the server. 210 // bool to keep track if this packet creator is being used the server.
210 bool is_server_; 211 bool is_server_;
211 // Controls whether protocol version should be included while serializing the 212 // Controls whether protocol version should be included while serializing the
212 // packet. 213 // packet.
213 bool send_version_in_packet_; 214 bool send_version_in_packet_;
214 // The sequence number length for the current packet and the current FEC group 215 // The sequence number length for the current packet and the current FEC group
215 // if FEC is enabled. 216 // if FEC is enabled.
216 // Mutable so PacketSize() can adjust it when the packet is empty. 217 // Mutable so PacketSize() can adjust it when the packet is empty.
217 mutable QuicSequenceNumberLength sequence_number_length_; 218 mutable QuicSequenceNumberLength sequence_number_length_;
218 // packet_size_ is mutable because it's just a cache of the current size. 219 // packet_size_ is mutable because it's just a cache of the current size.
219 // packet_size should never be read directly, use PacketSize() instead. 220 // packet_size should never be read directly, use PacketSize() instead.
220 mutable size_t packet_size_; 221 mutable size_t packet_size_;
221 QuicFrames queued_frames_; 222 QuicFrames queued_frames_;
222 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; 223 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
223 224
224 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); 225 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator);
225 }; 226 };
226 227
227 } // namespace net 228 } // namespace net
228 229
229 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 230 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698