A Discrete-Event Network Simulator
API
ns3::dsr::DsrOptions Class Referenceabstract

#include "dsr-options.h"

+ Inheritance diagram for ns3::dsr::DsrOptions:
+ Collaboration diagram for ns3::dsr::DsrOptions:

Public Member Functions

 DsrOptions ()
 Constructor. More...
 
 ~DsrOptions () override
 Destructor. More...
 
bool CheckDuplicates (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
 Check if the route already contains the node ip address. More...
 
bool ContainAddressAfter (Ipv4Address ipv4Address, Ipv4Address destAddress, std::vector< Ipv4Address > &nodeList)
 Search for the ipv4 address in the node list. More...
 
std::vector< Ipv4AddressCutRoute (Ipv4Address ipv4Address, std::vector< Ipv4Address > &nodeList)
 Cut the route from ipv4Address to the end of the route vector. More...
 
uint32_t GetIDfromIP (Ipv4Address address)
 Get the node id with Ipv4Address. More...
 
Ptr< NodeGetNode () const
 Get the node. More...
 
Ptr< NodeGetNodeWithAddress (Ipv4Address ipv4Address)
 Get the node object with Ipv4Address. More...
 
virtual uint8_t GetOptionNumber () const =0
 Get the option number. More...
 
bool IfDuplicates (std::vector< Ipv4Address > &vec, std::vector< Ipv4Address > &vec2)
 Check if the two vectors contain duplicate or not. More...
 
void PrintVector (std::vector< Ipv4Address > &vec)
 Print out the elements in the route vector. More...
 
virtual uint8_t Process (Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)=0
 Process method. More...
 
void RemoveDuplicates (std::vector< Ipv4Address > &vec)
 Remove the duplicates from the route. More...
 
bool ReverseRoutes (std::vector< Ipv4Address > &vec)
 Reverse the routes. More...
 
Ipv4Address ReverseSearchNextHop (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
 Reverse search for the next hop in the route. More...
 
Ipv4Address ReverseSearchNextTwoHop (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
 Reverse search for the next two hop in the route. More...
 
void ScheduleReply (Ptr< Packet > &packet, std::vector< Ipv4Address > &nodeList, Ipv4Address &source, Ipv4Address &destination)
 Schedule the intermediate node route request broadcast. More...
 
Ipv4Address SearchNextHop (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
 Search for the next hop in the route. More...
 
void SetNode (Ptr< Node > node)
 Set the node. More...
 
virtual Ptr< Ipv4RouteSetRoute (Ipv4Address nextHop, Ipv4Address srcAddress)
 Set the route to use for data packets, used by the option headers when sending data/control packets. 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 TypeId GetTypeId ()
 Get the type identificator. 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 Attributes

Time ActiveRouteTimeout
 The active route timeout value. More...
 
Ipv4Address Broadcast
 The broadcast IP address. More...
 
TracedCallback< Ptr< const Packet > > m_dropTrace
 Drop trace callback. More...
 
std::vector< Ipv4Addressm_finalRoute
 The vector of final Ipv4 address. More...
 
Ptr< Ipv4m_ipv4
 The ipv4. More...
 
std::vector< Ipv4Addressm_ipv4Address
 The vector of Ipv4 address. More...
 
Ptr< Ipv4Routem_ipv4Route
 The ipv4 route. More...
 
Ptr< dsr::DsrRouteCachem_routeCache
 The route cache table. More...
 
Ptr< dsr::DsrRreqTablem_rreqTable
 The route request table. More...
 
TracedCallback< const DsrOptionSRHeader & > m_rxPacketTrace
 The receive trace back, only triggered when final destination receive data packet. More...
 

Private Attributes

Ptr< Nodem_node
 the node More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose ()
 Destructor implementation. More...
 
virtual void DoInitialize ()
 Initialize() implementation. 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...
 

Detailed Description

Definition at line 75 of file dsr-options.h.

Constructor & Destructor Documentation

◆ DsrOptions()

ns3::dsr::DsrOptions::DsrOptions ( )

Constructor.

Definition at line 98 of file dsr-options.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ ~DsrOptions()

ns3::dsr::DsrOptions::~DsrOptions ( )
override

Destructor.

Definition at line 103 of file dsr-options.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

◆ CheckDuplicates()

bool ns3::dsr::DsrOptions::CheckDuplicates ( Ipv4Address  ipv4Address,
std::vector< Ipv4Address > &  vec 
)

Check if the route already contains the node ip address.

Parameters
ipv4Addressthe IPv4 address that we are looking for
vecList of IPv4 addresses
Returns
true if it already exists

Definition at line 292 of file dsr-options.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process().

+ Here is the caller graph for this function:

◆ ContainAddressAfter()

bool ns3::dsr::DsrOptions::ContainAddressAfter ( Ipv4Address  ipv4Address,
Ipv4Address  destAddress,
std::vector< Ipv4Address > &  nodeList 
)

Search for the ipv4 address in the node list.

Parameters
ipv4AddressIPv4 address to search for
destAddressIPv4 address in the list that we begin the search
nodeListList of IPv4 addresses
Returns
true if contain ip address

Definition at line 123 of file dsr-options.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionSR::Process().

+ Here is the caller graph for this function:

◆ CutRoute()

std::vector< Ipv4Address > ns3::dsr::DsrOptions::CutRoute ( Ipv4Address  ipv4Address,
std::vector< Ipv4Address > &  nodeList 
)

Cut the route from ipv4Address to the end of the route vector.

Parameters
ipv4Addressthe address to begin cutting
nodeListList of IPv4 addresses
Returns
the vector after the route cut

Definition at line 141 of file dsr-options.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRrep::Process().

+ Here is the caller graph for this function:

◆ GetIDfromIP()

uint32_t ns3::dsr::DsrOptions::GetIDfromIP ( Ipv4Address  address)

Get the node id with Ipv4Address.

Parameters
addressIPv4 address to look for ID
Returns
the id of the node

Definition at line 343 of file dsr-options.cc.

References first::address, ns3::NodeList::GetNNodes(), ns3::NodeList::GetNode(), ns3::Object::GetObject(), nsclick-simple-lan::ipv4, and NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process(), and ns3::dsr::DsrOptionRrep::Process().

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

◆ GetNode()

Ptr< Node > ns3::dsr::DsrOptions::GetNode ( ) const

Get the node.

Returns
the node

Definition at line 116 of file dsr-options.cc.

References m_node, and NS_LOG_FUNCTION_NOARGS.

◆ GetNodeWithAddress()

Ptr< Node > ns3::dsr::DsrOptions::GetNodeWithAddress ( Ipv4Address  ipv4Address)

Get the node object with Ipv4Address.

Parameters
ipv4AddressIPv4 address of the node
Returns
the object of the node

Definition at line 360 of file dsr-options.cc.

References ns3::NodeList::GetNNodes(), ns3::NodeList::GetNode(), ns3::Object::GetObject(), nsclick-simple-lan::ipv4, and NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRerr::DoSendError(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::dsr::DsrOptionAckReq::Process(), and ns3::dsr::DsrOptionAck::Process().

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

◆ GetOptionNumber()

virtual uint8_t ns3::dsr::DsrOptions::GetOptionNumber ( ) const
pure virtual

Get the option number.

Returns
option number

Implemented in ns3::dsr::DsrOptionAck, ns3::dsr::DsrOptionAckReq, ns3::dsr::DsrOptionRerr, ns3::dsr::DsrOptionSR, ns3::dsr::DsrOptionRrep, ns3::dsr::DsrOptionRreq, ns3::dsr::DsrOptionPadn, and ns3::dsr::DsrOptionPad1.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::dsr::DsrOptions::GetTypeId ( void  )
static

Get the type identificator.

Returns
type identificator

Definition at line 77 of file dsr-options.cc.

References GetOptionNumber(), m_dropTrace, m_rxPacketTrace, ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ IfDuplicates()

bool ns3::dsr::DsrOptions::IfDuplicates ( std::vector< Ipv4Address > &  vec,
std::vector< Ipv4Address > &  vec2 
)

Check if the two vectors contain duplicate or not.

Parameters
vecthe first list of IPv4 addresses
vec2the second list of IPv4 addresses
Returns
true if contains duplicate

Definition at line 275 of file dsr-options.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process().

+ Here is the caller graph for this function:

◆ PrintVector()

void ns3::dsr::DsrOptions::PrintVector ( std::vector< Ipv4Address > &  vec)

Print out the elements in the route vector.

Parameters
vecThe route vector to print.

Definition at line 254 of file dsr-options.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::dsr::DsrOptionSR::Process(), and RemoveDuplicates().

+ Here is the caller graph for this function:

◆ Process()

virtual uint8_t ns3::dsr::DsrOptions::Process ( Ptr< Packet packet,
Ptr< Packet dsrP,
Ipv4Address  ipv4Address,
Ipv4Address  source,
const Ipv4Header ipv4Header,
uint8_t  protocol,
bool &  isPromisc,
Ipv4Address  promiscSource 
)
pure virtual

Process method.

Called from DsrRouting::Receive.

Parameters
packetthe packet
dsrPthe clean packet with payload
ipv4Addressthe IPv4 address
sourceIPv4 address of the source
ipv4Headerthe IPv4 header of packet received
protocolthe protocol number of the up layer
isPromiscif the packet must be dropped
promiscSourceIPv4 address
Returns
the processed size

Implemented in ns3::dsr::DsrOptionAck, ns3::dsr::DsrOptionAckReq, ns3::dsr::DsrOptionRerr, ns3::dsr::DsrOptionSR, ns3::dsr::DsrOptionRrep, ns3::dsr::DsrOptionRreq, ns3::dsr::DsrOptionPadn, and ns3::dsr::DsrOptionPad1.

◆ RemoveDuplicates()

void ns3::dsr::DsrOptions::RemoveDuplicates ( std::vector< Ipv4Address > &  vec)

Remove the duplicates from the route.

Parameters
[in,out]vecList of IPv4 addresses to clean

Definition at line 306 of file dsr-options.cc.

References NS_LOG_FUNCTION, and PrintVector().

Referenced by ns3::dsr::DsrOptionRrep::Process().

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

◆ ReverseRoutes()

bool ns3::dsr::DsrOptions::ReverseRoutes ( std::vector< Ipv4Address > &  vec)

Reverse the routes.

Parameters
vecList of IPv4 addresses
Returns
true if successfully reversed

Definition at line 165 of file dsr-options.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process().

+ Here is the caller graph for this function:

◆ ReverseSearchNextHop()

Ipv4Address ns3::dsr::DsrOptions::ReverseSearchNextHop ( Ipv4Address  ipv4Address,
std::vector< Ipv4Address > &  vec 
)

Reverse search for the next hop in the route.

Parameters
ipv4Addressthe IPv4 address of the node we are looking for its next hop address
vecList of IPv4 addresses
Returns
the previous next hop address if found

Definition at line 208 of file dsr-options.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process(), and ns3::dsr::DsrOptionRrep::Process().

+ Here is the caller graph for this function:

◆ ReverseSearchNextTwoHop()

Ipv4Address ns3::dsr::DsrOptions::ReverseSearchNextTwoHop ( Ipv4Address  ipv4Address,
std::vector< Ipv4Address > &  vec 
)

Reverse search for the next two hop in the route.

Parameters
ipv4Addressthe IPv4 address of the node we are looking for its next two hop address
vecList of IPv4 addresses
Returns
the previous next two hop address if found

Definition at line 234 of file dsr-options.cc.

References NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ ScheduleReply()

void ns3::dsr::DsrOptions::ScheduleReply ( Ptr< Packet > &  packet,
std::vector< Ipv4Address > &  nodeList,
Ipv4Address source,
Ipv4Address destination 
)

Schedule the intermediate node route request broadcast.

Parameters
packetthe original packet
nodeListThe list of IPv4 addresses
sourceaddress
destinationaddress

◆ SearchNextHop()

Ipv4Address ns3::dsr::DsrOptions::SearchNextHop ( Ipv4Address  ipv4Address,
std::vector< Ipv4Address > &  vec 
)

Search for the next hop in the route.

Parameters
ipv4Addressthe IPv4 address of the node we are looking for its next hop address
vecList of IPv4 addresses
Returns
the next hop address if found

Definition at line 175 of file dsr-options.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), and ns3::dsr::DsrOptionSR::Process().

+ Here is the caller graph for this function:

◆ SetNode()

void ns3::dsr::DsrOptions::SetNode ( Ptr< Node node)

Set the node.

Parameters
nodethe node to set

Definition at line 109 of file dsr-options.cc.

References m_node, and NS_LOG_FUNCTION.

◆ SetRoute()

Ptr< Ipv4Route > ns3::dsr::DsrOptions::SetRoute ( Ipv4Address  nextHop,
Ipv4Address  srcAddress 
)
virtual

Set the route to use for data packets, used by the option headers when sending data/control packets.

Parameters
nextHopIPv4 address of the next hop
srcAddressIPv4 address of the source
Returns
the route

Definition at line 154 of file dsr-options.cc.

References m_ipv4Route, and NS_LOG_FUNCTION.

Referenced by ns3::dsr::DsrOptionRerr::DoSendError(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), and ns3::dsr::DsrOptionSR::Process().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ActiveRouteTimeout

Time ns3::dsr::DsrOptions::ActiveRouteTimeout
protected

The active route timeout value.

Definition at line 276 of file dsr-options.h.

Referenced by ns3::dsr::DsrOptionRreq::Process(), and ns3::dsr::DsrOptionRrep::Process().

◆ Broadcast

Ipv4Address ns3::dsr::DsrOptions::Broadcast
protected

The broadcast IP address.

Definition at line 248 of file dsr-options.h.

◆ m_dropTrace

TracedCallback<Ptr<const Packet> > ns3::dsr::DsrOptions::m_dropTrace
protected

◆ m_finalRoute

std::vector<Ipv4Address> ns3::dsr::DsrOptions::m_finalRoute
protected

The vector of final Ipv4 address.

Definition at line 272 of file dsr-options.h.

Referenced by ns3::dsr::DsrOptionRreq::Process().

◆ m_ipv4

Ptr<Ipv4> ns3::dsr::DsrOptions::m_ipv4
protected

The ipv4.

Definition at line 264 of file dsr-options.h.

◆ m_ipv4Address

std::vector<Ipv4Address> ns3::dsr::DsrOptions::m_ipv4Address
protected

The vector of Ipv4 address.

Definition at line 268 of file dsr-options.h.

◆ m_ipv4Route

Ptr<Ipv4Route> ns3::dsr::DsrOptions::m_ipv4Route
protected

◆ m_node

Ptr<Node> ns3::dsr::DsrOptions::m_node
private

the node

Definition at line 283 of file dsr-options.h.

Referenced by GetNode(), and SetNode().

◆ m_routeCache

Ptr<dsr::DsrRouteCache> ns3::dsr::DsrOptions::m_routeCache
protected

The route cache table.

Definition at line 256 of file dsr-options.h.

◆ m_rreqTable

Ptr<dsr::DsrRreqTable> ns3::dsr::DsrOptions::m_rreqTable
protected

The route request table.

Definition at line 252 of file dsr-options.h.

◆ m_rxPacketTrace

TracedCallback<const DsrOptionSRHeader&> ns3::dsr::DsrOptions::m_rxPacketTrace
protected

The receive trace back, only triggered when final destination receive data packet.

Definition at line 280 of file dsr-options.h.

Referenced by GetTypeId().


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