A Discrete-Event Network Simulator
API
wifi-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #ifndef WIFI_HELPER_H
24 #define WIFI_HELPER_H
25 
26 #include "ns3/trace-helper.h"
27 #include "ns3/wifi-phy.h"
28 #include "ns3/qos-utils.h"
29 #include "ns3/deprecated.h"
30 #include "wifi-mac-helper.h"
31 #include <functional>
32 
33 namespace ns3 {
34 
35 class WifiNetDevice;
36 class Node;
37 class RadiotapHeader;
38 class QueueItem;
39 
48 {
49 public:
50  WifiPhyHelper ();
51  virtual ~WifiPhyHelper ();
52 
66  virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const = 0;
67 
74  void Set (std::string name, const AttributeValue &v);
96  void SetErrorRateModel (std::string name,
97  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
98  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
99  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
100  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
101  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
102  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
103  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
104  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
126  void SetFrameCaptureModel (std::string name,
127  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
128  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
129  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
130  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
131  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
132  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
133  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
134  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
156  void SetPreambleDetectionModel (std::string name,
157  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
158  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
159  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
160  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
161  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
162  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
163  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
164  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
165 
170 
177  {
181  };
182 
193 
202 
203 
204 protected:
216  Ptr<const Packet> packet,
217  uint16_t channelFreqMhz,
218  WifiTxVector txVector,
219  MpduInfo aMpdu,
220  uint16_t staId = SU_STA_ID);
233  Ptr<const Packet> packet,
234  uint16_t channelFreqMhz,
235  WifiTxVector txVector,
236  MpduInfo aMpdu,
237  SignalNoiseDbm signalNoise,
238  uint16_t staId = SU_STA_ID);
239 
244 
245 
246 private:
257  static void GetRadiotapHeader (RadiotapHeader &header,
258  Ptr<Packet> packet,
259  uint16_t channelFreqMhz,
260  WifiTxVector txVector,
261  MpduInfo aMpdu,
262  uint16_t staId);
263 
275  static void GetRadiotapHeader (RadiotapHeader &header,
276  Ptr<Packet> packet,
277  uint16_t channelFreqMhz,
278  WifiTxVector txVector,
279  MpduInfo aMpdu,
280  uint16_t staId,
281  SignalNoiseDbm signalNoise);
282 
294  virtual void EnablePcapInternal (std::string prefix,
295  Ptr<NetDevice> nd,
296  bool promiscuous,
297  bool explicitFilename);
298 
310  virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
311  std::string prefix,
312  Ptr<NetDevice> nd,
313  bool explicitFilename);
314 
316 };
317 
318 
327 {
328 public:
329  virtual ~WifiHelper ();
330 
339  WifiHelper ();
340 
363  void SetRemoteStationManager (std::string type,
364  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
365  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
366  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
367  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
368  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
369  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
370  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
371  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
372 
395  void SetObssPdAlgorithm (std::string type,
396  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
397  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
398  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
399  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
400  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
401  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
402  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
403  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
404 
406  typedef std::function<std::size_t (Ptr<QueueItem>)> SelectQueueCallback;
407 
423  virtual Install (const WifiPhyHelper &phy,
424  const WifiMacHelper &mac,
426  NodeContainer::Iterator last) const;
434  const WifiMacHelper &mac, NodeContainer c) const;
442  const WifiMacHelper &mac, Ptr<Node> node) const;
450  const WifiMacHelper &mac, std::string nodeName) const;
475  virtual void SetStandard (WifiStandard standard);
476 
502  virtual void SetStandard (WifiPhyStandard standard);
503 
507  static void EnableLogComponents (void);
508 
523  int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
524 
525 
526 protected:
532 };
533 
534 } //namespace ns3
535 
536 #endif /* WIFI_HELPER_H */
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:135
MpduInfo structure.
Definition: phy-entity.h:59
Base class providing common user-level ascii trace operations for helpers representing net devices...
Definition: trace-helper.h:642
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:140
void SetPreambleDetectionModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:192
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:810
void SetObssPdAlgorithm(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:744
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:721
Radiotap header implementation.
virtual ~WifiHelper()
Definition: wifi-helper.cc:709
Hold a value for an Attribute.
Definition: attribute.h:68
create PHY objects
Definition: wifi-helper.h:46
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:315
Base class providing common user-level pcap operations for helpers representing net devices...
Definition: trace-helper.h:553
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:241
helps to create WifiNetDevice objects
Definition: wifi-helper.h:326
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:713
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ASCII trace output on the indicated net device.
Definition: wifi-helper.cc:634
phy
Definition: third.py:93
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:243
DataLinkType
This enumeration holds the data link types that will be written to the pcap file. ...
Definition: trace-helper.h:50
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
A class for an empty attribute value.
Definition: attribute.h:232
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId=SU_STA_ID)
Definition: wifi-helper.cc:221
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:99
void SetFrameCaptureModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:169
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:531
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:592
Include Prism monitor mode information.
Definition: wifi-helper.h:179
double f(double x, void *params)
Definition: 80211b.c:70
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
keep track of a set of node pointers.
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs
Definition: wifi-helper.h:528
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:767
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:530
#define NS_DEPRECATED_3_32
Tag for things deprecated in version ns-3.32.
Definition: deprecated.h:80
ObjectFactory m_stationManager
station manager
Definition: wifi-helper.h:527
create MAC layers for a ns3::WifiNetDevice.
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:573
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:146
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:598
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:240
static void GetRadiotapHeader(RadiotapHeader &header, Ptr< Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId)
Get the Radiotap header for a transmitted packet.
Definition: wifi-helper.cc:305
Instantiate subclasses of ns3::Object.
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId=SU_STA_ID)
Definition: wifi-helper.cc:255
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:914
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:804
SignalNoiseDbm structure.
Definition: phy-entity.h:52
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:178
ObjectFactory m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:242
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:406
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:176
void DisablePreambleDetectionModel()
Disable the preamble detection model.
Definition: wifi-helper.cc:215
Definition: first.py:1
WifiStandard m_standard
wifi standard
Definition: wifi-helper.h:529
Include Radiotap link layer information.
Definition: wifi-helper.h:180
#define SU_STA_ID
Definition: wifi-mode.h:32