22 #include "ns3/uinteger.h" 
   24 #include "ns3/names.h" 
   42     .SetGroupName (
"Internet")
 
   43     .AddAttribute (
"UnresolvedQueueSize",
 
   44                    "Size of the queue for packets pending an NA reply.",
 
   47                    MakeUintegerChecker<uint32_t> ())
 
  111   std::list<NdiscCache::Entry *> entryList;
 
  117           NS_LOG_LOGIC (
"Found an entry:" << (*i).first << 
" to " << (*i).second);
 
  118           entryList.push_back (entry);
 
  131   entry->SetIpv6Address (to);
 
  142       if ((*i).second == entry)
 
  183       *os << i->first << 
" dev ";
 
  191           *os << static_cast<int> (
m_device->GetIfIndex ());
 
  194       *os << 
" lladdr " << i->second->GetMacAddress ();
 
  196       if (i->second->IsReachable ())
 
  198           *os << 
" REACHABLE\n";
 
  200       else if (i->second->IsDelay ())
 
  204       else if (i->second->IsIncomplete ())
 
  206           *os << 
" INCOMPLETE\n";
 
  208       else if (i->second->IsProbe ())
 
  212       else if (i->second->IsStale ())
 
  216       else if (i->second->IsPermanent ())
 
  218       *os << 
" PERMANENT\n";
 
  222       NS_FATAL_ERROR (
"Test for possibly unreachable code-- please file a bug report, with a test case, if this is ever hit");
 
  231     m_nudTimer (
Timer::CANCEL_ON_DESTROY),
 
  232     m_lastReachabilityConfirmation (
Seconds (0.0)),
 
  254   if (m_waiting.size () >= 
m_ndCache->GetUnresQlen ())
 
  258       m_waiting.pop_front ();
 
  260   m_waiting.push_back (p);
 
  282   if (m_ipv6Address.IsLinkLocal ())
 
  284       addr = 
m_ndCache->GetInterface ()->GetLinkLocalAddress ().GetAddress ();;
 
  286   else if (!m_ipv6Address.IsAny ())
 
  288       addr = 
m_ndCache->GetInterface ()->GetAddressMatchingDestination (m_ipv6Address).GetAddress ();
 
  298   if (m_nsRetransmit < m_ndCache->
m_icmpv6->GetMaxMulticastSolicit ())
 
  304       StartRetransmitTimer ();
 
  309       if (malformedPacket.first == 0)
 
  311           malformedPacket.first = Create<Packet> ();
 
  315           malformedPacket.first->AddHeader (malformedPacket.second);
 
  332   if (m_ipv6Address.IsLinkLocal ())
 
  334       addr = 
m_ndCache->GetInterface ()->GetLinkLocalAddress ().GetAddress ();
 
  336   else if (!m_ipv6Address.IsAny ())
 
  338       addr = 
m_ndCache->GetInterface ()->GetAddressMatchingDestination (m_ipv6Address).GetAddress ();
 
  353   p.first->AddHeader (p.second);
 
  364   if (m_nsRetransmit < m_ndCache->
m_icmpv6->GetMaxUnicastSolicit ())
 
  370       if (m_ipv6Address.IsLinkLocal ())
 
  372           addr = 
m_ndCache->GetInterface ()->GetLinkLocalAddress ().GetAddress ();
 
  374       else if (!m_ipv6Address.IsAny ())
 
  376           addr = 
m_ndCache->GetInterface ()->GetAddressMatchingDestination (m_ipv6Address).GetAddress ();
 
  392       p.first->AddHeader (p.second);
 
  408   m_ipv6Address = ipv6Address;
 
  414   return m_lastReachabilityConfirmation;
 
  420   if (m_nudTimer.IsRunning ())
 
  422       m_nudTimer.Cancel ();
 
  427   m_nudTimer.SetDelay (
m_ndCache->m_icmpv6->GetReachableTime ());
 
  428   m_nudTimer.Schedule ();
 
  435   if (m_state == REACHABLE)
 
  438       if (m_nudTimer.IsRunning ())
 
  440           m_nudTimer.Cancel ();
 
  442       m_nudTimer.Schedule ();
 
  449   if (m_nudTimer.IsRunning ())
 
  451       m_nudTimer.Cancel ();
 
  455   m_nudTimer.SetDelay (
m_ndCache->m_icmpv6->GetRetransmissionTime ());
 
  456   m_nudTimer.Schedule ();
 
  462   if (m_nudTimer.IsRunning ())
 
  464       m_nudTimer.Cancel ();
 
  468   m_nudTimer.SetDelay (
m_ndCache->m_icmpv6->GetDelayFirstProbe ());
 
  469   m_nudTimer.Schedule ();
 
  475   if (m_nudTimer.IsRunning ())
 
  477       m_nudTimer.Cancel ();
 
  481   m_nudTimer.SetDelay (
m_ndCache->m_icmpv6->GetRetransmissionTime ());
 
  482   m_nudTimer.Schedule ();
 
  488   m_nudTimer.Cancel ();
 
  495   m_state = INCOMPLETE;
 
  499       m_waiting.push_back (p);
 
  553   return (m_state == STALE);
 
  559   return (m_state == REACHABLE);
 
  565   return (m_state == 
DELAY);
 
  571   return (m_state == INCOMPLETE);
 
  577   return (m_state == PROBE);
 
  583   return (m_state == PERMANENT);
 
