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 // The entity that handles framing writes for a Quic client or server. | 5 // The entity that handles framing writes for a Quic client or server. |
6 // Each QuicSession will have a connection associated with it. | 6 // Each QuicSession will have a connection associated with it. |
7 // | 7 // |
8 // On the server side, the Dispatcher handles the raw reads, and hands off | 8 // On the server side, the Dispatcher handles the raw reads, and hands off |
9 // packets via ProcessUdpPacket for framing and processing. | 9 // packets via ProcessUdpPacket for framing and processing. |
10 // | 10 // |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Called when the connection failed to write because the socket was blocked. | 88 // Called when the connection failed to write because the socket was blocked. |
89 virtual void OnWriteBlocked() = 0; | 89 virtual void OnWriteBlocked() = 0; |
90 | 90 |
91 // Called once a specific QUIC version is agreed by both endpoints. | 91 // Called once a specific QUIC version is agreed by both endpoints. |
92 virtual void OnSuccessfulVersionNegotiation(const QuicVersion& version) = 0; | 92 virtual void OnSuccessfulVersionNegotiation(const QuicVersion& version) = 0; |
93 | 93 |
94 // Called when a blocked socket becomes writable. | 94 // Called when a blocked socket becomes writable. |
95 virtual void OnCanWrite() = 0; | 95 virtual void OnCanWrite() = 0; |
96 | 96 |
| 97 // Called when the connection experiences a change in congestion window. |
| 98 virtual void OnCongestionWindowChange(QuicTime now) = 0; |
| 99 |
97 // Called to ask if the visitor wants to schedule write resumption as it both | 100 // Called to ask if the visitor wants to schedule write resumption as it both |
98 // has pending data to write, and is able to write (e.g. based on flow control | 101 // has pending data to write, and is able to write (e.g. based on flow control |
99 // limits). | 102 // limits). |
100 // Writes may be pending because they were write-blocked, congestion-throttled | 103 // Writes may be pending because they were write-blocked, congestion-throttled |
101 // or yielded to other connections. | 104 // or yielded to other connections. |
102 virtual bool WillingAndAbleToWrite() const = 0; | 105 virtual bool WillingAndAbleToWrite() const = 0; |
103 | 106 |
104 // Called to ask if any handshake messages are pending in this visitor. | 107 // Called to ask if any handshake messages are pending in this visitor. |
105 virtual bool HasPendingHandshake() const = 0; | 108 virtual bool HasPendingHandshake() const = 0; |
106 | 109 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 218 |
216 // Creates a new platform-specific alarm which will be configured to | 219 // Creates a new platform-specific alarm which will be configured to |
217 // notify |delegate| when the alarm fires. Caller takes ownership | 220 // notify |delegate| when the alarm fires. Caller takes ownership |
218 // of the new alarm, which will not yet be "set" to fire. | 221 // of the new alarm, which will not yet be "set" to fire. |
219 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0; | 222 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0; |
220 }; | 223 }; |
221 | 224 |
222 class NET_EXPORT_PRIVATE QuicConnection | 225 class NET_EXPORT_PRIVATE QuicConnection |
223 : public QuicFramerVisitorInterface, | 226 : public QuicFramerVisitorInterface, |
224 public QuicBlockedWriterInterface, | 227 public QuicBlockedWriterInterface, |
225 public QuicPacketGenerator::DelegateInterface { | 228 public QuicPacketGenerator::DelegateInterface, |
| 229 public QuicSentPacketManager::NetworkChangeVisitor { |
226 public: | 230 public: |
227 enum PacketType { | 231 enum PacketType { |
228 NORMAL, | 232 NORMAL, |
229 QUEUED, | 233 QUEUED, |
230 CONNECTION_CLOSE | 234 CONNECTION_CLOSE |
231 }; | 235 }; |
232 | 236 |
233 enum AckBundling { | 237 enum AckBundling { |
234 NO_ACK = 0, | 238 NO_ACK = 0, |
235 SEND_ACK = 1, | 239 SEND_ACK = 1, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 363 |
360 // QuicPacketGenerator::DelegateInterface | 364 // QuicPacketGenerator::DelegateInterface |
361 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, | 365 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, |
362 HasRetransmittableData retransmittable, | 366 HasRetransmittableData retransmittable, |
363 IsHandshake handshake) OVERRIDE; | 367 IsHandshake handshake) OVERRIDE; |
364 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; | 368 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; |
365 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; | 369 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; |
366 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; | 370 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; |
367 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; | 371 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; |
368 | 372 |
| 373 // QuicSentPacketManager::NetworkChangeVisitor |
| 374 virtual void OnCongestionWindowChange( |
| 375 QuicByteCount congestion_window) OVERRIDE; |
| 376 |
369 // Called by the crypto stream when the handshake completes. In the server's | 377 // Called by the crypto stream when the handshake completes. In the server's |
370 // case this is when the SHLO has been ACKed. Clients call this on receipt of | 378 // case this is when the SHLO has been ACKed. Clients call this on receipt of |
371 // the SHLO. | 379 // the SHLO. |
372 void OnHandshakeComplete(); | 380 void OnHandshakeComplete(); |
373 | 381 |
374 // Accessors | 382 // Accessors |
375 void set_visitor(QuicConnectionVisitorInterface* visitor) { | 383 void set_visitor(QuicConnectionVisitorInterface* visitor) { |
376 visitor_ = visitor; | 384 visitor_ = visitor; |
377 } | 385 } |
378 // This method takes ownership of |debug_visitor|. | 386 // This method takes ownership of |debug_visitor|. |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 // If non-empty this contains the set of versions received in a | 804 // If non-empty this contains the set of versions received in a |
797 // version negotiation packet. | 805 // version negotiation packet. |
798 QuicVersionVector server_supported_versions_; | 806 QuicVersionVector server_supported_versions_; |
799 | 807 |
800 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 808 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
801 }; | 809 }; |
802 | 810 |
803 } // namespace net | 811 } // namespace net |
804 | 812 |
805 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 813 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |