A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::ClickInternetStackHelper Class Reference

aggregate Click/IP/TCP/UDP functionality to existing Nodes. More...

#include "click-internet-stack-helper.h"

+ Inheritance diagram for ns3::ClickInternetStackHelper:
+ Collaboration diagram for ns3::ClickInternetStackHelper:

Public Member Functions

 ClickInternetStackHelper ()
 Create a new ClickInternetStackHelper which uses Ipv4ClickRouting for routing.
 
 ClickInternetStackHelper (const ClickInternetStackHelper &o)
 Copy constructor.
 
 ~ClickInternetStackHelper () override
 Destroy the ClickInternetStackHelper.
 
void Install (NodeContainer c) const
 For each node in the input container, aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and, ns3::Tcp classes.
 
void Install (Ptr< Node > node) const
 Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and ns3::Tcp classes onto the provided node.
 
void Install (std::string nodeName) const
 Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and ns3::Tcp classes onto the provided node.
 
void InstallAll () const
 Aggregate IPv4, UDP, and TCP stacks to all nodes in the simulation.
 
ClickInternetStackHelperoperator= (const ClickInternetStackHelper &o)
 Assignment operator.
 
void Reset ()
 Return helper internal state to that of a newly constructed one.
 
void SetClickFile (NodeContainer c, std::string clickfile)
 Set a Click file to be used for a group of nodes.
 
void SetClickFile (Ptr< Node > node, std::string clickfile)
 Set a Click file to be used for a node.
 
void SetDefines (NodeContainer c, std::map< std::string, std::string > defines)
 Set defines to be used for a group of nodes.
 
void SetDefines (Ptr< Node > node, std::map< std::string, std::string > defines)
 Set defines to be used for a node.
 
void SetRoutingTableElement (NodeContainer c, std::string rt)
 Set a Click routing table element for a group of nodes.
 
void SetRoutingTableElement (Ptr< Node > node, std::string rt)
 Set a Click routing table element for a node.
 
- Public Member Functions inherited from ns3::PcapHelperForIpv4
 PcapHelperForIpv4 ()
 Construct a PcapHelperForIpv4.
 
virtual ~PcapHelperForIpv4 ()
 Destroy a PcapHelperForIpv4.
 
void EnablePcapIpv4 (std::string prefix, Ipv4InterfaceContainer c)
 Enable pcap output on each Ipv4 and interface pair in the container.
 
void EnablePcapIpv4 (std::string prefix, NodeContainer n)
 Enable pcap output on all Ipv4 and interface pairs existing in the nodes provided in the container.
 
void EnablePcapIpv4 (std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename=false)
 Enable pcap output the indicated Ipv4 and interface pair.
 
void EnablePcapIpv4 (std::string prefix, std::string ipv4Name, uint32_t interface, bool explicitFilename=false)
 Enable pcap output the indicated Ipv4 and interface pair using a Ptr<Ipv4> previously named using the ns-3 object name service.
 
void EnablePcapIpv4 (std::string prefix, uint32_t nodeid, uint32_t interface, bool explicitFilename)
 Enable pcap output on the Ipv4 and interface pair specified by a global node-id (of a previously created node) and interface.
 
void EnablePcapIpv4All (std::string prefix)
 Enable pcap output on all Ipv4 and interface pairs existing in the set of all nodes created in the simulation.
 
- Public Member Functions inherited from ns3::AsciiTraceHelperForIpv4
 AsciiTraceHelperForIpv4 ()
 Construct an AsciiTraceHelperForIpv4.
 
virtual ~AsciiTraceHelperForIpv4 ()
 Destroy an AsciiTraceHelperForIpv4.
 
void EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, Ipv4InterfaceContainer c)
 Enable ascii trace output on each device in the container which is of the appropriate type.
 
void EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, NodeContainer n)
 Enable ascii trace output on all Ipv4 and interface pairs existing in the nodes provided in the container.
 
void EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, Ptr< Ipv4 > ipv4, uint32_t interface)
 Enable ascii trace output on the indicated Ipv4 and interface pair.
 
void EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, std::string ipv4Name, uint32_t interface)
 Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service.
 
void EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, uint32_t nodeid, uint32_t interface, bool explicitFilename)
 Enable ascii trace output on the Ipv4 and interface pair specified by a global node-id (of a previously created node) and interface.
 
void EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c)
 Enable ascii trace output on each Ipv4 and interface pair in the container.
 
void EnableAsciiIpv4 (std::string prefix, NodeContainer n)
 Enable ascii trace output on all Ipv4 and interface pairs existing in the nodes provided in the container.
 
