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

Side by Side Diff: net/quic/quic_packet_creator.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_framer_test.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 namespace net { 21 namespace net {
22 namespace test { 22 namespace test {
23 class QuicPacketCreatorPeer; 23 class QuicPacketCreatorPeer;
24 } 24 }
25 25
26 class QuicAckNotifier;
26 class QuicRandom; 27 class QuicRandom;
27 28
28 class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { 29 class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
29 public: 30 public:
30 // Options for controlling how packets are created. 31 // Options for controlling how packets are created.
31 struct Options { 32 struct Options {
32 Options() 33 Options()
33 : max_packet_length(kMaxPacketSize), 34 : max_packet_length(kMaxPacketSize),
34 random_reorder(false), 35 random_reorder(false),
35 max_packets_per_fec_group(0), 36 max_packets_per_fec_group(0),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Converts a raw payload to a frame which fits into the currently open 83 // Converts a raw payload to a frame which fits into the currently open
83 // packet if there is one. Returns the number of bytes consumed from data. 84 // packet if there is one. Returns the number of bytes consumed from data.
84 // If data is empty and fin is true, the expected behavior is to consume the 85 // If data is empty and fin is true, the expected behavior is to consume the
85 // fin but return 0. 86 // fin but return 0.
86 size_t CreateStreamFrame(QuicStreamId id, 87 size_t CreateStreamFrame(QuicStreamId id,
87 base::StringPiece data, 88 base::StringPiece data,
88 QuicStreamOffset offset, 89 QuicStreamOffset offset,
89 bool fin, 90 bool fin,
90 QuicFrame* frame); 91 QuicFrame* frame);
91 92
93 // As above, but keeps track of an QuicAckNotifier that should be called when
94 // the packet that contains this stream frame is ACKed.
95 // The |notifier| is not owned by the QuicPacketGenerator and must outlive the
96 // generated packet.
97 size_t CreateStreamFrameWithNotifier(QuicStreamId id,
98 base::StringPiece data,
99 QuicStreamOffset offset,
100 bool fin,
101 QuicAckNotifier* notifier,
102 QuicFrame* frame);
103
92 // Serializes all frames into a single packet. All frames must fit into a 104 // Serializes all frames into a single packet. All frames must fit into a
93 // single packet. Also, sets the entropy hash of the serialized packet to a 105 // single packet. Also, sets the entropy hash of the serialized packet to a
94 // random bool and returns that value as a member of SerializedPacket. 106 // random bool and returns that value as a member of SerializedPacket.
95 // Never returns a RetransmittableFrames in SerializedPacket. 107 // Never returns a RetransmittableFrames in SerializedPacket.
96 SerializedPacket SerializeAllFrames(const QuicFrames& frames); 108 SerializedPacket SerializeAllFrames(const QuicFrames& frames);
97 109
98 // Re-serializes frames with the original packet's sequence number length. 110 // Re-serializes frames with the original packet's sequence number length.
99 // Used for retransmitting packets to ensure they aren't too long. 111 // Used for retransmitting packets to ensure they aren't too long.
100 SerializedPacket ReserializeAllFrames( 112 SerializedPacket ReserializeAllFrames(
101 const QuicFrames& frames, QuicSequenceNumberLength original_length); 113 const QuicFrames& frames, QuicSequenceNumberLength original_length);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 mutable size_t packet_size_; 199 mutable size_t packet_size_;
188 QuicFrames queued_frames_; 200 QuicFrames queued_frames_;
189 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; 201 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
190 202
191 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); 203 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator);
192 }; 204 };
193 205
194 } // namespace net 206 } // namespace net
195 207
196 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 208 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698