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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « net/quic/quic_packet_creator_test.cc ('k') | net/quic/quic_packet_generator.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 // Responsible for generating packets on behalf of a QuicConnection. 5 // Responsible for generating packets on behalf of a QuicConnection.
6 // Packets are serialized just-in-time. Control frames are queued. 6 // Packets are serialized just-in-time. Control frames are queued.
7 // Ack and Feedback frames will be requested from the Connection 7 // Ack and Feedback frames will be requested from the Connection
8 // just-in-time. When a packet needs to be sent, the Generator 8 // just-in-time. When a packet needs to be sent, the Generator
9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket() 9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket()
10 // 10 //
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } // namespace test 68 } // namespace test
69 69
70 class NET_EXPORT_PRIVATE QuicPacketGenerator { 70 class NET_EXPORT_PRIVATE QuicPacketGenerator {
71 public: 71 public:
72 class NET_EXPORT_PRIVATE DelegateInterface { 72 class NET_EXPORT_PRIVATE DelegateInterface {
73 public: 73 public:
74 virtual ~DelegateInterface() {} 74 virtual ~DelegateInterface() {}
75 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, 75 virtual bool ShouldGeneratePacket(TransmissionType transmission_type,
76 HasRetransmittableData retransmittable, 76 HasRetransmittableData retransmittable,
77 IsHandshake handshake) = 0; 77 IsHandshake handshake) = 0;
78 virtual QuicAckFrame* CreateAckFrame() = 0; 78 virtual void PopulateAckFrame(QuicAckFrame* ack) = 0;
79 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() = 0; 79 virtual void PopulateStopWaitingFrame(
80 QuicStopWaitingFrame* stop_waiting) = 0;
80 // Takes ownership of |packet.packet| and |packet.retransmittable_frames|. 81 // Takes ownership of |packet.packet| and |packet.retransmittable_frames|.
81 virtual void OnSerializedPacket(const SerializedPacket& packet) = 0; 82 virtual void OnSerializedPacket(const SerializedPacket& packet) = 0;
82 virtual void CloseConnection(QuicErrorCode error, bool from_peer) = 0; 83 virtual void CloseConnection(QuicErrorCode error, bool from_peer) = 0;
83 }; 84 };
84 85
85 // Interface which gets callbacks from the QuicPacketGenerator at interesting 86 // Interface which gets callbacks from the QuicPacketGenerator at interesting
86 // points. Implementations must not mutate the state of the generator 87 // points. Implementations must not mutate the state of the generator
87 // as a result of these callbacks. 88 // as a result of these callbacks.
88 class NET_EXPORT_PRIVATE DebugDelegate { 89 class NET_EXPORT_PRIVATE DebugDelegate {
89 public: 90 public:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // SerializedPacket. 152 // SerializedPacket.
152 QuicEncryptedPacket* SerializeVersionNegotiationPacket( 153 QuicEncryptedPacket* SerializeVersionNegotiationPacket(
153 const QuicVersionVector& supported_versions); 154 const QuicVersionVector& supported_versions);
154 155
155 156
156 // Re-serializes frames with the original packet's sequence number length. 157 // Re-serializes frames with the original packet's sequence number length.
157 // Used for retransmitting packets to ensure they aren't too long. 158 // Used for retransmitting packets to ensure they aren't too long.
158 // Caller must ensure that any open FEC group is closed before calling this 159 // Caller must ensure that any open FEC group is closed before calling this
159 // method. 160 // method.
160 SerializedPacket ReserializeAllFrames( 161 SerializedPacket ReserializeAllFrames(
161 const QuicFrames& frames, 162 const RetransmittableFrames& frames,
162 QuicSequenceNumberLength original_length); 163 QuicSequenceNumberLength original_length);
163 164
164 // Update the sequence number length to use in future packets as soon as it 165 // Update the sequence number length to use in future packets as soon as it
165 // can be safely changed. 166 // can be safely changed.
166 void UpdateSequenceNumberLength( 167 void UpdateSequenceNumberLength(
167 QuicPacketSequenceNumber least_packet_awaited_by_peer, 168 QuicPacketSequenceNumber least_packet_awaited_by_peer,
168 QuicPacketCount max_packets_in_flight); 169 QuicPacketCount max_packets_in_flight);
169 170
170 // Set the minimum number of bytes for the connection id length; 171 // Set the minimum number of bytes for the connection id length;
171 void SetConnectionIdLength(uint32 length); 172 void SetConnectionIdLength(uint32 length);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // if this variable is false. 248 // if this variable is false.
248 bool should_fec_protect_; 249 bool should_fec_protect_;
249 250
250 // Flags to indicate the need for just-in-time construction of a frame. 251 // Flags to indicate the need for just-in-time construction of a frame.
251 bool should_send_ack_; 252 bool should_send_ack_;
252 bool should_send_stop_waiting_; 253 bool should_send_stop_waiting_;
253 // If we put a non-retransmittable frame (ack frame) in this packet, then we 254 // If we put a non-retransmittable frame (ack frame) in this packet, then we
254 // have to hold a reference to it until we flush (and serialize it). 255 // have to hold a reference to it until we flush (and serialize it).
255 // Retransmittable frames are referenced elsewhere so that they 256 // Retransmittable frames are referenced elsewhere so that they
256 // can later be (optionally) retransmitted. 257 // can later be (optionally) retransmitted.
257 scoped_ptr<QuicAckFrame> pending_ack_frame_; 258 QuicAckFrame pending_ack_frame_;
258 scoped_ptr<QuicStopWaitingFrame> pending_stop_waiting_frame_; 259 QuicStopWaitingFrame pending_stop_waiting_frame_;
260 // True if an ack or stop waiting frame is already queued, and should not be
261 // re-added.
262 bool ack_queued_;
263 bool stop_waiting_queued_;
259 264
260 // Stores notifiers that should be attached to the next serialized packet. 265 // Stores notifiers that should be attached to the next serialized packet.
261 std::list<QuicAckNotifier*> ack_notifiers_; 266 std::list<QuicAckNotifier*> ack_notifiers_;
262 267
263 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); 268 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator);
264 }; 269 };
265 270
266 } // namespace net 271 } // namespace net
267 272
268 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ 273 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator_test.cc ('k') | net/quic/quic_packet_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698