void EnableAsciiIpv4 (std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename=false)
 Enable ascii trace output on the indicated Ipv4 and interface pair.
 
void EnableAsciiIpv4 (std::string prefix, std::string ipv4Name, uint32_t interface, bool explicitFilename=false)
 Enable ascii trace output the indicated Ipv4 and interface pair using an Ipv4 previously named using the ns-3 object name service.
 
void EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename)
 Enable ascii trace output on the Ipv4 and interface pair specified by a global node-id (of a previously created node) and interface.
 
void EnableAsciiIpv4All (Ptr< OutputStreamWrapper > stream)
 Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation.
 
void EnableAsciiIpv4All (std::string prefix)
 Enable ascii trace output on all Ipv4 and interface pairs existing in the set of all nodes created in the simulation.
 

Private Member Functions

bool AsciiHooked (Ptr< Ipv4 > ipv4)
 Check if ASCII is hooked.
 
void EnableAsciiIpv4Internal (Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename) override
 Enable ascii trace output on the indicated Ipv4 and interface pair.
 
void EnablePcapIpv4Internal (std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename) override
 Enable pcap output the indicated Ipv4 and interface pair.
 
void Initialize ()
 Initialize stack helper.
 
bool PcapHooked (Ptr< Ipv4 > ipv4)
 Check if PCAP is hooked.
 

Static Private Member Functions

static void CreateAndAggregateObjectFromTypeId (Ptr< Node > node, const std::string typeId)
 Create and aggregate object from type ID.
 

Private Attributes

bool m_ipv4Enabled
 IPv4 install state (enabled/disabled) ?
 
std::map< Ptr< Node >, std::string > m_nodeToClickFileMap
 Node to Click file mapping.
 
std::map< Ptr< Node >, std::map< std::string, std::string > > m_nodeToDefinesMap
 Node to Click defines mapping.
 
std::map< Ptr< Node >, std::string > m_nodeToRoutingTableElementMap
 Node to Routing Table Element mapping.
 

Detailed Description

aggregate Click/IP/TCP/UDP functionality to existing Nodes.

This helper has been adapted from the InternetStackHelper class and nodes will not be able to use Ipv6 functionalities.

Definition at line 37 of file click-internet-stack-helper.h.

Constructor & Destructor Documentation

◆ ClickInternetStackHelper() [1/2]

ns3::ClickInternetStackHelper::ClickInternetStackHelper ( )

Create a new ClickInternetStackHelper which uses Ipv4ClickRouting for routing.

Definition at line 159 of file click-internet-stack-helper.cc.

References Initialize().

+ Here is the call graph for this function:

◆ ~ClickInternetStackHelper()

ns3::ClickInternetStackHelper::~ClickInternetStackHelper ( )
override

Destroy the ClickInternetStackHelper.

Definition at line 170 of file click-internet-stack-helper.cc.

◆ ClickInternetStackHelper() [2/2]

ns3::ClickInternetStackHelper::ClickInternetStackHelper ( const ClickInternetStackHelper & o)

Copy constructor.

Parameters
oObject to copy from.

Definition at line 174 of file click-internet-stack-helper.cc.

References m_ipv4Enabled.

Member Function Documentation

◆ AsciiHooked()

bool ns3::ClickInternetStackHelper::AsciiHooked ( Ptr< Ipv4 > ipv4)
private

Check if ASCII is hooked.

Parameters
ipv4IPv4 stack.
Returns
True if ASCII is hooked.

Definition at line 395 of file click-internet-stack-helper.cc.

References ns3::g_interfaceStreamMapIpv4.

Referenced by EnableAsciiIpv4Internal().

+ Here is the caller graph for this function:

◆ CreateAndAggregateObjectFromTypeId()

void ns3::ClickInternetStackHelper::CreateAndAggregateObjectFromTypeId ( Ptr< Node > node,
const std::string typeId )
staticprivate

Create and aggregate object from type ID.

Parameters
nodeNode.
typeIdType ID.

Definition at line 257 of file click-internet-stack-helper.cc.

References ns3::ObjectFactory::Create(), and ns3::ObjectFactory::SetTypeId().

Referenced by Install().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnableAsciiIpv4Internal()

void ns3::ClickInternetStackHelper::EnableAsciiIpv4Internal ( Ptr< OutputStreamWrapper > stream,
std::string prefix,
Ptr< Ipv4 > ipv4,
uint32_t interface,
bool explicitFilename )
overrideprivatevirtual

