aggregate Click/IP/TCP/UDP functionality to existing Nodes. More...
#include "click-internet-stack-helper.h"
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. | |
ClickInternetStackHelper & | operator= (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. | |
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.
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().
|
override |
Destroy the ClickInternetStackHelper.
Definition at line 170 of file click-internet-stack-helper.cc.
ns3::ClickInternetStackHelper::ClickInternetStackHelper | ( | const ClickInternetStackHelper & | o | ) |
Copy constructor.
o | Object to copy from. |
Definition at line 174 of file click-internet-stack-helper.cc.
References m_ipv4Enabled.
Check if ASCII is hooked.
ipv4 | IPv4 stack. |
Definition at line 395 of file click-internet-stack-helper.cc.
References ns3::g_interfaceStreamMapIpv4.
Referenced by EnableAsciiIpv4Internal().
|
staticprivate |
Create and aggregate object from type ID.
node | Node. |
typeId | Type ID. |
Definition at line 257 of file click-internet-stack-helper.cc.
References ns3::ObjectFactory::Create(), and ns3::ObjectFactory::SetTypeId().
Referenced by Install().
|
overrideprivatevirtual |
Enable ascii trace output on the indicated Ipv4 and interface pair.
stream | An OutputStreamWrapper representing an existing file to use when writing trace data. |
prefix | Filename prefix to use for ascii trace files. |
ipv4 | Ptr to the Ipv4 interface on which you want to enable tracing. |
interface | Interface ID on the Ipv4 on which you want to enable tracing. |
explicitFilename | Whether 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().
|
overrideprivatevirtual |
Enable pcap output the indicated Ipv4 and interface pair.
prefix | Filename prefix to use for pcap files. |
ipv4 | Ptr to the Ipv4 interface on which you want to enable tracing. |
interface | Interface ID on the Ipv4 on which you want to enable tracing. |
explicitFilename | Whether 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().
|
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().
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.
c | NodeContainer 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().
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.
node | The 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.
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.
nodeName | The 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().
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().
ClickInternetStackHelper & ns3::ClickInternetStackHelper::operator= | ( | const ClickInternetStackHelper & | o | ) |
Assignment operator.
o | Object to copy from. |
Definition at line 180 of file click-internet-stack-helper.cc.
References m_ipv4Enabled.
Check if PCAP is hooked.
ipv4 | IPv4 stack. |
Definition at line 319 of file click-internet-stack-helper.cc.
References ns3::g_interfaceFileMapIpv4.
Referenced by EnablePcapIpv4Internal().
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.
void ns3::ClickInternetStackHelper::SetClickFile | ( | NodeContainer | c, |
std::string | clickfile ) |
Set a Click file to be used for a group of nodes.
c | NodeContainer of nodes |
clickfile | Click 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().
Set a Click file to be used for a node.
node | Node for which Click file is to be set |
clickfile | Click file to be used |
Definition at line 206 of file click-internet-stack-helper.cc.
References m_nodeToClickFileMap.
void ns3::ClickInternetStackHelper::SetDefines | ( | NodeContainer | c, |
std::map< std::string, std::string > | defines ) |
Set defines to be used for a group of nodes.
c | NodeContainer of nodes |
defines | Defines 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().
void ns3::ClickInternetStackHelper::SetDefines | ( | Ptr< Node > | node, |
std::map< std::string, std::string > | defines ) |
Set defines to be used for a node.
node | Node for which the defines are to be set |
defines | Defines mapping to be used |
Definition at line 221 of file click-internet-stack-helper.cc.
References m_nodeToDefinesMap.
void ns3::ClickInternetStackHelper::SetRoutingTableElement | ( | NodeContainer | c, |
std::string | rt ) |
Set a Click routing table element for a group of nodes.
c | NodeContainer of nodes |
rt | Click 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().
Set a Click routing table element for a node.
node | Node for which Click file is to be set |
rt | Click Routing Table element name |
Definition at line 236 of file click-internet-stack-helper.cc.
References m_nodeToRoutingTableElementMap.
|
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().
Node to Click file mapping.
Definition at line 214 of file click-internet-stack-helper.h.
Referenced by Install(), and SetClickFile().
|
private |
Node to Click defines mapping.
Definition at line 219 of file click-internet-stack-helper.h.
Referenced by Install(), and SetDefines().
|
private |
Node to Routing Table Element mapping.
Definition at line 224 of file click-internet-stack-helper.h.
Referenced by Install(), and SetRoutingTableElement().