28 #define NS_LOG_APPEND_CONTEXT \
29 if (m_ipv4) { std::clog << "[node " << m_ipv4->GetObject<Node> ()->GetId () << "] "; }
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"
92 return sizeof(int32_t);
107 os <<
"DeferredRouteOutputTag: output interface = " <<
m_oif;
124 ActiveRouteTimeout (Seconds (3)),
126 NodeTraversalTime (MilliSeconds (40)),
127 NetTraversalTime (
Time ((2 * NetDiameter) * NodeTraversalTime)),
128 PathDiscoveryTime (
Time (2 * NetTraversalTime)),
129 MyRouteTimeout (
Time (2 * std::max (PathDiscoveryTime, ActiveRouteTimeout))),
130 HelloInterval (Seconds (1)),
131 AllowedHelloLoss (2),
132 DeletePeriod (
Time (5 * std::max (ActiveRouteTimeout, HelloInterval))),
133 NextHopWait (NodeTraversalTime + MilliSeconds (10)),
134 BlackListTimeout (
Time (RreqRetries * NetTraversalTime)),
136 MaxQueueTime (Seconds (30)),
137 DestinationOnly (false),
138 GratuitousReply (true),
140 m_routingTable (DeletePeriod),
141 m_queue (MaxQueueLen, MaxQueueTime),
144 m_rreqIdCache (PathDiscoveryTime),
145 m_dpd (PathDiscoveryTime),
146 m_nb (HelloInterval),
149 m_htimer (
Timer::CANCEL_ON_DESTROY),
150 m_rreqRateLimitTimer (
Timer::CANCEL_ON_DESTROY),
151 m_rerrRateLimitTimer (
Timer::CANCEL_ON_DESTROY),
152 m_lastBcastTime (Seconds (0))
160 static TypeId tid =
TypeId (
"ns3::aodv::RoutingProtocol")
162 .AddConstructor<RoutingProtocol> ()
163 .AddAttribute (
"HelloInterval",
"HELLO messages emission interval.",
167 .AddAttribute (
"RreqRetries",
"Maximum number of retransmissions of RREQ to discover a route",
170 MakeUintegerChecker<uint32_t> ())
171 .AddAttribute (
"RreqRateLimit",
"Maximum number of RREQ per second.",
174 MakeUintegerChecker<uint32_t> ())
175 .AddAttribute (
"RerrRateLimit",
"Maximum number of RERR per second.",
178 MakeUintegerChecker<uint32_t> ())
179 .AddAttribute (
"NodeTraversalTime",
"Conservative estimate of the average one hop traversal time for packets and should include "
180 "queuing delays, interrupt processing times and transfer times.",
184 .AddAttribute (
"NextHopWait",
"Period of our waiting for the neighbour's RREP_ACK = 10 ms + NodeTraversalTime",
188 .AddAttribute (
"ActiveRouteTimeout",
"Period of time during which the route is considered to be valid",
192 .AddAttribute (
"MyRouteTimeout",
"Value of lifetime field in RREP generating by this node = 2 * max(ActiveRouteTimeout, PathDiscoveryTime)",
196 .AddAttribute (
"BlackListTimeout",
"Time for which the node is put into the blacklist = RreqRetries * NetTraversalTime",
200 .AddAttribute (
"DeletePeriod",
"DeletePeriod is intended to provide an upper bound on the time for which an upstream node A "
201 "can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D."
202 " = 5 * max (HelloInterval, ActiveRouteTimeout)",
206 .AddAttribute (
"NetDiameter",
"Net diameter measures the maximum possible number of hops between two nodes in the network",
209 MakeUintegerChecker<uint32_t> ())
210 .AddAttribute (
"NetTraversalTime",
"Estimate of the average net traversal time = 2 * NodeTraversalTime * NetDiameter",
214 .AddAttribute (
"PathDiscoveryTime",
"Estimate of maximum time needed to find route in network = 2 * NetTraversalTime",
218 .AddAttribute (
"MaxQueueLen",
"Maximum number of packets that we allow a routing protocol to buffer.",
222 MakeUintegerChecker<uint32_t> ())
223 .AddAttribute (
"MaxQueueTime",
"Maximum time packets can be queued (in seconds)",
228 .AddAttribute (
"AllowedHelloLoss",
"Number of hello messages which may be loss for valid link.",
231 MakeUintegerChecker<uint16_t> ())
232 .AddAttribute (
"GratuitousReply",
"Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.",
236 MakeBooleanChecker ())
237 .AddAttribute (
"DestinationOnly",
"Indicates only the destination may respond to this RREQ.",
241 MakeBooleanChecker ())
242 .AddAttribute (
"EnableHello",
"Indicates whether a hello messages enable.",
246 MakeBooleanChecker ())
247 .AddAttribute (
"EnableBroadcast",
"Indicates whether a broadcast data packets forwarding enable.",
251 MakeBooleanChecker ())
252 .AddAttribute (
"UniformRv",
253 "Access to the underlying UniformRandomVariable",
256 MakePointerChecker<UniformRandomVariable> ())
285 iter->first->Close ();
364 uint32_t iif = (oif ?
m_ipv4->GetInterfaceForDevice (oif) : -1);
388 if(!result || ((rt.GetFlag () !=
IN_SEARCH) && result))
411 int32_t iif =
m_ipv4->GetInterfaceForDevice (idev);
447 NS_LOG_DEBUG (
"Duplicated packet " << p->
GetUid () <<
" from " << origin <<
". Drop.");
452 if (lcb.
IsNull () ==
false)
455 lcb (p, header, iif);
460 NS_LOG_ERROR (
"Unable to deliver packet locally due to null callback " << p->
GetUid () <<
" from " << origin);
474 ucb (route, packet, header);
490 if (
m_ipv4->IsDestinationAddress (dst, iif))
499 if (lcb.
IsNull () ==
false)
502 lcb (p, header, iif);
506 NS_LOG_ERROR (
"Unable to deliver packet locally due to null callback " << p->
GetUid () <<
" from " << origin);
553 ucb (route, p, header);
566 NS_LOG_LOGIC (
"route not found to "<< dst <<
". Send RERR message.");
605 if (l3->GetNAddresses (i) > 1)
607 NS_LOG_WARN (
"AODV does not work with more then one address per each interface.");
656 mac->TraceDisconnectWithoutContext (
"TxErrHeader",
681 NS_LOG_FUNCTION (
this <<
" interface " << i <<
" address " << address);
685 if (l3->GetNAddresses (i) == 1)
715 NS_LOG_LOGIC (
"AODV does not work with more then one address per each interface. Ignore added address");
729 if (l3->GetNAddresses (i))
759 NS_LOG_LOGIC (
"Remove address not participating in AODV operation");
809 int32_t
interface =
m_ipv4->GetInterfaceForAddress (addr);
810 if (oif ==
m_ipv4->GetNetDevice (static_cast<uint32_t> (interface)))
943 NS_LOG_DEBUG (
"AODV node " <<
this <<
" received a AODV packet from " << sender <<
" to " << receiver);
950 NS_LOG_DEBUG (
"AODV message " << packet->
GetUid () <<
" with unknown type received: " << tHeader.
Get () <<
". Drop");
953 switch (tHeader.
Get ())
1000 NS_LOG_FUNCTION (
this <<
"sender " << sender <<
" receiver " << receiver);
1006 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
1020 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
1046 uint32_t
id = rreqHeader.
GetId ();
1078 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0), hop,
1106 NS_LOG_DEBUG (
"Neighbor:" << src <<
" not found in routing table. Creating an entry");
1109 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
1126 <<
" ID " << rreqHeader.
GetId ()
1127 <<
" to destination " << rreqHeader.
GetDst ());
1134 NS_LOG_DEBUG (
"Send reply since I am the destination");
1214 packet->AddHeader (tHeader);
1229 if (toDst.
GetHop () == 1)
1260 packetToDst->AddHeader (type);
1315 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0), hop,
1324 if (!toDst.GetValidSeqNo ())
1329 else if ((int32_t (rrepHeader.
GetDstSeqno ()) - int32_t (toDst.GetSeqNo ())) > 0)
1336 if ((rrepHeader.
GetDstSeqno () == toDst.GetSeqNo ()) && (toDst.GetFlag () !=
VALID))
1341 else if ((rrepHeader.
GetDstSeqno () == toDst.GetSeqNo ()) && (hop < toDst.GetHop ()))
1384 toDst.InsertPrecursor (toOrigin.
GetNextHop ());
1437 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
1445 toNeighbor.SetValidSeqNo (
true);
1446 toNeighbor.SetFlag (
VALID);
1447 toNeighbor.SetOutputDevice (
m_ipv4->GetNetDevice (
m_ipv4->GetInterfaceForAddress (receiver)));
1448 toNeighbor.SetInterface (
m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0));
1463 std::map<Ipv4Address, uint32_t> dstWithNextHopSrc;
1464 std::map<Ipv4Address, uint32_t> unreachable;
1466 std::pair<Ipv4Address, uint32_t> un;
1469 for (std::map<Ipv4Address, uint32_t>::const_iterator i =
1470 dstWithNextHopSrc.begin (); i != dstWithNextHopSrc.end (); ++i)
1472 if (i->first == un.first)
1474 unreachable.insert (un);
1479 std::vector<Ipv4Address> precursors;
1480 for (std::map<Ipv4Address, uint32_t>::const_iterator i = unreachable.begin ();
1481 i != unreachable.end ();)
1490 rerrHeader.
Clear ();
1529 NS_LOG_LOGIC (
"route discovery to " << dst <<
" has been attempted RreqRetries (" <<
RreqRetries <<
") times");
1532 NS_LOG_DEBUG (
"Route not found. Drop all packets with dst " << dst);
1544 NS_LOG_DEBUG (
"Route down. Stop search. Drop packet with destination " << dst);
1613 packet->AddHeader (tHeader);
1642 NS_LOG_DEBUG (
"Output device doesn't match. Dropped.");
1649 ucb (route, p, header);
1658 std::vector<Ipv4Address> precursors;
1659 std::map<Ipv4Address, uint32_t> unreachable;
1667 for (std::map<Ipv4Address, uint32_t>::const_iterator i = unreachable.begin (); i
1668 != unreachable.end ();)
1678 rerrHeader.
Clear ();
1696 unreachable.insert (std::make_pair (nextHop, toNextHop.
GetSeqNo ()));
1713 <<
"; suppressing RERR");
1727 NS_LOG_LOGIC (
"Unicast RERR to the source of the data transmission");
1759 if (precursors.empty ())
1772 <<
"; suppressing RERR");
1776 if (precursors.size () == 1)
1791 std::vector<Ipv4InterfaceAddress> ifaces;
1793 for (std::vector<Ipv4Address>::const_iterator i = precursors.begin (); i != precursors.end (); ++i)
1796 std::find (ifaces.begin (), ifaces.end (), toPrecursor.
GetInterface ()) == ifaces.end ())
1802 for (std::vector<Ipv4InterfaceAddress>::const_iterator i = ifaces.begin (); i != ifaces.end (); ++i)
1806 NS_LOG_LOGIC (
"Broadcast RERR message from interface " << i->GetLocal ());
1815 destination = i->GetBroadcast ();
UnicastForwardCallback GetUnicastForwardCallback() const
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
static TypeId GetTypeId(void)
Get the type ID.
void SendReplyAck(Ipv4Address neighbor)
Send RREP_ACK.
static Ipv4Mask GetOnes(void)
void InvalidateRoutesWithDst(std::map< Ipv4Address, uint32_t > const &unreachable)
Update routing entries with this destinations as follows:
keep track of time values and allow control of global simulation resolution
bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout)
Mark entry as unidirectional (e.g.
Ipv4Address GetIpv4(void) const
static Ipv4Address GetAny(void)
void SetOutputDevice(Ptr< NetDevice > dev)
RREP_ACK timer.
#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.
Ipv4Mask GetMask(void) const
Get the network mask.
Time MaxQueueTime
The maximum period of time that a routing protocol is allowed to buffer a packet for.
NS_LOG_COMPONENT_DEFINE("AodvRoutingProtocol")
bool LookupRoute(Ipv4Address dst, RoutingTableEntry &rt)
Lookup routing table entry with destination address dst.
void Clear()
Delete all entries from routing table.
void SendTo(Ptr< Socket > socket, Ptr< Packet > packet, Ipv4Address destination)
RoutingTable m_routingTable
Routing table.
Ipv4Header GetIpv4Header() const
Ipv4Address GetLocal(void) const
Get the local address.
bool GetBroadcastEnable() const
hold variables of type string
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
void SetDesinationOnlyFlag(bool f)
a class to represent an Ipv4 address mask
Tag used by AODV implementation.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
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.
uint64_t GetUid(void) const
A packet is allocated a new uid when it is created empty or with zero-filled payload.
Timer m_ackTimer
RREP_ACK timer.
void IncrementRreqCnt()
RREP_ACK timer.
bool Forwarding(Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
If route exists and valid, forward packet.
bool IsNull(void) const
Check for null implementation.
void SetMaxQueueLen(uint32_t len)
#define NS_ASSERT(condition)
void DelArpCache(Ptr< ArpCache >)
Don't use given ARP cache any more (interface is down)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
void SendHello()
Send hello.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
void SetMaxQueueLen(uint32_t len)
Timer m_rreqRateLimitTimer
RREQ rate limit timer.
bool IsMulticast(void) const
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Ptr< NetDevice > GetOutputDevice() const
RREP_ACK timer.
Time NetTraversalTime
Estimate of the average net traversal time.
Neighbors m_nb
Handle neighbors.
void GetPrecursors(std::vector< Ipv4Address > &prec) const
Inserts precursors in vector prec if they does not yet exist in vector.
void SetGratuitousReplyFlag(bool f)
TAG_BUFFER_INLINE uint32_t ReadU32(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
void SetLifeTime(Time lt)
RREP_ACK timer.
uint32_t RreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
SocketErrno
Enumeration of the possible errors returned by a socket.
Time m_lastBcastTime
Keep track of the last bcast time.
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 SetInterface(int32_t oif)
void ScheduleRreqRetry(Ipv4Address dst)
To reduce congestion in a network, repeated attempts by a source node at route discovery for a single...
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)
Insert precursor in precursor list if it doesn't yet exist in the list.
double GetSeconds(void) const
void Print(Ptr< OutputStreamWrapper > stream) const
Print routing table.
Time GetLifeTime() const
RREP_ACK timer.
bool DestinationOnly
Indicates only the destination may respond to this RREQ.
void SetRreqCnt(uint8_t n)
RREP_ACK timer.
void RecvReplyAck(Ipv4Address neighbor)
Receive RREP_ACK.
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
bool IsDuplicate(Ptr< const Packet > p, const Ipv4Header &header)
Check that the packet is duplicated. If not, save information about this packet.
void SendPacketFromQueue(Ipv4Address dst, Ptr< Ipv4Route > route)
Forward packet from route request queue.
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 Schedule(void)
Schedule a new event using the currently-configured delay, function, and arguments.
Ipv4Address GetNextHop() const
RREP_ACK timer.
void SetGateway(Ipv4Address gw)
bool UpdateRouteLifeTime(Ipv4Address addr, Time lt)
Set lifetime field in routing table entry to the maximum of existing lifetime and lt...
Hold an unsigned integer type.
void UpdateRouteToNeighbor(Ipv4Address sender, Ipv4Address receiver)
Update neighbor record.
Time HelloInterval
Every HelloInterval the node checks whether it has sent a broadcast within the last HelloInterval...
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
bool GetDesinationOnlyFlag() const
bool IsBroadcast(void) const
void SetSeqNo(uint32_t sn)
RREP_ACK timer.
uint16_t RreqRateLimit
Maximum number of RREQ per second.
void SetValidSeqNo(bool s)
RREP_ACK timer.
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.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
static TypeId GetTypeId(void)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
Time GetMaxQueueTime() const
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
void SendReplyByIntermediateNode(RoutingTableEntry &toDst, RoutingTableEntry &toOrigin, bool gratRep)
Send RREP by intermediate node.
Ipv4Address GetSource(void) const
void AddArpCache(Ptr< ArpCache >)
Add ARP cache to be used to allow layer 2 notifications processing.
Ptr< const Packet > GetPacket() const
Ipv4InterfaceAddress GetInterface() const
RREP_ACK timer.
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 SetMaxQueueTime(Time t)
void GetListOfDestinationWithNextHop(Ipv4Address nextHop, std::map< Ipv4Address, uint32_t > &unreachable)
Lookup routing entries with next hop Address dst and not empty list of precursors.
bool GetHelloEnable() const
void SetInterface(Ipv4InterfaceAddress iface)
RREP_ACK timer.
Ptr< Packet > Copy(void) const
void SendRerrWhenNoRouteToForward(Ipv4Address dst, uint32_t dstSeqNo, Ipv4Address origin)
Send RERR message when no route to forward input packet.
This policy cancels the event from the destructor of the Timer to verify that the event has already e...
tag a set of bytes in a packet
void Clear()
Remove all entries.
void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop)
Initiate RERR.
Time NodeTraversalTime
NodeTraversalTime is a conservative estimate of the average one hop traversal time for packets and sh...
Implement the Ipv4 layer.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
static InetSocketAddress ConvertFrom(const Address &address)
void SetFlag(RouteFlags flag)
RREP_ACK timer.
bool GetGratuitousReplyFlag() const
uint16_t GetHop() const
RREP_ACK timer.
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)
Schedule an event to expire Now.
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. ...
static Time Now(void)
Return the "current simulation time".
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Equivalent in Linux to dst_entry.dev.
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.
int32_t GetInterface() const
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.
void SetHop(uint16_t hop)
RREP_ACK timer.
Ipv4 addresses are stored in host order in this class.
Time NextHopWait
Period of our waiting for the neighbour's RREP_ACK.
Time DeletePeriod
DeletePeriod is intended to provide an upper bound on the time for which an upstream node A can have ...
Ipv4Address GetBroadcast(void) const
Get the broadcast address.
virtual void NotifyInterfaceDown(uint32_t interface)
virtual ~RoutingProtocol()
Time MyRouteTimeout
Value of lifetime field in RREP generating by this node.
a class to store IPv4 address information on an interface
uint32_t GetSeqNo() const
RREP_ACK timer.
void SetQueueTimeout(Time t)
bool AddRoute(RoutingTableEntry &r)
Add routing table entry if it doesn't yet exist in routing table.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
#define NS_LOG_DEBUG(msg)
void Cancel(void)
Cancel the currently-running event if there is one.
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 SetCallback(Callback< void, Ipv4Address > cb)
void Print(std::ostream &os) const
void SendReply(RreqHeader const &rreqHeader, RoutingTableEntry const &toOrigin)
Send RREP.
Abstract base class for IPv4 routing protocols.
void SetNextHop(Ipv4Address nextHop)
RREP_ACK timer.
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.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
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.
Ptr< Ipv4Route > GetRoute() const
RREP_ACK timer.
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.
DeferredRouteOutputTag(int32_t o=-1)
IdCache m_rreqIdCache
Handle duplicated RREQ.
void RouteRequestTimerExpire(Ipv4Address dst)
Handle route discovery process.
TypeId GetInstanceTypeId() const
void Start()
Start protocol operation.
void SetHelloEnable(bool f)
virtual int Close(void)=0
Close a socket.
bool LookupValidRoute(Ipv4Address dst, RoutingTableEntry &rt)
Lookup route in VALID state.
Time GetDelayLeft(void) const
static TypeId GetTypeId()
void SetAttribute(std::string name, const AttributeValue &value)
bool IsUnidirectional() const
RREP_ACK timer.
void SetBroadcastEnable(bool f)
bool DeleteRoute(Ipv4Address dst)
Delete routing table entry with destination address dst, if it exists.
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.
RouteFlags GetFlag() const
RREP_ACK timer.
void Deserialize(TagBuffer i)
uint32_t m_requestId
Broadcast ID.
Ipv4Address GetDestination() const
RREP_ACK timer.
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.
uint8_t GetRreqCnt() const
RREP_ACK timer.
static Time GetMaximumSimulationTime(void)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
uint32_t GetMaxQueueLen() const
void AddHeader(const Header &header)
Add header to this packet.
void SetDestination(Ipv4Address dest)
void ScheduleTimer()
Schedule m_ntimer.
bool GetValidSeqNo() const
RREP_ACK timer.
static const uint32_t AODV_PORT
UDP Port for AODV control traffic.
bool EnableHello
Indicates whether a hello messages enable.