An ARP cache. More...
#include <arp-cache.h>
Classes | |
class | Entry |
A record that that holds information about an ArpCache entry. More... | |
Public Member Functions | |
ArpCache::Entry * | Add (Ipv4Address to) |
Add an Ipv4Address to this ARP cache. | |
void | Flush (void) |
Clear the ArpCache of all entries. | |
Time | GetAliveTimeout (void) const |
Time | GetDeadTimeout (void) const |
Ptr< NetDevice > | GetDevice (void) const |
Ptr< Ipv4Interface > | GetInterface (void) const |
Time | GetWaitReplyTimeout (void) const |
ArpCache::Entry * | Lookup (Ipv4Address destination) |
Do lookup in the ARP cache against an IP address. More... | |
void | SetAliveTimeout (Time aliveTimeout) |
void | SetArpRequestCallback (Callback< void, Ptr< const ArpCache >, Ipv4Address > arpRequestCallback) |
void | SetDeadTimeout (Time deadTimeout) |
void | SetDevice (Ptr< NetDevice > device, Ptr< Ipv4Interface > interface) |
void | SetWaitReplyTimeout (Time waitReplyTimeout) |
void | StartWaitReplyTimer (void) |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Private Types | |
typedef sgi::hash_map < Ipv4Address, ArpCache::Entry *, Ipv4AddressHash > | Cache |
typedef sgi::hash_map < Ipv4Address, ArpCache::Entry *, Ipv4AddressHash >::iterator | CacheI |
Private Member Functions | |
ArpCache (ArpCache const &) | |
virtual void | DoDispose (void) |
void | HandleWaitReplyTimeout (void) |
ArpCache & | operator= (ArpCache const &) |
Private Attributes | |
Time | m_aliveTimeout |
Cache | m_arpCache |
Callback< void, Ptr< const ArpCache >, Ipv4Address > | m_arpRequestCallback |
Time | m_deadTimeout |
Ptr< NetDevice > | m_device |
TracedCallback< Ptr< const Packet > > | m_dropTrace |
Ptr< Ipv4Interface > | m_interface |
uint32_t | m_maxRetries |
uint32_t | m_pendingQueueSize |
Time | m_waitReplyTimeout |
EventId | m_waitReplyTimer |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
An ARP cache.
A cached lookup table for translating layer 3 addresses to layer 2. This implementation does lookups from IPv4 to a MAC address
ns3::ArpCache is accessible through the following paths with Config::Set and Config::Connect:
Definition at line 49 of file arp-cache.h.
|
privatevirtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
Definition at line 88 of file arp-cache.cc.
References ns3::Object::DoDispose(), Flush(), ns3::EventId::IsRunning(), NS_LOG_FUNCTION, and ns3::Simulator::Remove().
Definition at line 110 of file arp-cache.cc.
References NS_LOG_FUNCTION.
Ptr< Ipv4Interface > ns3::ArpCache::GetInterface | ( | void | ) | const |
Definition at line 117 of file arp-cache.cc.
References NS_LOG_FUNCTION.
|
private |
This function is an event handler for the event that the ArpCache wants to check whether it must retry any Arp requests. If there are no Arp requests pending, this event is not scheduled.
Definition at line 183 of file arp-cache.cc.
References ns3::ArpCache::Entry::ClearRetries(), ns3::ArpCache::Entry::DequeuePending(), ns3::ArpCache::Entry::GetIpv4Address(), ns3::ArpCache::Entry::GetRetries(), ns3::ArpCache::Entry::IncrementRetries(), ns3::ArpCache::Entry::IsWaitReply(), ns3::ArpCache::Entry::MarkDead(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Simulator::Schedule().
Referenced by StartWaitReplyTimer().
ArpCache::Entry * ns3::ArpCache::Lookup | ( | Ipv4Address | destination | ) |
Do lookup in the ARP cache against an IP address.
destination | The destination IPv4 address to lookup the MAC address of |
Definition at line 246 of file arp-cache.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::ArpL3Protocol::Lookup().
void ns3::ArpCache::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 the WaitReply time expires and a retransmission must be sent
arpRequestCallback | Callback for transmitting an Arp request. |
Definition at line 162 of file arp-cache.cc.
References NS_LOG_FUNCTION.
void ns3::ArpCache::SetDevice | ( | Ptr< NetDevice > | device, |
Ptr< Ipv4Interface > | interface | ||
) |
device | The hardware NetDevice associated with this ARP chache |
interface | the Ipv4Interface associated with this ARP chache |
Definition at line 102 of file arp-cache.cc.
References NS_LOG_FUNCTION.
void ns3::ArpCache::StartWaitReplyTimer | ( | void | ) |
This method will schedule a timeout at WaitReplyTimeout interval in the future, unless a timer is already running for the cache, in which case this method does nothing.
Definition at line 170 of file arp-cache.cc.
References HandleWaitReplyTimeout(), ns3::EventId::IsRunning(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Simulator::Schedule().