OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // A connection level received packet manager which manages multiple per path |
| 6 // received packet managers. |
| 7 |
| 8 #ifndef NET_QUIC_QUIC_MULTIPATH_RECEIVED_PACKET_MANAGER_H_ |
| 9 #define NET_QUIC_QUIC_MULTIPATH_RECEIVED_PACKET_MANAGER_H_ |
| 10 |
| 11 #include <vector> |
| 12 |
| 13 #include "net/quic/quic_protocol.h" |
| 14 #include "net/quic/quic_received_packet_manager.h" |
| 15 |
| 16 namespace net { |
| 17 |
| 18 namespace test { |
| 19 class QuicMultipathReceivedPacketManagerPeer; |
| 20 } // namespace test |
| 21 |
| 22 class NET_EXPORT_PRIVATE QuicMultipathReceivedPacketManager { |
| 23 public: |
| 24 typedef base::hash_map<QuicPathId, QuicReceivedPacketManager*> |
| 25 MultipathReceivedPacketManagerMap; |
| 26 |
| 27 explicit QuicMultipathReceivedPacketManager(QuicConnectionStats* stats); |
| 28 ~QuicMultipathReceivedPacketManager(); |
| 29 |
| 30 // Called when a new path with |path_id| is created. |
| 31 void OnPathCreated(QuicPathId path_id, QuicConnectionStats* stats); |
| 32 |
| 33 // Called when path with |path_id| is closed. |
| 34 void OnPathClosed(QuicPathId path_id); |
| 35 |
| 36 // Records packet receipt information on path with |path_id|. |
| 37 void RecordPacketReceived(QuicPathId path_id, |
| 38 QuicByteCount bytes, |
| 39 const QuicPacketHeader& header, |
| 40 QuicTime receipt_time); |
| 41 |
| 42 // Called when packet with |packet_number| is revived on path with |path_id|. |
| 43 void RecordPacketRevived(QuicPathId path_id, QuicPacketNumber packet_number); |
| 44 |
| 45 // Checks whether |packet_number| is missing on path with |path_id|. |
| 46 bool IsMissing(QuicPathId path_id, QuicPacketNumber packet_number); |
| 47 |
| 48 // Checks if we're still waiting for the packet with |packet_number| on path |
| 49 // with |path_id|. |
| 50 bool IsAwaitingPacket(QuicPathId path_id, QuicPacketNumber packet_number); |
| 51 |
| 52 // If |force_all_paths| is false, populates ack information for paths whose |
| 53 // ack has been updated since UpdateReceivedPacketInfo was called last time. |
| 54 // Otherwise, populates ack for all paths. |
| 55 void UpdateReceivedPacketInfo(std::vector<QuicAckFrame>* ack_frames, |
| 56 QuicTime approximate_now, |
| 57 bool force_all_paths); |
| 58 |
| 59 // Updates internal state based on stop_waiting frames for corresponding path. |
| 60 void UpdatePacketInformationSentByPeer( |
| 61 const std::vector<QuicStopWaitingFrame>& stop_waitings); |
| 62 |
| 63 // Returns true when there are new missing packets to be reported within 3 |
| 64 // packets of the largest observed on path with |path_id|. |
| 65 bool HasNewMissingPackets(QuicPathId path_id) const; |
| 66 |
| 67 QuicPacketNumber GetPeerLeastPacketAwaitingAck(QuicPathId path_id); |
| 68 |
| 69 private: |
| 70 friend class test::QuicMultipathReceivedPacketManagerPeer; |
| 71 |
| 72 // Map mapping path id to path received packet manager. |
| 73 MultipathReceivedPacketManagerMap path_managers_; |
| 74 }; |
| 75 |
| 76 } // namespace net |
| 77 |
| 78 #endif // NET_QUIC_QUIC_MULTIPATH_RECEIVED_PACKET_MANAGER_H_ |
OLD | NEW |