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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 virtual void OnPacketRetransmitted( | 130 virtual void OnPacketRetransmitted( |
131 QuicPacketSequenceNumber old_sequence_number, | 131 QuicPacketSequenceNumber old_sequence_number, |
132 QuicPacketSequenceNumber new_sequence_number) {} | 132 QuicPacketSequenceNumber new_sequence_number) {} |
133 | 133 |
134 // Called when a packet has been received, but before it is | 134 // Called when a packet has been received, but before it is |
135 // validated or parsed. | 135 // validated or parsed. |
136 virtual void OnPacketReceived(const IPEndPoint& self_address, | 136 virtual void OnPacketReceived(const IPEndPoint& self_address, |
137 const IPEndPoint& peer_address, | 137 const IPEndPoint& peer_address, |
138 const QuicEncryptedPacket& packet) {} | 138 const QuicEncryptedPacket& packet) {} |
139 | 139 |
140 // Called when a packet is recived with a connection id that does not | |
wtc
2014/08/04 23:28:13
recived => received
ramant (doing other things)
2014/08/09 02:53:19
Done.
| |
141 // match the ID of this connection. | |
142 virtual void OnIncorrectConnectionId( | |
143 QuicConnectionId connection_id) {} | |
144 | |
145 // Called when an undecryptable packet has been received. | |
146 virtual void OnUndecryptablePacket() {} | |
147 | |
148 // Called when a duplicate packet has been received. | |
149 virtual void OnDuplicatePacket(QuicPacketSequenceNumber sequence_number) {} | |
150 | |
140 // Called when the protocol version on the received packet doensn't match | 151 // Called when the protocol version on the received packet doensn't match |
141 // current protocol version of the connection. | 152 // current protocol version of the connection. |
142 virtual void OnProtocolVersionMismatch(QuicVersion version) {} | 153 virtual void OnProtocolVersionMismatch(QuicVersion version) {} |
143 | 154 |
144 // Called when the complete header of a packet has been parsed. | 155 // Called when the complete header of a packet has been parsed. |
145 virtual void OnPacketHeader(const QuicPacketHeader& header) {} | 156 virtual void OnPacketHeader(const QuicPacketHeader& header) {} |
146 | 157 |
147 // Called when a StreamFrame has been parsed. | 158 // Called when a StreamFrame has been parsed. |
148 virtual void OnStreamFrame(const QuicStreamFrame& frame) {} | 159 virtual void OnStreamFrame(const QuicStreamFrame& frame) {} |
149 | 160 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 IsHandshake handshake) OVERRIDE; | 360 IsHandshake handshake) OVERRIDE; |
350 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; | 361 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; |
351 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; | 362 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; |
352 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; | 363 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; |
353 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; | 364 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; |
354 | 365 |
355 // Accessors | 366 // Accessors |
356 void set_visitor(QuicConnectionVisitorInterface* visitor) { | 367 void set_visitor(QuicConnectionVisitorInterface* visitor) { |
357 visitor_ = visitor; | 368 visitor_ = visitor; |
358 } | 369 } |
359 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { | 370 void set_debug_visitor(QuicConnectionDebugVisitor* debug_visitor) { |
wtc
2014/08/04 23:28:13
We should document that this method now takes owne
ramant (doing other things)
2014/08/09 02:53:19
Done.
| |
360 debug_visitor_ = debug_visitor; | 371 debug_visitor_.reset(debug_visitor); |
361 packet_generator_.set_debug_delegate(debug_visitor); | 372 packet_generator_.set_debug_delegate(debug_visitor); |
362 sent_packet_manager_.set_debug_delegate(debug_visitor); | 373 sent_packet_manager_.set_debug_delegate(debug_visitor); |
363 } | 374 } |
364 const IPEndPoint& self_address() const { return self_address_; } | 375 const IPEndPoint& self_address() const { return self_address_; } |
365 const IPEndPoint& peer_address() const { return peer_address_; } | 376 const IPEndPoint& peer_address() const { return peer_address_; } |
366 QuicConnectionId connection_id() const { return connection_id_; } | 377 QuicConnectionId connection_id() const { return connection_id_; } |
367 const QuicClock* clock() const { return clock_; } | 378 const QuicClock* clock() const { return clock_; } |
368 QuicRandom* random_generator() const { return random_generator_; } | 379 QuicRandom* random_generator() const { return random_generator_; } |
369 size_t max_packet_length() const; | 380 size_t max_packet_length() const; |
370 void set_max_packet_length(size_t length); | 381 void set_max_packet_length(size_t length); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
712 scoped_ptr<QuicAlarm> send_alarm_; | 723 scoped_ptr<QuicAlarm> send_alarm_; |
713 // An alarm that is scheduled when the connection can still write and there | 724 // An alarm that is scheduled when the connection can still write and there |
714 // may be more data to send. | 725 // may be more data to send. |
715 scoped_ptr<QuicAlarm> resume_writes_alarm_; | 726 scoped_ptr<QuicAlarm> resume_writes_alarm_; |
716 // An alarm that fires when the connection may have timed out. | 727 // An alarm that fires when the connection may have timed out. |
717 scoped_ptr<QuicAlarm> timeout_alarm_; | 728 scoped_ptr<QuicAlarm> timeout_alarm_; |
718 // An alarm that fires when a ping should be sent. | 729 // An alarm that fires when a ping should be sent. |
719 scoped_ptr<QuicAlarm> ping_alarm_; | 730 scoped_ptr<QuicAlarm> ping_alarm_; |
720 | 731 |
721 QuicConnectionVisitorInterface* visitor_; | 732 QuicConnectionVisitorInterface* visitor_; |
722 QuicConnectionDebugVisitor* debug_visitor_; | 733 scoped_ptr<QuicConnectionDebugVisitor> debug_visitor_; |
723 QuicPacketGenerator packet_generator_; | 734 QuicPacketGenerator packet_generator_; |
724 | 735 |
725 // Network idle time before we kill of this connection. | 736 // Network idle time before we kill of this connection. |
726 QuicTime::Delta idle_network_timeout_; | 737 QuicTime::Delta idle_network_timeout_; |
727 // Overall connection timeout. | 738 // Overall connection timeout. |
728 QuicTime::Delta overall_connection_timeout_; | 739 QuicTime::Delta overall_connection_timeout_; |
729 | 740 |
730 // Statistics for this session. | 741 // Statistics for this session. |
731 QuicConnectionStats stats_; | 742 QuicConnectionStats stats_; |
732 | 743 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
776 // If non-empty this contains the set of versions received in a | 787 // If non-empty this contains the set of versions received in a |
777 // version negotiation packet. | 788 // version negotiation packet. |
778 QuicVersionVector server_supported_versions_; | 789 QuicVersionVector server_supported_versions_; |
779 | 790 |
780 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 791 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
781 }; | 792 }; |
782 | 793 |
783 } // namespace net | 794 } // namespace net |
784 | 795 |
785 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 796 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |