| 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 <stdint.h> |
| 21 |
| 20 #include <deque> | 22 #include <deque> |
| 21 #include <list> | 23 #include <list> |
| 22 #include <map> | 24 #include <map> |
| 23 #include <queue> | 25 #include <queue> |
| 24 #include <string> | 26 #include <string> |
| 25 #include <vector> | 27 #include <vector> |
| 26 | 28 |
| 27 #include "base/basictypes.h" | |
| 28 #include "base/logging.h" | 29 #include "base/logging.h" |
| 30 #include "base/macros.h" |
| 29 #include "base/memory/scoped_ptr.h" | 31 #include "base/memory/scoped_ptr.h" |
| 30 #include "base/strings/string_piece.h" | 32 #include "base/strings/string_piece.h" |
| 31 #include "net/base/ip_endpoint.h" | 33 #include "net/base/ip_endpoint.h" |
| 32 #include "net/quic/crypto/quic_decrypter.h" | 34 #include "net/quic/crypto/quic_decrypter.h" |
| 33 #include "net/quic/quic_alarm.h" | 35 #include "net/quic/quic_alarm.h" |
| 34 #include "net/quic/quic_blocked_writer_interface.h" | 36 #include "net/quic/quic_blocked_writer_interface.h" |
| 35 #include "net/quic/quic_fec_group.h" | 37 #include "net/quic/quic_fec_group.h" |
| 36 #include "net/quic/quic_framer.h" | 38 #include "net/quic/quic_framer.h" |
| 37 #include "net/quic/quic_packet_creator.h" | 39 #include "net/quic/quic_packet_creator.h" |
| 38 #include "net/quic/quic_packet_generator.h" | 40 #include "net/quic/quic_packet_generator.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // |target_mtu|. | 617 // |target_mtu|. |
| 616 void SendMtuDiscoveryPacket(QuicByteCount target_mtu); | 618 void SendMtuDiscoveryPacket(QuicByteCount target_mtu); |
| 617 | 619 |
| 618 // Sends an MTU discovery packet of size |mtu_discovery_target_| and updates | 620 // Sends an MTU discovery packet of size |mtu_discovery_target_| and updates |
| 619 // the MTU discovery alarm. | 621 // the MTU discovery alarm. |
| 620 void DiscoverMtu(); | 622 void DiscoverMtu(); |
| 621 | 623 |
| 622 // Return the name of the cipher of the primary decrypter of the framer. | 624 // Return the name of the cipher of the primary decrypter of the framer. |
| 623 const char* cipher_name() const { return framer_.decrypter()->cipher_name(); } | 625 const char* cipher_name() const { return framer_.decrypter()->cipher_name(); } |
| 624 // Return the id of the cipher of the primary decrypter of the framer. | 626 // Return the id of the cipher of the primary decrypter of the framer. |
| 625 uint32 cipher_id() const { return framer_.decrypter()->cipher_id(); } | 627 uint32_t cipher_id() const { return framer_.decrypter()->cipher_id(); } |
| 626 | 628 |
| 627 std::vector<QuicEncryptedPacket*>* termination_packets() { | 629 std::vector<QuicEncryptedPacket*>* termination_packets() { |
| 628 return termination_packets_.get(); | 630 return termination_packets_.get(); |
| 629 } | 631 } |
| 630 | 632 |
| 631 bool ack_frame_updated() const; | 633 bool ack_frame_updated() const; |
| 632 | 634 |
| 633 protected: | 635 protected: |
| 634 // Packets which have not been written to the wire. | 636 // Packets which have not been written to the wire. |
| 635 struct QueuedPacket { | 637 struct QueuedPacket { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 | 802 |
| 801 const QuicConnectionId connection_id_; | 803 const QuicConnectionId connection_id_; |
| 802 // Address on the last successfully processed packet received from the | 804 // Address on the last successfully processed packet received from the |
| 803 // client. | 805 // client. |
| 804 IPEndPoint self_address_; | 806 IPEndPoint self_address_; |
| 805 IPEndPoint peer_address_; | 807 IPEndPoint peer_address_; |
| 806 | 808 |
| 807 // Used to store latest peer IP address for IP address migration. | 809 // Used to store latest peer IP address for IP address migration. |
| 808 IPAddressNumber migrating_peer_ip_; | 810 IPAddressNumber migrating_peer_ip_; |
| 809 // Used to store latest peer port to possibly migrate to later. | 811 // Used to store latest peer port to possibly migrate to later. |
| 810 uint16 migrating_peer_port_; | 812 uint16_t migrating_peer_port_; |
| 811 | 813 |
| 812 // True if the last packet has gotten far enough in the framer to be | 814 // True if the last packet has gotten far enough in the framer to be |
| 813 // decrypted. | 815 // decrypted. |
| 814 bool last_packet_decrypted_; | 816 bool last_packet_decrypted_; |
| 815 bool last_packet_revived_; // True if the last packet was revived from FEC. | 817 bool last_packet_revived_; // True if the last packet was revived from FEC. |
| 816 QuicByteCount last_size_; // Size of the last received packet. | 818 QuicByteCount last_size_; // Size of the last received packet. |
| 817 EncryptionLevel last_decrypted_packet_level_; | 819 EncryptionLevel last_decrypted_packet_level_; |
| 818 QuicPacketHeader last_header_; | 820 QuicPacketHeader last_header_; |
| 819 QuicStopWaitingFrame last_stop_waiting_frame_; | 821 QuicStopWaitingFrame last_stop_waiting_frame_; |
| 820 bool should_last_packet_instigate_acks_; | 822 bool should_last_packet_instigate_acks_; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 | 986 |
| 985 // Whether a GoAway has been received. | 987 // Whether a GoAway has been received. |
| 986 bool goaway_received_; | 988 bool goaway_received_; |
| 987 | 989 |
| 988 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 990 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 989 }; | 991 }; |
| 990 | 992 |
| 991 } // namespace net | 993 } // namespace net |
| 992 | 994 |
| 993 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 995 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |