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 * 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: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef REDUCED_NEIGHBOR_REPORT_H
21#define REDUCED_NEIGHBOR_REPORT_H
22
24
25#include "ns3/mac48-address.h"
26
27#include <vector>
28
29namespace ns3
30{
31
32class WifiPhyOperatingChannel;
33
34/**
35 * \brief The Reduced Neighbor Report element
36 * \ingroup wifi
37 *
38 * This class knows how to serialise and deserialise the Reduced Neighbor Report element.
39 */
41{
42 public:
43 /**
44 * MLD Parameters subfield
45 */
47 {
48 uint8_t mldId; //!< MLD ID
49 uint8_t linkId; //!< Link ID
50 uint8_t bssParamsChangeCount; //!< BSS Parameters Change Count
51 };
52
53 /**
54 * TBTT Information field
55 */
57 {
58 uint8_t neighborApTbttOffset{0}; //!< Neighbor AP TBTT Offset
59 Mac48Address bssid; //!< BSSID (optional)
60 uint32_t shortSsid{0}; //!< Short SSID (optional)
61 uint8_t bssParameters{0}; //!< BSS parameters (optional)
62 uint8_t psd20MHz{0}; //!< 20 MHz PSD (optional)
63 MldParameters mldParameters{0, 0, 0}; //!< MLD Parameters (optional)
64 };
65
66 /**
67 * TBTT Information Header subfield
68 */
70 {
71 uint8_t type : 2; //!< TBTT Information Field Type (2 bits)
72 uint8_t filtered : 1; //!< Filtered Neighbor AP (1 bit)
73 uint8_t reserved : 1; //!< Reserved (1 bit)
74 uint8_t tbttInfoCount : 4; //!< TBTT Information Count (4 bits)
75 uint8_t tbttInfoLength; //!< TBTT Information Length (8 bits)
76 };
77
78 /**
79 * Neighbor AP information field
80 */
82 {
83 mutable TbttInformationHeader tbttInfoHdr{0, 0, 0, 0, 0}; //!< TBTT Information header
84 uint8_t operatingClass{0}; //!< Operating class
85 uint8_t channelNumber{0}; //!< Primary channel number
86 std::vector<TbttInformation> tbttInformationSet; //!< One or more TBTT Information fields
87
88 bool hasBssid{false}; //!< whether BSSID is present in all TBTT Information fields
89 bool hasShortSsid{false}; //!< whether Short SSID is present in all TBTT Information fields
91 false}; //!< whether BSS parameters is present in all TBTT Information fields
92 bool has20MHzPsd{false}; //!< whether 20 MHz PSD is present in all TBTT Information fields
94 false}; //!< whether MLD Parameters is present in all TBTT Information fields
95 };
96
98
99 // Implementations of pure virtual methods of WifiInformationElement
100 WifiInformationElementId ElementId() const override;
101 uint16_t GetInformationFieldSize() const override;
102 void SerializeInformationField(Buffer::Iterator start) const override;
103 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
104
105 /**
106 * Get the number of Neighbor AP Information fields
107 *
108 * \return the number of Neighbor AP Information fields
109 */
110 std::size_t GetNNbrApInfoFields() const;
111 /**
112 * Add a Neighbor AP Information field
113 */
114 void AddNbrApInfoField();
115
116 /**
117 * Set the Operating Class and the Channel Number fields of the given
118 * Neighbor AP Information field based on the given operating channel.
119 *
120 * \param nbrApInfoId identifier of the given Neighbor AP Information field
121 * \param channel the PHY operating channel
122 */
123 void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel& channel);
124 /**
125 * Get the operating channel coded into the Operating Class and the Channel Number
126 * fields of the given Neighbor AP Information field.
127 *
128 * \param nbrApInfoId identifier of the given Neighbor AP Information field
129 * \return the PHY operating channel
130 */
131 WifiPhyOperatingChannel GetOperatingChannel(std::size_t nbrApInfoId) const;
132
133 /**
134 * Get the number of TBTT Information fields included in the TBTT Information Set
135 * field of the given Neighbor AP Information field
136 *
137 * \param nbrApInfoId identifier of the given Neighbor AP Information field
138 * \return the number of TBTT Information fields
139 */
140 std::size_t GetNTbttInformationFields(std::size_t nbrApInfoId) const;
141 /**
142 * Add a TBTT Information fields to the TBTT Information Set field
143 * of the given Neighbor AP Information field
144 *
145 * \param nbrApInfoId identifier of the given Neighbor AP Information field
146 */
147 void AddTbttInformationField(std::size_t nbrApInfoId);
148
149 /**
150 * Set the BSSID field of the <i>i</i>-th TBTT Information field of the given
151 * Neighbor AP Information field
152 *
153 * \param nbrApInfoId identifier of the given Neighbor AP Information field
154 * \param index the index of the given TBTT Information field
155 * \param bssid the BSSID value
156 */
157 void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid);
158 /**
159 * Return true if the BSSID field is present in all the TBTT Information fields
160 * of the given Neighbor AP Information field.
161 *
162 * \param nbrApInfoId identifier of the given Neighbor AP Information field
163 * \return true if the BSSID field is present
164 */
165 bool HasBssid(std::size_t nbrApInfoId) const;
166 /**
167 * Get the BSSID field (must be present) in the <i>i</i>-th TBTT Information field
168 * of the given Neighbor AP Information field.
169 *
170 * \param nbrApInfoId identifier of the given Neighbor AP Information field
171 * \param index the index of the given TBTT Information field
172 * \return the BSSID field
173 */
174 Mac48Address GetBssid(std::size_t nbrApInfoId, std::size_t index) const;
175
176 /**
177 * Set the Short SSID field of the <i>i</i>-th TBTT Information field of the given
178 * Neighbor AP Information field
179 *
180 * \param nbrApInfoId identifier of the given Neighbor AP Information field
181 * \param index the index of the given TBTT Information field
182 * \param shortSsid the short SSID value
183 */
184 void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid);
185 /**
186 * Return true if the Short SSID field is present in all the TBTT Information fields
187 * of the given Neighbor AP Information field.
188 *
189 * \param nbrApInfoId identifier of the given Neighbor AP Information field
190 * \return true if the Short SSID field is present
191 */
192 bool HasShortSsid(std::size_t nbrApInfoId) const;
193 /**
194 * Get the Short SSID field (must be present) in the <i>i</i>-th TBTT Information field
195 * of the given Neighbor AP Information field.
196 *
197 * \param nbrApInfoId identifier of the given Neighbor AP Information field
198 * \param index the index of the given TBTT Information field
199 * \return the Short SSID field
200 */
201 uint32_t GetShortSsid(std::size_t nbrApInfoId, std::size_t index) const;
202
203 /**
204 * Set the BSS Parameters field of the <i>i</i>-th TBTT Information field of the given
205 * Neighbor AP Information field
206 *
207 * \param nbrApInfoId identifier of the given Neighbor AP Information field
208 * \param index the index of the given TBTT Information field
209 * \param bssParameters the BSS Parameters value
210 */
211 void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters);
212 /**
213 * Return true if the BSS Parameters field is present in all the TBTT Information fields
214 * of the given Neighbor AP Information field.
215 *
216 * \param nbrApInfoId identifier of the given Neighbor AP Information field
217 * \return true if the BSS Parameters field is present
218 */
219 bool HasBssParameters(std::size_t nbrApInfoId) const;
220 /**
221 * Get the BSS Parameters field (must be present) in the <i>i</i>-th TBTT Information field
222 * of the given Neighbor AP Information field.
223 *
224 * \param nbrApInfoId identifier of the given Neighbor AP Information field
225 * \param index the index of the given TBTT Information field
226 * \return the BSS Parameters field
227 */
228 uint8_t GetBssParameters(std::size_t nbrApInfoId, std::size_t index) const;
229
230 /**
231 * Set the 20 MHz PSD field of the <i>i</i>-th TBTT Information field of the given
232 * Neighbor AP Information field
233 *
234 * \param nbrApInfoId identifier of the given Neighbor AP Information field
235 * \param index the index of the given TBTT Information field
236 * \param psd20MHz the 20 MHz PSD value
237 */
238 void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz);
239 /**
240 * Return true if the 20 MHz PSD field is present in all the TBTT Information fields
241 * of the given Neighbor AP Information field.
242 *
243 * \param nbrApInfoId identifier of the given Neighbor AP Information field
244 * \return true if the 20 MHz PSD field is present
245 */
246 bool HasPsd20MHz(std::size_t nbrApInfoId) const;
247 /**
248 * Get the 20 MHz PSD field (must be present) in the <i>i</i>-th TBTT Information field
249 * of the given Neighbor AP Information field.
250 *
251 * \param nbrApInfoId identifier of the given Neighbor AP Information field
252 * \param index the index of the given TBTT Information field
253 * \return the 20 MHz PSD field
254 */
255 uint8_t GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) const;
256
257 /**
258 * Set the MLD Parameters subfield of the <i>i</i>-th TBTT Information field of the given
259 * Neighbor AP Information field
260 *
261 * \param nbrApInfoId identifier of the given Neighbor AP Information field
262 * \param index the index of the given TBTT Information field
263 * \param mldId the MLD ID value
264 * \param linkId the Link ID value
265 * \param changeSequence the Change Sequence value
266 */
267 void SetMldParameters(std::size_t nbrApInfoId,
268 std::size_t index,
269 uint8_t mldId,
270 uint8_t linkId,
271 uint8_t changeSequence);
272 /**
273 * Return true if the MLD Parameters subfield is present in all the TBTT Information fields
274 * of the given Neighbor AP Information field.
275 *
276 * \param nbrApInfoId identifier of the given Neighbor AP Information field
277 * \return true if the MLD Parameters subfield is present
278 */
279 bool HasMldParameters(std::size_t nbrApInfoId) const;
280 /**
281 * Get the MLD ID value in the MLD Parameters subfield (must be present) in the
282 * <i>i</i>-th TBTT Information field of the given Neighbor AP Information field.
283 *
284 * \param nbrApInfoId identifier of the given Neighbor AP Information field
285 * \param index the index of the given TBTT Information field
286 * \return the MLD ID value
287 */
288 uint8_t GetMldId(std::size_t nbrApInfoId, std::size_t index) const;
289 /**
290 * Get the Link ID value in the MLD Parameters subfield (must be present) in the
291 * <i>i</i>-th TBTT Information field of the given Neighbor AP Information field.
292 *
293 * \param nbrApInfoId identifier of the given Neighbor AP Information field
294 * \param index the index of the given TBTT Information field
295 * \return the Link ID value
296 */
297 uint8_t GetLinkId(std::size_t nbrApInfoId, std::size_t index) const;
298
299 private:
300 /**
301 * Set the TBTT Information Count field of the given Neighbor AP Information field
302 * based on the size of the tbttInformationSet field.
303 *
304 * This method is marked as const because it needs to be called within the
305 * SerializeInformationField method. In fact, only when serializing this object
306 * we can set the TBTT Information Count field based on the number of TBTT Information
307 * fields included in the given Neighbor AP Information field.
308 *
309 * \param nbrApInfoId identifier of the given Neighbor AP Information field
310 */
311 void WriteTbttInformationCount(std::size_t nbrApInfoId) const;
312 /**
313 * Get the TBTT Information Count field of the given Neighbor AP Information field.
314 *
315 * \param nbrApInfoId identifier of the given Neighbor AP Information field
316 * \return the TBTT Information Count
317 */
318 uint8_t ReadTbttInformationCount(std::size_t nbrApInfoId) const;
319
320 /**
321 * Set the TBTT Information Length field of the given Neighbor AP Information field
322 * based on the xxxPresent flags of the NeighborApInformation struct
323 *
324 * This method is marked as const because it needs to be called within the
325 * SerializeInformationField method. In fact, only when serializing this object
326 * we can set the TBTT Information Length field based on the TBTT Information
327 * field contents.
328 *
329 * \param nbrApInfoId identifier of the given Neighbor AP Information field
330 */
331 void WriteTbttInformationLength(std::size_t nbrApInfoId) const;
332 /**
333 * Use the TBTT Information Length field of the given Neighbor AP Information field
334 * to set the xxxPresent flags of the NeighborApInformation struct
335 *
336 * \param nbrApInfoId identifier of the given Neighbor AP Information field
337 */
338 void ReadTbttInformationLength(std::size_t nbrApInfoId);
339
340 std::vector<NeighborApInformation>
341 m_nbrApInfoFields; //!< one or more Neighbor AP Information fields
342};
343
344} // namespace ns3
345
346#endif /* REDUCED_NEIGHBOR_REPORT_H */
iterator in a Buffer instance
Definition: buffer.h:100
an EUI-48 address
Definition: mac48-address.h:46
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 SetMldParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t mldId, uint8_t linkId, uint8_t changeSequence)
Set the MLD Parameters subfield of the i-th TBTT Information field of the given Neighbor AP Informati...
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...
uint8_t GetLinkId(std::size_t nbrApInfoId, std::size_t index) const
Get the Link ID value in the MLD Parameters subfield (must be present) in the i-th TBTT Information f...
uint8_t GetMldId(std::size_t nbrApInfoId, std::size_t index) const
Get the MLD ID value in the MLD Parameters subfield (must be present) in the i-th TBTT Information fi...
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.
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 ...
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 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.
uint8_t bssParameters
BSS parameters (optional)
MldParameters mldParameters
MLD Parameters (optional)