A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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#include <optional>
26#include <vector>
27
28namespace ns3
29{
30
31/**
32 * \brief The Supported Rates Information Element
33 * \ingroup wifi
34 *
35 * This class knows how to serialise and deserialise the Supported
36 * Rates Element that holds the first 8 (non-HT) supported rates.
37 *
38 * The \c ExtendedSupportedRatesIE class deals with rates beyond the first 8.
39 */
41{
42 friend struct AllSupportedRates;
43
44 public:
46
47 // Implementations of pure virtual methods of WifiInformationElement
48 WifiInformationElementId ElementId() const override;
49 void Print(std::ostream& os) const override;
50
51 /**
52 * Return the rate (converted back to raw value) at the given index.
53 *
54 * \param i the given index
55 * \return the rate in bps
56 */
57 uint32_t GetRate(uint8_t i) const;
58
59 protected:
60 uint16_t GetInformationFieldSize() const override;
61 void SerializeInformationField(Buffer::Iterator start) const override;
62 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
63
64 std::vector<uint8_t> m_rates; //!< List of supported bit rates (divided by 500000)
65};
66
67/**
68 * \brief The Extended Supported Rates Information Element
69 * \ingroup wifi
70 *
71 * This class knows how to serialise and deserialise the Extended
72 * Supported Rates Element that holds (non-HT) rates beyond the 8 that
73 * the original Supported Rates element can carry.
74 */
76{
77 public:
78 // Implementations of pure virtual methods of WifiInformationElement
79 WifiInformationElementId ElementId() const override;
80};
81
82/**
83 * \brief Struct containing all supported rates.
84 * \ingroup wifi
85 *
86 */
88{
89 /**
90 * Add the given rate to the supported rates.
91 *
92 * \param bs the rate to be added in bps
93 */
94 void AddSupportedRate(uint64_t bs);
95 /**
96 * Set the given rate to basic rates.
97 *
98 * \param bs the rate to be set in bps
99 */
100 void SetBasicRate(uint64_t bs);
101 /**
102 * Add a special value to the supported rate set, corresponding to
103 * a BSS membership selector
104 *
105 * \param bs the special membership selector value (not a valid rate)
106 */
107 void AddBssMembershipSelectorRate(uint64_t bs);
108 /**
109 * Check if the given rate is supported. The rate is encoded as it is
110 * serialized to the Supported Rates Information Element (i.e. as a
111 * multiple of 500 Kbits/sec, possibly with MSB set to 1).
112 *
113 * \param bs the rate to be checked in bps
114 *
115 * \return true if the rate is supported, false otherwise
116 */
117 bool IsSupportedRate(uint64_t bs) const;
118 /**
119 * Check if the given rate is a basic rate. The rate is encoded as it is
120 * serialized to the Supported Rates Information Element (i.e. as a
121 * multiple of 500 Kbits/sec, with MSB set to 1).
122 *
123 * \param bs the rate to be checked in bps
124 *
125 * \return true if the rate is a basic rate, false otherwise
126 */
127 bool IsBasicRate(uint64_t bs) const;
128 /**
129 * Check if the given rate is a BSS membership selector value. The rate
130 * is encoded as it is serialized to the Supporting Rates Information
131 * Element (i.e. with the MSB set to 1).
132 *
133 * \param bs the rate to be checked in bps
134 *
135 * \return true if the rate is a BSS membership selector, false otherwise
136 */
137 bool IsBssMembershipSelectorRate(uint64_t bs) const;
138 /**
139 * Return the number of supported rates.
140 *
141 * \return the number of supported rates
142 */
143 uint8_t GetNRates() const;
144
145 SupportedRates rates; //!< supported rates
146 std::optional<ExtendedSupportedRatesIE> extendedRates; //!< supported extended rates
147};
148
149} // namespace ns3
150
151#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.
The Supported Rates Information Element.
void Print(std::ostream &os) const override
Generate human-readable form of IE.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
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)
std::vector< uint8_t > m_rates
List of supported bit rates (divided by 500000)
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
uint32_t GetRate(uint8_t i) const
Return the rate (converted back to raw value) at the given index.
Information element, as defined in 802.11-2007 standard.
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.
Struct containing all supported rates.
SupportedRates rates
supported rates
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
bool IsBssMembershipSelectorRate(uint64_t bs) const
Check if the given rate is a BSS membership selector value.
std::optional< ExtendedSupportedRatesIE > extendedRates
supported extended rates
void AddBssMembershipSelectorRate(uint64_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
uint8_t GetNRates() const
Return the number of supported rates.
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
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.