A Discrete-Event Network Simulator
API
tid-to-link-mapping-element.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Sharan Naribole <sharan.naribole@gmail.com>
18  */
19 
20 #ifndef TID_TO_LINK_MAPPING_H
21 #define TID_TO_LINK_MAPPING_H
22 
23 #include "ns3/nstime.h"
24 #include "ns3/wifi-information-element.h"
25 #include "ns3/wifi-utils.h"
26 
27 #include <map>
28 #include <optional>
29 #include <set>
30 
31 namespace ns3
32 {
33 
35 constexpr auto DEFAULT_WIFI_TID_LINK_MAPPING{true};
40  1; // IEEE 802.11be D2.0 9.4.2.314
43 
54 {
55  public:
60  struct Control
61  {
62  friend class TidToLinkMapping;
63 
66 
68  uint16_t GetSubfieldSize() const;
69 
75  void Serialize(Buffer::Iterator& start) const;
83 
84  private:
91  uint8_t linkMappingSize{1};
92  std::optional<uint8_t> presenceBitmap;
93  };
94 
95  WifiInformationElementId ElementId() const override;
96  WifiInformationElementId ElementIdExt() const override;
97 
104  void SetMappingSwitchTime(Time mappingSwitchTime);
105 
107  std::optional<Time> GetMappingSwitchTime() const;
108 
115  void SetExpectedDuration(Time expectedDuration);
116 
118  std::optional<Time> GetExpectedDuration() const;
119 
127  void SetLinkMappingOfTid(uint8_t tid, std::set<uint8_t> linkIds);
134  std::set<uint8_t> GetLinkMappingOfTid(uint8_t tid) const;
135 
137  std::map<uint8_t, uint16_t> m_linkMapping;
138 
139  private:
140  std::optional<uint16_t> m_mappingSwitchTime;
141  std::optional<uint32_t> m_expectedDuration;
142 
143  uint16_t GetInformationFieldSize() const override;
144  void SerializeInformationField(Buffer::Iterator start) const override;
145  uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
146 };
147 
148 } // namespace ns3
149 
150 #endif /* TID_TO_LINK_MAPPING_H */
iterator in a Buffer instance
Definition: buffer.h:100
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Information element, as defined in 802.11-2007 standard.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr uint16_t WIFI_TID_TO_LINK_MAPPING_CONTROL_BASIC_SIZE_B
size in bytes of the TID-To-Link Control field with default link mapping
constexpr auto DEFAULT_WIFI_TID_LINK_MAP_DIR
default value for the Direction subfield of the TID-To-Link Control field
WifiDirection
Wifi direction.
Definition: wifi-utils.h:43
constexpr uint16_t WIFI_LINK_MAPPING_PRESENCE_IND_SIZE_B
size in bytes of the Link Mapping Presence Indicator field (IEEE 802.11be D2.0 9.4....
constexpr auto DEFAULT_WIFI_TID_LINK_MAPPING
whether to enforce the default link mapping
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.