| 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 <unordered_map> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "net/quic/quic_protocol.h" | |
| 15 #include "net/quic/quic_received_packet_manager.h" | |
| 16 | |
| 17 namespace net { | |
| 18 | |
| 19 namespace test { | |
| 20 class QuicMultipathReceivedPacketManagerPeer; | |
| 21 } // namespace test | |
| 22 | |
| 23 class NET_EXPORT_PRIVATE QuicMultipathReceivedPacketManager { | |
| 24 public: | |
| 25 typedef std::unordered_map<QuicPathId, QuicReceivedPacketManager*> | |
| 26 MultipathReceivedPacketManagerMap; | |
| 27 | |
| 28 explicit QuicMultipathReceivedPacketManager(QuicConnectionStats* stats); | |
| 29 ~QuicMultipathReceivedPacketManager(); | |
| 30 | |
| 31 // Called when a new path with |path_id| is created. | |
| 32 void OnPathCreated(QuicPathId path_id, QuicConnectionStats* stats); | |
| 33 | |
| 34 // Called when path with |path_id| is closed. | |
| 35 void OnPathClosed(QuicPathId path_id); | |
| 36 | |
| 37 // Records packet receipt information on path with |path_id|. | |
| 38 void RecordPacketReceived(QuicPathId path_id, | |
| 39 QuicByteCount bytes, | |
| 40 const QuicPacketHeader& header, | |
| 41 QuicTime receipt_time); | |
| 42 | |
| 43 // Checks whether |packet_number| is missing on path with |path_id|. | |
| 44 bool IsMissing(QuicPathId path_id, QuicPacketNumber packet_number); | |
| 45 | |
| 46 // Checks if we're still waiting for the packet with |packet_number| on path | |
| 47 // with |path_id|. | |
| 48 bool IsAwaitingPacket(QuicPathId path_id, QuicPacketNumber packet_number); | |
| 49 | |
| 50 // If |force_all_paths| is false, populates ack information for paths whose | |
| 51 // ack has been updated since UpdateReceivedPacketInfo was called last time. | |
| 52 // Otherwise, populates ack for all paths. | |
| 53 void UpdateReceivedPacketInfo(std::vector<QuicAckFrame>* ack_frames, | |
| 54 QuicTime approximate_now, | |
| 55 bool force_all_paths); | |
| 56 | |
| 57 // Updates internal state based on stop_waiting frames for corresponding path. | |
| 58 void UpdatePacketInformationSentByPeer( | |
| 59 const std::vector<QuicStopWaitingFrame>& stop_waitings); | |
| 60 | |
| 61 // Returns true when there are new missing packets to be reported within 3 | |
| 62 // packets of the largest observed on path with |path_id|. | |
| 63 bool HasNewMissingPackets(QuicPathId path_id) const; | |
| 64 | |
| 65 QuicPacketNumber GetPeerLeastPacketAwaitingAck(QuicPathId path_id); | |
| 66 | |
| 67 private: | |
| 68 friend class test::QuicMultipathReceivedPacketManagerPeer; | |
| 69 | |
| 70 // Map mapping path id to path received packet manager. | |
| 71 MultipathReceivedPacketManagerMap path_managers_; | |
| 72 }; | |
| 73 | |
| 74 } // namespace net | |
| 75 | |
| 76 #endif // NET_QUIC_QUIC_MULTIPATH_RECEIVED_PACKET_MANAGER_H_ | |
| OLD | NEW |