28 #define NS_LOG_APPEND_CONTEXT                                   \ 
   29   if (m_ipv4) { std::clog << "[node " << m_ipv4->GetObject<Node> ()->GetId () << "] "; }  
   31 #include "aodv-routing-protocol.h" 
   33 #include "ns3/boolean.h" 
   34 #include "ns3/random-variable-stream.h" 
   35 #include "ns3/inet-socket-address.h" 
   36 #include "ns3/trace-source-accessor.h" 
   37 #include "ns3/udp-socket-factory.h" 
   38 #include "ns3/wifi-net-device.h" 
   39 #include "ns3/adhoc-wifi-mac.h" 
   40 #include "ns3/string.h" 
   41 #include "ns3/pointer.h" 
   51 NS_OBJECT_ENSURE_REGISTERED (RoutingProtocol);
 
   79   int32_t GetInterface()
 const 
   84   void SetInterface(int32_t oif)
 
   91     return sizeof(int32_t);
 
  106     os << 
"DeferredRouteOutputTag: output interface = " << 
m_oif;
 
  122   ActiveRouteTimeout (
Seconds (3)),
 
  125   NetTraversalTime (
Time ((2 * NetDiameter) * NodeTraversalTime)),
 
  126   PathDiscoveryTime ( 
Time (2 * NetTraversalTime)),
 
  127   MyRouteTimeout (
Time (2 * std::max (PathDiscoveryTime, ActiveRouteTimeout))),
 
  129   AllowedHelloLoss (2),
 
  130   DeletePeriod (
Time (5 * std::max (ActiveRouteTimeout, HelloInterval))),
 
  133   BlackListTimeout (
Time (RreqRetries * NetTraversalTime)),
 
  136   DestinationOnly (false),
 
  137   GratuitousReply (true),
 
  139   m_routingTable (DeletePeriod),
 
  140   m_queue (MaxQueueLen, MaxQueueTime),
 
  143   m_rreqIdCache (PathDiscoveryTime),
 
  144   m_dpd (PathDiscoveryTime),
 
  145   m_nb (HelloInterval),
 
  148   m_htimer (
Timer::CANCEL_ON_DESTROY),
 
  149   m_rreqRateLimitTimer (
Timer::CANCEL_ON_DESTROY),
 
  150   m_rerrRateLimitTimer (
Timer::CANCEL_ON_DESTROY)
 
  159 RoutingProtocol::GetTypeId (
void)
 
  161   static TypeId tid = 
