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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 virtual bool HasPendingHandshake() const = 0; | 104 virtual bool HasPendingHandshake() const = 0; |
105 | 105 |
106 // Called to ask if any streams are open in this visitor, excluding the | 106 // Called to ask if any streams are open in this visitor, excluding the |
107 // reserved crypto and headers stream. | 107 // reserved crypto and headers stream. |
108 virtual bool HasOpenDataStreams() const = 0; | 108 virtual bool HasOpenDataStreams() const = 0; |
109 }; | 109 }; |
110 | 110 |
111 // Interface which gets callbacks from the QuicConnection at interesting | 111 // Interface which gets callbacks from the QuicConnection at interesting |
112 // points. Implementations must not mutate the state of the connection | 112 // points. Implementations must not mutate the state of the connection |
113 // as a result of these callbacks. | 113 // as a result of these callbacks. |
114 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitorInterface | 114 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor |
115 : public QuicPacketGenerator::DebugDelegateInterface { | 115 : public QuicPacketGenerator::DebugDelegate { |
116 public: | 116 public: |
117 virtual ~QuicConnectionDebugVisitorInterface() {} | 117 virtual ~QuicConnectionDebugVisitor() {} |
118 | 118 |
119 // Called when a packet has been sent. | 119 // Called when a packet has been sent. |
120 virtual void OnPacketSent(QuicPacketSequenceNumber sequence_number, | 120 virtual void OnPacketSent(QuicPacketSequenceNumber sequence_number, |
121 EncryptionLevel level, | 121 EncryptionLevel level, |
122 TransmissionType transmission_type, | 122 TransmissionType transmission_type, |
123 const QuicEncryptedPacket& packet, | 123 const QuicEncryptedPacket& packet, |
124 WriteResult result) {} | 124 WriteResult result) {} |
125 | 125 |
126 // Called when the contents of a packet have been retransmitted as | 126 // Called when the contents of a packet have been retransmitted as |
127 // a new packet. | 127 // a new packet. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 IsHandshake handshake) OVERRIDE; | 337 IsHandshake handshake) OVERRIDE; |
338 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; | 338 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; |
339 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; | 339 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; |
340 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; | 340 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; |
341 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; | 341 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; |
342 | 342 |
343 // Accessors | 343 // Accessors |
344 void set_visitor(QuicConnectionVisitorInterface* visitor) { | 344 void set_visitor(QuicConnectionVisitorInterface* visitor) { |
345 visitor_ = visitor; | 345 visitor_ = visitor; |
346 } | 346 } |
347 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) { | 347 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { |
348 debug_visitor_ = debug_visitor; | 348 debug_visitor_ = debug_visitor; |
349 packet_generator_.set_debug_delegate(debug_visitor); | 349 packet_generator_.set_debug_delegate(debug_visitor); |
350 } | 350 } |
351 const IPEndPoint& self_address() const { return self_address_; } | 351 const IPEndPoint& self_address() const { return self_address_; } |
352 const IPEndPoint& peer_address() const { return peer_address_; } | 352 const IPEndPoint& peer_address() const { return peer_address_; } |
353 QuicConnectionId connection_id() const { return connection_id_; } | 353 QuicConnectionId connection_id() const { return connection_id_; } |
354 const QuicClock* clock() const { return clock_; } | 354 const QuicClock* clock() const { return clock_; } |
355 QuicRandom* random_generator() const { return random_generator_; } | 355 QuicRandom* random_generator() const { return random_generator_; } |
356 size_t max_packet_length() const { | 356 size_t max_packet_length() const { |
357 return packet_creator_.max_packet_length(); | 357 return packet_creator_.max_packet_length(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 scoped_ptr<QuicAlarm> send_alarm_; | 691 scoped_ptr<QuicAlarm> send_alarm_; |
692 // An alarm that is scheduled when the connection can still write and there | 692 // An alarm that is scheduled when the connection can still write and there |
693 // may be more data to send. | 693 // may be more data to send. |
694 scoped_ptr<QuicAlarm> resume_writes_alarm_; | 694 scoped_ptr<QuicAlarm> resume_writes_alarm_; |
695 // An alarm that fires when the connection may have timed out. | 695 // An alarm that fires when the connection may have timed out. |
696 scoped_ptr<QuicAlarm> timeout_alarm_; | 696 scoped_ptr<QuicAlarm> timeout_alarm_; |
697 // An alarm that fires when a ping should be sent. | 697 // An alarm that fires when a ping should be sent. |
698 scoped_ptr<QuicAlarm> ping_alarm_; | 698 scoped_ptr<QuicAlarm> ping_alarm_; |
699 | 699 |
700 QuicConnectionVisitorInterface* visitor_; | 700 QuicConnectionVisitorInterface* visitor_; |
701 QuicConnectionDebugVisitorInterface* debug_visitor_; | 701 QuicConnectionDebugVisitor* debug_visitor_; |
702 QuicPacketCreator packet_creator_; | 702 QuicPacketCreator packet_creator_; |
703 QuicPacketGenerator packet_generator_; | 703 QuicPacketGenerator packet_generator_; |
704 | 704 |
705 // Network idle time before we kill of this connection. | 705 // Network idle time before we kill of this connection. |
706 QuicTime::Delta idle_network_timeout_; | 706 QuicTime::Delta idle_network_timeout_; |
707 // Overall connection timeout. | 707 // Overall connection timeout. |
708 QuicTime::Delta overall_connection_timeout_; | 708 QuicTime::Delta overall_connection_timeout_; |
709 | 709 |
710 // Statistics for this session. | 710 // Statistics for this session. |
711 QuicConnectionStats stats_; | 711 QuicConnectionStats stats_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // If non-empty this contains the set of versions received in a | 756 // If non-empty this contains the set of versions received in a |
757 // version negotiation packet. | 757 // version negotiation packet. |
758 QuicVersionVector server_supported_versions_; | 758 QuicVersionVector server_supported_versions_; |
759 | 759 |
760 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 760 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
761 }; | 761 }; |
762 | 762 |
763 } // namespace net | 763 } // namespace net |
764 | 764 |
765 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 765 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |