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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 QuicPacketHeader(); | 105 QuicPacketHeader(); |
106 explicit QuicPacketHeader(const QuicPacketPublicHeader& header); | 106 explicit QuicPacketHeader(const QuicPacketPublicHeader& header); |
107 QuicPacketHeader(const QuicPacketHeader& other); | 107 QuicPacketHeader(const QuicPacketHeader& other); |
108 | 108 |
109 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, | 109 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
110 const QuicPacketHeader& s); | 110 const QuicPacketHeader& s); |
111 | 111 |
112 QuicPacketPublicHeader public_header; | 112 QuicPacketPublicHeader public_header; |
113 QuicPacketNumber packet_number; | 113 QuicPacketNumber packet_number; |
114 QuicPathId path_id; | 114 QuicPathId path_id; |
115 bool entropy_flag; | |
116 QuicPacketEntropyHash entropy_hash; | |
117 }; | 115 }; |
118 | 116 |
119 struct NET_EXPORT_PRIVATE QuicPublicResetPacket { | 117 struct NET_EXPORT_PRIVATE QuicPublicResetPacket { |
120 QuicPublicResetPacket(); | 118 QuicPublicResetPacket(); |
121 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header); | 119 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header); |
122 | 120 |
123 QuicPacketPublicHeader public_header; | 121 QuicPacketPublicHeader public_header; |
124 QuicPublicResetNonceProof nonce_proof; | 122 QuicPublicResetNonceProof nonce_proof; |
125 // TODO(fayang): remove rejected_packet_number when deprecating | 123 // TODO(fayang): remove rejected_packet_number when deprecating |
126 // FLAGS_quic_remove_packet_number_from_public_reset. | 124 // FLAGS_quic_remove_packet_number_from_public_reset. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 215 |
218 struct NET_EXPORT_PRIVATE QuicStopWaitingFrame { | 216 struct NET_EXPORT_PRIVATE QuicStopWaitingFrame { |
219 QuicStopWaitingFrame(); | 217 QuicStopWaitingFrame(); |
220 ~QuicStopWaitingFrame(); | 218 ~QuicStopWaitingFrame(); |
221 | 219 |
222 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 220 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
223 std::ostream& os, | 221 std::ostream& os, |
224 const QuicStopWaitingFrame& s); | 222 const QuicStopWaitingFrame& s); |
225 // Path which this stop waiting frame belongs to. | 223 // Path which this stop waiting frame belongs to. |
226 QuicPathId path_id; | 224 QuicPathId path_id; |
227 // Entropy hash of all packets up to, but not including, the least unacked | |
228 // packet. | |
229 QuicPacketEntropyHash entropy_hash; | |
230 // The lowest packet we've sent which is unacked, and we expect an ack for. | 225 // The lowest packet we've sent which is unacked, and we expect an ack for. |
231 QuicPacketNumber least_unacked; | 226 QuicPacketNumber least_unacked; |
232 }; | 227 }; |
233 | 228 |
234 // A sequence of packet numbers where each number is unique. Intended to be used | 229 // A sequence of packet numbers where each number is unique. Intended to be used |
235 // in a sliding window fashion, where smaller old packet numbers are removed and | 230 // in a sliding window fashion, where smaller old packet numbers are removed and |
236 // larger new packet numbers are added, with the occasional random access. | 231 // larger new packet numbers are added, with the occasional random access. |
237 class NET_EXPORT_PRIVATE PacketNumberQueue { | 232 class NET_EXPORT_PRIVATE PacketNumberQueue { |
238 public: | 233 public: |
239 using const_iterator = IntervalSet<QuicPacketNumber>::const_iterator; | 234 using const_iterator = IntervalSet<QuicPacketNumber>::const_iterator; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 309 |
315 struct NET_EXPORT_PRIVATE QuicAckFrame { | 310 struct NET_EXPORT_PRIVATE QuicAckFrame { |
316 QuicAckFrame(); | 311 QuicAckFrame(); |
317 QuicAckFrame(const QuicAckFrame& other); | 312 QuicAckFrame(const QuicAckFrame& other); |
318 ~QuicAckFrame(); | 313 ~QuicAckFrame(); |
319 | 314 |
320 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, | 315 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
321 const QuicAckFrame& s); | 316 const QuicAckFrame& s); |
322 | 317 |
323 // The highest packet number we've observed from the peer. | 318 // The highest packet number we've observed from the peer. |
324 // | |
325 // In general, this should be the largest packet number we've received. In | |
326 // the case of truncated acks, we may have to advertise a lower "upper bound" | |
327 // than largest received, to avoid implicitly acking missing packets that | |
328 // don't fit in the missing packet list due to size limitations. In this | |
329 // case, largest_observed may be a packet which is also in the missing packets | |
330 // list. | |
331 QuicPacketNumber largest_observed; | 319 QuicPacketNumber largest_observed; |
332 | 320 |
333 // Time elapsed since largest_observed was received until this Ack frame was | 321 // Time elapsed since largest_observed was received until this Ack frame was |
334 // sent. | 322 // sent. |
335 QuicTime::Delta ack_delay_time; | 323 QuicTime::Delta ack_delay_time; |
336 | 324 |
337 // Vector of <packet_number, time> for when packets arrived. | 325 // Vector of <packet_number, time> for when packets arrived. |
338 PacketTimeVector received_packet_times; | 326 PacketTimeVector received_packet_times; |
339 | 327 |
340 // Set of packets. | 328 // Set of packets. |
341 PacketNumberQueue packets; | 329 PacketNumberQueue packets; |
342 | 330 |
343 // Path which this ack belongs to. | 331 // Path which this ack belongs to. |
344 QuicPathId path_id; | 332 QuicPathId path_id; |
345 | |
346 // Entropy hash of all packets up to largest observed not including missing | |
347 // packets. | |
348 QuicPacketEntropyHash entropy_hash; | |
349 | |
350 // Whether the ack had to be truncated when sent. | |
351 bool is_truncated; | |
352 | |
353 // If true, |packets| express missing packets. Otherwise, |packets| express | |
354 // received packets. | |
355 bool missing; | |
356 }; | 333 }; |
357 | 334 |
358 // True if the packet number is greater than largest_observed or is listed | 335 // True if the packet number is greater than largest_observed or is listed |
359 // as missing. | 336 // as missing. |
360 // Always returns false for packet numbers less than least_unacked. | 337 // Always returns false for packet numbers less than least_unacked. |
361 bool NET_EXPORT_PRIVATE | 338 bool NET_EXPORT_PRIVATE |
362 IsAwaitingPacket(const QuicAckFrame& ack_frame, | 339 IsAwaitingPacket(const QuicAckFrame& ack_frame, |
363 QuicPacketNumber packet_number, | 340 QuicPacketNumber packet_number, |
364 QuicPacketNumber peer_least_packet_awaiting_ack); | 341 QuicPacketNumber peer_least_packet_awaiting_ack); |
365 | 342 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 // Used to generate filtered supported versions based on flags. | 631 // Used to generate filtered supported versions based on flags. |
655 class NET_EXPORT_PRIVATE QuicVersionManager { | 632 class NET_EXPORT_PRIVATE QuicVersionManager { |
656 public: | 633 public: |
657 explicit QuicVersionManager(QuicVersionVector supported_versions); | 634 explicit QuicVersionManager(QuicVersionVector supported_versions); |
658 ~QuicVersionManager(); | 635 ~QuicVersionManager(); |
659 | 636 |
660 // Returns supported versions based on flags. | 637 // Returns supported versions based on flags. |
661 const QuicVersionVector& GetSupportedVersions(); | 638 const QuicVersionVector& GetSupportedVersions(); |
662 | 639 |
663 private: | 640 private: |
664 // FLAGS_quic_disable_pre_34 | |
665 bool disable_pre_34_; | |
666 // FLAGS_quic_enable_version_35 | 641 // FLAGS_quic_enable_version_35 |
667 bool enable_version_35_; | 642 bool enable_version_35_; |
668 // FLAGS_quic_enable_version_36_v2 | 643 // FLAGS_quic_enable_version_36_v2 |
669 bool enable_version_36_; | 644 bool enable_version_36_; |
670 // The list of versions that may be supported. | 645 // The list of versions that may be supported. |
671 QuicVersionVector allowed_supported_versions_; | 646 QuicVersionVector allowed_supported_versions_; |
672 // This vector contains QUIC versions which are currently supported based | 647 // This vector contains QUIC versions which are currently supported based |
673 // on flags. | 648 // on flags. |
674 QuicVersionVector filtered_supported_versions_; | 649 QuicVersionVector filtered_supported_versions_; |
675 }; | 650 }; |
676 | 651 |
677 struct NET_EXPORT_PRIVATE AckListenerWrapper { | 652 struct NET_EXPORT_PRIVATE AckListenerWrapper { |
678 AckListenerWrapper(QuicAckListenerInterface* listener, | 653 AckListenerWrapper(QuicAckListenerInterface* listener, |
679 QuicPacketLength data_length); | 654 QuicPacketLength data_length); |
680 AckListenerWrapper(const AckListenerWrapper& other); | 655 AckListenerWrapper(const AckListenerWrapper& other); |
681 ~AckListenerWrapper(); | 656 ~AckListenerWrapper(); |
682 | 657 |
683 scoped_refptr<QuicAckListenerInterface> ack_listener; | 658 scoped_refptr<QuicAckListenerInterface> ack_listener; |
684 QuicPacketLength length; | 659 QuicPacketLength length; |
685 }; | 660 }; |
686 | 661 |
687 struct NET_EXPORT_PRIVATE SerializedPacket { | 662 struct NET_EXPORT_PRIVATE SerializedPacket { |
688 SerializedPacket(QuicPathId path_id, | 663 SerializedPacket(QuicPathId path_id, |
689 QuicPacketNumber packet_number, | 664 QuicPacketNumber packet_number, |
690 QuicPacketNumberLength packet_number_length, | 665 QuicPacketNumberLength packet_number_length, |
691 const char* encrypted_buffer, | 666 const char* encrypted_buffer, |
692 QuicPacketLength encrypted_length, | 667 QuicPacketLength encrypted_length, |
693 QuicPacketEntropyHash entropy_hash, | |
694 bool has_ack, | 668 bool has_ack, |
695 bool has_stop_waiting); | 669 bool has_stop_waiting); |
696 SerializedPacket(const SerializedPacket& other); | 670 SerializedPacket(const SerializedPacket& other); |
697 ~SerializedPacket(); | 671 ~SerializedPacket(); |
698 | 672 |
699 // Not owned. | 673 // Not owned. |
700 const char* encrypted_buffer; | 674 const char* encrypted_buffer; |
701 QuicPacketLength encrypted_length; | 675 QuicPacketLength encrypted_length; |
702 QuicFrames retransmittable_frames; | 676 QuicFrames retransmittable_frames; |
703 IsHandshake has_crypto_handshake; | 677 IsHandshake has_crypto_handshake; |
704 // -1: full padding to the end of a max-sized packet | 678 // -1: full padding to the end of a max-sized packet |
705 // 0: no padding | 679 // 0: no padding |
706 // otherwise: only pad up to num_padding_bytes bytes | 680 // otherwise: only pad up to num_padding_bytes bytes |
707 int16_t num_padding_bytes; | 681 int16_t num_padding_bytes; |
708 QuicPathId path_id; | 682 QuicPathId path_id; |
709 QuicPacketNumber packet_number; | 683 QuicPacketNumber packet_number; |
710 QuicPacketNumberLength packet_number_length; | 684 QuicPacketNumberLength packet_number_length; |
711 EncryptionLevel encryption_level; | 685 EncryptionLevel encryption_level; |
712 QuicPacketEntropyHash entropy_hash; | |
713 bool has_ack; | 686 bool has_ack; |
714 bool has_stop_waiting; | 687 bool has_stop_waiting; |
715 TransmissionType transmission_type; | 688 TransmissionType transmission_type; |
716 QuicPathId original_path_id; | 689 QuicPathId original_path_id; |
717 QuicPacketNumber original_packet_number; | 690 QuicPacketNumber original_packet_number; |
718 | 691 |
719 // Optional notifiers which will be informed when this packet has been ACKed. | 692 // Optional notifiers which will be informed when this packet has been ACKed. |
720 std::list<AckListenerWrapper> listeners; | 693 std::list<AckListenerWrapper> listeners; |
721 }; | 694 }; |
722 | 695 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 771 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
799 | 772 |
800 const struct iovec* iov; | 773 const struct iovec* iov; |
801 const int iov_count; | 774 const int iov_count; |
802 const size_t total_length; | 775 const size_t total_length; |
803 }; | 776 }; |
804 | 777 |
805 } // namespace net | 778 } // namespace net |
806 | 779 |
807 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 780 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |