A Discrete-Event Network Simulator
API
multi-link-element.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 MULTI_LINK_ELEMENT_H
21#define MULTI_LINK_ELEMENT_H
22
23#include "ns3/nstime.h"
24#include "ns3/wifi-information-element.h"
25#include "ns3/wifi-mac-header.h"
26
27#include <memory>
28#include <optional>
29#include <variant>
30
31namespace ns3
32{
33
34class MgtAssocRequestHeader;
35class MgtReassocRequestHeader;
36class MgtAssocResponseHeader;
37
39using AssocReqRefVariant = std::variant<std::reference_wrapper<MgtAssocRequestHeader>,
40 std::reference_wrapper<MgtReassocRequestHeader>>;
41
47{
52 {
55 uint8_t mediumSyncMaxNTxops : 4;
56 };
57
62 {
63 uint8_t emlsrSupport : 1;
64 uint8_t emlsrPaddingDelay : 3;
66 uint8_t emlmrSupport : 1;
67 uint8_t emlmrDelay : 3;
68 uint8_t transitionTimeout : 4;
69 };
70
75 {
77 uint8_t srsSupport : 1;
79 uint8_t freqSepForStrApMld : 5;
80 uint8_t aarSupport : 1;
81 };
82
87 std::optional<uint8_t> m_linkIdInfo;
88 std::optional<uint8_t> m_bssParamsChangeCount;
89 std::optional<MediumSyncDelayInfo>
91 std::optional<EmlCapabilities> m_emlCapabilities;
92 std::optional<MldCapabilities> m_mldCapabilities;
93
99 uint16_t GetPresenceBitmap() const;
105 uint8_t GetSize() const;
111 void Serialize(Buffer::Iterator& start) const;
120 uint8_t Deserialize(Buffer::Iterator start, uint16_t presence);
121};
122
135{
136 public:
146 enum Variant : uint8_t
147 {
149 // PROBE_REQUEST_VARIANT,
150 // RECONFIGURATION_VARIANT,
151 // TDLS_VARIANT,
152 // PRIORITY_ACCESS_VARIANT,
153 UNSET
154 };
155
160 enum SubElementId : uint8_t
161 {
163 };
164
170 MultiLinkElement(WifiMacType frameType);
177 MultiLinkElement(Variant variant, WifiMacType frameType);
178
179 WifiInformationElementId ElementId() const override;
180 WifiInformationElementId ElementIdExt() const override;
181 uint16_t GetInformationFieldSize() const override;
183 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
184
190 Variant GetVariant() const;
191
199
207
214 void SetLinkIdInfo(uint8_t linkIdInfo);
222 bool HasLinkIdInfo() const;
229 uint8_t GetLinkIdInfo() const;
230
237 void SetBssParamsChangeCount(uint8_t count);
245 bool HasBssParamsChangeCount() const;
252 uint8_t GetBssParamsChangeCount() const;
253
261 void SetMediumSyncDelayTimer(Time delay);
269 void SetMediumSyncOfdmEdThreshold(int8_t threshold);
278 void SetMediumSyncMaxNTxops(uint8_t nTxops);
287 bool HasMediumSyncDelayInfo() const;
310 uint8_t GetMediumSyncMaxNTxops() const;
311
325 {
326 public:
333 PerStaProfileSubelement(Variant variant, WifiMacType frameType);
334
355
356 WifiInformationElementId ElementId() const override;
357
363 void SetLinkId(uint8_t linkId);
369 uint8_t GetLinkId() const;
370
374 void SetCompleteProfile();
378 bool IsCompleteProfileSet() const;
379
391 bool HasStaMacAddress() const;
398
405 void SetAssocRequest(
406 const std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>& assoc);
408 void SetAssocRequest(std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>&& assoc);
415 bool HasAssocRequest() const;
422 bool HasReassocRequest() const;
430
437 void SetAssocResponse(const MgtAssocResponseHeader& assoc);
446 bool HasAssocResponse() const;
454
461 uint8_t GetStaInfoLength() const;
462
463 private:
464 uint16_t GetInformationFieldSize() const override;
466 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
467
470 uint16_t m_staControl;
472 std::unique_ptr<Header> m_staProfile;
475 };
476
486 std::size_t GetNPerStaProfileSubelements() const;
500 const PerStaProfileSubelement& GetPerStaProfile(std::size_t i) const;
501
502 private:
508 void SetVariant(Variant variant);
509
511
513 using CommonInfo = std::variant<CommonInfoBasicMle,
514 // TODO Add other variants
515 std::monostate /* UNSET variant*/>;
516
518
519 /*
520 * Link Info field
521 */
522 std::vector<PerStaProfileSubelement>
524};
525
526} // namespace ns3
527
528#endif /* MULTI_LINK_ELEMENT_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 and reassociation response.
Definition: mgt-headers.h:446
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Information element, as defined in 802.11-2007 standard.
Variant
Multi-Link element variants.
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::variant< std::reference_wrapper< MgtAssocRequestHeader >, std::reference_wrapper< MgtReassocRequestHeader > > AssocReqRefVariant
variant holding a reference to a (Re)Association Request
Definition: ap-wifi-mac.h:53
WifiMacType
Combination of valid MAC header type/subtype.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
def start()
Definition: core.py:1861
uint8_t emlsrPaddingDelay
EMLSR Padding Delay.
uint8_t emlsrTransitionDelay
EMLSR Transition Delay.
uint8_t transitionTimeout
Transition Timeout.
Medium Synchronization Delay Information subfield.
uint8_t mediumSyncOfdmEdThreshold
Medium Synchronization OFDM ED Threshold.
uint8_t mediumSyncDuration
Medium Synchronization Duration.
uint8_t mediumSyncMaxNTxops
Medium Synchronization MAximum Number of TXOPs.
uint8_t freqSepForStrApMld
Frequency Separation For STR/AP MLD Type Indication.
uint8_t maxNSimultaneousLinks
Max number of simultaneous links.
uint8_t tidToLinkMappingSupport
TID-To-Link Mapping Negotiation Supported.
Common Info field of the Basic Multi-Link element.
uint16_t GetPresenceBitmap() const
Get the Presence Bitmap subfield of the Common Info field.
uint8_t GetSize() const
Get the size of the serialized Common Info field.
std::optional< EmlCapabilities > m_emlCapabilities
EML Capabilities.
uint8_t Deserialize(Buffer::Iterator start, uint16_t presence)
Deserialize the Common Info field.
std::optional< MldCapabilities > m_mldCapabilities
MLD Capabilities.
void Serialize(Buffer::Iterator &start) const
Serialize the Common Info field.
std::optional< MediumSyncDelayInfo > m_mediumSyncDelayInfo
Medium Synchronization Delay Information.
Mac48Address m_mldMacAddress
Subfields.
std::optional< uint8_t > m_bssParamsChangeCount
BSS Parameters Change Count.
std::optional< uint8_t > m_linkIdInfo
Link ID Info.