22 #include "ns3/trace-helper.h" 
   24 #include "ns3/error-rate-model.h" 
   25 #include "ns3/propagation-loss-model.h" 
   26 #include "ns3/propagation-delay-model.h" 
   27 #include "ns3/yans-wifi-channel.h" 
   28 #include "ns3/yans-wifi-phy.h" 
   29 #include "ns3/ampdu-subframe-header.h" 
   30 #include "ns3/wifi-net-device.h" 
   31 #include "ns3/radiotap-header.h" 
   32 #include "ns3/pcap-file-wrapper.h" 
   33 #include "ns3/simulator.h" 
   34 #include "ns3/config.h" 
   35 #include "ns3/names.h" 
   36 #include "ns3/abort.h" 
   52   NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
 
  119   factory.
Set (n0, v0);
 
  120   factory.
Set (n1, v1);
 
  121   factory.
Set (n2, v2);
 
  122   factory.
Set (n3, v3);
 
  123   factory.
Set (n4, v4);
 
  124   factory.
Set (n5, v5);
 
  125   factory.
Set (n6, v6);
 
  126   factory.
Set (n7, v7);
 
  143   factory.
Set (n0, v0);
 
  144   factory.
Set (n1, v1);
 
  145   factory.
Set (n2, v2);
 
  146   factory.
Set (n3, v3);
 
  147   factory.
Set (n4, v4);
 
  148   factory.
Set (n5, v5);
 
  149   factory.
Set (n6, v6);
 
  150   factory.
Set (n7, v7);
 
  168           channel->SetPropagationLossModel (cur);
 
  173   channel->SetPropagationDelayModel (delay);
 
  180   return c->AssignStreams (stream);
 
  255   uint16_t             channelFreqMhz,
 
  256   uint16_t             channelNumber,
 
  271         NS_FATAL_ERROR (
"PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
 
  297         uint16_t channelFlags = 0;
 
  312         if (channelFreqMhz < 2500)
 
  330             mcsRate = rate - 128;
 
  351             if (txVector.
GetNess () & 0x01) 
 
  355             if (txVector.
GetNess () & 0x02) 
 
  378             uint32_t extractedLength;
 
  381             p = p->
CreateFragment (0, static_cast<uint32_t> (extractedLength));
 
  393             uint8_t vhtBandwidth = 0;
 
  394             uint8_t vhtMcsNss[4] = {0,0,0,0};
 
  395             uint8_t vhtCoding = 0;
 
  396             uint8_t vhtGroupId = 0;
 
  397             uint16_t vhtPartialAid = 0;
 
  429             vhtMcsNss[0] |= (txVector.
GetNss () & 0x0f);
 
  430             vhtMcsNss[0] |= (((rate - 128) << 4) & 0xf0);
 
  432             header.
SetVhtFields (vhtKnown, vhtFlags, vhtBandwidth, vhtMcsNss, vhtCoding, vhtGroupId, vhtPartialAid);
 
  440       NS_ABORT_MSG (
"PcapSniffTxEvent(): Unexpected data link type " << dlt);
 
  448   uint16_t              channelFreqMhz,
 
  449   uint16_t              channelNumber,
 
  465         NS_FATAL_ERROR (
"PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
 
  491         uint16_t channelFlags = 0;
 
  506         if (channelFreqMhz < 2500)
 
  527             mcsRate = rate - 128;
 
  548             if (txVector.
GetNess () & 0x01) 
 
  552             if (txVector.
GetNess () & 0x02) 
 
  570             uint16_t ampduStatusFlags = 0;
 
  575             uint32_t extractedLength;
 
  578             p = p->
CreateFragment (0, static_cast<uint32_t> (extractedLength));
 
  590             uint8_t vhtBandwidth = 0;
 
  591             uint8_t vhtMcsNss[4] = {0,0,0,0};
 
  592             uint8_t vhtCoding = 0;
 
  593             uint8_t vhtGroupId = 0;
 
  594             uint16_t vhtPartialAid = 0;
 
  626             vhtMcsNss[0] |= (txVector.
GetNss () & 0x0f);
 
  627             vhtMcsNss[0] |= (((rate - 128) << 4) & 0xf0);
 
  629             header.
SetVhtFields (vhtKnown, vhtFlags, vhtBandwidth, vhtMcsNss, vhtCoding, vhtGroupId, vhtPartialAid);
 
  637       NS_ABORT_MSG (
"PcapSniffRxEvent(): Unexpected data link type " << dlt);
 
  656       NS_ABORT_MSG (
"YansWifiPhyHelper::SetPcapFormat(): Unexpected format");
 
  675       NS_LOG_INFO (
"YansWifiHelper::EnablePcapInternal(): Device " << &device << 
" not of type ns3::WifiNetDevice");
 
  680   NS_ABORT_MSG_IF (phy == 0, 
"YansWifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set");
 
  684   std::string filename;
 
  685   if (explicitFilename)
 
  705   bool explicitFilename)
 
  713       NS_LOG_INFO (
"YansWifiHelper::EnableAsciiInternal(): Device " << device << 
" not of type ns3::WifiNetDevice");
 
  721   uint32_t nodeid = nd->GetNode ()->GetId ();
 
  722   uint32_t deviceid = nd->GetIfIndex ();
 
  723   std::ostringstream oss;
 
  736       std::string filename;
 
  737       if (explicitFilename)
 
  752       oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/RxOk";
 
  756       oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/Tx";
 
  768   oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/RxOk";
 
  772   oss << 
"/NodeList/" << nodeid << 
"/DeviceList/" << deviceid << 
"/$ns3::WifiNetDevice/Phy/State/Tx";
 
void AddPropagationLoss(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())
 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
 
uint32_t GetPcapDataLinkType(void) const 
Get the data link type of PCAP traces to be used. 
 
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 "...
 
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())
 
