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_PROTOCOL_H_ | 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ |
6 #define NET_QUIC_QUIC_PROTOCOL_H_ | 6 #define NET_QUIC_QUIC_PROTOCOL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // to reverse the order of the bytes. | 402 // to reverse the order of the bytes. |
403 | 403 |
404 // MakeQuicTag returns a value given the four bytes. For example: | 404 // MakeQuicTag returns a value given the four bytes. For example: |
405 // MakeQuicTag('C', 'H', 'L', 'O'); | 405 // MakeQuicTag('C', 'H', 'L', 'O'); |
406 NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d); | 406 NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d); |
407 | 407 |
408 // Returns true if the tag vector contains the specified tag. | 408 // Returns true if the tag vector contains the specified tag. |
409 NET_EXPORT_PRIVATE bool ContainsQuicTag(const QuicTagVector& tag_vector, | 409 NET_EXPORT_PRIVATE bool ContainsQuicTag(const QuicTagVector& tag_vector, |
410 QuicTag tag); | 410 QuicTag tag); |
411 | 411 |
412 // Size in bytes of the data or fec packet header. | 412 // Size in bytes of the data packet header. |
413 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header); | 413 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header); |
414 | 414 |
415 NET_EXPORT_PRIVATE size_t | 415 NET_EXPORT_PRIVATE size_t |
416 GetPacketHeaderSize(QuicConnectionIdLength connection_id_length, | 416 GetPacketHeaderSize(QuicConnectionIdLength connection_id_length, |
417 bool include_version, | 417 bool include_version, |
418 bool include_path_id, | 418 bool include_path_id, |
419 QuicPacketNumberLength packet_number_length, | 419 QuicPacketNumberLength packet_number_length); |
420 InFecGroup is_in_fec_group); | |
421 | |
422 // Index of the first byte in a QUIC packet of FEC protected data. | |
423 NET_EXPORT_PRIVATE size_t | |
424 GetStartOfFecProtectedData(QuicConnectionIdLength connection_id_length, | |
425 bool include_version, | |
426 bool include_path_id, | |
427 QuicPacketNumberLength packet_number_length); | |
428 | 420 |
429 // Index of the first byte in a QUIC packet of encrypted data. | 421 // Index of the first byte in a QUIC packet of encrypted data. |
430 NET_EXPORT_PRIVATE size_t | 422 NET_EXPORT_PRIVATE size_t |
431 GetStartOfEncryptedData(QuicConnectionIdLength connection_id_length, | 423 GetStartOfEncryptedData(QuicConnectionIdLength connection_id_length, |
432 bool include_version, | 424 bool include_version, |
433 bool include_path_id, | 425 bool include_path_id, |
434 QuicPacketNumberLength packet_number_length); | 426 QuicPacketNumberLength packet_number_length); |
435 | 427 |
436 enum QuicRstStreamErrorCode { | 428 enum QuicRstStreamErrorCode { |
437 // Complete response has been sent, sending a RST to ask the other endpoint | 429 // Complete response has been sent, sending a RST to ask the other endpoint |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 bool multipath_flag; | 671 bool multipath_flag; |
680 bool reset_flag; | 672 bool reset_flag; |
681 bool version_flag; | 673 bool version_flag; |
682 QuicPacketNumberLength packet_number_length; | 674 QuicPacketNumberLength packet_number_length; |
683 QuicVersionVector versions; | 675 QuicVersionVector versions; |
684 }; | 676 }; |
685 | 677 |
686 // An integer which cannot be a packet number. | 678 // An integer which cannot be a packet number. |
687 const QuicPacketNumber kInvalidPacketNumber = 0; | 679 const QuicPacketNumber kInvalidPacketNumber = 0; |
688 | 680 |
689 // Header for Data or FEC packets. | 681 // Header for Data packets. |
690 struct NET_EXPORT_PRIVATE QuicPacketHeader { | 682 struct NET_EXPORT_PRIVATE QuicPacketHeader { |
691 QuicPacketHeader(); | 683 QuicPacketHeader(); |
692 explicit QuicPacketHeader(const QuicPacketPublicHeader& header); | 684 explicit QuicPacketHeader(const QuicPacketPublicHeader& header); |
693 QuicPacketHeader(const QuicPacketHeader& other); | 685 QuicPacketHeader(const QuicPacketHeader& other); |
694 | 686 |
695 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, | 687 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
696 const QuicPacketHeader& s); | 688 const QuicPacketHeader& s); |
697 | 689 |
698 QuicPacketPublicHeader public_header; | 690 QuicPacketPublicHeader public_header; |
699 QuicPacketNumber packet_number; | 691 QuicPacketNumber packet_number; |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 // Consider to add a convenience method which directly accepts the entire | 1197 // Consider to add a convenience method which directly accepts the entire |
1206 // public header. | 1198 // public header. |
1207 QuicPacket(char* buffer, | 1199 QuicPacket(char* buffer, |
1208 size_t length, | 1200 size_t length, |
1209 bool owns_buffer, | 1201 bool owns_buffer, |
1210 QuicConnectionIdLength connection_id_length, | 1202 QuicConnectionIdLength connection_id_length, |
1211 bool includes_version, | 1203 bool includes_version, |
1212 bool includes_path_id, | 1204 bool includes_path_id, |
1213 QuicPacketNumberLength packet_number_length); | 1205 QuicPacketNumberLength packet_number_length); |
1214 | 1206 |
1215 base::StringPiece FecProtectedData() const; | |
1216 base::StringPiece AssociatedData() const; | 1207 base::StringPiece AssociatedData() const; |
1217 base::StringPiece Plaintext() const; | 1208 base::StringPiece Plaintext() const; |
1218 | 1209 |
1219 char* mutable_data() { return buffer_; } | 1210 char* mutable_data() { return buffer_; } |
1220 | 1211 |
1221 private: | 1212 private: |
1222 char* buffer_; | 1213 char* buffer_; |
1223 const QuicConnectionIdLength connection_id_length_; | 1214 const QuicConnectionIdLength connection_id_length_; |
1224 const bool includes_version_; | 1215 const bool includes_version_; |
1225 const bool includes_path_id_; | 1216 const bool includes_path_id_; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1386 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
1396 | 1387 |
1397 const struct iovec* iov; | 1388 const struct iovec* iov; |
1398 const int iov_count; | 1389 const int iov_count; |
1399 const size_t total_length; | 1390 const size_t total_length; |
1400 }; | 1391 }; |
1401 | 1392 |
1402 } // namespace net | 1393 } // namespace net |
1403 | 1394 |
1404 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1395 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |