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. More... | |
ClickInternetStackHelper (const ClickInternetStackHelper &o) | |
Copy constructor. More... | |
~ClickInternetStackHelper () override | |
Destroy the ClickInternetStackHelper. More... | |
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. More... | |
void | Install (Ptr< Node > node) const |
Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and ns3::Tcp classes onto the provided node. More... | |
void | Install (std::string nodeName) const |
Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and ns3::Tcp classes onto the provided node. More... | |
void | InstallAll () const |
Aggregate IPv4, UDP, and TCP stacks to all nodes in the simulation. More... | |
ClickInternetStackHelper & | operator= (const ClickInternetStackHelper &o) |
Assignment operator. More... | |
void | Reset () |
Return helper internal state to that of a newly constructed one. More... | |
void | SetClickFile (NodeContainer c, std::string clickfile) |
Set a Click file to be used for a group of nodes. More... | |
void | SetClickFile (Ptr< Node > node, std::string clickfile) |
Set a Click file to be used for a node. More... | |
void | SetDefines (NodeContainer c, std::map< std::string, std::string > defines) |
Set defines to be used for a group of nodes. More... | |
void | SetDefines (Ptr< Node > node, std::map< std::string, std::string > defines) |
Set defines to be used for a node. More... | |
void | SetRoutingTableElement (NodeContainer c, std::string rt) |
Set a Click routing table element for a group of nodes. More... | |
void | SetRoutingTableElement (Ptr< Node > node, std::string rt) |
Set a Click routing table element for a node. More... | |
Public Member Functions inherited from ns3::PcapHelperForIpv4 | |
PcapHelperForIpv4 () | |
Construct a PcapHelperForIpv4. More... | |
virtual | ~PcapHelperForIpv4 () |
Destroy a PcapHelperForIpv4. More... | |
void | EnablePcapIpv4 (std::string prefix, Ipv4InterfaceContainer c) |
Enable pcap output on each Ipv4 and interface pair in the container. More... | |
void | EnablePcapIpv4 (std::string prefix, NodeContainer n) |
Enable pcap output on all Ipv4 and interface pairs existing in the nodes provided in the container. More... | |
void | EnablePcapIpv4 (std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename=false) |
Enable pcap output the indicated Ipv4 and interface pair. More... | |
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. More... | |
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. More... | |
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. More... | |
Public Member Functions inherited from ns3::AsciiTraceHelperForIpv4 | |
AsciiTraceHelperForIpv4 () | |
Construct an AsciiTraceHelperForIpv4. More... | |
virtual | ~AsciiTraceHelperForIpv4 () |
Destroy an AsciiTraceHelperForIpv4. More... | |
void | EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, Ipv4InterfaceContainer c) |
Enable ascii trace output on each device in the container which is of the appropriate type. More... | |
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. More... | |
void | EnableAsciiIpv4 (Ptr< OutputStreamWrapper > stream, Ptr< Ipv4 > ipv4, uint32_t interface) |
Enable ascii trace output on the indicated Ipv4 and interface pair. More... | |
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. More... | |
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. More... | |
void | EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c) |
Enable ascii trace output on each Ipv4 and interface pair in the container. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Private Member Functions | |
bool | AsciiHooked (Ptr< Ipv4 > ipv4) |
Check if ASCII is hooked. More... | |
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. More... | |
void | EnablePcapIpv4Internal (std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename) override |
Enable pcap output the indicated Ipv4 and interface pair. More... | |
void | Initialize () |
Initialize stack helper. More... | |
bool | PcapHooked (Ptr< Ipv4 > ipv4) |
Check if PCAP is hooked. More... | |
Static Private Member Functions | |
static void | CreateAndAggregateObjectFromTypeId (Ptr< Node > node, const std::string typeId) |
Create and aggregate object from type ID. More... | |
Private Attributes | |
bool | m_ipv4Enabled |
IPv4 install state (enabled/disabled) ? More... | |
std::map< Ptr< Node >, std::string > | m_nodeToClickFileMap |
Node to Click file mapping. More... | |
std::map< Ptr< Node >, std::map< std::string, std::string > > | m_nodeToDefinesMap |
Node to Click defines mapping. More... | |
std::map< Ptr< Node >, std::string > | m_nodeToRoutingTableElementMap |
Node to Routing Table Element mapping. More... | |
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 48 of file click-internet-stack-helper.h.
ns3::ClickInternetStackHelper::ClickInternetStackHelper | ( | ) |
Create a new ClickInternetStackHelper which uses Ipv4ClickRouting for routing.
Definition at line 170 of file click-internet-stack-helper.cc.
References Initialize().
|
override |
Destroy the ClickInternetStackHelper.
Definition at line 181 of file click-internet-stack-helper.cc.
ns3::ClickInternetStackHelper::ClickInternetStackHelper | ( | const ClickInternetStackHelper & | o | ) |
Copy constructor.
o | Object to copy from. |
Definition at line 185 of file click-internet-stack-helper.cc.
References m_ipv4Enabled.
Check if ASCII is hooked.
ipv4 | IPv4 stack. |
Definition at line 406 of file click-internet-stack-helper.cc.
References ns3::g_interfaceStreamMapIpv4, and nsclick-simple-lan::ipv4.
Referenced by EnableAsciiIpv4Internal().
|
staticprivate |
Create and aggregate object from type ID.
node | Node. |
typeId | Type ID. |
Definition at line 268 of file click-internet-stack-helper.cc.
References ns3::Object::AggregateObject(), 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 419 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::Node::GetId(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), nsclick-simple-lan::ipv4, 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 343 of file click-internet-stack-helper.cc.
References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_RAW, create-module::file, ns3::g_interfaceFileMapIpv4, ns3::PcapHelper::GetFilenameFromInterfacePair(), nsclick-simple-lan::ipv4, 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 177 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 253 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 278 of file click-internet-stack-helper.cc.
References ns3::Object::AggregateObject(), CreateAndAggregateObjectFromTypeId(), ns3::Object::GetObject(), nsclick-simple-lan::ipv4, 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 323 of file click-internet-stack-helper.cc.
Referenced by Install(), and InstallAll().
void ns3::ClickInternetStackHelper::InstallAll | ( | ) | const |
Aggregate IPv4, UDP, and TCP stacks to all nodes in the simulation.
Definition at line 262 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 191 of file click-internet-stack-helper.cc.
References m_ipv4Enabled.
Check if PCAP is hooked.
ipv4 | IPv4 stack. |
Definition at line 330 of file click-internet-stack-helper.cc.
References ns3::g_interfaceFileMapIpv4, and nsclick-simple-lan::ipv4.
Referenced by EnablePcapIpv4Internal().
void ns3::ClickInternetStackHelper::Reset | ( | ) |
Return helper internal state to that of a newly constructed one.
Definition at line 201 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 208 of file click-internet-stack-helper.cc.
References ns3::NodeContainer::Begin(), and ns3::NodeContainer::End().
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 217 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 223 of file click-internet-stack-helper.cc.
References ns3::NodeContainer::Begin(), and ns3::NodeContainer::End().
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 232 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 238 of file click-internet-stack-helper.cc.
References ns3::NodeContainer::Begin(), and ns3::NodeContainer::End().
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 247 of file click-internet-stack-helper.cc.
References m_nodeToRoutingTableElementMap.
|
private |
IPv4 install state (enabled/disabled) ?
Definition at line 220 of file click-internet-stack-helper.h.
Referenced by ClickInternetStackHelper(), EnableAsciiIpv4Internal(), EnablePcapIpv4Internal(), Install(), operator=(), and Reset().
Node to Click file mapping.
Definition at line 225 of file click-internet-stack-helper.h.
Referenced by Install(), and SetClickFile().
|
private |
Node to Click defines mapping.
Definition at line 230 of file click-internet-stack-helper.h.
Referenced by Install(), and SetDefines().
|
private |
Node to Routing Table Element mapping.
Definition at line 235 of file click-internet-stack-helper.h.
Referenced by Install(), and SetRoutingTableElement().