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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 virtual void OnFecData(const QuicFecData& fec) OVERRIDE; | 367 virtual void OnFecData(const QuicFecData& fec) OVERRIDE; |
368 virtual void OnPacketComplete() OVERRIDE; | 368 virtual void OnPacketComplete() OVERRIDE; |
369 | 369 |
370 // QuicPacketGenerator::DelegateInterface | 370 // QuicPacketGenerator::DelegateInterface |
371 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, | 371 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, |
372 HasRetransmittableData retransmittable, | 372 HasRetransmittableData retransmittable, |
373 IsHandshake handshake) OVERRIDE; | 373 IsHandshake handshake) OVERRIDE; |
374 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; | 374 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; |
375 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; | 375 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; |
376 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; | 376 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; |
377 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; | 377 virtual void OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; |
378 | 378 |
379 // QuicSentPacketManager::NetworkChangeVisitor | 379 // QuicSentPacketManager::NetworkChangeVisitor |
380 virtual void OnCongestionWindowChange( | 380 virtual void OnCongestionWindowChange( |
381 QuicByteCount congestion_window) OVERRIDE; | 381 QuicByteCount congestion_window) OVERRIDE; |
382 | 382 |
383 // Called by the crypto stream when the handshake completes. In the server's | 383 // Called by the crypto stream when the handshake completes. In the server's |
384 // case this is when the SHLO has been ACKed. Clients call this on receipt of | 384 // case this is when the SHLO has been ACKed. Clients call this on receipt of |
385 // the SHLO. | 385 // the SHLO. |
386 void OnHandshakeComplete(); | 386 void OnHandshakeComplete(); |
387 | 387 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 QuicConnection* connection_; | 519 QuicConnection* connection_; |
520 bool already_in_batch_mode_; | 520 bool already_in_batch_mode_; |
521 }; | 521 }; |
522 | 522 |
523 protected: | 523 protected: |
524 // Do any work which logically would be done in OnPacket but can not be | 524 // Do any work which logically would be done in OnPacket but can not be |
525 // safely done until the packet is validated. Returns true if the packet | 525 // safely done until the packet is validated. Returns true if the packet |
526 // can be handled, false otherwise. | 526 // can be handled, false otherwise. |
527 virtual bool ProcessValidatedPacket(); | 527 virtual bool ProcessValidatedPacket(); |
528 | 528 |
529 // Send a packet to the peer using encryption |level|. If |sequence_number| | 529 // Send a packet to the peer, and takes ownership of the packet if the packet |
530 // is present in the |retransmission_map_|, then contents of this packet will | 530 // cannot be written immediately. |
531 // be retransmitted with a new sequence number if it's not acked by the peer. | 531 virtual void SendOrQueuePacket(EncryptionLevel level, |
532 // Deletes |packet| if WritePacket call succeeds, or transfers ownership to | |
533 // QueuedPacket, ultimately deleted in WriteQueuedPackets. Updates the | |
534 // entropy map corresponding to |sequence_number| using |entropy_hash|. | |
535 // |transmission_type| and |retransmittable| are supplied to the congestion | |
536 // manager, and when |forced| is true, it bypasses the congestion manager. | |
537 // TODO(wtc): none of the callers check the return value. | |
538 virtual bool SendOrQueuePacket(EncryptionLevel level, | |
539 const SerializedPacket& packet, | 532 const SerializedPacket& packet, |
540 TransmissionType transmission_type); | 533 TransmissionType transmission_type); |
541 | 534 |
542 QuicConnectionHelperInterface* helper() { return helper_; } | 535 QuicConnectionHelperInterface* helper() { return helper_; } |
543 | 536 |
544 // Selects and updates the version of the protocol being used by selecting a | 537 // Selects and updates the version of the protocol being used by selecting a |
545 // version from |available_versions| which is also supported. Returns true if | 538 // version from |available_versions| which is also supported. Returns true if |
546 // such a version exists, false otherwise. | 539 // such a version exists, false otherwise. |
547 bool SelectMutualVersion(const QuicVersionVector& available_versions); | 540 bool SelectMutualVersion(const QuicVersionVector& available_versions); |
548 | 541 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 // If non-empty this contains the set of versions received in a | 795 // If non-empty this contains the set of versions received in a |
803 // version negotiation packet. | 796 // version negotiation packet. |
804 QuicVersionVector server_supported_versions_; | 797 QuicVersionVector server_supported_versions_; |
805 | 798 |
806 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 799 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
807 }; | 800 }; |
808 | 801 |
809 } // namespace net | 802 } // namespace net |
810 | 803 |
811 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 804 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |