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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 // cannot be written immediately. | 651 // cannot be written immediately. |
652 virtual void SendOrQueuePacket(QueuedPacket packet); | 652 virtual void SendOrQueuePacket(QueuedPacket packet); |
653 | 653 |
654 QuicConnectionHelperInterface* helper() { return helper_; } | 654 QuicConnectionHelperInterface* helper() { return helper_; } |
655 | 655 |
656 // Selects and updates the version of the protocol being used by selecting a | 656 // Selects and updates the version of the protocol being used by selecting a |
657 // version from |available_versions| which is also supported. Returns true if | 657 // version from |available_versions| which is also supported. Returns true if |
658 // such a version exists, false otherwise. | 658 // such a version exists, false otherwise. |
659 bool SelectMutualVersion(const QuicVersionVector& available_versions); | 659 bool SelectMutualVersion(const QuicVersionVector& available_versions); |
660 | 660 |
| 661 bool peer_ip_changed() const { return peer_ip_changed_; } |
| 662 |
661 bool peer_port_changed() const { return peer_port_changed_; } | 663 bool peer_port_changed() const { return peer_port_changed_; } |
662 | 664 |
663 private: | 665 private: |
664 friend class test::QuicConnectionPeer; | 666 friend class test::QuicConnectionPeer; |
665 friend class test::PacketSavingConnection; | 667 friend class test::PacketSavingConnection; |
666 | 668 |
667 typedef std::list<QueuedPacket> QueuedPacketList; | 669 typedef std::list<QueuedPacket> QueuedPacketList; |
668 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; | 670 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; |
669 | 671 |
670 // Writes the given packet to socket, encrypted with packet's | 672 // Writes the given packet to socket, encrypted with packet's |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 QuicPacketNumber first_required_forward_secure_packet_; | 793 QuicPacketNumber first_required_forward_secure_packet_; |
792 const QuicClock* clock_; | 794 const QuicClock* clock_; |
793 QuicRandom* random_generator_; | 795 QuicRandom* random_generator_; |
794 | 796 |
795 const QuicConnectionId connection_id_; | 797 const QuicConnectionId connection_id_; |
796 // Address on the last successfully processed packet received from the | 798 // Address on the last successfully processed packet received from the |
797 // client. | 799 // client. |
798 IPEndPoint self_address_; | 800 IPEndPoint self_address_; |
799 IPEndPoint peer_address_; | 801 IPEndPoint peer_address_; |
800 | 802 |
801 // TODO(fayang): Use migrating_peer_address_ instead of migrating_peer_ip_ | |
802 // and migrating_peer_port_ once FLAGS_quic_allow_ip_migration is deprecated. | |
803 // Used to store latest peer IP address for IP address migration. | 803 // Used to store latest peer IP address for IP address migration. |
804 IPAddressNumber migrating_peer_ip_; | 804 IPAddressNumber migrating_peer_ip_; |
805 // Used to store latest peer port to possibly migrate to later. | 805 // Used to store latest peer port to possibly migrate to later. |
806 uint16 migrating_peer_port_; | 806 uint16 migrating_peer_port_; |
807 | 807 |
808 // True if the last packet has gotten far enough in the framer to be | 808 // True if the last packet has gotten far enough in the framer to be |
809 // decrypted. | 809 // decrypted. |
810 bool last_packet_decrypted_; | 810 bool last_packet_decrypted_; |
811 bool last_packet_revived_; // True if the last packet was revived from FEC. | 811 bool last_packet_revived_; // True if the last packet was revived from FEC. |
812 QuicByteCount last_size_; // Size of the last received packet. | 812 QuicByteCount last_size_; // Size of the last received packet. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 QuicVersionNegotiationState version_negotiation_state_; | 928 QuicVersionNegotiationState version_negotiation_state_; |
929 | 929 |
930 // Tracks if the connection was created by the server or the client. | 930 // Tracks if the connection was created by the server or the client. |
931 Perspective perspective_; | 931 Perspective perspective_; |
932 | 932 |
933 // True by default. False if we've received or sent an explicit connection | 933 // True by default. False if we've received or sent an explicit connection |
934 // close. | 934 // close. |
935 bool connected_; | 935 bool connected_; |
936 | 936 |
937 // Set to true if the UDP packet headers have a new IP address for the peer. | 937 // Set to true if the UDP packet headers have a new IP address for the peer. |
938 // If true, do not perform connection migration. | |
939 bool peer_ip_changed_; | 938 bool peer_ip_changed_; |
940 | 939 |
941 // Set to true if the UDP packet headers have a new port for the peer. | 940 // Set to true if the UDP packet headers have a new port for the peer. |
942 // If true, and the IP has not changed, then we can migrate the connection. | |
943 bool peer_port_changed_; | 941 bool peer_port_changed_; |
944 | 942 |
945 // Set to true if the UDP packet headers are addressed to a different IP. | 943 // Set to true if the UDP packet headers are addressed to a different IP. |
946 // We do not support connection migration when the self IP changed. | 944 // We do not support connection migration when the self IP changed. |
947 bool self_ip_changed_; | 945 bool self_ip_changed_; |
948 | 946 |
949 // Set to true if the UDP packet headers are addressed to a different port. | 947 // Set to true if the UDP packet headers are addressed to a different port. |
950 // We do not support connection migration when the self port changed. | 948 // We do not support connection migration when the self port changed. |
951 bool self_port_changed_; | 949 bool self_port_changed_; |
952 | 950 |
(...skipping 29 matching lines...) Expand all Loading... |
982 | 980 |
983 // Whether a GoAway has been received. | 981 // Whether a GoAway has been received. |
984 bool goaway_received_; | 982 bool goaway_received_; |
985 | 983 |
986 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 984 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
987 }; | 985 }; |
988 | 986 |
989 } // namespace net | 987 } // namespace net |
990 | 988 |
991 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 989 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |