A Discrete-Event Network Simulator
API
ns3::NdiscCache Class Reference

IPv6 Neighbor Discovery cache. More...

#include "ndisc-cache.h"

+ Inheritance diagram for ns3::NdiscCache:
+ Collaboration diagram for ns3::NdiscCache:

Classes

class  Entry
 A record that holds information about a NdiscCache entry. More...
 

Public Types

typedef std::pair< Ptr< Packet >, Ipv6HeaderIpv6PayloadHeaderPair
 Pair of a packet and an Ipv4 header. More...
 

Public Member Functions

 NdiscCache ()
 Constructor. More...
 
 ~NdiscCache ()
 Destructor. More...
 
virtual NdiscCache::EntryAdd (Ipv6Address to)
 Add an entry. More...
 
void Flush ()
 Flush the cache. More...
 
Ptr< NetDeviceGetDevice () const
 Get the NetDevice associated with this cache. More...
 
Ptr< Ipv6InterfaceGetInterface () const
 Get the Ipv6Interface associated with this cache. More...
 
uint32_t GetUnresQlen ()
 Get the max number of waiting packet. More...
 
virtual NdiscCache::EntryLookup (Ipv6Address dst)
 Lookup in the cache. More...
 
std::list< NdiscCache::Entry * > LookupInverse (Address dst)
 Lookup in the cache for a MAC address. More...
 
void PrintNdiscCache (Ptr< OutputStreamWrapper > stream)
 Print the NDISC cache entries. More...
 
void Remove (NdiscCache::Entry *entry)
 Delete an entry. More...
 
void SetDevice (Ptr< NetDevice > device, Ptr< Ipv6Interface > interface, Ptr< Icmpv6L4Protocol > icmpv6)
 Set the device and interface. More...
 
void SetUnresQlen (uint32_t unresQlen)
 Set the max number of waiting packet. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject () const
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Static Public Attributes

static const uint32_t DEFAULT_UNRES_QLEN = 3
 Default value for unres qlen. More...
 

Protected Types

typedef std::unordered_map< Ipv6Address, NdiscCache::Entry *, Ipv6AddressHashCache
 Neighbor Discovery Cache container. More...
 
typedef std::unordered_map< Ipv6Address, NdiscCache::Entry *, Ipv6AddressHash >::iterator CacheI
 Neighbor Discovery Cache container iterator. More...
 

Protected Member Functions

void DoDispose ()
 Dispose this object. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Protected Attributes

Cache m_ndCache
 A list of Entry. More...
 

Private Member Functions

 NdiscCache (NdiscCache const &)
 Copy constructor. More...
 
NdiscCacheoperator= (NdiscCache const &)
 Copy constructor. More...
 

Private Attributes

Ptr< NetDevicem_device
 The NetDevice. More...
 
Ptr< Icmpv6L4Protocolm_icmpv6
 the icmpv6 L4 protocol for this cache. More...
 
Ptr< Ipv6Interfacem_interface
 the interface. More...
 
uint32_t m_unresQlen
 Max number of packet stored in m_waiting. More...
 

Additional Inherited Members

Detailed Description

IPv6 Neighbor Discovery cache.


Introspection did not find any typical Config paths.


Attributes

  • UnresolvedQueueSize: Size of the queue for packets pending an NA reply.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 3
    • Flags: construct write read

No TraceSources are defined for this type.
Size of this type is 120 bytes (on a 64-bit architecture).

Definition at line 49 of file ndisc-cache.h.

Member Typedef Documentation

◆ Cache

typedef std::unordered_map<Ipv6Address, NdiscCache::Entry *, Ipv6AddressHash> ns3::NdiscCache::Cache
protected

Neighbor Discovery Cache container.

Definition at line 424 of file ndisc-cache.h.

◆ CacheI

typedef std::unordered_map<Ipv6Address, NdiscCache::Entry *, Ipv6AddressHash>::iterator ns3::NdiscCache::CacheI
protected

Neighbor Discovery Cache container iterator.

Definition at line 428 of file ndisc-cache.h.

◆ Ipv6PayloadHeaderPair

Pair of a packet and an Ipv4 header.

Definition at line 149 of file ndisc-cache.h.

Constructor & Destructor Documentation

◆ NdiscCache() [1/2]

ns3::NdiscCache::NdiscCache ( )

Constructor.

Definition at line 52 of file ndisc-cache.cc.

References NS_LOG_FUNCTION.

◆ ~NdiscCache()

ns3::NdiscCache::~NdiscCache ( )

Destructor.

Definition at line 57 of file ndisc-cache.cc.

References Flush(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NdiscCache() [2/2]

ns3::NdiscCache::NdiscCache ( NdiscCache const &  )
private

Copy constructor.

Not implemented to avoid misuse

Member Function Documentation

◆ Add()

NdiscCache::Entry * ns3::NdiscCache::Add ( Ipv6Address  to)
virtual

Add an entry.

Parameters
toaddress to add
Returns
an new Entry

Definition at line 126 of file ndisc-cache.cc.

References m_ndCache, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6L4Protocol::HandleNS(), ns3::Icmpv6L4Protocol::HandleRedirection(), ns3::Icmpv6L4Protocol::HandleRS(), ns3::Icmpv6L4Protocol::Lookup(), and ns3::Icmpv6L4Protocol::ReceiveLLA().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::NdiscCache::DoDispose ( void  )
protectedvirtual

Dispose this object.

Reimplemented from ns3::Object.

Definition at line 63 of file ndisc-cache.cc.

References ns3::Object::DoDispose(), Flush(), m_device, m_icmpv6, m_interface, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ Flush()

void ns3::NdiscCache::Flush ( void  )

Flush the cache.

Definition at line 153 of file ndisc-cache.cc.

References m_ndCache, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6L4Protocol::CreateCache(), DoDispose(), ns3::Ipv6Interface::SetDown(), and ~NdiscCache().

+ Here is the caller graph for this function:

◆ GetDevice()

Ptr< NetDevice > ns3::NdiscCache::GetDevice ( void  ) const

Get the NetDevice associated with this cache.

Returns
NetDevice

Definition at line 87 of file ndisc-cache.cc.

References m_device, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6L4Protocol::Lookup().

+ Here is the caller graph for this function:

◆ GetInterface()

Ptr< Ipv6Interface > ns3::NdiscCache::GetInterface ( void  ) const

Get the Ipv6Interface associated with this cache.

Returns
The Ipv6Interface.

Definition at line 81 of file ndisc-cache.cc.

References m_interface, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6L4Protocol::HandleNA(), ns3::Icmpv6L4Protocol::Lookup(), and ns3::Icmpv6L4Protocol::ReceiveLLA().

+ Here is the caller graph for this function:

◆ GetTypeId()

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

Get the type ID.

Returns
type ID

Definition at line 38 of file ndisc-cache.cc.

References DEFAULT_UNRES_QLEN, m_unresQlen, ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ GetUnresQlen()

uint32_t ns3::NdiscCache::GetUnresQlen ( )

Get the max number of waiting packet.

Returns
max number

Definition at line 171 of file ndisc-cache.cc.

References m_unresQlen, and NS_LOG_FUNCTION.

◆ Lookup()

NdiscCache::Entry * ns3::NdiscCache::Lookup ( Ipv6Address  dst)
virtual

Lookup in the cache.

Parameters
dstdestination address.
Returns
the entry if found, 0 otherwise.

Definition at line 93 of file ndisc-cache.cc.

References m_ndCache, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::Icmpv6L4Protocol::HandleNA(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::Icmpv6L4Protocol::HandleRedirection(), ns3::Icmpv6L4Protocol::HandleRS(), ns3::Icmpv6L4Protocol::Lookup(), ns3::Ipv6L3Protocol::Receive(), and ns3::Icmpv6L4Protocol::ReceiveLLA().

+ Here is the caller graph for this function:

◆ LookupInverse()

std::list< NdiscCache::Entry * > ns3::NdiscCache::LookupInverse ( Address  dst)

Lookup in the cache for a MAC address.

Parameters
dstdestination MAC address.
Returns
a list of matching entries.

Definition at line 108 of file ndisc-cache.cc.

References ns3::NdiscCache::Entry::GetMacAddress(), m_ndCache, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::Ipv6L3Protocol::Receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

NdiscCache& ns3::NdiscCache::operator= ( NdiscCache const &  )
private

Copy constructor.

Not implemented to avoid misuse

Returns

◆ PrintNdiscCache()

void ns3::NdiscCache::PrintNdiscCache ( Ptr< OutputStreamWrapper stream)

Print the NDISC cache entries.

Parameters
streamthe ostream the NDISC cache entries is printed to

Definition at line 177 of file ndisc-cache.cc.

References ns3::Names::FindName(), ns3::OutputStreamWrapper::GetStream(), m_device, m_ndCache, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6RoutingHelper::PrintNdiscCache(), and ns3::Ipv6RoutingHelper::PrintNdiscCacheEvery().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Remove()

void ns3::NdiscCache::Remove ( NdiscCache::Entry entry)

Delete an entry.

Parameters
entrypointer to delete from the list.

Definition at line 137 of file ndisc-cache.cc.

References ns3::NdiscCache::Entry::ClearWaitingPacket(), m_ndCache, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6L4Protocol::Lookup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDevice()

void ns3::NdiscCache::SetDevice ( Ptr< NetDevice device,
Ptr< Ipv6Interface interface,
Ptr< Icmpv6L4Protocol icmpv6 
)

Set the device and interface.

Parameters
devicethe device
interfacethe IPv6 interface
icmpv6the ICMPv6 protocol

Definition at line 73 of file ndisc-cache.cc.

References m_device, m_icmpv6, m_interface, and NS_LOG_FUNCTION.

Referenced by ns3::Icmpv6L4Protocol::CreateCache().

+ Here is the caller graph for this function:

◆ SetUnresQlen()

void ns3::NdiscCache::SetUnresQlen ( uint32_t  unresQlen)

Set the max number of waiting packet.

Parameters
unresQlenvalue to set

Definition at line 165 of file ndisc-cache.cc.

References m_unresQlen, and NS_LOG_FUNCTION.

Member Data Documentation

◆ DEFAULT_UNRES_QLEN

const uint32_t ns3::NdiscCache::DEFAULT_UNRES_QLEN = 3
static

Default value for unres qlen.

Definition at line 63 of file ndisc-cache.h.

Referenced by GetTypeId().

◆ m_device

Ptr<NetDevice> ns3::NdiscCache::m_device
private

The NetDevice.

Definition at line 456 of file ndisc-cache.h.

Referenced by DoDispose(), GetDevice(), PrintNdiscCache(), and SetDevice().

◆ m_icmpv6

Ptr<Icmpv6L4Protocol> ns3::NdiscCache::m_icmpv6
private

the icmpv6 L4 protocol for this cache.

Definition at line 466 of file ndisc-cache.h.

Referenced by DoDispose(), ns3::NdiscCache::Entry::FunctionProbeTimeout(), ns3::NdiscCache::Entry::FunctionRetransmitTimeout(), and SetDevice().

◆ m_interface

Ptr<Ipv6Interface> ns3::NdiscCache::m_interface
private

the interface.

Definition at line 461 of file ndisc-cache.h.

Referenced by DoDispose(), GetInterface(), and SetDevice().

◆ m_ndCache

◆ m_unresQlen

uint32_t ns3::NdiscCache::m_unresQlen
private

Max number of packet stored in m_waiting.

Definition at line 471 of file ndisc-cache.h.

Referenced by GetTypeId(), GetUnresQlen(), and SetUnresQlen().


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