bool IsAny() const 
If the IPv6 address is the "Any" address. 
 
void FunctionDelayTimeout()
Function called when delay timer timeout. 
 
static TypeId GetTypeId()
Get the type ID. 
 
Simulation virtual time values and global simulation resolution. 
 
Time GetLastReachabilityConfirmation() const 
Get the time of last reachability confirmation. 
 
Smart pointer class similar to boost::intrusive_ptr. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
Address GetMacAddress() const 
Get the MAC address of this entry. 
 
NdiscCache::Entry * Add(Ipv6Address to)
Add an entry. 
 
void SetUnresQlen(uint32_t unresQlen)
Set the max number of waiting packet. 
 
void StopNudTimer()
Stop NUD timer and reset the NUD retransmission counter. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
Ptr< Icmpv6L4Protocol > m_icmpv6
the icmpv6 L4 protocol for this cache. 
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
virtual void DoDispose(void)
Destructor implementation. 
 
void SetDevice(Ptr< NetDevice > device, Ptr< Ipv6Interface > interface, Ptr< Icmpv6L4Protocol > icmpv6)
Set the device and interface. 
 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function. 
 
void MarkPermanent()
Change the state to this entry to PERMANENT. 
 
a polymophic address class 
 
uint32_t GetUnresQlen()
Get the max number of waiting packet. 
 
Ptr< Ipv6Interface > GetInterface() const 
Get the Ipv6Interface associated with this cache. 
 
bool IsDelay() const 
Is the entry DELAY. 
 
Ptr< Ipv6Interface > m_interface
the interface. 
 
void FunctionRetransmitTimeout()
Function called when retransmit timer timeout. 
 
void MarkReachable()
Changes the state to this entry to REACHABLE. 
 
void Flush()
Flush the cache. 
 
Hold an unsigned integer type. 
 
#define DELAY(time)
Gets the delay between a given time and the current time. 
 
IPv6 Neighbor Discovery cache. 
 
void PrintNdiscCache(Ptr< OutputStreamWrapper > stream)
Print the NDISC cache entries. 
 
void StartRetransmitTimer()
Start retransmit timer. 
 
void ClearWaitingPacket()
Clear the waiting packet list. 
 
Entry(NdiscCache *nd)
Constructor. 
 
bool IsProbe() const 
Is the entry PROBE. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
void StartDelayTimer()
Start delay timer. 
 
void StartReachableTimer()
Start the reachable timer. 
 
bool IsIncomplete() const 
Is the entry INCOMPLETE. 
 
void FunctionReachableTimeout()
Function called when reachable timer timeout. 
 
void StartProbeTimer()
Start probe timer. 
 
static Time Now(void)
Return the current simulation virtual time. 
 
static const uint32_t DEFAULT_UNRES_QLEN
Default value for unres qlen. 
 
void Remove(NdiscCache::Entry *entry)
Delete an entry. 
 
void FunctionProbeTimeout()
Function called when probe timer timeout. 
 
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
 
uint32_t m_unresQlen
Max number of packet stored in m_waiting. 
 
void UpdateReachableTimer()
Update the reachable timer. 
 
std::list< NdiscCache::Entry * > LookupInverse(Address dst)
Lookup in the cache for a MAC address. 
 
void SetMacAddress(Address mac)
Set the MAC address of this entry. 
 
Describes an IPv6 address. 
 
NdiscCache::Entry * Lookup(Ipv6Address dst)
Lookup in the cache. 
 
void MarkStale()
Changes the state to this entry to STALE. 
 
void DoDispose()
Dispose this object. 
 
void SetIpv6Address(Ipv6Address ipv6Address)
Set the IPv6 address. 
 
void MarkDelay()
Change the state to this entry to DELAY. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
static std::string FindName(Ptr< Object > object)
Given a pointer to an object, look to see if that object has a name associated with it and...
 
bool IsRouter() const 
If the entry is a host or a router. 
 
void MarkIncomplete(Ipv6PayloadHeaderPair p)
Changes the state to this entry to INCOMPLETE. 
 
Cache m_ndCache
A list of Entry. 
 
bool IsPermanent() const 
Is the entry PERMANENT. 
 
A record that holds information about a NdiscCache entry. 
 
void SetRouter(bool router)
Set the node type. 
 
A base class which provides memory management and object aggregation. 
 
sgi::hash_map< Ipv6Address, NdiscCache::Entry *, Ipv6AddressHash >::iterator CacheI
Neighbor Discovery Cache container iterator. 
 
std::pair< Ptr< Packet >, Ipv6Header > Ipv6PayloadHeaderPair
Pair of a packet and an Ipv4 header. 
 
bool IsReachable() const 
Is the entry REACHABLE. 
 
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
a unique identifier for an interface. 
 
void AddWaitingPacket(Ipv6PayloadHeaderPair p)
Add a packet (or replace old value) in the queue. 
 
Ptr< NetDevice > GetDevice() const 
Get the NetDevice associated with this cache. 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
void MarkProbe()
Changes the state to this entry to PROBE. 
 
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD). 
 
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper. 
 
bool IsStale() const 
Is the entry STALE. 
 
static Ipv6Address MakeSolicitedAddress(Ipv6Address addr)
Make the solicited IPv6 address. 
 
Ptr< NetDevice > m_device
The NetDevice.