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 "wifi-mgt-header.h"
22
23#include "ns3/dsss-parameter-set.h"
24#include "ns3/eht-capabilities.h"
25#include "ns3/eht-operation.h"
26#include "ns3/erp-information.h"
27#include "ns3/he-6ghz-band-capabilities.h"
28#include "ns3/he-capabilities.h"
29#include "ns3/he-operation.h"
30#include "ns3/ht-capabilities.h"
31#include "ns3/ht-operation.h"
32#include "ns3/mac48-address.h"
33#include "ns3/mu-edca-parameter-set.h"
34#include "ns3/multi-link-element.h"
35#include "ns3/tid-to-link-mapping-element.h"
36#include "ns3/vht-capabilities.h"
37#include "ns3/vht-operation.h"
38
39namespace ns3
40{
41
42/**
43 * Indicate which Information Elements cannot be included in a Per-STA Profile subelement of
44 * a Basic Multi-Link Element (see Sec. 35.3.3.4 of 802.11be D3.1):
45 *
46 * An AP affiliated with an AP MLD shall not include a Timestamp field, a Beacon Interval field,
47 * an AID field, a BSS Max Idle Period element, a Neighbor Report element, a Reduced Neighbor
48 * Report element, a Multiple BSSID element, TIM element, Multiple BSSID-Index element, Multiple
49 * BSSID Configuration element, TID-to-Link Mapping element, Multi-Link Traffic Indication element
50 * or another Multi- Link element in the STA Profile field of the Basic Multi-Link element.
51 *
52 * A non-AP STA affiliated with a non-AP MLD shall not include a Listen Interval field, a Current
53 * AP Address field, an SSID element, BSS Max Idle Period element or another Multi-Link element in
54 * the STA Profile field of the Basic Multi-Link element.
55 */
56
57/** @copydoc CanBeInPerStaProfile */
58template <>
60{
61};
62
63/** @copydoc CanBeInPerStaProfile */
64template <>
65struct CanBeInPerStaProfile<TidToLinkMapping> : std::false_type
66{
67};
68
69/** @copydoc CanBeInPerStaProfile */
70template <>
71struct CanBeInPerStaProfile<MultiLinkElement> : std::false_type
72{
73};
74
75/** @copydoc CanBeInPerStaProfile */
76template <>
77struct CanBeInPerStaProfile<Ssid> : std::false_type
78{
79};
80
81/// List of Information Elements included in Probe Request frames
82using ProbeRequestElems = std::tuple<Ssid,
84 std::optional<ExtendedSupportedRatesIE>,
85 std::optional<DsssParameterSet>,
86 std::optional<HtCapabilities>,
87 std::optional<ExtendedCapabilities>,
88 std::optional<VhtCapabilities>,
89 std::optional<HeCapabilities>,
90 std::optional<He6GhzBandCapabilities>,
91 std::optional<MultiLinkElement>,
92 std::optional<EhtCapabilities>>;
93
94/// List of Information Elements included in Probe Response frames
95using ProbeResponseElems = std::tuple<Ssid,
97 std::optional<DsssParameterSet>,
98 std::optional<ErpInformation>,
99 std::optional<ExtendedSupportedRatesIE>,
100 std::optional<EdcaParameterSet>,
101 std::optional<HtCapabilities>,
102 std::optional<HtOperation>,
103 std::optional<ExtendedCapabilities>,
104 std::optional<VhtCapabilities>,
105 std::optional<VhtOperation>,
106 std::optional<ReducedNeighborReport>,
107 std::optional<HeCapabilities>,
108 std::optional<HeOperation>,
109 std::optional<MuEdcaParameterSet>,
110 std::optional<He6GhzBandCapabilities>,
111 std::optional<MultiLinkElement>,
112 std::optional<EhtCapabilities>,
113 std::optional<EhtOperation>,
114 std::vector<TidToLinkMapping>>;
115
116/// List of Information Elements included in Association Request frames
117using AssocRequestElems = std::tuple<Ssid,
119 std::optional<ExtendedSupportedRatesIE>,
120 std::optional<HtCapabilities>,
121 std::optional<ExtendedCapabilities>,
122 std::optional<VhtCapabilities>,
123 std::optional<HeCapabilities>,
124 std::optional<He6GhzBandCapabilities>,
125 std::optional<MultiLinkElement>,
126 std::optional<EhtCapabilities>,
127 std::vector<TidToLinkMapping>>;
128
129/// List of Information Elements included in Association Response frames
131 std::optional<ExtendedSupportedRatesIE>,
132 std::optional<EdcaParameterSet>,
133 std::optional<HtCapabilities>,
134 std::optional<HtOperation>,
135 std::optional<ExtendedCapabilities>,
136 std::optional<VhtCapabilities>,
137 std::optional<VhtOperation>,
138 std::optional<HeCapabilities>,
139 std::optional<HeOperation>,
140 std::optional<MuEdcaParameterSet>,
141 std::optional<He6GhzBandCapabilities>,
142 std::optional<MultiLinkElement>,
143 std::optional<EhtCapabilities>,
144 std::optional<EhtOperation>,
145 std::vector<TidToLinkMapping>>;
146
147/**
148 * @ingroup wifi
149 * Implement the header for management frames of type association request.
150 */
152 : public MgtHeaderInPerStaProfile<MgtAssocRequestHeader, AssocRequestElems>
153{
156
157 public:
158 ~MgtAssocRequestHeader() override = default;
159
160 /**
161 * Register this type.
162 * @return The TypeId.
163 */
164 static TypeId GetTypeId();
165
166 /** @copydoc Header::GetInstanceTypeId */
167 TypeId GetInstanceTypeId() const override;
168
169 /**
170 * Set the listen interval.
171 *
172 * @param interval the listen interval
173 */
174 void SetListenInterval(uint16_t interval);
175 /**
176 * Return the listen interval.
177 *
178 * @return the listen interval
179 */
180 uint16_t GetListenInterval() const;
181 /**
182 * @return a reference to the Capability information
183 */
185 /**
186 * @return a const reference to the Capability information
187 */
188 const CapabilityInformation& Capabilities() const;
189
190 protected:
191 /** @copydoc Header::GetSerializedSize */
193 /** @copydoc Header::Serialize */
194 void SerializeImpl(Buffer::Iterator start) const;
195 /** @copydoc Header::Deserialize */
197
198 /**
199 * @param frame the frame containing the Multi-Link Element
200 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
201 * subelement of the Multi-Link Element
202 */
204
205 /**
206 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
207 *
208 * @param start an iterator which points to where the header should be written
209 * @param frame the frame containing the Multi-Link Element
210 */
212 const MgtAssocRequestHeader& frame) const;
213
214 /**
215 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
216 *
217 * @param start an iterator which points to where the header should be read from
218 * @param length the expected number of bytes to read
219 * @param frame the frame containing the Multi-Link Element
220 * @return the number of bytes read
221 */
223 uint16_t length,
224 const MgtAssocRequestHeader& frame);
225
226 private:
227 CapabilityInformation m_capability; //!< Capability information
228 uint16_t m_listenInterval{0}; //!< listen interval
229};
230
231/**
232 * @ingroup wifi
233 * Implement the header for management frames of type reassociation request.
234 */
236 : public MgtHeaderInPerStaProfile<MgtReassocRequestHeader, AssocRequestElems>
237{
240
241 public:
242 ~MgtReassocRequestHeader() override = default;
243
244 /**
245 * Register this type.
246 * @return The TypeId.
247 */
248 static TypeId GetTypeId();
249
250 /** @copydoc Header::GetInstanceTypeId */
251 TypeId GetInstanceTypeId() const override;
252
253 /**
254 * Set the listen interval.
255 *
256 * @param interval the listen interval
257 */
258 void SetListenInterval(uint16_t interval);
259 /**
260 * Return the listen interval.
261 *
262 * @return the listen interval
263 */
264 uint16_t GetListenInterval() const;
265 /**
266 * @return a reference to the Capability information
267 */
269 /**
270 * @return a const reference to the Capability information
271 */
272 const CapabilityInformation& Capabilities() const;
273 /**
274 * Set the address of the current access point.
275 *
276 * @param currentApAddr address of the current access point
277 */
278 void SetCurrentApAddress(Mac48Address currentApAddr);
279
280 protected:
281 /** @copydoc Header::GetSerializedSize */
283 /** @copydoc Header::Serialize */
284 void SerializeImpl(Buffer::Iterator start) const;
285 /** @copydoc Header::Deserialize */
287 /** @copydoc Header::Print */
288 void PrintImpl(std::ostream& os) const;
289
290 /**
291 * @param frame the frame containing the Multi-Link Element
292 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
293 * subelement of the Multi-Link Element
294 */
296
297 /**
298 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
299 *
300 * @param start an iterator which points to where the header should be written
301 * @param frame the frame containing the Multi-Link Element
302 */
304 const MgtReassocRequestHeader& frame) const;
305
306 /**
307 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
308 *
309 * @param start an iterator which points to where the header should be read from
310 * @param length the expected number of bytes to read
311 * @param frame the frame containing the Multi-Link Element
312 * @return the number of bytes read
313 */
315 uint16_t length,
316 const MgtReassocRequestHeader& frame);
317
318 private:
319 Mac48Address m_currentApAddr; //!< Address of the current access point
320 CapabilityInformation m_capability; //!< Capability information
321 uint16_t m_listenInterval{0}; //!< listen interval
322};
323
324/**
325 * @ingroup wifi
326 * Implement the header for management frames of type association and reassociation response.
327 */
329 : public MgtHeaderInPerStaProfile<MgtAssocResponseHeader, AssocResponseElems>
330{
333
334 public:
335 ~MgtAssocResponseHeader() override = default;
336
337 /**
338 * Register this type.
339 * @return The TypeId.
340 */
341 static TypeId GetTypeId();
342
343 /** @copydoc Header::GetInstanceTypeId */
344 TypeId GetInstanceTypeId() const override;
345
346 /**
347 * Return the status code.
348 *
349 * @return the status code
350 */
352 /**
353 * Set the status code.
354 *
355 * @param code the status code
356 */
357 void SetStatusCode(StatusCode code);
358 /**
359 * @return a reference to the Capability information
360 */
362 /**
363 * @return a const reference to the Capability information
364 */
365 const CapabilityInformation& Capabilities() const;
366 /**
367 * Return the association ID.
368 *
369 * @return the association ID
370 */
371 uint16_t GetAssociationId() const;
372 /**
373 * Set the association ID.
374 *
375 * @param aid the association ID
376 */
377 void SetAssociationId(uint16_t aid);
378
379 protected:
380 /** @copydoc Header::GetSerializedSize */
382 /** @copydoc Header::Serialize */
383 void SerializeImpl(Buffer::Iterator start) const;
384 /** @copydoc Header::Deserialize */
386 /** @copydoc Header::Print */
387 void PrintImpl(std::ostream& os) const;
388
389 /**
390 * @param frame the frame containing the Multi-Link Element
391 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
392 * subelement of the Multi-Link Element
393 */
395
396 /**
397 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
398 *
399 * @param start an iterator which points to where the header should be written
400 * @param frame the frame containing the Multi-Link Element
401 */
403 const MgtAssocResponseHeader& frame) const;
404
405 /**
406 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
407 *
408 * @param start an iterator which points to where the header should be read from
409 * @param length the expected number of bytes to read
410 * @param frame the frame containing the Multi-Link Element
411 * @return the number of bytes read
412 */
414 uint16_t length,
415 const MgtAssocResponseHeader& frame);
416
417 private:
418 CapabilityInformation m_capability; //!< Capability information
419 StatusCode m_code; //!< Status code
420 uint16_t m_aid{0}; //!< AID
421};
422
423/**
424 * @ingroup wifi
425 * Implement the header for management frames of type probe request.
426 */
427class MgtProbeRequestHeader : public WifiMgtHeader<MgtProbeRequestHeader, ProbeRequestElems>
428{
429 public:
430 ~MgtProbeRequestHeader() override = default;
431
432 /**
433 * Register this type.
434 * @return The TypeId.
435 */
436 static TypeId GetTypeId();
437
438 /** @copydoc Header::GetInstanceTypeId */
439 TypeId GetInstanceTypeId() const override;
440};
441
442/**
443 * @ingroup wifi
444 * Implement the header for management frames of type probe response.
445 */
447 : public MgtHeaderInPerStaProfile<MgtProbeResponseHeader, ProbeResponseElems>
448{
451
452 public:
453 ~MgtProbeResponseHeader() override = default;
454
455 /**
456 * Register this type.
457 * @return The TypeId.
458 */
459 static TypeId GetTypeId();
460
461 /** @copydoc Header::GetInstanceTypeId */
462 TypeId GetInstanceTypeId() const override;
463
464 /**
465 * Return the beacon interval in microseconds unit.
466 *
467 * @return beacon interval in microseconds unit
468 */
469 uint64_t GetBeaconIntervalUs() const;
470 /**
471 * Set the beacon interval in microseconds unit.
472 *
473 * @param us beacon interval in microseconds unit
474 */
475 void SetBeaconIntervalUs(uint64_t us);
476 /**
477 * @return a reference to the Capability information
478 */
480 /**
481 * @return a const reference to the Capability information
482 */
483 const CapabilityInformation& Capabilities() const;
484 /**
485 * Return the time stamp.
486 *
487 * @return time stamp
488 */
489 uint64_t GetTimestamp() const;
490
491 protected:
492 /** @copydoc Header::GetSerializedSize */
494 /** @copydoc Header::Serialize*/
495 void SerializeImpl(Buffer::Iterator start) const;
496 /** @copydoc Header::Deserialize */
498
499 /**
500 * @param frame the frame containing the Multi-Link Element
501 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
502 * subelement of the Multi-Link Element
503 */
505
506 /**
507 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
508 *
509 * @param start an iterator which points to where the header should be written
510 * @param frame the frame containing the Multi-Link Element
511 */
513 const MgtProbeResponseHeader& frame) const;
514
515 /**
516 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
517 *
518 * @param start an iterator which points to where the header should be read from
519 * @param length the expected number of bytes to read
520 * @param frame the frame containing the Multi-Link Element
521 * @return the number of bytes read
522 */
524 uint16_t length,
525 const MgtProbeResponseHeader& frame);
526
527 private:
528 uint64_t m_timestamp; //!< Timestamp
529 uint64_t m_beaconInterval; //!< Beacon interval
530 CapabilityInformation m_capability; //!< Capability information
531};
532
533/**
534 * @ingroup wifi
535 * Implement the header for management frames of type beacon.
536 */
538{
539 public:
540 ~MgtBeaconHeader() override = default;
541
542 /**
543 * Register this type.
544 * @return The TypeId.
545 */
546 static TypeId GetTypeId();
547};
548
549} // namespace ns3
550
551#endif /* MGT_HEADERS_H */
iterator in a Buffer instance
Definition buffer.h:89
an EUI-48 address
Implement the header for management frames of type association request.
uint32_t GetSerializedSizeImpl() const
uint32_t DeserializeImpl(Buffer::Iterator start)
CapabilityInformation & Capabilities()
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.
void SetListenInterval(uint16_t interval)
Set the listen interval.
uint16_t GetListenInterval() const
Return the listen interval.
uint16_t m_listenInterval
listen 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.
CapabilityInformation & Capabilities()
static TypeId GetTypeId()
Register this type.
StatusCode GetStatusCode()
Return the 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)
void SetStatusCode(StatusCode code)
Set the status code.
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtAssocResponseHeader &frame) const
void SetAssociationId(uint16_t aid)
Set the association ID.
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.
uint16_t GetAssociationId() const
Return the association ID.
StatusCode m_code
Status code.
Implement the header for management frames of type beacon.
static TypeId GetTypeId()
Register this type.
~MgtBeaconHeader() override=default
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 SetBeaconIntervalUs(uint64_t us)
Set the beacon interval in microseconds unit.
uint64_t GetBeaconIntervalUs() const
Return the beacon interval in microseconds unit.
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.
CapabilityInformation & Capabilities()
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
uint16_t GetListenInterval() const
Return the listen interval.
static TypeId GetTypeId()
Register this type.
CapabilityInformation & Capabilities()
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
void SetListenInterval(uint16_t interval)
Set the listen interval.
~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
void SetCurrentApAddress(Mac48Address currentApAddr)
Set the address of the current access point.
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.
a unique identifier for an interface.
Definition type-id.h:49
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.
Definition mgt-headers.h:82
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.
Definition mgt-headers.h:95
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...