20#include "ns3/wifi-mac-header.h"
32 : m_ntimer(
Timer::CANCEL_ON_DESTROY)
43 for (
auto i =
m_nb.begin(); i !=
m_nb.end(); ++i)
45 if (i->m_neighborAddress == addr)
57 for (
auto i =
m_nb.begin(); i !=
m_nb.end(); ++i)
59 if (i->m_neighborAddress == addr)
70 for (
auto i =
m_nb.begin(); i !=
m_nb.end(); ++i)
72 if (i->m_neighborAddress == addr)
74 i->m_expireTime = std::max(expire +
Simulator::Now(), i->m_expireTime);
85 m_nb.push_back(neighbor);
117 for (
auto j =
m_nb.begin(); j !=
m_nb.end(); ++j)
154 for (
auto i =
m_arp.begin(); i !=
m_arp.end(); ++i)
171 for (
auto i =
m_nb.begin(); i !=
m_nb.end(); ++i)
173 if (i->m_hardwareAddress == addr)
A record that that holds information about an ArpCache entry.
Address GetMacAddress() const
Ipv4 addresses are stored in host order in this class.
static Mac48Address ConvertFrom(const Address &address)
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
A simple virtual Timer class.
void SetDelay(const Time &delay)
void Cancel()
Cancel the currently-running event if there is one.
void Schedule()
Schedule a new event using the currently-configured delay, function, and arguments.
Time GetExpireTime(Ipv4Address addr)
Return expire time for neighbor node with address addr, if exists, else return 0.
void ScheduleTimer()
Schedule m_ntimer.
Neighbors(Time delay)
constructor
Callback< void, const WifiMacHeader & > m_txErrorCallback
TX error callback.
void Purge()
Remove all expired entries.
std::vector< Ptr< ArpCache > > m_arp
list of ARP cached to be used for layer 2 notifications processing
Mac48Address LookupMacAddress(Ipv4Address addr)
Find MAC address by IP using list of ARP caches.
void Update(Ipv4Address addr, Time expire)
Update expire time for entry with address addr, if it exists, else add new entry.
std::vector< Neighbor > m_nb
vector of entries
Timer m_ntimer
Timer for neighbor's list. Schedule Purge().
Callback< void, Ipv4Address > m_handleLinkFailure
link failure callback
void ProcessTxError(const WifiMacHeader &hdr)
Process layer 2 TX error notification.
void DelArpCache(Ptr< ArpCache > a)
Don't use given ARP cache any more (interface is down)
bool IsNeighbor(Ipv4Address addr)
Check that node with address addr is neighbor.
void AddArpCache(Ptr< ArpCache > a)
Add ARP cache to be used to allow layer 2 notifications processing.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
bool operator()(const Neighbors::Neighbor &nb) const
Check if the entry is expired.
bool close
Neighbor close indicator.
Time m_expireTime
Neighbor expire time.