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. If multipath enabled, only creates | 6 // it's time to create a packet from them. If multipath enabled, only creates |
7 // packets on one path at the same time. Currently, next packet number is | 7 // packets on one path at the same time. Currently, next packet number is |
8 // tracked per-path. | 8 // tracked per-path. |
9 | 9 |
10 #ifndef NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ | 10 #ifndef NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Optimized method to create a QuicStreamFrame and serialize it. Adds the | 118 // Optimized method to create a QuicStreamFrame and serialize it. Adds the |
119 // QuicStreamFrame to the returned SerializedPacket. Sets | 119 // QuicStreamFrame to the returned SerializedPacket. Sets |
120 // |num_bytes_consumed| to the number of bytes consumed to create the | 120 // |num_bytes_consumed| to the number of bytes consumed to create the |
121 // QuicStreamFrame. | 121 // QuicStreamFrame. |
122 void CreateAndSerializeStreamFrame( | 122 void CreateAndSerializeStreamFrame( |
123 QuicStreamId id, | 123 QuicStreamId id, |
124 const QuicIOVector& iov, | 124 const QuicIOVector& iov, |
125 QuicStreamOffset iov_offset, | 125 QuicStreamOffset iov_offset, |
126 QuicStreamOffset stream_offset, | 126 QuicStreamOffset stream_offset, |
127 bool fin, | 127 bool fin, |
128 scoped_refptr<QuicAckListenerInterface> listener, | 128 QuicReferenceCountedPointer<QuicAckListenerInterface> listener, |
129 size_t* num_bytes_consumed); | 129 size_t* num_bytes_consumed); |
130 | 130 |
131 // Returns true if there are frames pending to be serialized. | 131 // Returns true if there are frames pending to be serialized. |
132 bool HasPendingFrames() const; | 132 bool HasPendingFrames() const; |
133 | 133 |
134 // Returns true if there are retransmittable frames pending to be serialized. | 134 // Returns true if there are retransmittable frames pending to be serialized. |
135 bool HasPendingRetransmittableFrames() const; | 135 bool HasPendingRetransmittableFrames() const; |
136 | 136 |
137 // Returns the number of bytes which are available to be used by additional | 137 // Returns the number of bytes which are available to be used by additional |
138 // frames in the packet. Since stream frames are slightly smaller when they | 138 // frames in the packet. Since stream frames are slightly smaller when they |
(...skipping 14 matching lines...) Expand all Loading... |
153 size_t PacketSize(); | 153 size_t PacketSize(); |
154 | 154 |
155 // Tries to add |frame| to the packet creator's list of frames to be | 155 // Tries to add |frame| to the packet creator's list of frames to be |
156 // serialized. If the frame does not fit into the current packet, flushes the | 156 // serialized. If the frame does not fit into the current packet, flushes the |
157 // packet and returns false. | 157 // packet and returns false. |
158 bool AddSavedFrame(const QuicFrame& frame); | 158 bool AddSavedFrame(const QuicFrame& frame); |
159 | 159 |
160 // Identical to AddSavedFrame, but allows the frame to be padded. | 160 // Identical to AddSavedFrame, but allows the frame to be padded. |
161 bool AddPaddedSavedFrame(const QuicFrame& frame); | 161 bool AddPaddedSavedFrame(const QuicFrame& frame); |
162 | 162 |
163 // Adds |listener| to the next serialized packet and notifies the | 163 // Adds |listener| to the next serialized packet and notifies the listener |
164 // std::listener with |length| as the number of acked bytes. | 164 // with |length| as the number of acked bytes. |
165 void AddAckListener(scoped_refptr<QuicAckListenerInterface> listener, | 165 void AddAckListener( |
166 QuicPacketLength length); | 166 QuicReferenceCountedPointer<QuicAckListenerInterface> listener, |
| 167 QuicPacketLength length); |
167 | 168 |
168 // Creates a version negotiation packet which supports |supported_versions|. | 169 // Creates a version negotiation packet which supports |supported_versions|. |
169 std::unique_ptr<QuicEncryptedPacket> SerializeVersionNegotiationPacket( | 170 std::unique_ptr<QuicEncryptedPacket> SerializeVersionNegotiationPacket( |
170 const QuicVersionVector& supported_versions); | 171 const QuicVersionVector& supported_versions); |
171 | 172 |
172 // Returns a dummy packet that is valid but contains no useful information. | 173 // Returns a dummy packet that is valid but contains no useful information. |
173 static SerializedPacket NoPacket(); | 174 static SerializedPacket NoPacket(); |
174 | 175 |
175 // Sets the encryption level that will be applied to new packets. | 176 // Sets the encryption level that will be applied to new packets. |
176 void set_encryption_level(EncryptionLevel level) { | 177 void set_encryption_level(EncryptionLevel level) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 313 |
313 // Map mapping path_id to last sent packet number on the path. | 314 // Map mapping path_id to last sent packet number on the path. |
314 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; | 315 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; |
315 | 316 |
316 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 317 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
317 }; | 318 }; |
318 | 319 |
319 } // namespace net | 320 } // namespace net |
320 | 321 |
321 #endif // NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ | 322 #endif // NET_QUIC_CORE_QUIC_PACKET_CREATOR_H_ |
OLD | NEW |