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<HtCapabilities>,
86 std::optional<ExtendedCapabilities>,
87 std::optional<VhtCapabilities>,
88 std::optional<HeCapabilities>,
89 std::optional<He6GhzBandCapabilities>,
90 std::optional<EhtCapabilities>>;
91
92/// List of Information Elements included in Probe Response frames
93using ProbeResponseElems = std::tuple<Ssid,
95 std::optional<DsssParameterSet>,
96 std::optional<ErpInformation>,
97 std::optional<ExtendedSupportedRatesIE>,
98 std::optional<EdcaParameterSet>,
99 std::optional<HtCapabilities>,
100 std::optional<HtOperation>,
101 std::optional<ExtendedCapabilities>,
102 std::optional<VhtCapabilities>,
103 std::optional<VhtOperation>,
104 std::optional<ReducedNeighborReport>,
105 std::optional<HeCapabilities>,
106 std::optional<HeOperation>,
107 std::optional<MuEdcaParameterSet>,
108 std::optional<He6GhzBandCapabilities>,
109 std::optional<MultiLinkElement>,
110 std::optional<EhtCapabilities>,
111 std::optional<EhtOperation>,
112 std::vector<TidToLinkMapping>>;
113
114/// List of Information Elements included in Association Request frames
115using AssocRequestElems = std::tuple<Ssid,
117 std::optional<ExtendedSupportedRatesIE>,
118 std::optional<HtCapabilities>,
119 std::optional<ExtendedCapabilities>,
120 std::optional<VhtCapabilities>,
121 std::optional<HeCapabilities>,
122 std::optional<He6GhzBandCapabilities>,
123 std::optional<MultiLinkElement>,
124 std::optional<EhtCapabilities>,
125 std::vector<TidToLinkMapping>>;
126
127/// List of Information Elements included in Association Response frames
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<HeCapabilities>,
137 std::optional<HeOperation>,
138 std::optional<MuEdcaParameterSet>,
139 std::optional<He6GhzBandCapabilities>,
140 std::optional<MultiLinkElement>,
141 std::optional<EhtCapabilities>,
142 std::optional<EhtOperation>,
143 std::vector<TidToLinkMapping>>;
144
145/**
146 * @ingroup wifi
147 * Implement the header for management frames of type association request.
148 */
150 : public MgtHeaderInPerStaProfile<MgtAssocRequestHeader, AssocRequestElems>
151{
154
155 public:
156 ~MgtAssocRequestHeader() override = default;
157
158 /**
159 * Register this type.
160 * @return The TypeId.
161 */
162 static TypeId GetTypeId();
163
164 /** @copydoc Header::GetInstanceTypeId */
165 TypeId GetInstanceTypeId() const override;
166
167 /**
168 * Set the listen interval.
169 *
170 * @param interval the listen interval
171 */
172 void SetListenInterval(uint16_t interval);
173 /**
174 * Return the listen interval.
175 *
176 * @return the listen interval
177 */
178 uint16_t GetListenInterval() const;
179 /**
180 * @return a reference to the Capability information
181 */
183 /**
184 * @return a const reference to the Capability information
185 */
186 const CapabilityInformation& Capabilities() const;
187
188 protected:
189 /** @copydoc Header::GetSerializedSize */
191 /** @copydoc Header::Serialize */
192 void SerializeImpl(Buffer::Iterator start) const;
193 /** @copydoc Header::Deserialize */
195
196 /**
197 * @param frame the frame containing the Multi-Link Element
198 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
199 * subelement of the Multi-Link Element
200 */
202
203 /**
204 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
205 *
206 * @param start an iterator which points to where the header should be written
207 * @param frame the frame containing the Multi-Link Element
208 */
210 const MgtAssocRequestHeader& frame) const;
211
212 /**
213 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
214 *
215 * @param start an iterator which points to where the header should be read from
216 * @param length the expected number of bytes to read
217 * @param frame the frame containing the Multi-Link Element
218 * @return the number of bytes read
219 */
221 uint16_t length,
222 const MgtAssocRequestHeader& frame);
223
224 private:
225 CapabilityInformation m_capability; //!< Capability information
226 uint16_t m_listenInterval{0}; //!< listen interval
227};
228
229/**
230 * @ingroup wifi
231 * Implement the header for management frames of type reassociation request.
232 */
234 : public MgtHeaderInPerStaProfile<MgtReassocRequestHeader, AssocRequestElems>
235{
238
239 public:
240 ~MgtReassocRequestHeader() override = default;
241
242 /**
243 * Register this type.
244 * @return The TypeId.
245 */
246 static TypeId GetTypeId();
247
248 /** @copydoc Header::GetInstanceTypeId */
249 TypeId GetInstanceTypeId() const override;
250
251 /**
252 * Set the listen interval.
253 *
254 * @param interval the listen interval
255 */
256 void SetListenInterval(uint16_t interval);
257 /**
258 * Return the listen interval.
259 *
260 * @return the listen interval
261 */
262 uint16_t GetListenInterval() const;
263 /**
264 * @return a reference to the Capability information
265 */
267 /**
268 * @return a const reference to the Capability information
269 */
270 const CapabilityInformation& Capabilities() const;
271 /**
272 * Set the address of the current access point.
273 *
274 * @param currentApAddr address of the current access point
275 */
276 void SetCurrentApAddress(Mac48Address currentApAddr);
277
278 protected:
279 /** @copydoc Header::GetSerializedSize */
281 /** @copydoc Header::Serialize */
282 void SerializeImpl(Buffer::Iterator start) const;
283 /** @copydoc Header::Deserialize */
285 /** @copydoc Header::Print */
286 void PrintImpl(std::ostream& os) const;
287
288 /**
289 * @param frame the frame containing the Multi-Link Element
290 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
291 * subelement of the Multi-Link Element
292 */
294
295 /**
296 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
297 *
298 * @param start an iterator which points to where the header should be written
299 * @param frame the frame containing the Multi-Link Element
300 */
302 const MgtReassocRequestHeader& frame) const;
303
304 /**
305 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
306 *
307 * @param start an iterator which points to where the header should be read from
308 * @param length the expected number of bytes to read
309 * @param frame the frame containing the Multi-Link Element
310 * @return the number of bytes read
311 */
313 uint16_t length,
314 const MgtReassocRequestHeader& frame);
315
316 private:
317 Mac48Address m_currentApAddr; //!< Address of the current access point
318 CapabilityInformation m_capability; //!< Capability information
319 uint16_t m_listenInterval{0}; //!< listen interval
320};
321
322/**
323 * @ingroup wifi
324 * Implement the header for management frames of type association and reassociation response.
325 */
327 : public MgtHeaderInPerStaProfile<MgtAssocResponseHeader, AssocResponseElems>
328{
331
332 public:
333 ~MgtAssocResponseHeader() override = default;
334
335 /**
336 * Register this type.
337 * @return The TypeId.
338 */
339 static TypeId GetTypeId();
340
341 /** @copydoc Header::GetInstanceTypeId */
342 TypeId GetInstanceTypeId() const override;
343
344 /**
345 * Return the status code.
346 *
347 * @return the status code
348 */
350 /**
351 * Set the status code.
352 *
353 * @param code the status code
354 */
355 void SetStatusCode(StatusCode code);
356 /**
357 * @return a reference to the Capability information
358 */
360 /**
361 * @return a const reference to the Capability information
362 */
363 const CapabilityInformation& Capabilities() const;
364 /**
365 * Return the association ID.
366 *
367 * @return the association ID
368 */
369 uint16_t GetAssociationId() const;
370 /**
371 * Set the association ID.
372 *
373 * @param aid the association ID
374 */
375 void SetAssociationId(uint16_t aid);
376
377 protected:
378 /** @copydoc Header::GetSerializedSize */
380 /** @copydoc Header::Serialize */
381 void SerializeImpl(Buffer::Iterator start) const;
382 /** @copydoc Header::Deserialize */
384 /** @copydoc Header::Print */
385 void PrintImpl(std::ostream& os) const;
386
387 /**
388 * @param frame the frame containing the Multi-Link Element
389 * @return the number of bytes that are needed to serialize this header into a Per-STA Profile
390 * subelement of the Multi-Link Element
391 */
393
394 /**
395 * Serialize this header into a Per-STA Profile subelement of a Multi-Link Element
396 *
397 * @param start an iterator which points to where the header should be written
398 * @param frame the frame containing the Multi-Link Element
399 */
401 const MgtAssocResponseHeader& frame) const;
402
403 /**
404 * Deserialize this header from a Per-STA Profile subelement of a Multi-Link Element.
405 *
406 * @param start an iterator which points to where the header should be read from
407 * @param length the expected number of bytes to read
408 * @param frame the frame containing the Multi-Link Element
409 * @return the number of bytes read
410 */
412 uint16_t length,
413 const MgtAssocResponseHeader& frame);
414
415 private:
416 CapabilityInformation m_capability; //!< Capability information
417 StatusCode m_code; //!< Status code
418 uint16_t m_aid{0}; //!< AID
419};
420
421/**
422 * @ingroup wifi
423 * Implement the header for management frames of type probe request.
424 */
425class MgtProbeRequestHeader : public WifiMgtHeader<MgtProbeRequestHeader, ProbeRequestElems>
426{
427 public:
428 ~MgtProbeRequestHeader() override = default;
429
430 /**
431 * Register this type.
432 * @return The TypeId.
433 */
434 static TypeId GetTypeId();
435
436 /** @copydoc Header::GetInstanceTypeId */
437 TypeId GetInstanceTypeId() const override;
438};
439
440/**
441 * @ingroup wifi
442 * Implement the header for management frames of type probe response.
443 */
444class MgtProbeResponseHeader : public WifiMgtHeader<MgtProbeResponseHeader, ProbeResponseElems>
445{
447
448 public:
449 ~MgtProbeResponseHeader() override = default;
450
451 /**
452 * Register this type.
453 * @return The TypeId.
454 */
455 static TypeId GetTypeId();
456
457 /** @copydoc Header::GetInstanceTypeId */
458 TypeId GetInstanceTypeId() const override;
459
460 /**
461 * Return the beacon interval in microseconds unit.
462 *
463 * @return beacon interval in microseconds unit
464 */
465 uint64_t GetBeaconIntervalUs() const;
466 /**
467 * Set the beacon interval in microseconds unit.
468 *
469 * @param us beacon interval in microseconds unit
470 */
471 void SetBeaconIntervalUs(uint64_t us);
472 /**
473 * @return a reference to the Capability information
474 */
476 /**
477 * @return a const reference to the Capability information
478 */
479 const CapabilityInformation& Capabilities() const;
480 /**
481 * Return the time stamp.
482 *
483 * @return time stamp
484 */
485 uint64_t GetTimestamp() const;
486
487 protected:
488 /** @copydoc Header::GetSerializedSize */
490 /** @copydoc Header::Serialize*/
491 void SerializeImpl(Buffer::Iterator start) const;
492 /** @copydoc Header::Deserialize */
494
495 private:
496 uint64_t m_timestamp; //!< Timestamp
497 uint64_t m_beaconInterval; //!< Beacon interval
498 CapabilityInformation m_capability; //!< Capability information
499};
500
501/**
502 * @ingroup wifi
503 * Implement the header for management frames of type beacon.
504 */
506{
507 public:
508 ~MgtBeaconHeader() override = default;
509
510 /**
511 * Register this type.
512 * @return The TypeId.
513 */
514 static TypeId GetTypeId();
515};
516
517} // namespace ns3
518
519#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
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.
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:48
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< HtCapabilities >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< HeCapabilities >, std::optional< He6GhzBandCapabilities >, 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:93
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...