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 #ifndef NET_QUIC_QUIC_FRAMER_H_ | 5 #ifndef NET_QUIC_QUIC_FRAMER_H_ |
6 #define NET_QUIC_QUIC_FRAMER_H_ | 6 #define NET_QUIC_QUIC_FRAMER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 QuicPacketNumberLength packet_number_length); | 279 QuicPacketNumberLength packet_number_length); |
280 | 280 |
281 // Returns the associated data from the encrypted packet |encrypted| as a | 281 // Returns the associated data from the encrypted packet |encrypted| as a |
282 // stringpiece. | 282 // stringpiece. |
283 static base::StringPiece GetAssociatedDataFromEncryptedPacket( | 283 static base::StringPiece GetAssociatedDataFromEncryptedPacket( |
284 const QuicEncryptedPacket& encrypted, | 284 const QuicEncryptedPacket& encrypted, |
285 QuicConnectionIdLength connection_id_length, | 285 QuicConnectionIdLength connection_id_length, |
286 bool includes_version, | 286 bool includes_version, |
287 QuicPacketNumberLength packet_number_length); | 287 QuicPacketNumberLength packet_number_length); |
288 | 288 |
289 // Returns a QuicPacket* that is owned by the caller, is created from | 289 // Serializes a packet containing |frames| into |buffer|. |
290 // |frames|. Returns nullptr if the packet could not be created. | 290 // Returns the length of the packet, which must not be longer than |
291 // The packet must be of size |packet_size|. | 291 // |packet_length|. Returns 0 if it fails to serialize. |
292 QuicPacket* BuildDataPacket(const QuicPacketHeader& header, | 292 size_t BuildDataPacket(const QuicPacketHeader& header, |
293 const QuicFrames& frames, | 293 const QuicFrames& frames, |
294 char* buffer, | 294 char* buffer, |
295 size_t packet_length); | 295 size_t packet_length); |
296 | 296 |
297 // Returns a QuicPacket* that is owned by the caller, and is populated with | 297 // Returns a QuicPacket* that is owned by the caller, and is populated with |
298 // the fields in |header| and |fec|. Returns nullptr if the packet could | 298 // the fields in |header| and |fec|. Returns nullptr if the packet could |
299 // not be created. | 299 // not be created. |
300 QuicPacket* BuildFecPacket(const QuicPacketHeader& header, | 300 QuicPacket* BuildFecPacket(const QuicPacketHeader& header, |
301 base::StringPiece redundancy); | 301 base::StringPiece redundancy); |
302 | 302 |
303 // Returns a new public reset packet, owned by the caller. | 303 // Returns a new public reset packet, owned by the caller. |
304 static QuicEncryptedPacket* BuildPublicResetPacket( | 304 static QuicEncryptedPacket* BuildPublicResetPacket( |
305 const QuicPublicResetPacket& packet); | 305 const QuicPublicResetPacket& packet); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // The time delta computed for the last timestamp frame. This is relative to | 544 // The time delta computed for the last timestamp frame. This is relative to |
545 // the creation_time. | 545 // the creation_time. |
546 QuicTime::Delta last_timestamp_; | 546 QuicTime::Delta last_timestamp_; |
547 | 547 |
548 DISALLOW_COPY_AND_ASSIGN(QuicFramer); | 548 DISALLOW_COPY_AND_ASSIGN(QuicFramer); |
549 }; | 549 }; |
550 | 550 |
551 } // namespace net | 551 } // namespace net |
552 | 552 |
553 #endif // NET_QUIC_QUIC_FRAMER_H_ | 553 #endif // NET_QUIC_QUIC_FRAMER_H_ |
OLD | NEW |