AODV routing protocol. More...
#include "aodv-routing-protocol.h"
Public Member Functions | |
RoutingProtocol () | |
constructor | |
~RoutingProtocol () override | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. | |
void | DoDispose () override |
Destructor implementation. | |
bool | GetBroadcastEnable () const |
Get broadcast enable flag. | |
bool | GetDestinationOnlyFlag () const |
Get destination only flag. | |
bool | GetGratuitousReplyFlag () const |
Get gratuitous reply flag. | |
bool | GetHelloEnable () const |
Get hello enable flag. | |
uint32_t | GetMaxQueueLen () const |
Get the maximum queue length. | |
Time | GetMaxQueueTime () const |
Get maximum queue time. | |
void | NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) override |
void | NotifyInterfaceDown (uint32_t interface) override |
void | NotifyInterfaceUp (uint32_t interface) override |
void | NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) override |
void | PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override |
Print the Routing Table entries. | |
bool | RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb) override |
Route an input packet (to be forwarded or locally delivered) | |
Ptr< Ipv4Route > | RouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override |
Query routing cache for an existing route, for an outbound packet. | |
void | SetBroadcastEnable (bool f) |
Set broadcast enable flag. | |
void | SetDestinationOnlyFlag (bool f) |
Set destination only flag. | |
void | SetGratuitousReplyFlag (bool f) |
Set gratuitous reply flag. | |
void | SetHelloEnable (bool f) |
Set hello enable. | |
void | SetIpv4 (Ptr< Ipv4 > ipv4) override |
void | SetMaxQueueLen (uint32_t len) |
Set the maximum queue length. | |
void | SetMaxQueueTime (Time t) |
Set the maximum queue time. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Ipv4RoutingProtocol | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Attributes | |
static const uint32_t | AODV_PORT = 654 |
UDP Port for AODV control traffic. | |
Protected Member Functions | |
void | DoInitialize () override |
Initialize() implementation. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Private Member Functions | |
void | AckTimerExpire (Ipv4Address neighbor, Time blacklistTimeout) |
Mark link to neighbor node as unidirectional for blacklistTimeout. | |
void | DeferredRouteOutput (Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb) |
Queue packet and send route request. | |
Ptr< Socket > | FindSocketWithInterfaceAddress (Ipv4InterfaceAddress iface) const |
Find unicast socket with local interface address iface. | |
Ptr< Socket > | FindSubnetBroadcastSocketWithInterfaceAddress (Ipv4InterfaceAddress iface) const |
Find subnet directed broadcast socket with local interface address iface. | |
bool | Forwarding (Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb) |
If route exists and is valid, forward packet. | |
void | HelloTimerExpire () |
Schedule next send of hello message. | |
bool | IsMyOwnAddress (Ipv4Address src) |
Test whether the provided address is assigned to an interface on this node. | |
Ptr< Ipv4Route > | LoopbackRoute (const Ipv4Header &header, Ptr< NetDevice > oif) const |
Create loopback route for given header. | |
void | NotifyTxError (WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu) |
Notify that an MPDU was dropped. | |
void | ProcessHello (const RrepHeader &rrepHeader, Ipv4Address receiverIfaceAddr) |
Process hello message. | |
void | RerrRateLimitTimerExpire () |
Reset RERR count and schedule RERR rate limit timer with delay 1 sec. | |
void | RouteRequestTimerExpire (Ipv4Address dst) |
Handle route discovery process. | |
void | RreqRateLimitTimerExpire () |
Reset RREQ count and schedule RREQ rate limit timer with delay 1 sec. | |
void | ScheduleRreqRetry (Ipv4Address dst) |
Repeated attempts by a source node at route discovery for a single destination use the expanding ring search technique. | |
void | SendTo (Ptr< Socket > socket, Ptr< Packet > packet, Ipv4Address destination) |
Send packet to destination socket. | |
void | Start () |
Start protocol operation. | |
bool | UpdateRouteLifeTime (Ipv4Address addr, Time lt) |
Set lifetime field in routing table entry to the maximum of existing lifetime and lt, if the entry exists. | |
void | UpdateRouteToNeighbor (Ipv4Address sender, Ipv4Address receiver) |
Update neighbor record. | |
Receive control packets | |
void | RecvAodv (Ptr< Socket > socket) |
Receive and process control packet. | |
void | RecvRequest (Ptr< Packet > p, Ipv4Address receiver, Ipv4Address src) |
Receive RREQ. | |
void | RecvReply (Ptr< Packet > p, Ipv4Address my, Ipv4Address src) |
Receive RREP. | |
void | RecvReplyAck (Ipv4Address neighbor) |
Receive RREP_ACK. | |
void | RecvError (Ptr< Packet > p, Ipv4Address src) |
Receive RERR. | |
Send | |
void | SendPacketFromQueue (Ipv4Address dst, Ptr< Ipv4Route > route) |
Forward packet from route request queue. | |
void | SendHello () |
Send hello. | |
void | SendRequest (Ipv4Address dst) |
Send RREQ. | |
void | SendReply (const RreqHeader &rreqHeader, const RoutingTableEntry &toOrigin) |
Send RREP. | |
void | SendReplyByIntermediateNode (RoutingTableEntry &toDst, RoutingTableEntry &toOrigin, bool gratRep) |
Send RREP by intermediate node. | |
void | SendReplyAck (Ipv4Address neighbor) |
Send RREP_ACK. | |
void | SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop) |
Initiate RERR. | |
void | SendRerrMessage (Ptr< Packet > packet, std::vector< Ipv4Address > precursors) |
Forward RERR. | |
void | SendRerrWhenNoRouteToForward (Ipv4Address dst, uint32_t dstSeqNo, Ipv4Address origin) |
Send RERR message when no route to forward input packet. | |
Private Attributes | |
Time | m_activeRouteTimeout |
Period of time during which the route is considered to be valid. | |
std::map< Ipv4Address, Timer > | m_addressReqTimer |
Map IP address + RREQ timer. | |
uint32_t | m_allowedHelloLoss |
Number of hello messages which may be loss for valid link. | |
Time | m_blackListTimeout |
Time for which the node is put into the blacklist. | |
Time | m_deletePeriod |
DeletePeriod is intended to provide an upper bound on the time for which an upstream node A can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D. | |
bool | m_destinationOnly |
Indicates only the destination may respond to this RREQ. | |
DuplicatePacketDetection | m_dpd |
Handle duplicated broadcast/multicast packets. | |
bool | m_enableBroadcast |
Indicates whether a a broadcast data packets forwarding enable. | |
bool | m_enableHello |
Indicates whether a hello messages enable. | |
bool | m_gratuitousReply |
Indicates whether a gratuitous RREP should be unicast to the node originated route discovery. | |
Time | m_helloInterval |
Every HelloInterval the node checks whether it has sent a broadcast within the last HelloInterval. | |
Timer | m_htimer |
Hello timer. | |
Ptr< Ipv4 > | m_ipv4 |
IP protocol. | |
Time | m_lastBcastTime |
Keep track of the last bcast time. | |
Ptr< NetDevice > | m_lo |
Loopback device used to defer RREQ until packet will be fully formed. | |
uint32_t | m_maxQueueLen |
The maximum number of packets that we allow a routing protocol to buffer. | |
Time | m_maxQueueTime |
The maximum period of time that a routing protocol is allowed to buffer a packet for. | |
Time | m_myRouteTimeout |
Value of lifetime field in RREP generating by this node. | |
Neighbors | m_nb |
Handle neighbors. | |
uint32_t | m_netDiameter |
Net diameter measures the maximum possible number of hops between two nodes in the network. | |
Time | m_netTraversalTime |
Estimate of the average net traversal time. | |
Time | m_nextHopWait |
Period of our waiting for the neighbour's RREP_ACK. | |
Time | m_nodeTraversalTime |
NodeTraversalTime is a conservative estimate of the average one hop traversal time for packets and should include queuing delays, interrupt processing times and transfer times. | |
Time | m_pathDiscoveryTime |
Estimate of maximum time needed to find route in network. | |
RequestQueue | m_queue |
A "drop-front" queue used by the routing layer to buffer packets to which it does not have a route. | |
uint32_t | m_requestId |
Broadcast ID. | |
uint16_t | m_rerrCount |
Number of RERRs used for RERR rate control. | |
uint16_t | m_rerrRateLimit |
Maximum number of REER per second. | |
Timer | m_rerrRateLimitTimer |
RERR rate limit timer. | |
RoutingTable | m_routingTable |
Routing table. | |
uint16_t | m_rreqCount |
Number of RREQs used for RREQ rate control. | |
IdCache | m_rreqIdCache |
Handle duplicated RREQ. | |
uint16_t | m_rreqRateLimit |
Maximum number of RREQ per second. | |
Timer | m_rreqRateLimitTimer |
RREQ rate limit timer. | |
uint32_t | m_rreqRetries |
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route. | |
uint32_t | m_seqNo |
Request sequence number. | |
std::map< Ptr< Socket >, Ipv4InterfaceAddress > | m_socketAddresses |
Raw unicast socket per each IP interface, map socket -> iface address (IP + mask) | |
std::map< Ptr< Socket >, Ipv4InterfaceAddress > | m_socketSubnetBroadcastAddresses |
Raw subnet directed broadcast socket per each IP interface, map socket -> iface address (IP. | |
uint16_t | m_timeoutBuffer |
Provide a buffer for the timeout. | |
uint16_t | m_ttlIncrement |
TTL increment for each attempt using the expanding ring search for RREQ dissemination. | |
uint16_t | m_ttlStart |
Initial TTL value for RREQ. | |
uint16_t | m_ttlThreshold |
Maximum TTL value for expanding ring search, TTL = NetDiameter is used beyond this value. | |
Ptr< UniformRandomVariable > | m_uniformRandomVariable |
Provides uniform random variables. | |
Additional Inherited Members | |
Public Types inherited from ns3::Ipv4RoutingProtocol | |
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno > | ErrorCallback |
Callback for routing errors (e.g., no route found) | |
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > | LocalDeliverCallback |
Callback for packets to be locally delivered. | |
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > | MulticastForwardCallback |
Callback for multicast packets to be forwarded. | |
typedef Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > | UnicastForwardCallback |
Callback for unicast packets to be forwarded. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
AODV routing protocol.
Definition at line 47 of file aodv-routing-protocol.h.
ns3::aodv::RoutingProtocol::RoutingProtocol | ( | ) |
constructor
Definition at line 134 of file aodv-routing-protocol.cc.
References m_nb, ns3::MakeCallback(), SendRerrWhenBreaksLinkToNextHop(), and ns3::aodv::Neighbors::SetCallback().
|
override |
Definition at line 346 of file aodv-routing-protocol.cc.
|
private |
Mark link to neighbor node as unidirectional for blacklistTimeout.
neighbor | the IP address of the neighbor node |
blacklistTimeout | the black list timeout time |
Definition at line 1966 of file aodv-routing-protocol.cc.
References m_routingTable, ns3::aodv::RoutingTable::MarkLinkAsUnidirectional(), and NS_LOG_FUNCTION.
Referenced by SendReplyByIntermediateNode().
int64_t ns3::aodv::RoutingProtocol::AssignStreams | ( | int64_t | stream | ) |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use |
Definition at line 382 of file aodv-routing-protocol.cc.
References m_uniformRandomVariable, and NS_LOG_FUNCTION.
|
private |
Queue packet and send route request.
p | the packet to route |
header | the IP header |
ucb | the UnicastForwardCallback function |
ecb | the ErrorCallback function |
Definition at line 458 of file aodv-routing-protocol.cc.
References ns3::aodv::RequestQueue::Enqueue(), ns3::Ipv4Header::GetDestination(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::Ipv4Header::GetProtocol(), ns3::aodv::IN_SEARCH, ns3::aodv::RoutingTable::LookupRoute(), m_queue, m_routingTable, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and SendRequest().
Referenced by RouteInput().
|
overridevirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 351 of file aodv-routing-protocol.cc.
References ns3::Object::DoDispose(), m_ipv4, m_socketAddresses, and m_socketSubnetBroadcastAddresses.
|
overrideprotectedvirtual |
Initialize() implementation.
This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 2267 of file aodv-routing-protocol.cc.
References ns3::Object::DoInitialize(), HelloTimerExpire(), m_enableHello, m_htimer, m_uniformRandomVariable, ns3::MilliSeconds(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Timer::Schedule(), and ns3::Timer::SetFunction().
|
private |
Find unicast socket with local interface address iface.
iface | the interface |
Definition at line 2231 of file aodv-routing-protocol.cc.
References m_socketAddresses, and NS_LOG_FUNCTION.
Referenced by NotifyAddAddress(), NotifyInterfaceDown(), NotifyRemoveAddress(), RecvReply(), SendReply(), SendReplyAck(), SendReplyByIntermediateNode(), SendRerrMessage(), and SendRerrWhenNoRouteToForward().
|
private |
Find subnet directed broadcast socket with local interface address iface.
iface | the interface |
Definition at line 2248 of file aodv-routing-protocol.cc.
References m_socketSubnetBroadcastAddresses, and NS_LOG_FUNCTION.
Referenced by NotifyInterfaceDown(), and NotifyRemoveAddress().
|
private |
If route exists and is valid, forward packet.
p | the packet to route |
header | the IP header |
ucb | the UnicastForwardCallback function |
ecb | the ErrorCallback function |
Definition at line 631 of file aodv-routing-protocol.cc.
References ns3::Ipv4Header::GetDestination(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::aodv::RoutingTableEntry::GetRoute(), ns3::aodv::RoutingTableEntry::GetSeqNo(), ns3::Ipv4Header::GetSource(), ns3::aodv::RoutingTableEntry::GetValidSeqNo(), ns3::aodv::RoutingTable::LookupRoute(), m_activeRouteTimeout, m_nb, m_routingTable, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::aodv::RoutingTable::Purge(), SendRerrWhenNoRouteToForward(), ns3::aodv::Neighbors::Update(), UpdateRouteLifeTime(), and ns3::aodv::VALID.
Referenced by RouteInput().
|
inline |
Get broadcast enable flag.
Definition at line 180 of file aodv-routing-protocol.h.
References m_enableBroadcast.
Referenced by GetTypeId().
|
inline |
Get destination only flag.
Definition at line 117 of file aodv-routing-protocol.h.
References m_destinationOnly.
Referenced by GetTypeId().
|
inline |
Get gratuitous reply flag.
Definition at line 135 of file aodv-routing-protocol.h.
References m_gratuitousReply.
Referenced by GetTypeId().
|
inline |
Get hello enable flag.
Definition at line 162 of file aodv-routing-protocol.h.
References m_enableHello.
Referenced by GetTypeId().
|
inline |
Get the maximum queue length.
Definition at line 102 of file aodv-routing-protocol.h.
References m_maxQueueLen.
Referenced by GetTypeId().
|
inline |
Get maximum queue time.
Definition at line 87 of file aodv-routing-protocol.h.
References m_maxQueueTime.
Referenced by GetTypeId().
|
static |
Get the type ID.
Definition at line 176 of file aodv-routing-protocol.cc.
References GetBroadcastEnable(), GetDestinationOnlyFlag(), GetGratuitousReplyFlag(), GetHelloEnable(), GetMaxQueueLen(), GetMaxQueueTime(), m_activeRouteTimeout, m_allowedHelloLoss, m_blackListTimeout, m_deletePeriod, m_helloInterval, m_myRouteTimeout, m_netDiameter, m_netTraversalTime, m_nextHopWait, m_nodeTraversalTime, m_pathDiscoveryTime, m_rerrRateLimit, m_rreqRateLimit, m_rreqRetries, m_timeoutBuffer, m_ttlIncrement, m_ttlStart, m_ttlThreshold, m_uniformRandomVariable, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakePointerAccessor(), ns3::MakePointerChecker(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), ns3::MilliSeconds(), ns3::Seconds(), SetBroadcastEnable(), SetDestinationOnlyFlag(), SetGratuitousReplyFlag(), SetHelloEnable(), SetMaxQueueLen(), SetMaxQueueTime(), and ns3::TypeId::SetParent().
|
private |
Schedule next send of hello message.
Definition at line 1930 of file aodv-routing-protocol.cc.
References ns3::Timer::Cancel(), m_helloInterval, m_htimer, m_lastBcastTime, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Timer::Schedule(), ns3::Seconds(), and SendHello().
Referenced by DoInitialize().
|
private |
Test whether the provided address is assigned to an interface on this node.
src | the source IP address |
Definition at line 968 of file aodv-routing-protocol.cc.
References ns3::Ipv4InterfaceAddress::GetLocal(), m_socketAddresses, and NS_LOG_FUNCTION.
Referenced by RecvReply(), RecvRequest(), and RouteInput().
|
private |
Create loopback route for given header.
header | the IP header |
oif | the output interface net device |
Definition at line 983 of file aodv-routing-protocol.cc.
References ns3::Create(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4::GetNetDevice(), m_ipv4, m_lo, m_socketAddresses, NS_ASSERT, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Referenced by RouteOutput().
|
overridevirtual |
interface | the index of the interface we are being notified about |
address | a new address being added to an interface |
Protocols are expected to implement this method to be notified whenever a new address is added to an interface. Typically used to add a 'network route' on an interface. Can be invoked on an up or down interface.
Implements ns3::Ipv4RoutingProtocol.
Definition at line 836 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), AODV_PORT, ns3::Socket::CreateSocket(), FindSocketWithInterfaceAddress(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Ipv4::GetInterfaceForAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Ipv4::GetNetDevice(), ns3::Object::GetObject(), ns3::UdpSocketFactory::GetTypeId(), m_ipv4, m_routingTable, m_socketAddresses, m_socketSubnetBroadcastAddresses, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RecvAodv().
|
overridevirtual |
interface | the index of the interface we are being notified about |
Protocols are expected to implement this method to be notified of the state change of an interface in a node.
Implements ns3::Ipv4RoutingProtocol.
Definition at line 793 of file aodv-routing-protocol.cc.
References ns3::Timer::Cancel(), ns3::aodv::Neighbors::Clear(), ns3::aodv::RoutingTable::Clear(), ns3::aodv::Neighbors::DelArpCache(), ns3::aodv::RoutingTable::DeleteAllRoutesFromInterface(), FindSocketWithInterfaceAddress(), FindSubnetBroadcastSocketWithInterfaceAddress(), ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Object::GetObject(), m_htimer, m_ipv4, m_nb, m_routingTable, m_socketAddresses, m_socketSubnetBroadcastAddresses, ns3::MakeCallback(), NotifyTxError(), NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
overridevirtual |
interface | the index of the interface we are being notified about |
Protocols are expected to implement this method to be notified of the state change of an interface in a node.
Implements ns3::Ipv4RoutingProtocol.
Definition at line 719 of file aodv-routing-protocol.cc.
References ns3::aodv::Neighbors::AddArpCache(), ns3::aodv::RoutingTable::AddRoute(), AODV_PORT, ns3::Socket::CreateSocket(), ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Ipv4::GetInterfaceForAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Ipv4::GetNetDevice(), ns3::Object::GetObject(), ns3::UdpSocketFactory::GetTypeId(), m_ipv4, m_nb, m_routingTable, m_socketAddresses, m_socketSubnetBroadcastAddresses, ns3::MakeCallback(), NotifyTxError(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_WARN, and RecvAodv().
|
overridevirtual |
interface | the index of the interface we are being notified about |
address | a new address being added to an interface |
Protocols are expected to implement this method to be notified whenever a new address is removed from an interface. Typically used to remove the 'network route' of an interface. Can be invoked on an up or down interface.
Implements ns3::Ipv4RoutingProtocol.
Definition at line 896 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), AODV_PORT, ns3::Timer::Cancel(), ns3::aodv::Neighbors::Clear(), ns3::aodv::RoutingTable::Clear(), ns3::Socket::CreateSocket(), ns3::aodv::RoutingTable::DeleteAllRoutesFromInterface(), FindSocketWithInterfaceAddress(), FindSubnetBroadcastSocketWithInterfaceAddress(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Ipv4::GetInterfaceForAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Ipv4::GetNetDevice(), ns3::Object::GetObject(), ns3::UdpSocketFactory::GetTypeId(), m_htimer, m_ipv4, m_nb, m_routingTable, m_socketAddresses, m_socketSubnetBroadcastAddresses, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RecvAodv().
|
private |
Notify that an MPDU was dropped.
reason | the reason why the MPDU was dropped |
mpdu | the dropped MPDU |
Definition at line 787 of file aodv-routing-protocol.cc.
References ns3::aodv::Neighbors::GetTxErrorCallback(), and m_nb.
Referenced by NotifyInterfaceDown(), and NotifyInterfaceUp().
|
overridevirtual |
Print the Routing Table entries.
stream | The ostream the Routing table is printed to |
unit | The time unit to be used in the report |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 370 of file aodv-routing-protocol.cc.
References ns3::Time::As(), ns3::Object::GetObject(), m_ipv4, m_routingTable, ns3::Now(), and ns3::aodv::RoutingTable::Print().
|
private |
Process hello message.
rrepHeader | RREP message header |
receiverIfaceAddr | receiver interface IP address |
Definition at line 1786 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), ns3::Ipv4::GetAddress(), ns3::aodv::RrepHeader::GetDst(), ns3::aodv::RrepHeader::GetDstSeqno(), ns3::Ipv4::GetInterfaceForAddress(), ns3::aodv::RoutingTableEntry::GetLifeTime(), ns3::aodv::RrepHeader::GetLifeTime(), ns3::Ipv4::GetNetDevice(), ns3::aodv::RoutingTable::LookupRoute(), m_allowedHelloLoss, m_enableHello, m_helloInterval, m_ipv4, m_nb, m_routingTable, NS_LOG_FUNCTION, ns3::aodv::RoutingTableEntry::SetFlag(), ns3::aodv::RoutingTableEntry::SetHop(), ns3::aodv::RoutingTableEntry::SetInterface(), ns3::aodv::RoutingTableEntry::SetLifeTime(), ns3::aodv::RoutingTableEntry::SetNextHop(), ns3::aodv::RoutingTableEntry::SetOutputDevice(), ns3::aodv::RoutingTableEntry::SetSeqNo(), ns3::aodv::RoutingTableEntry::SetValidSeqNo(), ns3::aodv::Neighbors::Update(), ns3::aodv::RoutingTable::Update(), and ns3::aodv::VALID.
Referenced by RecvReply().
Receive and process control packet.
socket | input socket |
Definition at line 1195 of file aodv-routing-protocol.cc.
References ns3::aodv::AODVTYPE_RERR, ns3::aodv::AODVTYPE_RREP, ns3::aodv::AODVTYPE_RREP_ACK, ns3::aodv::AODVTYPE_RREQ, ns3::InetSocketAddress::ConvertFrom(), ns3::aodv::TypeHeader::Get(), ns3::InetSocketAddress::GetIpv4(), ns3::aodv::TypeHeader::IsValid(), m_socketAddresses, m_socketSubnetBroadcastAddresses, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, RecvError(), RecvReply(), RecvReplyAck(), RecvRequest(), and UpdateRouteToNeighbor().
Referenced by NotifyAddAddress(), NotifyInterfaceUp(), and NotifyRemoveAddress().
|
private |
Receive RERR.
p | packet |
src | sender address Receive from node with address src |
Definition at line 1829 of file aodv-routing-protocol.cc.
References ns3::aodv::RerrHeader::AddUnDestination(), ns3::aodv::AODVTYPE_RERR, ns3::aodv::RerrHeader::Clear(), ns3::Create(), ns3::aodv::RerrHeader::GetDestCount(), ns3::aodv::RoutingTable::GetListOfDestinationWithNextHop(), ns3::aodv::RoutingTableEntry::GetPrecursors(), ns3::aodv::RoutingTable::InvalidateRoutesWithDst(), ns3::aodv::RoutingTable::LookupRoute(), m_routingTable, NS_LOG_FUNCTION, ns3::aodv::RerrHeader::RemoveUnDestination(), SendRerrMessage(), and ns3::SocketIpTtlTag::SetTtl().
Referenced by RecvAodv().
|
private |
Receive RREP.
p | packet |
my | destination address |
src | sender address |
Definition at line 1633 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), AODV_PORT, ns3::aodv::AODVTYPE_RREP, ns3::Create(), FindSocketWithInterfaceAddress(), ns3::aodv::RrepHeader::GetAckRequired(), ns3::Ipv4::GetAddress(), ns3::aodv::RrepHeader::GetDst(), ns3::aodv::RrepHeader::GetDstSeqno(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::RoutingTableEntry::GetHop(), ns3::aodv::RrepHeader::GetHopCount(), ns3::aodv::RoutingTableEntry::GetInterface(), ns3::Ipv4::GetInterfaceForAddress(), ns3::aodv::RoutingTableEntry::GetLifeTime(), ns3::aodv::RrepHeader::GetLifeTime(), ns3::Ipv4::GetNetDevice(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::aodv::RrepHeader::GetOrigin(), ns3::aodv::RoutingTableEntry::GetRoute(), ns3::aodv::RoutingTableEntry::GetSeqNo(), ns3::SocketIpTtlTag::GetTtl(), ns3::aodv::RoutingTableEntry::GetValidSeqNo(), ns3::aodv::IN_SEARCH, ns3::aodv::RoutingTableEntry::InsertPrecursor(), IsMyOwnAddress(), ns3::aodv::RoutingTable::LookupRoute(), ns3::aodv::RoutingTable::LookupValidRoute(), m_activeRouteTimeout, m_addressReqTimer, m_ipv4, m_routingTable, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ProcessHello(), SendPacketFromQueue(), SendReplyAck(), ns3::aodv::RrepHeader::SetAckRequired(), ns3::aodv::RrepHeader::SetHopCount(), ns3::aodv::RoutingTableEntry::SetLifeTime(), ns3::SocketIpTtlTag::SetTtl(), ns3::aodv::RoutingTable::Update(), and ns3::aodv::VALID.
Referenced by RecvAodv().
|
private |
Receive RREP_ACK.
neighbor | neighbor address |
Definition at line 1773 of file aodv-routing-protocol.cc.
References ns3::Timer::Cancel(), ns3::aodv::RoutingTable::LookupRoute(), ns3::aodv::RoutingTableEntry::m_ackTimer, m_routingTable, NS_LOG_FUNCTION, ns3::aodv::RoutingTableEntry::SetFlag(), ns3::aodv::RoutingTable::Update(), and ns3::aodv::VALID.
Referenced by RecvAodv().
|
private |
Receive RREQ.
p | packet |
receiver | receiver address |
src | sender address |
Definition at line 1313 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), ns3::aodv::AODVTYPE_RREQ, ns3::Create(), ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::aodv::RreqHeader::GetDestinationOnly(), ns3::aodv::RreqHeader::GetDst(), ns3::aodv::RreqHeader::GetDstSeqno(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::RreqHeader::GetGratuitousRrep(), ns3::aodv::RreqHeader::GetHopCount(), ns3::aodv::RreqHeader::GetId(), ns3::Ipv4::GetInterfaceForAddress(), ns3::aodv::RoutingTableEntry::GetLifeTime(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4::GetNetDevice(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::Ipv4Mask::GetOnes(), ns3::aodv::RreqHeader::GetOrigin(), ns3::aodv::RreqHeader::GetOriginSeqno(), ns3::aodv::RoutingTableEntry::GetSeqNo(), ns3::SocketIpTtlTag::GetTtl(), ns3::aodv::RreqHeader::GetUnknownSeqno(), ns3::aodv::RoutingTableEntry::GetValidSeqNo(), ns3::aodv::IdCache::IsDuplicate(), IsMyOwnAddress(), ns3::aodv::RoutingTableEntry::IsUnidirectional(), ns3::aodv::RoutingTable::LookupRoute(), m_activeRouteTimeout, m_allowedHelloLoss, m_helloInterval, m_ipv4, m_lastBcastTime, m_nb, m_netTraversalTime, m_nodeTraversalTime, m_routingTable, m_rreqIdCache, m_socketAddresses, m_uniformRandomVariable, ns3::MilliSeconds(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), SendReply(), SendReplyByIntermediateNode(), SendTo(), ns3::aodv::RreqHeader::SetDstSeqno(), ns3::aodv::RoutingTableEntry::SetFlag(), ns3::aodv::RoutingTableEntry::SetHop(), ns3::aodv::RreqHeader::SetHopCount(), ns3::aodv::RoutingTableEntry::SetInterface(), ns3::aodv::RoutingTableEntry::SetLifeTime(), ns3::aodv::RoutingTableEntry::SetNextHop(), ns3::aodv::RoutingTableEntry::SetOutputDevice(), ns3::aodv::RoutingTableEntry::SetSeqNo(), ns3::SocketIpTtlTag::SetTtl(), ns3::aodv::RreqHeader::SetUnknownSeqno(), ns3::aodv::RoutingTableEntry::SetValidSeqNo(), ns3::aodv::Neighbors::Update(), ns3::aodv::RoutingTable::Update(), and ns3::aodv::VALID.
Referenced by RecvAodv().
|
private |
Reset RERR count and schedule RERR rate limit timer with delay 1 sec.
Definition at line 1958 of file aodv-routing-protocol.cc.
References m_rerrCount, m_rerrRateLimitTimer, NS_LOG_FUNCTION, ns3::Timer::Schedule(), and ns3::Seconds().
Referenced by Start().
|
overridevirtual |
Route an input packet (to be forwarded or locally delivered)
This lookup is used in the forwarding process. The packet is handed over to the Ipv4RoutingProtocol, and will get forwarded onward by one of the callbacks. The Linux equivalent is ip_route_input(). There are four valid outcomes, and a matching callbacks to handle each.
p | received packet |
header | input parameter used to form a search key for a route |
idev | Pointer to ingress network device |
ucb | Callback for the case in which the packet is to be forwarded as unicast |
mcb | Callback for the case in which the packet is to be forwarded as multicast |
lcb | Callback for the case in which the packet is to be locally delivered |
ecb | Callback to call if there is an error in forwarding |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 483 of file aodv-routing-protocol.cc.
References AODV_PORT, DeferredRouteOutput(), ns3::Socket::ERROR_NOROUTETOHOST, Forwarding(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Ipv4Header::GetDestination(), ns3::UdpHeader::GetDestinationPort(), ns3::Ipv4::GetInterfaceForAddress(), ns3::Ipv4::GetInterfaceForDevice(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::Ipv4Header::GetProtocol(), ns3::aodv::RoutingTableEntry::GetRoute(), ns3::Ipv4Header::GetSource(), ns3::Ipv4Header::GetTtl(), ns3::Ipv4Address::IsBroadcast(), ns3::Ipv4::IsDestinationAddress(), ns3::aodv::DuplicatePacketDetection::IsDuplicate(), ns3::Ipv4::IsForwarding(), ns3::Ipv4Address::IsMulticast(), IsMyOwnAddress(), ns3::Callback< R, UArgs >::IsNull(), ns3::aodv::RoutingTable::LookupRoute(), ns3::aodv::RoutingTable::LookupValidRoute(), m_activeRouteTimeout, m_dpd, m_enableBroadcast, m_ipv4, m_lo, m_nb, m_routingTable, m_socketAddresses, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::UdpL4Protocol::PROT_NUMBER, ns3::aodv::Neighbors::Update(), and UpdateRouteLifeTime().
|
overridevirtual |
Query routing cache for an existing route, for an outbound packet.
This lookup is used by transport protocols. It does not cause any packet to be forwarded, and is synchronous. Can be used for multicast or unicast. The Linux equivalent is ip_route_output()
The header input parameter may have an uninitialized value for the source address, but the destination address should always be properly set by the caller.
p | packet to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer. |
header | input parameter (used to form key to search for the route) |
oif | Output interface Netdevice. May be zero, or may be bound via socket options to a particular output interface. |
sockerr | Output parameter; socket errno |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 405 of file aodv-routing-protocol.cc.
References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::Ipv4Header::GetDestination(), ns3::Ipv4::GetInterfaceForDevice(), ns3::aodv::RoutingTableEntry::GetRoute(), ns3::aodv::RoutingTable::LookupValidRoute(), LoopbackRoute(), m_activeRouteTimeout, m_ipv4, m_routingTable, m_socketAddresses, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and UpdateRouteLifeTime().
|
private |
Handle route discovery process.
dst | the destination IP address |
Definition at line 1887 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::DeleteRoute(), ns3::aodv::RequestQueue::DropPacketWithDst(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::RoutingTableEntry::GetHop(), ns3::aodv::RoutingTableEntry::GetRoute(), ns3::aodv::RoutingTableEntry::GetRreqCnt(), ns3::aodv::IN_SEARCH, ns3::aodv::RoutingTable::LookupValidRoute(), m_addressReqTimer, m_netDiameter, m_queue, m_routingTable, m_rreqRetries, NS_LOG_DEBUG, NS_LOG_LOGIC, SendPacketFromQueue(), and SendRequest().
Referenced by ScheduleRreqRetry().
|
private |
Reset RREQ count and schedule RREQ rate limit timer with delay 1 sec.
Definition at line 1950 of file aodv-routing-protocol.cc.
References m_rreqCount, m_rreqRateLimitTimer, NS_LOG_FUNCTION, ns3::Timer::Schedule(), and ns3::Seconds().
Referenced by Start().
|
private |
Repeated attempts by a source node at route discovery for a single destination use the expanding ring search technique.
dst | the destination IP address |
Definition at line 1165 of file aodv-routing-protocol.cc.
References ns3::Time::As(), ns3::Timer::CANCEL_ON_DESTROY, ns3::aodv::RoutingTableEntry::GetHop(), ns3::aodv::RoutingTableEntry::GetRreqCnt(), ns3::aodv::RoutingTable::LookupRoute(), m_addressReqTimer, m_netDiameter, m_netTraversalTime, m_nodeTraversalTime, m_routingTable, m_timeoutBuffer, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, RouteRequestTimerExpire(), ns3::Time::S, and ns3::Timer::SetFunction().
Referenced by SendRequest().
|
private |
Send hello.
Definition at line 1973 of file aodv-routing-protocol.cc.
References ns3::aodv::AODVTYPE_RREP, ns3::Create(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4Mask::GetOnes(), m_allowedHelloLoss, m_helloInterval, m_seqNo, m_socketAddresses, m_uniformRandomVariable, ns3::MilliSeconds(), NS_LOG_FUNCTION, ns3::Simulator::Schedule(), SendTo(), and ns3::SocketIpTtlTag::SetTtl().
Referenced by HelloTimerExpire().
|
private |
Forward packet from route request queue.
dst | destination address |
route | route to use |
Definition at line 2015 of file aodv-routing-protocol.cc.
References ns3::ConstCast(), ns3::aodv::RequestQueue::Dequeue(), ns3::aodv::DeferredRouteOutputTag::GetInterface(), ns3::Ipv4::GetInterfaceForDevice(), ns3::aodv::QueueEntry::GetIpv4Header(), ns3::aodv::QueueEntry::GetPacket(), ns3::Ipv4Header::GetTtl(), ns3::aodv::QueueEntry::GetUnicastForwardCallback(), m_ipv4, m_queue, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Ipv4Header::SetSource(), and ns3::Ipv4Header::SetTtl().
Referenced by RecvReply(), and RouteRequestTimerExpire().
|
private |
Send RREP.
rreqHeader | route request header |
toOrigin | routing table entry to originator |
Definition at line 1520 of file aodv-routing-protocol.cc.
References AODV_PORT, ns3::aodv::AODVTYPE_RREP, ns3::Create(), FindSocketWithInterfaceAddress(), ns3::aodv::RoutingTableEntry::GetDestination(), ns3::aodv::RreqHeader::GetDst(), ns3::aodv::RreqHeader::GetDstSeqno(), ns3::aodv::RoutingTableEntry::GetHop(), ns3::aodv::RoutingTableEntry::GetInterface(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::aodv::RreqHeader::GetUnknownSeqno(), m_myRouteTimeout, m_seqNo, NS_ASSERT, NS_LOG_FUNCTION, and ns3::SocketIpTtlTag::SetTtl().
Referenced by RecvRequest().
|
private |
Send RREP_ACK.
neighbor | neighbor address |
Definition at line 1614 of file aodv-routing-protocol.cc.
References AODV_PORT, ns3::aodv::AODVTYPE_RREP_ACK, ns3::Create(), FindSocketWithInterfaceAddress(), ns3::aodv::RoutingTableEntry::GetInterface(), ns3::aodv::RoutingTable::LookupRoute(), m_routingTable, NS_ASSERT, NS_LOG_FUNCTION, and ns3::SocketIpTtlTag::SetTtl().
Referenced by RecvReply().
|
private |
Send RREP by intermediate node.
toDst | routing table entry to destination |
toOrigin | routing table entry to originator |
gratRep | indicates whether a gratuitous RREP should be unicast to destination |
Definition at line 1551 of file aodv-routing-protocol.cc.
References AckTimerExpire(), AODV_PORT, ns3::aodv::AODVTYPE_RREP, ns3::Create(), FindSocketWithInterfaceAddress(), ns3::aodv::RoutingTableEntry::GetDestination(), ns3::aodv::RoutingTableEntry::GetHop(), ns3::aodv::RoutingTableEntry::GetInterface(), ns3::aodv::RoutingTableEntry::GetLifeTime(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::aodv::RoutingTableEntry::GetSeqNo(), ns3::aodv::RoutingTableEntry::InsertPrecursor(), ns3::aodv::RoutingTable::LookupRoute(), ns3::aodv::RoutingTableEntry::m_ackTimer, m_blackListTimeout, m_nextHopWait, m_routingTable, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::aodv::RrepHeader::SetAckRequired(), ns3::Timer::SetArguments(), ns3::Timer::SetDelay(), ns3::Timer::SetFunction(), ns3::SocketIpTtlTag::SetTtl(), and ns3::aodv::RoutingTable::Update().
Referenced by RecvRequest().
|
private |
Send RREQ.
dst | destination address |
Definition at line 1031 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), ns3::aodv::AODVTYPE_RREQ, ns3::Create(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Timer::GetDelayLeft(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::RoutingTableEntry::GetHop(), ns3::aodv::RreqHeader::GetId(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4Mask::GetOnes(), ns3::aodv::RoutingTableEntry::GetSeqNo(), ns3::aodv::RoutingTableEntry::GetValidSeqNo(), ns3::aodv::IN_SEARCH, ns3::aodv::RoutingTableEntry::IncrementRreqCnt(), ns3::aodv::IdCache::IsDuplicate(), ns3::aodv::RoutingTable::LookupRoute(), m_destinationOnly, m_gratuitousReply, m_lastBcastTime, m_netDiameter, m_pathDiscoveryTime, m_requestId, m_routingTable, m_rreqCount, m_rreqIdCache, m_rreqRateLimit, m_rreqRateLimitTimer, m_seqNo, m_socketAddresses, m_ttlIncrement, m_ttlStart, m_ttlThreshold, m_uniformRandomVariable, ns3::MicroSeconds(), ns3::MilliSeconds(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ScheduleRreqRetry(), SendRequest(), SendTo(), ns3::aodv::RreqHeader::SetDestinationOnly(), ns3::aodv::RreqHeader::SetDst(), ns3::aodv::RreqHeader::SetDstSeqno(), ns3::aodv::RoutingTableEntry::SetFlag(), ns3::aodv::RreqHeader::SetGratuitousRrep(), ns3::aodv::RoutingTableEntry::SetHop(), ns3::aodv::RreqHeader::SetId(), ns3::aodv::RoutingTableEntry::SetLifeTime(), ns3::aodv::RreqHeader::SetOrigin(), ns3::aodv::RreqHeader::SetOriginSeqno(), ns3::SocketIpTtlTag::SetTtl(), ns3::aodv::RreqHeader::SetUnknownSeqno(), and ns3::aodv::RoutingTable::Update().
Referenced by DeferredRouteOutput(), RouteRequestTimerExpire(), and SendRequest().
|
private |
Forward RERR.
packet | packet |
precursors | list of addresses of the visited nodes |
Definition at line 2149 of file aodv-routing-protocol.cc.
References ns3::Time::As(), FindSocketWithInterfaceAddress(), ns3::Ipv4Address::GetBroadcast(), ns3::Timer::GetDelayLeft(), ns3::aodv::RoutingTableEntry::GetDestination(), ns3::aodv::RoutingTableEntry::GetInterface(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4Mask::GetOnes(), ns3::Timer::IsRunning(), ns3::aodv::RoutingTable::LookupValidRoute(), m_rerrCount, m_rerrRateLimit, m_rerrRateLimitTimer, m_routingTable, m_uniformRandomVariable, ns3::MilliSeconds(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Time::S, ns3::Simulator::Schedule(), and SendTo().
Referenced by RecvError(), and SendRerrWhenBreaksLinkToNextHop().
|
private |
Initiate RERR.
nextHop | next hop address |
Definition at line 2039 of file aodv-routing-protocol.cc.
References ns3::aodv::RerrHeader::AddUnDestination(), ns3::aodv::AODVTYPE_RERR, ns3::aodv::RerrHeader::Clear(), ns3::Create(), ns3::aodv::RerrHeader::GetDestCount(), ns3::aodv::RoutingTable::GetListOfDestinationWithNextHop(), ns3::aodv::RoutingTableEntry::GetPrecursors(), ns3::aodv::RoutingTableEntry::GetSeqNo(), ns3::aodv::RoutingTable::InvalidateRoutesWithDst(), ns3::aodv::RoutingTable::LookupRoute(), m_routingTable, NS_LOG_FUNCTION, NS_LOG_LOGIC, SendRerrMessage(), and ns3::SocketIpTtlTag::SetTtl().
Referenced by RoutingProtocol().
|
private |
Send RERR message when no route to forward input packet.
Unicast if there is reverse route to originating node, broadcast otherwise.
dst | destination node IP address |
dstSeqNo | destination node sequence number |
origin | originating node IP address |
Definition at line 2093 of file aodv-routing-protocol.cc.
References ns3::aodv::RerrHeader::AddUnDestination(), AODV_PORT, ns3::aodv::AODVTYPE_RERR, ns3::Time::As(), ns3::Create(), FindSocketWithInterfaceAddress(), ns3::Ipv4InterfaceAddress::GetBroadcast(), ns3::Timer::GetDelayLeft(), ns3::aodv::RoutingTableEntry::GetInterface(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::aodv::RoutingTableEntry::GetNextHop(), ns3::Ipv4Mask::GetOnes(), ns3::Timer::IsRunning(), ns3::aodv::RoutingTable::LookupValidRoute(), m_rerrCount, m_rerrRateLimit, m_rerrRateLimitTimer, m_routingTable, m_socketAddresses, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Time::S, and ns3::SocketIpTtlTag::SetTtl().
Referenced by Forwarding().
|
private |
Send packet to destination socket.
socket | destination node socket |
packet | packet to send |
destination | destination node IP address |
Definition at line 1159 of file aodv-routing-protocol.cc.
References AODV_PORT.
Referenced by RecvRequest(), SendHello(), SendRequest(), and SendRerrMessage().
|
inline |
Set broadcast enable flag.
f | enable broadcast flag |
Definition at line 171 of file aodv-routing-protocol.h.
References m_enableBroadcast.
Referenced by GetTypeId().
|
inline |
Set destination only flag.
f | the destination only flag |
Definition at line 126 of file aodv-routing-protocol.h.
References m_destinationOnly.
Referenced by GetTypeId().
|
inline |
Set gratuitous reply flag.
f | the gratuitous reply flag |
Definition at line 144 of file aodv-routing-protocol.h.
References m_gratuitousReply.
Referenced by GetTypeId().
|
inline |
Set hello enable.
f | the hello enable flag |
Definition at line 153 of file aodv-routing-protocol.h.
References m_enableHello.
Referenced by GetTypeId().
ipv4 | the ipv4 object this routing protocol is being associated with |
Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
Implements ns3::Ipv4RoutingProtocol.
Definition at line 691 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4Address::GetLoopback(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Ipv4::GetNetDevice(), ns3::Ipv4::GetNInterfaces(), m_ipv4, m_lo, m_routingTable, NS_ASSERT, ns3::Simulator::ScheduleNow(), and Start().
void ns3::aodv::RoutingProtocol::SetMaxQueueLen | ( | uint32_t | len | ) |
Set the maximum queue length.
len | the maximum queue length |
Definition at line 333 of file aodv-routing-protocol.cc.
References m_maxQueueLen, m_queue, and ns3::aodv::RequestQueue::SetMaxQueueLen().
Referenced by GetTypeId().
void ns3::aodv::RoutingProtocol::SetMaxQueueTime | ( | Time | t | ) |
Set the maximum queue time.
t | the maximum queue time |
Definition at line 340 of file aodv-routing-protocol.cc.
References m_maxQueueTime, m_queue, and ns3::aodv::RequestQueue::SetQueueTimeout().
Referenced by GetTypeId().
|
private |
Start protocol operation.
Definition at line 390 of file aodv-routing-protocol.cc.
References m_enableHello, m_nb, m_rerrRateLimitTimer, m_rreqRateLimitTimer, NS_LOG_FUNCTION, RerrRateLimitTimerExpire(), RreqRateLimitTimerExpire(), ns3::Timer::Schedule(), ns3::aodv::Neighbors::ScheduleTimer(), ns3::Seconds(), and ns3::Timer::SetFunction().
Referenced by SetIpv4().
|
private |
Set lifetime field in routing table entry to the maximum of existing lifetime and lt, if the entry exists.
addr | destination address |
lt | proposed time for lifetime field in routing table entry for destination with address addr. |
Definition at line 1251 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::RoutingTableEntry::GetLifeTime(), ns3::aodv::RoutingTable::LookupRoute(), m_routingTable, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::aodv::RoutingTableEntry::SetLifeTime(), ns3::aodv::RoutingTableEntry::SetRreqCnt(), ns3::aodv::RoutingTable::Update(), and ns3::aodv::VALID.
Referenced by Forwarding(), RouteInput(), and RouteOutput().
|
private |
Update neighbor record.
receiver | is supposed to be my interface |
sender | is supposed to be IP address of my neighbor. |
Definition at line 1270 of file aodv-routing-protocol.cc.
References ns3::aodv::RoutingTable::AddRoute(), ns3::Ipv4::GetAddress(), ns3::aodv::RoutingTableEntry::GetHop(), ns3::Ipv4::GetInterfaceForAddress(), ns3::aodv::RoutingTableEntry::GetLifeTime(), ns3::Ipv4::GetNetDevice(), ns3::aodv::RoutingTableEntry::GetOutputDevice(), ns3::aodv::RoutingTableEntry::GetValidSeqNo(), ns3::aodv::RoutingTable::LookupRoute(), m_activeRouteTimeout, m_ipv4, m_routingTable, NS_LOG_FUNCTION, ns3::aodv::RoutingTableEntry::SetLifeTime(), and ns3::aodv::RoutingTable::Update().
Referenced by RecvAodv().
|
static |
UDP Port for AODV control traffic.
Definition at line 55 of file aodv-routing-protocol.h.
Referenced by NotifyAddAddress(), NotifyInterfaceUp(), NotifyRemoveAddress(), RecvReply(), RouteInput(), SendReply(), SendReplyAck(), SendReplyByIntermediateNode(), SendRerrWhenNoRouteToForward(), and SendTo().
|
private |
Period of time during which the route is considered to be valid.
Definition at line 218 of file aodv-routing-protocol.h.
Referenced by Forwarding(), GetTypeId(), RecvReply(), RecvRequest(), RouteInput(), RouteOutput(), and UpdateRouteToNeighbor().
|
private |
Map IP address + RREQ timer.
Definition at line 477 of file aodv-routing-protocol.h.
Referenced by RecvReply(), RouteRequestTimerExpire(), and ScheduleRreqRetry().
|
private |
Number of hello messages which may be loss for valid link.
Definition at line 234 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), ProcessHello(), RecvRequest(), and SendHello().
|
private |
Time for which the node is put into the blacklist.
Definition at line 242 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendReplyByIntermediateNode().
|
private |
DeletePeriod is intended to provide an upper bound on the time for which an upstream node A can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D.
Definition at line 240 of file aodv-routing-protocol.h.
Referenced by GetTypeId().
|
private |
Indicates only the destination may respond to this RREQ.
Definition at line 247 of file aodv-routing-protocol.h.
Referenced by GetDestinationOnlyFlag(), SendRequest(), and SetDestinationOnlyFlag().
|
private |
Handle duplicated broadcast/multicast packets.
Definition at line 275 of file aodv-routing-protocol.h.
Referenced by RouteInput().
|
private |
Indicates whether a a broadcast data packets forwarding enable.
Definition at line 251 of file aodv-routing-protocol.h.
Referenced by GetBroadcastEnable(), RouteInput(), and SetBroadcastEnable().
|
private |
Indicates whether a hello messages enable.
Definition at line 250 of file aodv-routing-protocol.h.
Referenced by DoInitialize(), GetHelloEnable(), ProcessHello(), SetHelloEnable(), and Start().
|
private |
Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.
Definition at line 248 of file aodv-routing-protocol.h.
Referenced by GetGratuitousReplyFlag(), SendRequest(), and SetGratuitousReplyFlag().
|
private |
Every HelloInterval the node checks whether it has sent a broadcast within the last HelloInterval.
If it has not, it MAY broadcast a Hello message
Definition at line 233 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), HelloTimerExpire(), ProcessHello(), RecvRequest(), and SendHello().
|
private |
Hello timer.
Definition at line 465 of file aodv-routing-protocol.h.
Referenced by DoInitialize(), HelloTimerExpire(), NotifyInterfaceDown(), and NotifyRemoveAddress().
IP protocol.
Definition at line 254 of file aodv-routing-protocol.h.
Referenced by DoDispose(), LoopbackRoute(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), PrintRoutingTable(), ProcessHello(), RecvReply(), RecvRequest(), RouteInput(), RouteOutput(), SendPacketFromQueue(), SetIpv4(), and UpdateRouteToNeighbor().
|
private |
Keep track of the last bcast time.
Definition at line 494 of file aodv-routing-protocol.h.
Referenced by HelloTimerExpire(), RecvRequest(), and SendRequest().
Loopback device used to defer RREQ until packet will be fully formed.
Definition at line 261 of file aodv-routing-protocol.h.
Referenced by LoopbackRoute(), RouteInput(), and SetIpv4().
|
private |
The maximum number of packets that we allow a routing protocol to buffer.
Definition at line 243 of file aodv-routing-protocol.h.
Referenced by GetMaxQueueLen(), and SetMaxQueueLen().
|
private |
The maximum period of time that a routing protocol is allowed to buffer a packet for.
Definition at line 245 of file aodv-routing-protocol.h.
Referenced by GetMaxQueueTime(), and SetMaxQueueTime().
|
private |
Value of lifetime field in RREP generating by this node.
Definition at line 228 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendReply().
|
private |
Handle neighbors.
Definition at line 277 of file aodv-routing-protocol.h.
Referenced by RoutingProtocol(), Forwarding(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), NotifyTxError(), ProcessHello(), RecvRequest(), RouteInput(), and Start().
|
private |
Net diameter measures the maximum possible number of hops between two nodes in the network.
Definition at line 219 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), RouteRequestTimerExpire(), ScheduleRreqRetry(), and SendRequest().
|
private |
Estimate of the average net traversal time.
Definition at line 226 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), RecvRequest(), and ScheduleRreqRetry().
|
private |
Period of our waiting for the neighbour's RREP_ACK.
Definition at line 241 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendReplyByIntermediateNode().
|
private |
NodeTraversalTime is a conservative estimate of the average one hop traversal time for packets and should include queuing delays, interrupt processing times and transfer times.
Definition at line 225 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), RecvRequest(), and ScheduleRreqRetry().
|
private |
Estimate of maximum time needed to find route in network.
Definition at line 227 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendRequest().
|
private |
A "drop-front" queue used by the routing layer to buffer packets to which it does not have a route.
Definition at line 267 of file aodv-routing-protocol.h.
Referenced by DeferredRouteOutput(), RouteRequestTimerExpire(), SendPacketFromQueue(), SetMaxQueueLen(), and SetMaxQueueTime().
|
private |
|
private |
Number of RERRs used for RERR rate control.
Definition at line 281 of file aodv-routing-protocol.h.
Referenced by RerrRateLimitTimerExpire(), SendRerrMessage(), and SendRerrWhenNoRouteToForward().
|
private |
Maximum number of REER per second.
Definition at line 217 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), SendRerrMessage(), and SendRerrWhenNoRouteToForward().
|
private |
RERR rate limit timer.
Definition at line 473 of file aodv-routing-protocol.h.
Referenced by RerrRateLimitTimerExpire(), SendRerrMessage(), SendRerrWhenNoRouteToForward(), and Start().
|
private |
Routing table.
Definition at line 264 of file aodv-routing-protocol.h.
Referenced by AckTimerExpire(), DeferredRouteOutput(), Forwarding(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), PrintRoutingTable(), ProcessHello(), RecvError(), RecvReply(), RecvReplyAck(), RecvRequest(), RouteInput(), RouteOutput(), RouteRequestTimerExpire(), ScheduleRreqRetry(), SendReplyAck(), SendReplyByIntermediateNode(), SendRequest(), SendRerrMessage(), SendRerrWhenBreaksLinkToNextHop(), SendRerrWhenNoRouteToForward(), SetIpv4(), UpdateRouteLifeTime(), and UpdateRouteToNeighbor().
|
private |
Number of RREQs used for RREQ rate control.
Definition at line 279 of file aodv-routing-protocol.h.
Referenced by RreqRateLimitTimerExpire(), and SendRequest().
|
private |
Handle duplicated RREQ.
Definition at line 273 of file aodv-routing-protocol.h.
Referenced by RecvRequest(), and SendRequest().
|
private |
Maximum number of RREQ per second.
Definition at line 216 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendRequest().
|
private |
RREQ rate limit timer.
Definition at line 469 of file aodv-routing-protocol.h.
Referenced by RreqRateLimitTimerExpire(), SendRequest(), and Start().
|
private |
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
Definition at line 208 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and RouteRequestTimerExpire().
|
private |
Request sequence number.
Definition at line 271 of file aodv-routing-protocol.h.
Referenced by SendHello(), SendReply(), and SendRequest().
|
private |
Raw unicast socket per each IP interface, map socket -> iface address (IP + mask)
Definition at line 256 of file aodv-routing-protocol.h.
Referenced by DoDispose(), FindSocketWithInterfaceAddress(), IsMyOwnAddress(), LoopbackRoute(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), RecvAodv(), RecvRequest(), RouteInput(), RouteOutput(), SendHello(), SendRequest(), and SendRerrWhenNoRouteToForward().
|
private |
Raw subnet directed broadcast socket per each IP interface, map socket -> iface address (IP.
Definition at line 259 of file aodv-routing-protocol.h.
Referenced by DoDispose(), FindSubnetBroadcastSocketWithInterfaceAddress(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), and RecvAodv().
|
private |
Provide a buffer for the timeout.
Definition at line 215 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and ScheduleRreqRetry().
|
private |
TTL increment for each attempt using the expanding ring search for RREQ dissemination.
Definition at line 211 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendRequest().
|
private |
Initial TTL value for RREQ.
Definition at line 210 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendRequest().
|
private |
Maximum TTL value for expanding ring search, TTL = NetDiameter is used beyond this value.
Definition at line 213 of file aodv-routing-protocol.h.
Referenced by GetTypeId(), and SendRequest().
|
private |
Provides uniform random variables.
Definition at line 492 of file aodv-routing-protocol.h.
Referenced by AssignStreams(), DoInitialize(), GetTypeId(), RecvRequest(), SendHello(), SendRequest(), and SendRerrMessage().