A Discrete-Event Network Simulator
API
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Sébastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #ifndef WIFI_MODE_H
23 #define WIFI_MODE_H
24 
25 #include <vector>
26 #include "ns3/attribute-helper.h"
27 
28 namespace ns3 {
29 
30 class WifiTxVector;
31 
37 {
63 };
64 
73 {
84 };
85 
97 class WifiMode
98 {
99 public:
106  bool IsAllowed (uint16_t channelWidth, uint8_t nss) const;
118  uint64_t GetPhyRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const;
127  uint64_t GetPhyRate (WifiTxVector txVector) const;
136  uint64_t GetDataRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const;
142  uint64_t GetDataRate (WifiTxVector txVector) const;
148  uint64_t GetDataRate (uint16_t channelWidth) const;
149 
153  WifiCodeRate GetCodeRate (void) const;
157  uint16_t GetConstellationSize (void) const;
161  uint8_t GetMcsValue (void) const;
166  std::string GetUniqueName (void) const;
171  bool IsMandatory (void) const;
179  uint32_t GetUid (void) const;
194  uint64_t GetNonHtReferenceRate (void) const;
200  bool IsHigherCodeRate (WifiMode mode) const;
206  bool IsHigherDataRate (WifiMode mode) const;
207 
214  WifiMode ();
221  WifiMode (std::string name);
222 
223 
224 private:
226  friend class WifiModeFactory;
232  WifiMode (uint32_t uid);
233  uint32_t m_uid;
234 };
235 
245 bool operator == (const WifiMode &a, const WifiMode &b);
255 bool operator < (const WifiMode &a, const WifiMode &b);
264 std::ostream & operator << (std::ostream & os, const WifiMode &mode);
273 std::istream & operator >> (std::istream &is, WifiMode &mode);
274 
276 
283 typedef std::vector<WifiMode> WifiModeList;
287 typedef WifiModeList::const_iterator WifiModeListIterator;
288 
296 {
297 public:
314  static WifiMode CreateWifiMode (std::string uniqueName,
315  WifiModulationClass modClass,
316  bool isMandatory,
317  WifiCodeRate codingRate,
318  uint16_t constellationSize);
319 
330  static WifiMode CreateWifiMcs (std::string uniqueName,
331  uint8_t mcsValue,
332  WifiModulationClass modClass);
333 
334 
335 private:
337  friend class WifiMode;
338  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
339 
345  static WifiModeFactory* GetFactory ();
346  WifiModeFactory ();
347 
354  {
355  std::string uniqueUid;
357  uint16_t constellationSize;
359  bool isMandatory;
360  uint8_t mcsValue;
361  };
362 
370  WifiMode Search (std::string name) const;
378  uint32_t AllocateUid (std::string uniqueUid);
386  WifiModeItem* Get (uint32_t uid);
387 
391  typedef std::vector<WifiModeItem> WifiModeItemList;
393 };
394 
395 } //namespace ns3
396 
397 #endif /* WIFI_MODE_H */
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:48
WifiMode()
Create an invalid WifiMode.
Definition: wifi-mode.cc:635
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:54
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiCodeRate
This enumeration defines the various convolutional coding rates used for the OFDM transmission modes ...
Definition: wifi-mode.h:72
DSSS-OFDM PHY (19.7)
Definition: wifi-mode.h:52
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:54
WifiCodeRate codingRate
coding rate
Definition: wifi-mode.h:358
VHT PHY (Clause 22)
Definition: wifi-mode.h:60
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:48
ERP-PBCC PHY (19.6)
Definition: wifi-mode.h:50
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
uint32_t GetUid(void) const
Definition: wifi-mode.cc:457
Modulation class unknown or unspecified.
Definition: wifi-mode.h:40
bool IsMandatory(void) const
Definition: wifi-mode.cc:434
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:160
WifiMode Search(std::string name) const
Search and return WifiMode from a given name.
Definition: wifi-mode.cc:717
Frequency-hopping spread spectrum (FHSS) PHY (Clause 14)
Definition: wifi-mode.h:44
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
Definition: wifi-mode.cc:657
uint32_t m_uid
UID.
Definition: wifi-mode.h:233
HT PHY (Clause 20)
Definition: wifi-mode.h:58
WifiModeItemList m_itemList
item list
Definition: wifi-mode.h:392
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:463
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:426
WifiModulationClass modClass
modulation class
Definition: wifi-mode.h:356
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Infrared (IR) (Clause 16)
Definition: wifi-mode.h:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsHigherCodeRate(WifiMode mode) const
Definition: wifi-mode.cc:558
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:287
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:283
uint16_t constellationSize
constellation size
Definition: wifi-mode.h:357
uint16_t GetConstellationSize(void) const
Definition: wifi-mode.cc:369
uint64_t GetNonHtReferenceRate(void) const
Definition: wifi-mode.cc:470
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:75
create WifiMode class instances and keep track of them.
Definition: wifi-mode.h:295
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:36
OFDM PHY (Clause 17)
Definition: wifi-mode.h:56
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:142
uint64_t GetPhyRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:72
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:777
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:752
WifiCodeRate GetCodeRate(void) const
Definition: wifi-mode.cc:293
std::vector< WifiModeItem > WifiModeItemList
typedef for a vector of WifiModeItem.
Definition: wifi-mode.h:391
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given UID index.
Definition: wifi-mode.cc:770
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:441
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass)
Definition: wifi-mode.cc:695
bool isMandatory
flag to indicate whether this mode is mandatory
Definition: wifi-mode.h:359
friend std::istream & operator>>(std::istream &is, WifiMode &mode)
Serialize WifiMode from istream (human-readable).
Definition: wifi-mode.cc:45
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:578
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
HE PHY (Clause 26)
Definition: wifi-mode.h:62
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:119
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:353
DSSS PHY (Clause 15)
Definition: wifi-mode.h:46
std::string uniqueUid
unique UID
Definition: wifi-mode.h:355