| 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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 }; | 773 }; |
| 774 | 774 |
| 775 typedef QuicPacketPublicHeader QuicVersionNegotiationPacket; | 775 typedef QuicPacketPublicHeader QuicVersionNegotiationPacket; |
| 776 | 776 |
| 777 // A padding frame contains no payload. | 777 // A padding frame contains no payload. |
| 778 struct NET_EXPORT_PRIVATE QuicPaddingFrame { | 778 struct NET_EXPORT_PRIVATE QuicPaddingFrame { |
| 779 QuicPaddingFrame() : num_padding_bytes(-1) {} | 779 QuicPaddingFrame() : num_padding_bytes(-1) {} |
| 780 explicit QuicPaddingFrame(int num_padding_bytes) | 780 explicit QuicPaddingFrame(int num_padding_bytes) |
| 781 : num_padding_bytes(num_padding_bytes) {} | 781 : num_padding_bytes(num_padding_bytes) {} |
| 782 | 782 |
| 783 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
| 784 const QuicPaddingFrame& s); |
| 785 |
| 783 // -1: full padding to the end of a max-sized packet | 786 // -1: full padding to the end of a max-sized packet |
| 784 // otherwise: only pad up to num_padding_bytes bytes | 787 // otherwise: only pad up to num_padding_bytes bytes |
| 785 int num_padding_bytes; | 788 int num_padding_bytes; |
| 786 }; | 789 }; |
| 787 | 790 |
| 788 // A ping frame contains no payload, though it is retransmittable, | 791 // A ping frame contains no payload, though it is retransmittable, |
| 789 // and ACK'd just like other normal frames. | 792 // and ACK'd just like other normal frames. |
| 790 struct NET_EXPORT_PRIVATE QuicPingFrame {}; | 793 struct NET_EXPORT_PRIVATE QuicPingFrame {}; |
| 791 | 794 |
| 792 // A path MTU discovery frame contains no payload and is serialized as a ping | 795 // A path MTU discovery frame contains no payload and is serialized as a ping |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 842 |
| 840 struct NET_EXPORT_PRIVATE QuicStreamFrame { | 843 struct NET_EXPORT_PRIVATE QuicStreamFrame { |
| 841 QuicStreamFrame(); | 844 QuicStreamFrame(); |
| 842 QuicStreamFrame(QuicStreamId stream_id, | 845 QuicStreamFrame(QuicStreamId stream_id, |
| 843 bool fin, | 846 bool fin, |
| 844 QuicStreamOffset offset, | 847 QuicStreamOffset offset, |
| 845 base::StringPiece data); | 848 base::StringPiece data); |
| 846 QuicStreamFrame(QuicStreamId stream_id, | 849 QuicStreamFrame(QuicStreamId stream_id, |
| 847 bool fin, | 850 bool fin, |
| 848 QuicStreamOffset offset, | 851 QuicStreamOffset offset, |
| 849 QuicPacketLength frame_length, | 852 QuicPacketLength data_length, |
| 850 UniqueStreamBuffer buffer); | 853 UniqueStreamBuffer buffer); |
| 851 ~QuicStreamFrame(); | 854 ~QuicStreamFrame(); |
| 852 | 855 |
| 853 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, | 856 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
| 854 const QuicStreamFrame& s); | 857 const QuicStreamFrame& s); |
| 855 | 858 |
| 856 QuicStreamId stream_id; | 859 QuicStreamId stream_id; |
| 857 bool fin; | 860 bool fin; |
| 858 QuicPacketLength frame_length; | 861 QuicPacketLength data_length; |
| 859 const char* frame_buffer; | 862 const char* data_buffer; |
| 860 QuicStreamOffset offset; // Location of this data in the stream. | 863 QuicStreamOffset offset; // Location of this data in the stream. |
| 861 // nullptr when the QuicStreamFrame is received, and non-null when sent. | 864 // nullptr when the QuicStreamFrame is received, and non-null when sent. |
| 862 UniqueStreamBuffer buffer; | 865 UniqueStreamBuffer buffer; |
| 863 | 866 |
| 864 private: | 867 private: |
| 865 QuicStreamFrame(QuicStreamId stream_id, | 868 QuicStreamFrame(QuicStreamId stream_id, |
| 866 bool fin, | 869 bool fin, |
| 867 QuicStreamOffset offset, | 870 QuicStreamOffset offset, |
| 868 const char* frame_buffer, | 871 const char* data_buffer, |
| 869 QuicPacketLength frame_length, | 872 QuicPacketLength data_length, |
| 870 UniqueStreamBuffer buffer); | 873 UniqueStreamBuffer buffer); |
| 871 | 874 |
| 872 DISALLOW_COPY_AND_ASSIGN(QuicStreamFrame); | 875 DISALLOW_COPY_AND_ASSIGN(QuicStreamFrame); |
| 873 }; | 876 }; |
| 874 static_assert(sizeof(QuicStreamFrame) <= 64, | 877 static_assert(sizeof(QuicStreamFrame) <= 64, |
| 875 "Keep the QuicStreamFrame size to a cacheline."); | 878 "Keep the QuicStreamFrame size to a cacheline."); |
| 876 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing | 879 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing |
| 877 // is finalized. | 880 // is finalized. |
| 878 typedef std::set<QuicPacketNumber> PacketNumberSet; | 881 typedef std::set<QuicPacketNumber> PacketNumberSet; |
| 879 typedef std::list<QuicPacketNumber> PacketNumberList; | 882 typedef std::list<QuicPacketNumber> PacketNumberList; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 // 0: no padding | 1399 // 0: no padding |
| 1397 // otherwise: only pad up to num_padding_bytes bytes | 1400 // otherwise: only pad up to num_padding_bytes bytes |
| 1398 int num_padding_bytes; | 1401 int num_padding_bytes; |
| 1399 QuicPathId path_id; | 1402 QuicPathId path_id; |
| 1400 QuicPacketNumber packet_number; | 1403 QuicPacketNumber packet_number; |
| 1401 QuicPacketNumberLength packet_number_length; | 1404 QuicPacketNumberLength packet_number_length; |
| 1402 EncryptionLevel encryption_level; | 1405 EncryptionLevel encryption_level; |
| 1403 QuicPacketEntropyHash entropy_hash; | 1406 QuicPacketEntropyHash entropy_hash; |
| 1404 bool has_ack; | 1407 bool has_ack; |
| 1405 bool has_stop_waiting; | 1408 bool has_stop_waiting; |
| 1409 QuicPathId original_path_id; |
| 1406 QuicPacketNumber original_packet_number; | 1410 QuicPacketNumber original_packet_number; |
| 1407 TransmissionType transmission_type; | 1411 TransmissionType transmission_type; |
| 1408 | 1412 |
| 1409 // Optional notifiers which will be informed when this packet has been ACKed. | 1413 // Optional notifiers which will be informed when this packet has been ACKed. |
| 1410 std::list<AckListenerWrapper> listeners; | 1414 std::list<AckListenerWrapper> listeners; |
| 1411 }; | 1415 }; |
| 1412 | 1416 |
| 1413 struct NET_EXPORT_PRIVATE TransmissionInfo { | 1417 struct NET_EXPORT_PRIVATE TransmissionInfo { |
| 1414 // Used by STL when assigning into a map. | 1418 // Used by STL when assigning into a map. |
| 1415 TransmissionInfo(); | 1419 TransmissionInfo(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1491 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
| 1488 | 1492 |
| 1489 const struct iovec* iov; | 1493 const struct iovec* iov; |
| 1490 const int iov_count; | 1494 const int iov_count; |
| 1491 const size_t total_length; | 1495 const size_t total_length; |
| 1492 }; | 1496 }; |
| 1493 | 1497 |
| 1494 } // namespace net | 1498 } // namespace net |
| 1495 | 1499 |
| 1496 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1500 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |