A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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.
 
 ~Ipv4ClickRouting () override
 
void DoDispose () override
 Destructor implementation.
 
std::map< std::string, std::string > GetDefines ()
 Provides for SIMCLICK_GET_DEFINES.
 
int GetInterfaceId (const char *ifname)
 Provides for SIMCLICK_IFID_FROM_NAME.
 
std::string GetIpAddressFromInterfaceId (int ifid)
 Provides for SIMCLICK_IPADDR_FROM_NAME.
 
std::string GetIpPrefixFromInterfaceId (int ifid)
 Provides for SIMCLICK_IPPREFIX_FROM_NAME.
 
std::string GetMacAddressFromInterfaceId (int ifid)
 Provides for SIMCLICK_MACADDR_FROM_NAME.
 
std::string GetNodeName ()
 Provides for SIMCLICK_GET_NODE_NAME.
 
Ptr< UniformRandomVariableGetRandomVariable ()
 Get the uniform random variable.
 
void HandlePacketFromClick (int ifid, int type, const unsigned char *data, int len)
 Receives a packet from Click.
 
void HandleScheduleFromClick (const struct timeval *when)
 Schedules simclick_click_run to run at the given time.
 
bool IsInterfaceReady (int ifid)
 Provides for SIMCLICK_IF_READY.
 
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.
 
std::string ReadHandler (std::string elementName, std::string handlerName)
 Read Handler interface for a node's Click Elements.
 
void Receive (Ptr< Packet > p, Mac48Address receiverAddr, Mac48Address dest)
 Allow a lower layer to send data to Click.
 
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)
 
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.
 
void Send (Ptr< Packet > p, Ipv4Address src, Ipv4Address dest)
 Allow a higher layer to send data through Click.
 
void SendPacketToClick (int ifid, int type, const unsigned char *data, int len)
 Sends a packet to Click.
 
void SetClickFile (std::string clickfile)
 Click configuration file to be used by the node's Click Instance.
 
void SetClickRoutingTableElement (std::string name)
 Name of the routing table element being used by Click.
 
void SetDefines (std::map< std::string, std::string > defines)
 Click defines to be used by the node's Click Instance.
 
void SetIpv4 (Ptr< Ipv4 > ipv4) override
 Set the Ipv4 instance to be used.
 
void SetNodeName (std::string name)
 Name of the node as to be used by Click.
 
void SetPromisc (int ifid)
 Sets an interface to run on promiscuous mode.
 
int WriteHandler (std::string elementName, std::string handlerName, std::string writeString)
 Write Handler interface for a node's Click Elements.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

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.
 
static TypeId GetTypeId ()
 Get type ID.
 
- Static Public Member Functions inherited from ns3::Ipv4RoutingProtocol
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Protected Member Functions

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

Private Member Functions

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

Private Attributes

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

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.
 

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)
 
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_tLocalDeliverCallback
 Callback for packets to be locally delivered.
 
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
 Callback for multicast packets to be forwarded.
 
typedef Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
 Callback for unicast packets to be forwarded.
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ Ipv4ClickRouting()

ns3::Ipv4ClickRouting::Ipv4ClickRouting ( )

Constructor.

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

References AddSimNodeToClickMapping(), ns3::CreateObject(), m_random, and m_simNode.

+ Here is the call graph for this function:

◆ ~Ipv4ClickRouting()

ns3::Ipv4ClickRouting::~Ipv4ClickRouting ( )
override

Definition at line 62 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 252 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 ( )
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 110 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 ( )
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 67 of file ipv4-click-routing.cc.

References ns3::Object::GetObject(), m_clickFile, m_clickInitialised, m_ipv4, m_nodeName, m_nonDefaultName, m_simNode, NS_ASSERT, and NS_LOG_DEBUG.

+ Here is the call graph for this function:

◆ 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 258 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 134 of file ipv4-click-routing.cc.

References m_defines.

◆ 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 159 of file ipv4-click-routing.cc.

References ns3::Ipv4::GetNInterfaces(), INTERFACE_ID_FIRST, INTERFACE_ID_FIRST_DROP, and m_ipv4.

+ Here is the call 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 222 of file ipv4-click-routing.cc.

References ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), m_ipv4, and ns3::Ipv4Address::Print().

+ Here is the call 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 231 of file ipv4-click-routing.cc.

References ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetMask(), m_ipv4, and ns3::Ipv4Mask::Print().

+ Here is the call 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 240 of file ipv4-click-routing.cc.

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

+ Here is the call graph for this function:

◆ GetNodeName()

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

Provides for SIMCLICK_GET_NODE_NAME.

Returns
The Node name

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

References m_nodeName.

◆ GetRandomVariable()

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

Get the uniform random variable.

Returns
Uniform random variable.

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

References m_random.

◆ 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 264 of file ipv4-click-routing.cc.

References ns3::Time::GetFemtoSeconds(), ns3::Time::GetMicroSeconds(), ns3::Time::GetNanoSeconds(), ns3::Time::GetPicoSeconds(), and ns3::Time::GetSeconds().

Referenced by RunClickEvent(), and SendPacketToClick().

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

◆ GetTypeId()

TypeId ns3::Ipv4ClickRouting::GetTypeId ( )
static

Get type ID.

Returns
TypeId.

Definition at line 41 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 326 of file ipv4-click-routing.cc.

References ns3::Create(), data, ns3::DynamicCast(), m_ipv4, and NS_LOG_DEBUG.

+ Here is the call 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 313 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.

+ Here is the call 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 216 of file ipv4-click-routing.cc.

References ns3::Ipv4::GetNInterfaces(), and m_ipv4.

+ Here is the call 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 575 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 570 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 565 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 580 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 559 of file ipv4-click-routing.cc.

◆ 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 426 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 398 of file ipv4-click-routing.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::Ipv4::GetNetDevice(), ns3::Ipv4::GetNInterfaces(), 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 546 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 471 of file ipv4-click-routing.cc.

References ns3::Create(), ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::Ipv4::GetAddress(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4::GetNAddresses(), ns3::Ipv4::GetNetDevice(), 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 303 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 372 of file ipv4-click-routing.cc.

References ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4::GetNInterfaces(), 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 357 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 122 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 140 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 128 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 98 of file ipv4-click-routing.cc.

References 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 146 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 463 of file ipv4-click-routing.cc.

References ns3::DynamicCast(), m_ipv4, and NS_ASSERT.

+ Here is the call 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 444 of file ipv4-click-routing.cc.

References m_simNode.

Friends And Related Symbol Documentation

◆ ::ClickIfidFromNameTest

friend class ::ClickIfidFromNameTest
friend

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

◆ ::ClickIpMacAddressFromNameTest

friend class ::ClickIpMacAddressFromNameTest
friend

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

◆ ::ClickTrivialTest

friend class ::ClickTrivialTest
friend

Definition at line 50 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 280 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 285 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 135 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 283 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 281 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 282 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 286 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 289 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: