A Discrete-Event Network Simulator
API
mgt-headers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 INRIA
3  * Copyright (c) 2009 MIRKO BANCHI
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Mirko Banchi <mk.banchi@gmail.com>
20  */
21 
22 #ifndef MGT_HEADERS_H
23 #define MGT_HEADERS_H
24 
25 #include "capability-information.h"
26 #include "edca-parameter-set.h"
27 #include "extended-capabilities.h"
29 #include "ssid.h"
30 #include "status-code.h"
31 #include "supported-rates.h"
32 #include "wifi-mgt-header.h"
33 
34 #include "ns3/dsss-parameter-set.h"
35 #include "ns3/eht-capabilities.h"
36 #include "ns3/eht-operation.h"
37 #include "ns3/erp-information.h"
38 #include "ns3/he-capabilities.h"
39 #include "ns3/he-operation.h"
40 #include "ns3/ht-capabilities.h"
41 #include "ns3/ht-operation.h"
42 #include "ns3/mac48-address.h"
43 #include "ns3/mu-edca-parameter-set.h"
44 #include "ns3/multi-link-element.h"
45 #include "ns3/tid-to-link-mapping-element.h"
46 #include "ns3/vht-capabilities.h"
47 #include "ns3/vht-operation.h"
48 
49 namespace ns3
50 {
51 
68 template <>
70 {
71 };
72 
74 template <>
75 struct CanBeInPerStaProfile<TidToLinkMapping> : std::false_type
76 {
77 };
78 
80 template <>
81 struct CanBeInPerStaProfile<MultiLinkElement> : std::false_type
82 {
83 };
84 
86 template <>
87 struct CanBeInPerStaProfile<Ssid> : std::false_type
88 {
89 };
90 
92 using ProbeRequestElems = std::tuple<Ssid,
94  std::optional<ExtendedSupportedRatesIE>,
95  std::optional<HtCapabilities>,
96  std::optional<ExtendedCapabilities>,
97  std::optional<VhtCapabilities>,
98  std::optional<HeCapabilities>,
99  std::optional<EhtCapabilities>>;
100 
102 using ProbeResponseElems = std::tuple<Ssid,
104  std::optional<DsssParameterSet>,
105  std::optional<ErpInformation>,
106  std::optional<ExtendedSupportedRatesIE>,
107  std::optional<EdcaParameterSet>,
108  std::optional<HtCapabilities>,
109  std::optional<HtOperation>,
110  std::optional<ExtendedCapabilities>,
111  std::optional<VhtCapabilities>,
112  std::optional<VhtOperation>,
113  std::optional<ReducedNeighborReport>,
114  std::optional<HeCapabilities>,
115  std::optional<HeOperation>,
116  std::optional<MuEdcaParameterSet>,
117  std::optional<MultiLinkElement>,
118  std::optional<EhtCapabilities>,
119  std::optional<EhtOperation>,
120  std::vector<TidToLinkMapping>>;
121 
123 using AssocRequestElems = std::tuple<Ssid,
125  std::optional<ExtendedSupportedRatesIE>,
126  std::optional<HtCapabilities>,
127  std::optional<ExtendedCapabilities>,
128  std::optional<VhtCapabilities>,
129  std::optional<HeCapabilities>,
130  std::optional<MultiLinkElement>,
131  std::optional<EhtCapabilities>,
132  std::vector<TidToLinkMapping>>;
133 
136  std::optional<ExtendedSupportedRatesIE>,
137  std::optional<EdcaParameterSet>,
138  std::optional<HtCapabilities>,
139  std::optional<HtOperation>,
140  std::optional<ExtendedCapabilities>,
141  std::optional<VhtCapabilities>,
142  std::optional<VhtOperation>,
143  std::optional<HeCapabilities>,
144  std::optional<HeOperation>,
145  std::optional<MuEdcaParameterSet>,
146  std::optional<MultiLinkElement>,
147  std::optional<EhtCapabilities>,
148  std::optional<EhtOperation>,
149  std::vector<TidToLinkMapping>>;
150 
156  : public MgtHeaderInPerStaProfile<MgtAssocRequestHeader, AssocRequestElems>
157 {
160 
161  public:
162  ~MgtAssocRequestHeader() override = default;
163 
168  static TypeId GetTypeId();
169 
171  TypeId GetInstanceTypeId() const override;
172 
178  void SetListenInterval(uint16_t interval);
184  uint16_t GetListenInterval() const;
192  const CapabilityInformation& Capabilities() const;
193 
194  protected:
196  uint32_t GetSerializedSizeImpl() const;
201 
207  uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtAssocRequestHeader& frame) const;
208 
216  const MgtAssocRequestHeader& frame) const;
217 
227  uint16_t length,
228  const MgtAssocRequestHeader& frame);
229 
230  private:
232  uint16_t m_listenInterval{0};
233 };
234 
240  : public MgtHeaderInPerStaProfile<MgtReassocRequestHeader, AssocRequestElems>
241 {
244 
245  public:
246  ~MgtReassocRequestHeader() override = default;
247 
252  static TypeId GetTypeId();
253 
255  TypeId GetInstanceTypeId() const override;
256 
262  void SetListenInterval(uint16_t interval);
268  uint16_t GetListenInterval() const;
276  const CapabilityInformation& Capabilities() const;
282  void SetCurrentApAddress(Mac48Address currentApAddr);
283 
284  protected:
286  uint32_t GetSerializedSizeImpl() const;
292  void PrintImpl(std::ostream& os) const;
293 
300 
308  const MgtReassocRequestHeader& frame) const;
309 
319  uint16_t length,
320  const MgtReassocRequestHeader& frame);
321 
322  private:
325  uint16_t m_listenInterval{0};
326 };
327 
333  : public MgtHeaderInPerStaProfile<MgtAssocResponseHeader, AssocResponseElems>
334 {
337 
338  public:
339  ~MgtAssocResponseHeader() override = default;
340 
345  static TypeId GetTypeId();
346 
348  TypeId GetInstanceTypeId() const override;
349 
361  void SetStatusCode(StatusCode code);
369  const CapabilityInformation& Capabilities() const;
375  uint16_t GetAssociationId() const;
381  void SetAssociationId(uint16_t aid);
382 
383  protected:
385  uint32_t GetSerializedSizeImpl() const;
391  void PrintImpl(std::ostream& os) const;
392 
399 
407  const MgtAssocResponseHeader& frame) const;
408 
418  uint16_t length,
419  const MgtAssocResponseHeader& frame);
420 
421  private:
424  uint16_t m_aid{0};
425 };
426 
431 class MgtProbeRequestHeader : public WifiMgtHeader<MgtProbeRequestHeader, ProbeRequestElems>
432 {
433  public:
434  ~MgtProbeRequestHeader() override = default;
435 
440  static TypeId GetTypeId();
441 
443  TypeId GetInstanceTypeId() const override;
444 };
445 
450 class MgtProbeResponseHeader : public WifiMgtHeader<MgtProbeResponseHeader, ProbeResponseElems>
451 {
453 
454  public:
455  ~MgtProbeResponseHeader() override = default;
456 
461  static TypeId GetTypeId();
462 
464  TypeId GetInstanceTypeId() const override;
465 
471  uint64_t GetBeaconIntervalUs() const;
477  void SetBeaconIntervalUs(uint64_t us);
485  const CapabilityInformation& Capabilities() const;
491  uint64_t GetTimestamp() const;
492 
493  protected:
495  uint32_t GetSerializedSizeImpl() const;
500 
501  private:
502  uint64_t m_timestamp;
503  uint64_t m_beaconInterval;
505 };
506 
512 {
513  public:
514  ~MgtBeaconHeader() override = default;
515 
520  static TypeId GetTypeId();
521 };
522 
523 } // namespace ns3
524 
525 #endif /* MGT_HEADERS_H */
iterator in a Buffer instance
Definition: buffer.h:100
an EUI-48 address
Definition: mac48-address.h:46
Implement the header for management frames of type association request.
Definition: mgt-headers.h:157
uint32_t GetSerializedSizeImpl() const
Definition: mgt-headers.cc:199
uint32_t DeserializeImpl(Buffer::Iterator start)
Definition: mgt-headers.cc:244
CapabilityInformation & Capabilities()
Definition: mgt-headers.cc:193
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.
Definition: mgt-headers.cc:270
~MgtAssocRequestHeader() override=default
void SerializeImpl(Buffer::Iterator start) const
Definition: mgt-headers.cc:223
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:231
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtAssocRequestHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
Definition: mgt-headers.cc:234
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:181
uint16_t GetListenInterval() const
Return the listen interval.
Definition: mgt-headers.cc:175
uint16_t m_listenInterval
listen interval
Definition: mgt-headers.h:232
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtAssocRequestHeader &frame) const
Definition: mgt-headers.cc:211
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:159
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:169
Implement the header for management frames of type association and reassociation response.
Definition: mgt-headers.h:334
CapabilityInformation & Capabilities()
Definition: mgt-headers.cc:474
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:440
StatusCode GetStatusCode()
Return the status code.
Definition: mgt-headers.cc:456
~MgtAssocResponseHeader() override=default
uint32_t GetSerializedSizeImpl() const
Definition: mgt-headers.cc:492
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.
Definition: mgt-headers.cc:573
uint32_t DeserializeImpl(Buffer::Iterator start)
Definition: mgt-headers.cc:549
void SetStatusCode(StatusCode code)
Set the status code.
Definition: mgt-headers.cc:462
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtAssocResponseHeader &frame) const
Definition: mgt-headers.cc:505
void SetAssociationId(uint16_t aid)
Set the association ID.
Definition: mgt-headers.cc:480
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:422
void SerializeImpl(Buffer::Iterator start) const
Definition: mgt-headers.cc:526
void PrintImpl(std::ostream &os) const
Definition: mgt-headers.cc:518
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:450
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtAssocResponseHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
Definition: mgt-headers.cc:538
uint16_t GetAssociationId() const
Return the association ID.
Definition: mgt-headers.cc:486
StatusCode m_code
Status code.
Definition: mgt-headers.h:423
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:512
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:143
~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.
Definition: mgt-headers.h:432
~MgtProbeRequestHeader() override=default
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:37
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:47
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:451
uint64_t GetTimestamp() const
Return the time stamp.
Definition: mgt-headers.cc:99
uint64_t m_beaconInterval
Beacon interval.
Definition: mgt-headers.h:503
uint32_t GetSerializedSizeImpl() const
Definition: mgt-headers.cc:105
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:59
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:69
uint32_t DeserializeImpl(Buffer::Iterator start)
Definition: mgt-headers.cc:124
~MgtProbeResponseHeader() override=default
void SetBeaconIntervalUs(uint64_t us)
Set the beacon interval in microseconds unit.
Definition: mgt-headers.cc:81
uint64_t GetBeaconIntervalUs() const
Return the beacon interval in microseconds unit.
Definition: mgt-headers.cc:75
void SerializeImpl(Buffer::Iterator start) const
Definition: mgt-headers.cc:114
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:504
uint64_t m_timestamp
Timestamp.
Definition: mgt-headers.h:502
CapabilityInformation & Capabilities()
Definition: mgt-headers.cc:93
Implement the header for management frames of type reassociation request.
Definition: mgt-headers.h:241
Mac48Address m_currentApAddr
Address of the current access point.
Definition: mgt-headers.h:323
uint16_t m_listenInterval
listen interval
Definition: mgt-headers.h:325
uint16_t GetListenInterval() const
Return the listen interval.
Definition: mgt-headers.cc:307
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:291
CapabilityInformation & Capabilities()
Definition: mgt-headers.cc:325
void PrintImpl(std::ostream &os) const
Definition: mgt-headers.cc:362
void SerializeInPerStaProfileImpl(Buffer::Iterator start, const MgtReassocRequestHeader &frame) const
Serialize this header into a Per-STA Profile subelement of a Multi-Link Element.
Definition: mgt-headers.cc:381
uint32_t DeserializeImpl(Buffer::Iterator start)
Definition: mgt-headers.cc:391
void SerializeImpl(Buffer::Iterator start) const
Definition: mgt-headers.cc:369
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:313
~MgtReassocRequestHeader() override=default
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:324
uint32_t GetSerializedSizeInPerStaProfileImpl(const MgtReassocRequestHeader &frame) const
Definition: mgt-headers.cc:350
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.
Definition: mgt-headers.cc:418
uint32_t GetSerializedSizeImpl() const
Definition: mgt-headers.cc:337
void SetCurrentApAddress(Mac48Address currentApAddr)
Set the address of the current access point.
Definition: mgt-headers.cc:331
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:301
The Reduced Neighbor Report element.
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
Status code for association response.
Definition: status-code.h:32
The Supported Rates Information Element.
a unique identifier for an interface.
Definition: type-id.h:59
Implement the header for management frames.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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< MultiLinkElement >, std::optional< EhtCapabilities >, std::optional< EhtOperation >, std::vector< TidToLinkMapping > > AssocResponseElems
List of Information Elements included in Association Response frames.
Definition: mgt-headers.h:149
std::tuple< Ssid, SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::optional< HtCapabilities >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< HeCapabilities >, std::optional< EhtCapabilities > > ProbeRequestElems
List of Information Elements included in Probe Request frames.
Definition: mgt-headers.h:99
std::tuple< Ssid, SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::optional< HtCapabilities >, std::optional< ExtendedCapabilities >, std::optional< VhtCapabilities >, std::optional< HeCapabilities >, std::optional< MultiLinkElement >, std::optional< EhtCapabilities >, std::vector< TidToLinkMapping > > AssocRequestElems
List of Information Elements included in Association Request frames.
Definition: mgt-headers.h:132
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< MultiLinkElement >, std::optional< EhtCapabilities >, std::optional< EhtOperation >, std::vector< TidToLinkMapping > > ProbeResponseElems
List of Information Elements included in Probe Response frames.
Definition: mgt-headers.h:120
Inspect a type to deduce whether it is an Information Element that can be included in a Per-STA Profi...