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 #define SU_STA_ID 65535
31 
32 class WifiTxVector;
33 
39 {
65 };
66 
75 {
86 };
87 
99 class WifiMode
100 {
101 public:
108  bool IsAllowed (uint16_t channelWidth, uint8_t nss) const;
120  uint64_t GetPhyRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const;
129  uint64_t GetPhyRate (WifiTxVector txVector) const;
138  uint64_t GetDataRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const;
145  uint64_t GetDataRate (WifiTxVector txVector, uint16_t staId = SU_STA_ID) const;
151  uint64_t GetDataRate (uint16_t channelWidth) const;
152 
156  WifiCodeRate GetCodeRate (void) const;
160  uint16_t GetConstellationSize (void) const;
164  uint8_t GetMcsValue (void) const;
169  std::string GetUniqueName (void) const;
174  bool IsMandatory (void) const;
182  uint32_t GetUid (void) const;
197  uint64_t GetNonHtReferenceRate (void) const;
203  bool IsHigherCodeRate (WifiMode mode) const;
209  bool IsHigherDataRate (WifiMode mode) const;
210 
217  WifiMode ();
224  WifiMode (std::string name);
225 
226 
227 private:
229  friend class WifiModeFactory;
235  WifiMode (uint32_t uid);
236  uint32_t m_uid;
237 };
238 
248 bool operator == (const WifiMode &a, const WifiMode &b);
258 bool operator < (const WifiMode &a, const WifiMode &b);
267 std::ostream & operator << (std::ostream & os, const WifiMode &mode);
276 std::istream & operator >> (std::istream &is, WifiMode &mode);
277 
279 
286 typedef std::vector<WifiMode> WifiModeList;
290 typedef WifiModeList::const_iterator WifiModeListIterator;
291 
299 {
300 public:
317  static WifiMode CreateWifiMode (std::string uniqueName,
318  WifiModulationClass modClass,
319  bool isMandatory,
320  WifiCodeRate codingRate,
321  uint16_t constellationSize);
322 
333  static WifiMode CreateWifiMcs (std::string uniqueName,
334  uint8_t mcsValue,
335  WifiModulationClass modClass);
336 
337 
338 private:
340  friend class WifiMode;
341  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
342 
348  static WifiModeFactory* GetFactory ();
349  WifiModeFactory ();
350 
357  {
358  std::string uniqueUid;
360  uint16_t constellationSize;
362  bool isMandatory;
363  uint8_t mcsValue;
364  };
365 
373  WifiMode Search (std::string name) const;
381  uint32_t AllocateUid (std::string uniqueUid);
389  WifiModeItem* Get (uint32_t uid);
390 
394  typedef std::vector<WifiModeItem> WifiModeItemList;
396 };
397 
398 } //namespace ns3
399 
400 #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:652
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:56
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:54
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:55
WifiCodeRate codingRate
coding rate
Definition: wifi-mode.h:361
VHT PHY (Clause 22)
Definition: wifi-mode.h:62
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:50
ERP-PBCC PHY (19.6)
Definition: wifi-mode.h:52
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
uint32_t GetUid(void) const
Definition: wifi-mode.cc:474
Modulation class unknown or unspecified.
Definition: wifi-mode.h:42
bool IsMandatory(void) const
Definition: wifi-mode.cc:451
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:734
Frequency-hopping spread spectrum (FHSS) PHY (Clause 14)
Definition: wifi-mode.h:46
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, WifiCodeRate codingRate, uint16_t constellationSize)
Definition: wifi-mode.cc:674
uint32_t m_uid
UID.
Definition: wifi-mode.h:236
HT PHY (Clause 20)
Definition: wifi-mode.h:60
WifiModeItemList m_itemList
item list
Definition: wifi-mode.h:395
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:480
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:443
WifiModulationClass modClass
modulation class
Definition: wifi-mode.h:359
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:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsHigherCodeRate(WifiMode mode) const
Definition: wifi-mode.cc:575
WifiModeList::const_iterator WifiModeListIterator
An iterator for WifiModeList vector.
Definition: wifi-mode.h:290
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
Definition: wifi-mode.h:286
uint16_t constellationSize
constellation size
Definition: wifi-mode.h:360
uint16_t GetConstellationSize(void) const
Definition: wifi-mode.cc:386
uint64_t GetNonHtReferenceRate(void) const
Definition: wifi-mode.cc:487
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:298
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:38
OFDM PHY (Clause 17)
Definition: wifi-mode.h:58
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:73
static WifiModeFactory * GetFactory()
Return a WifiModeFactory.
Definition: wifi-mode.cc:794
uint32_t AllocateUid(std::string uniqueUid)
Allocate a WifiModeItem from a given uniqueUid.
Definition: wifi-mode.cc:769
WifiCodeRate GetCodeRate(void) const
Definition: wifi-mode.cc:310
std::vector< WifiModeItem > WifiModeItemList
typedef for a vector of WifiModeItem.
Definition: wifi-mode.h:394
WifiModeItem * Get(uint32_t uid)
Return a WifiModeItem at the given UID index.
Definition: wifi-mode.cc:787
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:458
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass)
Definition: wifi-mode.cc:712
bool isMandatory
flag to indicate whether this mode is mandatory
Definition: wifi-mode.h:362
friend std::istream & operator>>(std::istream &is, WifiMode &mode)
Serialize WifiMode from istream (human-readable).
Definition: wifi-mode.cc:46
bool IsHigherDataRate(WifiMode mode) const
Definition: wifi-mode.cc:595
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
#define SU_STA_ID
Definition: wifi-mode.h:30
HE PHY (Clause 26)
Definition: wifi-mode.h:64
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:127
This is the data associated to a unique WifiMode.
Definition: wifi-mode.h:356
DSSS PHY (Clause 15)
Definition: wifi-mode.h:48
std::string uniqueUid
unique UID
Definition: wifi-mode.h:358