A Discrete-Event Network Simulator
API
supported-rates.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef SUPPORTED_RATES_H
21 #define SUPPORTED_RATES_H
22 
23 #include <stdint.h>
24 #include <ostream>
25 #include "ns3/buffer.h"
26 #include "ns3/wifi-information-element.h"
27 
28 namespace ns3 {
29 
30 class SupportedRates;
31 
45 {
46 public:
55 
56  void SetSupportedRates (SupportedRates *rates);
57 
59  uint8_t GetInformationFieldSize () const;
62  uint8_t length);
63 
81  uint16_t GetSerializedSize () const;
82 private:
89 };
90 
91 
103 {
104 public:
105  SupportedRates ();
106 
107  SupportedRates (const SupportedRates &);
109 
116  static const uint8_t MAX_SUPPORTED_RATES = 32;
117 
123  void AddSupportedRate (uint32_t bs);
129  void SetBasicRate (uint32_t bs);
130 
137  bool IsSupportedRate (uint32_t bs) const;
144  bool IsBasicRate (uint32_t bs) const;
145 
151  uint8_t GetNRates (void) const;
158  uint32_t GetRate (uint8_t i) const;
159 
161  uint8_t GetInformationFieldSize () const;
164  uint8_t length);
165 
166  /*
167  * We support the Extended Supported Rates Information Element
168  * through the ExtendedSupportedRatesIE object which is declared
169  * above. We allow this class to be a friend so that it can access
170  * our private data detailing the rates, and create an instance as
171  * extended.
172  */
175 private:
176  uint8_t m_nRates;
178 };
179 
180 std::ostream &operator << (std::ostream &os, const SupportedRates &rates);
181 
182 } // namespace ns3
183 
184 #endif /* SUPPORTED_RATES_H */
uint32_t GetRate(uint8_t i) const
Return the rate at the given index.
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length)
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
def start()
Definition: core.py:1482
uint16_t GetSerializedSize() const
Return the serialized size of this supported rates information element.
uint8_t GetNRates(void) const
Return the number of supported rates.
void SerializeInformationField(Buffer::Iterator start) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
iterator in a Buffer instance
Definition: buffer.h:98
ExtendedSupportedRatesIE extended
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
Buffer::Iterator Serialize(Buffer::Iterator start) const
This information element is a bit special in that it is only included if there are more than 8 rates...
WifiInformationElementId ElementId() const
Own unique Element ID.
uint8_t GetInformationFieldSize() const
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SetSupportedRates(SupportedRates *rates)
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
bool IsBasicRate(uint32_t bs) const
Check if the given rate is a basic rate.
uint8_t m_nRates
Number of supported rates.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The Extended Supported Rates Information ElementThis class knows how to serialise and deserialise the...
uint8_t m_rates[MAX_SUPPORTED_RATES]
List of supported bitrate (divided by 500000)
uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length)
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
SupportedRates * m_supportedRates
This member points to the SupportedRates object that contains the actual rate details.
WifiInformationElementId ElementId() const
Own unique Element ID.
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t GetInformationFieldSize() const
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
SupportedRates & operator=(const SupportedRates &)
void SerializeInformationField(Buffer::Iterator start) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
static const uint8_t MAX_SUPPORTED_RATES
This defines the maximum number of supported rates that a STA is allowed to have. ...