A Discrete-Event Network Simulator
API
ns3::Ipv4ClickRouting Class Reference

Class to allow a node to use Click for external routing. More...

#include "ipv4-click-routing.h"

+ Inheritance diagram for ns3::Ipv4ClickRouting:
+ Collaboration diagram for ns3::Ipv4ClickRouting:

Public Member Functions

 Ipv4ClickRouting ()
 Constructor. More...
 
 ~Ipv4ClickRouting () override
 
void DoDispose () override
 Destructor implementation. More...
 
std::map< std::string, std::string > GetDefines ()
 Provides for SIMCLICK_GET_DEFINES. More...
 
int GetInterfaceId (const char *ifname)
 Provides for SIMCLICK_IFID_FROM_NAME. More...
 
std::string GetIpAddressFromInterfaceId (int ifid)
 Provides for SIMCLICK_IPADDR_FROM_NAME. More...
 
std::string GetIpPrefixFromInterfaceId (int ifid)
 Provides for SIMCLICK_IPPREFIX_FROM_NAME. More...
 
std::string GetMacAddressFromInterfaceId (int ifid)
 Provides for SIMCLICK_MACADDR_FROM_NAME. More...
 
std::string GetNodeName ()
 Provides for SIMCLICK_GET_NODE_NAME. More...
 
Ptr< UniformRandomVariableGetRandomVariable ()
 Get the uniform random variable. More...
 
void HandlePacketFromClick (int ifid, int type, const unsigned char *data, int len)
 Receives a packet from Click. More...
 
void HandleScheduleFromClick (const struct timeval *when)
 Schedules simclick_click_run to run at the given time. More...
 
bool IsInterfaceReady (int ifid)
 Provides for SIMCLICK_IF_READY. More...
 
void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) override
 
void NotifyInterfaceDown (uint32_t interface) override
 
void NotifyInterfaceUp (uint32_t interface) override
 
void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) override
 
void PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
 Print the Routing Table entries. More...
 
std::string ReadHandler (std::string elementName, std::string handlerName)
 Read Handler interface for a node's Click Elements. More...
 
void Receive (Ptr< Packet > p, Mac48Address receiverAddr, Mac48Address dest)
 Allow a lower layer to send data to Click. More...
 
bool RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb) override
 Route an input packet (to be forwarded or locally delivered) More...
 
Ptr< Ipv4RouteRouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override
 Query routing cache for an existing route, for an outbound packet. More...
 
void Send (Ptr< Packet > p, Ipv4Address src, Ipv4Address dest)
 Allow a higher layer to send data through Click. More...
 
void SendPacketToClick (int ifid, int type, const unsigned char *data, int len)
 Sends a packet to Click. More...
 
void SetClickFile (std::string clickfile)
 Click configuration file to be used by the node's Click Instance. More...
 
void SetClickRoutingTableElement (std::string name)
 Name of the routing table element being used by Click. More...
 
void SetDefines (std::map< std::string, std::string > defines)
 Click defines to be used by the node's Click Instance. More...
 
void SetIpv4 (Ptr< Ipv4 > ipv4) override
 Set the Ipv4 instance to be used. More...
 
void SetNodeName (std::string name)
 Name of the node as to be used by Click. More...
 
void SetPromisc (int ifid)
 Sets an interface to run on promiscuous mode. More...
 
int WriteHandler (std::string elementName, std::string handlerName, std::string writeString)
 Write Handler interface for a node's Click Elements. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
 ~Object () override
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose ()
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one. More...
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object. More...
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized () const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static Ptr< Ipv4ClickRoutingGetClickInstanceFromSimNode (simclick_node_t *simnode)
 Allows the Click service methods, which reside outside Ipv4ClickRouting, to get the required Ipv4ClickRouting instances. More...
 
static TypeId GetTypeId ()
 Get type ID. More...
 
- Static Public Member Functions inherited from ns3::Ipv4RoutingProtocol
static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID. More...
 

Protected Member Functions

void DoInitialize () override
 Initialize() implementation. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Member Functions

void AddSimNodeToClickMapping ()
 Used internally in DoInitialize () to Add a mapping to m_clickInstanceFromSimNode mapping. More...
 
struct timeval GetTimevalFromNow () const
 Get current simulation time as a timeval. More...
 
void RunClickEvent ()
 This method has to be scheduled every time Click calls SIMCLICK_SCHEDULE. More...
 

Private Attributes

std::string m_clickFile
 Name of .click configuration file. More...
 
bool m_clickInitialised
 Whether click has been initialized. More...
 
std::string m_clickRoutingTableElement
 Name of the routing table element. More...
 
std::map< std::string, std::string > m_defines
 Defines for .click configuration file parsing. More...
 
Ptr< Ipv4m_ipv4
 Pointer to the IPv4 object. More...
 
std::string m_nodeName
 Name of the node. More...
 
bool m_nonDefaultName
 Whether a non-default name has been set. More...
 
Ptr< UniformRandomVariablem_random
 Uniform random variable. More...
 
simclick_node_tm_simNode
 Pointer to the simclick node. More...
 

Static Private Attributes

static std::map< simclick_node_t *, Ptr< Ipv4ClickRouting > > m_clickInstanceFromSimNode
 Provide a mapping between the node reference used by Click and the corresponding Ipv4ClickRouting instance. More...
 

Friends

class ::ClickIfidFromNameTest
 
class ::ClickIpMacAddressFromNameTest
 
class ::ClickTrivialTest
 

Additional Inherited Members

- Public Types inherited from ns3::Ipv4RoutingProtocol
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrnoErrorCallback
 Callback for routing errors (e.g., no route found) More...
 
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > LocalDeliverCallback
 Callback for packets to be locally delivered. More...
 
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
 Callback for multicast packets to be forwarded. More...
 
typedef Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
 Callback for unicast packets to be forwarded. More...
 

Detailed Description

Class to allow a node to use Click for external routing.

Definition at line 57 of file ipv4-click-routing.h.

Constructor & Destructor Documentation

◆ Ipv4ClickRouting()

ns3::Ipv4ClickRouting::Ipv4ClickRouting ( )

Constructor.

Definition at line 62 of file ipv4-click-routing.cc.

References AddSimNodeToClickMapping(), m_random, and m_simNode.

+ Here is the call graph for this function:

◆ ~Ipv4ClickRouting()

ns3::Ipv4ClickRouting::~Ipv4ClickRouting ( )
override

Definition at line 73 of file ipv4-click-routing.cc.

Member Function Documentation

◆ AddSimNodeToClickMapping()

void ns3::Ipv4ClickRouting::AddSimNodeToClickMapping ( )
private

Used internally in DoInitialize () to Add a mapping to m_clickInstanceFromSimNode mapping.

Definition at line 263 of file ipv4-click-routing.cc.

References m_clickInstanceFromSimNode, and m_simNode.

Referenced by Ipv4ClickRouting().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::Ipv4ClickRouting::DoDispose ( void  )
overridevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 121 of file ipv4-click-routing.cc.

References ns3::Object::DoDispose(), m_clickInitialised, m_ipv4, and m_simNode.

+ Here is the call graph for this function:

◆ DoInitialize()

void ns3::Ipv4ClickRouting::DoInitialize ( void  )
overrideprotectedvirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 78 of file ipv4-click-routing.cc.

References m_clickFile, m_clickInitialised, m_ipv4, m_nodeName, m_nonDefaultName, m_simNode, NS_ASSERT, and NS_LOG_DEBUG.

◆ GetClickInstanceFromSimNode()

Ptr< Ipv4ClickRouting > ns3::Ipv4ClickRouting::GetClickInstanceFromSimNode ( simclick_node_t simnode)
static

Allows the Click service methods, which reside outside Ipv4ClickRouting, to get the required Ipv4ClickRouting instances.

Parameters
simnodeThe Click simclick_node_t instance for which the Ipv4ClickRouting instance is required
Returns
A Ptr to the required Ipv4ClickRouting instance

Definition at line 269 of file ipv4-click-routing.cc.

References m_clickInstanceFromSimNode.

Referenced by simclick_sim_command(), and simclick_sim_send().

+ Here is the caller graph for this function:

◆ GetDefines()

std::map< std::string, std::string > ns3::Ipv4ClickRouting::GetDefines ( )

Provides for SIMCLICK_GET_DEFINES.

Returns
The defines mapping for .click configuration file parsing

Definition at line 145 of file ipv4-click-routing.cc.

References m_defines.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ GetInterfaceId()

int ns3::Ipv4ClickRouting::GetInterfaceId ( const char *  ifname)

Provides for SIMCLICK_IFID_FROM_NAME.

Parameters
ifnameThe name of the interface
Returns
The interface ID which corresponds to ifname

Definition at line 170 of file ipv4-click-routing.cc.

References INTERFACE_ID_FIRST, INTERFACE_ID_FIRST_DROP, and m_ipv4.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ GetIpAddressFromInterfaceId()

std::string ns3::Ipv4ClickRouting::GetIpAddressFromInterfaceId ( int  ifid)

Provides for SIMCLICK_IPADDR_FROM_NAME.

Parameters
ifidThe interface ID for which the IP Address is required
Returns
The IP Address of the interface in string format

Definition at line 233 of file ipv4-click-routing.cc.

References m_ipv4.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ GetIpPrefixFromInterfaceId()

std::string ns3::Ipv4ClickRouting::GetIpPrefixFromInterfaceId ( int  ifid)

Provides for SIMCLICK_IPPREFIX_FROM_NAME.

Parameters
ifidThe interface ID for which the IP Prefix is required
Returns
The IP Prefix of the interface in string format

Definition at line 242 of file ipv4-click-routing.cc.

References m_ipv4.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ GetMacAddressFromInterfaceId()

std::string ns3::Ipv4ClickRouting::GetMacAddressFromInterfaceId ( int  ifid)

Provides for SIMCLICK_MACADDR_FROM_NAME.

Parameters
ifidThe interface ID for which the MAC Address is required
Returns
The MAC Address of the interface in string format

Definition at line 251 of file ipv4-click-routing.cc.

References ns3::Mac48Address::ConvertFrom(), and m_ipv4.

Referenced by simclick_sim_command().

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

◆ GetNodeName()

std::string ns3::Ipv4ClickRouting::GetNodeName ( )

Provides for SIMCLICK_GET_NODE_NAME.

Returns
The Node name

Definition at line 164 of file ipv4-click-routing.cc.

References m_nodeName.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ GetRandomVariable()

Ptr< UniformRandomVariable > ns3::Ipv4ClickRouting::GetRandomVariable ( )

Get the uniform random variable.

Returns
Uniform random variable.

Definition at line 115 of file ipv4-click-routing.cc.

References m_random.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ GetTimevalFromNow()

struct timeval ns3::Ipv4ClickRouting::GetTimevalFromNow ( ) const
private

Get current simulation time as a timeval.

Returns
Current simulation time as a timeval.

Definition at line 269 of file ipv4-click-routing.cc.

Referenced by RunClickEvent(), and SendPacketToClick().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::Ipv4ClickRouting::GetTypeId ( void  )
static

Get type ID.

Returns
TypeId.

Definition at line 52 of file ipv4-click-routing.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ HandlePacketFromClick()

void ns3::Ipv4ClickRouting::HandlePacketFromClick ( int  ifid,
int  type,
const unsigned char *  data,
int  len 
)

Receives a packet from Click.

Parameters
ifidThe interface ID from which the packet is arriving
typeThe type of packet as defined in click/simclick.h
dataThe contents of the packet
lenThe length of the packet

Definition at line 337 of file ipv4-click-routing.cc.

References data, m_ipv4, NS_LOG_DEBUG, and ns3::Packet::RemoveHeader().

Referenced by simclick_sim_send().

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

◆ HandleScheduleFromClick()

void ns3::Ipv4ClickRouting::HandleScheduleFromClick ( const struct timeval *  when)

Schedules simclick_click_run to run at the given time.

Parameters
whenTime at which the simclick_click_run instance should be run

Definition at line 324 of file ipv4-click-routing.cc.

References ns3::Time::FromInteger(), ns3::Simulator::Now(), NS_LOG_DEBUG, RunClickEvent(), ns3::Time::S, ns3::Simulator::Schedule(), and ns3::Time::US.

Referenced by simclick_sim_command().

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

◆ IsInterfaceReady()

bool ns3::Ipv4ClickRouting::IsInterfaceReady ( int  ifid)

Provides for SIMCLICK_IF_READY.

Parameters
ifidInterface ID
Returns
Returns 1, if the interface is ready, -1 if ifid is invalid

Definition at line 227 of file ipv4-click-routing.cc.

References m_ipv4.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ NotifyAddAddress()

void ns3::Ipv4ClickRouting::NotifyAddAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface

Protocols are expected to implement this method to be notified whenever a new address is added to an interface. Typically used to add a 'network route' on an interface. Can be invoked on an up or down interface.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 586 of file ipv4-click-routing.cc.

◆ NotifyInterfaceDown()

void ns3::Ipv4ClickRouting::NotifyInterfaceDown ( uint32_t  interface)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about

Protocols are expected to implement this method to be notified of the state change of an interface in a node.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 581 of file ipv4-click-routing.cc.

◆ NotifyInterfaceUp()

void ns3::Ipv4ClickRouting::NotifyInterfaceUp ( uint32_t  interface)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about

Protocols are expected to implement this method to be notified of the state change of an interface in a node.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 576 of file ipv4-click-routing.cc.

◆ NotifyRemoveAddress()

void ns3::Ipv4ClickRouting::NotifyRemoveAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface

Protocols are expected to implement this method to be notified whenever a new address is removed from an interface. Typically used to remove the 'network route' of an interface. Can be invoked on an up or down interface.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 591 of file ipv4-click-routing.cc.

◆ PrintRoutingTable()

void ns3::Ipv4ClickRouting::PrintRoutingTable ( Ptr< OutputStreamWrapper stream,
Time::Unit  unit = Time::S 
) const
overridevirtual

Print the Routing Table entries.

Parameters
streamThe ostream the Routing table is printed to
unitThe time unit to be used in the report

Implements ns3::Ipv4RoutingProtocol.

Definition at line 570 of file ipv4-click-routing.cc.

References ns3::OutputStreamWrapper::GetStream().

+ Here is the call graph for this function:

◆ ReadHandler()

std::string ns3::Ipv4ClickRouting::ReadHandler ( std::string  elementName,
std::string  handlerName 
)

Read Handler interface for a node's Click Elements.

Allows a user to read state information of a Click element.

Parameters
elementNamename of the Click element.
handlerNamename of the handler to be read.
Returns
String read.

Definition at line 437 of file ipv4-click-routing.cc.

References m_simNode.

Referenced by RouteOutput().

+ Here is the caller graph for this function:

◆ Receive()

void ns3::Ipv4ClickRouting::Receive ( Ptr< Packet p,
Mac48Address  receiverAddr,
Mac48Address  dest 
)

Allow a lower layer to send data to Click.

(From Ipv4ExtRouting)

Parameters
pThe packet to be sent
receiverAddrReceiving interface's address
destThe Destination MAC address

Definition at line 409 of file ipv4-click-routing.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::Packet::CopyData(), ns3::Packet::GetSize(), m_ipv4, NS_LOG_FUNCTION, and SendPacketToClick().

+ Here is the call graph for this function:

◆ RouteInput()

bool ns3::Ipv4ClickRouting::RouteInput ( Ptr< const Packet p,
const Ipv4Header header,
Ptr< const NetDevice idev,
const UnicastForwardCallback ucb,
const MulticastForwardCallback mcb,
const LocalDeliverCallback lcb,
const ErrorCallback ecb 
)
overridevirtual

Route an input packet (to be forwarded or locally delivered)

This lookup is used in the forwarding process. The packet is handed over to the Ipv4RoutingProtocol, and will get forwarded onward by one of the callbacks. The Linux equivalent is ip_route_input(). There are four valid outcomes, and a matching callbacks to handle each.

Parameters
preceived packet
headerinput parameter used to form a search key for a route
idevPointer to ingress network device
ucbCallback for the case in which the packet is to be forwarded as unicast
mcbCallback for the case in which the packet is to be forwarded as multicast
lcbCallback for the case in which the packet is to be locally delivered
ecbCallback to call if there is an error in forwarding
Returns
true if the Ipv4RoutingProtocol takes responsibility for forwarding or delivering the packet, false otherwise

Implements ns3::Ipv4RoutingProtocol.

Definition at line 557 of file ipv4-click-routing.cc.

References NS_FATAL_ERROR.

◆ RouteOutput()

Ptr< Ipv4Route > ns3::Ipv4ClickRouting::RouteOutput ( Ptr< Packet p,
const Ipv4Header header,
Ptr< NetDevice oif,
Socket::SocketErrno sockerr 
)
overridevirtual

Query routing cache for an existing route, for an outbound packet.

This lookup is used by transport protocols. It does not cause any packet to be forwarded, and is synchronous. Can be used for multicast or unicast. The Linux equivalent is ip_route_output()

The header input parameter may have an uninitialized value for the source address, but the destination address should always be properly set by the caller.

Parameters
ppacket to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer.
headerinput parameter (used to form key to search for the route)
oifOutput interface Netdevice. May be zero, or may be bound via socket options to a particular output interface.
sockerrOutput parameter; socket errno
Returns
a code that indicates what happened in the lookup
Todo:
Implement IP aliasing and Click

Implements ns3::Ipv4RoutingProtocol.

Definition at line 482 of file ipv4-click-routing.cc.

References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::Ipv4Header::GetDestination(), ns3::Ipv4InterfaceAddress::GetLocal(), m_clickRoutingTableElement, m_ipv4, m_nodeName, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, ns3::Ipv4Address::Print(), and ReadHandler().

+ Here is the call graph for this function:

◆ RunClickEvent()

void ns3::Ipv4ClickRouting::RunClickEvent ( )
private

This method has to be scheduled every time Click calls SIMCLICK_SCHEDULE.

Definition at line 314 of file ipv4-click-routing.cc.

References GetTimevalFromNow(), m_simNode, ns3::Simulator::Now(), and NS_LOG_DEBUG.

Referenced by HandleScheduleFromClick().

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

◆ Send()

void ns3::Ipv4ClickRouting::Send ( Ptr< Packet p,
Ipv4Address  src,
Ipv4Address  dest 
)

Allow a higher layer to send data through Click.

(From Ipv4ExtRouting)

Parameters
pThe packet to be sent
srcThe source IP Address
destThe destination IP Address

Definition at line 383 of file ipv4-click-routing.cc.

References ns3::Packet::CopyData(), ns3::Packet::GetSize(), m_ipv4, and SendPacketToClick().

+ Here is the call graph for this function:

◆ SendPacketToClick()

void ns3::Ipv4ClickRouting::SendPacketToClick ( int  ifid,
int  type,
const unsigned char *  data,
int  len 
)

Sends a packet to Click.

Parameters
ifidThe interface ID from which the packet is arriving
typeThe type of packet as defined in click/simclick.h
dataThe contents of the packet
lenThe length of the packet

Definition at line 368 of file ipv4-click-routing.cc.

References data, GetTimevalFromNow(), m_simNode, and NS_LOG_FUNCTION.

Referenced by Receive(), and Send().

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

◆ SetClickFile()

void ns3::Ipv4ClickRouting::SetClickFile ( std::string  clickfile)

Click configuration file to be used by the node's Click Instance.

Parameters
clickfilename of .click configuration file

Definition at line 133 of file ipv4-click-routing.cc.

References m_clickFile.

◆ SetClickRoutingTableElement()

void ns3::Ipv4ClickRouting::SetClickRoutingTableElement ( std::string  name)

Name of the routing table element being used by Click.

Required for RouteOutput ()

Parameters
nameName of the routing table element.

Definition at line 151 of file ipv4-click-routing.cc.

References m_clickRoutingTableElement.

◆ SetDefines()

void ns3::Ipv4ClickRouting::SetDefines ( std::map< std::string, std::string >  defines)

Click defines to be used by the node's Click Instance.

Parameters
definesmapping of defines for .click configuration file parsing

Definition at line 139 of file ipv4-click-routing.cc.

References m_defines.

◆ SetIpv4()

void ns3::Ipv4ClickRouting::SetIpv4 ( Ptr< Ipv4 ipv4)
overridevirtual

Set the Ipv4 instance to be used.

Parameters
ipv4The Ipv4 instance

Implements ns3::Ipv4RoutingProtocol.

Definition at line 109 of file ipv4-click-routing.cc.

References nsclick-simple-lan::ipv4, and m_ipv4.

◆ SetNodeName()

void ns3::Ipv4ClickRouting::SetNodeName ( std::string  name)

Name of the node as to be used by Click.

Required for Click Dumps.

Parameters
nameName to be assigned to the node.

Definition at line 157 of file ipv4-click-routing.cc.

References m_nodeName, and m_nonDefaultName.

◆ SetPromisc()

void ns3::Ipv4ClickRouting::SetPromisc ( int  ifid)

Sets an interface to run on promiscuous mode.

Parameters
ifidInterface ID.

Definition at line 474 of file ipv4-click-routing.cc.

References m_ipv4, and NS_ASSERT.

Referenced by simclick_sim_command().

+ Here is the caller graph for this function:

◆ WriteHandler()

int ns3::Ipv4ClickRouting::WriteHandler ( std::string  elementName,
std::string  handlerName,
std::string  writeString 
)

Write Handler interface for a node's Click Elements.

Allows a user to modify state information of a Click element.

Parameters
elementNamename of the Click element.
handlerNamename of the handler to be read.
writeStringstring to be written using the write handler.
Returns
Write operation status.

Definition at line 455 of file ipv4-click-routing.cc.

References m_simNode.

Friends And Related Function Documentation

◆ ::ClickIfidFromNameTest

friend class ::ClickIfidFromNameTest
friend

Definition at line 62 of file ipv4-click-routing.h.

◆ ::ClickIpMacAddressFromNameTest

friend class ::ClickIpMacAddressFromNameTest
friend

Definition at line 63 of file ipv4-click-routing.h.

◆ ::ClickTrivialTest

friend class ::ClickTrivialTest
friend

Definition at line 61 of file ipv4-click-routing.h.

Member Data Documentation

◆ m_clickFile

std::string ns3::Ipv4ClickRouting::m_clickFile
private

Name of .click configuration file.

Definition at line 291 of file ipv4-click-routing.h.

Referenced by DoInitialize(), and SetClickFile().

◆ m_clickInitialised

bool ns3::Ipv4ClickRouting::m_clickInitialised
private

Whether click has been initialized.

Definition at line 296 of file ipv4-click-routing.h.

Referenced by DoDispose(), and DoInitialize().

◆ m_clickInstanceFromSimNode

std::map< simclick_node_t *, Ptr< Ipv4ClickRouting > > ns3::Ipv4ClickRouting::m_clickInstanceFromSimNode
staticprivate

Provide a mapping between the node reference used by Click and the corresponding Ipv4ClickRouting instance.

Definition at line 146 of file ipv4-click-routing.h.

Referenced by AddSimNodeToClickMapping(), and GetClickInstanceFromSimNode().

◆ m_clickRoutingTableElement

std::string ns3::Ipv4ClickRouting::m_clickRoutingTableElement
private

Name of the routing table element.

Definition at line 294 of file ipv4-click-routing.h.

Referenced by RouteOutput(), and SetClickRoutingTableElement().

◆ m_defines

std::map<std::string, std::string> ns3::Ipv4ClickRouting::m_defines
private

Defines for .click configuration file parsing.

Definition at line 292 of file ipv4-click-routing.h.

Referenced by GetDefines(), and SetDefines().

◆ m_ipv4

◆ m_nodeName

std::string ns3::Ipv4ClickRouting::m_nodeName
private

Name of the node.

Definition at line 293 of file ipv4-click-routing.h.

Referenced by DoInitialize(), GetNodeName(), RouteOutput(), and SetNodeName().

◆ m_nonDefaultName

bool ns3::Ipv4ClickRouting::m_nonDefaultName
private

Whether a non-default name has been set.

Definition at line 297 of file ipv4-click-routing.h.

Referenced by DoInitialize(), and SetNodeName().

◆ m_random

Ptr<UniformRandomVariable> ns3::Ipv4ClickRouting::m_random
private

Uniform random variable.

Definition at line 300 of file ipv4-click-routing.h.

Referenced by Ipv4ClickRouting(), and GetRandomVariable().

◆ m_simNode

simclick_node_t* ns3::Ipv4ClickRouting::m_simNode
private

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