| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Sets the encrypter to use for the encryption level. | 141 // Sets the encrypter to use for the encryption level. |
| 142 void SetEncrypter(EncryptionLevel level, QuicEncrypter* encrypter); | 142 void SetEncrypter(EncryptionLevel level, QuicEncrypter* encrypter); |
| 143 | 143 |
| 144 // Sets the encryption level that will be applied to new packets. | 144 // Sets the encryption level that will be applied to new packets. |
| 145 void set_encryption_level(EncryptionLevel level); | 145 void set_encryption_level(EncryptionLevel level); |
| 146 | 146 |
| 147 // packet number of the last created packet, or 0 if no packets have been | 147 // packet number of the last created packet, or 0 if no packets have been |
| 148 // created. | 148 // created. |
| 149 QuicPacketNumber packet_number() const; | 149 QuicPacketNumber packet_number() const; |
| 150 | 150 |
| 151 // Returns the maximum packet length. Note that this is the long-term maximum | 151 // Returns the maximum length a current packet can actually have. |
| 152 // packet length, and it may not be the maximum length of the current packet, | |
| 153 // if the generator is in the middle of the packet (in batch mode). | |
| 154 QuicByteCount GetMaxPacketLength() const; | |
| 155 // Returns the maximum length current packet can actually have. | |
| 156 QuicByteCount GetCurrentMaxPacketLength() const; | 152 QuicByteCount GetCurrentMaxPacketLength() const; |
| 157 | 153 |
| 158 // Set maximum packet length at the next opportunity. | 154 // Set maximum packet length in the creator immediately. May not be called |
| 155 // when there are frames queued in the creator. |
| 159 void SetMaxPacketLength(QuicByteCount length); | 156 void SetMaxPacketLength(QuicByteCount length); |
| 160 | 157 |
| 161 // Sets |path_id| to be the path on which next packet is generated. | 158 // Sets |path_id| to be the path on which next packet is generated. |
| 162 void SetCurrentPath(QuicPathId path_id, | 159 void SetCurrentPath(QuicPathId path_id, |
| 163 QuicPacketNumber least_packet_awaited_by_peer, | 160 QuicPacketNumber least_packet_awaited_by_peer, |
| 164 QuicPacketCount max_packets_in_flight); | 161 QuicPacketCount max_packets_in_flight); |
| 165 | 162 |
| 166 void set_debug_delegate(QuicPacketCreator::DebugDelegate* debug_delegate) { | 163 void set_debug_delegate(QuicPacketCreator::DebugDelegate* debug_delegate) { |
| 167 packet_creator_.set_debug_delegate(debug_delegate); | 164 packet_creator_.set_debug_delegate(debug_delegate); |
| 168 } | 165 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 194 // Flags to indicate the need for just-in-time construction of a frame. | 191 // Flags to indicate the need for just-in-time construction of a frame. |
| 195 bool should_send_ack_; | 192 bool should_send_ack_; |
| 196 bool should_send_stop_waiting_; | 193 bool should_send_stop_waiting_; |
| 197 // If we put a non-retransmittable frame in this packet, then we have to hold | 194 // If we put a non-retransmittable frame in this packet, then we have to hold |
| 198 // a reference to it until we flush (and serialize it). Retransmittable frames | 195 // a reference to it until we flush (and serialize it). Retransmittable frames |
| 199 // are referenced elsewhere so that they can later be (optionally) | 196 // are referenced elsewhere so that they can later be (optionally) |
| 200 // retransmitted. | 197 // retransmitted. |
| 201 QuicAckFrame pending_ack_frame_; | 198 QuicAckFrame pending_ack_frame_; |
| 202 QuicStopWaitingFrame pending_stop_waiting_frame_; | 199 QuicStopWaitingFrame pending_stop_waiting_frame_; |
| 203 | 200 |
| 204 // Stores the maximum packet size we are allowed to send. This might not be | |
| 205 // the maximum size we are actually using now, if we are in the middle of the | |
| 206 // packet. | |
| 207 QuicByteCount max_packet_length_; | |
| 208 | |
| 209 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); | 201 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); |
| 210 }; | 202 }; |
| 211 | 203 |
| 212 } // namespace net | 204 } // namespace net |
| 213 | 205 |
| 214 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ | 206 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ |
| OLD | NEW |