A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::ArpL3Protocol Class Reference

An implementation of the ARP protocol. More...

#include <arp-l3-protocol.h>

+ Inheritance diagram for ns3::ArpL3Protocol:
+ Collaboration diagram for ns3::ArpL3Protocol:

Public Member Functions

 ArpL3Protocol ()
virtual ~ArpL3Protocol ()
Ptr< ArpCacheCreateCache (Ptr< NetDevice > device, Ptr< Ipv4Interface > interface)
bool Lookup (Ptr< Packet > p, Ipv4Address destination, Ptr< NetDevice > device, Ptr< ArpCache > cache, Address *hardwareDestination)
 Perform an ARP lookup.
void Receive (Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
 Receive a packet.
void SetNode (Ptr< Node > node)
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~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 Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~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)
 This method returns the TypeId associated to ns3::ArpL3Protocol.

Static Public Attributes

static const uint16_t PROT_NUMBER = 0x0806

Protected Member Functions

virtual void DoDispose (void)
virtual void NotifyNewAggregate ()
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
virtual void DoStart (void)

Private Types

typedef std::list< Ptr
< ArpCache > > 
CacheList

Private Member Functions

 ArpL3Protocol (const ArpL3Protocol &o)
Ptr< ArpCacheFindCache (Ptr< NetDevice > device)
ArpL3Protocoloperator= (const ArpL3Protocol &o)
void SendArpReply (Ptr< const ArpCache > cache, Ipv4Address myIp, Ipv4Address toIp, Address toMac)
void SendArpRequest (Ptr< const ArpCache >cache, Ipv4Address to)

Private Attributes

CacheList m_cacheList
TracedCallback< Ptr< const
Packet > > 
m_dropTrace
Ptr< Nodem_node

Detailed Description

An implementation of the ARP protocol.

Definition at line 48 of file arp-l3-protocol.h.

Member Typedef Documentation

Definition at line 87 of file arp-l3-protocol.h.

Constructor & Destructor Documentation

ns3::ArpL3Protocol::ArpL3Protocol ( )

Definition at line 59 of file arp-l3-protocol.cc.

References NS_LOG_FUNCTION.

ns3::ArpL3Protocol::~ArpL3Protocol ( )
virtual

Definition at line 64 of file arp-l3-protocol.cc.

References NS_LOG_FUNCTION.

ns3::ArpL3Protocol::ArpL3Protocol ( const ArpL3Protocol o)
private

Member Function Documentation

Ptr< ArpCache > ns3::ArpL3Protocol::CreateCache ( Ptr< NetDevice device,
Ptr< Ipv4Interface interface 
)
void ns3::ArpL3Protocol::DoDispose ( void  )
protectedvirtual

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 97 of file arp-l3-protocol.cc.

References ns3::Object::Dispose(), m_cacheList, m_node, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Ptr< ArpCache > ns3::ArpL3Protocol::FindCache ( Ptr< NetDevice device)
private

Definition at line 125 of file arp-l3-protocol.cc.

References m_cacheList, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by Receive().

+ Here is the caller graph for this function:

TypeId ns3::ArpL3Protocol::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::ArpL3Protocol.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/$ns3::ArpL3Protocol

Attributes defined for this type:

TraceSources defined for this type:

  • Drop: Packet dropped because not enough room in pending queue for a specific cache entry.

Reimplemented from ns3::Object.

Definition at line 42 of file arp-l3-protocol.cc.

References m_cacheList, m_dropTrace, ns3::MakeObjectVectorAccessor(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

bool ns3::ArpL3Protocol::Lookup ( Ptr< Packet p,
Ipv4Address  destination,
Ptr< NetDevice device,
Ptr< ArpCache cache,
Address hardwareDestination 
)
void ns3::ArpL3Protocol::NotifyNewAggregate ( void  )
protectedvirtual

This method is invoked whenever two sets of objects are aggregated together. It is invoked exactly once for each object in both sets. This method can be overriden by subclasses who wish to be notified of aggregation events. These subclasses must chain up to their base class NotifyNewAggregate method. It is safe to call GetObject and AggregateObject from within this method.

This function must be implemented in the stack that needs to notify other stacks connected to the node of their presence in the node.

Reimplemented from ns3::Object.

Definition at line 81 of file arp-l3-protocol.cc.

References m_node, and SetNode().

+ Here is the call graph for this function:

ArpL3Protocol& ns3::ArpL3Protocol::operator= ( const ArpL3Protocol o)
private
void ns3::ArpL3Protocol::Receive ( Ptr< NetDevice device,
Ptr< const Packet p,
uint16_t  protocol,
const Address from,
const Address to,
NetDevice::PacketType  packetType 
)
void ns3::ArpL3Protocol::SendArpReply ( Ptr< const ArpCache cache,
Ipv4Address  myIp,
Ipv4Address  toIp,
Address  toMac 
)
private

Definition at line 333 of file arp-l3-protocol.cc.

References ns3::Packet::AddHeader(), ns3::Node::GetId(), m_node, NS_LOG_FUNCTION, NS_LOG_LOGIC, PROT_NUMBER, and ns3::ArpHeader::SetReply().

Referenced by Receive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::ArpL3Protocol::SendArpRequest ( Ptr< const ArpCache cache,
Ipv4Address  to 
)
private
void ns3::ArpL3Protocol::SetNode ( Ptr< Node node)

Definition at line 70 of file arp-l3-protocol.cc.

References m_node, and NS_LOG_FUNCTION.

Referenced by NotifyNewAggregate().

+ Here is the caller graph for this function:

Member Data Documentation

CacheList ns3::ArpL3Protocol::m_cacheList
private

Definition at line 93 of file arp-l3-protocol.h.

Referenced by CreateCache(), DoDispose(), FindCache(), and GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::ArpL3Protocol::m_dropTrace
private

Definition at line 95 of file arp-l3-protocol.h.

Referenced by GetTypeId(), Lookup(), and Receive().

Ptr<Node> ns3::ArpL3Protocol::m_node
private
const uint16_t ns3::ArpL3Protocol::PROT_NUMBER = 0x0806
static

The documentation for this class was generated from the following files: