A Discrete-Event Network Simulator
API
reduced-neighbor-report.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 REDUCED_NEIGHBOR_REPORT_H
21 #define REDUCED_NEIGHBOR_REPORT_H
22 
24 
25 #include "ns3/mac48-address.h"
26 
27 #include <vector>
28 
29 namespace ns3
30 {
31 
32 class WifiPhyOperatingChannel;
33 
41 {
42  public:
47  {
48  uint8_t mldId;
49  uint8_t linkId;
51  };
52 
57  {
58  uint8_t neighborApTbttOffset{0};
60  uint32_t shortSsid{0};
61  uint8_t bssParameters{0};
62  uint8_t psd20MHz{0};
64  };
65 
70  {
71  uint8_t type : 2;
72  uint8_t filtered : 1;
73  uint8_t reserved : 1;
74  uint8_t tbttInfoCount : 4;
75  uint8_t tbttInfoLength;
76  };
77 
82  {
83  mutable TbttInformationHeader tbttInfoHdr{0, 0, 0, 0, 0};
84  uint8_t operatingClass{0};
85  uint8_t channelNumber{0};
86  std::vector<TbttInformation> tbttInformationSet;
87 
88  bool hasBssid{false};
89  bool hasShortSsid{false};
91  false};
92  bool has20MHzPsd{false};
94  false};
95  };
96 
98 
99  // Implementations of pure virtual methods of WifiInformationElement
100  WifiInformationElementId ElementId() const override;
101  uint16_t GetInformationFieldSize() const override;
102  void SerializeInformationField(Buffer::Iterator start) const override;
103  uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
104 
110  std::size_t GetNNbrApInfoFields() const;
114  void AddNbrApInfoField();
115 
123  void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel& channel);
131  WifiPhyOperatingChannel GetOperatingChannel(std::size_t nbrApInfoId) const;
132 
140  std::size_t GetNTbttInformationFields(std::size_t nbrApInfoId) const;
147  void AddTbttInformationField(std::size_t nbrApInfoId);
148 
157  void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid);
165  bool HasBssid(std::size_t nbrApInfoId) const;
174  Mac48Address GetBssid(std::size_t nbrApInfoId, std::size_t index) const;
175 
184  void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid);
192  bool HasShortSsid(std::size_t nbrApInfoId) const;
201  uint32_t GetShortSsid(std::size_t nbrApInfoId, std::size_t index) const;
202 
211  void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters);
219  bool HasBssParameters(std::size_t nbrApInfoId) const;
228  uint8_t GetBssParameters(std::size_t nbrApInfoId, std::size_t index) const;
229 
238  void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz);
246  bool HasPsd20MHz(std::size_t nbrApInfoId) const;
255  uint8_t GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) const;
256 
267  void SetMldParameters(std::size_t nbrApInfoId,
268  std::size_t index,
269  uint8_t mldId,
270  uint8_t linkId,
271  uint8_t changeSequence);
279  bool HasMldParameters(std::size_t nbrApInfoId) const;
288  uint8_t GetMldId(std::size_t nbrApInfoId, std::size_t index) const;
297  uint8_t GetLinkId(std::size_t nbrApInfoId, std::size_t index) const;
298 
299  private:
311  void WriteTbttInformationCount(std::size_t nbrApInfoId) const;
318  uint8_t ReadTbttInformationCount(std::size_t nbrApInfoId) const;
319 
331  void WriteTbttInformationLength(std::size_t nbrApInfoId) const;
338  void ReadTbttInformationLength(std::size_t nbrApInfoId);
339 
340  std::vector<NeighborApInformation>
342 };
343 
344 } // namespace ns3
345 
346 #endif /* REDUCED_NEIGHBOR_REPORT_H */
iterator in a Buffer instance
Definition: buffer.h:100
an EUI-48 address
Definition: mac48-address.h:46
The Reduced Neighbor Report element.
void WriteTbttInformationLength(std::size_t nbrApInfoId) const
Set the TBTT Information Length field of the given Neighbor AP Information field based on the xxxPres...
Mac48Address GetBssid(std::size_t nbrApInfoId, std::size_t index) const
Get the BSSID field (must be present) in the i-th TBTT Information field of the given Neighbor AP Inf...
std::vector< NeighborApInformation > m_nbrApInfoFields
one or more Neighbor AP Information fields
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
bool HasShortSsid(std::size_t nbrApInfoId) const
Return true if the Short SSID field is present in all the TBTT Information fields of the given Neighb...
std::size_t GetNNbrApInfoFields() const
Get the number of Neighbor AP Information fields.
void WriteTbttInformationCount(std::size_t nbrApInfoId) const
Set the TBTT Information Count field of the given Neighbor AP Information field based on the size of ...
bool HasBssid(std::size_t nbrApInfoId) const
Return true if the BSSID field is present in all the TBTT Information fields of the given Neighbor AP...
uint8_t ReadTbttInformationCount(std::size_t nbrApInfoId) const
Get the TBTT Information Count field of the given Neighbor AP Information field.
void SetMldParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t mldId, uint8_t linkId, uint8_t changeSequence)
Set the MLD Parameters subfield of the i-th TBTT Information field of the given Neighbor AP Informati...
void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid)
Set the Short SSID field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
uint32_t GetShortSsid(std::size_t nbrApInfoId, std::size_t index) const
Get the Short SSID field (must be present) in the i-th TBTT Information field of the given Neighbor A...
void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid)
Set the BSSID field of the i-th TBTT Information field of the given Neighbor AP Information field.
std::size_t GetNTbttInformationFields(std::size_t nbrApInfoId) const
Get the number of TBTT Information fields included in the TBTT Information Set field of the given Nei...
uint8_t GetLinkId(std::size_t nbrApInfoId, std::size_t index) const
Get the Link ID value in the MLD Parameters subfield (must be present) in the i-th TBTT Information f...
uint8_t GetMldId(std::size_t nbrApInfoId, std::size_t index) const
Get the MLD ID value in the MLD Parameters subfield (must be present) in the i-th TBTT Information fi...
void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz)
Set the 20 MHz PSD field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
void AddNbrApInfoField()
Add a Neighbor AP Information field.
WifiPhyOperatingChannel GetOperatingChannel(std::size_t nbrApInfoId) const
Get the operating channel coded into the Operating Class and the Channel Number fields of the given N...
void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters)
Set the BSS Parameters field of the i-th TBTT Information field of the given Neighbor AP Information ...
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) const
Get the 20 MHz PSD field (must be present) in the i-th TBTT Information field of the given Neighbor A...
bool HasMldParameters(std::size_t nbrApInfoId) const
Return true if the MLD Parameters subfield is present in all the TBTT Information fields of the given...
void AddTbttInformationField(std::size_t nbrApInfoId)
Add a TBTT Information fields to the TBTT Information Set field of the given Neighbor AP Information ...
void ReadTbttInformationLength(std::size_t nbrApInfoId)
Use the TBTT Information Length field of the given Neighbor AP Information field to set the xxxPresen...
bool HasBssParameters(std::size_t nbrApInfoId) const
Return true if the BSS Parameters field is present in all the TBTT Information fields of the given Ne...
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel &channel)
Set the Operating Class and the Channel Number fields of the given Neighbor AP Information field base...
bool HasPsd20MHz(std::size_t nbrApInfoId) const
Return true if the 20 MHz PSD field is present in all the TBTT Information fields of the given Neighb...
uint8_t GetBssParameters(std::size_t nbrApInfoId, std::size_t index) const
Get the BSS Parameters field (must be present) in the i-th TBTT Information field of the given Neighb...
Information element, as defined in 802.11-2007 standard.
Class that keeps track of all information about the current PHY operating channel.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
channel
Definition: third.py:88
uint8_t bssParamsChangeCount
BSS Parameters Change Count.
std::vector< TbttInformation > tbttInformationSet
One or more TBTT Information fields.
bool hasMldParams
whether MLD Parameters is present in all TBTT Information fields
TbttInformationHeader tbttInfoHdr
TBTT Information header.
bool hasShortSsid
whether Short SSID is present in all TBTT Information fields
bool hasBssParams
whether BSS parameters is present in all TBTT Information fields
bool has20MHzPsd
whether 20 MHz PSD is present in all TBTT Information fields
bool hasBssid
whether BSSID is present in all TBTT Information fields
uint8_t tbttInfoLength
TBTT Information Length (8 bits)
uint8_t tbttInfoCount
TBTT Information Count (4 bits)
uint8_t type
TBTT Information Field Type (2 bits)
uint8_t neighborApTbttOffset
Neighbor AP TBTT Offset.
uint8_t bssParameters
BSS parameters (optional)
MldParameters mldParameters
MLD Parameters (optional)