TypeId (
"ns3::aodv::RoutingProtocol")
 
  163     .AddConstructor<RoutingProtocol> ()
 
  164     .AddAttribute (
"HelloInterval", 
"HELLO messages emission interval.",
 
  168     .AddAttribute (
"RreqRetries", 
"Maximum number of retransmissions of RREQ to discover a route",
 
  171                    MakeUintegerChecker<uint32_t> ())
 
  172     .AddAttribute (
"RreqRateLimit", 
"Maximum number of RREQ per second.",
 
  175                    MakeUintegerChecker<uint32_t> ())
 
  176     .AddAttribute (
"RerrRateLimit", 
"Maximum number of RERR per second.",
 
  179                    MakeUintegerChecker<uint32_t> ())
 
  180     .AddAttribute (
"NodeTraversalTime", 
"Conservative estimate of the average one hop traversal time for packets and should include " 
  181                    "queuing delays, interrupt processing times and transfer times.",
 
  185     .AddAttribute (
"NextHopWait", 
"Period of our waiting for the neighbour's RREP_ACK = 10 ms + NodeTraversalTime",
 
  189     .AddAttribute (
"ActiveRouteTimeout", 
"Period of time during which the route is considered to be valid",
 
  193     .AddAttribute (
"MyRouteTimeout", 
"Value of lifetime field in RREP generating by this node = 2 * max(ActiveRouteTimeout, PathDiscoveryTime)",
 
  197     .AddAttribute (
"BlackListTimeout", 
"Time for which the node is put into the blacklist = RreqRetries * NetTraversalTime",
 
  201     .AddAttribute (
"DeletePeriod", 
"DeletePeriod is intended to provide an upper bound on the time for which an upstream node A " 
  202                    "can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D." 
  203                    " = 5 * max (HelloInterval, ActiveRouteTimeout)",
 
  207     .AddAttribute (
"TimeoutBuffer", 
"Its purpose is to provide a buffer for the timeout so that if the RREP is delayed" 
  208                    " due to congestion, a timeout is less likely to occur while the RREP is still en route back to the source.",
 
  211                    MakeUintegerChecker<uint16_t> ())
 
  212     .AddAttribute (
"NetDiameter", 
"Net diameter measures the maximum possible number of hops between two nodes in the network",
 
  215                    MakeUintegerChecker<uint32_t> ())
 
  216     .AddAttribute (
"NetTraversalTime", 
"Estimate of the average net traversal time = 2 * NodeTraversalTime * NetDiameter",
 
  220     .AddAttribute (
"PathDiscoveryTime", 
"Estimate of maximum time needed to find route in network = 2 * NetTraversalTime",
 
  224     .AddAttribute (
"MaxQueueLen", 
"Maximum number of packets that we allow a routing protocol to buffer.",
 
  226                    MakeUintegerAccessor (&RoutingProtocol::SetMaxQueueLen,
 
  227                                          &RoutingProtocol::GetMaxQueueLen),
 
  228                    MakeUintegerChecker<uint32_t> ())
 
  229     .AddAttribute (
"MaxQueueTime", 
"Maximum time packets can be queued (in seconds)",
 
  231                    MakeTimeAccessor (&RoutingProtocol::SetMaxQueueTime,
 
  232                                      &RoutingProtocol::GetMaxQueueTime),
 
  234     .AddAttribute (
"AllowedHelloLoss", 
"Number of hello messages which may be loss for valid link.",
 
  237                    MakeUintegerChecker<uint16_t> ())
 
  238     .AddAttribute (
"GratuitousReply", 
"Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.",
 
  240                    MakeBooleanAccessor (&RoutingProtocol::SetGratuitousReplyFlag,
 
  241                                         &RoutingProtocol::GetGratuitousReplyFlag),
 
  242                    MakeBooleanChecker ())
 
  243     .AddAttribute (
"DestinationOnly", 
"Indicates only the destination may respond to this RREQ.",
 
  245                    MakeBooleanAccessor (&RoutingProtocol::SetDesinationOnlyFlag,
 
  246                                         &RoutingProtocol::GetDesinationOnlyFlag),
 
  247                    MakeBooleanChecker ())
 
  248     .AddAttribute (
"EnableHello", 
"Indicates whether a hello messages enable.",
 
  250                    MakeBooleanAccessor (&RoutingProtocol::SetHelloEnable,
 
  251                                         &RoutingProtocol::GetHelloEnable),
 
  252                    MakeBooleanChecker ())
 
  253     .AddAttribute (
"EnableBroadcast", 
"Indicates whether a broadcast data packets forwarding enable.",
 
  255                    MakeBooleanAccessor (&RoutingProtocol::SetBroadcastEnable,
 
  256                                         &RoutingProtocol::GetBroadcastEnable),
 
  257                    MakeBooleanChecker ())
 
  258     .AddAttribute (
"UniformRv",
 
  259                    "Access to the underlying UniformRandomVariable",
 
  262                    MakePointerChecker<UniformRandomVariable> ())
 
  268 RoutingProtocol::SetMaxQueueLen (uint32_t len)
 
  274 RoutingProtocol::SetMaxQueueTime (Time t)
 
  280 RoutingProtocol::~RoutingProtocol ()
 
  291       iter->first->Close ();
 
  341       sockerr = Socket::ERROR_NOROUTETOHOST;
 
  346   sockerr = Socket::ERROR_NOTERROR;
 
  352       route = rt.GetRoute ();
 
  358           sockerr = Socket::ERROR_NOROUTETOHOST;
 
  363       uint16_t channel = 1;
 
  367         channel = rt.GetChannel();
 
  377   uint32_t iif = (oif ? 
m_ipv4->GetInterfaceForDevice (oif) : -1);
 
  400       if(!result || ((rt.GetFlag () != 
IN_SEARCH) && result))
 
  423   int32_t iif = 
m_ipv4->GetInterfaceForDevice (idev);
 
  454       if (
m_ipv4->GetInterfaceForAddress (iface.GetLocal ()) == iif)
 
  455         if (dst == iface.GetBroadcast () || dst.
IsBroadcast ())
 
  459                 NS_LOG_DEBUG (
"Duplicated packet " << p->
GetUid () << 
" from " << origin << 
". Drop.");
 
  464             if (lcb.IsNull () == 
false)
 
  466                 NS_LOG_LOGIC (
"Broadcast local delivery to " << iface.GetLocal ());
 
  467                 lcb (p, header, iif);
 
  472                 NS_LOG_ERROR (
"Unable to deliver packet locally due to null callback " << p->
GetUid () << 
" from " << origin);
 
  473                 ecb (p, header, Socket::ERROR_NOROUTETOHOST);
 
  486                     ucb (route, packet, header);
 
  502   if (
m_ipv4->IsDestinationAddress (dst, iif))
 
  511       if (lcb.IsNull () == 
false)
 
  514           lcb (p, header, iif);
 
  518           NS_LOG_ERROR (
"Unable to deliver packet locally due to null callback " << p->
GetUid () << 
" from " << origin);
 
  519           ecb (p, header, Socket::ERROR_NOROUTETOHOST);
 
  539       if (toDst.GetFlag () == 
VALID)
 
  572           ucb (route, packet, header);
 
  577           if (toDst.GetValidSeqNo ())
 
  585   NS_LOG_LOGIC (
"route not found to "<< dst << 
". Send RERR message.");
 
  625   if (l3->GetNAddresses (i) > 1)
 
  627       NS_LOG_WARN (
"AODV does not work with more then one address per each interface.");
 
  630   if (iface.GetLocal () == 
Ipv4Address (
"127.0.0.1"))
 
  635                                              UdpSocketFactory::GetTypeId ());
 
  677           mac->TraceDisconnectWithoutContext (
"TxErrHeader",
 
  702   NS_LOG_FUNCTION (
this << 
" interface " << i << 
" address " << address);
 
  706   if (l3->GetNAddresses (i) == 1)
 
  712           if (iface.GetLocal () == 
Ipv4Address (
"127.0.0.1"))
 
  716                                                      UdpSocketFactory::GetTypeId ());
 
  727               m_ipv4->GetInterfaceForAddress (iface.GetLocal ()));
 
  737       NS_LOG_LOGIC (
"AODV does not work with more then one address per each interface. Ignore added address");
 
  751       if (l3->GetNAddresses (i))
 
  756                                                      UdpSocketFactory::GetTypeId ());
 
  782       NS_LOG_LOGIC (
"Remove address not participating in AODV operation");
 
  794       if (src == iface.GetLocal ())
 
  832           int32_t 
interface = 
m_ipv4->GetInterfaceForAddress (addr);
 
  833           if (oif == 
m_ipv4->GetNetDevice (static_cast<uint32_t> (interface)))
 
  865   rreqHeader.SetDst (dst);
 
  870       rreqHeader.SetHopCount (rt.GetHop ());
 
  871       if (rt.GetValidSeqNo ())
 
  872         rreqHeader.SetDstSeqno (rt.GetSeqNo ());
 
  874         rreqHeader.SetUnknownSeqno (
true);
 
  880       rreqHeader.SetUnknownSeqno (
true);
 
  891     rreqHeader.SetGratiousRrep (
true);
 
  893     rreqHeader.SetDestinationOnly (
true);
 
  896   rreqHeader.SetOriginSeqno (
m_seqNo);
 
  899   rreqHeader.SetHopCount (0);
 
  908       rreqHeader.SetOrigin (iface.GetLocal ());
 
  927           destination = iface.GetBroadcast ();
 
  929       NS_LOG_DEBUG (
"Send RREQ with id " << rreqHeader.GetId () << 
" to socket");
 
  957   rt.IncrementRreqCnt ();
 
  972   NS_LOG_DEBUG (
"AODV node " << 
this << 
" received a AODV packet from " << sender << 
" to " << receiver);
 
  979       NS_LOG_DEBUG (
"AODV message " << packet->
GetUid () << 
" with unknown type received: " << tHeader.
Get () << 
". Drop");
 
  982   switch (tHeader.
Get ())
 
  999     case AODVTYPE_RREP_ACK:
 
 1014       if (rt.GetFlag () == 
VALID)
 
 1018           rt.SetLifeTime (std::max (lifetime, rt.GetLifeTime ()));
 
 1029   NS_LOG_FUNCTION (
this << 
"sender " << sender << 
" receiver " << receiver);
 
 1035                                                m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
 
 1043       if (toNeighbor.GetValidSeqNo () && (toNeighbor.GetHop () == 1) && (toNeighbor.GetOutputDevice () == dev))
 
 1050                                                    m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
 
 1052                                                   toNeighbor.GetChannel());
 
 1070       if (toPrev.IsUnidirectional ())
 
 1077   uint32_t 
id = rreqHeader.GetId ();
 
 1091   uint8_t hop = rreqHeader.GetHopCount () + 1;
 
 1092   rreqHeader.SetHopCount (hop);
 
 1109                                                m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),  hop,
 
 1111                                               rreqHeader.GetRXChannel());
 
 1116       if (toOrigin.GetValidSeqNo ())
 
 1118           if (int32_t (rreqHeader.GetOriginSeqno ()) - int32_t (toOrigin.GetSeqNo ()) > 0)
 
 1119             toOrigin.SetSeqNo (rreqHeader.GetOriginSeqno ());
 
 1122         toOrigin.SetSeqNo (rreqHeader.GetOriginSeqno ());
 
 1123       toOrigin.SetValidSeqNo (
true);
 
 1124       toOrigin.SetNextHop (src);
 
 1125       toOrigin.SetChannel (rreqHeader.GetRXChannel());
 
 1126       toOrigin.SetOutputDevice (
m_ipv4->GetNetDevice (
m_ipv4->GetInterfaceForAddress (receiver)));
 
 1127       toOrigin.SetInterface (
m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0));
 
 1128       toOrigin.SetHop (hop);
 
 1130                                       toOrigin.GetLifeTime ()));
 
 1133   NS_LOG_LOGIC (receiver << 
" receive RREQ with hop count " << static_cast<uint32_t>(rreqHeader.GetHopCount ()) 
 
 1134                          << 
" ID " << rreqHeader.GetId ()
 
 1135                          << 
" to destination " << rreqHeader.GetDst ()
 
 1136                          << 
" Originator RX channel = " << rreqHeader.GetRXChannel ());
 
 1143       NS_LOG_DEBUG (
"Send reply since I am the destination");
 
 1158       if (toDst.GetNextHop () == src)
 
 1160           NS_LOG_DEBUG (
"Drop RREQ from " << src << 
", dest next hop " << toDst.GetNextHop ());
 
 1169       if ((rreqHeader.GetUnknownSeqno () || (int32_t (toDst.GetSeqNo ()) - int32_t (rreqHeader.GetDstSeqno ()) >= 0))
 
 1170           && toDst.GetValidSeqNo () )
 
 1172           if (!rreqHeader.GetDestinationOnly () && toDst.GetFlag () == 
VALID)
 
 1178           rreqHeader.SetDstSeqno (toDst.GetSeqNo ());
 
 1179           rreqHeader.SetUnknownSeqno (
false);
 
 1203           destination = iface.GetBroadcast ();
 
 1226   if (!rreqHeader.GetUnknownSeqno () && (rreqHeader.GetDstSeqno () == 
m_seqNo + 1))
 
 1228   RrepHeader rrepHeader (  0,  0,  rreqHeader.GetDst (),
 
 1246   RrepHeader rrepHeader ( 0,  toDst.GetHop (),  toDst.GetDestination (),  toDst.GetSeqNo (),
 
 1247                                            toOrigin.GetDestination (),  toDst.GetLifeTime (),
 
 1252   if (toDst.GetHop () == 1)
 
 1254       rrepHeader.SetAckRequired (
true);
 
 1279       RrepHeader gratRepHeader ( 0,  toOrigin.GetHop (),  toOrigin.GetDestination (),
 
 1280                                                   toOrigin.GetSeqNo (),  toDst.GetDestination (),
 
 1281                                                   toOrigin.GetLifeTime (),
 
 1321   NS_LOG_LOGIC (
"RREP destination " << dst << 
" RREP origin " << rrepHeader.GetOrigin ()
 
 1322                 << 
" channel number: " << rrepHeader.GetRXChannel());
 
 1324   uint8_t hop = rrepHeader.GetHopCount () + 1;
 
 1325   rrepHeader.SetHopCount (hop);
 
 1328   if (dst == rrepHeader.GetOrigin ())
 
 1346                                            m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0), hop,
 
 1347                                            sender,  rrepHeader.GetLifeTime (), rrepHeader.GetRXChannel());
 
 1355       if (!toDst.GetValidSeqNo ())
 
 1360       else if ((int32_t (rrepHeader.GetDstSeqno ()) - int32_t (toDst.GetSeqNo ())) > 0)
 
 1367           if ((rrepHeader.GetDstSeqno () == toDst.GetSeqNo ()) && (toDst.GetFlag () != 
VALID))
 
 1372           else if ((rrepHeader.GetDstSeqno () == toDst.GetSeqNo ()) && (hop < toDst.GetHop ()))
 
 1385   if (rrepHeader.GetAckRequired ())
 
 1388       rrepHeader.SetAckRequired (
false);
 
 1390   NS_LOG_LOGIC (
"receiver " << receiver << 
" origin " << rrepHeader.GetOrigin ());
 
 1415       toDst.InsertPrecursor (toOrigin.GetNextHop ());
 
 1470       RoutingTableEntry newEntry ( dev,  rrepHeader.GetDst (),  
true,  rrepHeader.GetDstSeqno (),
 
 1471                                                m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
 
 1472                                                1,  rrepHeader.GetDst (),  rrepHeader.GetLifeTime (),
 
 1473                                               rrepHeader.GetRXChannel());
 
 1479       toNeighbor.SetSeqNo (rrepHeader.GetDstSeqno ());
 
 1480       toNeighbor.SetValidSeqNo (
true);
 
 1481       toNeighbor.SetChannel (rrepHeader.GetRXChannel());
 
 1482       toNeighbor.SetFlag (
VALID);
 
 1483       toNeighbor.SetOutputDevice (
m_ipv4->GetNetDevice (
m_ipv4->GetInterfaceForAddress (receiver)));
 
 1484       toNeighbor.SetInterface (
m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0));
 
 1499   std::map<Ipv4Address, uint32_t> dstWithNextHopSrc;
 
 1500   std::map<Ipv4Address, uint32_t> unreachable;
 
 1502   std::pair<Ipv4Address, uint32_t> un;
 
 1505       for (std::map<Ipv4Address, uint32_t>::const_iterator i =
 
 1506            dstWithNextHopSrc.begin (); i != dstWithNextHopSrc.end (); ++i)
 
 1508         if (i->first == un.first)
 
 1510             unreachable.insert (un);
 
 1515   std::vector<Ipv4Address> precursors;
 
 1516   for (std::map<Ipv4Address, uint32_t>::const_iterator i = unreachable.begin ();
 
 1517        i != unreachable.end ();)
 
 1528           rerrHeader.
Clear ();
 
 1569       NS_LOG_LOGIC (
"route discovery to " << dst << 
" has been attempted RreqRetries (" << 
RreqRetries << 
") times");
 
 1572       NS_LOG_DEBUG (
"Route not found. Drop all packets with dst " << dst);
 
 1584       NS_LOG_DEBUG (
"Route down. Stop search. Drop packet with destination " << dst);
 
 1655           destination = iface.GetBroadcast ();
 
 1669       Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
 
 1673           tag.GetInterface() != -1 &&
 
 1676           NS_LOG_DEBUG (
"Output device doesn't match. Dropped.");
 
 1680       Ipv4Header header = queueEntry.GetIpv4Header ();
 
 1683       ucb (route, p, header);
 
 1692   std::vector<Ipv4Address> precursors;
 
 1693   std::map<Ipv4Address, uint32_t> unreachable;
 
 1701   for (std::map<Ipv4Address, uint32_t>::const_iterator i = unreachable.begin (); i
 
 1702        != unreachable.end ();)
 
 1714           rerrHeader.
Clear ();
 
 1734   unreachable.insert (std::make_pair (nextHop, toNextHop.GetSeqNo ()));
 
 1751                                                 << 
"; suppressing RERR");
 
 1765           toOrigin.GetInterface ());
 
 1767       NS_LOG_LOGIC (
"Unicast RERR to the source of the data transmission");
 
 1778           NS_LOG_LOGIC (
"Broadcast RERR message from interface " << iface.GetLocal ());
 
 1787               destination = iface.GetBroadcast ();
 
 1799   if (precursors.empty ())
 
 1812                                                 << 
