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