DSDV routing protocol. More...
#include <dsdv-routing-protocol.h>
Public Member Functions | |
RoutingProtocol () | |
c-tor | |
int64_t | AssignStreams (int64_t stream) |
virtual void | DoDispose () |
From Ipv4RoutingProtocol | |
Ptr< Ipv4Route > | RouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) |
Query routing cache for an existing route, for an outbound packet. More... | |
bool | RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) |
virtual void | PrintRoutingTable (Ptr< OutputStreamWrapper > stream) const |
Print the Routing Table entries. More... | |
virtual void | NotifyInterfaceUp (uint32_t interface) |
virtual void | NotifyInterfaceDown (uint32_t interface) |
virtual void | NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) |
virtual void | NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) |
virtual void | SetIpv4 (Ptr< Ipv4 > ipv4) |
Methods to handle protocol parameters | |
void | SetEnableBufferFlag (bool f) |
bool | GetEnableBufferFlag () const |
void | SetWSTFlag (bool f) |
bool | GetWSTFlag () const |
void | SetEnableRAFlag (bool f) |
bool | GetEnableRAFlag () const |
Public Member Functions inherited from ns3::Ipv4RoutingProtocol | |
virtual bool | RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)=0 |
Route an input packet (to be forwarded or locally delivered) More... | |
virtual void | SetRepository (Ptr< Repository > repo) |
Set cognitive radio repository. More... | |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Ipv4RoutingProtocol | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
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 untill we find a route. | |
void | Drop (Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno) |
Notify that packet is dropped for some reason. | |
Ptr< Socket > | FindSocketWithInterfaceAddress (Ipv4InterfaceAddress iface) const |
Find socket with local interface address iface. | |
Time | GetSettlingTime (Ipv4Address dst) |
void | LookForQueuedPackets (void) |
Look for any queued packets to send them out. | |
Ptr< Ipv4Route > | LoopbackRoute (const Ipv4Header &header, Ptr< NetDevice > oif) const |
Create loopback route for given header. | |
void | MergeTriggerPeriodicUpdates () |
void | Send (Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header &) |
void | SendPacketFromQueue (Ipv4Address dst, Ptr< Ipv4Route > route) |
void | SendPeriodicUpdate () |
Broadcasts the entire routing table for every PeriodicUpdateInterval. | |
void | SendTriggeredUpdate () |
Sends trigger update from a node. | |
void | Start () |
Start protocol operation. | |
Receive dsdv control packets | |
void | RecvDsdv (Ptr< Socket > socket) |
Receive and process dsdv control packet. | |
Private Attributes | |
Timer | m_periodicUpdateTimer |
Timer to trigger periodic updates from a node. | |
Timer | m_triggeredExpireTimer |
Timer used by the trigger updates in case of Weighted Settling Time is used. | |
Ptr< UniformRandomVariable > | m_uniformRandomVariable |
Provides uniform random variables. | |
Protocol parameters. | |
uint32_t | Holdtimes |
Time | m_periodicUpdateInterval |
Time | m_settlingTime |
Ipv4Address | m_mainAddress |
Nodes IP address. | |
Ptr< Ipv4 > | m_ipv4 |
IP protocol. | |
std::map< Ptr< Socket > , Ipv4InterfaceAddress > | m_socketAddresses |
Raw socket per each IP interface, map socket -> iface address (IP + mask) | |
Ptr< NetDevice > | m_lo |
Loopback device used to defer route requests until a route is found. | |
RoutingTable | m_routingTable |
Main Routing table for the node. | |
RoutingTable | m_advRoutingTable |
Advertised Routing table for the node. | |
uint32_t | m_maxQueueLen |
The maximum number of packets that we allow a routing protocol to buffer. | |
uint32_t | m_maxQueuedPacketsPerDst |
The maximum number of packets that we allow per destination to buffer. | |
Time | m_maxQueueTime |
The maximum period of time that a routing protocol is allowed to buffer a packet for. | |
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. | |
bool | EnableBuffering |
Flag that is used to enable or disable buffering. | |
bool | EnableWST |
Flag that is used to enable or disable Weighted Settling Time. | |
double | m_weightedFactor |
This is the wighted factor to determine the weighted settling time. | |
bool | EnableRouteAggregation |
Time | m_routeAggregationTime |
Parameter that holds the route aggregation time interval. | |
UnicastForwardCallback | m_scb |
Unicast callback for own packets. | |
ErrorCallback | m_ecb |
Error callback for own packets. | |
Additional Inherited Members | |
Public Types inherited from ns3::Ipv4RoutingProtocol | |
typedef Callback< void, Ptr < const Packet >, const Ipv4Header &, Socket::SocketErrno > | ErrorCallback |
typedef Callback< void, Ptr < const Packet >, const Ipv4Header &, uint32_t > | LocalDeliverCallback |
typedef Callback< void, Ptr < Ipv4MulticastRoute >, Ptr < const Packet >, const Ipv4Header & > | MulticastForwardCallback |
typedef Callback< void, Ptr < Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > | UnicastForwardCallback |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
DSDV routing protocol.
Doxygen introspection did not find any typical Config paths.
No TraceSources are defined for this type.
Definition at line 53 of file dsdv-routing-protocol.h.
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.
stream | first stream index to use |
Definition at line 191 of file dsdv-routing-protocol.cc.
References m_uniformRandomVariable, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
virtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden 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 212 of file dsdv-routing-protocol.cc.
References ns3::Object::DoDispose(), m_ipv4, and m_socketAddresses.
|
private |
Get settlingTime for a destination
dst | - destination address |
Definition at line 1156 of file dsdv-routing-protocol.cc.
References EnableWST, ns3::Time::GetSeconds(), ns3::dsdv::RoutingTable::LookupRoute(), m_routingTable, m_weightedFactor, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by RecvDsdv().
|
virtual |
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 995 of file dsdv-routing-protocol.cc.
References ns3::dsdv::RoutingTable::AddRoute(), ns3::Socket::Bind(), ns3::Socket::BindToNetDevice(), ns3::Socket::CreateSocket(), DSDV_PORT, FindSocketWithInterfaceAddress(), ns3::Ipv4Address::GetAny(), ns3::Simulator::GetMaximumSimulationTime(), m_ipv4, m_routingTable, m_socketAddresses, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, RecvDsdv(), ns3::Socket::SetAllowBroadcast(), and ns3::Socket::SetRecvCallback().
|
virtual |
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 976 of file dsdv-routing-protocol.cc.
References ns3::dsdv::RoutingTable::Clear(), ns3::Socket::Close(), ns3::dsdv::RoutingTable::DeleteAllRoutesFromInterface(), FindSocketWithInterfaceAddress(), m_advRoutingTable, m_ipv4, m_routingTable, m_socketAddresses, NS_ASSERT, and NS_LOG_LOGIC.
|
virtual |
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 944 of file dsdv-routing-protocol.cc.
References ns3::dsdv::RoutingTable::AddRoute(), ns3::Socket::Bind(), ns3::Socket::BindToNetDevice(), ns3::Socket::CreateSocket(), DSDV_PORT, ns3::Ipv4Address::GetAny(), ns3::Simulator::GetMaximumSimulationTime(), m_ipv4, m_mainAddress, m_routingTable, m_socketAddresses, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, RecvDsdv(), ns3::Socket::SetAllowBroadcast(), ns3::ObjectBase::SetAttribute(), and ns3::Socket::SetRecvCallback().
|
virtual |
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 1028 of file dsdv-routing-protocol.cc.
References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), DSDV_PORT, FindSocketWithInterfaceAddress(), ns3::Ipv4Address::GetAny(), m_ipv4, m_socketAddresses, ns3::MakeCallback(), NS_ASSERT, RecvDsdv(), ns3::Socket::SetAllowBroadcast(), and ns3::Socket::SetRecvCallback().
|
virtual |
Print the Routing Table entries.
stream | the ostream the Routing table is printed to |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 225 of file dsdv-routing-protocol.cc.
References ns3::Time::GetSeconds(), ns3::OutputStreamWrapper::GetStream(), m_ipv4, m_routingTable, ns3::Simulator::Now(), and ns3::dsdv::RoutingTable::Print().
|
virtual |
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 246 of file dsdv-routing-protocol.cc.
References ns3::Packet::AddPacketTag(), ns3::dsdv::RoutingTable::AddRoute(), EnableBuffering, ns3::Ipv4Route::GetDestination(), ns3::Ipv4Header::GetDestination(), ns3::UniformRandomVariable::GetInteger(), ns3::Ipv4Route::GetOutputDevice(), ns3::Packet::GetSize(), ns3::Ipv4Route::GetSource(), ns3::Packet::GetUid(), 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::Packet::PeekPacketTag(), ns3::dsdv::RoutingTable::Purge(), ns3::Simulator::Schedule(), and SendTriggeredUpdate().
|
private |
Send packet from queue
dst | - destination address to which we are sending the packet to |
route | - route identified for this packet |
Definition at line 1125 of file dsdv-routing-protocol.cc.
References ns3::dsdv::PacketQueue::Dequeue(), ns3::dsdv::PacketQueue::Find(), ns3::UniformRandomVariable::GetInteger(), ns3::Ipv4Route::GetOutputDevice(), ns3::dsdv::PacketQueue::GetSize(), ns3::Ipv4Route::GetSource(), ns3::Ipv4Header::GetTtl(), m_ipv4, m_mainAddress, m_queue, m_uniformRandomVariable, ns3::MilliSeconds(), NS_LOG_DEBUG, ns3::dsdv::DeferredRouteOutputTag::oif, ns3::Packet::RemovePacketTag(), ns3::Simulator::Schedule(), ns3::Ipv4Header::SetSource(), and ns3::Ipv4Header::SetTtl().
Referenced by LookForQueuedPackets().
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 919 of file dsdv-routing-protocol.cc.
References ns3::dsdv::RoutingTable::AddRoute(), ns3::Ipv4Address::GetLoopback(), ns3::Simulator::GetMaximumSimulationTime(), ns3::aodv::INVALID, m_ipv4, m_lo, m_routingTable, NS_ASSERT, ns3::Simulator::ScheduleNow(), and Start().
|
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 140 of file dsdv-routing-protocol.h.
Referenced by RecvDsdv().
|
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 105 of file dsdv-routing-protocol.h.
Referenced by Start().
|
private |
PeriodicUpdateInterval specifies the periodic time interval between which the a node broadcasts its entire routing table.
Definition at line 108 of file dsdv-routing-protocol.h.
Referenced by SendPeriodicUpdate(), and Start().
|
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 111 of file dsdv-routing-protocol.h.
Referenced by RecvDsdv().