| 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 // 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_ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Turn off FEC protection for subsequently created packets. If the creator | 49 // Turn off FEC protection for subsequently created packets. If the creator |
| 50 // has any open FEC group, call will fail. It is the caller's responsibility | 50 // has any open FEC group, call will fail. It is the caller's responsibility |
| 51 // to flush out FEC packets in generation, and to verify with ShouldSendFec() | 51 // to flush out FEC packets in generation, and to verify with ShouldSendFec() |
| 52 // that there is no open FEC group. | 52 // that there is no open FEC group. |
| 53 void StopFecProtectingPackets(); | 53 void StopFecProtectingPackets(); |
| 54 | 54 |
| 55 // Checks if it's time to send an FEC packet. |force_close| forces this to | 55 // Checks if it's time to send an FEC packet. |force_close| forces this to |
| 56 // return true if an FEC group is open. | 56 // return true if an FEC group is open. |
| 57 bool ShouldSendFec(bool force_close) const; | 57 bool ShouldSendFec(bool force_close) const; |
| 58 | 58 |
| 59 // Returns true if an FEC packet is under construction. |
| 60 bool IsFecGroupOpen() const; |
| 61 |
| 59 // Makes the framer not serialize the protocol version in sent packets. | 62 // Makes the framer not serialize the protocol version in sent packets. |
| 60 void StopSendingVersion(); | 63 void StopSendingVersion(); |
| 61 | 64 |
| 62 // Update the sequence number length to use in future packets as soon as it | 65 // Update the sequence number length to use in future packets as soon as it |
| 63 // can be safely changed. | 66 // can be safely changed. |
| 64 void UpdateSequenceNumberLength( | 67 void UpdateSequenceNumberLength( |
| 65 QuicPacketSequenceNumber least_packet_awaited_by_peer, | 68 QuicPacketSequenceNumber least_packet_awaited_by_peer, |
| 66 QuicByteCount congestion_window); | 69 QuicByteCount congestion_window); |
| 67 | 70 |
| 68 // The overhead the framing will add for a packet with one frame. | 71 // The overhead the framing will add for a packet with one frame. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 SerializedPacket SerializeAllFrames(const QuicFrames& frames); | 107 SerializedPacket SerializeAllFrames(const QuicFrames& frames); |
| 105 | 108 |
| 106 // Re-serializes frames with the original packet's sequence number length. | 109 // Re-serializes frames with the original packet's sequence number length. |
| 107 // Used for retransmitting packets to ensure they aren't too long. | 110 // Used for retransmitting packets to ensure they aren't too long. |
| 108 // Caller must ensure that any open FEC group is closed before calling this | 111 // Caller must ensure that any open FEC group is closed before calling this |
| 109 // method. | 112 // method. |
| 110 SerializedPacket ReserializeAllFrames( | 113 SerializedPacket ReserializeAllFrames( |
| 111 const QuicFrames& frames, QuicSequenceNumberLength original_length); | 114 const QuicFrames& frames, QuicSequenceNumberLength original_length); |
| 112 | 115 |
| 113 // Returns true if there are frames pending to be serialized. | 116 // Returns true if there are frames pending to be serialized. |
| 114 bool HasPendingFrames(); | 117 bool HasPendingFrames() const; |
| 115 | 118 |
| 116 // Returns whether FEC protection is currently enabled. Note: Enabled does not | 119 // Returns whether FEC protection is currently enabled. Note: Enabled does not |
| 117 // mean that an FEC group is currently active; i.e., IsFecProtected() may | 120 // mean that an FEC group is currently active; i.e., IsFecProtected() may |
| 118 // still return false. | 121 // still return false. |
| 119 bool IsFecEnabled() const; | 122 bool IsFecEnabled() const; |
| 120 | 123 |
| 121 // Returns true if subsequent packets will be FEC protected. Note: True does | 124 // Returns true if subsequent packets will be FEC protected. Note: True does |
| 122 // not mean that an FEC packet is currently under construction; i.e., | 125 // not mean that an FEC packet is currently under construction; i.e., |
| 123 // fec_group_.get() may still be NULL, until MaybeStartFec() is called. | 126 // fec_group_.get() may still be NULL, until MaybeStartFec() is called. |
| 124 bool IsFecProtected() const; | 127 bool IsFecProtected() const; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 mutable size_t packet_size_; | 289 mutable size_t packet_size_; |
| 287 QuicFrames queued_frames_; | 290 QuicFrames queued_frames_; |
| 288 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; | 291 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; |
| 289 | 292 |
| 290 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 293 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
| 291 }; | 294 }; |
| 292 | 295 |
| 293 } // namespace net | 296 } // namespace net |
| 294 | 297 |
| 295 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 298 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| OLD | NEW |