#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...
 
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Sets the error rate model. 
 
bool IsAggregation(void) const 
Checks whether the PSDU contains A-MPDU. 
 
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
 
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal. 
 
Ptr< YansWifiChannel > Create(void) const 
 
Make it easy to create and manage PHY objects for the yans model. 
 
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state. 
 
Hold a value for an Attribute. 
 
Manage pcap files for device models. 
 
void Write(Time t, Ptr< const Packet > p)
Write the next packet to file. 
 
Include Prism monitor mode information. 
 
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument. 
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
void SetPcapDataLinkType(enum SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used. 
 
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory. 
 
bool IsShortGuardInterval(void) const 
 
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device. 
 
static void AsciiPhyReceiveSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
 
#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. 
 
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. ...
 
void Set(std::string name, const AttributeValue &v)
 
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state. 
 
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...
 
YansWifiChannelHelper()
Create a channel helper without any parameter set. 
 
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
 
Include Radiotap link layer information. 
 
the interface for Wifi's error models 
 
IEEE 802.11 Wireless LAN headers on packets. 
 
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission. 
 
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const 
Create a new packet which contains a fragment of the original packet. 
 
void SetChannel(Ptr< YansWifiChannel > channel)
 
double GetSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
 
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...
 
uint32_t GetDataLinkType(void)
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
 
static void EnablePrinting(void)
Enable printing packets metadata. 
 
Ptr< Object > Create(void) const 
Create an Object instance of the configured TypeId. 
 
uint8_t GetNess(void) const 
 
uint32_t GetChannelWidth(void) const 
 
calculate a propagation delay. 
 
Hold together all Wifi-related objects. 
 
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
 
YansWifiPhyHelper()
Create a phy helper without any parameter set. 
 
bool IsStbc(void) const 
Check if STBC is used or not. 
 
void Connect(std::string path, const CallbackBase &cb)
 
void SetChannel(Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to. 
 
Ptr< Packet > Copy(void) const 
performs a COW copy of the packet. 
 
ObjectFactory m_errorRateModel
 
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)
 
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
802.11 PHY layer modelThis PHY implements a model of 802.11a. 
 
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device. 
 
Ptr< YansWifiChannel > m_channel
 
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction. 
 
manage and create wifi channel objects for the yans model. 
 
static Time Now(void)
Return the current simulation virtual time. 
 
ObjectFactory m_propagationDelay
 
Instantiate subclasses of ns3::Object. 
 
uint8_t GetNss(void) const 
 
Models the propagation loss through a transmission medium. 
 
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message. 
 
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const 
 
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file. 
 
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)
 
void SetDevice(Ptr< NetDevice > device)
Sets the device this PHY is associated with. 
 
void SetPropagationDelay(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())
 
std::vector< ObjectFactory > m_propagationLoss
 
static void AsciiPhyTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
 
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper. 
 
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports. 
 
void AddHeader(const Header &header)
Add header to this packet. 
 
int64_t AssignStreams(Ptr< YansWifiChannel > c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the channel. 
 
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)