24 #include "ns3/abort.h" 25 #include "ns3/config.h" 26 #include "ns3/fd-net-device.h" 28 #include "ns3/names.h" 29 #include "ns3/object-factory.h" 30 #include "ns3/packet.h" 31 #include "ns3/simulator.h" 32 #include "ns3/trace-helper.h" 63 NS_LOG_INFO (
"FdNetDeviceHelper::EnablePcapInternal(): Device " << device <<
" not of type ns3::FdNetDevice");
95 bool explicitFilename)
105 NS_LOG_INFO (
"FdNetDeviceHelper::EnableAsciiInternal(): Device " << device <<
" not of type ns3::FdNetDevice");
130 std::string filename;
131 if (explicitFilename)
162 uint32_t deviceid = nd->GetIfIndex ();
163 std::ostringstream oss;
165 oss <<
"/NodeList/" << nd->GetNode ()->GetId () <<
"/DeviceList/" << deviceid <<
"/$ns3::FdNetDevice/MacRx";
178 Ptr<Node> node = Names::Find<Node> (nodeName);
virtual Ptr< NetDevice > InstallPriv(Ptr< Node > node) const
This method creates an ns3::FdNetDevice and associates it to a node.
Manage ASCII trace files for device models.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
#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. ...
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
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.
void SetAttribute(std::string n1, const AttributeValue &v1)
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output on the indicated net device.
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...
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
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 Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
holds a vector of ns3::NetDevice pointers
void Connect(std::string path, const CallbackBase &cb)
static void DefaultReceiveSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Receive default trace sink.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
void HookDefaultReceiveSinkWithoutContext(Ptr< T > object, std::string traceName, Ptr< OutputStreamWrapper > stream)
Hook a trace source to the default receive operation trace sink that does not accept nor log a trace ...
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
a NetDevice to read/write network traffic from/into a file descriptor.
void HookDefaultSink(Ptr< T > object, std::string traceName, Ptr< PcapFileWrapper > file)
Hook a trace source to the default trace sink.
FdNetDeviceHelper()
Construct a FdNetDeviceHelper.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
ObjectFactory m_deviceFactory
factory for the NetDevices