A Discrete-Event Network Simulator
API
supported-rates.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #ifndef SUPPORTED_RATES_H
21 #define SUPPORTED_RATES_H
22 
24 
25 namespace ns3
26 {
27 
28 class SupportedRates;
29 
43 {
44  public:
53 
54  // Implementations of pure virtual methods of WifiInformationElement
55  WifiInformationElementId ElementId() const override;
56 
62  void SetSupportedRates(SupportedRates* rates);
63 
64  private:
65  uint16_t GetInformationFieldSize() const override;
67  uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
68 
75 };
76 
88 {
89  public:
91 
97  SupportedRates(const SupportedRates& rates);
98 
99  // Implementations of pure virtual methods of WifiInformationElement
100  WifiInformationElementId ElementId() const override;
101 
108  SupportedRates& operator=(const SupportedRates& rates);
109 
116  static const uint8_t MAX_SUPPORTED_RATES = 32;
117 
123  void AddSupportedRate(uint64_t bs);
129  void SetBasicRate(uint64_t bs);
136  void AddBssMembershipSelectorRate(uint64_t bs);
146  bool IsSupportedRate(uint64_t bs) const;
156  bool IsBasicRate(uint64_t bs) const;
166  bool IsBssMembershipSelectorRate(uint64_t bs) const;
172  uint8_t GetNRates() const;
180  uint32_t GetRate(uint8_t i) const;
181 
190  std::optional<ExtendedSupportedRatesIE> extended;
191 
192  private:
193  uint16_t GetInformationFieldSize() const override;
194  void SerializeInformationField(Buffer::Iterator start) const override;
195  uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
196 
197  uint8_t m_nRates;
199 };
200 
209 std::ostream& operator<<(std::ostream& os, const SupportedRates& rates);
210 
211 } // namespace ns3
212 
213 #endif /* SUPPORTED_RATES_H */
iterator in a Buffer instance
Definition: buffer.h:100
The Extended Supported Rates Information Element.
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
SupportedRates * m_supportedRates
This member points to the SupportedRates object that contains the actual rate details.
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
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)
void SetSupportedRates(SupportedRates *rates)
Set supported rates.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
The Supported Rates Information Element.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
void AddBssMembershipSelectorRate(uint64_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t m_nRates
Number of supported rates.
uint8_t m_rates[MAX_SUPPORTED_RATES]
List of supported bit rates (divided by 500000)
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
SupportedRates & operator=(const SupportedRates &rates)
Assignment operator.
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 GetNRates() const
Return the number of supported rates.
std::optional< ExtendedSupportedRatesIE > extended
extended supported rates info element
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
bool IsBssMembershipSelectorRate(uint64_t bs) const
Check if the given rate is a BSS membership selector value.
static const uint8_t MAX_SUPPORTED_RATES
This defines the maximum number of supported rates that a STA is allowed to have.
uint32_t GetRate(uint8_t i) const
Return the rate at the given index.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
Information element, as defined in 802.11-2007 standard.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.