|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #include "ns3/pointer.h"
21 #include "ns3/string.h"
22 #include "ns3/config.h"
23 #include "ns3/names.h"
24 #include "ns3/abort.h"
25 #include "ns3/wave-net-device.h"
26 #include "ns3/minstrel-wifi-manager.h"
27 #include "ns3/radiotap-header.h"
28 #include "ns3/unused.h"
54 NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
141 NS_LOG_INFO (
"YansWavePhyHelper::EnablePcapInternal(): Device " << &device <<
" not of type ns3::WaveNetDevice");
145 std::vector<Ptr<WifiPhy> > phys = device->
GetPhys ();
146 NS_ABORT_MSG_IF (phys.size () == 0,
"EnablePcapInternal(): Phy layer in WaveNetDevice must be set");
150 std::string filename;
151 if (explicitFilename)
162 std::vector<Ptr<WifiPhy> >::iterator i;
163 for (i = phys.begin (); i != phys.end (); ++i)
176 bool explicitFilename)
186 NS_LOG_INFO (
"EnableAsciiInternal(): Device " << device <<
" not of type ns3::WaveNetDevice");
198 std::ostringstream oss;
215 std::string filename;
216 if (explicitFilename)
233 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/RxOk";
237 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/Tx";
251 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/RxOk";
255 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/Tx";
278 "ControlMode",
StringValue (
"OfdmRate6MbpsBW10MHz"),
279 "NonUnicastMode",
StringValue (
"OfdmRate6MbpsBW10MHz"));
286 if (channelNumbers.size () == 0)
290 for (std::vector<uint32_t>::iterator i = channelNumbers.begin (); i != channelNumbers.end (); ++i)
294 NS_FATAL_ERROR (
"the channel number " << (*i) <<
" is not a valid WAVE channel number");
309 NS_FATAL_ERROR (
"the number of assigned WAVE PHY entities is more than the number of valid WAVE channels");
368 catch (
const std::bad_cast &)
370 NS_FATAL_ERROR (
"WifiMacHelper should be the class or subclass of QosWaveMacHelper");
419 Ptr<Node> node = Names::Find<Node> (nodeName);
443 int64_t currentStream = stream;
452 std::vector<Ptr<WifiPhy> > phys = wave->
GetPhys ();
453 for (std::vector<
Ptr<WifiPhy> >::iterator j = phys.begin (); j != phys.end (); ++j)
455 currentStream += (*j)->AssignStreams (currentStream);
459 std::map<uint32_t, Ptr<OcbWifiMac> > macs = wave->
GetMacs ();
460 for ( std::map<uint32_t,
Ptr<OcbWifiMac> >::iterator
k = macs.begin ();
k != macs.end (); ++
k)
469 currentStream += minstrel->AssignStreams (currentStream);
473 rmac->GetAttribute (
"Txop", ptr);
477 rmac->GetAttribute (
"VO_Txop", ptr);
481 rmac->GetAttribute (
"VI_Txop", ptr);
485 rmac->GetAttribute (
"BE_Txop", ptr);
489 rmac->GetAttribute (
"BK_Txop", ptr);
495 return (currentStream - stream);
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
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 std::vector< uint32_t > GetWaveChannels(void)
This class holds together multiple, ns3::WifiPhy, and ns3::OcbWifiMac (including ns3::WifiRemoteStati...
void SetChannelScheduler(Ptr< ChannelScheduler > channelScheduler)
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId=SU_STA_ID)
uint32_t GetId(void) const
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)
static Time Now(void)
Return the current simulation virtual time.
static uint32_t GetNumberOfWaveChannels(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
static WaveHelper Default(void)
void CreateMacForChannel(std::vector< uint32_t > channelNumbers)
static bool IsWaveChannel(uint32_t channelNumber)
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
static void EnableLogComponents(void)
Helper to enable all WaveNetDevice log components with one statement.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
static void EnablePrinting(void)
Enable printing packets metadata.
@ LOG_LEVEL_ALL
Print everything.
Hold a value for an Attribute.
std::map< uint32_t, Ptr< OcbWifiMac > > GetMacs(void) const
void CreatePhys(uint32_t phys)
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
hold a list of per-remote-station state.
Hold objects of type Ptr<T>.
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
static uint32_t GetCch(void)
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
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())
helps to create WaveNetDevice objects
This class will assign channel access for requests from higher layers.
void AddPhy(Ptr< WifiPhy > phy)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
@ WIFI_PHY_STANDARD_80211p
OFDM PHY (Clause 17 - amendment for 10 MHz and 5 MHz channels)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Qos Wave Mac Helper class.
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.
represent a single transmission mode
std::vector< Ptr< WifiPhy > > GetPhys(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.
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
virtual Ptr< Node > GetNode(void) const =0
#define NS_UNUSED(x)
Mark a local variable as unused.
Instantiate subclasses of ns3::Object.
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 ...
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.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Manage pcap files for device models.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager) override
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink without context.
virtual void SetAddress(Address address)
Set the address of this interface.
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
void EnableForWave(Ptr< WaveNetDevice > device)
ObjectFactory m_stationManager
station manager
void SetChannelCoordinator(Ptr< ChannelCoordinator > channelCoordinator)
Hold variables of type string.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
void AddMac(uint32_t channelNumber, Ptr< OcbWifiMac > mac)
Manage ASCII trace files for device models.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void Connect(std::string path, const CallbackBase &cb)
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink without context.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
static YansWavePhyHelper Default(void)
Create a phy helper in a default working state.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetChannelScheduler(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())
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())
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
keep track of a set of node pointers.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
ObjectFactory m_channelScheduler
channel scheduler
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
create MAC layers for a ns3::WifiNetDevice.
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...
virtual Ptr< WifiMac > Create(Ptr< NetDevice > device, WifiStandard standard) const
uint32_t m_physNumber
Phy number.
void SetVsaManager(Ptr< VsaManager > vsaManager)
virtual uint32_t GetIfIndex(void) const =0
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
std::vector< uint32_t > m_macsForChannelNumber
MACs for channel number.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
void SetChannelManager(Ptr< ChannelManager > channelManager)
Handle packet fragmentation and retransmissions for data and management frames.