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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 678 |
679 // Migrate the connection if peer address changes. This function should only | 679 // Migrate the connection if peer address changes. This function should only |
680 // be called after the packet is validated. | 680 // be called after the packet is validated. |
681 virtual void MaybeMigrateConnectionToNewPeerAddress(); | 681 virtual void MaybeMigrateConnectionToNewPeerAddress(); |
682 | 682 |
683 // Selects and updates the version of the protocol being used by selecting a | 683 // Selects and updates the version of the protocol being used by selecting a |
684 // version from |available_versions| which is also supported. Returns true if | 684 // version from |available_versions| which is also supported. Returns true if |
685 // such a version exists, false otherwise. | 685 // such a version exists, false otherwise. |
686 bool SelectMutualVersion(const QuicVersionVector& available_versions); | 686 bool SelectMutualVersion(const QuicVersionVector& available_versions); |
687 | 687 |
688 bool peer_ip_changed() const { return peer_ip_changed_; } | |
689 | |
690 bool peer_port_changed() const { return peer_port_changed_; } | |
691 | |
692 const IPAddress& migrating_peer_ip() const { return migrating_peer_ip_; } | |
693 | |
694 uint16_t migrating_peer_port() const { return migrating_peer_port_; } | |
695 | |
696 const IPEndPoint& last_packet_source_address() const { | 688 const IPEndPoint& last_packet_source_address() const { |
697 return last_packet_source_address_; | 689 return last_packet_source_address_; |
698 } | 690 } |
699 | 691 |
700 // Returns the current per-packet options for the connection. | 692 // Returns the current per-packet options for the connection. |
701 PerPacketOptions* per_packet_options() { return per_packet_options_; } | 693 PerPacketOptions* per_packet_options() { return per_packet_options_; } |
702 // Sets the current per-packet options for the connection. The QuicConnection | 694 // Sets the current per-packet options for the connection. The QuicConnection |
703 // does not take ownership of |options|; |options| must live for as long as | 695 // does not take ownership of |options|; |options| must live for as long as |
704 // the QuicConnection is in use. | 696 // the QuicConnection is in use. |
705 void set_per_packet_options(PerPacketOptions* options) { | 697 void set_per_packet_options(PerPacketOptions* options) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 QuicPacketNumber first_required_forward_secure_packet_; | 832 QuicPacketNumber first_required_forward_secure_packet_; |
841 const QuicClock* clock_; | 833 const QuicClock* clock_; |
842 QuicRandom* random_generator_; | 834 QuicRandom* random_generator_; |
843 | 835 |
844 const QuicConnectionId connection_id_; | 836 const QuicConnectionId connection_id_; |
845 // Address on the last successfully processed packet received from the | 837 // Address on the last successfully processed packet received from the |
846 // client. | 838 // client. |
847 IPEndPoint self_address_; | 839 IPEndPoint self_address_; |
848 IPEndPoint peer_address_; | 840 IPEndPoint peer_address_; |
849 | 841 |
850 // Used to store latest peer IP address for IP address migration. | |
851 IPAddress migrating_peer_ip_; | |
852 // Used to store latest peer port to possibly migrate to later. | |
853 uint16_t migrating_peer_port_; | |
854 | |
855 // True if the last packet has gotten far enough in the framer to be | 842 // True if the last packet has gotten far enough in the framer to be |
856 // decrypted. | 843 // decrypted. |
857 bool last_packet_decrypted_; | 844 bool last_packet_decrypted_; |
858 QuicByteCount last_size_; // Size of the last received packet. | 845 QuicByteCount last_size_; // Size of the last received packet. |
859 // TODO(rch): remove this when b/27221014 is fixed. | 846 // TODO(rch): remove this when b/27221014 is fixed. |
860 const char* current_packet_data_; // UDP payload of packet currently being | 847 const char* current_packet_data_; // UDP payload of packet currently being |
861 // parsed or nullptr. | 848 // parsed or nullptr. |
862 EncryptionLevel last_decrypted_packet_level_; | 849 EncryptionLevel last_decrypted_packet_level_; |
863 QuicPacketHeader last_header_; | 850 QuicPacketHeader last_header_; |
864 QuicStopWaitingFrame last_stop_waiting_frame_; | 851 QuicStopWaitingFrame last_stop_waiting_frame_; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 // The state of connection in version negotiation finite state machine. | 978 // The state of connection in version negotiation finite state machine. |
992 QuicVersionNegotiationState version_negotiation_state_; | 979 QuicVersionNegotiationState version_negotiation_state_; |
993 | 980 |
994 // Tracks if the connection was created by the server or the client. | 981 // Tracks if the connection was created by the server or the client. |
995 Perspective perspective_; | 982 Perspective perspective_; |
996 | 983 |
997 // True by default. False if we've received or sent an explicit connection | 984 // True by default. False if we've received or sent an explicit connection |
998 // close. | 985 // close. |
999 bool connected_; | 986 bool connected_; |
1000 | 987 |
1001 // Set to true if the UDP packet headers have a new IP address for the peer. | |
1002 bool peer_ip_changed_; | |
1003 | |
1004 // Set to true if the UDP packet headers have a new port for the peer. | |
1005 bool peer_port_changed_; | |
1006 | |
1007 // Set to true if the UDP packet headers are addressed to a different IP. | |
1008 // We do not support connection migration when the self IP changed. | |
1009 bool self_ip_changed_; | |
1010 | |
1011 // Set to true if the UDP packet headers are addressed to a different port. | |
1012 // We do not support connection migration when the self port changed. | |
1013 bool self_port_changed_; | |
1014 | |
1015 // Destination address of the last received packet. | 988 // Destination address of the last received packet. |
1016 IPEndPoint last_packet_destination_address_; | 989 IPEndPoint last_packet_destination_address_; |
1017 | 990 |
1018 // Source address of the last received packet. | 991 // Source address of the last received packet. |
1019 IPEndPoint last_packet_source_address_; | 992 IPEndPoint last_packet_source_address_; |
1020 | 993 |
1021 // Set to false if the connection should not send truncated connection IDs to | 994 // Set to false if the connection should not send truncated connection IDs to |
1022 // the peer, even if the peer supports it. | 995 // the peer, even if the peer supports it. |
1023 bool can_truncate_connection_ids_; | 996 bool can_truncate_connection_ids_; |
1024 | 997 |
(...skipping 25 matching lines...) Expand all Loading... |
1050 | 1023 |
1051 // If true, multipath is enabled for this connection. | 1024 // If true, multipath is enabled for this connection. |
1052 bool multipath_enabled_; | 1025 bool multipath_enabled_; |
1053 | 1026 |
1054 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 1027 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
1055 }; | 1028 }; |
1056 | 1029 |
1057 } // namespace net | 1030 } // namespace net |
1058 | 1031 |
1059 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 1032 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |