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 "wifi-mac-helper.h"
30 #include <functional>
31 
32 namespace ns3 {
33 
34 class WifiNetDevice;
35 class Node;
36 class RadiotapHeader;
37 class QueueItem;
38 
47 {
48 public:
49  WifiPhyHelper ();
50  virtual ~WifiPhyHelper ();
51 
65  virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const = 0;
66 
73  void Set (std::string name, const AttributeValue &v);
95  void SetErrorRateModel (std::string name,
96  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
97  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
98  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
99  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
100  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
101  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
102  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
103  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
125  void SetFrameCaptureModel (std::string name,
126  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
127  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
128  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
129  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
130  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
131  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
132  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
133  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
155  void SetPreambleDetectionModel (std::string name,
156  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
157  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
158  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
159  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
160  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
161  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
162  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
163  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
164 
169 
176  {
180  };
181 
192 
201 
202 
203 protected:
214  Ptr<const Packet> packet,
215  uint16_t channelFreqMhz,
216  WifiTxVector txVector,
217  MpduInfo aMpdu);
229  Ptr<const Packet> packet,
230  uint16_t channelFreqMhz,
231  WifiTxVector txVector,
232  MpduInfo aMpdu,
233  SignalNoiseDbm signalNoise);
234 
239 
240 
241 private:
253  uint16_t channelFreqMhz,
254  WifiTxVector txVector,
255  MpduInfo aMpdu);
256 
268  virtual void EnablePcapInternal (std::string prefix,
269  Ptr<NetDevice> nd,
270  bool promiscuous,
271  bool explicitFilename);
272 
284  virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
285  std::string prefix,
286  Ptr<NetDevice> nd,
287  bool explicitFilename);
288 
290 };
291 
292 
301 {
302 public:
303  virtual ~WifiHelper ();
304 
313  WifiHelper ();
314 
337  void SetRemoteStationManager (std::string type,
338  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
339  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
340  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
341  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
342  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
343  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
344  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
345  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
346 
369  void SetObssPdAlgorithm (std::string type,
370  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
371  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
372  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
373  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
374  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
375  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
376  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
377  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
378 
402  void SetAckPolicySelectorForAc (AcIndex ac, std::string type,
403  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
404  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
405  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
406  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
407  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
408  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
409  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
410  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
411 
413  typedef std::function<std::size_t (Ptr<QueueItem>)> SelectQueueCallback;
414 
430  virtual Install (const WifiPhyHelper &phy,
431  const WifiMacHelper &mac,
433  NodeContainer::Iterator last) const;
441  const WifiMacHelper &mac, NodeContainer c) const;
449  const WifiMacHelper &mac, Ptr<Node> node) const;
457  const WifiMacHelper &mac, std::string nodeName) const;
482  virtual void SetStandard (WifiPhyStandard standard);
483 
487  static void EnableLogComponents (void);
488 
503  int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
504 
505 
506 protected:
512 };
513 
514 } //namespace ns3
515 
516 #endif /* WIFI_HELPER_H */
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:138
MpduInfo structure.
Definition: wifi-phy.h:76
Base class providing common user-level ascii trace operations for helpers representing net devices...
Definition: trace-helper.h:641
WifiPhyStandard m_standard
wifi standard
Definition: wifi-helper.h:509
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:143
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:195
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:747
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:689
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:666
Radiotap header implementation.
virtual ~WifiHelper()
Definition: wifi-helper.cc:650
Hold a value for an Attribute.
Definition: attribute.h:68
create PHY objects
Definition: wifi-helper.h:45
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:289
Base class providing common user-level pcap operations for helpers representing net devices...
Definition: trace-helper.h:552
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:236
helps to create WifiNetDevice objects
Definition: wifi-helper.h:300
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:654
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:575
phy
Definition: third.py:93
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:238
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu)
Definition: wifi-helper.cc:224
DataLinkType
This enumeration holds the data link types that will be written to the pcap file. ...
Definition: trace-helper.h:50
virtual void SetStandard(WifiPhyStandard standard)
Definition: wifi-helper.cc:735
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
A class for an empty attribute value.
Definition: attribute.h:232
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:99
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise)
Definition: wifi-helper.cc:256
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:172
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 ...
Definition: wifi-helper.cc:934
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:511
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:533
Include Prism monitor mode information.
Definition: wifi-helper.h:178
double f(double x, void *params)
Definition: 80211b.c:70
static RadiotapHeader GetRadiotapHeader(Ptr< Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu)
Get the Radiotap header.
Definition: wifi-helper.cc:291
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs
Definition: wifi-helper.h:508
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:510
ObjectFactory m_stationManager
station manager
Definition: wifi-helper.h:507
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:514
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:149
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:539
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:235
Instantiate subclasses of ns3::Object.
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:872
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:741
SignalNoiseDbm structure.
Definition: wifi-phy.h:69
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:177
ObjectFactory m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:237
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:413
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:175
void DisablePreambleDetectionModel()
Disable the preamble detection model.
Definition: wifi-helper.cc:218
Definition: first.py:1
void SetAckPolicySelectorForAc(AcIndex ac, 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:712
Include Radiotap link layer information.
Definition: wifi-helper.h:179
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38