Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: net/quic/quic_sent_packet_manager_interface.h

Issue 2002083002: Add QuicSentPacketManagerInterface, and QuicSentPacketManager implements it. No functional change e… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_QUIC_QUIC_SENT_PACKET_MANAGER_INTERFACE_H_
6 #define NET_QUIC_QUIC_SENT_PACKET_MANAGER_INTERFACE_H_
7
8 #include "base/macros.h"
9 #include "net/quic/proto/cached_network_parameters.pb.h"
10 #include "net/quic/quic_protocol.h"
11 #include "net/quic/quic_sustained_bandwidth_recorder.h"
12
13 namespace net {
14
15 class QuicConfig;
16 class RttStats;
17
18 class NET_EXPORT_PRIVATE QuicSentPacketManagerInterface {
19 public:
20 // Interface which gets callbacks from the QuicSentPacketManager at
21 // interesting points. Implementations must not mutate the state of
22 // the packet manager or connection as a result of these callbacks.
23 class NET_EXPORT_PRIVATE DebugDelegate {
24 public:
25 virtual ~DebugDelegate() {}
26
27 // Called when a spurious retransmission is detected.
28 virtual void OnSpuriousPacketRetransmission(
29 TransmissionType transmission_type,
30 QuicByteCount byte_size) {}
31
32 virtual void OnIncomingAck(const QuicAckFrame& ack_frame,
33 QuicTime ack_receive_time,
34 QuicPacketNumber largest_observed,
35 bool rtt_updated,
36 QuicPacketNumber least_unacked_sent_packet) {}
37
38 virtual void OnPacketLoss(QuicPacketNumber lost_packet_number,
39 TransmissionType transmission_type,
40 QuicTime detection_time) {}
41 };
42
43 // Interface which gets callbacks from the QuicSentPacketManager when
44 // network-related state changes. Implementations must not mutate the
45 // state of the packet manager as a result of these callbacks.
46 class NET_EXPORT_PRIVATE NetworkChangeVisitor {
47 public:
48 virtual ~NetworkChangeVisitor() {}
49
50 // Called when congestion window or RTT may have changed.
51 virtual void OnCongestionChange() = 0;
52
53 // Called with the path may be degrading. Note that the path may only be
54 // temporarily degrading.
55 // TODO(jri): With multipath, this method should probably have a path_id
56 // parameter, and should maybe result in the path being marked as inactive.
57 virtual void OnPathDegrading() = 0;
58 };
59
60 virtual ~QuicSentPacketManagerInterface() {}
61
62 virtual void SetFromConfig(const QuicConfig& config) = 0;
63
64 // Resumes connection state on the default path.
65 virtual void ResumeConnectionState(
66 const CachedNetworkParameters& cached_network_params,
67 bool max_bandwidth_resumption) = 0;
68
69 // Sets number of active streams of all paths.
70 virtual void SetNumOpenStreams(size_t num_streams) = 0;
71
72 // Sets max pacing rate of the default path.
73 virtual void SetMaxPacingRate(QuicBandwidth max_pacing_rate) = 0;
74
75 virtual void SetHandshakeConfirmed() = 0;
76
77 virtual void OnIncomingAck(const QuicAckFrame& ack_frame,
78 QuicTime ack_receive_time) = 0;
79
80 virtual bool IsUnacked(QuicPathId path_id,
81 QuicPacketNumber packet_number) const = 0;
82
83 virtual bool HasRetransmittableFrames(
84 QuicPathId path_id,
85 QuicPacketNumber packet_number) const = 0;
86
87 // Requests retransmission of all unacked packets of |retransmission_type| on
88 // the default path.
89 virtual void RetransmitUnackedPackets(
90 TransmissionType retransmission_type) = 0;
91
92 // Retransmits the oldest pending packet on the path (on which retransmission
93 // alarm fires) if there is still a tail loss probe pending. Invoked after
94 // OnRetransmissionTimeout.
95 virtual bool MaybeRetransmitTailLossProbe() = 0;
96
97 // Removes the retransmittable frames from all unencrypted packets on the
98 // default path to ensure they don't get retransmitted.
99 virtual void NeuterUnencryptedPackets() = 0;
100
101 virtual bool HasPendingRetransmissions() const = 0;
102
103 virtual PendingRetransmission NextPendingRetransmission() = 0;
104
105 // Returns true if the default path has unacked packets.
106 virtual bool HasUnackedPackets() const = 0;
107
108 virtual QuicPacketNumber GetLeastUnacked(QuicPathId path_id) const = 0;
109
110 virtual bool OnPacketSent(
111 SerializedPacket* serialized_packet,
112 QuicPathId original_path_id,
113 QuicPacketNumber original_packet_number,
114 QuicTime sent_time,
115 TransmissionType transmission_type,
116 HasRetransmittableData has_retransmittable_data) = 0;
117
118 virtual void OnRetransmissionTimeout() = 0;
119
120 // Returns the earliest time we can send the next packet. Sets |path_id| to be
121 // the path on which the next packet will be sent.
122 virtual QuicTime::Delta TimeUntilSend(QuicTime now,
123 HasRetransmittableData retransmittable,
124 QuicPathId* path_id) = 0;
125
126 // Returns the earliest retransmission time of all paths.
127 // TODO(fayang): This method should not be const becasue the return value
128 // depends upon the time it is invoked.
129 virtual const QuicTime GetRetransmissionTime() const = 0;
130
131 // Returns the rtt stats of the default path.
132 virtual const RttStats* GetRttStats() const = 0;
133
134 // Returns the estimated bandwidth on default path calculated by the
135 // congestion algorithm.
136 virtual QuicBandwidth BandwidthEstimate() const = 0;
137
138 // Returns the sustained bandwidth recorder on the default path.
139 virtual const QuicSustainedBandwidthRecorder& SustainedBandwidthRecorder()
140 const = 0;
141
142 // Returns the size of the current congestion window on default path in number
143 // of kDefaultTCPMSS-sized segments.
144 virtual QuicPacketCount GetCongestionWindowInTcpMss() const = 0;
145
146 // Determines the number of packets of length |max_packet_length| which fit in
147 // the congestion windows for all paths, and returns the max number of packets
148 // across all paths.
149 virtual QuicPacketCount EstimateMaxPacketsInFlight(
150 QuicByteCount max_packet_length) const = 0;
151
152 // Returns the size of the current congestion window size on the default path
153 // in bytes.
154 virtual QuicByteCount GetCongestionWindowInBytes() const = 0;
155
156 // Returns the size of the slow start congestion window in number of 1460 byte
157 // TCP segments on the default path.
158 virtual QuicPacketCount GetSlowStartThresholdInTcpMss() const = 0;
159
160 // No longer retransmit data for |stream_id| on all paths.
161 virtual void CancelRetransmissionsForStream(QuicStreamId stream_id) = 0;
162
163 // Called when peer address changes and the connection migrates on |path_id|.
164 // TODO(fayang): Name of this method is confusing in multipath world because
165 // this migration is path level. Need to rename this as OnPeerMigration.
166 virtual void OnConnectionMigration(QuicPathId path_id,
167 PeerAddressChangeType type) = 0;
168
169 virtual bool IsHandshakeConfirmed() const = 0;
170
171 virtual void SetDebugDelegate(DebugDelegate* debug_delegate) = 0;
172
173 virtual QuicPacketNumber GetLargestObserved(QuicPathId path_id) const = 0;
174
175 virtual QuicPacketNumber GetLargestSentPacket(QuicPathId path_id) const = 0;
176
177 virtual QuicPacketNumber GetLeastPacketAwaitedByPeer(
178 QuicPathId path_id) const = 0;
179
180 virtual void SetNetworkChangeVisitor(NetworkChangeVisitor* visitor) = 0;
181
182 // Returns true if the default path is in slow start.
183 virtual bool InSlowStart() const = 0;
184
185 // These two methods return the consecutive RTO or TLP count of the default
186 // path.
187 virtual size_t GetConsecutiveRtoCount() const = 0;
188 virtual size_t GetConsecutiveTlpCount() const = 0;
189 };
190
191 } // namespace net
192
193 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_INTERFACE_H_
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698