23 #include "ns3/wifi-net-device.h"    24 #include "ns3/minstrel-wifi-manager.h"    25 #include "ns3/minstrel-ht-wifi-manager.h"    26 #include "ns3/ap-wifi-mac.h"    27 #include "ns3/ampdu-subframe-header.h"    28 #include "ns3/mobility-model.h"    30 #include "ns3/pointer.h"    31 #include "ns3/radiotap-header.h"    32 #include "ns3/config.h"    33 #include "ns3/names.h"    34 #include "ns3/net-device-queue-interface.h"    35 #include "ns3/wifi-mac-queue.h"    36 #include "ns3/qos-utils.h"    37 #include "ns3/ht-configuration.h"    38 #include "ns3/vht-configuration.h"    39 #include "ns3/he-configuration.h"    40 #include "ns3/obss-pd-algorithm.h"    41 #include "ns3/wifi-ack-policy-selector.h"    66   NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
   227   uint16_t             channelFreqMhz,
   231   uint32_t dlt = 
file->GetDataLinkType ();
   239         NS_FATAL_ERROR (
"PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
   252       NS_ABORT_MSG (
"PcapSniffTxEvent(): Unexpected data link type " << dlt);
   260   uint16_t              channelFreqMhz,
   265   uint32_t dlt = 
file->GetDataLinkType ();
   273         NS_FATAL_ERROR (
"PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
   286       NS_ABORT_MSG (
"PcapSniffRxEvent(): Unexpected data link type " << dlt);
   294   uint16_t             channelFreqMhz,
   308   uint16_t             channelFreqMhz,
   338       header.
SetRate (static_cast<uint8_t> (rate));
   341   uint16_t channelFlags = 0;
   355   if (channelFreqMhz < 2500)
   392       if (txVector.
GetNess () & 0x01) 
   396       if (txVector.
GetNess () & 0x02) 
   418       uint32_t extractedLength;
   421       packet = packet->
CreateFragment (0, static_cast<uint32_t> (extractedLength));
   433       uint8_t vhtBandwidth = 0;
   434       uint8_t vhtMcsNss[4] = {0,0,0,0};
   435       uint8_t vhtCoding = 0;
   436       uint8_t vhtGroupId = 0;
   437       uint16_t vhtPartialAid = 0;
   469       vhtMcsNss[0] |= (txVector.
GetNss () & 0x0f);
   472       header.
SetVhtFields (vhtKnown, vhtFlags, vhtBandwidth, vhtMcsNss, vhtCoding, vhtGroupId, vhtPartialAid);
   540       NS_ABORT_MSG (
"WifiPhyHelper::SetPcapFormat(): Unexpected format");
   553   NS_LOG_FUNCTION (
this << prefix << nd << promiscuous << explicitFilename);
   561       NS_LOG_INFO (
"WifiHelper::EnablePcapInternal(): Device " << &device << 
" not of type ns3::WifiNetDevice");
   566   NS_ABORT_MSG_IF (
phy == 0, 
"WifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set");
   570   std::string filename;
   571   if (explicitFilename)
   591   bool explicitFilename)
   599       NS_LOG_INFO (
"WifiHelper::EnableAsciiInternal(): Device " << device << 
" not of type ns3::WifiNetDevice");
   607   uint32_t nodeid = nd->GetNode ()->GetId ();
   608   uint32_t deviceid = nd->GetIfIndex ();
   609   std::ostringstream oss;
   622       std::string filename;
   623       if (explicitFilename)
   638       oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/RxOk";
   642       oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/Tx";
   654   oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/RxOk";
   658   oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/Tx";
   829       phy->ConfigureStandardAndBand (it->second.phyStandard, it->second.phyBand);
   838           obssPdAlgorithm->ConnectWifiNetDevice (device);
   852           rmac->GetAttributeFailSafe (
"QosSupported", qosSupported);
   853           if (qosSupported.
Get ())
   855               ndqi = CreateObjectWithAttributes<NetDeviceQueueInterface> (
"NTxQueues",
   858               rmac->GetAttributeFailSafe (
"BE_Txop", ptr);
   860               ackSelector->SetQosTxop (ptr.
Get<
QosTxop> ());
   861               ptr.
Get<
QosTxop> ()->SetAckPolicySelector (ackSelector);
   862               wmq = ptr.
Get<
QosTxop> ()->GetWifiMacQueue ();
   863               ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
   865               rmac->GetAttributeFailSafe (
"BK_Txop", ptr);
   867               ackSelector->SetQosTxop (ptr.
Get<
QosTxop> ());
   868               ptr.
Get<
QosTxop> ()->SetAckPolicySelector (ackSelector);
   869               wmq = ptr.
Get<
QosTxop> ()->GetWifiMacQueue ();
   870               ndqi->GetTxQueue (1)->ConnectQueueTraces (wmq);
   872               rmac->GetAttributeFailSafe (
"VI_Txop", ptr);
   874               ackSelector->SetQosTxop (ptr.
Get<
QosTxop> ());
   875               ptr.
Get<
QosTxop> ()->SetAckPolicySelector (ackSelector);
   876               wmq = ptr.
Get<
QosTxop> ()->GetWifiMacQueue ();
   877               ndqi->GetTxQueue (2)->ConnectQueueTraces (wmq);
   879               rmac->GetAttributeFailSafe (
"VO_Txop", ptr);
   881               ackSelector->SetQosTxop (ptr.
Get<
QosTxop> ());
   882               ptr.
Get<
QosTxop> ()->SetAckPolicySelector (ackSelector);
   883               wmq = ptr.
Get<
QosTxop> ()->GetWifiMacQueue ();
   884               ndqi->GetTxQueue (3)->ConnectQueueTraces (wmq);
   889               ndqi = CreateObject<NetDeviceQueueInterface> ();
   891               rmac->GetAttributeFailSafe (
"Txop", ptr);
   892               wmq = ptr.
Get<
Txop> ()->GetWifiMacQueue ();
   893               ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
   919   Ptr<Node> node = Names::Find<Node> (nodeName);
   988   int64_t currentStream = stream;
   997           currentStream += 
wifi->GetPhy ()->AssignStreams (currentStream);
  1004               currentStream += minstrel->AssignStreams (currentStream);
  1010               currentStream += minstrelHt->AssignStreams (currentStream);
  1019               rmac->GetAttribute (
"Txop", ptr);
  1023               rmac->GetAttribute (
"VO_Txop", ptr);
  1027               rmac->GetAttribute (
"VI_Txop", ptr);
  1031               rmac->GetAttribute (
"BE_Txop", ptr);
  1035               rmac->GetAttribute (
"BK_Txop", ptr);
  1043                   currentStream += apmac->AssignStreams (currentStream);
  1048   return (currentStream - stream);
 
ERP-OFDM PHY (Clause 19, Section 19.5) 
 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
 
void Set(std::string name, const AttributeValue &v)
 
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())
 
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU. 
 
Prefix all trace prints with simulation node. 
 
Manage ASCII trace files for device models. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
  AttributeValue implementation for Boolean. 
 
HT PHY for the 5 GHz band (clause 20) 
 
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message. 
 
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
 
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink without context. 
 
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())
 
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())
 
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container. 
 
Hold a value for an Attribute. 
 
Manage pcap files for device models. 
 
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument. 
 
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type. 
 
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together. 
 
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
 
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit. 
 
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet. 
 
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction. 
 
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
OBSS PD algorithm interfaceThis object provides the interface for all OBSS_PD algorithms and is desig...
 
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory. 
 
bool IsStbc(void) const
Check if STBC is used or not. 
 
static void AsciiPhyReceiveSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink with context. 
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
uint8_t GetNess(void) const
 
uint16_t GetGuardInterval(void) const
 
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
 
HT PHY for the 2.4 GHz band (clause 20) 
 
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container. 
 
ObjectFactory m_errorRateModel
error rate model 
 
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the ascii trace helper figure out a reasonable filename to use for an ascii trace file associated...
 
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file. 
 
static void GetRadiotapHeader(RadiotapHeader &header, Ptr< Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu)
Get the Radiotap header for a transmitted packet. 
 
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
 
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
 
const std::map< WifiStandard, WifiStandardInfo > wifiStandards
map a given standard configured by the user to the corresponding WifiStandardInfo ...
 
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ASCII trace output on the indicated net device. 
 
ObjectFactory m_preambleDetectionModel
preamble detection model 
 
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu)
 
WifiPreamble GetPreambleType(void) const
 
