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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Consults delegate whether a packet should be generated. | 66 // Consults delegate whether a packet should be generated. |
67 virtual bool ShouldGeneratePacket(HasRetransmittableData retransmittable, | 67 virtual bool ShouldGeneratePacket(HasRetransmittableData retransmittable, |
68 IsHandshake handshake) = 0; | 68 IsHandshake handshake) = 0; |
69 virtual const QuicFrame GetUpdatedAckFrame() = 0; | 69 virtual const QuicFrame GetUpdatedAckFrame() = 0; |
70 virtual void PopulateStopWaitingFrame( | 70 virtual void PopulateStopWaitingFrame( |
71 QuicStopWaitingFrame* stop_waiting) = 0; | 71 QuicStopWaitingFrame* stop_waiting) = 0; |
72 }; | 72 }; |
73 | 73 |
74 QuicPacketGenerator(QuicConnectionId connection_id, | 74 QuicPacketGenerator(QuicConnectionId connection_id, |
75 QuicFramer* framer, | 75 QuicFramer* framer, |
76 QuicRandom* random_generator, | |
77 QuicBufferAllocator* buffer_allocator, | 76 QuicBufferAllocator* buffer_allocator, |
78 DelegateInterface* delegate); | 77 DelegateInterface* delegate); |
79 | 78 |
80 ~QuicPacketGenerator(); | 79 ~QuicPacketGenerator(); |
81 | 80 |
82 // Indicates that an ACK frame should be sent. | 81 // Indicates that an ACK frame should be sent. |
83 // If |also_send_stop_waiting| is true, then it also indicates that a | 82 // If |also_send_stop_waiting| is true, then it also indicates that a |
84 // STOP_WAITING frame should be sent as well. | 83 // STOP_WAITING frame should be sent as well. |
85 // The contents of the frame(s) will be generated via a call to the delegate | 84 // The contents of the frame(s) will be generated via a call to the delegate |
86 // CreateAckFrame() when the packet is serialized. | 85 // CreateAckFrame() when the packet is serialized. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 128 |
130 // Makes the framer not serialize the protocol version in sent packets. | 129 // Makes the framer not serialize the protocol version in sent packets. |
131 void StopSendingVersion(); | 130 void StopSendingVersion(); |
132 | 131 |
133 // SetDiversificationNonce sets the nonce that will be sent in each public | 132 // SetDiversificationNonce sets the nonce that will be sent in each public |
134 // header of packets encrypted at the initial encryption level. Should only | 133 // header of packets encrypted at the initial encryption level. Should only |
135 // be called by servers. | 134 // be called by servers. |
136 void SetDiversificationNonce(const DiversificationNonce& nonce); | 135 void SetDiversificationNonce(const DiversificationNonce& nonce); |
137 | 136 |
138 // Creates a version negotiation packet which supports |supported_versions|. | 137 // Creates a version negotiation packet which supports |supported_versions|. |
139 // Also, sets the entropy hash of the serialized packet to a random bool and | |
140 // returns that value as a member of SerializedPacket. | |
141 std::unique_ptr<QuicEncryptedPacket> SerializeVersionNegotiationPacket( | 138 std::unique_ptr<QuicEncryptedPacket> SerializeVersionNegotiationPacket( |
142 const QuicVersionVector& supported_versions); | 139 const QuicVersionVector& supported_versions); |
143 | 140 |
144 // Re-serializes frames with the original packet's packet number length. | 141 // Re-serializes frames with the original packet's packet number length. |
145 // Used for retransmitting packets to ensure they aren't too long. | 142 // Used for retransmitting packets to ensure they aren't too long. |
146 void ReserializeAllFrames(const PendingRetransmission& retransmission, | 143 void ReserializeAllFrames(const PendingRetransmission& retransmission, |
147 char* buffer, | 144 char* buffer, |
148 size_t buffer_len); | 145 size_t buffer_len); |
149 | 146 |
150 // Update the packet number length to use in future packets as soon as it | 147 // Update the packet number length to use in future packets as soon as it |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // are referenced elsewhere so that they can later be (optionally) | 210 // are referenced elsewhere so that they can later be (optionally) |
214 // retransmitted. | 211 // retransmitted. |
215 QuicStopWaitingFrame pending_stop_waiting_frame_; | 212 QuicStopWaitingFrame pending_stop_waiting_frame_; |
216 | 213 |
217 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); | 214 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); |
218 }; | 215 }; |
219 | 216 |
220 } // namespace net | 217 } // namespace net |
221 | 218 |
222 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ | 219 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ |
OLD | NEW |