| 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 map manages packets which are transmitted across multiple paths. |
| 6 // For example, a packet is originally transmitted on path 1 with packet number |
| 7 // 1. Then this packet is retransmitted on path 2 with packet number 1. (1, 1) |
| 8 // and (2, 1) are inserted into this map. Suppose (2, 1) is detected lost and |
| 9 // gets retransmitted on path 2 with packet 2. (2, 2) will not be inserted |
| 10 // because this transmission does not "across" path compared to (2, 1). |
| 11 |
| 12 #ifndef NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ |
| 13 #define NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ |
| 14 |
| 15 #include <deque> |
| 16 |
| 17 #include "base/containers/hash_tables.h" |
| 18 #include "base/macros.h" |
| 19 #include "net/quic/quic_protocol.h" |
| 20 |
| 21 namespace net_quic { |
| 22 |
| 23 typedef std::pair<net::QuicPathId, net::QuicPacketNumber> |
| 24 QuicPathIdPacketNumber; |
| 25 |
| 26 class NET_EXPORT_PRIVATE QuicMultipathTransmissionsMap { |
| 27 public: |
| 28 typedef std::deque<QuicPathIdPacketNumber> MultipathTransmissionsList; |
| 29 typedef base::hash_map<QuicPathIdPacketNumber, MultipathTransmissionsList*> |
| 30 MultipathTransmissionsMap; |
| 31 |
| 32 QuicMultipathTransmissionsMap(); |
| 33 ~QuicMultipathTransmissionsMap(); |
| 34 |
| 35 // Called when a packet is retransmitted on a different path. Adds both |
| 36 // |original_path_id_packet_number| (if not exists) and |
| 37 // |path_id_packet_number| to |transmission_map_|. |
| 38 void OnPacketRetransmittedOnDifferentPath( |
| 39 QuicPathIdPacketNumber original_path_id_packet_number, |
| 40 QuicPathIdPacketNumber path_id_packet_number); |
| 41 |
| 42 // Returns all multipath transmissions list if |path_id_packet_number| has |
| 43 // been transmitted across multiple paths, nullptr otherwise. |
| 44 const MultipathTransmissionsList* MaybeGetTransmissionsOnOtherPaths( |
| 45 QuicPathIdPacketNumber path_id_packet_number) const; |
| 46 |
| 47 // Called after packet |path_id_packet_number| is received. |
| 48 // If |path_id_packet_number| has been transmitted across multiple paths, |
| 49 // clears all multipath transmissions list and removes each transmission from |
| 50 // |transmission_map_|, does nothing otherwise. |
| 51 void OnPacketHandled(QuicPathIdPacketNumber path_id_packet_number); |
| 52 |
| 53 private: |
| 54 // Keys of the map are QuicPathIdPacketNumber, and values are pointers to |
| 55 // lists of multipath transmissions of the same packet. For example, if a |
| 56 // packet has been transmitted as (1, 1) and (2, 1), two entries are added |
| 57 // to this map and both values point to the same list: {(1, 1), (2, 1)}. |
| 58 // The MultipathTransmissionsList is owned by the transmission which is |
| 59 // received first (on any path). |
| 60 MultipathTransmissionsMap transmission_map_; |
| 61 }; |
| 62 |
| 63 } // namespace net_quic |
| 64 |
| 65 #endif // NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ |
| OLD | NEW |