25 #include "ns3/simulator.h"
26 #include "ns3/callback.h"
27 #include "ns3/packet.h"
28 #include "ns3/nstime.h"
29 #include "ns3/net-device.h"
30 #include "ns3/ipv4-address.h"
31 #include "ns3/address.h"
33 #include "ns3/object.h"
34 #include "ns3/traced-callback.h"
35 #include "ns3/sgi-hashmap.h"
270 typedef sgi::hash_map<Ipv4Address, ArpCache::Entry *, Ipv4AddressHash>
Cache;
274 typedef sgi::hash_map<Ipv4Address, ArpCache::Entry *, Ipv4AddressHash>::iterator
CacheI;
uint32_t m_retries
rerty counter
ArpCacheEntryState_e m_state
state of the entry
void SetDevice(Ptr< NetDevice > device, Ptr< Ipv4Interface > interface)
Set the NetDevice and Ipv4Interface associated with the ArpCache.
uint32_t m_maxRetries
max retries for a resolution
void StartWaitReplyTimer(void)
This method will schedule a timeout at WaitReplyTimeout interval in the future, unless a timer is alr...
keep track of time values and allow control of global simulation resolution
void SetArpRequestCallback(Callback< void, Ptr< const ArpCache >, Ipv4Address > arpRequestCallback)
This callback is set when the ArpCache is set up and allows the cache to generate an Arp request when...
smart pointer class similar to boost::intrusive_ptr
ArpCache::Entry * Add(Ipv4Address to)
Add an Ipv4Address to this ARP cache.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
static TypeId GetTypeId(void)
Get the type ID.
ArpCache::Entry * Lookup(Ipv4Address destination)
Do lookup in the ARP cache against an IP address.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
Callback< void, Ptr< const ArpCache >, Ipv4Address > m_arpRequestCallback
reply timeout callback
Time GetDeadTimeout(void) const
Get the time the entry will be in DEAD state before being removed.
Ptr< NetDevice > GetDevice(void) const
Returns the NetDevice that this ARP cache is associated with.
Address m_macAddress
entry's MAC address
ArpCache * m_arp
pointer to the ARP cache owning the entry
EventId m_waitReplyTimer
cache alive state timer
a polymophic address class
Cache m_arpCache
the ARP cache
void SetIpv4Address(Ipv4Address destination)
void HandleWaitReplyTimeout(void)
This function is an event handler for the event that the ArpCache wants to check whether it must retr...
void MarkWaitReply(Ptr< Packet > waiting)
uint32_t GetRetries(void) const
Ptr< Ipv4Interface > m_interface
Ipv4Interface associated with the cache.
bool IsExpired(void) const
Ipv4Address GetIpv4Address(void) const
Time m_waitReplyTimeout
cache reply state timeout
Address GetMacAddress(void) const
void SetDeadTimeout(Time deadTimeout)
Set the time the entry will be in DEAD state before being removed.
void SetAliveTimeout(Time aliveTimeout)
Set the time the entry will be in ALIVE state (unless refreshed)
Ptr< Ipv4Interface > GetInterface(void) const
Returns the Ipv4Interface that this ARP cache is associated with.
void IncrementRetries(void)
Increment the counter of number of retries for an entry.
void MarkAlive(Address macAddress)
Time GetAliveTimeout(void) const
Get the time the entry will be in ALIVE state (unless refreshed)
A record that that holds information about an ArpCache entry.
void Flush(void)
Clear the ArpCache of all entries.
ArpCacheEntryState_e
ARP cache entry states.
Entry(ArpCache *arp)
Constructor.
Time GetTimeout(void) const
Returns the entry timeout.
void UpdateSeen(void)
Update the entry when seeing a packet.
TracedCallback< Ptr< const Packet > > m_dropTrace
trace for packets dropped by the ARP cache queue
bool UpdateWaitReply(Ptr< Packet > waiting)
Ipv4 addresses are stored in host order in this class.
an identifier for simulation events.
sgi::hash_map< Ipv4Address, ArpCache::Entry *, Ipv4AddressHash >::iterator CacheI
ARP Cache container iterator.
Ptr< Packet > DequeuePending(void)
Time GetWaitReplyTimeout(void) const
Get the time the entry will be in WAIT_REPLY state.
void ClearRetries(void)
Zero the counter of number of retries for an entry.
Ptr< NetDevice > m_device
NetDevice associated with the cache.
void MarkDead(void)
Changes the state of this entry to dead.
Time m_deadTimeout
cache dead state timeout
a base class which provides memory management and object aggregation
Time m_lastSeen
last moment a packet from that address has been seen
uint32_t m_pendingQueueSize
number of packets waiting for a resolution
void SetWaitReplyTimeout(Time waitReplyTimeout)
Set the time the entry will be in WAIT_REPLY state.
Time m_aliveTimeout
cache alive state timeout
a unique identifier for an interface.
ArpCache & operator=(ArpCache const &)
Copy constructor.
std::list< Ptr< Packet > > m_pending
list of pending packets for the entry's IP
sgi::hash_map< Ipv4Address, ArpCache::Entry *, Ipv4AddressHash > Cache
ARP Cache container.
Ipv4Address m_ipv4Address
entry's IP address