| 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 // |
| 11 // On the client side, the Connection handles the raw reads, as well as the | 11 // On the client side, the Connection handles the raw reads, as well as the |
| 12 // processing. | 12 // processing. |
| 13 // | 13 // |
| 14 // Note: this class is not thread-safe. | 14 // Note: this class is not thread-safe. |
| 15 | 15 |
| 16 #ifndef NET_QUIC_QUIC_CONNECTION_H_ | 16 #ifndef NET_QUIC_QUIC_CONNECTION_H_ |
| 17 #define NET_QUIC_QUIC_CONNECTION_H_ | 17 #define NET_QUIC_QUIC_CONNECTION_H_ |
| 18 | 18 |
| 19 #include <stddef.h> | 19 #include <stddef.h> |
| 20 #include <deque> | 20 #include <deque> |
| 21 #include <list> | 21 #include <list> |
| 22 #include <map> | 22 #include <map> |
| 23 #include <queue> | 23 #include <queue> |
| 24 #include <string> | 24 #include <string> |
| 25 #include <vector> | 25 #include <vector> |
| 26 | 26 |
| 27 #include "base/basictypes.h" |
| 27 #include "base/logging.h" | 28 #include "base/logging.h" |
| 28 #include "net/base/iovec.h" | 29 #include "net/base/iovec.h" |
| 29 #include "net/base/ip_endpoint.h" | 30 #include "net/base/ip_endpoint.h" |
| 30 #include "net/quic/iovector.h" | 31 #include "net/quic/iovector.h" |
| 31 #include "net/quic/quic_ack_notifier.h" | 32 #include "net/quic/quic_ack_notifier.h" |
| 32 #include "net/quic/quic_ack_notifier_manager.h" | 33 #include "net/quic/quic_ack_notifier_manager.h" |
| 33 #include "net/quic/quic_alarm.h" | 34 #include "net/quic/quic_alarm.h" |
| 34 #include "net/quic/quic_blocked_writer_interface.h" | 35 #include "net/quic/quic_blocked_writer_interface.h" |
| 35 #include "net/quic/quic_connection_stats.h" | 36 #include "net/quic/quic_connection_stats.h" |
| 36 #include "net/quic/quic_packet_creator.h" | 37 #include "net/quic/quic_packet_creator.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 const PacketWriterFactory& writer_factory, | 252 const PacketWriterFactory& writer_factory, |
| 252 bool owns_writer, | 253 bool owns_writer, |
| 253 bool is_server, | 254 bool is_server, |
| 254 bool is_secure, | 255 bool is_secure, |
| 255 const QuicVersionVector& supported_versions); | 256 const QuicVersionVector& supported_versions); |
| 256 ~QuicConnection() override; | 257 ~QuicConnection() override; |
| 257 | 258 |
| 258 // Sets connection parameters from the supplied |config|. | 259 // Sets connection parameters from the supplied |config|. |
| 259 void SetFromConfig(const QuicConfig& config); | 260 void SetFromConfig(const QuicConfig& config); |
| 260 | 261 |
| 262 // Called by the Session when the client has provided CachedNetworkParameters. |
| 263 // Virtual for tests. |
| 264 virtual void ResumeConnectionState( |
| 265 const CachedNetworkParameters& cached_network_params); |
| 266 |
| 261 // Sets the number of active streams on the connection for congestion control. | 267 // Sets the number of active streams on the connection for congestion control. |
| 262 void SetNumOpenStreams(size_t num_streams); | 268 void SetNumOpenStreams(size_t num_streams); |
| 263 | 269 |
| 264 // Send the data in |data| to the peer in as few packets as possible. | 270 // Send the data in |data| to the peer in as few packets as possible. |
| 265 // Returns a pair with the number of bytes consumed from data, and a boolean | 271 // Returns a pair with the number of bytes consumed from data, and a boolean |
| 266 // indicating if the fin bit was consumed. This does not indicate the data | 272 // indicating if the fin bit was consumed. This does not indicate the data |
| 267 // has been sent on the wire: it may have been turned into a packet and queued | 273 // has been sent on the wire: it may have been turned into a packet and queued |
| 268 // if the socket was unexpectedly blocked. |fec_protection| indicates if | 274 // if the socket was unexpectedly blocked. |fec_protection| indicates if |
| 269 // data is to be FEC protected. Note that data that is sent immediately | 275 // data is to be FEC protected. Note that data that is sent immediately |
| 270 // following MUST_FEC_PROTECT data may get protected by falling within the | 276 // following MUST_FEC_PROTECT data may get protected by falling within the |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 QuicPacketSequenceNumber first_required_forward_secure_packet_; | 688 QuicPacketSequenceNumber first_required_forward_secure_packet_; |
| 683 const QuicClock* clock_; | 689 const QuicClock* clock_; |
| 684 QuicRandom* random_generator_; | 690 QuicRandom* random_generator_; |
| 685 | 691 |
| 686 const QuicConnectionId connection_id_; | 692 const QuicConnectionId connection_id_; |
| 687 // Address on the last successfully processed packet received from the | 693 // Address on the last successfully processed packet received from the |
| 688 // client. | 694 // client. |
| 689 IPEndPoint self_address_; | 695 IPEndPoint self_address_; |
| 690 IPEndPoint peer_address_; | 696 IPEndPoint peer_address_; |
| 691 // Used to store latest peer port to possibly migrate to later. | 697 // Used to store latest peer port to possibly migrate to later. |
| 692 int migrating_peer_port_; | 698 uint16 migrating_peer_port_; |
| 693 | 699 |
| 694 // True if the last packet has gotten far enough in the framer to be | 700 // True if the last packet has gotten far enough in the framer to be |
| 695 // decrypted. | 701 // decrypted. |
| 696 bool last_packet_decrypted_; | 702 bool last_packet_decrypted_; |
| 697 bool last_packet_revived_; // True if the last packet was revived from FEC. | 703 bool last_packet_revived_; // True if the last packet was revived from FEC. |
| 698 QuicByteCount last_size_; // Size of the last received packet. | 704 QuicByteCount last_size_; // Size of the last received packet. |
| 699 EncryptionLevel last_decrypted_packet_level_; | 705 EncryptionLevel last_decrypted_packet_level_; |
| 700 QuicPacketHeader last_header_; | 706 QuicPacketHeader last_header_; |
| 701 std::vector<QuicStreamFrame> last_stream_frames_; | 707 std::vector<QuicStreamFrame> last_stream_frames_; |
| 702 std::vector<QuicAckFrame> last_ack_frames_; | 708 std::vector<QuicAckFrame> last_ack_frames_; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 // Overall connection timeout. | 782 // Overall connection timeout. |
| 777 QuicTime::Delta overall_connection_timeout_; | 783 QuicTime::Delta overall_connection_timeout_; |
| 778 | 784 |
| 779 // Statistics for this session. | 785 // Statistics for this session. |
| 780 QuicConnectionStats stats_; | 786 QuicConnectionStats stats_; |
| 781 | 787 |
| 782 // The time that we got a packet for this connection. | 788 // The time that we got a packet for this connection. |
| 783 // This is used for timeouts, and does not indicate the packet was processed. | 789 // This is used for timeouts, and does not indicate the packet was processed. |
| 784 QuicTime time_of_last_received_packet_; | 790 QuicTime time_of_last_received_packet_; |
| 785 | 791 |
| 786 // The last time a new (non-retransmitted) packet was sent for this | 792 // The last time this connection began sending a new (non-retransmitted) |
| 787 // connection. | 793 // packet. |
| 788 QuicTime time_of_last_sent_new_packet_; | 794 QuicTime time_of_last_sent_new_packet_; |
| 789 | 795 |
| 790 // Sequence number of the last sent packet. Packets are guaranteed to be sent | 796 // Sequence number of the last sent packet. Packets are guaranteed to be sent |
| 791 // in sequence number order. | 797 // in sequence number order. |
| 792 QuicPacketSequenceNumber sequence_number_of_last_sent_packet_; | 798 QuicPacketSequenceNumber sequence_number_of_last_sent_packet_; |
| 793 | 799 |
| 794 // Sent packet manager which tracks the status of packets sent by this | 800 // Sent packet manager which tracks the status of packets sent by this |
| 795 // connection and contains the send and receive algorithms to determine when | 801 // connection and contains the send and receive algorithms to determine when |
| 796 // to send packets. | 802 // to send packets. |
| 797 QuicSentPacketManager sent_packet_manager_; | 803 QuicSentPacketManager sent_packet_manager_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 838 |
| 833 // True if this is a secure QUIC connection. | 839 // True if this is a secure QUIC connection. |
| 834 bool is_secure_; | 840 bool is_secure_; |
| 835 | 841 |
| 836 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 842 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 837 }; | 843 }; |
| 838 | 844 |
| 839 } // namespace net | 845 } // namespace net |
| 840 | 846 |
| 841 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 847 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |