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 <string>
27 #include "ns3/attribute.h"
28 #include "ns3/object-factory.h"
29 #include "ns3/node-container.h"
30 #include "ns3/net-device-container.h"
31 #include "ns3/wifi-phy-standard.h"
32 #include "ns3/trace-helper.h"
33 #include "ns3/wifi-mac-helper.h"
34 #include "ns3/wifi-phy.h"
35 
36 namespace ns3 {
37 
38 class WifiPhy;
39 class WifiNetDevice;
40 class Node;
41 
50 {
51 public:
52  WifiPhyHelper ();
53  virtual ~WifiPhyHelper ();
54 
68  virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const = 0;
69 
76  void Set (std::string name, const AttributeValue &v);
98  void SetErrorRateModel (std::string name,
99  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
100  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
101  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
102  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
103  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
104  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
105  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
106  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
107 
114  {
118  };
119 
130 
139 
140 protected:
153  static void PcapSniffTxEvent (Ptr<PcapFileWrapper> file,
154  Ptr<const Packet> packet,
155  uint16_t channelFreqMhz,
156  uint16_t channelNumber,
157  uint32_t rate,
158  WifiPreamble preamble,
159  WifiTxVector txVector,
160  struct mpduInfo aMpdu);
174  static void PcapSniffRxEvent (Ptr<PcapFileWrapper> file,
175  Ptr<const Packet> packet,
176  uint16_t channelFreqMhz,
177  uint16_t channelNumber,
178  uint32_t rate,
179  WifiPreamble preamble,
180  WifiTxVector txVector,
181  struct mpduInfo aMpdu,
182  struct signalNoiseDbm signalNoise);
183 
186 
187 private:
199  virtual void EnablePcapInternal (std::string prefix,
200  Ptr<NetDevice> nd,
201  bool promiscuous,
202  bool explicitFilename);
203 
215  virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
216  std::string prefix,
217  Ptr<NetDevice> nd,
218  bool explicitFilename);
219 
221 };
222 
223 
232 {
233 public:
234  virtual ~WifiHelper ();
235 
244  WifiHelper ();
245 
257  static WifiHelper Default (void);
258 
281  void SetRemoteStationManager (std::string type,
282  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
283  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
284  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
285  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
286  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
287  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
288  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
289  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
297  const WifiMacHelper &mac, NodeContainer c) const;
304  virtual NetDeviceContainer Install (const WifiPhyHelper &phy,
305  const WifiMacHelper &mac, Ptr<Node> node) const;
312  virtual NetDeviceContainer Install (const WifiPhyHelper &phy,
313  const WifiMacHelper &mac, std::string nodeName) const;
338  virtual void SetStandard (enum WifiPhyStandard standard);
339 
343  static void EnableLogComponents (void);
344 
359  int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
360 
361 
362 protected:
365 };
366 
367 } //namespace ns3
368 
369 #endif /* WIFI_HELPER_H */
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:107
Base class providing common user-level ascii trace operations for helpers representing net devices...
Definition: trace-helper.h:641
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:112
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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:683
virtual ~WifiHelper()
Definition: wifi-helper.cc:664
Hold a value for an Attribute.
Definition: attribute.h:68
create PHY objects
Definition: wifi-helper.h:48
PcapHelper::DataLinkType m_pcapDlt
Definition: wifi-helper.h:220
Base class providing common user-level pcap operations for helpers representing net devices...
Definition: trace-helper.h:552
ObjectFactory m_errorRateModel
Definition: wifi-helper.h:185
helps to create WifiNetDevice objects
Definition: wifi-helper.h:231
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:668
void SetPcapDataLinkType(enum SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:530
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wifi-helper.cc:712
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:589
DataLinkType
This enumeration holds the data link types that will be written to the pcap file. ...
Definition: trace-helper.h:50
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu)
Definition: wifi-helper.cc:141
tuple phy
Definition: third.py:86
A class for an empty attribute value.
Definition: attribute.h:232
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Definition: wifi-helper.cc:706
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:787
tuple mac
Definition: third.py:92
Include Prism monitor mode information.
Definition: wifi-helper.h:116
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
ObjectFactory m_stationManager
Definition: wifi-helper.h:363
create MAC layers for a ns3::WifiNetDevice.
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:118
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:555
ObjectFactory m_phy
Definition: wifi-helper.h:184
Instantiate subclasses of ns3::Object.
#define NS_DEPRECATED
Mark a function as deprecated.
Definition: deprecated.h:60
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:752
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:115
enum WifiPhyStandard m_standard
Definition: wifi-helper.h:364
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:113
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
Definition: wifi-helper.cc:333
Include Radiotap link layer information.
Definition: wifi-helper.h:117
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:549
static NS_DEPRECATED WifiHelper Default(void)
Definition: wifi-helper.cc:675