Enable ascii trace output on the indicated Ipv4 and interface pair.

Parameters
streamAn OutputStreamWrapper representing an existing file to use when writing trace data.
prefixFilename prefix to use for ascii trace files.
ipv4Ptr to the Ipv4 interface on which you want to enable tracing.
interfaceInterface ID on the Ipv4 on which you want to enable tracing.
explicitFilenameWhether the filename is explicit or not.

Implements ns3::AsciiTraceHelperForIpv4.

Definition at line 408 of file click-internet-stack-helper.cc.

References AsciiHooked(), ns3::Config::Connect(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::AsciiTraceHelper::DefaultDropSinkWithContext(), ns3::Packet::EnablePrinting(), ns3::g_interfaceStreamMapIpv4, ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::Ipv4L3ProtocolDropSinkWithContext(), ns3::Ipv4L3ProtocolDropSinkWithoutContext(), m_ipv4Enabled, ns3::MakeBoundCallback(), NS_ASSERT_MSG, NS_LOG_INFO, and ns3::ObjectBase::TraceConnectWithoutContext().

+ Here is the call graph for this function:

◆ EnablePcapIpv4Internal()

void ns3::ClickInternetStackHelper::EnablePcapIpv4Internal ( std::string prefix,
Ptr< Ipv4 > ipv4,
uint32_t interface,
bool explicitFilename )
overrideprivatevirtual

Enable pcap output the indicated Ipv4 and interface pair.

Parameters
prefixFilename prefix to use for pcap files.
ipv4Ptr to the Ipv4 interface on which you want to enable tracing.
interfaceInterface ID on the Ipv4 on which you want to enable tracing.
explicitFilenameWhether the filename is explicit or not.

Implements ns3::PcapHelperForIpv4.

Definition at line 332 of file click-internet-stack-helper.cc.

References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_RAW, ns3::g_interfaceFileMapIpv4, ns3::PcapHelper::GetFilenameFromInterfacePair(), ns3::Ipv4L3ProtocolRxTxSink(), m_ipv4Enabled, ns3::MakeCallback(), NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, and PcapHooked().

+ Here is the call graph for this function:

◆ Initialize()

void ns3::ClickInternetStackHelper::Initialize ( )
private

Initialize stack helper.

Called by both constructor and Reset().

Definition at line 166 of file click-internet-stack-helper.cc.

Referenced by ClickInternetStackHelper(), and Reset().

+ Here is the caller graph for this function:

◆ Install() [1/3]

void ns3::ClickInternetStackHelper::Install ( NodeContainer c) const

For each node in the input container, aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and, ns3::Tcp classes.

The program will assert if this method is called on a container with a node that already has an Ipv4 object aggregated to it.

Parameters
cNodeContainer that holds the set of nodes on which to install the new stacks.

Definition at line 242 of file click-internet-stack-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and Install().

+ Here is the call graph for this function:

◆ Install() [2/3]

void ns3::ClickInternetStackHelper::Install ( Ptr< Node > node) const

Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and ns3::Tcp classes onto the provided node.

This method will assert if called on a node that already has an Ipv4 object aggregated to it.

Parameters
nodeThe node on which to install the stack.

Definition at line 267 of file click-internet-stack-helper.cc.

References CreateAndAggregateObjectFromTypeId(), ns3::CreateObject(), m_ipv4Enabled, m_nodeToClickFileMap, m_nodeToDefinesMap, m_nodeToRoutingTableElementMap, and NS_FATAL_ERROR.

+ Here is the call graph for this function:

◆ Install() [3/3]

void ns3::ClickInternetStackHelper::Install ( std::string nodeName) const

Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and ns3::Tcp classes onto the provided node.

This method will assert if called on a node that already has an Ipv4 object aggregated to it.

Parameters
nodeNameThe name of the node on which to install the stack.

Definition at line 312 of file click-internet-stack-helper.cc.

References ns3::Names::Find(), and Install().

Referenced by Install(), Install(), and InstallAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InstallAll()

void ns3::ClickInternetStackHelper::InstallAll ( ) const

Aggregate IPv4, UDP, and TCP stacks to all nodes in the simulation.

Definition at line 251 of file click-internet-stack-helper.cc.

References ns3::NodeContainer::GetGlobal(), and Install().

+ Here is the call graph for this function:

◆ operator=()

ClickInternetStackHelper & ns3::ClickInternetStackHelper::operator= ( const ClickInternetStackHelper & o)

Assignment operator.

Parameters
oObject to copy from.
Returns
Reference to updated object.

Definition at line 180 of file click-internet-stack-helper.cc.

References m_ipv4Enabled.

◆ PcapHooked()

bool ns3::ClickInternetStackHelper::PcapHooked ( Ptr< Ipv4 > ipv4)
private

Check if PCAP is hooked.

Parameters
ipv4IPv4 stack.
Returns
True if PCAP is hooked.

Definition at line 319 of file click-internet-stack-helper.cc.

References ns3::g_interfaceFileMapIpv4.

Referenced by EnablePcapIpv4Internal().

+ Here is the caller graph for this function:

◆ Reset()

void ns3::ClickInternetStackHelper::Reset ( )

Return helper internal state to that of a newly constructed one.

Definition at line 190 of file click-internet-stack-helper.cc.

References Initialize(), and m_ipv4Enabled.

+ Here is the call graph for this function:

◆ SetClickFile() [1/2]

void ns3::ClickInternetStackHelper::SetClickFile ( NodeContainer c,
std::string clickfile )

Set a Click file to be used for a group of nodes.

Parameters
cNodeContainer of nodes
clickfileClick file to be used

Definition at line 197 of file click-internet-stack-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and SetClickFile().

Referenced by SetClickFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetClickFile() [2/2]

void ns3::ClickInternetStackHelper::SetClickFile ( Ptr< Node > node,
std::string clickfile )

Set a Click file to be used for a node.

Parameters
nodeNode for which Click file is to be set
clickfileClick file to be used

Definition at line 206 of file click-internet-stack-helper.cc.

References m_nodeToClickFileMap.

◆ SetDefines() [1/2]

void ns3::ClickInternetStackHelper::SetDefines ( NodeContainer c,
std::map< std::string, std::string > defines )

Set defines to be used for a group of nodes.

Parameters
cNodeContainer of nodes
definesDefines mapping to be used

Definition at line 212 of file click-internet-stack-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and SetDefines().

Referenced by SetDefines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDefines() [2/2]

void ns3::ClickInternetStackHelper::SetDefines ( Ptr< Node > node,
std::map< std::string, std::string > defines )

Set defines to be used for a node.

Parameters
nodeNode for which the defines are to be set
definesDefines mapping to be used

Definition at line 221 of file click-internet-stack-helper.cc.

References m_nodeToDefinesMap.

◆ SetRoutingTableElement() [1/2]

void ns3::ClickInternetStackHelper::SetRoutingTableElement ( NodeContainer c,
std::string rt )

Set a Click routing table element for a group of nodes.

Parameters
cNodeContainer of nodes
rtClick Routing Table element name

Definition at line 227 of file click-internet-stack-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and SetRoutingTableElement().

Referenced by SetRoutingTableElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetRoutingTableElement() [2/2]

void ns3::ClickInternetStackHelper::SetRoutingTableElement ( Ptr< Node > node,
std::string rt )

Set a Click routing table element for a node.

Parameters
nodeNode for which Click file is to be set
rtClick Routing Table element name

Definition at line 236 of file click-internet-stack-helper.cc.

References m_nodeToRoutingTableElementMap.

Member Data Documentation

◆ m_ipv4Enabled

bool ns3::ClickInternetStackHelper::m_ipv4Enabled
private

IPv4 install state (enabled/disabled) ?

Definition at line 209 of file click-internet-stack-helper.h.

Referenced by ClickInternetStackHelper(), EnableAsciiIpv4Internal(), EnablePcapIpv4Internal(), Install(), operator=(), and Reset().

◆ m_nodeToClickFileMap

std::map<Ptr<Node>, std::string> ns3::ClickInternetStackHelper::m_nodeToClickFileMap
private

Node to Click file mapping.

Definition at line 214 of file click-internet-stack-helper.h.

Referenced by Install(), and SetClickFile().

◆ m_nodeToDefinesMap

std::map<Ptr<Node>, std::map<std::string, std::string> > ns3::ClickInternetStackHelper::m_nodeToDefinesMap
private

Node to Click defines mapping.

Definition at line 219 of file click-internet-stack-helper.h.

Referenced by Install(), and SetDefines().

◆ m_nodeToRoutingTableElementMap

std::map<Ptr<Node>, std::string> ns3::ClickInternetStackHelper::m_nodeToRoutingTableElementMap
private

Node to Routing Table Element mapping.

Definition at line 224 of file click-internet-stack-helper.h.

Referenced by Install(), and SetRoutingTableElement().


The documentation for this class was generated from the following files: