A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
wifi-mode.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 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 WIFI_MODE_H
21 #define WIFI_MODE_H
22 
23 #include <stdint.h>
24 #include <string>
25 #include <vector>
26 #include <ostream>
27 #include "ns3/attribute-helper.h"
28 #include "ns3/wifi-phy-standard.h"
29 
30 namespace ns3 {
31 
37 {
57 };
58 
59 
68 {
79 
80 };
81 
91 class WifiMode
92 {
93 public:
97  uint32_t GetBandwidth (void) const;
104  uint64_t GetPhyRate (void) const;
108  uint64_t GetDataRate (void) const;
112  enum WifiCodeRate GetCodeRate (void) const;
116  uint8_t GetConstellationSize (void) const;
117 
122  std::string GetUniqueName (void) const;
123 
128  bool IsMandatory (void) const;
129 
137  uint32_t GetUid (void) const;
138 
145 
152  WifiMode ();
159  WifiMode (std::string name);
160 private:
161  friend class WifiModeFactory;
167  WifiMode (uint32_t uid);
168  uint32_t m_uid;
169 };
170 
171 bool operator == (const WifiMode &a, const WifiMode &b);
172 std::ostream & operator << (std::ostream & os, const WifiMode &mode);
173 std::istream & operator >> (std::istream &is, WifiMode &mode);
174 
181 
188 typedef std::vector<WifiMode> WifiModeList;
192 typedef WifiModeList::const_iterator WifiModeListIterator;
193 
197 typedef std::vector<uint8_t> WifiMcsList;
201 typedef WifiMcsList::const_iterator WifiMcsListIterator;
202 
210 {
211 public:
230  static WifiMode CreateWifiMode (std::string uniqueName,
231  enum WifiModulationClass modClass,
232  bool isMandatory,
233  uint32_t bandwidth,
234  uint32_t dataRate,
235  enum WifiCodeRate codingRate,
236  uint8_t constellationSize);
237 
238 private:
239  friend class WifiMode;
240  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
241 
247  static WifiModeFactory* GetFactory ();
248  WifiModeFactory ();
249 
256  {
257  std::string uniqueUid;
258  uint32_t bandwidth;
259  uint32_t dataRate;
260  uint32_t phyRate;
265  };
266 
273  WifiMode Search (std::string name);
280  uint32_t AllocateUid (std::string uniqueUid);
287  WifiModeItem* Get (uint32_t uid);
288 
292  typedef std::vector<struct WifiModeItem> WifiModeItemList;
294 };
295 
296 } // namespace ns3
297 
298 #endif /* WIFI_MODE_H */
ATTRIBUTE_HELPER_HEADER(ObjectFactory)
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:49
WifiMode()
Create an invalid WifiMode.
Definition: wifi-mode.cc:120
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:52
WifiCodeRate
This enumeration defines the various convolutional coding rates used for the OFDM transmission modes ...
Definition: wifi-mode.h:67
DSSS-OFDM PHY (19.7)
Definition: wifi-mode.h:50
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:115
WifiMcsList::const_iterator WifiMcsListIterator
An iterator for WifiMcsList vector.
Definition: wifi-mode.h:201
ERP-PBCC PHY (19.6)
Definition: wifi-mode.h:48
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
bool IsMandatory(void) const
Definition: wifi-mode.cc:104
Modulation class unknown or unspecified.
Definition: wifi-mode.h:40
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given uid index.
Definition: wifi-mode.cc:254
Frequency-hopping spread spectrum (FHSS) PHY (Clause 14)
Definition: wifi-mode.h:44
uint32_t m_uid
Definition: wifi-mode.h:168
enum WifiCodeRate GetCodeRate(void) const
Definition: wifi-mode.cc:85
HT PHY (Clause 20)
Definition: wifi-mode.h:56
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:97
WifiModeItemList m_itemList
Definition: wifi-mode.h:293
std::vector< uint8_t > WifiMcsList
A list of Wi-Fi Modulation and Coding Scheme (MCS).
Definition: wifi-mode.h:197
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, enum WifiCodeRate codingRate, uint8_t constellationSize)
Definition: wifi-mode.cc:141
uint32_t GetBandwidth(void) const
Definition: wifi-mode.cc:67
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:43
Infrared (IR) (Clause 16)
Definition: wifi-mode.h:42
uint8_t GetConstellationSize(void) const
Definition: wifi-mode.cc:91
uint64_t GetPhyRate(void) const
Definition: wifi-mode.cc:73
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:192
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:188
std::vector< struct WifiModeItem > WifiModeItemList
typedef for a vector of WifiModeItem.
Definition: wifi-mode.h:292
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:70
create WifiMode class instances and keep track of them.
Definition: wifi-mode.h:209
WifiModulationClass
This enumeration defines the modulation classes per IEEE 802.11-2007, Section 9.6.1, Table 9-2.
Definition: wifi-mode.h:36
OFDM PHY (Clause 17)
Definition: wifi-mode.h:54
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:89
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:261
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:236
enum WifiModulationClass modClass
Definition: wifi-mode.h:261
uint32_t GetUid(void) const
Definition: wifi-mode.cc:110
friend std::istream & operator>>(std::istream &is, WifiMode &mode)
Serialize WifiMode from istream (human-readable).
Definition: wifi-mode.cc:58
WifiMode Search(std::string name)
Search and return WifiMode from a given name.
Definition: wifi-mode.cc:201
uint64_t GetDataRate(void) const
Definition: wifi-mode.cc:79
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:255
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:46