A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
eht-configuration.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING
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 * Authors: Sébastien Deronne <sebastien.deronne@gmail.com>
18 * Stefano Avallone <stavallo@unina.it>
19 */
20
21#include "eht-configuration.h"
22
23#include "ns3/attribute-container.h"
24#include "ns3/boolean.h"
25#include "ns3/enum.h"
26#include "ns3/integer.h"
27#include "ns3/log.h"
28#include "ns3/pair.h"
29#include "ns3/string.h"
30#include "ns3/uinteger.h"
31
32namespace ns3
33{
34
35NS_LOG_COMPONENT_DEFINE("EhtConfiguration");
36
37NS_OBJECT_ENSURE_REGISTERED(EhtConfiguration);
38
39std::ostream&
40operator<<(std::ostream& os, WifiTidToLinkMappingNegSupport negsupport)
41{
42 switch (negsupport)
43 {
45 return os << "NOT_SUPPORTED";
47 return os << "SAME_LINK_SET";
49 return os << "ANY_LINK_SET";
50 };
51 return os << "UNKNOWN(" << static_cast<uint32_t>(negsupport) << ")";
52}
53
55{
56 NS_LOG_FUNCTION(this);
57}
58
60{
61 NS_LOG_FUNCTION(this);
62}
63
66{
67 using TidLinkMapValue =
69
70 static ns3::TypeId tid =
71 ns3::TypeId("ns3::EhtConfiguration")
73 .SetGroupName("Wifi")
74 .AddConstructor<EhtConfiguration>()
75 .AddAttribute("EmlsrActivated",
76 "Whether EMLSR option is activated. If activated, EMLSR mode can be "
77 "enabled on the EMLSR links by an installed EMLSR Manager.",
79 TypeId::ATTR_CONSTRUCT, // prevent setting after construction
80 BooleanValue(false),
83 .AddAttribute("TransitionTimeout",
84 "The Transition Timeout (not used by non-AP MLDs). "
85 "Possible values are 0us or 2^n us, with n=7..16.",
89 .AddAttribute(
90 "MediumSyncDuration",
91 "The duration of the MediumSyncDelay timer (must be a multiple of 32 us). "
92 "The value of this attribute is only used by AP MLDs with EMLSR activated.",
96 .AddAttribute(
97 "MsdOfdmEdThreshold",
98 "Threshold (dBm) to be used instead of the normal CCA sensitivity for the primary "
99 "20 MHz channel if the MediumSyncDelay timer has a nonzero value. "
100 "The value of this attribute is only used by AP MLDs with EMLSR activated.",
103 MakeIntegerChecker<int8_t>(-72, -62))
104 .AddAttribute(
105 "MsdMaxNTxops",
106 "Maximum number of TXOPs that an EMLSR client is allowed to attempt to initiate "
107 "while the MediumSyncDelay timer is running (zero indicates no limit). "
108 "The value of this attribute is only used by AP MLDs with EMLSR activated.",
111 MakeUintegerChecker<uint8_t>(0, 15))
112 .AddAttribute("TidToLinkMappingNegSupport",
113 "TID-to-Link Mapping Negotiation Support.",
115 MakeEnumAccessor<WifiTidToLinkMappingNegSupport>(
118 "NOT_SUPPORTED",
120 "SAME_LINK_SET",
122 "ANY_LINK_SET"))
123 .AddAttribute(
124 "TidToLinkMappingDl",
125 "A list-of-TIDs-indexed map of the list of links where the TIDs are mapped to "
126 "for the downlink direction. "
127 "In case a string is used to set this attribute, the string shall contain the "
128 "(TID list, link list) pairs separated by a semicolon (;); in every pair, the "
129 "TID list and the link list are separated by a blank space, and the elements of "
130 "each list are separated by a comma (,) without spaces. "
131 "E.g., \"0,4 1,2,3; 1 0;2 0,1\" means that TIDs 0 and 4 are mapped on links "
132 "1, 2 and 3; TID 1 is mapped on link 0 and TID 2 is mapped on links 0 and 1. "
133 "An empty map indicates the default mapping, i.e., all TIDs are mapped to all "
134 "setup links. If the map contains the mapping for some TID(s), the mapping "
135 "corresponding to the missing TID(s) remains unchanged. "
136 "A non-AP MLD includes this mapping in the Association Request frame sent to "
137 "an AP MLD, unless the AP MLD advertises a negotiation support of 1 and this "
138 "mapping is such that TIDs are mapped to distinct link sets, in which case "
139 "the default mapping is included.",
140 StringValue(""),
141 MakeAttributeContainerAccessor<TidLinkMapValue, ';'>(
143 MakeAttributeContainerChecker<TidLinkMapValue, ';'>(
146 MakeAttributeContainerChecker<UintegerValue>(
147 MakeUintegerChecker<uint8_t>()),
148 MakeAttributeContainerChecker<UintegerValue>(
149 MakeUintegerChecker<uint8_t>()))))
150 .AddAttribute(
151 "TidToLinkMappingUl",
152 "A list-of-TIDs-indexed map of the list of links where the TIDs are mapped to "
153 "for the uplink direction. "
154 "In case a string is used to set this attribute, the string shall contain the "
155 "(TID list, link list) pairs separated by a semicolon (;); in every pair, the "
156 "TID list and the link list are separated by a blank space, and the elements of "
157 "each list are separated by a comma (,) without spaces. "
158 "E.g., \"0,4 1,2,3; 1 0;2 0,1\" means that TIDs 0 and 4 are mapped on links "
159 "1, 2 and 3; TID 1 is mapped on link 0 and TID 2 is mapped on links 0 and 1. "
160 "An empty map indicates the default mapping, i.e., all TIDs are mapped to all "
161 "setup links. If the map contains the mapping for some TID(s), the mapping "
162 "corresponding to the missing TID(s) remains unchanged. "
163 "A non-AP MLD includes this mapping in the Association Request frame sent to "
164 "an AP MLD, unless the AP MLD advertises a negotiation support of 1 and this "
165 "mapping is such that TIDs are mapped to distinct link sets, in which case "
166 "the default mapping is included.",
167 StringValue(""),
168 MakeAttributeContainerAccessor<TidLinkMapValue, ';'>(
170 MakeAttributeContainerChecker<TidLinkMapValue, ';'>(
173 MakeAttributeContainerChecker<UintegerValue>(
174 MakeUintegerChecker<uint8_t>()),
175 MakeAttributeContainerChecker<UintegerValue>(
176 MakeUintegerChecker<uint8_t>()))));
177 return tid;
178}
179
182{
185 const auto& linkMapping = (dir == WifiDirection::DOWNLINK ? m_linkMappingDl : m_linkMappingUl);
186
187 for (const auto& [tids, links] : linkMapping)
188 {
189 for (auto tid : tids)
190 {
191 ret[tid] = std::set<uint8_t>(links.cbegin(), links.cend());
192 }
193 }
194 return ret;
195}
196
197void
199 const std::map<std::list<uint8_t>, std::list<uint8_t>>& mapping)
200{
202 auto& linkMapping = (dir == WifiDirection::DOWNLINK ? m_linkMappingDl : m_linkMappingUl);
203 linkMapping.clear();
204 for (const auto& [tids, links] : mapping)
205 {
206 linkMapping.emplace(std::list<uint64_t>(tids.cbegin(), tids.cend()),
207 std::list<uint64_t>(links.cbegin(), links.cend()));
208 }
209}
210
211} // namespace ns3
A container for one type of attribute.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
EHT configuration.
static TypeId GetTypeId()
Get the type ID.
Time m_mediumSyncDuration
duration of the MediumSyncDelay timer
bool m_emlsrActivated
whether EMLSR option is activated
WifiTidLinkMapping GetTidLinkMapping(WifiDirection dir) const
Time m_transitionTimeout
Transition timeout.
std::map< std::list< uint64_t >, std::list< uint64_t > > m_linkMappingDl
TIDs-indexed Link Mapping for downlink.
void SetTidLinkMapping(WifiDirection dir, const std::map< std::list< uint8_t >, std::list< uint8_t > > &mapping)
Set the TID-to-Link mapping for the given direction.
WifiTidToLinkMappingNegSupport m_tidLinkMappingSupport
TID-to-Link Mapping Negotiation Support.
uint8_t m_msdMaxNTxops
MediumSyncDelay max number of TXOPs.
std::map< std::list< uint64_t >, std::list< uint64_t > > m_linkMappingUl
TIDs-indexed Link Mapping for uplink.
int8_t m_msdOfdmEdThreshold
MediumSyncDelay OFDM ED threshold.
Hold variables of type enum.
Definition: enum.h:62
Hold a signed integer type.
Definition: integer.h:45
A base class which provides memory management and object aggregation.
Definition: object.h:89
AttributeValue implementation for Pair.
Definition: pair.h:65
Hold variables of type string.
Definition: string.h:56
AttributeValue implementation for Time.
Definition: nstime.h:1406
a unique identifier for an interface.
Definition: type-id.h:59
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:66
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:81
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition: integer.h:46
Ptr< AttributeChecker > MakePairChecker()
Make a PairChecker without abscissa and ordinate AttributeCheckers.
Definition: pair.h:298
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1427
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1407
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1343
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t DEFAULT_MSD_MAX_N_TXOPS
default MediumSyncDelay max number of TXOP attempts
WifiTidToLinkMappingNegSupport
TID-to-Link Mapping Negotiation Support.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:189
WifiDirection
Wifi direction.
Definition: wifi-utils.h:43
static constexpr int8_t DEFAULT_MSD_OFDM_ED_THRESH
default MediumSyncDelay timer OFDM ED threshold
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Definition: wifi-utils.h:74
static constexpr uint16_t DEFAULT_MSD_DURATION_USEC
default MediumSyncDelay timer duration (max PPDU TX time rounded to a multiple of 32 us)
std::string dir