DataLinkType
This enumeration holds the data link types that will be written to the pcap file. ...
 
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
 
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission. 
 
Keep track of the current position and velocity of an object. 
 
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use. 
 
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the pcap helper figure out a reasonable filename to use for a pcap file associated with a device...
 
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component. 
 
static Mac48Address Allocate(void)
Allocate a new Mac48Address. 
 
static void EnablePrinting(void)
Enable printing packets metadata. 
 
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId. 
 
void SetMac(const Ptr< WifiMac > mac)
 
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
 
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container. 
 
Hold an unsigned integer type. 
 
holds a vector of ns3::NetDevice pointers 
 
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise)
 
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())
 
WifiMode GetMode(void) const
 
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 ...
 
Hold together all Wifi-related objects. 
 
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
 
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm. 
 
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used. 
 
hold a list of per-remote-station state. 
 
WifiModulationClass GetModulationClass() const
 
void Connect(std::string path, const CallbackBase &cb)
 
Include Prism monitor mode information. 
 
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
 
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
 
Ptr< WifiPhy > GetPhy(void) const
 
double f(double x, void *params)
 
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components. 
 
Prefix all trace prints with simulation time. 
 
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. 
 
Hold objects of type Ptr<T>. 
 
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet. 
 
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs 
 
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18) 
 
virtual void SetStandard(WifiStandard standard)
 
Ptr< Packet > Copy(void) const
performs a COW copy of the packet. 
 
SelectQueueCallback m_selectQueueCallback
select queue callback 
 
ObjectFactory m_stationManager
station manager 
 
create MAC layers for a ns3::WifiNetDevice. 
 
static Time Now(void)
Return the current simulation virtual time. 
 
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used. 
 
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())
 
bool IsTypeIdSet(void) const
Check if the ObjectFactory has been configured with a TypeId. 
 
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device. 
 
ObjectFactory m_phy
PHY object. 
 
virtual Ptr< WifiMac > Create(Ptr< NetDevice > device) const
 
Instantiate subclasses of ns3::Object. 
 
void SetPhy(const Ptr< WifiPhy > phy)
 
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement. 
 
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
 
void SetSelectQueueCallback(SelectQueueCallback f)
 
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node. 
 
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message. 
 
SignalNoiseDbm structure. 
 
uint32_t mpduRefNumber
MPDU ref number. 
 
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs. 
 
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator. 
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
 
IEEE 802.11 Wireless LAN headers on packets. 
 
ObjectFactory m_frameCaptureModel
frame capture model 
 
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet. 
 
uint16_t GetChannelWidth(void) const
 
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports. 
 
void DisablePreambleDetectionModel()
Disable the preamble detection model. 
 
WifiAckPolicySelector is in charge of selecting the acknowledgment policy for PSDUs containing QoS Da...
 
WifiStandard m_standard
wifi standard 
 
uint8_t GetMcsValue(void) const
 
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())
 
a unique identifier for an interface. 
 
Include Radiotap link layer information. 
 
static void AsciiPhyTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink with context. 
 
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
 
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
 
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper. 
 
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
 
void AddHeader(const Header &header)
Add header to this packet. 
 
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container. 
 
uint8_t GetNss(void) const
 
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
 
Handle packet fragmentation and retransmissions for data and management frames. 
 
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink without context.