|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
28 #ifndef AODVROUTINGPROTOCOL_H
29 #define AODVROUTINGPROTOCOL_H
37 #include "ns3/random-variable-stream.h"
38 #include "ns3/output-stream-wrapper.h"
39 #include "ns3/ipv4-routing-protocol.h"
40 #include "ns3/ipv4-interface.h"
41 #include "ns3/ipv4-l3-protocol.h"
46 class WifiMacQueueItem;
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.
std::map< Ptr< Socket >, Ipv4InterfaceAddress > m_socketAddresses
Raw unicast socket per each IP interface, map socket -> iface address (IP + mask)
a unique identifier for an interface.
void RerrRateLimitTimerExpire()
Reset RERR count and schedule RERR rate limit timer with delay 1 sec.
uint32_t GetMaxQueueLen() const
Get the maximum queue length.
void RecvRequest(Ptr< Packet > p, Ipv4Address receiver, Ipv4Address src)
Receive RREQ.
void Start()
Start protocol operation.
Ptr< Socket > FindSocketWithInterfaceAddress(Ipv4InterfaceAddress iface) const
Find unicast socket with local interface address iface.
void RecvReply(Ptr< Packet > p, Ipv4Address my, Ipv4Address src)
Receive RREP.
void RouteRequestTimerExpire(Ipv4Address dst)
Handle route discovery process.
uint16_t m_ttlThreshold
Maximum TTL value for expanding ring search, TTL = NetDiameter is used beyond this value.
void ScheduleRreqRetry(Ipv4Address dst)
Repeated attempts by a source node at route discovery for a single destination use the expanding ring...
SocketErrno
Enumeration of the possible errors returned by a socket.
WifiMacDropReason
The reason why an MPDU was dropped.
bool GetGratuitousReplyFlag() const
Get gratuitous reply flag.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Neighbors m_nb
Handle neighbors.
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
Time m_activeRouteTimeout
Period of time during which the route is considered to be valid.
void RreqRateLimitTimerExpire()
Reset RREQ count and schedule RREQ rate limit timer with delay 1 sec.
bool m_enableBroadcast
Indicates whether a a broadcast data packets forwarding enable.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
bool Forwarding(Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
If route exists and is valid, forward packet.
void NotifyTxError(WifiMacDropReason reason, Ptr< const WifiMacQueueItem > mpdu)
Notify that an MPDU was dropped.
uint16_t m_rerrRateLimit
Maximum number of REER per second.
Ptr< NetDevice > m_lo
Loopback device used to defer RREQ until packet will be fully formed.
Helper class used to remember already seen packets and detect duplicates.
uint16_t m_rreqRateLimit
Maximum number of RREQ per second.
Ipv4 addresses are stored in host order in this class.
uint32_t m_allowedHelloLoss
Number of hello messages which may be loss for valid link.
Unique packets identification cache used for simple duplicate detection.
static const uint32_t AODV_PORT
UDP Port for AODV control traffic.
void DeferredRouteOutput(Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
Queue packet and send route request.
uint32_t m_maxQueueLen
The maximum number of packets that we allow a routing protocol to buffer.
virtual void NotifyInterfaceDown(uint32_t interface)
void SendPacketFromQueue(Ipv4Address dst, Ptr< Ipv4Route > route)
Forward packet from route request queue.
void SendReplyByIntermediateNode(RoutingTableEntry &toDst, RoutingTableEntry &toOrigin, bool gratRep)
Send RREP by intermediate node.
RequestQueue m_queue
A "drop-front" queue used by the routing layer to buffer packets to which it does not have a route.
Timer m_htimer
Hello timer.
void SetDestinationOnlyFlag(bool f)
Set destination only flag.
virtual void DoInitialize(void)
Initialize() implementation.
bool m_enableHello
Indicates whether a hello messages enable.
A simple virtual Timer class.
void SetBroadcastEnable(bool f)
Set broadcast enable flag.
uint32_t m_requestId
Broadcast ID.
bool GetDestinationOnlyFlag() const
Get destination only flag.
Smart pointer class similar to boost::intrusive_ptr.
void SendRerrWhenNoRouteToForward(Ipv4Address dst, uint32_t dstSeqNo, Ipv4Address origin)
Send RERR message when no route to forward input packet.
uint16_t m_timeoutBuffer
Provide a buffer for the timeout.
uint16_t m_rerrCount
Number of RERRs used for RERR rate control.
uint16_t m_ttlIncrement
TTL increment for each attempt using the expanding ring search for RREQ dissemination.
void SendHello()
Send hello.
void RecvError(Ptr< Packet > p, Ipv4Address src)
Receive RERR.
void SendRequest(Ipv4Address dst)
Send RREQ.
Time m_deletePeriod
DeletePeriod is intended to provide an upper bound on the time for which an upstream node A can have ...
a class to store IPv4 address information on an interface
void SetGratuitousReplyFlag(bool f)
Set gratuitous reply flag.
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
Time m_myRouteTimeout
Value of lifetime field in RREP generating by this node.
IdCache m_rreqIdCache
Handle duplicated RREQ.
void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop)
Initiate RERR.
bool m_destinationOnly
Indicates only the destination may respond to this RREQ.
AODV route request queue.
Ptr< Ipv4 > m_ipv4
IP protocol.
Time m_lastBcastTime
Keep track of the last bcast time.
bool IsMyOwnAddress(Ipv4Address src)
Test whether the provided address is assigned to an interface on this node.
void SendTo(Ptr< Socket > socket, Ptr< Packet > packet, Ipv4Address destination)
Send packet to destination scoket.
Ptr< Socket > FindSubnetBroadcastSocketWithInterfaceAddress(Ipv4InterfaceAddress iface) const
Find subnet directed broadcast socket with local interface address iface.
Ptr< Ipv4Route > LoopbackRoute(const Ipv4Header &header, Ptr< NetDevice > oif) const
Create loopback route for given header.
Simulation virtual time values and global simulation resolution.
uint32_t m_rreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
Time m_nextHopWait
Period of our waiting for the neighbour's RREP_ACK.
RoutingTable m_routingTable
Routing table.
uint16_t m_ttlStart
Initial TTL value for RREQ.
Time m_helloInterval
Every HelloInterval the node checks whether it has sent a broadcast within the last HelloInterval.
std::map< Ipv4Address, Timer > m_addressReqTimer
Map IP address + RREQ timer.
virtual void NotifyInterfaceUp(uint32_t interface)
void SendReply(RreqHeader const &rreqHeader, RoutingTableEntry const &toOrigin)
Send RREP.
virtual ~RoutingProtocol()
void UpdateRouteToNeighbor(Ipv4Address sender, Ipv4Address receiver)
Update neighbor record.
Abstract base class for IPv4 routing protocols.
bool GetHelloEnable() const
Get hello enable flag.
Time m_netTraversalTime
Estimate of the average net traversal time.
void SendReplyAck(Ipv4Address neighbor)
Send RREP_ACK.
void SendRerrMessage(Ptr< Packet > packet, std::vector< Ipv4Address > precursors)
Forward RERR.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
bool UpdateRouteLifeTime(Ipv4Address addr, Time lt)
Set lifetime field in routing table entry to the maximum of existing lifetime and lt,...
void RecvAodv(Ptr< Socket > socket)
Receive and process control packet.
virtual void DoDispose()
Destructor implementation.
std::map< Ptr< Socket >, Ipv4InterfaceAddress > m_socketSubnetBroadcastAddresses
Raw subnet directed broadcast socket per each IP interface, map socket -> iface address (IP + mask)
void SetMaxQueueLen(uint32_t len)
Set the maximum queue length.
double f(double x, void *params)
Time m_pathDiscoveryTime
Estimate of maximum time needed to find route in network.
void SetHelloEnable(bool f)
Set hello enable.
The Routing table used by AODV protocol.
static TypeId GetTypeId(void)
Get the type ID.
Time m_nodeTraversalTime
NodeTraversalTime is a conservative estimate of the average one hop traversal time for packets and sh...
Time GetMaxQueueTime() const
Get maximum queue time.
void ProcessHello(RrepHeader const &rrepHeader, Ipv4Address receiverIfaceAddr)
Process hello message.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
bool GetBroadcastEnable() const
Get broadcast enable flag.
Timer m_rerrRateLimitTimer
RERR rate limit timer.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
uint16_t m_rreqCount
Number of RREQs used for RREQ rate control.
DuplicatePacketDetection m_dpd
Handle duplicated broadcast/multicast packets.
bool m_gratuitousReply
Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.
Time m_maxQueueTime
The maximum period of time that a routing protocol is allowed to buffer a packet for.
Timer m_rreqRateLimitTimer
RREQ rate limit timer.
void RecvReplyAck(Ipv4Address neighbor)
Receive RREP_ACK.
maintain list of active neighbors
Time m_blackListTimeout
Time for which the node is put into the blacklist.
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 AckTimerExpire(Ipv4Address neighbor, Time blacklistTimeout)
Mark link to neighbor node as unidirectional for blacklistTimeout.
Unit
The unit to use to interpret a number representing time.
void HelloTimerExpire()
Schedule next send of hello message.
uint32_t m_netDiameter
Net diameter measures the maximum possible number of hops between two nodes in the network.
void SetMaxQueueTime(Time t)
Set the maximum queue time.
uint32_t m_seqNo
Request sequence number.
RoutingProtocol()
constructor