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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Writes may be pending because they were write-blocked, congestion-throttled | 153 // Writes may be pending because they were write-blocked, congestion-throttled |
154 // or yielded to other connections. | 154 // or yielded to other connections. |
155 virtual bool WillingAndAbleToWrite() const = 0; | 155 virtual bool WillingAndAbleToWrite() const = 0; |
156 | 156 |
157 // Called to ask if any handshake messages are pending in this visitor. | 157 // Called to ask if any handshake messages are pending in this visitor. |
158 virtual bool HasPendingHandshake() const = 0; | 158 virtual bool HasPendingHandshake() const = 0; |
159 | 159 |
160 // Called to ask if any streams are open in this visitor, excluding the | 160 // Called to ask if any streams are open in this visitor, excluding the |
161 // reserved crypto and headers stream. | 161 // reserved crypto and headers stream. |
162 virtual bool HasOpenDynamicStreams() const = 0; | 162 virtual bool HasOpenDynamicStreams() const = 0; |
| 163 |
| 164 // Save |data_length| data starts at |iov_offset| in |iov|. |
| 165 virtual void SaveStreamData(QuicStreamId id, |
| 166 QuicIOVector iov, |
| 167 size_t iov_offset, |
| 168 QuicStreamOffset offset, |
| 169 QuicByteCount data_length) = 0; |
| 170 |
| 171 // Write |data_length| data with |offset| of stream |id| to |writer|. |
| 172 virtual bool WriteStreamData(QuicStreamId id, |
| 173 QuicStreamOffset offset, |
| 174 QuicByteCount data_length, |
| 175 QuicDataWriter* writer) = 0; |
163 }; | 176 }; |
164 | 177 |
165 // Interface which gets callbacks from the QuicConnection at interesting | 178 // Interface which gets callbacks from the QuicConnection at interesting |
166 // points. Implementations must not mutate the state of the connection | 179 // points. Implementations must not mutate the state of the connection |
167 // as a result of these callbacks. | 180 // as a result of these callbacks. |
168 class QUIC_EXPORT_PRIVATE QuicConnectionDebugVisitor | 181 class QUIC_EXPORT_PRIVATE QuicConnectionDebugVisitor |
169 : public QuicSentPacketManager::DebugDelegate { | 182 : public QuicSentPacketManager::DebugDelegate { |
170 public: | 183 public: |
171 ~QuicConnectionDebugVisitor() override {} | 184 ~QuicConnectionDebugVisitor() override {} |
172 | 185 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 470 |
458 // QuicPacketGenerator::DelegateInterface | 471 // QuicPacketGenerator::DelegateInterface |
459 bool ShouldGeneratePacket(HasRetransmittableData retransmittable, | 472 bool ShouldGeneratePacket(HasRetransmittableData retransmittable, |
460 IsHandshake handshake) override; | 473 IsHandshake handshake) override; |
461 const QuicFrame GetUpdatedAckFrame() override; | 474 const QuicFrame GetUpdatedAckFrame() override; |
462 void PopulateStopWaitingFrame(QuicStopWaitingFrame* stop_waiting) override; | 475 void PopulateStopWaitingFrame(QuicStopWaitingFrame* stop_waiting) override; |
463 | 476 |
464 // QuicPacketCreator::DelegateInterface | 477 // QuicPacketCreator::DelegateInterface |
465 void OnSerializedPacket(SerializedPacket* packet) override; | 478 void OnSerializedPacket(SerializedPacket* packet) override; |
466 | 479 |
| 480 // QuicStreamFrameDataProducer methods: |
| 481 void SaveStreamData(QuicStreamId id, |
| 482 QuicIOVector iov, |
| 483 size_t iov_offset, |
| 484 QuicStreamOffset offset, |
| 485 QuicByteCount data_length) override; |
| 486 bool WriteStreamData(QuicStreamId id, |
| 487 QuicStreamOffset offset, |
| 488 QuicByteCount data_length, |
| 489 QuicDataWriter* writer) override; |
| 490 |
467 // QuicSentPacketManager::NetworkChangeVisitor | 491 // QuicSentPacketManager::NetworkChangeVisitor |
468 void OnCongestionChange() override; | 492 void OnCongestionChange() override; |
469 void OnPathDegrading() override; | 493 void OnPathDegrading() override; |
470 void OnPathMtuIncreased(QuicPacketLength packet_size) override; | 494 void OnPathMtuIncreased(QuicPacketLength packet_size) override; |
471 | 495 |
472 // Called by the crypto stream when the handshake completes. In the server's | 496 // Called by the crypto stream when the handshake completes. In the server's |
473 // case this is when the SHLO has been ACKed. Clients call this on receipt of | 497 // case this is when the SHLO has been ACKed. Clients call this on receipt of |
474 // the SHLO. | 498 // the SHLO. |
475 void OnHandshakeComplete(); | 499 void OnHandshakeComplete(); |
476 | 500 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 // |target_mtu|. | 679 // |target_mtu|. |
656 void SendMtuDiscoveryPacket(QuicByteCount target_mtu); | 680 void SendMtuDiscoveryPacket(QuicByteCount target_mtu); |
657 | 681 |
658 // Sends an MTU discovery packet of size |mtu_discovery_target_| and updates | 682 // Sends an MTU discovery packet of size |mtu_discovery_target_| and updates |
659 // the MTU discovery alarm. | 683 // the MTU discovery alarm. |
660 void DiscoverMtu(); | 684 void DiscoverMtu(); |
661 | 685 |
662 // Sets the stream notifer on the SentPacketManager. | 686 // Sets the stream notifer on the SentPacketManager. |
663 void SetStreamNotifier(StreamNotifierInterface* stream_notifier); | 687 void SetStreamNotifier(StreamNotifierInterface* stream_notifier); |
664 | 688 |
| 689 // Enable/disable delegate saves data in PacketCreator. |
| 690 // TODO(fayang): Remove this method when deprecating |
| 691 // quic_reloadable_flag_quic_stream_owns_data. |
| 692 void SetDelegateSavesData(bool delegate_saves_data); |
| 693 |
665 // Return the name of the cipher of the primary decrypter of the framer. | 694 // Return the name of the cipher of the primary decrypter of the framer. |
666 const char* cipher_name() const { return framer_.decrypter()->cipher_name(); } | 695 const char* cipher_name() const { return framer_.decrypter()->cipher_name(); } |
667 // Return the id of the cipher of the primary decrypter of the framer. | 696 // Return the id of the cipher of the primary decrypter of the framer. |
668 uint32_t cipher_id() const { return framer_.decrypter()->cipher_id(); } | 697 uint32_t cipher_id() const { return framer_.decrypter()->cipher_id(); } |
669 | 698 |
670 std::vector<std::unique_ptr<QuicEncryptedPacket>>* termination_packets() { | 699 std::vector<std::unique_ptr<QuicEncryptedPacket>>* termination_packets() { |
671 return termination_packets_.get(); | 700 return termination_packets_.get(); |
672 } | 701 } |
673 | 702 |
674 bool ack_queued() const { return ack_queued_; } | 703 bool ack_queued() const { return ack_queued_; } |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 | 1125 |
1097 // Consecutive number of sent packets which have no retransmittable frames. | 1126 // Consecutive number of sent packets which have no retransmittable frames. |
1098 size_t consecutive_num_packets_with_no_retransmittable_frames_; | 1127 size_t consecutive_num_packets_with_no_retransmittable_frames_; |
1099 | 1128 |
1100 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 1129 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
1101 }; | 1130 }; |
1102 | 1131 |
1103 } // namespace net | 1132 } // namespace net |
1104 | 1133 |
1105 #endif // NET_QUIC_CORE_QUIC_CONNECTION_H_ | 1134 #endif // NET_QUIC_CORE_QUIC_CONNECTION_H_ |
OLD | NEW |