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
33namespace ns3 {
34
35class WifiNetDevice;
36class Node;
37class RadiotapHeader;
38class QueueItem;
39
48{
49public:
51 virtual ~WifiPhyHelper ();
52
62 virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const = 0;
63
70 void Set (std::string name, const AttributeValue &v);
92 void SetErrorRateModel (std::string name,
93 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
94 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
95 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
96 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
97 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
98 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
99 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
100 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
122 void SetFrameCaptureModel (std::string name,
123 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
124 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
125 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
126 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
127 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
128 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
129 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
130 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
152 void SetPreambleDetectionModel (std::string name,
153 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
154 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
155 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
156 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
157 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
158 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
159 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
160 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
161
166
173 {
177 };
178
189
198
199
200protected:
212 Ptr<const Packet> packet,
213 uint16_t channelFreqMhz,
214 WifiTxVector txVector,
215 MpduInfo aMpdu,
216 uint16_t staId = SU_STA_ID);
229 Ptr<const Packet> packet,
230 uint16_t channelFreqMhz,
231 WifiTxVector txVector,
232 MpduInfo aMpdu,
233 SignalNoiseDbm signalNoise,
234 uint16_t staId = SU_STA_ID);
235
240
241
242private:
253 static void GetRadiotapHeader (RadiotapHeader &header,
254 Ptr<Packet> packet,
255 uint16_t channelFreqMhz,
256 WifiTxVector txVector,
257 MpduInfo aMpdu,
258 uint16_t staId);
259
271 static void GetRadiotapHeader (RadiotapHeader &header,
272 Ptr<Packet> packet,
273 uint16_t channelFreqMhz,
274 WifiTxVector txVector,
275 MpduInfo aMpdu,
276 uint16_t staId,
277 SignalNoiseDbm signalNoise);
278
290 virtual void EnablePcapInternal (std::string prefix,
292 bool promiscuous,
293 bool explicitFilename) override;
294
307 std::string prefix,
309 bool explicitFilename) override;
310
312};
313
314
323{
324public:
325 virtual ~WifiHelper ();
326
335 WifiHelper ();
336
359 void SetRemoteStationManager (std::string type,
360 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
361 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
362 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
363 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
364 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
365 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
366 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
367 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
368
391 void SetObssPdAlgorithm (std::string type,
392 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
393 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
394 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
395 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
396 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
397 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
398 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
399 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
400
402 typedef std::function<std::size_t (Ptr<QueueItem>)> SelectQueueCallback;
403
411
420 void DisableFlowControl (void);
421
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 (WifiStandard standard);
483
487 static void EnableLogComponents (void);
488
503 int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
504
505
506protected:
513};
514
515} //namespace ns3
516
517#endif /* WIFI_HELPER_H */
double f(double x, void *params)
Definition: 80211b.c:70
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition: trace-helper.h:643
Hold a value for an Attribute.
Definition: attribute.h:69
A class for an empty attribute value.
Definition: attribute.h:233
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Instantiate subclasses of ns3::Object.
Base class providing common user-level pcap operations for helpers representing net devices.
Definition: trace-helper.h:554
DataLinkType
This enumeration holds the data link types that will be written to the pcap file.
Definition: trace-helper.h:50
Radiotap header implementation.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:323
virtual ~WifiHelper()
Definition: wifi-helper.cc:710
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:723
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs
Definition: wifi-helper.h:508
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:511
ObjectFactory m_stationManager
station manager
Definition: wifi-helper.h:507
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:781
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:894
WifiStandard m_standard
wifi standard
Definition: wifi-helper.h:509
void DisableFlowControl(void)
Disable flow control only if you know what you are doing.
Definition: wifi-helper.cc:775
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:991
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:746
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:769
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:787
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:510
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:402
bool m_enableFlowControl
whether to enable flow control
Definition: wifi-helper.h:512
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:714
create MAC layers for a ns3::WifiNetDevice.
create PHY objects
Definition: wifi-helper.h:48
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:170
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:574
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ASCII trace output on the indicated net device.
Definition: wifi-helper.cc:635
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:147
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:141
void DisablePreambleDetectionModel()
Disable the preamble detection model.
Definition: wifi-helper.cc:216
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:599
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:311
ObjectFactory m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:238
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:136
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const =0
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:256
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:239
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:237
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:222
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:193
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:173
@ DLT_IEEE802_11
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:174
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
Definition: wifi-helper.h:176
@ DLT_PRISM_HEADER
Include Prism monitor mode information.
Definition: wifi-helper.h:175
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:306
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:236
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:593
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
Definition: first.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mac
Definition: third.py:96
phy
Definition: third.py:93
MpduInfo structure.
Definition: phy-entity.h:60
SignalNoiseDbm structure.
Definition: phy-entity.h:53
#define SU_STA_ID
Definition: wifi-mode.h:32