A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
supported-rates.h
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 
36 #define MAX_SUPPORTED_RATES (12)
37 
38 class SupportedRates;
39 
53 {
54 public:
57 
59  uint8_t GetInformationFieldSize () const;
62  uint8_t length);
63 
64  /*
65  * This information element is a bit special in that it is only
66  * included if there are more than 8 rates. To support this we
67  * override the Serialize and GetSerializedSize methods of
68  * WifiInformationElement.
69  */
70  Buffer::Iterator Serialize (Buffer::Iterator start) const;
71  uint16_t GetSerializedSize () const;
72 private:
79 };
80 
81 
93 {
94 public:
95  SupportedRates ();
96 
97  void AddSupportedRate (uint32_t bs);
98  void SetBasicRate (uint32_t bs);
99 
100  bool IsSupportedRate (uint32_t bs) const;
101  bool IsBasicRate (uint32_t bs) const;
102 
103  uint8_t GetNRates (void) const;
104  uint32_t GetRate (uint8_t i) const;
105 
107  uint8_t GetInformationFieldSize () const;
108  void SerializeInformationField (Buffer::Iterator start) const;
110  uint8_t length);
111 
112  /*
113  * We support the Extended Supported Rates Information Element
114  * through the ExtendedSupportedRatesIE object which is declared
115  * above. We allow this class to be a friend so that it can access
116  * our private data detailing the rates, and create an instance as
117  * extended.
118  */
119  friend class ExtendedSupportedRatesIE;
120  ExtendedSupportedRatesIE extended;
121 private:
122  uint8_t m_nRates;
123  uint8_t m_rates[MAX_SUPPORTED_RATES];
124 };
125 
126 std::ostream &operator << (std::ostream &os, const SupportedRates &rates);
127 
128 } // namespace ns3
129 
130 #endif /* SUPPORTED_RATES_H */
uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length)
void SerializeInformationField(Buffer::Iterator start) const
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
iterator in a Buffer instance
Definition: buffer.h:98
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
WifiInformationElementId ElementId() const
Own unique Element ID.
uint8_t GetInformationFieldSize() const
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:43
The Extended Supported Rates Information ElementThis class knows how to serialise and deserialise the...
uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length)
SupportedRates * m_supportedRates
WifiInformationElementId ElementId() const
Own unique Element ID.
uint8_t WifiInformationElementId
uint8_t GetInformationFieldSize() const
void SerializeInformationField(Buffer::Iterator start) const