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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef SUPPORTED_RATES_H
10#define SUPPORTED_RATES_H
11
13
14#include <optional>
15#include <vector>
16
17namespace ns3
18{
19
20/**
21 * @brief The Supported Rates Information Element
22 * @ingroup wifi
23 *
24 * This class knows how to serialise and deserialise the Supported
25 * Rates Element that holds the first 8 (non-HT) supported rates.
26 *
27 * The \c ExtendedSupportedRatesIE class deals with rates beyond the first 8.
28 */
30{
31 friend struct AllSupportedRates;
32
33 public:
35
36 // Implementations of pure virtual methods of WifiInformationElement
37 WifiInformationElementId ElementId() const override;
38 void Print(std::ostream& os) const override;
39
40 /**
41 * Return the rate (converted back to raw value) at the given index.
42 *
43 * @param i the given index
44 * @return the rate in bps
45 */
46 uint32_t GetRate(uint8_t i) const;
47
48 protected:
49 uint16_t GetInformationFieldSize() const override;
50 void SerializeInformationField(Buffer::Iterator start) const override;
51 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
52
53 std::vector<uint8_t> m_rates; //!< List of supported bit rates (divided by 500000)
54};
55
56/**
57 * @brief The Extended Supported Rates Information Element
58 * @ingroup wifi
59 *
60 * This class knows how to serialise and deserialise the Extended
61 * Supported Rates Element that holds (non-HT) rates beyond the 8 that
62 * the original Supported Rates element can carry.
63 */
65{
66 public:
67 // Implementations of pure virtual methods of WifiInformationElement
68 WifiInformationElementId ElementId() const override;
69};
70
71/**
72 * @brief Struct containing all supported rates.
73 * @ingroup wifi
74 *
75 */
77{
78 /**
79 * Add the given rate to the supported rates.
80 *
81 * @param bs the rate to be added in bps
82 */
83 void AddSupportedRate(uint64_t bs);
84 /**
85 * Set the given rate to basic rates.
86 *
87 * @param bs the rate to be set in bps
88 */
89 void SetBasicRate(uint64_t bs);
90 /**
91 * Add a special value to the supported rate set, corresponding to
92 * a BSS membership selector
93 *
94 * @param bs the special membership selector value (not a valid rate)
95 */
96 void AddBssMembershipSelectorRate(uint64_t bs);
97 /**
98 * Check if the given rate is supported. The rate is encoded as it is
99 * serialized to the Supported Rates Information Element (i.e. as a
100 * multiple of 500 Kbits/sec, possibly with MSB set to 1).
101 *
102 * @param bs the rate to be checked in bps
103 *
104 * @return true if the rate is supported, false otherwise
105 */
106 bool IsSupportedRate(uint64_t bs) const;
107 /**
108 * Check if the given rate is a basic rate. The rate is encoded as it is
109 * serialized to the Supported Rates Information Element (i.e. as a
110 * multiple of 500 Kbits/sec, with MSB set to 1).
111 *
112 * @param bs the rate to be checked in bps
113 *
114 * @return true if the rate is a basic rate, false otherwise
115 */
116 bool IsBasicRate(uint64_t bs) const;
117 /**
118 * Check if the given rate is a BSS membership selector value. The rate
119 * is encoded as it is serialized to the Supporting Rates Information
120 * Element (i.e. with the MSB set to 1).
121 *
122 * @param bs the rate to be checked in bps
123 *
124 * @return true if the rate is a BSS membership selector, false otherwise
125 */
126 bool IsBssMembershipSelectorRate(uint64_t bs) const;
127 /**
128 * Return the number of supported rates.
129 *
130 * @return the number of supported rates
131 */
132 uint8_t GetNRates() const;
133
134 SupportedRates rates; //!< supported rates
135 std::optional<ExtendedSupportedRatesIE> extendedRates; //!< supported extended rates
136};
137
138} // namespace ns3
139
140#endif /* SUPPORTED_RATES_H */
iterator in a Buffer instance
Definition buffer.h:89
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.