A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
reduced-neighbor-report.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#ifndef REDUCED_NEIGHBOR_REPORT_H
10#define REDUCED_NEIGHBOR_REPORT_H
11
13
14#include "ns3/mac48-address.h"
15
16#include <vector>
17
18namespace ns3
19{
20
21class WifiPhyOperatingChannel;
22
23/**
24 * @brief The Reduced Neighbor Report element
25 * @ingroup wifi
26 *
27 * This class knows how to serialise and deserialise the Reduced Neighbor Report element.
28 */
30{
31 public:
32 /**
33 * MLD Parameters subfield
34 */
36 {
37 uint8_t apMldId; //!< AP MLD ID
38 uint8_t linkId : 4; //!< Link ID
39 uint8_t bssParamsChangeCount; //!< BSS Parameters Change Count
40 uint8_t allUpdates : 1; ///< All Updates Included
41 uint8_t disabledLink : 1; ///< Disabled Link Indication
42 };
43
44 /**
45 * TBTT Information field
46 */
48 {
49 uint8_t neighborApTbttOffset{0}; //!< Neighbor AP TBTT Offset
50 Mac48Address bssid; //!< BSSID (optional)
51 uint32_t shortSsid{0}; //!< Short SSID (optional)
52 uint8_t bssParameters{0}; //!< BSS parameters (optional)
53 uint8_t psd20MHz{0}; //!< 20 MHz PSD (optional)
54 MldParameters mldParameters{}; //!< MLD Parameters (optional)
55 };
56
57 /**
58 * TBTT Information Header subfield
59 */
61 {
62 uint8_t type : 2; //!< TBTT Information Field Type (2 bits)
63 uint8_t filtered : 1; //!< Filtered Neighbor AP (1 bit)
64 uint8_t reserved : 1; //!< Reserved (1 bit)
65 uint8_t tbttInfoCount : 4; //!< TBTT Information Count (4 bits)
66 uint8_t tbttInfoLength; //!< TBTT Information Length (8 bits)
67 };
68
69 /**
70 * Neighbor AP information field
71 */
73 {
74 mutable TbttInformationHeader tbttInfoHdr{0, 0, 0, 0, 0}; //!< TBTT Information header
75 uint8_t operatingClass{0}; //!< Operating class
76 uint8_t channelNumber{0}; //!< Primary channel number
77 std::vector<TbttInformation> tbttInformationSet; //!< One or more TBTT Information fields
78
79 bool hasBssid{false}; //!< whether BSSID is present in all TBTT Information fields
80 bool hasShortSsid{false}; //!< whether Short SSID is present in all TBTT Information fields
82 false}; //!< whether BSS parameters is present in all TBTT Information fields
83 bool has20MHzPsd{false}; //!< whether 20 MHz PSD is present in all TBTT Information fields
85 false}; //!< whether MLD Parameters is present in all TBTT Information fields
86 };
87
89
90 // Implementations of pure virtual methods of WifiInformationElement
91 WifiInformationElementId ElementId() const override;
92 uint16_t GetInformationFieldSize() const override;
93 void SerializeInformationField(Buffer::Iterator start) const override;
94 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
95
96 /**
97 * Get the number of Neighbor AP Information fields
98 *
99 * @return the number of Neighbor AP Information fields
100 */
101 std::size_t GetNNbrApInfoFields() const;
102 /**
103 * Add a Neighbor AP Information field
104 */
105 void AddNbrApInfoField();
106
107 /**
108 * Set the Operating Class and the Channel Number fields of the given
109 * Neighbor AP Information field based on the given operating channel.
110 *
111 * @param nbrApInfoId identifier of the given Neighbor AP Information field
112 * @param channel the PHY operating channel
113 */
114 void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel& channel);
115 /**
116 * Get the operating channel coded into the Operating Class and the Channel Number
117 * fields of the given Neighbor AP Information field.
118 *
119 * @param nbrApInfoId identifier of the given Neighbor AP Information field
120 * @return the PHY operating channel
121 */
122 WifiPhyOperatingChannel GetOperatingChannel(std::size_t nbrApInfoId) const;
123
124 /**
125 * Get the number of TBTT Information fields included in the TBTT Information Set
126 * field of the given Neighbor AP Information field
127 *
128 * @param nbrApInfoId identifier of the given Neighbor AP Information field
129 * @return the number of TBTT Information fields
130 */
131 std::size_t GetNTbttInformationFields(std::size_t nbrApInfoId) const;
132 /**
133 * Add a TBTT Information fields to the TBTT Information Set field
134 * of the given Neighbor AP Information field
135 *
136 * @param nbrApInfoId identifier of the given Neighbor AP Information field
137 */
138 void AddTbttInformationField(std::size_t nbrApInfoId);
139
140 /**
141 * Set the BSSID field of the <i>i</i>-th TBTT Information field of the given
142 * Neighbor AP Information field
143 *
144 * @param nbrApInfoId identifier of the given Neighbor AP Information field
145 * @param index the index of the given TBTT Information field
146 * @param bssid the BSSID value
147 */
148 void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid);
149 /**
150 * Return true if the BSSID field is present in all the TBTT Information fields
151 * of the given Neighbor AP Information field.
152 *
153 * @param nbrApInfoId identifier of the given Neighbor AP Information field
154 * @return true if the BSSID field is present
155 */
156 bool HasBssid(std::size_t nbrApInfoId) const;
157 /**
158 * Get the BSSID field (must be present) in the <i>i</i>-th TBTT Information field
159 * of the given Neighbor AP Information field.
160 *
161 * @param nbrApInfoId identifier of the given Neighbor AP Information field
162 * @param index the index of the given TBTT Information field
163 * @return the BSSID field
164 */
165 Mac48Address GetBssid(std::size_t nbrApInfoId, std::size_t index) const;
166
167 /**
168 * Set the Short SSID field of the <i>i</i>-th TBTT Information field of the given
169 * Neighbor AP Information field
170 *
171 * @param nbrApInfoId identifier of the given Neighbor AP Information field
172 * @param index the index of the given TBTT Information field
173 * @param shortSsid the short SSID value
174 */
175 void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid);
176 /**
177 * Return true if the Short SSID field is present in all the TBTT Information fields
178 * of the given Neighbor AP Information field.
179 *
180 * @param nbrApInfoId identifier of the given Neighbor AP Information field
181 * @return true if the Short SSID field is present
182 */
183 bool HasShortSsid(std::size_t nbrApInfoId) const;
184 /**
185 * Get the Short SSID field (must be present) in the <i>i</i>-th TBTT Information field
186 * of the given Neighbor AP Information field.
187 *
188 * @param nbrApInfoId identifier of the given Neighbor AP Information field
189 * @param index the index of the given TBTT Information field
190 * @return the Short SSID field
191 */
192 uint32_t GetShortSsid(std::size_t nbrApInfoId, std::size_t index) const;
193
194 /**
195 * Set the BSS Parameters field of the <i>i</i>-th TBTT Information field of the given
196 * Neighbor AP Information field
197 *
198 * @param nbrApInfoId identifier of the given Neighbor AP Information field
199 * @param index the index of the given TBTT Information field
200 * @param bssParameters the BSS Parameters value
201 */
202 void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters);
203 /**
204 * Return true if the BSS Parameters field is present in all the TBTT Information fields
205 * of the given Neighbor AP Information field.
206 *
207 * @param nbrApInfoId identifier of the given Neighbor AP Information field
208 * @return true if the BSS Parameters field is present
209 */
210 bool HasBssParameters(std::size_t nbrApInfoId) const;
211 /**
212 * Get the BSS Parameters field (must be present) in the <i>i</i>-th TBTT Information field
213 * of the given Neighbor AP Information field.
214 *
215 * @param nbrApInfoId identifier of the given Neighbor AP Information field
216 * @param index the index of the given TBTT Information field
217 * @return the BSS Parameters field
218 */
219 uint8_t GetBssParameters(std::size_t nbrApInfoId, std::size_t index) const;
220
221 /**
222 * Set the 20 MHz PSD field of the <i>i</i>-th TBTT Information field of the given
223 * Neighbor AP Information field
224 *
225 * @param nbrApInfoId identifier of the given Neighbor AP Information field
226 * @param index the index of the given TBTT Information field
227 * @param psd20MHz the 20 MHz PSD value
228 */
229 void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz);
230 /**
231 * Return true if the 20 MHz PSD field is present in all the TBTT Information fields
232 * of the given Neighbor AP Information field.
233 *
234 * @param nbrApInfoId identifier of the given Neighbor AP Information field
235 * @return true if the 20 MHz PSD field is present
236 */
237 bool HasPsd20MHz(std::size_t nbrApInfoId) const;
238 /**
239 * Get the 20 MHz PSD field (must be present) in the <i>i</i>-th TBTT Information field
240 * of the given Neighbor AP Information field.
241 *
242 * @param nbrApInfoId identifier of the given Neighbor AP Information field
243 * @param index the index of the given TBTT Information field
244 * @return the 20 MHz PSD field
245 */
246 uint8_t GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) const;
247
248 /**
249 * Set the MLD Parameters subfield of the <i>i</i>-th TBTT Information field of the given
250 * Neighbor AP Information field
251 *
252 * @param nbrApInfoId identifier of the given Neighbor AP Information field
253 * @param index the index of the given TBTT Information field
254 * @param mldParams the MLD parameters
255 */
256 void SetMldParameters(std::size_t nbrApInfoId,
257 std::size_t index,
258 const MldParameters& mldParams);
259 /**
260 * Return true if the MLD Parameters subfield is present in all the TBTT Information fields
261 * of the given Neighbor AP Information field.
262 *
263 * @param nbrApInfoId identifier of the given Neighbor AP Information field
264 * @return true if the MLD Parameters subfield is present
265 */
266 bool HasMldParameters(std::size_t nbrApInfoId) const;
267 /**
268 * Get the MLD Parameters subfield (must be present) in the <i>i</i>-th TBTT Information field
269 * of the given Neighbor AP Information field.
270 *
271 * @param nbrApInfoId identifier of the given Neighbor AP Information field
272 * @param index the index of the given TBTT Information field
273 * @return the MLD parameters
274 */
275 const MldParameters& GetMldParameters(std::size_t nbrApInfoId, std::size_t index) const;
276
277 private:
278 /**
279 * Set the TBTT Information Count field of the given Neighbor AP Information field
280 * based on the size of the tbttInformationSet field.
281 *
282 * This method is marked as const because it needs to be called within the
283 * SerializeInformationField method. In fact, only when serializing this object
284 * we can set the TBTT Information Count field based on the number of TBTT Information
285 * fields included in the given Neighbor AP Information field.
286 *
287 * @param nbrApInfoId identifier of the given Neighbor AP Information field
288 */
289 void WriteTbttInformationCount(std::size_t nbrApInfoId) const;
290 /**
291 * Get the TBTT Information Count field of the given Neighbor AP Information field.
292 *
293 * @param nbrApInfoId identifier of the given Neighbor AP Information field
294 * @return the TBTT Information Count
295 */
296 uint8_t ReadTbttInformationCount(std::size_t nbrApInfoId) const;
297
298 /**
299 * Set the TBTT Information Length field of the given Neighbor AP Information field
300 * based on the xxxPresent flags of the NeighborApInformation struct
301 *
302 * This method is marked as const because it needs to be called within the
303 * SerializeInformationField method. In fact, only when serializing this object
304 * we can set the TBTT Information Length field based on the TBTT Information
305 * field contents.
306 *
307 * @param nbrApInfoId identifier of the given Neighbor AP Information field
308 */
309 void WriteTbttInformationLength(std::size_t nbrApInfoId) const;
310 /**
311 * Use the TBTT Information Length field of the given Neighbor AP Information field
312 * to set the xxxPresent flags of the NeighborApInformation struct
313 *
314 * @param nbrApInfoId identifier of the given Neighbor AP Information field
315 */
316 void ReadTbttInformationLength(std::size_t nbrApInfoId);
317
318 std::vector<NeighborApInformation>
319 m_nbrApInfoFields; //!< one or more Neighbor AP Information fields
320};
321
322} // namespace ns3
323
324#endif /* REDUCED_NEIGHBOR_REPORT_H */
iterator in a Buffer instance
Definition buffer.h:89
an EUI-48 address
The Reduced Neighbor Report element.
void WriteTbttInformationLength(std::size_t nbrApInfoId) const
Set the TBTT Information Length field of the given Neighbor AP Information field based on the xxxPres...
Mac48Address GetBssid(std::size_t nbrApInfoId, std::size_t index) const
Get the BSSID field (must be present) in the i-th TBTT Information field of the given Neighbor AP Inf...
std::vector< NeighborApInformation > m_nbrApInfoFields
one or more Neighbor AP Information fields
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
bool HasShortSsid(std::size_t nbrApInfoId) const
Return true if the Short SSID field is present in all the TBTT Information fields of the given Neighb...
std::size_t GetNNbrApInfoFields() const
Get the number of Neighbor AP Information fields.
void WriteTbttInformationCount(std::size_t nbrApInfoId) const
Set the TBTT Information Count field of the given Neighbor AP Information field based on the size of ...
bool HasBssid(std::size_t nbrApInfoId) const
Return true if the BSSID field is present in all the TBTT Information fields of the given Neighbor AP...
uint8_t ReadTbttInformationCount(std::size_t nbrApInfoId) const
Get the TBTT Information Count field of the given Neighbor AP Information field.
void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid)
Set the Short SSID field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
uint32_t GetShortSsid(std::size_t nbrApInfoId, std::size_t index) const
Get the Short SSID field (must be present) in the i-th TBTT Information field of the given Neighbor A...
void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid)
Set the BSSID field of the i-th TBTT Information field of the given Neighbor AP Information field.
std::size_t GetNTbttInformationFields(std::size_t nbrApInfoId) const
Get the number of TBTT Information fields included in the TBTT Information Set field of the given Nei...
void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz)
Set the 20 MHz PSD field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
const MldParameters & GetMldParameters(std::size_t nbrApInfoId, std::size_t index) const
Get the MLD Parameters subfield (must be present) in the i-th TBTT Information field of the given Nei...
void AddNbrApInfoField()
Add a Neighbor AP Information field.
WifiPhyOperatingChannel GetOperatingChannel(std::size_t nbrApInfoId) const
Get the operating channel coded into the Operating Class and the Channel Number fields of the given N...
void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters)
Set the BSS Parameters field of the i-th TBTT Information field of the given Neighbor AP Information ...
void SetMldParameters(std::size_t nbrApInfoId, std::size_t index, const MldParameters &mldParams)
Set the MLD Parameters subfield of the i-th TBTT Information field of the given Neighbor AP Informati...
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) const
Get the 20 MHz PSD field (must be present) in the i-th TBTT Information field of the given Neighbor A...
bool HasMldParameters(std::size_t nbrApInfoId) const
Return true if the MLD Parameters subfield is present in all the TBTT Information fields of the given...
void AddTbttInformationField(std::size_t nbrApInfoId)
Add a TBTT Information fields to the TBTT Information Set field of the given Neighbor AP Information ...
void ReadTbttInformationLength(std::size_t nbrApInfoId)
Use the TBTT Information Length field of the given Neighbor AP Information field to set the xxxPresen...
bool HasBssParameters(std::size_t nbrApInfoId) const
Return true if the BSS Parameters field is present in all the TBTT Information fields of the given Ne...
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel &channel)
Set the Operating Class and the Channel Number fields of the given Neighbor AP Information field base...
bool HasPsd20MHz(std::size_t nbrApInfoId) const
Return true if the 20 MHz PSD field is present in all the TBTT Information fields of the given Neighb...
uint8_t GetBssParameters(std::size_t nbrApInfoId, std::size_t index) const
Get the BSS Parameters field (must be present) in the i-th TBTT Information field of the given Neighb...
Information element, as defined in 802.11-2007 standard.
Class that keeps track of all information about the current PHY operating channel.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t disabledLink
Disabled Link Indication.
uint8_t bssParamsChangeCount
BSS Parameters Change Count.
std::vector< TbttInformation > tbttInformationSet
One or more TBTT Information fields.
bool hasMldParams
whether MLD Parameters is present in all TBTT Information fields
TbttInformationHeader tbttInfoHdr
TBTT Information header.
bool hasShortSsid
whether Short SSID is present in all TBTT Information fields
bool hasBssParams
whether BSS parameters is present in all TBTT Information fields
bool has20MHzPsd
whether 20 MHz PSD is present in all TBTT Information fields
bool hasBssid
whether BSSID is present in all TBTT Information fields
uint8_t tbttInfoLength
TBTT Information Length (8 bits)
uint8_t tbttInfoCount
TBTT Information Count (4 bits)
uint8_t type
TBTT Information Field Type (2 bits)
uint8_t neighborApTbttOffset
Neighbor AP TBTT Offset.
MldParameters mldParameters
MLD Parameters (optional)