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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // points. Implementations must not mutate the state of the connection | 118 // points. Implementations must not mutate the state of the connection |
119 // as a result of these callbacks. | 119 // as a result of these callbacks. |
120 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor | 120 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor |
121 : public QuicPacketGenerator::DebugDelegate, | 121 : public QuicPacketGenerator::DebugDelegate, |
122 public QuicSentPacketManager::DebugDelegate { | 122 public QuicSentPacketManager::DebugDelegate { |
123 public: | 123 public: |
124 virtual ~QuicConnectionDebugVisitor() {} | 124 virtual ~QuicConnectionDebugVisitor() {} |
125 | 125 |
126 // Called when a packet has been sent. | 126 // Called when a packet has been sent. |
127 virtual void OnPacketSent(QuicPacketSequenceNumber sequence_number, | 127 virtual void OnPacketSent(QuicPacketSequenceNumber sequence_number, |
| 128 QuicPacketSequenceNumber original_sequence_number, |
128 EncryptionLevel level, | 129 EncryptionLevel level, |
129 TransmissionType transmission_type, | 130 TransmissionType transmission_type, |
130 const QuicEncryptedPacket& packet, | 131 const QuicEncryptedPacket& packet, |
131 WriteResult result) {} | 132 WriteResult result) {} |
132 | 133 |
133 // Called when the contents of a packet have been retransmitted as | |
134 // a new packet. | |
135 virtual void OnPacketRetransmitted( | |
136 QuicPacketSequenceNumber old_sequence_number, | |
137 QuicPacketSequenceNumber new_sequence_number) {} | |
138 | |
139 // Called when a packet has been received, but before it is | 134 // Called when a packet has been received, but before it is |
140 // validated or parsed. | 135 // validated or parsed. |
141 virtual void OnPacketReceived(const IPEndPoint& self_address, | 136 virtual void OnPacketReceived(const IPEndPoint& self_address, |
142 const IPEndPoint& peer_address, | 137 const IPEndPoint& peer_address, |
143 const QuicEncryptedPacket& packet) {} | 138 const QuicEncryptedPacket& packet) {} |
144 | 139 |
145 // Called when a packet is received with a connection id that does not | 140 // Called when a packet is received with a connection id that does not |
146 // match the ID of this connection. | 141 // match the ID of this connection. |
147 virtual void OnIncorrectConnectionId( | 142 virtual void OnIncorrectConnectionId( |
148 QuicConnectionId connection_id) {} | 143 QuicConnectionId connection_id) {} |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 418 } |
424 | 419 |
425 // Returns true if the underlying UDP socket is writable, there is | 420 // Returns true if the underlying UDP socket is writable, there is |
426 // no queued data and the connection is not congestion-control | 421 // no queued data and the connection is not congestion-control |
427 // blocked. | 422 // blocked. |
428 bool CanWriteStreamData(); | 423 bool CanWriteStreamData(); |
429 | 424 |
430 // Returns true if the connection has queued packets or frames. | 425 // Returns true if the connection has queued packets or frames. |
431 bool HasQueuedData() const; | 426 bool HasQueuedData() const; |
432 | 427 |
| 428 // TODO(ianswett): Remove when quic_unified_timeouts is removed. |
433 // Sets (or resets) the idle state connection timeout. Also, checks and times | 429 // Sets (or resets) the idle state connection timeout. Also, checks and times |
434 // out the connection if network timer has expired for |timeout|. | 430 // out the connection if network timer has expired for |timeout|. |
435 void SetIdleNetworkTimeout(QuicTime::Delta timeout); | 431 void SetIdleNetworkTimeout(QuicTime::Delta timeout); |
436 // Sets (or resets) the total time delta the connection can be alive for. | 432 // Sets (or resets) the total time delta the connection can be alive for. |
437 // Also, checks and times out the connection if timer has expired for | 433 // Also, checks and times out the connection if timer has expired for |
438 // |timeout|. Used to limit the time a connection can be alive before crypto | 434 // |timeout|. Used to limit the time a connection can be alive before crypto |
439 // handshake finishes. | 435 // handshake finishes. |
440 void SetOverallConnectionTimeout(QuicTime::Delta timeout); | 436 void SetOverallConnectionTimeout(QuicTime::Delta timeout); |
441 | 437 |
| 438 // Sets the overall and idle state connection timeouts. |
| 439 // Times out the connection if the timeout has been reached and |
| 440 // the quic_timeouts_only_from_alarms flag is false. |
| 441 void SetNetworkTimeouts(QuicTime::Delta overall_timeout, |
| 442 QuicTime::Delta idle_timeout); |
| 443 |
442 // If the connection has timed out, this will close the connection. | 444 // If the connection has timed out, this will close the connection. |
443 // Otherwise, it will reschedule the timeout alarm. | 445 // Otherwise, it will reschedule the timeout alarm. |
444 void CheckForTimeout(); | 446 void CheckForTimeout(); |
445 | 447 |
446 // Sends a ping, and resets the ping alarm. | 448 // Sends a ping, and resets the ping alarm. |
447 void SendPing(); | 449 void SendPing(); |
448 | 450 |
449 // Sets up a packet with an QuicAckFrame and sends it out. | 451 // Sets up a packet with an QuicAckFrame and sends it out. |
450 void SendAck(); | 452 void SendAck(); |
451 | 453 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 // If non-empty this contains the set of versions received in a | 811 // If non-empty this contains the set of versions received in a |
810 // version negotiation packet. | 812 // version negotiation packet. |
811 QuicVersionVector server_supported_versions_; | 813 QuicVersionVector server_supported_versions_; |
812 | 814 |
813 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 815 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
814 }; | 816 }; |
815 | 817 |
816 } // namespace net | 818 } // namespace net |
817 | 819 |
818 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 820 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |