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" 36 #include "ns3/output-stream-wrapper.h" 322 typedef sgi::hash_map<Ipv4Address, ArpCache::Entry *, Ipv4AddressHash>
Cache;
326 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...
void MarkPermanent(void)
Changes the state of this entry to Permanent.
Simulation virtual time values and 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.
void SetMacAddress(Address macAddress)
ArpCache::Entry * Add(Ipv4Address to)
Add an Ipv4Address to this ARP cache.
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
void PrintArpCache(Ptr< OutputStreamWrapper > stream)
Print the ARP cache entries.
NS_DEPRECATED void SetMacAddresss(Address macAddress)
ArpCache::Entry * Lookup(Ipv4Address destination)
Do lookup in the ARP cache against an IP address.
Forward calls to a chain of Callback.
Callback< void, Ptr< const ArpCache >, Ipv4Address > m_arpRequestCallback
reply timeout callback
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...
Ptr< NetDevice > GetDevice(void) const
Returns the NetDevice that this ARP cache is associated with.
Address GetMacAddress(void) const
Time GetTimeout(void) const
Returns the entry timeout.
Time GetDeadTimeout(void) const
Get the time the entry will be in DEAD state before being removed.
Ptr< Ipv4Interface > GetInterface(void) const
Returns the Ipv4Interface that this ARP cache is associated with.
Ptr< Ipv4Interface > m_interface
Ipv4Interface associated with the cache.
void MarkWaitReply(Ipv4PayloadHeaderPair waiting)
Time m_waitReplyTimeout
cache reply state timeout
Ipv4Address GetIpv4Address(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)
void IncrementRetries(void)
Increment the counter of number of retries for an entry.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void ClearPendingPacket(void)
Clear the pending packet list.
uint32_t GetRetries(void) const
void MarkAlive(Address macAddress)
bool IsExpired(void) const
A record that that holds information about an ArpCache entry.
void Flush(void)
Clear the ArpCache of all entries.
Time GetAliveTimeout(void) const
Get the time the entry will be in ALIVE state (unless refreshed)
ArpCacheEntryState_e
ARP cache entry states.
void Remove(ArpCache::Entry *entry)
Remove an entry.
Entry(ArpCache *arp)
Constructor.
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
Time GetWaitReplyTimeout(void) const
Get the time the entry will be in WAIT_REPLY state.
bool UpdateWaitReply(Ipv4PayloadHeaderPair waiting)
Ipv4 addresses are stored in host order in this class.
#define NS_DEPRECATED
Mark a function as deprecated.
Ipv4PayloadHeaderPair DequeuePending(void)
An identifier for simulation events.
sgi::hash_map< Ipv4Address, ArpCache::Entry *, Ipv4AddressHash >::iterator CacheI
ARP Cache container iterator.
std::pair< Ptr< Packet >, Ipv4Header > Ipv4PayloadHeaderPair
Pair of a packet and an Ipv4 header.
std::list< Ipv4PayloadHeaderPair > m_pending
list of pending packets for the entry's IP
void ClearRetries(void)
Zero the counter of number of retries for an entry.
Ptr< NetDevice > m_device
NetDevice associated with the cache.
std::list< ArpCache::Entry * > LookupInverse(Address destination)
Do lookup in the ARP cache against a MAC address.
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.
sgi::hash_map< Ipv4Address, ArpCache::Entry *, Ipv4AddressHash > Cache
ARP Cache container.
Ipv4Address m_ipv4Address
entry's IP address