"; suppressing RERR");
 
 1816   if (precursors.size () == 1)
 
 1823           NS_LOG_LOGIC (
"one precursor => unicast RERR to " << toPrecursor.GetDestination () << 
" from " << toPrecursor.GetInterface ().GetLocal ());
 
 1831   std::vector<Ipv4InterfaceAddress> ifaces;
 
 1833   for (std::vector<Ipv4Address>::const_iterator i = precursors.begin (); i != precursors.end (); ++i)
 
 1836           std::find (ifaces.begin (), ifaces.end (), toPrecursor.GetInterface ()) == ifaces.end ())
 
 1838           ifaces.push_back (toPrecursor.GetInterface ());
 
 1842   for (std::vector<Ipv4InterfaceAddress>::const_iterator i = ifaces.begin (); i != ifaces.end (); ++i)
 
 1846       NS_LOG_LOGIC (
"Broadcast RERR message from interface " << i->GetLocal ());
 
 1855           destination = i->GetBroadcast ();
 
uint32_t RemoveHeader(Header &header)
void SendReplyAck(Ipv4Address neighbor)
Send RREP_ACK. 
static Ipv4Mask GetOnes(void)
void InvalidateRoutesWithDst(std::map< Ipv4Address, uint32_t > const &unreachable)
bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout)
Ipv4Address GetIpv4(void) const 
static Ipv4Address GetAny(void)
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream. 
uint16_t m_rreqCount
Number of RREQs used for RREQ rate control. 
Time MaxQueueTime
The maximum period of time that a routing protocol is allowed to buffer a packet for. 
bool LookupRoute(Ipv4Address dst, RoutingTableEntry &rt)
void Clear()
Delete all entries from routing table. 
RoutingTable m_routingTable
Routing table. 
hold variables of type string 
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed. 
a class to represent an Ipv4 address mask 
Tag used by AODV implementation. 
void AddPacketTag(const Tag &tag) const 
uint32_t MaxQueueLen
The maximum number of packets that we allow a routing protocol to buffer. 
Ptr< Ipv4 > m_ipv4
IP protocol. 
bool Update(RoutingTableEntry &rt)
Update routing table. 
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream) const 
Print the Routing Table entries. 
Ptr< Repository > m_crRepository
Pointer to cognitive radio repository. 
uint64_t GetUid(void) const 
Timer m_ackTimer
RREP_ACK timer. 
bool Forwarding(Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
If route exists and valid, forward packet. 
#define NS_ASSERT(condition)
void DelArpCache(Ptr< ArpCache >)
Don't use given ARP cache any more (interface is down) 
void SendHello()
Send hello. 
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
int64_t AssignStreams(int64_t stream)
Timer m_rreqRateLimitTimer
RREQ rate limit timer. 
bool IsMulticast(void) const 
virtual void DoDispose(void)
Time NetTraversalTime
Estimate of the average net traversal time. 
Neighbors m_nb
Handle neighbors. 
void GetPrecursors(std::vector< Ipv4Address > &prec) const 
TAG_BUFFER_INLINE uint32_t ReadU32(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
uint32_t RreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route. 
RequestQueue m_queue
A "drop-front" queue used by the routing layer to buffer packets to which it does not have a route...
bool Enqueue(QueueEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...
uint32_t m_seqNo
Request sequence number. 
void ScheduleRreqRetry(Ipv4Address dst)
Ptr< Socket > FindSocketWithInterfaceAddress(Ipv4InterfaceAddress iface) const 
Find socket with local interface address iface. 
a polymophic address class 
bool IsRunning(void) const 
Ptr< Ipv4Route > LoopbackRoute(const Ipv4Header &header, Ptr< NetDevice > oif) const 
Create loopback route for given header. 
void SetSource(Ipv4Address src)
void RecvAodv(Ptr< Socket > socket)
Receive and process control packet. 
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
Ptr< NetDevice > GetOutputDevice(void) const 
bool InsertPrecursor(Ipv4Address id)
double GetSeconds(void) const 
void Print(Ptr< OutputStreamWrapper > stream) const 
Print routing table. 
bool DestinationOnly
Indicates only the destination may respond to this RREQ. 
void RecvReplyAck(Ipv4Address neighbor)
Receive RREP_ACK. 
bool PeekPacketTag(Tag &tag) const 
bool IsDuplicate(Ptr< const Packet > p, const Ipv4Header &header)
Check that the packet is duplicated. If not, save information about this packet. 
void DeferredRouteOutput(Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
Queue packet and send route request. 
bool IsMyOwnAddress(Ipv4Address src)
Check that packet is send from own interface. 
bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
Route an input packet (to be forwarded or locally delivered) 
void RecvReply(Ptr< Packet > p, Ipv4Address my, Ipv4Address src)
Receive RREP. 
void DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
Delete all route from interface with address iface. 
void HelloTimerExpire()
Schedule next send of hello message. 
hold objects of type ns3::Time 
void SetGateway(Ipv4Address gw)
bool UpdateRouteLifeTime(Ipv4Address addr, Time lt)
Hold an unsigned integer type. 
void UpdateRouteToNeighbor(Ipv4Address sender, Ipv4Address receiver)
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
bool IsBroadcast(void) const 
uint16_t RreqRateLimit
Maximum number of RREQ per second. 
int32_t m_oif
Positive if output device is fixed in RouteOutput. 
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
Hold together all Wifi-related objects.This class holds together ns3::WifiChannel, ns3::WifiPhy, ns3::WifiMac, and, ns3::WifiRemoteStationManager. 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read. 
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
void SendReplyByIntermediateNode(RoutingTableEntry &toDst, RoutingTableEntry &toOrigin, bool gratRep)
Ipv4Address GetSource(void) const 
void AddArpCache(Ptr< ArpCache >)
Add ARP cache to be used to allow layer 2 notifications processing. 
Callback< void, WifiMacHeader const & > GetTxErrorCallback() const 
Get callback to ProcessTxError. 
void SetDelay(const Time &delay)
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst. 
#define NS_LOG_LOGIC(msg)
uint16_t m_rerrCount
Number of RERRs used for RERR rate control. 
Ipv4Address GetGateway(void) const 
void GetListOfDestinationWithNextHop(Ipv4Address nextHop, std::map< Ipv4Address, uint32_t > &unreachable)
Lookup routing entries with next hop Address dst and not empty list of precursors. 
Ptr< Packet > Copy(void) const 
void SendRerrWhenNoRouteToForward(Ipv4Address dst, uint32_t dstSeqNo, Ipv4Address origin)
tag a set of bytes in a packet 
void Clear()
Remove all entries. 
void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop)
Initiate RERR. 
void SendPacketFromQueue(Ipv4Address dst, Ptr< Ipv4Route > route, uint16_t channel)
Forward packet from route request queue. 
Implement the Ipv4 layer. 
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket. 
static InetSocketAddress ConvertFrom(const Address &address)
Time ActiveRouteTimeout
Period of time during which the route is considered to be valid. 
void RecvRequest(Ptr< Packet > p, Ipv4Address receiver, Ipv4Address src)
Receive RREQ. 
std::map< Ptr< Socket >, Ipv4InterfaceAddress > m_socketAddresses
Raw socket per each IP interface, map socket -> iface address (IP + mask) 
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
uint32_t GetSerializedSize() const 
void Update(Ipv4Address addr, Time expire)
Update expire time for entry with address addr, if it exists, else add new entry. ...
void SetOutputDevice(Ptr< NetDevice > outputDevice)
void ProcessHello(RrepHeader const &rrepHeader, Ipv4Address receiverIfaceAddr)
Process hello message. 
static Ipv4Address GetLoopback(void)
virtual void NotifyInterfaceUp(uint32_t interface)
DuplicatePacketDetection m_dpd
Handle duplicated broadcast/multicast packets. 
bool EnableBroadcast
Indicates whether a a broadcast data packets forwarding enable. 
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device. 
void RecvError(Ptr< Packet > p, Ipv4Address src)
Receive RERR from node with address src. 
void RreqRateLimitTimerExpire()
Reset RREQ count and schedule RREQ rate limit timer with delay 1 sec. 
#define NS_ASSERT_MSG(condition, message)
void Serialize(TagBuffer i) const 
Time PathDiscoveryTime
Estimate of maximum time needed to find route in network. 
Ipv4Address GetDestination(void) const 
Time BlackListTimeout
Time for which the node is put into the blacklist. 
Ipv4 addresses are stored in host order in this class. 
Time NextHopWait
Period of our waiting for the neighbour's RREP_ACK. 
virtual void NotifyInterfaceDown(uint32_t interface)
Time Seconds(double seconds)
create ns3::Time instances in units of seconds. 
void SetRepository(Ptr< Repository > repo)
Set cognitive radio repository. 
Time MyRouteTimeout
Value of lifetime field in RREP generating by this node. 
uint32_t GetId(void) const 
a class to store IPv4 address information on an interface 
bool AddRoute(RoutingTableEntry &r)
bool RemovePacketTag(Tag &tag)
#define NS_LOG_DEBUG(msg)
uint32_t AllowedHelloLoss
Number of hello messages which may be loss for valid link. 
void SendRerrMessage(Ptr< Packet > packet, std::vector< Ipv4Address > precursors)
Forward RERR. 
bool IsDuplicate(Ipv4Address addr, uint32_t id)
Check that entry (addr, id) exists in cache. Add entry, if it doesn't exist. 
void Print(std::ostream &os) const 
void SendReply(RreqHeader const &rreqHeader, RoutingTableEntry const &toOrigin)
Send RREP. 
Abstract base class for IPv4 routing protocols. 
uint32_t NetDiameter
Net diameter measures the maximum possible number of hops between two nodes in the network...
Timer m_rerrRateLimitTimer
RERR rate limit timer. 
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer. 
void AckTimerExpire(Ipv4Address neighbor, Time blacklistTimeout)
Mark link to neighbor node as unidirectional for blacklistTimeout. 
std::map< Ipv4Address, Timer > m_addressReqTimer
Map IP address + RREQ timer. 
Time MilliSeconds(uint64_t ms)
create ns3::Time instances in units of milliseconds. 
bool GratuitousReply
Indicates whether a gratuitous RREP should be unicast to the node originated route discovery...
#define NS_LOG_ERROR(msg)
uint16_t RerrRateLimit
Maximum number of REER per second. 
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables. 
void SendRequest(Ipv4Address dst)
Send RREQ. 
bool Dequeue(Ipv4Address dst, QueueEntry &entry)
Return first found (the earliest) entry for given destination. 
void RerrRateLimitTimerExpire()
Reset RERR count and schedule RERR rate limit timer with delay 1 sec. 
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address. 
IdCache m_rreqIdCache
Handle duplicated RREQ. 
void RouteRequestTimerExpire(Ipv4Address dst)
Handle route discovery process. 
TypeId GetInstanceTypeId() const 
void Start()
Start protocol operation. 
virtual int Close(void)=0
Close a socket. 
bool LookupValidRoute(Ipv4Address dst, RoutingTableEntry &rt)
Lookup route in VALID state. 
Time GetDelayLeft(void) const 
void SetAttribute(std::string name, const AttributeValue &value)
bool DeleteRoute(Ipv4Address dst)
void Purge()
Delete all outdated entries and invalidate valid entry if Lifetime is expired. 
a unique identifier for an interface. 
Timer m_htimer
Hello timer. 
Ptr< NetDevice > m_lo
Loopback device used to defer RREQ until packet will be fully formed. 
void Deserialize(TagBuffer i)
uint32_t m_requestId
Broadcast ID. 
TypeId SetParent(TypeId tid)
Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
Query routing cache for an existing route, for an outbound packet. 
static Time GetMaximumSimulationTime(void)
Time MicroSeconds(uint64_t us)
create ns3::Time instances in units of microseconds. 
std::ostream * GetStream(void)
void AddHeader(const Header &header)
void SetDestination(Ipv4Address dest)
void ScheduleTimer()
Schedule m_ntimer. 
static const uint32_t AODV_PORT
UDP Port for AODV control traffic. 
bool EnableHello
Indicates whether a hello messages enable.