| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 CONNECTION_CLOSE | 216 CONNECTION_CLOSE |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 enum AckBundling { | 219 enum AckBundling { |
| 220 NO_ACK = 0, | 220 NO_ACK = 0, |
| 221 SEND_ACK = 1, | 221 SEND_ACK = 1, |
| 222 BUNDLE_PENDING_ACK = 2, | 222 BUNDLE_PENDING_ACK = 2, |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 // Constructs a new QuicConnection for |connection_id| and |address|. | 225 // Constructs a new QuicConnection for |connection_id| and |address|. |
| 226 // |helper| and |writer| must outlive this connection. | 226 // |helper| must outlive this connection, and if |owns_writer| is false, so |
| 227 // must |writer|. |
| 227 QuicConnection(QuicConnectionId connection_id, | 228 QuicConnection(QuicConnectionId connection_id, |
| 228 IPEndPoint address, | 229 IPEndPoint address, |
| 229 QuicConnectionHelperInterface* helper, | 230 QuicConnectionHelperInterface* helper, |
| 230 QuicPacketWriter* writer, | 231 QuicPacketWriter* writer, |
| 232 bool owns_writer, |
| 231 bool is_server, | 233 bool is_server, |
| 232 const QuicVersionVector& supported_versions); | 234 const QuicVersionVector& supported_versions); |
| 233 virtual ~QuicConnection(); | 235 virtual ~QuicConnection(); |
| 234 | 236 |
| 235 // Sets connection parameters from the supplied |config|. | 237 // Sets connection parameters from the supplied |config|. |
| 236 void SetFromConfig(const QuicConfig& config); | 238 void SetFromConfig(const QuicConfig& config); |
| 237 | 239 |
| 238 // Send the data in |data| to the peer in as few packets as possible. | 240 // Send the data in |data| to the peer in as few packets as possible. |
| 239 // Returns a pair with the number of bytes consumed from data, and a boolean | 241 // Returns a pair with the number of bytes consumed from data, and a boolean |
| 240 // indicating if the fin bit was consumed. This does not indicate the data | 242 // indicating if the fin bit was consumed. This does not indicate the data |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 // Sets the ping alarm to the appropriate value, if any. | 627 // Sets the ping alarm to the appropriate value, if any. |
| 626 void SetPingAlarm(); | 628 void SetPingAlarm(); |
| 627 | 629 |
| 628 // On arrival of a new packet, checks to see if the socket addresses have | 630 // On arrival of a new packet, checks to see if the socket addresses have |
| 629 // changed since the last packet we saw on this connection. | 631 // changed since the last packet we saw on this connection. |
| 630 void CheckForAddressMigration(const IPEndPoint& self_address, | 632 void CheckForAddressMigration(const IPEndPoint& self_address, |
| 631 const IPEndPoint& peer_address); | 633 const IPEndPoint& peer_address); |
| 632 | 634 |
| 633 QuicFramer framer_; | 635 QuicFramer framer_; |
| 634 QuicConnectionHelperInterface* helper_; // Not owned. | 636 QuicConnectionHelperInterface* helper_; // Not owned. |
| 635 QuicPacketWriter* writer_; // Not owned. | 637 QuicPacketWriter* writer_; // Owned or not depending on |owns_writer_|. |
| 638 bool owns_writer_; |
| 636 EncryptionLevel encryption_level_; | 639 EncryptionLevel encryption_level_; |
| 637 const QuicClock* clock_; | 640 const QuicClock* clock_; |
| 638 QuicRandom* random_generator_; | 641 QuicRandom* random_generator_; |
| 639 | 642 |
| 640 const QuicConnectionId connection_id_; | 643 const QuicConnectionId connection_id_; |
| 641 // Address on the last successfully processed packet received from the | 644 // Address on the last successfully processed packet received from the |
| 642 // client. | 645 // client. |
| 643 IPEndPoint self_address_; | 646 IPEndPoint self_address_; |
| 644 IPEndPoint peer_address_; | 647 IPEndPoint peer_address_; |
| 645 // Used to store latest peer port to possibly migrate to later. | 648 // Used to store latest peer port to possibly migrate to later. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // If non-empty this contains the set of versions received in a | 776 // If non-empty this contains the set of versions received in a |
| 774 // version negotiation packet. | 777 // version negotiation packet. |
| 775 QuicVersionVector server_supported_versions_; | 778 QuicVersionVector server_supported_versions_; |
| 776 | 779 |
| 777 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 780 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 778 }; | 781 }; |
| 779 | 782 |
| 780 } // namespace net | 783 } // namespace net |
| 781 | 784 |
| 782 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 785 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |