maintain list of active neighbors More...
#include "aodv-neighbor.h"
Classes | |
struct | Neighbor |
Neighbor description. More... | |
Public Member Functions | |
Neighbors (Time delay) | |
constructor More... | |
void | AddArpCache (Ptr< ArpCache > a) |
Add ARP cache to be used to allow layer 2 notifications processing. More... | |
void | Clear () |
Remove all entries. More... | |
void | DelArpCache (Ptr< ArpCache > a) |
Don't use given ARP cache any more (interface is down) More... | |
Callback< void, Ipv4Address > | GetCallback () const |
Get link failure callback. More... | |
Time | GetExpireTime (Ipv4Address addr) |
Return expire time for neighbor node with address addr, if exists, else return 0. More... | |
Callback< void, const WifiMacHeader & > | GetTxErrorCallback () const |
Get callback to ProcessTxError. More... | |
bool | IsNeighbor (Ipv4Address addr) |
Check that node with address addr is neighbor. More... | |
void | Purge () |
Remove all expired entries. More... | |
void | ScheduleTimer () |
Schedule m_ntimer. More... | |
void | SetCallback (Callback< void, Ipv4Address > cb) |
Set link failure callback. More... | |
void | Update (Ipv4Address addr, Time expire) |
Update expire time for entry with address addr, if it exists, else add new entry. More... | |
Private Member Functions | |
Mac48Address | LookupMacAddress (Ipv4Address addr) |
Find MAC address by IP using list of ARP caches. More... | |
void | ProcessTxError (const WifiMacHeader &hdr) |
Process layer 2 TX error notification. More... | |
Private Attributes | |
std::vector< Ptr< ArpCache > > | m_arp |
list of ARP cached to be used for layer 2 notifications processing More... | |
Callback< void, Ipv4Address > | m_handleLinkFailure |
link failure callback More... | |
std::vector< Neighbor > | m_nb |
vector of entries More... | |
Timer | m_ntimer |
Timer for neighbor's list. Schedule Purge(). More... | |
Callback< void, const WifiMacHeader & > | m_txErrorCallback |
TX error callback. More... | |
maintain list of active neighbors
Definition at line 53 of file aodv-neighbor.h.
ns3::aodv::Neighbors::Neighbors | ( | Time | delay | ) |
constructor
delay | the 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().
Add ARP cache to be used to allow layer 2 notifications processing.
a | pointer to the ARP cache to add |
Definition at line 150 of file aodv-neighbor.cc.
References m_arp.
Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceUp().
|
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().
Don't use given ARP cache any more (interface is down)
a | pointer to the ARP cache to delete |
Definition at line 156 of file aodv-neighbor.cc.
References m_arp.
Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceDown().
|
inline |
Get link failure callback.
Definition at line 152 of file aodv-neighbor.h.
References m_handleLinkFailure.
Time ns3::aodv::Neighbors::GetExpireTime | ( | Ipv4Address | addr | ) |
Return expire time for neighbor node with address addr, if exists, else return 0.
addr | the IP address of 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().
|
inline |
Get callback to ProcessTxError.
Definition at line 134 of file aodv-neighbor.h.
References m_txErrorCallback.
Referenced by ns3::aodv::RoutingProtocol::NotifyTxError().
bool ns3::aodv::Neighbors::IsNeighbor | ( | Ipv4Address | addr | ) |
Check that node with address addr is neighbor.
addr | the IP address to check |
Definition at line 51 of file aodv-neighbor.cc.
Referenced by ns3::aodv::NeighborTest::CheckTimeout1(), ns3::aodv::NeighborTest::CheckTimeout2(), ns3::aodv::NeighborTest::CheckTimeout3(), and ns3::aodv::NeighborTest::DoRun().
|
private |
Find MAC address by IP using list of ARP caches.
addr | the IP address to lookup |
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().
|
private |
Process layer 2 TX error notification.
hdr | header of the packet |
Definition at line 178 of file aodv-neighbor.cc.
References ns3::WifiMacHeader::GetAddr1(), m_nb, and Purge().
Referenced by Neighbors().
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().
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().
|
inline |
Set link failure callback.
cb | the 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().
void ns3::aodv::Neighbors::Update | ( | Ipv4Address | addr, |
Time | expire | ||
) |
Update expire time for entry with address addr, if it exists, else add new entry.
addr | the IP address to check |
expire | the expire time for the address |
Definition at line 79 of file aodv-neighbor.cc.
References LookupMacAddress(), m_nb, max, 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().
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().
|
private |
link failure callback
Definition at line 159 of file aodv-neighbor.h.
Referenced by GetCallback(), Purge(), and SetCallback().
|
private |
vector of entries
Definition at line 165 of file aodv-neighbor.h.
Referenced by Clear(), GetExpireTime(), IsNeighbor(), ProcessTxError(), Purge(), and Update().
|
private |
Timer for neighbor's list. Schedule Purge().
Definition at line 163 of file aodv-neighbor.h.
Referenced by Neighbors(), Purge(), and ScheduleTimer().
|
private |
TX error callback.
Definition at line 161 of file aodv-neighbor.h.
Referenced by Neighbors(), and GetTxErrorCallback().