A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mgt-headers.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8 * Mirko Banchi <mk.banchi@gmail.com>
9 */
10
11#ifndef MGT_HEADERS_H
12#define MGT_HEADERS_H
13
15#include "edca-parameter-set.h"
18#include "ssid.h"
19#include "status-code.h"
20#include "supported-rates.h"
21#include "tim.h"
22#include "wifi-mgt-header.h"
23
24#include "ns3/dsss-parameter-set.h"
25#include "ns3/eht-capabilities.h"
26#include "ns3/eht-operation.h"
27#include "ns3/erp-information.h"
28#include "ns3/he-6ghz-band-capabilities.h"
29#include "ns3/he-capabilities.h"
30#include "ns3/he-operation.h"
31#include "ns3/ht-capabilities.h"
32#include "ns3/ht-operation.h"
33#include "ns3/mac48-address.h"
34#include "ns3/mu-edca-parameter-set.h"
35#include "ns3/multi-link-element.h"
36#include "ns3/tid-to-link-mapping-element.h"
37#include "ns3/vht-capabilities.h"
38#include "ns3/vht-operation.h"
39
40namespace ns3
41{
42
43/**
44 * Indicate which Information Elements cannot be included in a Per-STA Profile subelement of
45 * a Basic Multi-Link Element (see Sec. 35.3.3.4 of 802.11be D3.1):
46 *
47 * An AP affiliated with an AP MLD shall not include a Timestamp field, a Beacon Interval field,
48 * an AID field, a BSS Max Idle Period element, a Neighbor Report element, a Reduced Neighbor
49 * Report element, a Multiple BSSID element, TIM element, Multiple BSSID-Index element, Multiple
50 * BSSID Configuration element, TID-to-Link Mapping element, Multi-Link Traffic Indication element
51 * or another Multi- Link element in the STA Profile field of the Basic Multi-Link element.
52 *
53 * A non-AP STA affiliated with a non-AP MLD shall not include a Listen Interval field, a Current
54 * AP Address field, an SSID element, BSS Max Idle Period element or another Multi-Link element in
55 * the STA Profile field of the Basic Multi-Link element.
56 */
57
58/** @copydoc CanBeInPerStaProfile */
59template <>
61{
62};
63
64/// @copydoc CanBeInPerStaProfile
65template <>
66struct CanBeInPerStaProfile<Tim> : std::false_type
67{
68};
69
70/** @copydoc CanBeInPerStaProfile */
71template <>
72struct CanBeInPerStaProfile<TidToLinkMapping> : std::false_type
73{
74};
75
76/** @copydoc CanBeInPerStaProfile */
77template <>
78struct CanBeInPerStaProfile<MultiLinkElement> : std::false_type
79{
80};
81
82/** @copydoc CanBeInPerStaProfile */
83template <>
84struct CanBeInPerStaProfile<Ssid> : std::false_type
85{
86};
87
88/// List of Information Elements included in Beacon frames
89using BeaconElems = std::tuple<Ssid,
91 std::optional<DsssParameterSet>,
92 std::optional<Tim>,
93 std::optional<ErpInformation>,
94 std::optional<ExtendedSupportedRatesIE>,
95 std::optional<EdcaParameterSet>,
96 std::optional<HtCapabilities>,
97 std::optional<HtOperation>,
98 std::optional<ExtendedCapabilities>,
99 std::optional<VhtCapabilities>,
100 std::optional<VhtOperation>,
101 std::optional<ReducedNeighborReport>,
102 std::optional<HeCapabilities>,
103 std::optional<HeOperation>,
104 std::optional<MuEdcaParameterSet>,
105 std::optional<He6GhzBandCapabilities>,
106 std::optional<MultiLinkElement>,
107 std::optional<EhtCapabilities>,
108 std::optional<EhtOperation>,
109 std::vector<TidToLinkMapping>>;
110
111/// List of Information Elements included in Probe Request frames
112using ProbeRequestElems = std::tuple<Ssid,
114 std::optional<ExtendedSupportedRatesIE>,
115 std::optional<DsssParameterSet>,
116 std::optional<HtCapabilities>,
117 std::optional<ExtendedCapabilities>,
118 std::optional<VhtCapabilities>,
119 std::optional<HeCapabilities>,
120 std::optional<He6GhzBandCapabilities>,
121 std::optional<MultiLinkElement>,
122 std::optional<EhtCapabilities>>;
123
124/// List of Information Elements included in Probe Response frames
125using ProbeResponseElems = std::tuple<Ssid,
127 std::optional<DsssParameterSet>,
128 std::optional<ErpInformation>,
129 std::optional<ExtendedSupportedRatesIE>,
130 std::optional<EdcaParameterSet>,
131 std::optional<HtCapabilities>,
132 std::optional<HtOperation>,
133 std::optional<ExtendedCapabilities>,
134 std::optional<VhtCapabilities>,
135 std::optional<VhtOperation>,
136 std::optional<ReducedNeighborReport>,
137 std::optional<HeCapabilities>,
138 std::optional<HeOperation>,
139 std::optional<MuEdcaParameterSet>,
140 std::optional<He6GhzBandCapabilities>,
141 std::optional<MultiLinkElement>,
142 std::optional<EhtCapabilities>,
143 std::optional<EhtOperation>,
144 std::vector<TidToLinkMapping>>;
145
146/// List of Information Elements included in Association Request frames
147using AssocRequestElems = std::tuple<Ssid,
149 std::optional<ExtendedSupportedRatesIE>,
150 std::optional<HtCapabilities>,
151 std::optional<ExtendedCapabilities>,
152 std::optional<VhtCapabilities>,
153 std::optional<HeCapabilities>,
154 std::optional<He6GhzBandCapabilities>,
155 std::optional<MultiLinkElement>,
156 std::optional<EhtCapabilities>,
157 std::vector<TidToLinkMapping>>;
158
159/// List of Information Elements included in Association Response frames
161 std::optional<ExtendedSupportedRatesIE>,
162 std::optional<EdcaParameterSet>,
163 std::optional<HtCapabilities>,
164 std::optional<HtOperation>,
165 std::optional<ExtendedCapabilities>,
166 std::optional<VhtCapabilities>,
167 std::optional<VhtOperation>,
168 std::optional<HeCapabilities>,
169 std::optional<HeOperation>,
170 std::optional<MuEdcaParameterSet>,
171 std::optional<He6GhzBandCapabilities>,
172 std::optional<MultiLinkElement>,
173 std::optional<EhtCapabilities>,
174 std::optional<EhtOperation>,
175 std::vector<TidToLinkMapping>>;
176
177/**
178 * @ingroup wifi
179 * Implement the header for management frames of type association request.
180 */
182 : public MgtHeaderInPerStaProfile<MgtAssocRequestHeader, AssocRequestElems>
183{
186
187 public:
188 ~MgtAssocRequestHeader() override = default;
189
190 /**
191 * Register this type.
192 * @return The TypeId.
193 */
194 static TypeId GetTypeId();
195
196 /** @copydoc Header::GetInstanceTypeId */
197 TypeId GetInstanceTypeId() const override;
198
199 uint16_t m_listenInterval{0}; //!< listen interval (in units of beacon interval)
200 CapabilityInformation m_capability; //!< Capability information
201
202 protected:
203 /** @copydoc Header::GetSerializedSize */
205 /** @copydoc Header::Serialize */
206 void SerializeImpl(Buffer::Iterator start) const;
207 /** @copydoc Header::Deserialize */
209
210 /**
211 * @param frame the frame containing the Multi-Link Element
212 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
213 * subelement of the Multi-Link Element
214 */
216
217 /**
218 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
219 *
220 * @param start an iterator which points to where the header should be written
221 * @param frame the frame containing the Multi-Link Element
222 */
224 const MgtAssocRequestHeader& frame) const;
225
226 /**
227 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
228 *
229 * @param start an iterator which points to where the header should be read from
230 * @param length the expected number of bytes to read
231 * @param frame the frame containing the Multi-Link Element
232 * @return the number of bytes read
233 */
235 uint16_t length,
236 const MgtAssocRequestHeader& frame);
237};
238
239/**
240 * @ingroup wifi
241 * Implement the header for management frames of type reassociation request.
242 */
244 : public MgtHeaderInPerStaProfile<MgtReassocRequestHeader, AssocRequestElems>
245{
248
249 public:
250 ~MgtReassocRequestHeader() override = default;
251
252 /**
253 * Register this type.
254 * @return The TypeId.
255 */
256 static TypeId GetTypeId();
257
258 /** @copydoc Header::GetInstanceTypeId */
259 TypeId GetInstanceTypeId() const override;
260
261 Mac48Address m_currentApAddr; //!< Address of the current access point
262 CapabilityInformation m_capability; //!< Capability information
263 uint16_t m_listenInterval{0}; //!< listen interval (in units of beacon interval)
264
265 protected:
266 /** @copydoc Header::GetSerializedSize */
268 /** @copydoc Header::Serialize */
269 void SerializeImpl(Buffer::Iterator start) const;
270 /** @copydoc Header::Deserialize */
272 /** @copydoc Header::Print */
273 void PrintImpl(std::ostream& os) const;
274
275 /**
276 * @param frame the frame containing the Multi-Link Element
277 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
278 * subelement of the Multi-Link Element
279 */
281
282 /**
283 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
284 *
285 * @param start an iterator which points to where the header should be written
286 * @param frame the frame containing the Multi-Link Element
287 */
289 const MgtReassocRequestHeader& frame) const;
290
291 /**
292 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
293 *
294 * @param start an iterator which points to where the header should be read from
295 * @param length the expected number of bytes to read
296 * @param frame the frame containing the Multi-Link Element
297 * @return the number of bytes read
298 */
300 uint16_t length,
301 const MgtReassocRequestHeader& frame);
302};
303
304/**
305 * @ingroup wifi
306 * Implement the header for management frames of type association and reassociation response.
307 */
309 : public MgtHeaderInPerStaProfile<MgtAssocResponseHeader, AssocResponseElems>
310{
313
314 public:
315 ~MgtAssocResponseHeader() override = default;
316
317 /**
318 * Register this type.
319 * @return The TypeId.
320 */
321 static TypeId GetTypeId();
322
323 /** @copydoc Header::GetInstanceTypeId */
324 TypeId GetInstanceTypeId() const override;
325
326 CapabilityInformation m_capability; //!< Capability information
327 StatusCode m_statusCode; //!< Status code
328 uint16_t m_aid{0}; //!< AID
329
330 protected:
331 /** @copydoc Header::GetSerializedSize */
333 /** @copydoc Header::Serialize */
334 void SerializeImpl(Buffer::Iterator start) const;
335 /** @copydoc Header::Deserialize */
337 /** @copydoc Header::Print */
338 void PrintImpl(std::ostream& os) const;
339
340 /**
341 * @param frame the frame containing the Multi-Link Element
342 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
343 * subelement of the Multi-Link Element
344 */
346
347 /**
348 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
349 *
350 * @param start an iterator which points to where the header should be written
351 * @param frame the frame containing the Multi-Link Element
352 */
354 const MgtAssocResponseHeader& frame) const;
355
356 /**
357 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
358 *
359 * @param start an iterator which points to where the header should be read from
360 * @param length the expected number of bytes to read
361 * @param frame the frame containing the Multi-Link Element
362 * @return the number of bytes read
363 */
365 uint16_t length,
366 const MgtAssocResponseHeader& frame);
367};
368
369/**
370 * @ingroup wifi
371 * Implement the header for management frames of type probe request.
372 */
373class MgtProbeRequestHeader : public WifiMgtHeader<MgtProbeRequestHeader, ProbeRequestElems>
374{
375 public:
376 ~MgtProbeRequestHeader() override = default;
377
378 /**
379 * Register this type.
380 * @return The TypeId.
381 */
382 static TypeId GetTypeId();
383
384 /** @copydoc Header::GetInstanceTypeId */
385 TypeId GetInstanceTypeId() const override;
386};
387
388/**
389 * @ingroup wifi
390 * Implement the header for management frames of type probe response.
391 */
393 : public MgtHeaderInPerStaProfile<MgtProbeResponseHeader, ProbeResponseElems>
394{
397
398 public:
399 ~MgtProbeResponseHeader() override = default;
400
401 /**
402 * Register this type.
403 * @return The TypeId.
404 */
405 static TypeId GetTypeId();
406
407 /** @copydoc Header::GetInstanceTypeId */
408 TypeId GetInstanceTypeId() const override;
409
410 /**
411 * Return the time stamp.
412 *
413 * @return time stamp
414 */
415 uint64_t GetTimestamp() const;
416
417 uint64_t m_beaconInterval; //!< Beacon interval
418 CapabilityInformation m_capability; //!< Capability information
419
420 protected:
421 /** @copydoc Header::GetSerializedSize */
423 /** @copydoc Header::Serialize*/
424 void SerializeImpl(Buffer::Iterator start) const;
425 /** @copydoc Header::Deserialize */
427
428 /**
429 * @param frame the frame containing the Multi-Link Element
430 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
431 * subelement of the Multi-Link Element
432 */
434
435 /**
436 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
437 *
438 * @param start an iterator which points to where the header should be written
439 * @param frame the frame containing the Multi-Link Element
440 */
442 const MgtProbeResponseHeader& frame) const;
443
444 /**
445 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
446 *
447 * @param start an iterator which points to where the header should be read from
448 * @param length the expected number of bytes to read
449 * @param frame the frame containing the Multi-Link Element
450 * @return the number of bytes read
451 */
453 uint16_t length,
454 const MgtProbeResponseHeader& frame);
455
456 private:
457 uint64_t m_timestamp; //!< Timestamp (microseconds)
458};
459
460/**
461 * @ingroup wifi
462 * Implement the header for management frames of type beacon.
463 */
464class MgtBeaconHeader : public WifiMgtHeader<MgtBeaconHeader, BeaconElems>
465{
467
468 public:
469 ~MgtBeaconHeader() override = default;
470
471 /**
472 * Register this type.
473 * @return The TypeId.
474 */
475 static TypeId GetTypeId();
476
477 /// @copydoc Header::GetInstanceTypeId
478 TypeId GetInstanceTypeId() const override;
479
480 /// @return the time stamp
481 uint64_t GetTimestamp() const;
482
483 uint64_t m_beaconInterval{0}; //!< Beacon interval (microseconds)
484 CapabilityInformation m_capability; //!< Capability information
485
486 protected:
487 /// @copydoc Header::GetSerializedSize
489 /// @copydoc Header::Serialize
490 void SerializeImpl(Buffer::Iterator start) const;
491 /// @copydoc Header::Deserialize
493
494 private:
495 uint64_t m_timestamp{0}; //!< Timestamp (microseconds)
496};
497
498} // namespace ns3
499
500#endif /* MGT_HEADERS_H */
iterator in a Buffer instance
Definition buffer.h:98
an EUI-48 address
Implement the header for management frames of type association request.
uint32_t GetSerializedSizeImpl() const
uint32_t DeserializeImpl(Buffer::Iterator start)
uint32_t DeserializeFromPerStaProfileImpl(Buffer::Iterator start, uint16_t length, const MgtAssocRequestHeader &frame)
Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
~MgtAssocRequestHeader() override=default
void SerializeImpl(Buffer::Iterator start) const
CapabilityInformation m_capability
Capability information.
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtAssocRequestHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
uint16_t m_listenInterval
listen interval (in units of beacon interval)
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtAssocRequestHeader &frame) const
static TypeId GetTypeId()
Register this type.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Implement the header for management frames of type association and reassociation response.
static TypeId GetTypeId()
Register this type.
StatusCode m_statusCode
Status code.
~MgtAssocResponseHeader() override=default
uint32_t GetSerializedSizeImpl() const
uint32_t DeserializeFromPerStaProfileImpl(Buffer::Iterator start, uint16_t length, const MgtAssocResponseHeader &frame)
Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
uint32_t DeserializeImpl(Buffer::Iterator start)
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtAssocResponseHeader &frame) const
CapabilityInformation m_capability
Capability information.
void SerializeImpl(Buffer::Iterator start) const
void PrintImpl(std::ostream &os) const
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtAssocResponseHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
Implement the header for management frames of type beacon.
static TypeId GetTypeId()
Register this type.
uint32_t DeserializeImpl(Buffer::Iterator start)
uint64_t m_beaconInterval
Beacon interval (microseconds).
uint64_t m_timestamp
Timestamp (microseconds).
uint32_t GetSerializedSizeImpl() const
~MgtBeaconHeader() override=default
void SerializeImpl(Buffer::Iterator start) const
uint64_t GetTimestamp() const
CapabilityInformation m_capability
Capability information.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Implement the header for management frames that can be included in a Per-STA Profile subelement of a ...
Implement the header for management frames of type probe request.
~MgtProbeRequestHeader() override=default
static TypeId GetTypeId()
Register this type.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Implement the header for management frames of type probe response.
uint64_t GetTimestamp() const
Return the time stamp.
uint64_t m_beaconInterval
Beacon interval.
uint32_t GetSerializedSizeImpl() const
uint32_t DeserializeFromPerStaProfileImpl(Buffer::Iterator start, uint16_t length, const MgtProbeResponseHeader &frame)
Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtProbeResponseHeader &frame) const
static TypeId GetTypeId()
Register this type.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t DeserializeImpl(Buffer::Iterator start)
~MgtProbeResponseHeader() override=default
void SerializeImpl(Buffer::Iterator start) const
CapabilityInformation m_capability
Capability information.
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtProbeResponseHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
uint64_t m_timestamp
Timestamp (microseconds).
Implement the header for management frames of type reassociation request.
Mac48Address m_currentApAddr
Address of the current access point.
uint16_t m_listenInterval
listen interval (in units of beacon interval)
static TypeId GetTypeId()
Register this type.
void PrintImpl(std::ostream &os) const
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtReassocRequestHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
uint32_t DeserializeImpl(Buffer::Iterator start)
void SerializeImpl(Buffer::Iterator start) const
~MgtReassocRequestHeader() override=default
CapabilityInformation m_capability
Capability information.
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtReassocRequestHeader &frame) const
uint32_t DeserializeFromPerStaProfileImpl(Buffer::Iterator start, uint16_t length, const MgtReassocRequestHeader &frame)
Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
uint32_t GetSerializedSizeImpl() const
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
The Reduced Neighbor Report element.
The IEEE 802.11 SSID Information Element.
Definition ssid.h:25
Status code for association response.
Definition status-code.h:21
The Supported Rates Information Element.
The Traffic Indication Map Information Element.
Definition tim.h:29
a unique identifier for an interface.
Definition type-id.h:50
Implement the header for management frames.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::tuple< Ssid, SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::optional< HtCapabilities >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< HeCapabilities >, std::optional< He6GhzBandCapabilities >, std::optional< MultiLinkElement >, std::optional< EhtCapabilities >, std::vector< TidToLinkMapping > > AssocRequestElems
List of Information Elements included in Association Request frames.
std::tuple< Ssid, SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::optional< DsssParameterSet >, std::optional< HtCapabilities >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< HeCapabilities >, std::optional< He6GhzBandCapabilities >, std::optional< MultiLinkElement >, std::optional< EhtCapabilities > > ProbeRequestElems
List of Information Elements included in Probe Request frames.
std::tuple< Ssid, SupportedRates, std::optional< DsssParameterSet >, std::optional< Tim >, std::optional< ErpInformation >, std::optional< ExtendedSupportedRatesIE >, std::optional< EdcaParameterSet >, std::optional< HtCapabilities >, std::optional< HtOperation >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< VhtOperation >, std::optional< ReducedNeighborReport >, std::optional< HeCapabilities >, std::optional< HeOperation >, std::optional< MuEdcaParameterSet >, std::optional< He6GhzBandCapabilities >, std::optional< MultiLinkElement >, std::optional< EhtCapabilities >, std::optional< EhtOperation >, std::vector< TidToLinkMapping > > BeaconElems
List of Information Elements included in Beacon frames.
Definition mgt-headers.h:89
std::tuple< Ssid, SupportedRates, std::optional< DsssParameterSet >, std::optional< ErpInformation >, std::optional< ExtendedSupportedRatesIE >, std::optional< EdcaParameterSet >, std::optional< HtCapabilities >, std::optional< HtOperation >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< VhtOperation >, std::optional< ReducedNeighborReport >, std::optional< HeCapabilities >, std::optional< HeOperation >, std::optional< MuEdcaParameterSet >, std::optional< He6GhzBandCapabilities >, std::optional< MultiLinkElement >, std::optional< EhtCapabilities >, std::optional< EhtOperation >, std::vector< TidToLinkMapping > > ProbeResponseElems
List of Information Elements included in Probe Response frames.
std::tuple< SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::optional< EdcaParameterSet >, std::optional< HtCapabilities >, std::optional< HtOperation >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< VhtOperation >, std::optional< HeCapabilities >, std::optional< HeOperation >, std::optional< MuEdcaParameterSet >, std::optional< He6GhzBandCapabilities >, std::optional< MultiLinkElement >, std::optional< EhtCapabilities >, std::optional< EhtOperation >, std::vector< TidToLinkMapping > > AssocResponseElems
List of Information Elements included in Association Response frames.
Inspect a type to deduce whether it is an Information Element that can be included in a Per-STA Profi...