A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::aodv::Neighbors Class Reference

maintain list of active neighbors More...

#include "aodv-neighbor.h"

+ Collaboration diagram for ns3::aodv::Neighbors:

Classes

struct  Neighbor
 Neighbor description. More...
 

Public Member Functions

 Neighbors (Time delay)
 constructor
 
void AddArpCache (Ptr< ArpCache > a)
 Add ARP cache to be used to allow layer 2 notifications processing.
 
void Clear ()
 Remove all entries.
 
void DelArpCache (Ptr< ArpCache > a)
 Don't use given ARP cache any more (interface is down)
 
Callback< void, Ipv4AddressGetCallback () const
 Get link failure callback.
 
Time GetExpireTime (Ipv4Address addr)
 Return expire time for neighbor node with address addr, if exists, else return 0.
 
Callback< void, const WifiMacHeader & > GetTxErrorCallback () const
 Get callback to ProcessTxError.
 
bool IsNeighbor (Ipv4Address addr)
 Check that node with address addr is neighbor.
 
void Purge ()
 Remove all expired entries.
 
void ScheduleTimer ()
 Schedule m_ntimer.
 
void SetCallback (Callback< void, Ipv4Address > cb)
 Set link failure callback.
 
void Update (Ipv4Address addr, Time expire)
 Update expire time for entry with address addr, if it exists, else add new entry.
 

Private Member Functions

Mac48Address LookupMacAddress (Ipv4Address addr)
 Find MAC address by IP using list of ARP caches.
 
void ProcessTxError (const WifiMacHeader &hdr)
 Process layer 2 TX error notification.
 

Private Attributes

std::vector< Ptr< ArpCache > > m_arp
 list of ARP cached to be used for layer 2 notifications processing
 
Callback< void, Ipv4Addressm_handleLinkFailure
 link failure callback
 
std::vector< Neighborm_nb
 vector of entries
 
Timer m_ntimer
 Timer for neighbor's list. Schedule Purge().
 
Callback< void, const WifiMacHeader & > m_txErrorCallback
 TX error callback.
 

Detailed Description

maintain list of active neighbors

Definition at line 53 of file aodv-neighbor.h.

Constructor & Destructor Documentation

◆ Neighbors()

ns3::aodv::Neighbors::Neighbors ( Time  delay)

constructor

Parameters
delaythe delay time for purging the list of neighbors

Definition at line 42 of file aodv-neighbor.cc.

References m_ntimer, m_txErrorCallback, ns3::MakeCallback(), ProcessTxError(), Purge(), ns3::Timer::SetDelay(), and ns3::Timer::SetFunction().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddArpCache()

void ns3::aodv::Neighbors::AddArpCache ( Ptr< ArpCache a)

Add ARP cache to be used to allow layer 2 notifications processing.

Parameters
apointer to the ARP cache to add

Definition at line 150 of file aodv-neighbor.cc.

References m_arp.

Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceUp().

+ Here is the caller graph for this function:

◆ Clear()

void ns3::aodv::Neighbors::Clear ( )
inline

Remove all entries.

Definition at line 114 of file aodv-neighbor.h.

References m_nb.

Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceDown(), and ns3::aodv::RoutingProtocol::NotifyRemoveAddress().

+ Here is the caller graph for this function:

◆ DelArpCache()

void ns3::aodv::Neighbors::DelArpCache ( Ptr< ArpCache a)

Don't use given ARP cache any more (interface is down)

Parameters
apointer to the ARP cache to delete

Definition at line 156 of file aodv-neighbor.cc.

References m_arp.

Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceDown().

+ Here is the caller graph for this function:

◆ GetCallback()

Callback< void, Ipv4Address > ns3::aodv::Neighbors::GetCallback ( ) const
inline

Get link failure callback.

Returns
the link failure callback

Definition at line 152 of file aodv-neighbor.h.

References m_handleLinkFailure.

◆ GetExpireTime()

Time ns3::aodv::Neighbors::GetExpireTime ( Ipv4Address  addr)

Return expire time for neighbor node with address addr, if exists, else return 0.

Parameters
addrthe IP address of the neighbor node
Returns
the expire time for the neighbor node

Definition at line 65 of file aodv-neighbor.cc.

References m_nb, ns3::Simulator::Now(), Purge(), and ns3::Seconds().

Referenced by ns3::aodv::NeighborTest::DoRun().

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

◆ GetTxErrorCallback()

Callback< void, const WifiMacHeader & > ns3::aodv::Neighbors::GetTxErrorCallback ( ) const
inline

Get callback to ProcessTxError.

Returns
the callback function

Definition at line 134 of file aodv-neighbor.h.

References m_txErrorCallback.

Referenced by ns3::aodv::RoutingProtocol::NotifyTxError().

+ Here is the caller graph for this function:

◆ IsNeighbor()

bool ns3::aodv::Neighbors::IsNeighbor ( Ipv4Address  addr)

Check that node with address addr is neighbor.

Parameters
addrthe IP address to check
Returns
true if the node with IP address is a neighbor

Definition at line 51 of file aodv-neighbor.cc.

References m_nb, and Purge().

Referenced by ns3::aodv::NeighborTest::CheckTimeout1(), ns3::aodv::NeighborTest::CheckTimeout2(), ns3::aodv::NeighborTest::CheckTimeout3(), and ns3::aodv::NeighborTest::DoRun().

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

◆ LookupMacAddress()

Mac48Address ns3::aodv::Neighbors::LookupMacAddress ( Ipv4Address  addr)
private

Find MAC address by IP using list of ARP caches.

Parameters
addrthe IP address to lookup
Returns
the MAC address for the IP address

Definition at line 162 of file aodv-neighbor.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::ArpCache::Entry::GetMacAddress(), ns3::ArpCache::Entry::IsAlive(), ns3::ArpCache::Entry::IsExpired(), ns3::ArpCache::Entry::IsPermanent(), and m_arp.

Referenced by Update().

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

◆ ProcessTxError()

void ns3::aodv::Neighbors::ProcessTxError ( const WifiMacHeader hdr)
private

Process layer 2 TX error notification.

Parameters
hdrheader of the packet

Definition at line 178 of file aodv-neighbor.cc.

References ns3::WifiMacHeader::GetAddr1(), m_nb, and Purge().

Referenced by Neighbors().

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

◆ Purge()

void ns3::aodv::Neighbors::Purge ( )

Remove all expired entries.

Definition at line 118 of file aodv-neighbor.cc.

References ns3::Timer::Cancel(), m_handleLinkFailure, m_nb, m_ntimer, NS_LOG_LOGIC, and ns3::Timer::Schedule().

Referenced by Neighbors(), GetExpireTime(), IsNeighbor(), ProcessTxError(), and Update().

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

◆ ScheduleTimer()

void ns3::aodv::Neighbors::ScheduleTimer ( )

Schedule m_ntimer.

Definition at line 143 of file aodv-neighbor.cc.

References ns3::Timer::Cancel(), m_ntimer, and ns3::Timer::Schedule().

Referenced by ns3::aodv::RoutingProtocol::Start().

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

◆ SetCallback()

void ns3::aodv::Neighbors::SetCallback ( Callback< void, Ipv4Address cb)
inline

Set link failure callback.

Parameters
cbthe callback function

Definition at line 143 of file aodv-neighbor.h.

References m_handleLinkFailure.

Referenced by ns3::aodv::RoutingProtocol::RoutingProtocol(), and ns3::aodv::NeighborTest::DoRun().

+ Here is the caller graph for this function:

◆ Update()

void ns3::aodv::Neighbors::Update ( Ipv4Address  addr,
Time  expire 
)

Update expire time for entry with address addr, if it exists, else add new entry.

Parameters
addrthe IP address to check
expirethe expire time for the address

Definition at line 79 of file aodv-neighbor.cc.

References LookupMacAddress(), m_nb, ns3::Simulator::Now(), NS_LOG_LOGIC, and Purge().

Referenced by ns3::aodv::NeighborTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvRequest(), and ns3::aodv::RoutingProtocol::RouteInput().

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

Member Data Documentation

◆ m_arp

std::vector<Ptr<ArpCache> > ns3::aodv::Neighbors::m_arp
private

list of ARP cached to be used for layer 2 notifications processing

Definition at line 167 of file aodv-neighbor.h.

Referenced by AddArpCache(), DelArpCache(), and LookupMacAddress().

◆ m_handleLinkFailure

Callback<void, Ipv4Address> ns3::aodv::Neighbors::m_handleLinkFailure
private

link failure callback

Definition at line 159 of file aodv-neighbor.h.

Referenced by GetCallback(), Purge(), and SetCallback().

◆ m_nb

std::vector<Neighbor> ns3::aodv::Neighbors::m_nb
private

vector of entries

Definition at line 165 of file aodv-neighbor.h.

Referenced by Clear(), GetExpireTime(), IsNeighbor(), ProcessTxError(), Purge(), and Update().

◆ m_ntimer

Timer ns3::aodv::Neighbors::m_ntimer
private

Timer for neighbor's list. Schedule Purge().

Definition at line 163 of file aodv-neighbor.h.

Referenced by Neighbors(), Purge(), and ScheduleTimer().

◆ m_txErrorCallback

Callback<void, const WifiMacHeader&> ns3::aodv::Neighbors::m_txErrorCallback
private

TX error callback.

Definition at line 161 of file aodv-neighbor.h.

Referenced by Neighbors(), and GetTxErrorCallback().


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