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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 private: | 557 private: |
558 friend class test::QuicConnectionPeer; | 558 friend class test::QuicConnectionPeer; |
559 | 559 |
560 // Packets which have not been written to the wire. | 560 // Packets which have not been written to the wire. |
561 // Owns the QuicPacket* packet. | 561 // Owns the QuicPacket* packet. |
562 struct QueuedPacket { | 562 struct QueuedPacket { |
563 QueuedPacket(SerializedPacket packet, | 563 QueuedPacket(SerializedPacket packet, |
564 EncryptionLevel level, | 564 EncryptionLevel level, |
565 TransmissionType transmission_type); | 565 TransmissionType transmission_type); |
566 | 566 |
567 QuicPacketSequenceNumber sequence_number; | 567 SerializedPacket serialized_packet; |
568 QuicPacket* packet; | |
569 const EncryptionLevel encryption_level; | 568 const EncryptionLevel encryption_level; |
570 TransmissionType transmission_type; | 569 TransmissionType transmission_type; |
571 HasRetransmittableData retransmittable; | |
572 IsHandshake handshake; | |
573 bool is_connection_close; | |
574 QuicByteCount length; | |
575 }; | 570 }; |
576 | 571 |
577 typedef std::list<QueuedPacket> QueuedPacketList; | 572 typedef std::list<QueuedPacket> QueuedPacketList; |
578 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; | 573 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; |
579 | 574 |
580 // Writes the given packet to socket, encrypted with packet's | 575 // Writes the given packet to socket, encrypted with packet's |
581 // encryption_level. Returns true on successful write. Behavior is undefined | 576 // encryption_level. Returns true on successful write. Behavior is undefined |
582 // if connection is not established or broken. A return value of true means | 577 // if connection is not established or broken. A return value of true means |
583 // the packet was transmitted and may be destroyed. If the packet is | 578 // the packet was transmitted and may be destroyed. If the packet is |
584 // retransmittable, WritePacket sets up retransmission for a successful write. | 579 // retransmittable, WritePacket sets up retransmission for a successful write. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 void CloseFecGroupsBefore(QuicPacketSequenceNumber sequence_number); | 650 void CloseFecGroupsBefore(QuicPacketSequenceNumber sequence_number); |
656 | 651 |
657 // Sets the ping alarm to the appropriate value, if any. | 652 // Sets the ping alarm to the appropriate value, if any. |
658 void SetPingAlarm(); | 653 void SetPingAlarm(); |
659 | 654 |
660 // On arrival of a new packet, checks to see if the socket addresses have | 655 // On arrival of a new packet, checks to see if the socket addresses have |
661 // changed since the last packet we saw on this connection. | 656 // changed since the last packet we saw on this connection. |
662 void CheckForAddressMigration(const IPEndPoint& self_address, | 657 void CheckForAddressMigration(const IPEndPoint& self_address, |
663 const IPEndPoint& peer_address); | 658 const IPEndPoint& peer_address); |
664 | 659 |
| 660 HasRetransmittableData IsRetransmittable(QueuedPacket packet); |
| 661 bool IsConnectionClose(QueuedPacket packet); |
| 662 |
665 QuicFramer framer_; | 663 QuicFramer framer_; |
666 QuicConnectionHelperInterface* helper_; // Not owned. | 664 QuicConnectionHelperInterface* helper_; // Not owned. |
667 QuicPacketWriter* writer_; // Owned or not depending on |owns_writer_|. | 665 QuicPacketWriter* writer_; // Owned or not depending on |owns_writer_|. |
668 bool owns_writer_; | 666 bool owns_writer_; |
669 EncryptionLevel encryption_level_; | 667 EncryptionLevel encryption_level_; |
670 const QuicClock* clock_; | 668 const QuicClock* clock_; |
671 QuicRandom* random_generator_; | 669 QuicRandom* random_generator_; |
672 | 670 |
673 const QuicConnectionId connection_id_; | 671 const QuicConnectionId connection_id_; |
674 // Address on the last successfully processed packet received from the | 672 // Address on the last successfully processed packet received from the |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 // If non-empty this contains the set of versions received in a | 802 // If non-empty this contains the set of versions received in a |
805 // version negotiation packet. | 803 // version negotiation packet. |
806 QuicVersionVector server_supported_versions_; | 804 QuicVersionVector server_supported_versions_; |
807 | 805 |
808 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 806 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
809 }; | 807 }; |
810 | 808 |
811 } // namespace net | 809 } // namespace net |
812 | 810 |
813 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 811 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |