| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 QUEUED, | 197 QUEUED, |
| 198 CONNECTION_CLOSE | 198 CONNECTION_CLOSE |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 enum AckBundling { | 201 enum AckBundling { |
| 202 NO_ACK = 0, | 202 NO_ACK = 0, |
| 203 SEND_ACK = 1, | 203 SEND_ACK = 1, |
| 204 BUNDLE_PENDING_ACK = 2, | 204 BUNDLE_PENDING_ACK = 2, |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 // Constructs a new QuicConnection for the specified |guid| and |address|. | 207 // Constructs a new QuicConnection for |connection_id| and |address|. |
| 208 // |helper| and |writer| must outlive this connection. | 208 // |helper| and |writer| must outlive this connection. |
| 209 QuicConnection(QuicGuid guid, | 209 QuicConnection(QuicConnectionId connection_id, |
| 210 IPEndPoint address, | 210 IPEndPoint address, |
| 211 QuicConnectionHelperInterface* helper, | 211 QuicConnectionHelperInterface* helper, |
| 212 QuicPacketWriter* writer, | 212 QuicPacketWriter* writer, |
| 213 bool is_server, | 213 bool is_server, |
| 214 const QuicVersionVector& supported_versions); | 214 const QuicVersionVector& supported_versions); |
| 215 virtual ~QuicConnection(); | 215 virtual ~QuicConnection(); |
| 216 | 216 |
| 217 // Sets connection parameters from the supplied |config|. | 217 // Sets connection parameters from the supplied |config|. |
| 218 void SetFromConfig(const QuicConfig& config); | 218 void SetFromConfig(const QuicConfig& config); |
| 219 | 219 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 // Accessors | 334 // Accessors |
| 335 void set_visitor(QuicConnectionVisitorInterface* visitor) { | 335 void set_visitor(QuicConnectionVisitorInterface* visitor) { |
| 336 visitor_ = visitor; | 336 visitor_ = visitor; |
| 337 } | 337 } |
| 338 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) { | 338 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) { |
| 339 debug_visitor_ = debug_visitor; | 339 debug_visitor_ = debug_visitor; |
| 340 packet_generator_.set_debug_delegate(debug_visitor); | 340 packet_generator_.set_debug_delegate(debug_visitor); |
| 341 } | 341 } |
| 342 const IPEndPoint& self_address() const { return self_address_; } | 342 const IPEndPoint& self_address() const { return self_address_; } |
| 343 const IPEndPoint& peer_address() const { return peer_address_; } | 343 const IPEndPoint& peer_address() const { return peer_address_; } |
| 344 QuicGuid guid() const { return guid_; } | 344 QuicConnectionId connection_id() const { return connection_id_; } |
| 345 const QuicClock* clock() const { return clock_; } | 345 const QuicClock* clock() const { return clock_; } |
| 346 QuicRandom* random_generator() const { return random_generator_; } | 346 QuicRandom* random_generator() const { return random_generator_; } |
| 347 | 347 |
| 348 QuicPacketCreator::Options* options() { return packet_creator_.options(); } | 348 QuicPacketCreator::Options* options() { return packet_creator_.options(); } |
| 349 | 349 |
| 350 bool connected() const { return connected_; } | 350 bool connected() const { return connected_; } |
| 351 | 351 |
| 352 // Must only be called on client connections. | 352 // Must only be called on client connections. |
| 353 const QuicVersionVector& server_supported_versions() const { | 353 const QuicVersionVector& server_supported_versions() const { |
| 354 DCHECK(!is_server_); | 354 DCHECK(!is_server_); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 // Closes any FEC groups protecting packets before |sequence_number|. | 595 // Closes any FEC groups protecting packets before |sequence_number|. |
| 596 void CloseFecGroupsBefore(QuicPacketSequenceNumber sequence_number); | 596 void CloseFecGroupsBefore(QuicPacketSequenceNumber sequence_number); |
| 597 | 597 |
| 598 QuicFramer framer_; | 598 QuicFramer framer_; |
| 599 QuicConnectionHelperInterface* helper_; // Not owned. | 599 QuicConnectionHelperInterface* helper_; // Not owned. |
| 600 QuicPacketWriter* writer_; // Not owned. | 600 QuicPacketWriter* writer_; // Not owned. |
| 601 EncryptionLevel encryption_level_; | 601 EncryptionLevel encryption_level_; |
| 602 const QuicClock* clock_; | 602 const QuicClock* clock_; |
| 603 QuicRandom* random_generator_; | 603 QuicRandom* random_generator_; |
| 604 | 604 |
| 605 const QuicGuid guid_; | 605 const QuicConnectionId connection_id_; |
| 606 // Address on the last successfully processed packet received from the | 606 // Address on the last successfully processed packet received from the |
| 607 // client. | 607 // client. |
| 608 IPEndPoint self_address_; | 608 IPEndPoint self_address_; |
| 609 IPEndPoint peer_address_; | 609 IPEndPoint peer_address_; |
| 610 | 610 |
| 611 bool last_packet_revived_; // True if the last packet was revived from FEC. | 611 bool last_packet_revived_; // True if the last packet was revived from FEC. |
| 612 size_t last_size_; // Size of the last received packet. | 612 size_t last_size_; // Size of the last received packet. |
| 613 QuicPacketHeader last_header_; | 613 QuicPacketHeader last_header_; |
| 614 std::vector<QuicStreamFrame> last_stream_frames_; | 614 std::vector<QuicStreamFrame> last_stream_frames_; |
| 615 std::vector<QuicAckFrame> last_ack_frames_; | 615 std::vector<QuicAckFrame> last_ack_frames_; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 // If non-empty this contains the set of versions received in a | 724 // If non-empty this contains the set of versions received in a |
| 725 // version negotiation packet. | 725 // version negotiation packet. |
| 726 QuicVersionVector server_supported_versions_; | 726 QuicVersionVector server_supported_versions_; |
| 727 | 727 |
| 728 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 728 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 729 }; | 729 }; |
| 730 | 730 |
| 731 } // namespace net | 731 } // namespace net |
| 732 | 732 |
| 733 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 733 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |