A Discrete-Event Network Simulator
API
RoutingHelper Class Reference

The RoutingHelper class generates routing data between nodes (vehicles) and uses the RoutingStats class to collect statistics on routing data (application-data packet and byte counts). More...

+ Inheritance diagram for RoutingHelper:
+ Collaboration diagram for RoutingHelper:

Public Member Functions

 RoutingHelper ()
 Constructor. More...
 
virtual ~RoutingHelper ()
 Destructor. More...
 
RoutingStatsGetRoutingStats ()
 Returns the RoutingStats instance. More...
 
void Install (NodeContainer &c, NetDeviceContainer &d, Ipv4InterfaceContainer &i, double totalTime, int protocol, uint32_t nSinks, int routingTables)
 Installs routing functionality on nodes and their devices and interfaces. More...
 
void OnOffTrace (std::string context, Ptr< const Packet > packet)
 Trace the receipt of an on-off-application generated packet. More...
 
void SetLogging (int log)
 Enable/disable logging. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this 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...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) 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 (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= ([[maybe_unused]] const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) 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 erros. 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 TypeId GetTypeId (void)
 Get class TypeId. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Member Functions

void AssignIpAddresses (NetDeviceContainer &d, Ipv4InterfaceContainer &adhocTxInterfaces)
 Assigns IPv4 addresses to net devices and their interfaces. More...
 
void ReceiveRoutingPacket (Ptr< Socket > socket)
 Process a received routing packet. More...
 
void SetupRoutingMessages (NodeContainer &c, Ipv4InterfaceContainer &adhocTxInterfaces)
 Sets up routing messages on the nodes and their interfaces. More...
 
Ptr< SocketSetupRoutingPacketReceive (Ipv4Address addr, Ptr< Node > node)
 Sets up a routing packet for tranmission. More...
 
void SetupRoutingProtocol (NodeContainer &c)
 Sets up the protocol protocol on the nodes. More...
 

Private Attributes

int m_log
 log More...
 
uint32_t m_nSinks
 number of sink nodes (< all nodes) More...
 
uint32_t m_port
 port More...
 
uint32_t m_protocol
 routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR More...
 
std::string m_protocolName
 protocol name More...
 
int m_routingTables
 dump routing table (at t=5 sec). 0=No, 1=Yes More...
 
double m_TotalSimTime
 seconds More...
 
RoutingStats routingStats
 routing statistics More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 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 (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

The RoutingHelper class generates routing data between nodes (vehicles) and uses the RoutingStats class to collect statistics on routing data (application-data packet and byte counts).

A routing protocol is configured, and all nodes attempt to send (i.e. route) small packets to another node, which acts as data sinks. Not all nodes act as data sinks. for the vehicular network

Definition at line 371 of file vanet-routing-compare.cc.

Constructor & Destructor Documentation

◆ RoutingHelper()

RoutingHelper::RoutingHelper ( )

Constructor.

Definition at line 487 of file vanet-routing-compare.cc.

◆ ~RoutingHelper()

RoutingHelper::~RoutingHelper ( )
virtual

Destructor.

Definition at line 497 of file vanet-routing-compare.cc.

Member Function Documentation

◆ AssignIpAddresses()

void RoutingHelper::AssignIpAddresses ( NetDeviceContainer d,
Ipv4InterfaceContainer adhocTxInterfaces 
)
private

Assigns IPv4 addresses to net devices and their interfaces.

Parameters
dnet device container
adhocTxInterfacesIPv4 interface container

Definition at line 603 of file vanet-routing-compare.cc.

References ns3::Ipv4AddressHelper::Assign(), NS_LOG_INFO, and ns3::Ipv4AddressHelper::SetBase().

Referenced by Install().

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

◆ GetRoutingStats()

RoutingStats & RoutingHelper::GetRoutingStats ( )

Returns the RoutingStats instance.

Returns
the RoutingStats instance

Definition at line 696 of file vanet-routing-compare.cc.

References routingStats.

Referenced by VanetRoutingExperiment::CheckThroughput(), VanetRoutingExperiment::ProcessOutputs(), and ReceiveRoutingPacket().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId RoutingHelper::GetTypeId ( void  )
static

Get class TypeId.

Returns
the TypeId for the class

Definition at line 479 of file vanet-routing-compare.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ Install()

void RoutingHelper::Install ( NodeContainer c,
NetDeviceContainer d,
Ipv4InterfaceContainer i,
double  totalTime,
int  protocol,
uint32_t  nSinks,
int  routingTables 
)

Installs routing functionality on nodes and their devices and interfaces.

Parameters
cnode container
dnet device container
iIPv4 interface container
totalTimethe total time that nodes should attempt to route data
protocolthe routing protocol (1=OLSR;2=AODV;3=DSDV;4=DSR)
nSinksthe number of nodes which will act as data sinks
routingTablesdump routing tables at t=5 seconds (0=no;1=yes)

Definition at line 502 of file vanet-routing-compare.cc.

References AssignIpAddresses(), m_nSinks, m_protocol, m_routingTables, m_TotalSimTime, SetupRoutingMessages(), and SetupRoutingProtocol().

Referenced by VanetRoutingExperiment::SetupRoutingMessages().

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

◆ OnOffTrace()

void RoutingHelper::OnOffTrace ( std::string  context,
Ptr< const Packet packet 
)

Trace the receipt of an on-off-application generated packet.

Parameters
contextthis object
packeta received packet

Definition at line 689 of file vanet-routing-compare.cc.

References ns3::Packet::GetSize(), RoutingStats::IncTxBytes(), and routingStats.

Referenced by VanetRoutingExperiment::ConfigureApplications().

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

◆ ReceiveRoutingPacket()

void RoutingHelper::ReceiveRoutingPacket ( Ptr< Socket socket)
private

Process a received routing packet.

Parameters
socketthe receiving socket

Definition at line 671 of file vanet-routing-compare.cc.

References GetRoutingStats(), ns3::Packet::GetSize(), RoutingStats::IncRxBytes(), RoutingStats::IncRxPkts(), m_log, m_protocolName, NS_LOG_UNCOND, PrintReceivedRoutingPacket(), and ns3::Socket::RecvFrom().

Referenced by SetupRoutingPacketReceive().

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

◆ SetLogging()

void RoutingHelper::SetLogging ( int  log)

Enable/disable logging.

Parameters
lognon-zero to enable logging

Definition at line 702 of file vanet-routing-compare.cc.

References m_log.

Referenced by VanetRoutingExperiment::ParseCommandLineArguments().

+ Here is the caller graph for this function:

◆ SetupRoutingMessages()

void RoutingHelper::SetupRoutingMessages ( NodeContainer c,
Ipv4InterfaceContainer adhocTxInterfaces 
)
private

Sets up routing messages on the nodes and their interfaces.

Parameters
cnode container
adhocTxInterfacesIPv4 interface container

Definition at line 615 of file vanet-routing-compare.cc.

References ns3::NodeContainer::Get(), ns3::Ipv4InterfaceContainer::GetAddress(), ns3::UniformRandomVariable::GetValue(), ns3::OnOffHelper::Install(), m_nSinks, m_port, m_protocol, m_TotalSimTime, ns3::Seconds(), ns3::OnOffHelper::SetAttribute(), ns3::RandomVariableStream::SetStream(), SetupRoutingPacketReceive(), sink, ns3::ApplicationContainer::Start(), and ns3::ApplicationContainer::Stop().

Referenced by Install().

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

◆ SetupRoutingPacketReceive()

Ptr< Socket > RoutingHelper::SetupRoutingPacketReceive ( Ipv4Address  addr,
Ptr< Node node 
)
private

Sets up a routing packet for tranmission.

Parameters
addrdestination address
nodesource node
Returns
Socket to be used for sending/receiving a routed data packet

Definition at line 521 of file vanet-routing-compare.cc.

References m_port, ns3::MakeCallback(), ReceiveRoutingPacket(), and sink.

Referenced by SetupRoutingMessages().

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

◆ SetupRoutingProtocol()

void RoutingHelper::SetupRoutingProtocol ( NodeContainer c)
private

Sets up the protocol protocol on the nodes.

Parameters
cnode container

Definition at line 533 of file vanet-routing-compare.cc.

References ns3::AsciiTraceHelper::CreateFileStream(), ns3::DsrMainHelper::Install(), ns3::InternetStackHelper::Install(), list, m_log, m_protocol, m_protocolName, m_routingTables, NS_FATAL_ERROR, NS_LOG_UNCOND, ns3::Ipv4RoutingHelper::PrintRoutingTableAllAt(), and ns3::InternetStackHelper::SetRoutingHelper().

Referenced by Install().

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

Member Data Documentation

◆ m_log

int RoutingHelper::m_log
private

log

Definition at line 473 of file vanet-routing-compare.cc.

Referenced by ReceiveRoutingPacket(), SetLogging(), and SetupRoutingProtocol().

◆ m_nSinks

uint32_t RoutingHelper::m_nSinks
private

number of sink nodes (< all nodes)

Definition at line 469 of file vanet-routing-compare.cc.

Referenced by Install(), and SetupRoutingMessages().

◆ m_port

uint32_t RoutingHelper::m_port
private

port

Definition at line 468 of file vanet-routing-compare.cc.

Referenced by SetupRoutingMessages(), and SetupRoutingPacketReceive().

◆ m_protocol

uint32_t RoutingHelper::m_protocol
private

routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR

Definition at line 467 of file vanet-routing-compare.cc.

Referenced by Install(), SetupRoutingMessages(), and SetupRoutingProtocol().

◆ m_protocolName

std::string RoutingHelper::m_protocolName
private

protocol name

Definition at line 472 of file vanet-routing-compare.cc.

Referenced by ReceiveRoutingPacket(), and SetupRoutingProtocol().

◆ m_routingTables

int RoutingHelper::m_routingTables
private

dump routing table (at t=5 sec). 0=No, 1=Yes

Definition at line 470 of file vanet-routing-compare.cc.

Referenced by Install(), and SetupRoutingProtocol().

◆ m_TotalSimTime

double RoutingHelper::m_TotalSimTime
private

seconds

Definition at line 466 of file vanet-routing-compare.cc.

Referenced by Install(), and SetupRoutingMessages().

◆ routingStats

RoutingStats RoutingHelper::routingStats
private

routing statistics

Definition at line 471 of file vanet-routing-compare.cc.

Referenced by GetRoutingStats(), and OnOffTrace().


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