A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
126 static uint8_t EncodeEmlsrPaddingDelay(Time delay);
131 static Time DecodeEmlsrPaddingDelay(uint8_t value);
132
137 static uint8_t EncodeEmlsrTransitionDelay(Time delay);
142 static Time DecodeEmlsrTransitionDelay(uint8_t value);
143};
144
157{
158 public:
168 enum Variant : uint8_t
169 {
171 // PROBE_REQUEST_VARIANT,
172 // RECONFIGURATION_VARIANT,
173 // TDLS_VARIANT,
174 // PRIORITY_ACCESS_VARIANT,
175 UNSET
176 };
177
182 enum SubElementId : uint8_t
183 {
185 };
186
188 using ContainingFrame = std::variant<std::monostate,
189 std::reference_wrapper<const MgtAssocRequestHeader>,
190 std::reference_wrapper<const MgtReassocRequestHeader>,
191 std::reference_wrapper<const MgtAssocResponseHeader>>;
192
205 MultiLinkElement(Variant variant, ContainingFrame frame = {});
206
207 WifiInformationElementId ElementId() const override;
208 WifiInformationElementId ElementIdExt() const override;
209 uint16_t GetInformationFieldSize() const override;
210 void SerializeInformationField(Buffer::Iterator start) const override;
211 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
212
218 Variant GetVariant() const;
219
226 void SetMldMacAddress(Mac48Address address);
227
234 Mac48Address GetMldMacAddress() const;
235
242 void SetLinkIdInfo(uint8_t linkIdInfo);
250 bool HasLinkIdInfo() const;
257 uint8_t GetLinkIdInfo() const;
258
265 void SetBssParamsChangeCount(uint8_t count);
273 bool HasBssParamsChangeCount() const;
280 uint8_t GetBssParamsChangeCount() const;
281
289 void SetMediumSyncDelayTimer(Time delay);
297 void SetMediumSyncOfdmEdThreshold(int8_t threshold);
306 void SetMediumSyncMaxNTxops(uint8_t nTxops);
315 bool HasMediumSyncDelayInfo() const;
323 Time GetMediumSyncDelayTimer() const;
338 uint8_t GetMediumSyncMaxNTxops() const;
339
347 void SetEmlsrSupported(bool supported);
354 void SetEmlsrPaddingDelay(Time delay);
361 void SetEmlsrTransitionDelay(Time delay);
368 void SetTransitionTimeout(Time timeout);
375 bool HasEmlCapabilities() const;
383 bool IsEmlsrSupported() const;
391 Time GetEmlsrPaddingDelay() const;
399 Time GetEmlsrTransitionDelay() const;
407 Time GetTransitionTimeout() const;
408
410
424 {
425 public:
432
453
454 WifiInformationElementId ElementId() const override;
455
461 void SetLinkId(uint8_t linkId);
467 uint8_t GetLinkId() const;
468
472 void SetCompleteProfile();
476 bool IsCompleteProfileSet() const;
477
483 void SetStaMacAddress(Mac48Address address);
489 bool HasStaMacAddress() const;
496
503 void SetAssocRequest(
504 const std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>& assoc);
506 void SetAssocRequest(std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>&& assoc);
513 bool HasAssocRequest() const;
520 bool HasReassocRequest() const;
528
535 void SetAssocResponse(const MgtAssocResponseHeader& assoc);
544 bool HasAssocResponse() const;
552
559 uint8_t GetStaInfoLength() const;
560
561 mutable ContainingFrame
563
564 private:
565 uint16_t GetInformationFieldSize() const override;
566 void SerializeInformationField(Buffer::Iterator start) const override;
567 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
568
570 uint16_t m_staControl;
572 std::variant<std::monostate,
573 std::unique_ptr<MgtAssocRequestHeader>,
574 std::unique_ptr<MgtReassocRequestHeader>,
575 std::unique_ptr<MgtAssocResponseHeader>>
578 };
579
589 std::size_t GetNPerStaProfileSubelements() const;
603 const PerStaProfileSubelement& GetPerStaProfile(std::size_t i) const;
604
605 private:
611 void SetVariant(Variant variant);
612
614 using CommonInfo = std::variant<CommonInfoBasicMle,
615 // TODO Add other variants
616 std::monostate /* UNSET variant*/>;
617
619
620 /*
621 * Link Info field
622 */
623 std::vector<PerStaProfileSubelement>
625};
626
627} // namespace ns3
628
629#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:338
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.
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:55
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
ns3::Time timeout
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.
static uint8_t EncodeEmlsrTransitionDelay(Time delay)
static Time DecodeEmlsrTransitionDelay(uint8_t value)
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.
static Time DecodeEmlsrPaddingDelay(uint8_t value)
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.
static uint8_t EncodeEmlsrPaddingDelay(Time delay)