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 <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const size_t kDefaultInitialWindow = 10; | 62 const size_t kDefaultInitialWindow = 10; |
63 const uint32 kMaxInitialWindow = 100; | 63 const uint32 kMaxInitialWindow = 100; |
64 | 64 |
65 // Default size of initial flow control window, for both stream and session. | 65 // Default size of initial flow control window, for both stream and session. |
66 const uint32 kDefaultFlowControlSendWindow = 16 * 1024; // 16 KB | 66 const uint32 kDefaultFlowControlSendWindow = 16 * 1024; // 16 KB |
67 | 67 |
68 // Maximum size of the congestion window, in packets, for TCP congestion control | 68 // Maximum size of the congestion window, in packets, for TCP congestion control |
69 // algorithms. | 69 // algorithms. |
70 const size_t kMaxTcpCongestionWindow = 200; | 70 const size_t kMaxTcpCongestionWindow = 200; |
71 | 71 |
| 72 // Size of the socket receive buffer in bytes. |
| 73 const QuicByteCount kDefaultSocketReceiveBuffer = 256000; |
| 74 |
72 // Don't allow a client to suggest an RTT longer than 15 seconds. | 75 // Don't allow a client to suggest an RTT longer than 15 seconds. |
73 const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; | 76 const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; |
74 | 77 |
75 // Maximum number of open streams per connection. | 78 // Maximum number of open streams per connection. |
76 const size_t kDefaultMaxStreamsPerConnection = 100; | 79 const size_t kDefaultMaxStreamsPerConnection = 100; |
77 | 80 |
78 // Number of bytes reserved for public flags in the packet header. | 81 // Number of bytes reserved for public flags in the packet header. |
79 const size_t kPublicFlagsSize = 1; | 82 const size_t kPublicFlagsSize = 1; |
80 // Number of bytes reserved for version number in the packet header. | 83 // Number of bytes reserved for version number in the packet header. |
81 const size_t kQuicVersionSize = 4; | 84 const size_t kQuicVersionSize = 4; |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 void NET_EXPORT_PRIVATE InsertMissingPacketsBetween( | 696 void NET_EXPORT_PRIVATE InsertMissingPacketsBetween( |
694 QuicAckFrame* ack_frame, | 697 QuicAckFrame* ack_frame, |
695 QuicPacketSequenceNumber lower, | 698 QuicPacketSequenceNumber lower, |
696 QuicPacketSequenceNumber higher); | 699 QuicPacketSequenceNumber higher); |
697 | 700 |
698 // Defines for all types of congestion feedback that will be negotiated in QUIC, | 701 // Defines for all types of congestion feedback that will be negotiated in QUIC, |
699 // kTCP MUST be supported by all QUIC implementations to guarantee 100% | 702 // kTCP MUST be supported by all QUIC implementations to guarantee 100% |
700 // compatibility. | 703 // compatibility. |
701 enum CongestionFeedbackType { | 704 enum CongestionFeedbackType { |
702 kTCP, // Used to mimic TCP. | 705 kTCP, // Used to mimic TCP. |
703 kInterArrival, // Use additional inter arrival information. | 706 kTimestamp, // Use additional inter arrival timestamp information. |
704 }; | 707 }; |
705 | 708 |
706 // Defines for all types of congestion control algorithms that can be used in | 709 // Defines for all types of congestion control algorithms that can be used in |
707 // QUIC. Note that this is separate from the congestion feedback type - | 710 // QUIC. Note that this is separate from the congestion feedback type - |
708 // some congestion control algorithms may use the same feedback type | 711 // some congestion control algorithms may use the same feedback type |
709 // (Reno and Cubic are the classic example for that). | 712 // (Reno and Cubic are the classic example for that). |
710 enum CongestionControlType { | 713 enum CongestionControlType { |
711 kCubic, | 714 kCubic, |
712 kReno, | 715 kReno, |
713 kBBR, | 716 kBBR, |
714 }; | 717 }; |
715 | 718 |
716 enum LossDetectionType { | 719 enum LossDetectionType { |
717 kNack, // Used to mimic TCP's loss detection. | 720 kNack, // Used to mimic TCP's loss detection. |
718 kTime, // Time based loss detection. | 721 kTime, // Time based loss detection. |
719 }; | 722 }; |
720 | 723 |
721 struct NET_EXPORT_PRIVATE CongestionFeedbackMessageTCP { | 724 struct NET_EXPORT_PRIVATE CongestionFeedbackMessageTCP { |
722 CongestionFeedbackMessageTCP(); | 725 CongestionFeedbackMessageTCP(); |
723 | 726 |
724 QuicByteCount receive_window; | 727 QuicByteCount receive_window; |
725 }; | 728 }; |
726 | 729 |
727 struct NET_EXPORT_PRIVATE CongestionFeedbackMessageInterArrival { | 730 struct NET_EXPORT_PRIVATE CongestionFeedbackMessageTimestamp { |
728 CongestionFeedbackMessageInterArrival(); | 731 CongestionFeedbackMessageTimestamp(); |
729 ~CongestionFeedbackMessageInterArrival(); | 732 ~CongestionFeedbackMessageTimestamp(); |
730 | 733 |
731 // The set of received packets since the last feedback was sent, along with | 734 // The set of received packets since the last feedback was sent, along with |
732 // their arrival times. | 735 // their arrival times. |
733 TimeMap received_packet_times; | 736 TimeMap received_packet_times; |
734 }; | 737 }; |
735 | 738 |
736 struct NET_EXPORT_PRIVATE QuicCongestionFeedbackFrame { | 739 struct NET_EXPORT_PRIVATE QuicCongestionFeedbackFrame { |
737 QuicCongestionFeedbackFrame(); | 740 QuicCongestionFeedbackFrame(); |
738 ~QuicCongestionFeedbackFrame(); | 741 ~QuicCongestionFeedbackFrame(); |
739 | 742 |
740 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 743 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
741 std::ostream& os, const QuicCongestionFeedbackFrame& c); | 744 std::ostream& os, const QuicCongestionFeedbackFrame& c); |
742 | 745 |
743 CongestionFeedbackType type; | 746 CongestionFeedbackType type; |
744 // This should really be a union, but since the inter arrival struct | 747 // This should really be a union, but since the timestamp struct |
745 // is non-trivial, C++ prohibits it. | 748 // is non-trivial, C++ prohibits it. |
746 CongestionFeedbackMessageTCP tcp; | 749 CongestionFeedbackMessageTCP tcp; |
747 CongestionFeedbackMessageInterArrival inter_arrival; | 750 CongestionFeedbackMessageTimestamp timestamp; |
748 }; | 751 }; |
749 | 752 |
750 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { | 753 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { |
751 QuicRstStreamFrame(); | 754 QuicRstStreamFrame(); |
752 QuicRstStreamFrame(QuicStreamId stream_id, | 755 QuicRstStreamFrame(QuicStreamId stream_id, |
753 QuicRstStreamErrorCode error_code, | 756 QuicRstStreamErrorCode error_code, |
754 QuicStreamOffset bytes_written); | 757 QuicStreamOffset bytes_written); |
755 | 758 |
756 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 759 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
757 std::ostream& os, const QuicRstStreamFrame& r); | 760 std::ostream& os, const QuicRstStreamFrame& r); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 // Stores the sequence numbers of all transmissions of this packet. | 1056 // Stores the sequence numbers of all transmissions of this packet. |
1054 // Can never be null. | 1057 // Can never be null. |
1055 SequenceNumberSet* all_transmissions; | 1058 SequenceNumberSet* all_transmissions; |
1056 // In flight packets have not been abandoned or lost. | 1059 // In flight packets have not been abandoned or lost. |
1057 bool in_flight; | 1060 bool in_flight; |
1058 }; | 1061 }; |
1059 | 1062 |
1060 } // namespace net | 1063 } // namespace net |
1061 | 1064 |
1062 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1065 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |