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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) {} | 191 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) {} |
192 | 192 |
193 // Called when a version negotiation packet has been received. | 193 // Called when a version negotiation packet has been received. |
194 virtual void OnVersionNegotiationPacket( | 194 virtual void OnVersionNegotiationPacket( |
195 const QuicVersionNegotiationPacket& packet) {} | 195 const QuicVersionNegotiationPacket& packet) {} |
196 | 196 |
197 // Called after a packet has been successfully parsed which results | 197 // Called after a packet has been successfully parsed which results |
198 // in the revival of a packet via FEC. | 198 // in the revival of a packet via FEC. |
199 virtual void OnRevivedPacket(const QuicPacketHeader& revived_header, | 199 virtual void OnRevivedPacket(const QuicPacketHeader& revived_header, |
200 base::StringPiece payload) {} | 200 base::StringPiece payload) {} |
| 201 |
| 202 // Called when the connection is closed. |
| 203 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) {} |
201 }; | 204 }; |
202 | 205 |
203 class NET_EXPORT_PRIVATE QuicConnectionHelperInterface { | 206 class NET_EXPORT_PRIVATE QuicConnectionHelperInterface { |
204 public: | 207 public: |
205 virtual ~QuicConnectionHelperInterface() {} | 208 virtual ~QuicConnectionHelperInterface() {} |
206 | 209 |
207 // Returns a QuicClock to be used for all time related functions. | 210 // Returns a QuicClock to be used for all time related functions. |
208 virtual const QuicClock* GetClock() const = 0; | 211 virtual const QuicClock* GetClock() const = 0; |
209 | 212 |
210 // Returns a QuicRandom to be used for all random number related functions. | 213 // Returns a QuicRandom to be used for all random number related functions. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 359 |
357 // QuicPacketGenerator::DelegateInterface | 360 // QuicPacketGenerator::DelegateInterface |
358 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, | 361 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, |
359 HasRetransmittableData retransmittable, | 362 HasRetransmittableData retransmittable, |
360 IsHandshake handshake) OVERRIDE; | 363 IsHandshake handshake) OVERRIDE; |
361 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; | 364 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; |
362 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; | 365 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; |
363 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; | 366 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; |
364 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; | 367 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; |
365 | 368 |
| 369 // 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 |
| 371 // the SHLO. |
| 372 void OnHandshakeComplete(); |
| 373 |
366 // Accessors | 374 // Accessors |
367 void set_visitor(QuicConnectionVisitorInterface* visitor) { | 375 void set_visitor(QuicConnectionVisitorInterface* visitor) { |
368 visitor_ = visitor; | 376 visitor_ = visitor; |
369 } | 377 } |
370 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { | 378 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { |
371 debug_visitor_.reset(debug_visitor); | 379 debug_visitor_.reset(debug_visitor); |
372 packet_generator_.set_debug_delegate(debug_visitor); | 380 packet_generator_.set_debug_delegate(debug_visitor); |
373 sent_packet_manager_.set_debug_delegate(debug_visitor); | 381 sent_packet_manager_.set_debug_delegate(debug_visitor); |
374 } | 382 } |
375 const IPEndPoint& self_address() const { return self_address_; } | 383 const IPEndPoint& self_address() const { return self_address_; } |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 // If non-empty this contains the set of versions received in a | 795 // If non-empty this contains the set of versions received in a |
788 // version negotiation packet. | 796 // version negotiation packet. |
789 QuicVersionVector server_supported_versions_; | 797 QuicVersionVector server_supported_versions_; |
790 | 798 |
791 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 799 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
792 }; | 800 }; |
793 | 801 |
794 } // namespace net | 802 } // namespace net |
795 | 803 |
796 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 804 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |