maintain list of active neighbors More...
#include "aodv-neighbor.h"
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, Ipv4Address > | GetCallback () 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, Ipv4Address > | m_handleLinkFailure |
link failure callback | |
std::vector< Neighbor > | m_nb |
vector of entries | |
Timer | m_ntimer |
Timer for neighbor's list. Schedule Purge(). | |
Callback< void, const WifiMacHeader & > | m_txErrorCallback |
TX error callback. | |
maintain list of active neighbors
Definition at line 42 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 31 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 139 of file aodv-neighbor.cc.
References m_arp.
Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceUp().
|
inline |
Remove all entries.
Definition at line 103 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 145 of file aodv-neighbor.cc.
References m_arp.
Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceDown().
|
inline |
Get link failure callback.
Definition at line 141 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 54 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 123 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 40 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 151 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 167 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 107 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 132 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 132 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 68 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().
list of ARP cached to be used for layer 2 notifications processing
Definition at line 156 of file aodv-neighbor.h.
Referenced by AddArpCache(), DelArpCache(), and LookupMacAddress().
|
private |
link failure callback
Definition at line 148 of file aodv-neighbor.h.
Referenced by GetCallback(), Purge(), and SetCallback().
|
private |
vector of entries
Definition at line 154 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 152 of file aodv-neighbor.h.
Referenced by Neighbors(), Purge(), and ScheduleTimer().
|
private |
TX error callback.
Definition at line 150 of file aodv-neighbor.h.
Referenced by Neighbors(), and GetTxErrorCallback().