OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 class NET_EXPORT_PRIVATE QuicPacketGenerator { | 59 class NET_EXPORT_PRIVATE QuicPacketGenerator { |
60 public: | 60 public: |
61 class NET_EXPORT_PRIVATE DelegateInterface | 61 class NET_EXPORT_PRIVATE DelegateInterface |
62 : public QuicPacketCreator::DelegateInterface { | 62 : public QuicPacketCreator::DelegateInterface { |
63 public: | 63 public: |
64 ~DelegateInterface() override {} | 64 ~DelegateInterface() override {} |
65 // Consults delegate whether a packet should be generated. | 65 // Consults delegate whether a packet should be generated. |
66 virtual bool ShouldGeneratePacket(HasRetransmittableData retransmittable, | 66 virtual bool ShouldGeneratePacket(HasRetransmittableData retransmittable, |
67 IsHandshake handshake) = 0; | 67 IsHandshake handshake) = 0; |
68 virtual void PopulateAckFrame(QuicAckFrame* ack) = 0; | 68 virtual void PopulateAckFrame(QuicAckFrame* ack) = 0; |
| 69 virtual const QuicFrame GetUpdatedAckFrame() = 0; |
69 virtual void PopulateStopWaitingFrame( | 70 virtual void PopulateStopWaitingFrame( |
70 QuicStopWaitingFrame* stop_waiting) = 0; | 71 QuicStopWaitingFrame* stop_waiting) = 0; |
71 }; | 72 }; |
72 | 73 |
73 QuicPacketGenerator(QuicConnectionId connection_id, | 74 QuicPacketGenerator(QuicConnectionId connection_id, |
74 QuicFramer* framer, | 75 QuicFramer* framer, |
75 QuicRandom* random_generator, | 76 QuicRandom* random_generator, |
76 QuicBufferAllocator* buffer_allocator, | 77 QuicBufferAllocator* buffer_allocator, |
77 DelegateInterface* delegate); | 78 DelegateInterface* delegate); |
78 | 79 |
(...skipping 28 matching lines...) Expand all Loading... |
107 // Disables flushing. | 108 // Disables flushing. |
108 void StartBatchOperations(); | 109 void StartBatchOperations(); |
109 // Enables flushing and flushes queued data which can be sent. | 110 // Enables flushing and flushes queued data which can be sent. |
110 void FinishBatchOperations(); | 111 void FinishBatchOperations(); |
111 | 112 |
112 // Flushes all queued frames, even frames which are not sendable. | 113 // Flushes all queued frames, even frames which are not sendable. |
113 void FlushAllQueuedFrames(); | 114 void FlushAllQueuedFrames(); |
114 | 115 |
115 bool HasQueuedFrames() const; | 116 bool HasQueuedFrames() const; |
116 | 117 |
| 118 // Whether the pending packet has no frames in it at the moment. |
| 119 bool IsPendingPacketEmpty() const; |
| 120 |
117 // Makes the framer not serialize the protocol version in sent packets. | 121 // Makes the framer not serialize the protocol version in sent packets. |
118 void StopSendingVersion(); | 122 void StopSendingVersion(); |
119 | 123 |
120 // Creates a version negotiation packet which supports |supported_versions|. | 124 // Creates a version negotiation packet which supports |supported_versions|. |
121 // Caller owns the created packet. Also, sets the entropy hash of the | 125 // Caller owns the created packet. Also, sets the entropy hash of the |
122 // serialized packet to a random bool and returns that value as a member of | 126 // serialized packet to a random bool and returns that value as a member of |
123 // SerializedPacket. | 127 // SerializedPacket. |
124 QuicEncryptedPacket* SerializeVersionNegotiationPacket( | 128 QuicEncryptedPacket* SerializeVersionNegotiationPacket( |
125 const QuicVersionVector& supported_versions); | 129 const QuicVersionVector& supported_versions); |
126 | 130 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // retransmitted. | 201 // retransmitted. |
198 QuicAckFrame pending_ack_frame_; | 202 QuicAckFrame pending_ack_frame_; |
199 QuicStopWaitingFrame pending_stop_waiting_frame_; | 203 QuicStopWaitingFrame pending_stop_waiting_frame_; |
200 | 204 |
201 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); | 205 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); |
202 }; | 206 }; |
203 | 207 |
204 } // namespace net | 208 } // namespace net |
205 | 209 |
206 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ | 210 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ |
OLD | NEW |