| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // return true if an fec group is open. | 63 // return true if an fec group is open. |
| 64 bool ShouldSendFec(bool force_close) const; | 64 bool ShouldSendFec(bool force_close) const; |
| 65 | 65 |
| 66 // Starts a new FEC group with the next serialized packet, if FEC is enabled | 66 // Starts a new FEC group with the next serialized packet, if FEC is enabled |
| 67 // and there is not already an FEC group open. | 67 // and there is not already an FEC group open. |
| 68 void MaybeStartFEC(); | 68 void MaybeStartFEC(); |
| 69 | 69 |
| 70 // Makes the framer not serialize the protocol version in sent packets. | 70 // Makes the framer not serialize the protocol version in sent packets. |
| 71 void StopSendingVersion(); | 71 void StopSendingVersion(); |
| 72 | 72 |
| 73 // Update the sequence number length to use in future packets as soon as it |
| 74 // can be safely changed. |
| 75 void UpdateSequenceNumberLength( |
| 76 QuicPacketSequenceNumber least_packet_awaited_by_peer, |
| 77 QuicByteCount bytes_per_second); |
| 78 |
| 73 // The overhead the framing will add for a packet with one frame. | 79 // The overhead the framing will add for a packet with one frame. |
| 74 static size_t StreamFramePacketOverhead( | 80 static size_t StreamFramePacketOverhead( |
| 75 QuicVersion version, | 81 QuicVersion version, |
| 76 QuicGuidLength guid_length, | 82 QuicGuidLength guid_length, |
| 77 bool include_version, | 83 bool include_version, |
| 78 QuicSequenceNumberLength sequence_number_length, | 84 QuicSequenceNumberLength sequence_number_length, |
| 79 InFecGroup is_in_fec_group); | 85 InFecGroup is_in_fec_group); |
| 80 | 86 |
| 81 bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset) const; | 87 bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset) const; |
| 82 | 88 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 SerializedPacket SerializeConnectionClose( | 151 SerializedPacket SerializeConnectionClose( |
| 146 QuicConnectionCloseFrame* close_frame); | 152 QuicConnectionCloseFrame* close_frame); |
| 147 | 153 |
| 148 // Creates a version negotiation packet which supports |supported_versions|. | 154 // Creates a version negotiation packet which supports |supported_versions|. |
| 149 // Caller owns the created packet. Also, sets the entropy hash of the | 155 // Caller owns the created packet. Also, sets the entropy hash of the |
| 150 // serialized packet to a random bool and returns that value as a member of | 156 // serialized packet to a random bool and returns that value as a member of |
| 151 // SerializedPacket. | 157 // SerializedPacket. |
| 152 QuicEncryptedPacket* SerializeVersionNegotiationPacket( | 158 QuicEncryptedPacket* SerializeVersionNegotiationPacket( |
| 153 const QuicVersionVector& supported_versions); | 159 const QuicVersionVector& supported_versions); |
| 154 | 160 |
| 161 // Sequence number of the last created packet, or 0 if no packets have been |
| 162 // created. |
| 155 QuicPacketSequenceNumber sequence_number() const { | 163 QuicPacketSequenceNumber sequence_number() const { |
| 156 return sequence_number_; | 164 return sequence_number_; |
| 157 } | 165 } |
| 158 | 166 |
| 159 void set_sequence_number(QuicPacketSequenceNumber s) { | 167 void set_sequence_number(QuicPacketSequenceNumber s) { |
| 160 sequence_number_ = s; | 168 sequence_number_ = s; |
| 161 } | 169 } |
| 162 | 170 |
| 163 Options* options() { | 171 Options* options() { |
| 164 return &options_; | 172 return &options_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 mutable size_t packet_size_; | 207 mutable size_t packet_size_; |
| 200 QuicFrames queued_frames_; | 208 QuicFrames queued_frames_; |
| 201 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; | 209 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; |
| 202 | 210 |
| 203 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 211 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
| 204 }; | 212 }; |
| 205 | 213 |
| 206 } // namespace net | 214 } // namespace net |
| 207 | 215 |
| 208 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 216 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
| OLD | NEW |