A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::dsdv::RoutingProtocol Class Reference

DSDV routing protocol. More...

#include "dsdv-routing-protocol.h"

+ Inheritance diagram for ns3::dsdv::RoutingProtocol:
+ Collaboration diagram for ns3::dsdv::RoutingProtocol:

Public Member Functions

 RoutingProtocol ()
 c-tor
 
 ~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 GetEnableBufferFlag () const
 Get enable buffer flag.
 
bool GetEnableRAFlag () const
 Get enable route aggregation (RA) flag.
 
bool GetWSTFlag () const
 Get weighted settling time (WST) flag.
 
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 input packet.
 
Ptr< Ipv4RouteRouteOutput (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 SetEnableBufferFlag (bool f)
 Set enable buffer flag.
 
void SetEnableRAFlag (bool f)
 Set enable route aggregation (RA) flag.
 
void SetIpv4 (Ptr< Ipv4 > ipv4) override
 
void SetWSTFlag (bool f)
 Set weighted settling time (WST) flag.
 
- 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< ObjectGetObject () 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< ObjectGetObject (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.
 
SimpleRefCountoperator= (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 DSDV_PORT = 269
 UDP Port for DSDV control traffic.
 

Private Member Functions

void DeferredRouteOutput (Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
 Queue packet until we find a route.
 
void Drop (Ptr< const Packet > packet, const Ipv4Header &header, Socket::SocketErrno err)
 Notify that packet is dropped for some reason.
 
Ptr< SocketFindSocketWithInterfaceAddress (Ipv4InterfaceAddress iface) const
 Find socket with local interface address iface.
 
Time GetSettlingTime (Ipv4Address dst)
 Get settlingTime for a destination.
 
void LookForQueuedPackets ()
 Look for any queued packets to send them out.
 
Ptr< Ipv4RouteLoopbackRoute (const Ipv4Header &header, Ptr< NetDevice > oif) const
 Create loopback route for given header.
 
void MergeTriggerPeriodicUpdates ()
 Merge periodic updates.
 
void RecvDsdv (Ptr< Socket > socket)
 Receive and process dsdv control packet.
 
void Send (Ptr< Ipv4Route > route, Ptr< const Packet > packet, const Ipv4Header &header)
 Send a packet.
 
void SendPacketFromQueue (Ipv4Address dst, Ptr< Ipv4Route > route)
 Send packet from queue.
 
void SendPeriodicUpdate ()
 Broadcasts the entire routing table for every PeriodicUpdateInterval.
 
void SendTriggeredUpdate ()
 Sends trigger update from a node.
 
void Start ()
 Start protocol operation.
 

Private Attributes

bool EnableBuffering
 Flag that is used to enable or disable buffering.
 
bool EnableRouteAggregation
 This is a flag to enable route aggregation.
 
bool EnableWST
 Flag that is used to enable or disable Weighted Settling Time.
 
uint32_t Holdtimes
 Holdtimes is the multiplicative factor of PeriodicUpdateInterval for which the node waits since the last update before flushing a route from the routing table.
 
RoutingTable m_advRoutingTable
 Advertised Routing table for the node.
 
ErrorCallback m_ecb
 Error callback for own packets.
 
Ptr< Ipv4m_ipv4
 IP protocol.
 
Ptr< NetDevicem_lo
 Loopback device used to defer route requests until a route is found.
 
Ipv4Address m_mainAddress
 Nodes IP address.
 
uint32_t m_maxQueuedPacketsPerDst
 The maximum number of packets that we allow per destination to buffer.
 
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_periodicUpdateInterval
 PeriodicUpdateInterval specifies the periodic time interval between which the a node broadcasts its entire routing table.
 
Timer m_periodicUpdateTimer
 Timer to trigger periodic updates from a node.
 
PacketQueue m_queue
 A "drop front on full" queue used by the routing layer to buffer packets to which it does not have a route.
 
Time m_routeAggregationTime
 Parameter that holds the route aggregation time interval.
 
RoutingTable m_routingTable
 Main Routing table for the node.
 
UnicastForwardCallback m_scb
 Unicast callback for own packets.
 
Time m_settlingTime
 SettlingTime specifies the time for which a node waits before propagating an update.
 
std::map< Ptr< Socket >, Ipv4InterfaceAddressm_socketAddresses
 Raw socket per each IP interface, map socket -> iface address (IP + mask)
 
Timer m_triggeredExpireTimer
 Timer used by the trigger updates in case of Weighted Settling Time is used.
 
Ptr< UniformRandomVariablem_uniformRandomVariable
 Provides uniform random variables.
 
double m_weightedFactor
 This is the weighted factor to determine the weighted settling time.
 

Additional Inherited Members

- Public Types inherited from ns3::Ipv4RoutingProtocol
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrnoErrorCallback
 Callback for routing errors (e.g., no route found)
 
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_tLocalDeliverCallback
 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.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
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.
 

Detailed Description

DSDV routing protocol.

Definition at line 44 of file dsdv-routing-protocol.h.

Constructor & Destructor Documentation

◆ RoutingProtocol()

ns3::dsdv::RoutingProtocol::RoutingProtocol ( )

c-tor

Definition at line 216 of file dsdv-routing-protocol.cc.

References ns3::CreateObject(), and m_uniformRandomVariable.

+ Here is the call graph for this function:

◆ ~RoutingProtocol()

ns3::dsdv::RoutingProtocol::~RoutingProtocol ( )
override

Definition at line 225 of file dsdv-routing-protocol.cc.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::dsdv::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.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 209 of file dsdv-routing-protocol.cc.

References m_uniformRandomVariable, and NS_LOG_FUNCTION.

◆ DeferredRouteOutput()

void ns3::dsdv::RoutingProtocol::DeferredRouteOutput ( Ptr< const Packet > p,
const Ipv4Header & header,
UnicastForwardCallback ucb,
ErrorCallback ecb )
private

Queue packet until we find a route.

Parameters
pthe packet to route
headerthe Ipv4Header
ucbthe UnicastForwardCallback function
ecbthe ErrorCallback function

Definition at line 360 of file dsdv-routing-protocol.cc.

References ns3::dsdv::PacketQueue::Enqueue(), m_queue, NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by RouteInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::dsdv::RoutingProtocol::DoDispose ( )
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 230 of file dsdv-routing-protocol.cc.

References ns3::Object::DoDispose(), m_ipv4, and m_socketAddresses.

+ Here is the call graph for this function:

◆ Drop()

void ns3::dsdv::RoutingProtocol::Drop ( Ptr< const Packet > packet,
const Ipv4Header & header,
Socket::SocketErrno err )
private

Notify that packet is dropped for some reason.

Parameters
packetthe dropped packet
headerthe IPv4 header
errthe error number

Definition at line 1131 of file dsdv-routing-protocol.cc.

References ns3::Ipv4Header::GetDestination(), m_mainAddress, and NS_LOG_DEBUG.

Referenced by Start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindSocketWithInterfaceAddress()

Ptr< Socket > ns3::dsdv::RoutingProtocol::FindSocketWithInterfaceAddress ( Ipv4InterfaceAddress iface) const
private

Find socket with local interface address iface.

Parameters
ifacethe interface
Returns
the socket

Definition at line 1106 of file dsdv-routing-protocol.cc.

References m_socketAddresses.

Referenced by NotifyAddAddress(), NotifyInterfaceDown(), and NotifyRemoveAddress().

+ Here is the caller graph for this function:

◆ GetEnableBufferFlag()

bool ns3::dsdv::RoutingProtocol::GetEnableBufferFlag ( ) const

Get enable buffer flag.

Returns
the enable buffer flag

Definition at line 179 of file dsdv-routing-protocol.cc.

References EnableBuffering.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetEnableRAFlag()

bool ns3::dsdv::RoutingProtocol::GetEnableRAFlag ( ) const

Get enable route aggregation (RA) flag.

Returns
the enable route aggregation (RA) flag

Definition at line 203 of file dsdv-routing-protocol.cc.

References EnableRouteAggregation.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetSettlingTime()

Time ns3::dsdv::RoutingProtocol::GetSettlingTime ( Ipv4Address dst)
private

Get settlingTime for a destination.

Parameters
dst- destination address
Returns
settlingTime for the destination if found

Definition at line 1208 of file dsdv-routing-protocol.cc.

References ns3::Time::As(), EnableWST, ns3::dsdv::RoutingTableEntry::GetLifeTime(), ns3::dsdv::RoutingTableEntry::GetSettlingTime(), ns3::dsdv::RoutingTable::LookupRoute(), m_routingTable, m_weightedFactor, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Time::S, and ns3::Seconds().

Referenced by RecvDsdv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTypeId()

◆ GetWSTFlag()

bool ns3::dsdv::RoutingProtocol::GetWSTFlag ( ) const

Get weighted settling time (WST) flag.

Returns
the weighted settling time (WST) flag

Definition at line 191 of file dsdv-routing-protocol.cc.

References EnableWST.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ LookForQueuedPackets()

void ns3::dsdv::RoutingProtocol::LookForQueuedPackets ( )
private

Look for any queued packets to send them out.

Definition at line 1138 of file dsdv-routing-protocol.cc.

References ns3::dsdv::PacketQueue::Find(), ns3::dsdv::RoutingTableEntry::GetDestination(), ns3::dsdv::RoutingTableEntry::GetHop(), ns3::dsdv::RoutingTable::GetListOfAllRoutes(), ns3::dsdv::RoutingTableEntry::GetNextHop(), ns3::dsdv::RoutingTableEntry::GetRoute(), ns3::dsdv::RoutingTable::LookupRoute(), m_queue, m_routingTable, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and SendPacketFromQueue().

Referenced by RouteOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoopbackRoute()

Ptr< Ipv4Route > ns3::dsdv::RoutingProtocol::LoopbackRoute ( const Ipv4Header & header,
Ptr< NetDevice > oif ) const
private

Create loopback route for given header.

Parameters
headerthe IP header
oifthe device
Returns
the route

Definition at line 507 of file dsdv-routing-protocol.cc.

References ns3::Create(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4::GetNetDevice(), m_ipv4, m_lo, m_socketAddresses, NS_ASSERT, and NS_ASSERT_MSG.

Referenced by RouteOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MergeTriggerPeriodicUpdates()

void ns3::dsdv::RoutingProtocol::MergeTriggerPeriodicUpdates ( )
private

Merge periodic updates.

Definition at line 1235 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::AnyRunningEvent(), ns3::dsdv::RoutingTable::DeleteRoute(), ns3::dsdv::RoutingTableEntry::GetDestination(), ns3::dsdv::RoutingTableEntry::GetEntriesChanged(), ns3::dsdv::RoutingTable::GetListOfAllRoutes(), ns3::dsdv::RoutingTableEntry::GetSeqNo(), m_advRoutingTable, m_routingTable, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::dsdv::RoutingTableEntry::SetEntriesChanged(), ns3::dsdv::RoutingTableEntry::SetFlag(), ns3::dsdv::RoutingTable::Update(), and ns3::dsdv::VALID.

Referenced by SendPeriodicUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyAddAddress()

void ns3::dsdv::RoutingProtocol::NotifyAddAddress ( uint32_t interface,
Ipv4InterfaceAddress address )
overridevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa 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 1045 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::AddRoute(), ns3::Socket::CreateSocket(), DSDV_PORT, FindSocketWithInterfaceAddress(), ns3::Ipv4Address::GetAny(), 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, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, and RecvDsdv().

+ Here is the call graph for this function:

◆ NotifyInterfaceDown()

void ns3::dsdv::RoutingProtocol::NotifyInterfaceDown ( uint32_t interface)
overridevirtual
Parameters
interfacethe 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 1026 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::Clear(), ns3::dsdv::RoutingTable::DeleteAllRoutesFromInterface(), FindSocketWithInterfaceAddress(), ns3::Ipv4::GetAddress(), ns3::Object::GetObject(), m_advRoutingTable, m_ipv4, m_routingTable, m_socketAddresses, NS_ASSERT, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ NotifyInterfaceUp()

void ns3::dsdv::RoutingProtocol::NotifyInterfaceUp ( uint32_t interface)
overridevirtual
Parameters
interfacethe 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 990 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::AddRoute(), ns3::Socket::CreateSocket(), DSDV_PORT, ns3::Ipv4::GetAddress(), ns3::Ipv4Address::GetAny(), ns3::Ipv4::GetInterfaceForAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Ipv4::GetNetDevice(), ns3::Object::GetObject(), ns3::UdpSocketFactory::GetTypeId(), m_ipv4, m_mainAddress, m_routingTable, m_socketAddresses, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, and RecvDsdv().

+ Here is the call graph for this function:

◆ NotifyRemoveAddress()

void ns3::dsdv::RoutingProtocol::NotifyRemoveAddress ( uint32_t interface,
Ipv4InterfaceAddress address )
overridevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa 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 1082 of file dsdv-routing-protocol.cc.

References ns3::Socket::CreateSocket(), DSDV_PORT, FindSocketWithInterfaceAddress(), ns3::Ipv4Address::GetAny(), ns3::Object::GetObject(), ns3::UdpSocketFactory::GetTypeId(), m_ipv4, m_socketAddresses, ns3::MakeCallback(), NS_ASSERT, and RecvDsdv().

+ Here is the call graph for this function:

◆ PrintRoutingTable()

void ns3::dsdv::RoutingProtocol::PrintRoutingTable ( Ptr< OutputStreamWrapper > stream,
Time::Unit unit = Time::S ) const
overridevirtual

Print the Routing Table entries.

Parameters
streamThe ostream the Routing table is printed to
unitThe time unit to be used in the report

Implements ns3::Ipv4RoutingProtocol.

Definition at line 242 of file dsdv-routing-protocol.cc.

References ns3::Time::As(), ns3::Object::GetObject(), m_ipv4, m_routingTable, ns3::Now(), and ns3::dsdv::RoutingTable::Print().

+ Here is the call graph for this function:

◆ RecvDsdv()

void ns3::dsdv::RoutingProtocol::RecvDsdv ( Ptr< Socket > socket)
private

Receive and process dsdv control packet.

Parameters
socketthe socket for receiving dsdv control packets

Definition at line 555 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::AddIpv4Event(), ns3::dsdv::RoutingTable::AddRoute(), ns3::dsdv::RoutingTable::AnyRunningEvent(), ns3::Time::As(), ns3::InetSocketAddress::ConvertFrom(), ns3::Create(), ns3::dsdv::RoutingTable::DeleteRoute(), EnableRouteAggregation, ns3::dsdv::RoutingTable::ForceDeleteIpv4Event(), ns3::Ipv4::GetAddress(), ns3::Timer::GetDelayLeft(), ns3::dsdv::DsdvHeader::GetDst(), ns3::dsdv::DsdvHeader::GetDstSeqno(), ns3::dsdv::RoutingTableEntry::GetHop(), ns3::dsdv::DsdvHeader::GetHopCount(), ns3::Ipv4::GetInterfaceForAddress(), ns3::InetSocketAddress::GetIpv4(), ns3::dsdv::RoutingTable::GetListOfAllRoutes(), ns3::dsdv::RoutingTable::GetListOfDestinationWithNextHop(), ns3::Ipv4::GetNetDevice(), ns3::dsdv::RoutingTableEntry::GetNextHop(), ns3::dsdv::RoutingTableEntry::GetSeqNo(), GetSettlingTime(), ns3::EventId::GetUid(), ns3::dsdv::RoutingTable::LookupRoute(), m_advRoutingTable, m_ipv4, m_mainAddress, m_periodicUpdateTimer, m_routeAggregationTime, m_routingTable, m_settlingTime, m_socketAddresses, m_uniformRandomVariable, ns3::MicroSeconds(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, packetSize, ns3::Time::S, ns3::Simulator::Schedule(), SendTriggeredUpdate(), ns3::dsdv::RoutingTableEntry::SetEntriesChanged(), ns3::dsdv::RoutingTableEntry::SetFlag(), ns3::dsdv::RoutingTableEntry::SetHop(), ns3::dsdv::RoutingTableEntry::SetLifeTime(), ns3::dsdv::RoutingTableEntry::SetNextHop(), ns3::dsdv::RoutingTableEntry::SetSeqNo(), ns3::dsdv::RoutingTableEntry::SetSettlingTime(), ns3::dsdv::RoutingTable::Update(), and ns3::dsdv::VALID.

Referenced by NotifyAddAddress(), NotifyInterfaceUp(), and NotifyRemoveAddress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RouteInput()

bool ns3::dsdv::RoutingProtocol::RouteInput ( Ptr< const Packet > p,
const Ipv4Header & header,
Ptr< const NetDevice > idev,
const UnicastForwardCallback & ucb,
const MulticastForwardCallback & mcb,
const LocalDeliverCallback & lcb,
const ErrorCallback & ecb )
overridevirtual

◆ RouteOutput()

Ptr< Ipv4Route > ns3::dsdv::RoutingProtocol::RouteOutput ( Ptr< Packet > p,
const Ipv4Header & header,
Ptr< NetDevice > oif,
Socket::SocketErrno & sockerr )
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.

Parameters
ppacket to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer.
headerinput parameter (used to form key to search for the route)
oifOutput interface Netdevice. May be zero, or may be bound via socket options to a particular output interface.
sockerrOutput parameter; socket errno
Returns
a code that indicates what happened in the lookup

Implements ns3::Ipv4RoutingProtocol.

Definition at line 268 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::AddRoute(), EnableBuffering, ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::Ipv4Header::GetDestination(), ns3::dsdv::RoutingTableEntry::GetHop(), ns3::Ipv4::GetInterfaceForDevice(), ns3::dsdv::RoutingTableEntry::GetNextHop(), ns3::dsdv::RoutingTableEntry::GetRoute(), LookForQueuedPackets(), ns3::dsdv::RoutingTable::LookupRoute(), LoopbackRoute(), m_advRoutingTable, m_ipv4, m_routingTable, m_socketAddresses, m_uniformRandomVariable, ns3::MicroSeconds(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::dsdv::RoutingTable::Purge(), ns3::Simulator::Schedule(), and SendTriggeredUpdate().

+ Here is the call graph for this function:

◆ Send()

void ns3::dsdv::RoutingProtocol::Send ( Ptr< Ipv4Route > route,
Ptr< const Packet > packet,
const Ipv4Header & header )
private

Send a packet.

Parameters
routethe route
packetthe packet
headerthe IPv4 header

Definition at line 1122 of file dsdv-routing-protocol.cc.

References ns3::Ipv4Header::GetDestination(), ns3::Object::GetObject(), ns3::Ipv4Header::GetProtocol(), m_ipv4, and NS_ASSERT.

Referenced by Start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPacketFromQueue()

void ns3::dsdv::RoutingProtocol::SendPacketFromQueue ( Ipv4Address dst,
Ptr< Ipv4Route > route )
private

Send packet from queue.

Parameters
dst- destination address to which we are sending the packet to
route- route identified for this packet

Definition at line 1174 of file dsdv-routing-protocol.cc.

References ns3::ConstCast(), ns3::dsdv::PacketQueue::Dequeue(), ns3::dsdv::PacketQueue::Find(), ns3::Ipv4::GetInterfaceForDevice(), ns3::dsdv::QueueEntry::GetIpv4Header(), ns3::dsdv::QueueEntry::GetPacket(), ns3::dsdv::PacketQueue::GetSize(), ns3::Ipv4Header::GetTtl(), ns3::dsdv::QueueEntry::GetUnicastForwardCallback(), m_ipv4, m_mainAddress, m_queue, m_uniformRandomVariable, ns3::MilliSeconds(), NS_LOG_DEBUG, ns3::dsdv::DeferredRouteOutputTag::oif, ns3::Simulator::Schedule(), SendPacketFromQueue(), ns3::Ipv4Header::SetSource(), and ns3::Ipv4Header::SetTtl().

Referenced by LookForQueuedPackets(), and SendPacketFromQueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPeriodicUpdate()

◆ SendTriggeredUpdate()

void ns3::dsdv::RoutingProtocol::SendTriggeredUpdate ( )
private

◆ SetEnableBufferFlag()

void ns3::dsdv::RoutingProtocol::SetEnableBufferFlag ( bool f)

Set enable buffer flag.

Parameters
fThe enable buffer flag

Definition at line 173 of file dsdv-routing-protocol.cc.

References EnableBuffering.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetEnableRAFlag()

void ns3::dsdv::RoutingProtocol::SetEnableRAFlag ( bool f)

Set enable route aggregation (RA) flag.

Parameters
fthe enable route aggregation (RA) flag

Definition at line 197 of file dsdv-routing-protocol.cc.

References EnableRouteAggregation.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetIpv4()

void ns3::dsdv::RoutingProtocol::SetIpv4 ( Ptr< Ipv4 > ipv4)
overridevirtual
Parameters
ipv4the ipv4 object this routing protocol is being associated with

Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol

Implements ns3::Ipv4RoutingProtocol.

Definition at line 964 of file dsdv-routing-protocol.cc.

References ns3::dsdv::RoutingTable::AddRoute(), ns3::Ipv4::GetAddress(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4Address::GetLoopback(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Ipv4::GetNetDevice(), ns3::Ipv4::GetNInterfaces(), ns3::dsdv::INVALID, m_ipv4, m_lo, m_routingTable, NS_ASSERT, ns3::Simulator::ScheduleNow(), ns3::dsdv::RoutingTableEntry::SetEntriesChanged(), ns3::dsdv::RoutingTableEntry::SetFlag(), and Start().

+ Here is the call graph for this function:

◆ SetWSTFlag()

void ns3::dsdv::RoutingProtocol::SetWSTFlag ( bool f)

Set weighted settling time (WST) flag.

Parameters
fthe weighted settling time (WST) flag

Definition at line 185 of file dsdv-routing-protocol.cc.

References EnableWST.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ Start()

void ns3::dsdv::RoutingProtocol::Start ( )
private

Start protocol operation.

Definition at line 254 of file dsdv-routing-protocol.cc.

References Drop(), Holdtimes, m_advRoutingTable, m_ecb, m_maxQueuedPacketsPerDst, m_maxQueueLen, m_maxQueueTime, m_periodicUpdateInterval, m_periodicUpdateTimer, m_queue, m_routingTable, m_scb, m_uniformRandomVariable, ns3::MakeCallback(), ns3::MicroSeconds(), ns3::Timer::Schedule(), Send(), SendPeriodicUpdate(), ns3::Timer::SetFunction(), ns3::dsdv::RoutingTable::Setholddowntime(), ns3::dsdv::PacketQueue::SetMaxPacketsPerDst(), ns3::dsdv::PacketQueue::SetMaxQueueLen(), and ns3::dsdv::PacketQueue::SetQueueTimeout().

Referenced by SetIpv4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ DSDV_PORT

const uint32_t ns3::dsdv::RoutingProtocol::DSDV_PORT = 269
static

UDP Port for DSDV control traffic.

Definition at line 52 of file dsdv-routing-protocol.h.

Referenced by NotifyAddAddress(), NotifyInterfaceUp(), NotifyRemoveAddress(), SendPeriodicUpdate(), and SendTriggeredUpdate().

◆ EnableBuffering

bool ns3::dsdv::RoutingProtocol::EnableBuffering
private

Flag that is used to enable or disable buffering.

Definition at line 168 of file dsdv-routing-protocol.h.

Referenced by GetEnableBufferFlag(), RouteInput(), RouteOutput(), and SetEnableBufferFlag().

◆ EnableRouteAggregation

bool ns3::dsdv::RoutingProtocol::EnableRouteAggregation
private

This is a flag to enable route aggregation.

Route aggregation will aggregate all routes for 'RouteAggregationTime' from the time an update is received by a node and sends them as a single update .

Definition at line 176 of file dsdv-routing-protocol.h.

Referenced by GetEnableRAFlag(), RecvDsdv(), and SetEnableRAFlag().

◆ EnableWST

bool ns3::dsdv::RoutingProtocol::EnableWST
private

Flag that is used to enable or disable Weighted Settling Time.

Definition at line 170 of file dsdv-routing-protocol.h.

Referenced by GetSettlingTime(), GetWSTFlag(), and SetWSTFlag().

◆ Holdtimes

uint32_t ns3::dsdv::RoutingProtocol::Holdtimes
private

Holdtimes is the multiplicative factor of PeriodicUpdateInterval for which the node waits since the last update before flushing a route from the routing table.

If PeriodicUpdateInterval is 8s and Holdtimes is 3, the node waits for 24s since the last update to flush this route from its routing table.

Definition at line 139 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), and Start().

◆ m_advRoutingTable

RoutingTable ns3::dsdv::RoutingProtocol::m_advRoutingTable
private

Advertised Routing table for the node.

Definition at line 157 of file dsdv-routing-protocol.h.

Referenced by MergeTriggerPeriodicUpdates(), NotifyInterfaceDown(), RecvDsdv(), RouteOutput(), SendTriggeredUpdate(), and Start().

◆ m_ecb

ErrorCallback ns3::dsdv::RoutingProtocol::m_ecb
private

Error callback for own packets.

Definition at line 182 of file dsdv-routing-protocol.h.

Referenced by Start().

◆ m_ipv4

◆ m_lo

Ptr<NetDevice> ns3::dsdv::RoutingProtocol::m_lo
private

Loopback device used to defer route requests until a route is found.

Definition at line 153 of file dsdv-routing-protocol.h.

Referenced by LoopbackRoute(), RouteInput(), and SetIpv4().

◆ m_mainAddress

Ipv4Address ns3::dsdv::RoutingProtocol::m_mainAddress
private

◆ m_maxQueuedPacketsPerDst

uint32_t ns3::dsdv::RoutingProtocol::m_maxQueuedPacketsPerDst
private

The maximum number of packets that we allow per destination to buffer.

Definition at line 161 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), and Start().

◆ m_maxQueueLen

uint32_t ns3::dsdv::RoutingProtocol::m_maxQueueLen
private

The maximum number of packets that we allow a routing protocol to buffer.

Definition at line 159 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), and Start().

◆ m_maxQueueTime

Time ns3::dsdv::RoutingProtocol::m_maxQueueTime
private

The maximum period of time that a routing protocol is allowed to buffer a packet for.

Definition at line 163 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), and Start().

◆ m_periodicUpdateInterval

Time ns3::dsdv::RoutingProtocol::m_periodicUpdateInterval
private

PeriodicUpdateInterval specifies the periodic time interval between which the a node broadcasts its entire routing table.

Definition at line 142 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), SendPeriodicUpdate(), and Start().

◆ m_periodicUpdateTimer

Timer ns3::dsdv::RoutingProtocol::m_periodicUpdateTimer
private

Timer to trigger periodic updates from a node.

Definition at line 255 of file dsdv-routing-protocol.h.

Referenced by RecvDsdv(), SendPeriodicUpdate(), and Start().

◆ m_queue

PacketQueue ns3::dsdv::RoutingProtocol::m_queue
private

A "drop front on full" queue used by the routing layer to buffer packets to which it does not have a route.

Definition at line 166 of file dsdv-routing-protocol.h.

Referenced by DeferredRouteOutput(), LookForQueuedPackets(), SendPacketFromQueue(), and Start().

◆ m_routeAggregationTime

Time ns3::dsdv::RoutingProtocol::m_routeAggregationTime
private

Parameter that holds the route aggregation time interval.

Definition at line 178 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), and RecvDsdv().

◆ m_routingTable

◆ m_scb

UnicastForwardCallback ns3::dsdv::RoutingProtocol::m_scb
private

Unicast callback for own packets.

Definition at line 180 of file dsdv-routing-protocol.h.

Referenced by Start().

◆ m_settlingTime

Time ns3::dsdv::RoutingProtocol::m_settlingTime
private

SettlingTime specifies the time for which a node waits before propagating an update.

It waits for this time interval in hope of receiving an update with a better metric.

Definition at line 145 of file dsdv-routing-protocol.h.

Referenced by GetTypeId(), and RecvDsdv().

◆ m_socketAddresses

std::map<Ptr<Socket>, Ipv4InterfaceAddress> ns3::dsdv::RoutingProtocol::m_socketAddresses
private

◆ m_triggeredExpireTimer

Timer ns3::dsdv::RoutingProtocol::m_triggeredExpireTimer
private

Timer used by the trigger updates in case of Weighted Settling Time is used.

Definition at line 257 of file dsdv-routing-protocol.h.

◆ m_uniformRandomVariable

Ptr<UniformRandomVariable> ns3::dsdv::RoutingProtocol::m_uniformRandomVariable
private

Provides uniform random variables.

Definition at line 260 of file dsdv-routing-protocol.h.

Referenced by RoutingProtocol(), AssignStreams(), RecvDsdv(), RouteOutput(), SendPacketFromQueue(), SendPeriodicUpdate(), and Start().

◆ m_weightedFactor

double ns3::dsdv::RoutingProtocol::m_weightedFactor
private

This is the weighted factor to determine the weighted settling time.

Definition at line 172 of file dsdv-routing-protocol.h.

Referenced by GetSettlingTime(), and GetTypeId().


The documentation for this class was generated from the following files: