| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // will be the one last used. | 487 // will be the one last used. |
| 488 void SetAlternativeDecrypter(QuicDecrypter* decrypter, | 488 void SetAlternativeDecrypter(QuicDecrypter* decrypter, |
| 489 EncryptionLevel level, | 489 EncryptionLevel level, |
| 490 bool latch_once_used); | 490 bool latch_once_used); |
| 491 | 491 |
| 492 const QuicDecrypter* decrypter() const; | 492 const QuicDecrypter* decrypter() const; |
| 493 const QuicDecrypter* alternative_decrypter() const; | 493 const QuicDecrypter* alternative_decrypter() const; |
| 494 | 494 |
| 495 bool is_server() const { return is_server_; } | 495 bool is_server() const { return is_server_; } |
| 496 | 496 |
| 497 // Allow easy overriding of truncated connection IDs. |
| 498 void set_can_truncate_connection_ids(bool can) { |
| 499 can_truncate_connection_ids_ = can; |
| 500 } |
| 501 |
| 497 // Returns the underlying sent packet manager. | 502 // Returns the underlying sent packet manager. |
| 498 const QuicSentPacketManager& sent_packet_manager() const { | 503 const QuicSentPacketManager& sent_packet_manager() const { |
| 499 return sent_packet_manager_; | 504 return sent_packet_manager_; |
| 500 } | 505 } |
| 501 | 506 |
| 502 bool CanWrite(HasRetransmittableData retransmittable); | 507 bool CanWrite(HasRetransmittableData retransmittable); |
| 503 | 508 |
| 504 // Stores current batch state for connection, puts the connection | 509 // Stores current batch state for connection, puts the connection |
| 505 // into batch mode, and destruction restores the stored batch state. | 510 // into batch mode, and destruction restores the stored batch state. |
| 506 // While the bundler is in scope, any generated frames are bundled | 511 // While the bundler is in scope, any generated frames are bundled |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 virtual void SendOrQueuePacket(QueuedPacket packet); | 555 virtual void SendOrQueuePacket(QueuedPacket packet); |
| 551 | 556 |
| 552 QuicConnectionHelperInterface* helper() { return helper_; } | 557 QuicConnectionHelperInterface* helper() { return helper_; } |
| 553 | 558 |
| 554 // Selects and updates the version of the protocol being used by selecting a | 559 // Selects and updates the version of the protocol being used by selecting a |
| 555 // version from |available_versions| which is also supported. Returns true if | 560 // version from |available_versions| which is also supported. Returns true if |
| 556 // such a version exists, false otherwise. | 561 // such a version exists, false otherwise. |
| 557 bool SelectMutualVersion(const QuicVersionVector& available_versions); | 562 bool SelectMutualVersion(const QuicVersionVector& available_versions); |
| 558 | 563 |
| 559 QuicPacketWriter* writer() { return writer_; } | 564 QuicPacketWriter* writer() { return writer_; } |
| 565 const QuicPacketWriter* writer() const { return writer_; } |
| 560 | 566 |
| 561 bool peer_port_changed() const { return peer_port_changed_; } | 567 bool peer_port_changed() const { return peer_port_changed_; } |
| 562 | 568 |
| 563 QuicPacketSequenceNumber sequence_number_of_last_sent_packet() const { | 569 QuicPacketSequenceNumber sequence_number_of_last_sent_packet() const { |
| 564 return sequence_number_of_last_sent_packet_; | 570 return sequence_number_of_last_sent_packet_; |
| 565 } | 571 } |
| 566 | 572 |
| 567 private: | 573 private: |
| 568 friend class test::QuicConnectionPeer; | 574 friend class test::QuicConnectionPeer; |
| 569 friend class test::PacketSavingConnection; | 575 friend class test::PacketSavingConnection; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 bool peer_port_changed_; | 810 bool peer_port_changed_; |
| 805 | 811 |
| 806 // Set to true if the UDP packet headers are addressed to a different IP. | 812 // Set to true if the UDP packet headers are addressed to a different IP. |
| 807 // We do not support connection migration when the self IP changed. | 813 // We do not support connection migration when the self IP changed. |
| 808 bool self_ip_changed_; | 814 bool self_ip_changed_; |
| 809 | 815 |
| 810 // Set to true if the UDP packet headers are addressed to a different port. | 816 // Set to true if the UDP packet headers are addressed to a different port. |
| 811 // We do not support connection migration when the self port changed. | 817 // We do not support connection migration when the self port changed. |
| 812 bool self_port_changed_; | 818 bool self_port_changed_; |
| 813 | 819 |
| 820 // Set to false if the connection should not send truncated connection IDs to |
| 821 // the peer, even if the peer supports it. |
| 822 bool can_truncate_connection_ids_; |
| 823 |
| 814 // If non-empty this contains the set of versions received in a | 824 // If non-empty this contains the set of versions received in a |
| 815 // version negotiation packet. | 825 // version negotiation packet. |
| 816 QuicVersionVector server_supported_versions_; | 826 QuicVersionVector server_supported_versions_; |
| 817 | 827 |
| 818 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 828 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 819 }; | 829 }; |
| 820 | 830 |
| 821 } // namespace net | 831 } // namespace net |
| 822 | 832 |
| 823 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 833 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |