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 <stdint.h>
26 #include <string>
27 #include <vector>
28 #include <ostream>
29 #include "ns3/attribute-helper.h"
30 #include "ns3/wifi-phy-standard.h"
31 
32 namespace ns3 {
33 
34 class WifiTxVector;
35 
41 {
65 };
66 
75 {
86 };
87 
99 class WifiMode
100 {
101 public:
113  uint64_t GetPhyRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
122  uint64_t GetPhyRate (WifiTxVector txVector) const;
131  uint64_t GetDataRate (uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const;
137  uint64_t GetDataRate (WifiTxVector txVector) const;
141  enum WifiCodeRate GetCodeRate (void) const;
145  uint16_t GetConstellationSize (void) const;
149  uint8_t GetMcsValue (void) const;
154  std::string GetUniqueName (void) const;
159  bool IsMandatory (void) const;
167  uint32_t GetUid (void) const;
182  uint64_t GetNonHtReferenceRate (void) const;
187  bool IsHigherCodeRate (WifiMode mode) const;
192  bool IsHigherDataRate (WifiMode mode) const;
193 
200  WifiMode ();
207  WifiMode (std::string name);
208 
209 
210 private:
211  friend class WifiModeFactory;
212  friend class WifiPhyTag; // access the UID-based constructor
218  WifiMode (uint32_t uid);
219  uint32_t m_uid;
220 };
221 
222 bool operator == (const WifiMode &a, const WifiMode &b);
223 std::ostream & operator << (std::ostream & os, const WifiMode &mode);
224 std::istream & operator >> (std::istream &is, WifiMode &mode);
225 
227 
234 typedef std::vector<WifiMode> WifiModeList;
238 typedef WifiModeList::const_iterator WifiModeListIterator;
239 
247 {
248 public:
265  static WifiMode CreateWifiMode (std::string uniqueName,
266  enum WifiModulationClass modClass,
267  bool isMandatory,
268  enum WifiCodeRate codingRate,
269  uint16_t constellationSize);
270 
281  static WifiMode CreateWifiMcs (std::string uniqueName,
282  uint8_t mcsValue,
283  enum WifiModulationClass modClass);
284 
285 
286 private:
287  friend class WifiMode;
288  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
289 
295  static WifiModeFactory* GetFactory ();
296  WifiModeFactory ();
297 
304  {
305  std::string uniqueUid;
310  uint8_t mcsValue;
311  };
312 
320  WifiMode Search (std::string name);
328  uint32_t AllocateUid (std::string uniqueUid);
336  WifiModeItem* Get (uint32_t uid);
337 
341  typedef std::vector<struct WifiModeItem> WifiModeItemList;
342  WifiModeItemList m_itemList;
343 };
344 
345 } //namespace ns3
346 
347 #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:521
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:58
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:74
DSSS-OFDM PHY (19.7)
Definition: wifi-mode.h:56
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:379
VHT PHY (Clause 22)
Definition: wifi-mode.h:64
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:52
ERP-PBCC PHY (19.6)
Definition: wifi-mode.h:54
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
bool IsMandatory(void) const
Definition: wifi-mode.cc:350
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, enum WifiModulationClass modClass)
Definition: wifi-mode.cc:581
Modulation class unknown or unspecified.
Definition: wifi-mode.h:44
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given uid index.
Definition: wifi-mode.cc:657
uint64_t GetPhyRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:74
Frequency-hopping spread spectrum (FHSS) PHY (Clause 14)
Definition: wifi-mode.h:48
uint16_t GetConstellationSize(void) const
Definition: wifi-mode.cc:289
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:465
uint32_t m_uid
Definition: wifi-mode.h:219
enum WifiCodeRate GetCodeRate(void) const
Definition: wifi-mode.cc:237
HT PHY (Clause 20)
Definition: wifi-mode.h:62
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:357
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:342
WifiModeItemList m_itemList
Definition: wifi-mode.h:342
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:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:238
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:109
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:226
uint64_t GetNonHtReferenceRate(void) const
Definition: wifi-mode.cc:386
std::vector< struct WifiModeItem > WifiModeItemList
typedef for a vector of WifiModeItem.
Definition: wifi-mode.h:341
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, enum WifiCodeRate codingRate, uint16_t constellationSize)
Definition: wifi-mode.cc:543
No explicit coding (e.g., DSSS rates)
Definition: wifi-mode.h:77
create WifiMode class instances and keep track of them.
Definition: wifi-mode.h:246
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:40
bool IsHigherCodeRate(WifiMode mode) const
Definition: wifi-mode.cc:445
OFDM PHY (Clause 17)
Definition: wifi-mode.h:60
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:95
Tag for WifiTxVector and WifiPreamble information to be embedded in outgoing transmissions as a Packe...
Definition: wifi-phy-tag.h:36
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:664
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:639
enum WifiModulationClass modClass
Definition: wifi-mode.h:306
uint32_t GetUid(void) const
Definition: wifi-mode.cc:373
friend std::istream & operator>>(std::istream &is, WifiMode &mode)
Serialize WifiMode from istream (human-readable).
Definition: wifi-mode.cc:65
WifiMode Search(std::string name)
Search and return WifiMode from a given name.
Definition: wifi-mode.cc:604
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type.
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:303
DSSS PHY (Clause 15)
Definition: wifi-mode.h:50