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

Dsr Routing base. More...

#include "dsr-routing.h"

+ Inheritance diagram for ns3::dsr::DsrRouting:
+ Collaboration diagram for ns3::dsr::DsrRouting:

Public Member Functions

 DsrRouting ()
 Constructor.
 
 ~DsrRouting () override
 Destructor.
 
uint16_t AddAckReqHeader (Ptr< Packet > &packet, Ipv4Address nextHop)
 This function is called to add ack request header for network acknowledgement.
 
bool AddRoute (DsrRouteCacheEntry &rt)
 Add route cache entry if it doesn't yet exist in route cache See also DsrRouteCache::AddRoute.
 
bool AddRoute_Link (DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source)
 dd route link to cache See also DsrRouteCache::AddRoute_Link
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model.
 
void CallCancelPacketTimer (uint16_t ackId, const Ipv4Header &ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
 Call the cancel packet retransmission timer function.
 
void CancelLinkPacketTimer (DsrMaintainBuffEntry &mb)
 Cancel the link packet retransmission timer for a specific maintenance entry.
 
void CancelNetworkPacketTimer (DsrMaintainBuffEntry &mb)
 Cancel the network packet retransmission timer for a specific maintenance entry.
 
void CancelPacketAllTimer (DsrMaintainBuffEntry &mb)
 Cancel all the packet timers.
 
void CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol)
 Cancel the packet retransmission timer for a all maintenance entries with nextHop address.
 
void CancelPassivePacketTimer (DsrMaintainBuffEntry &mb)
 Cancel the passive packet retransmission timer for a specific maintenance entry.
 
bool CancelPassiveTimer (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft)
 Cancel the passive timer.
 
void CancelRreqTimer (Ipv4Address dst, bool isRemove)
 Cancel the route request timer.
 
void CheckSendBuffer ()
 Check the send buffer of packets with route when send buffer timer expire.
 
void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node)
 Delete all the routes which includes the link from next hop address that has just been notified as unreachable.
 
bool FindSourceEntry (Ipv4Address src, Ipv4Address dst, uint16_t id)
 Find the source request entry in the route request queue, return false if not found.
 
void ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr, DsrOptionSRHeader &sourceRoute, Ipv4Address nextHop, uint8_t protocol, Ptr< Ipv4Route > route)
 This function is responsible for forwarding error packets along the route.
 
void ForwardPacket (Ptr< const Packet > packet, DsrOptionSRHeader &sourceRoute, const Ipv4Header &ipv4Header, Ipv4Address source, Ipv4Address destination, Ipv4Address targetAddress, uint8_t protocol, Ptr< Ipv4Route > route)
 Forward the packet using the route saved in the source route option header.
 
IpL4Protocol::DownTargetCallback GetDownTarget () const override
 This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 case)
 
IpL4Protocol::DownTargetCallback6 GetDownTarget6 () const override
 This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 case)
 
std::vector< std::string > GetElementsFromContext (std::string context)
 Get the elements from the tracing context.
 
uint16_t GetIDfromIP (Ipv4Address address)
 Get the node id from ip address.
 
Ipv4Address GetIPfromID (uint16_t id)
 Get the ip address from id.
 
Ipv4Address GetIPfromMAC (Mac48Address address)
 Get the Ip address from mac address.
 
Ptr< NetDeviceGetNetDeviceFromContext (std::string context)
 Get the netdevice from the context.
 
Ptr< NodeGetNode () const
 Get the node.
 
Ptr< NodeGetNodeWithAddress (Ipv4Address ipv4Address)
 Get the node with give ip address.
 
Ptr< dsr::DsrOptionsGetOption (int optionNumber)
 Get the option corresponding to optionNumber.
 
Ptr< dsr::DsrPassiveBufferGetPassiveBuffer () const
 Get the passive buffer.
 
uint32_t GetPriority (DsrMessageType messageType)
 Set the priority of the packet in network queue.
 
int GetProtocolNumber () const override
 Get the dsr protocol number.
 
Ptr< dsr::DsrRreqTableGetRequestTable () const
 Get the request table.
 
Ptr< dsr::DsrRouteCacheGetRouteCache () const
 Get the route cache.
 
void IncreaseRetransTimer ()
 This function is called to increase the retransmission timer for data packet in the network queue.
 
void Insert (Ptr< dsr::DsrOptions > option)
 Insert a new Dsr Option.
 
bool IsLinkCache ()
 Checks if the link is cached in the route cache See also DsrRouteCache::IsLinkCache.
 
void LinkScheduleTimerExpire (DsrMaintainBuffEntry &mb, uint8_t protocol)
 This function deals with packet retransmission timer expire using link acknowledgment.
 
bool LookupRoute (Ipv4Address id, DsrRouteCacheEntry &rt)
 Lookup route cache entry with destination address dst See also DsrRouteCache::LookupRoute.
 
void NetworkScheduleTimerExpire (DsrMaintainBuffEntry &mb, uint8_t protocol)
 This function deals with packet retransmission timer expire using network acknowledgment.
 
void PacketNewRoute (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol)
 When route vector corrupted, originate a new packet, normally not happening.
 
bool PassiveEntryCheck (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft, uint16_t fragmentOffset, uint16_t identification, bool saveEntry)
 Find the same passive entry.
 
void PassiveScheduleTimerExpire (DsrMaintainBuffEntry &mb, uint8_t protocol)
 This function deals with packet retransmission timer expire using passive acknowledgment.
 
void PrintVector (std::vector< Ipv4Address > &vec)
 Print the route vector.
 
void PriorityScheduler (uint32_t priority, bool continueWithFirst)
 This function is called to schedule sending packets from the network queue by priority.
 
uint8_t Process (Ptr< Packet > &packet, const Ipv4Header &ipv4Header, Ipv4Address dst, uint8_t *nextHeader, uint8_t protocol, bool &isDropped)
 Process method Called from Ipv4L3Protocol::Receive.
 
IpL4Protocol::RxStatus Receive (Ptr< Packet > p, const Ipv4Header &header, Ptr< Ipv4Interface > incomingInterface) override
 
IpL4Protocol::RxStatus Receive (Ptr< Packet > p, const Ipv6Header &header, Ptr< Ipv6Interface > incomingInterface) override
 
void RouteRequestTimerExpire (Ptr< Packet > packet, std::vector< Ipv4Address > address, uint32_t requestId, uint8_t protocol)
 Handle route discovery timer.
 
void SalvagePacket (Ptr< const Packet > packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol)
 Salvage the packet which has been transmitted for 3 times.
 
void ScheduleCachedReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, Ptr< Ipv4Route > route, double hops)
 Schedule the cached reply to a random start time to avoid possible route reply storm.
 
void ScheduleInitialReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, Ptr< Ipv4Route > route)
 this is a generating the initial route reply from the destination address, a random delay time [0, m_broadcastJitter] is used before unicasting back the route reply packet
 
void ScheduleInterRequest (Ptr< Packet > packet)
 Schedule the intermediate route request.
 
void ScheduleLinkPacketRetry (DsrMaintainBuffEntry &mb, uint8_t protocol)
 Schedule the packet retransmission based on link-layer acknowledgment.
 
void ScheduleNetworkPacketRetry (DsrMaintainBuffEntry &mb, bool isFirst, uint8_t protocol)
 Schedule the packet retransmission based on network layer acknowledgment.
 
void SchedulePassivePacketRetry (DsrMaintainBuffEntry &mb, uint8_t protocol)
 Schedule the packet retransmission based on passive acknowledgment.
 
void Scheduler (uint32_t priority)
 This function is called to schedule sending packets from the network queue.
 
void ScheduleRreqRetry (Ptr< Packet > packet, std::vector< Ipv4Address > address, bool nonProp, uint32_t requestId, uint8_t protocol)
 Schedule the route request retry.
 
Ipv4Address SearchNextHop (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
 Get the next hop of the route.
 
void Send (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
 This function is called by higher layer protocol when sending packets.
 
void SendAck (uint16_t ackId, Ipv4Address destination, Ipv4Address realSrc, Ipv4Address realDst, uint8_t protocol, Ptr< Ipv4Route > route)
 Send network layer acknowledgment back to the earlier hop to notify the receipt of data packet.
 
void SendBuffTimerExpire ()
 The send buffer timer expire.
 
void SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol)
 Send the error request packet.
 
void SendGratuitousReply (Ipv4Address replyTo, Ipv4Address replyFrom, std::vector< Ipv4Address > &nodeList, uint8_t protocol)
 Send the gratuitous reply.
 
void SendInitialRequest (Ipv4Address source, Ipv4Address destination, uint8_t protocol)
 Broadcast the route request packet in subnet.
 
void SendPacket (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol)
 This function is called by when really sending out the packet.
 
void SendPacketFromBuffer (const DsrOptionSRHeader &sourceRoute, Ipv4Address nextHop, uint8_t protocol)
 This function is responsible for sending out data packets when have route, if no route found, it will cache the packet and send out route requests.
 
bool SendRealDown (DsrNetworkQueueEntry &newEntry)
 This function is called to send packets down stack.
 
void SendReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, Ptr< Ipv4Route > route)
 Send the route reply back to the request originator with the cumulated route.
 
void SendRequest (Ptr< Packet > packet, Ipv4Address source)
 Forward the route request if the node is not the destination.
 
void SendUnreachError (Ipv4Address unreachNode, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol)
 This function is responsible for sending error packets in case of break link to next hop.
 
void SetDownTarget (IpL4Protocol::DownTargetCallback callback) override
 This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 case)
 
void SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback) override
 This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 case)
 
void SetNode (Ptr< Node > node)
 Set the node.
 
void SetPassiveBuffer (Ptr< dsr::DsrPassiveBuffer > r)
 Set the node.
 
void SetRequestTable (Ptr< dsr::DsrRreqTable > r)
 Set the node.
 
Ptr< Ipv4RouteSetRoute (Ipv4Address nextHop, Ipv4Address srcAddress)
 Set the route to use for data packets, used by the option headers when sending data/control packets.
 
void SetRouteCache (Ptr< dsr::DsrRouteCache > r)
 Set the route cache.
 
bool UpdateRouteEntry (Ipv4Address dst)
 Update route cache entry if it has been recently used and successfully delivered the data packet.
 
void UseExtends (DsrRouteCacheEntry::IP_VECTOR rt)
 Extends the lifetime of a route cache entry.
 
- Public Member Functions inherited from ns3::IpL4Protocol
 ~IpL4Protocol () override
 
virtual DownTargetCallback GetDownTarget () const =0
 This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 case)
 
virtual DownTargetCallback6 GetDownTarget6 () const =0
 This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 case)
 
virtual int GetProtocolNumber () const =0
 Returns the protocol number of this protocol.
 
virtual RxStatus Receive (Ptr< Packet > p, const Ipv4Header &header, Ptr< Ipv4Interface > incomingInterface)=0
 Called from lower-level layers to send the packet up in the stack.
 
virtual RxStatus Receive (Ptr< Packet > p, const Ipv6Header &header, Ptr< Ipv6Interface > incomingInterface)=0
 Called from lower-level layers to send the packet up in the stack.
 
virtual void ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv4Address payloadSource, Ipv4Address payloadDestination, const uint8_t payload[8])
 Called from lower-level layers to send the ICMP packet up in the stack.
 
virtual void ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv6Address payloadSource, Ipv6Address payloadDestination, const uint8_t payload[8])
 Called from lower-level layers to send the ICMPv6 packet up in the stack.
 
virtual void SetDownTarget (DownTargetCallback cb)=0
 This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 case)
 
virtual void SetDownTarget6 (DownTargetCallback6 cb)=0
 This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 case)
 
- 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.
 
- 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) 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.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
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 identificator.
 
- Static Public Member Functions inherited from ns3::IpL4Protocol
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 uint8_t PROT_NUMBER = 48
 Define the dsr protocol number.
 

Protected Member Functions

void DoDispose () override
 Drop trace callback.
 
void NotifyNewAggregate () override
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
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.
 

Protected Attributes

TracedCallback< Ptr< const Packet > > m_dropTrace
 The trace for drop, receive and send data packets.
 
TracedCallback< const DsrOptionSRHeader & > m_txPacketTrace
 packet trace callback
 

Private Types

typedef std::list< Ptr< DsrOptions > > DsrOptionList_t
 Define the list to hold DSR options.
 

Private Member Functions

bool PromiscReceive (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
 Promiscuous receive data packets destined to some other node.
 
void SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop, uint8_t protocol)
 Send the route error message when the link breaks to the next hop.
 
void Start ()
 

Private Attributes

uint16_t m_ackId
 The ack id assigned to each acknowledge.
 
std::vector< Ipv4Addressm_addresses
 The bind ipv4 addresses with next hop, src, destination address in sequence.
 
std::map< NetworkKey, uint32_tm_addressForwardCnt
 Map network key + forward counts.
 
std::map< NetworkKey, Timerm_addressForwardTimer
 Map network key + forward timer.
 
std::map< Ipv4Address, Timerm_addressReqTimer
 Map IP address + RREQ timer.
 
Time m_blacklistTimeout
 The black list time out.
 
Ipv4Address m_broadcast
 The broadcast IP address.
 
uint32_t m_broadcastJitter
 The max time to delay route request broadcast.
 
std::string m_cacheType
 The type of route cache.
 
std::vector< Ipv4Addressm_clearList
 The node that is clear to send packet to.
 
uint32_t m_discoveryHopLimit
 Maximum hops to go for route request.
 
IpL4Protocol::DownTargetCallback m_downTarget
 The callback for down layer.
 
DsrErrorBuffer m_errorBuffer
 The error buffer to save the error messages.
 
std::vector< Ipv4Addressm_finalRoute
 The route cache.
 
DsrGraReply m_graReply
 The gratuitous route reply.
 
uint32_t m_graReplyTableSize
 Set the gratuitous reply table size.
 
Time m_gratReplyHoldoff
 The max gratuitous reply hold off time.
 
Time m_initStability
 The initial stability value for link cache.
 
Ptr< Ipv4m_ip
 The ip ptr.
 
Ptr< Ipv4L3Protocolm_ipv4
 Ipv4l3Protocol.
 
Ptr< Ipv4Routem_ipv4Route
 Ipv4 Route.
 
bool m_linkAck
 define if we use link acknowledgement or not
 
Time m_linkAckTimeout
 The timeout value for link acknowledge.
 
std::map< LinkKey, Timerm_linkAckTimer
 The timer for link acknowledgment.
 
std::map< LinkKey, uint32_tm_linkCnt
 Map packet key + link forward counts.
 
uint32_t m_linkRetries
 
std::map< std::string, uint32_tm_macToNodeIdMap
 The map of mac address to node id.
 
Ipv4Address m_mainAddress
 Our own Ip address.
 
DsrMaintainBuffer m_maintainBuffer
 The declaration of maintain buffer.
 
uint32_t m_maxCacheLen
 Max # of cache entries for route cache.
 
Time m_maxCacheTime
 Max time for caching the route cache entry.
 
uint32_t m_maxEntriesEachDst
 Max number of route entries to save for each destination.
 
uint32_t m_maxMaintainLen
 Max # of entries for maintenance buffer.
 
Time m_maxMaintainTime
 Time out for maintenance buffer.
 
uint32_t m_maxMaintRexmt
 Maximum number of retransmissions of data packets.
 
Time m_maxNetworkDelay
 Maximum network delay.
 
uint32_t m_maxNetworkSize
 Maximum network queue size.
 
Time m_maxRequestPeriod
 The max request period.
 
uint32_t m_maxRreqId
 The max number of request ids for a single destination.
 
Time m_maxRreqTime
 Max time for caching the route request entry.
 
uint8_t m_maxSalvageCount
 Maximum # times to salvage a packet.
 
uint32_t m_maxSendBuffLen
 The maximum number of packets that we allow a routing protocol to buffer.
 
Time m_minLifeTime
 The min life time.
 
DsrNetworkQueue m_networkQueue
 The network queue.
 
Ptr< Nodem_node
 The node ptr.
 
Time m_nodeTraversalTime
 Time estimated for packet to travel between two nodes.
 
std::map< Ipv4Address, Timerm_nonPropReqTimer
 Map IP address + RREQ timer.
 
Time m_nonpropRequestTimeout
 The non-propagation request timeout.
 
uint32_t m_numPriorityQueues
 The number of priority queues used.
 
DsrOptionList_t m_options
 List of DSR Options supported.
 
Time m_passiveAckTimeout
 The timeout value for passive acknowledge.
 
std::map< PassiveKey, Timerm_passiveAckTimer
 The timer for passive acknowledgment.
 
Ptr< dsr::DsrPassiveBufferm_passiveBuffer
 A "drop-front" queue used by the routing layer to cache route request sent.
 
std::map< PassiveKey, uint32_tm_passiveCnt
 Map packet key + passive forward counts.
 
uint32_t m_passiveRetries
 
std::map< uint32_t, Ptr< dsr::DsrNetworkQueue > > m_priorityQueue
 priority queues
 
uint32_t m_requestId
 The id assigned to each route request.
 
Time m_requestPeriod
 The base time interval between route requests.
 
uint32_t m_requestTableIds
 The request table identifiers.
 
uint32_t m_requestTableSize
 The max size of the request table size.
 
Time m_retransIncr
 the increase time for retransmission timer when face network congestion
 
Ptr< dsr::DsrRouteCachem_routeCache
 A "drop-front" queue used by the routing layer to cache routes found.
 
std::string m_routeSortType
 The type of route sort methods.
 
uint32_t m_rreqRetries
 Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
 
Ptr< dsr::DsrRreqTablem_rreqTable
 A "drop-front" queue used by the routing layer to cache route request sent.
 
DsrSendBuffer m_sendBuffer
 The send buffer.
 
Time m_sendBufferTimeout
 The maximum period of time that a routing protocol is allowed to buffer a packet for.
 
Time m_sendBuffInterval
 how often to check send buffer
 
Timer m_sendBuffTimer
 The send buffer timer.
 
uint32_t m_sendRetries
 
uint32_t m_stabilityDecrFactor
 The initial decrease factor for link cache.
 
uint32_t m_stabilityIncrFactor
 The initial increase factor for link cache.
 
bool m_subRoute
 Whether to save sub route or not.
 
uint32_t m_tryLinkAcks
 Maximum number of packet transmission using link acknowledgment.
 
uint32_t m_tryPassiveAcks
 Maximum number of packet transmission using passive acknowledgment.
 
Ptr< UniformRandomVariablem_uniformRandomVariable
 Provides uniform random variables.
 
Time m_useExtends
 The use extension of the life time for link cache.
 
uint8_t segsLeft
 The segment left value from SR header.
 

Additional Inherited Members

- Public Types inherited from ns3::IpL4Protocol
typedef Callback< void, Ptr< Packet >, Ipv4Address, Ipv4Address, uint8_t, Ptr< Ipv4Route > > DownTargetCallback
 callback to send packets over IPv4
 
typedef Callback< void, Ptr< Packet >, Ipv6Address, Ipv6Address, uint8_t, Ptr< Ipv6Route > > DownTargetCallback6
 callback to send packets over IPv6
 
enum  RxStatus { RX_OK , RX_CSUM_FAILED , RX_ENDPOINT_CLOSED , RX_ENDPOINT_UNREACH }
 Rx status codes. More...
 

Detailed Description

Dsr Routing base.

Config Paths

ns3::dsr::DsrRouting is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/$ns3::dsr::DsrRouting"

Attributes

  • BlacklistTimeout: The time for a neighbor to stay in blacklist.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+09ns
    • Flags: constructwriteread
  • BroadcastJitter: The jitter time to avoid collision for broadcast packets.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10
    • Flags: constructwriteread
  • CacheType: Use Link Cache or use Path Cache
    • Set with class: ns3::StringValue
    • Underlying type: std::string
    • Initial value: LinkCache
    • Flags: constructwriteread
  • DiscoveryHopLimit: The max discovery hop limit for route requests.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 255
    • Flags: constructwriteread
  • EnableSubRoute: Enables saving of sub route when receiving route error messages, only available when using path route cache
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • GraReplyTableSize: The gratuitous reply table size.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 64
    • Flags: constructwriteread
  • GratReplyHoldoff: The time for gratuitous reply entry to expire.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+09ns
    • Flags: constructwriteread
  • InitStability: The initial stability factor for link cache
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +2.5e+10ns
    • Flags: constructwriteread
  • LinkAckTimeout: The time a packet in maintenance buffer wait for link acknowledgment.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+08ns
    • Flags: constructwriteread
  • LinkAcknowledgment: Enable Link layer acknowledgment mechanism
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • MaintenanceRetries: Maximum number of retransmissions for data packets from maintenance buffer.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 2
    • Flags: constructwriteread
  • MaxCacheLen: Maximum number of route entries that can be stored in route cache.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 64
    • Flags: constructwriteread
  • MaxEntriesEachDst: Maximum number of route entries for a single destination to respond.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 20
    • Flags: constructwriteread
  • MaxMaintLen: Maximum number of packets that can be stored in maintenance buffer.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 50
    • Flags: constructwriteread
  • MaxMaintTime: Maximum time packets can be queued in maintenance buffer.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+10ns
    • Flags: constructwriteread
  • MaxNetworkQueueDelay: The max time for a packet to stay in the network queue.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+10ns
    • Flags: constructwriteread
  • MaxNetworkQueueSize: The max number of packet to save in the network queue.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 400
    • Flags: constructwriteread
  • MaxRequestPeriod: The max time interval between route requests.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+10ns
    • Flags: constructwriteread
  • MaxSalvageCount: The max salvage count for a single data packet.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:255
    • Initial value: 15
    • Flags: constructwriteread
  • MaxSendBuffLen: Maximum number of packets that can be stored in send buffer.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 64
    • Flags: constructwriteread
  • MaxSendBuffTime: Maximum time packets can be queued in the send buffer .
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+10ns
    • Flags: constructwriteread
  • MinLifeTime: The minimal life time for link cache
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+09ns
    • Flags: constructwriteread
  • NodeTraversalTime: The time it takes to traverse two neighboring nodes.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +4e+07ns
    • Flags: constructwriteread
  • NonPropRequestTimeout: The timeout value for non-propagation request.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+07ns
    • Flags: constructwriteread
  • NumPriorityQueues: The max number of packet to save in the network queue.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 2
    • Flags: constructwriteread
  • PassiveAckTimeout: The time a packet in maintenance buffer wait for passive acknowledgment.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+08ns
    • Flags: constructwriteread
  • PassiveBuffer: The passive buffer to manage promisucously received passive ack.
  • RequestIdSize: Maximum number of request source Ids in the request table.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 16
    • Flags: constructwriteread
  • RequestPeriod: The base time interval between route requests.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+08ns
    • Flags: constructwriteread
  • RequestTableSize: Maximum number of request entries in the request table, set this as the number of nodes in the simulation.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 64
    • Flags: constructwriteread
  • RetransIncr: The increase time for retransmission timer when facing network congestion
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +2e+07ns
    • Flags: constructwriteread
  • RouteCache: The route cache for saving routes from route discovery process.
  • RouteCacheTimeout: Maximum time the route cache can be queued in route cache.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+11ns
    • Flags: constructwriteread
  • RreqRetries: Maximum number of retransmissions for request discovery of a route.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 16
    • Flags: constructwriteread
  • RreqTable: The request table to manage route requests.
  • SendBuffInterval: How often to check send buffer for packet with route.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+11ns
    • Flags: constructwriteread
  • StabilityDecrFactor: The stability decrease factor for link cache
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 2
    • Flags: constructwriteread
  • StabilityIncrFactor: The stability increase factor for link cache
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 4
    • Flags: constructwriteread
  • TryLinkAcks: The number of link acknowledgment to use.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: constructwriteread
  • TryPassiveAcks: The number of passive acknowledgment to use.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: constructwriteread
  • UniqueRequestIdSize: Maximum number of request Ids in the request table for a single destination.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 256
    • Flags: constructwriteread
  • UseExtends: The extension time for link cache
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1.2e+11ns
    • Flags: constructwriteread

Attributes defined in parent class ns3::IpL4Protocol

  • ProtocolNumber: The IP protocol number.

TraceSources

Size of this type is 1376 bytes (on a 64-bit architecture).

Definition at line 97 of file dsr-routing.h.

Member Typedef Documentation

◆ DsrOptionList_t

Define the list to hold DSR options.

Definition at line 784 of file dsr-routing.h.

Constructor & Destructor Documentation

◆ DsrRouting()

ns3::dsr::DsrRouting::DsrRouting ( )

Constructor.

Definition at line 364 of file dsr-routing.cc.

References Insert(), m_sendBuffTimer, m_uniformRandomVariable, NS_LOG_FUNCTION_NOARGS, ns3::Timer::Schedule(), ns3::Seconds(), SendBuffTimerExpire(), and ns3::Timer::SetFunction().

+ Here is the call graph for this function:

◆ ~DsrRouting()

ns3::dsr::DsrRouting::~DsrRouting ( )
override

Destructor.

Definition at line 400 of file dsr-routing.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

◆ AddAckReqHeader()

uint16_t ns3::dsr::DsrRouting::AddAckReqHeader ( Ptr< Packet > &  packet,
Ipv4Address  nextHop 
)

◆ AddRoute()

bool ns3::dsr::DsrRouting::AddRoute ( DsrRouteCacheEntry rt)

Add route cache entry if it doesn't yet exist in route cache See also DsrRouteCache::AddRoute.

Parameters
rtroute cache entry
Returns
true on success

Definition at line 690 of file dsr-routing.cc.

References ns3::dsr::DsrErrorBuffer::DropPacketForErrLink(), ns3::dsr::DsrRouteCacheEntry::GetVector(), m_errorBuffer, m_mainAddress, m_routeCache, and SearchNextHop().

+ Here is the call graph for this function:

◆ AddRoute_Link()

bool ns3::dsr::DsrRouting::AddRoute_Link ( DsrRouteCacheEntry::IP_VECTOR  nodelist,
Ipv4Address  source 
)

dd route link to cache See also DsrRouteCache::AddRoute_Link

Parameters
nodelistvector of nodes
sourceip address of node to add
Returns
true if the link is cached

Definition at line 682 of file dsr-routing.cc.

References ns3::dsr::DsrErrorBuffer::DropPacketForErrLink(), m_errorBuffer, m_routeCache, and SearchNextHop().

+ Here is the call graph for this function:

◆ AssignStreams()

int64_t ns3::dsr::DsrRouting::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 2813 of file dsr-routing.cc.

References m_uniformRandomVariable, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ CallCancelPacketTimer()

void ns3::dsr::DsrRouting::CallCancelPacketTimer ( uint16_t  ackId,
const Ipv4Header ipv4Header,
Ipv4Address  realSrc,
Ipv4Address  realDst 
)

Call the cancel packet retransmission timer function.

Parameters
ackIdacknowledge ID
ipv4Headerheader
realSrcsource IP address
realDstdestination IP address

Definition at line 2210 of file dsr-routing.cc.

References CancelNetworkPacketTimer(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4Header::GetSource(), ns3::Simulator::Now(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ CancelLinkPacketTimer()

void ns3::dsr::DsrRouting::CancelLinkPacketTimer ( DsrMaintainBuffEntry mb)

Cancel the link packet retransmission timer for a specific maintenance entry.

Parameters
mbmaintain buffer entry

TODO need to think about this part

Definition at line 2244 of file dsr-routing.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrMaintainBuffer::GetSize(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), ns3::dsr::DsrMaintainBuffer::LinkEqual(), ns3::dsr::LinkKey::m_destination, m_linkAckTimer, m_linkCnt, m_maintainBuffer, ns3::dsr::LinkKey::m_nextHop, ns3::dsr::LinkKey::m_ourAdd, ns3::dsr::LinkKey::m_source, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by CancelPacketAllTimer().

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

◆ CancelNetworkPacketTimer()

◆ CancelPacketAllTimer()

void ns3::dsr::DsrRouting::CancelPacketAllTimer ( DsrMaintainBuffEntry mb)

Cancel all the packet timers.

Parameters
mbmaintain buffer entry

Definition at line 2235 of file dsr-routing.cc.

References CancelLinkPacketTimer(), CancelNetworkPacketTimer(), CancelPassivePacketTimer(), and NS_LOG_FUNCTION.

Referenced by CancelPacketTimerNextHop().

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

◆ CancelPacketTimerNextHop()

void ns3::dsr::DsrRouting::CancelPacketTimerNextHop ( Ipv4Address  nextHop,
uint8_t  protocol 
)

◆ CancelPassivePacketTimer()

void ns3::dsr::DsrRouting::CancelPassivePacketTimer ( DsrMaintainBuffEntry mb)

Cancel the passive packet retransmission timer for a specific maintenance entry.

Parameters
mbmaintain buffer entry

Definition at line 2339 of file dsr-routing.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), ns3::dsr::PassiveKey::m_ackId, ns3::dsr::PassiveKey::m_destination, m_passiveAckTimer, m_passiveCnt, ns3::dsr::PassiveKey::m_segsLeft, ns3::dsr::PassiveKey::m_source, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by CancelPacketAllTimer(), CancelPassiveTimer(), PassiveEntryCheck(), and PassiveScheduleTimerExpire().

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

◆ CancelPassiveTimer()

bool ns3::dsr::DsrRouting::CancelPassiveTimer ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
uint8_t  segsLeft 
)

Cancel the passive timer.

Parameters
packetto process
sourceIP address
destinationIP address
segsLeftsegments left
Returns

Definition at line 2181 of file dsr-routing.cc.

References CancelPassivePacketTimer(), m_maintainBuffer, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::dsr::DsrMaintainBuffer::PromiscEqual(), segsLeft, ns3::dsr::DsrMaintainBuffEntry::SetAckId(), ns3::dsr::DsrMaintainBuffEntry::SetDst(), ns3::dsr::DsrMaintainBuffEntry::SetPacket(), ns3::dsr::DsrMaintainBuffEntry::SetSegsLeft(), and ns3::dsr::DsrMaintainBuffEntry::SetSrc().

+ Here is the call graph for this function:

◆ CancelRreqTimer()

void ns3::dsr::DsrRouting::CancelRreqTimer ( Ipv4Address  dst,
bool  isRemove 
)

Cancel the route request timer.

Parameters
dstThe dst address of the route request timer
isRemovewhether to remove the route request entry or not

Definition at line 3100 of file dsr-routing.cc.

References m_addressReqTimer, m_nonPropReqTimer, m_rreqTable, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by RouteRequestTimerExpire(), and SendErrorRequest().

+ Here is the caller graph for this function:

◆ CheckSendBuffer()

void ns3::dsr::DsrRouting::CheckSendBuffer ( )

Check the send buffer of packets with route when send buffer timer expire.

When found a route and use it, UseExtends to the link cache

This will be priority 0

Todo:
New DsrNetworkQueueEntry

When found a route and use it, UseExtends to the link cache

Definition at line 864 of file dsr-routing.cc.

References ns3::dsr::DsrOptionField::AddDsrOption(), data, ns3::dsr::DSR_CONTROL_PACKET, ns3::dsr::DsrMaintainBuffer::Enqueue(), ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrSendBuffer::GetBuffer(), ns3::dsr::DsrOptionField::GetDsrOptionsOffset(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrOptionRerrUnreachHeader::GetErrorDst(), ns3::dsr::DsrOptionRerrUnreachHeader::GetErrorSrc(), GetIDfromIP(), ns3::dsr::DsrOptionHeader::GetLength(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), GetPriority(), ns3::dsr::DsrOptionRerrUnreachHeader::GetSalvage(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrSendBuffer::GetSize(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), ns3::dsr::DsrOptionRerrUnreachHeader::GetUnreachNode(), ns3::dsr::DsrRouteCacheEntry::GetVector(), ns3::Timer::IsSuspended(), ns3::dsr::NetworkKey::m_ackId, ns3::dsr::PassiveKey::m_ackId, m_addressForwardCnt, ns3::dsr::LinkKey::m_destination, ns3::dsr::NetworkKey::m_destination, ns3::dsr::PassiveKey::m_destination, m_ip, m_ipv4Route, m_linkAck, m_linkCnt, m_mainAddress, m_maintainBuffer, m_maxMaintainTime, ns3::dsr::LinkKey::m_nextHop, ns3::dsr::NetworkKey::m_nextHop, ns3::dsr::LinkKey::m_ourAdd, ns3::dsr::NetworkKey::m_ourAdd, m_passiveCnt, m_priorityQueue, m_routeCache, ns3::dsr::PassiveKey::m_segsLeft, m_sendBuffer, m_sendBuffInterval, m_sendBuffTimer, ns3::dsr::LinkKey::m_source, ns3::dsr::NetworkKey::m_source, ns3::dsr::PassiveKey::m_source, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_INFO, NS_LOG_LOGIC, PacketNewRoute(), ns3::Timer::Resume(), ns3::Time::S, ns3::Simulator::Schedule(), ScheduleLinkPacketRetry(), ScheduleNetworkPacketRetry(), SchedulePassivePacketRetry(), SearchNextHop(), SendBuffTimerExpire(), ns3::dsr::DsrFsHeader::SetDestId(), ns3::dsr::DsrOptionRerrUnreachHeader::SetErrorDst(), ns3::dsr::DsrOptionRerrUnreachHeader::SetErrorSrc(), ns3::dsr::DsrOptionRerrHeader::SetErrorType(), ns3::dsr::DsrFsHeader::SetMessageType(), ns3::dsr::DsrFsHeader::SetNextHeader(), ns3::dsr::DsrOptionSRHeader::SetNodesAddress(), ns3::dsr::DsrFsHeader::SetPayloadLength(), SetRoute(), ns3::dsr::DsrOptionSRHeader::SetSalvage(), ns3::dsr::DsrOptionRerrUnreachHeader::SetSalvage(), ns3::dsr::DsrOptionSRHeader::SetSegmentsLeft(), ns3::dsr::DsrFsHeader::SetSourceId(), ns3::dsr::DsrOptionRerrUnreachHeader::SetUnreachNode(), and ns3::Timer::Suspend().

Referenced by SendBuffTimerExpire().

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

◆ DeleteAllRoutesIncludeLink()

void ns3::dsr::DsrRouting::DeleteAllRoutesIncludeLink ( Ipv4Address  errorSrc,
Ipv4Address  unreachNode,
Ipv4Address  node 
)

Delete all the routes which includes the link from next hop address that has just been notified as unreachable.

See also DsrRouteCache::DeleteAllRoutesIncludeLink

Parameters
errorSrcThe error source address
unreachNodeThe unreachable node
nodeThis node's ip address

Definition at line 699 of file dsr-routing.cc.

References m_routeCache.

◆ DoDispose()

void ns3::dsr::DsrRouting::DoDispose ( )
overrideprotectedvirtual

Drop trace callback.

Reimplemented from ns3::Object.

Definition at line 565 of file dsr-routing.cc.

References ns3::Object::DoDispose(), m_ipv4, m_node, m_routeCache, and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ FindSourceEntry()

bool ns3::dsr::DsrRouting::FindSourceEntry ( Ipv4Address  src,
Ipv4Address  dst,
uint16_t  id 
)

Find the source request entry in the route request queue, return false if not found.

See also DsrRreqTable::FindSourceEntry

Parameters
srcthe source address we just received the source request
dstthe destination address the request is targeted at
idthe identification number for this request
Returns
true if found, false otherwise

Definition at line 713 of file dsr-routing.cc.

References m_rreqTable.

◆ ForwardErrPacket()

void ns3::dsr::DsrRouting::ForwardErrPacket ( DsrOptionRerrUnreachHeader rerr,
DsrOptionSRHeader sourceRoute,
Ipv4Address  nextHop,
uint8_t  protocol,
Ptr< Ipv4Route route 
)

◆ ForwardPacket()

void ns3::dsr::DsrRouting::ForwardPacket ( Ptr< const Packet packet,
DsrOptionSRHeader sourceRoute,
const Ipv4Header ipv4Header,
Ipv4Address  source,
Ipv4Address  destination,
Ipv4Address  targetAddress,
uint8_t  protocol,
Ptr< Ipv4Route route 
)

Forward the packet using the route saved in the source route option header.

Parameters
packetThe packet
sourceRouteSource route saved in option header
ipv4HeaderIPv4 Header
sourcesource address
destinationdestination address
targetAddresstarget address
protocolprotocol number
routeroute

Definition at line 2857 of file dsr-routing.cc.

References ns3::dsr::DsrOptionField::AddDsrOption(), ns3::dsr::DsrMaintainBuffer::Enqueue(), ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), GetIDfromIP(), ns3::dsr::DsrOptionHeader::GetLength(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrOptionSRHeader::GetSegmentsLeft(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), ns3::Callback< R, UArgs >::IsNull(), ns3::dsr::NetworkKey::m_ackId, ns3::dsr::PassiveKey::m_ackId, m_ackId, m_addressForwardCnt, ns3::dsr::LinkKey::m_destination, ns3::dsr::NetworkKey::m_destination, ns3::dsr::PassiveKey::m_destination, m_downTarget, m_linkAck, m_linkCnt, m_mainAddress, m_maintainBuffer, m_maxMaintainTime, ns3::dsr::LinkKey::m_nextHop, ns3::dsr::NetworkKey::m_nextHop, ns3::dsr::LinkKey::m_ourAdd, ns3::dsr::NetworkKey::m_ourAdd, m_passiveCnt, ns3::dsr::PassiveKey::m_segsLeft, ns3::dsr::LinkKey::m_source, ns3::dsr::NetworkKey::m_source, ns3::dsr::PassiveKey::m_source, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ScheduleLinkPacketRetry(), ScheduleNetworkPacketRetry(), SchedulePassivePacketRetry(), ns3::dsr::DsrFsHeader::SetDestId(), ns3::dsr::DsrFsHeader::SetMessageType(), ns3::dsr::DsrFsHeader::SetNextHeader(), ns3::dsr::DsrFsHeader::SetPayloadLength(), and ns3::dsr::DsrFsHeader::SetSourceId().

+ Here is the call graph for this function:

◆ GetDownTarget()

IpL4Protocol::DownTargetCallback ns3::dsr::DsrRouting::GetDownTarget ( ) const
overridevirtual

This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 case)

Returns
current Callback for the L4 protocol

Implements ns3::IpL4Protocol.

Definition at line 3752 of file dsr-routing.cc.

References m_downTarget.

◆ GetDownTarget6()

IpL4Protocol::DownTargetCallback6 ns3::dsr::DsrRouting::GetDownTarget6 ( ) const
overridevirtual

This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 case)

Returns
current Callback for the L4 protocol

Implements ns3::IpL4Protocol.

Definition at line 3758 of file dsr-routing.cc.

References NS_FATAL_ERROR.

◆ GetElementsFromContext()

std::vector< std::string > ns3::dsr::DsrRouting::GetElementsFromContext ( std::string  context)

Get the elements from the tracing context.

Parameters
contextcontext
Returns
the elements we are looking for

Definition at line 549 of file dsr-routing.cc.

Referenced by GetNetDeviceFromContext().

+ Here is the caller graph for this function:

◆ GetIDfromIP()

uint16_t ns3::dsr::DsrRouting::GetIDfromIP ( Ipv4Address  address)

Get the node id from ip address.

Parameters
addressIPv4 address
Returns
the node id

Definition at line 810 of file dsr-routing.cc.

References ns3::NodeList::GetNNodes(), and ns3::NodeList::GetNode().

Referenced by CheckSendBuffer(), ForwardErrPacket(), ForwardPacket(), PacketNewRoute(), SalvagePacket(), Send(), SendAck(), SendErrorRequest(), SendGratuitousReply(), SendInitialRequest(), SendPacketFromBuffer(), and SendUnreachError().

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

◆ GetIPfromID()

Ipv4Address ns3::dsr::DsrRouting::GetIPfromID ( uint16_t  id)

Get the ip address from id.

Parameters
idunique ID
Returns
the ip address for the id

Definition at line 826 of file dsr-routing.cc.

References ns3::NodeList::GetNode(), and NS_LOG_DEBUG.

Referenced by PromiscReceive(), and Receive().

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

◆ GetIPfromMAC()

Ipv4Address ns3::dsr::DsrRouting::GetIPfromMAC ( Mac48Address  address)

Get the Ip address from mac address.

Parameters
addressMac48Address
Returns
the ip address

Definition at line 719 of file dsr-routing.cc.

References ns3::NodeList::GetNNodes(), ns3::NodeList::GetNode(), and NS_LOG_FUNCTION.

Referenced by PromiscReceive().

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

◆ GetNetDeviceFromContext()

Ptr< NetDevice > ns3::dsr::DsrRouting::GetNetDeviceFromContext ( std::string  context)

Get the netdevice from the context.

Parameters
contextcontext
Returns
the netdevice we are looking for

Definition at line 537 of file dsr-routing.cc.

References GetElementsFromContext(), ns3::NodeList::GetNode(), and NS_ASSERT.

+ Here is the call graph for this function:

◆ GetNode()

Ptr< Node > ns3::dsr::DsrRouting::GetNode ( ) const

Get the node.

Returns
the node

Definition at line 597 of file dsr-routing.cc.

References m_node, and NS_LOG_FUNCTION_NOARGS.

Referenced by Receive().

+ Here is the caller graph for this function:

◆ GetNodeWithAddress()

Ptr< Node > ns3::dsr::DsrRouting::GetNodeWithAddress ( Ipv4Address  ipv4Address)

Get the node with give ip address.

Parameters
ipv4AddressIPv4 address
Returns
the node associated with the ip address

Definition at line 646 of file dsr-routing.cc.

References ns3::NodeList::GetNNodes(), ns3::NodeList::GetNode(), and NS_LOG_FUNCTION.

Referenced by PromiscReceive().

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

◆ GetOption()

Ptr< dsr::DsrOptions > ns3::dsr::DsrRouting::GetOption ( int  optionNumber)

Get the option corresponding to optionNumber.

Parameters
optionNumberthe option number of the option to retrieve
Returns
a matching Dsr option

Definition at line 3771 of file dsr-routing.cc.

References m_options.

Referenced by PromiscReceive(), and Receive().

+ Here is the caller graph for this function:

◆ GetPassiveBuffer()

Ptr< dsr::DsrPassiveBuffer > ns3::dsr::DsrRouting::GetPassiveBuffer ( ) const

Get the passive buffer.

Returns
the passive buffer

Definition at line 639 of file dsr-routing.cc.

References m_passiveBuffer.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetPriority()

uint32_t ns3::dsr::DsrRouting::GetPriority ( DsrMessageType  messageType)

Set the priority of the packet in network queue.

Parameters
messageTypeMessage type
Returns
the priority value

Definition at line 840 of file dsr-routing.cc.

References ns3::dsr::DSR_CONTROL_PACKET.

Referenced by CheckSendBuffer(), ForwardErrPacket(), IncreaseRetransTimer(), SalvagePacket(), SendAck(), SendPacket(), SendPacketFromBuffer(), SendReply(), SendRequest(), and SendUnreachError().

+ Here is the caller graph for this function:

◆ GetProtocolNumber()

int ns3::dsr::DsrRouting::GetProtocolNumber ( ) const
overridevirtual

Get the dsr protocol number.

Returns
protocol number

Implements ns3::IpL4Protocol.

Definition at line 803 of file dsr-routing.cc.

References PROT_NUMBER.

Referenced by SendRealDown().

+ Here is the caller graph for this function:

◆ GetRequestTable()

Ptr< dsr::DsrRreqTable > ns3::dsr::DsrRouting::GetRequestTable ( ) const

Get the request table.

Returns
the request table

Definition at line 625 of file dsr-routing.cc.

References m_rreqTable.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetRouteCache()

Ptr< dsr::DsrRouteCache > ns3::dsr::DsrRouting::GetRouteCache ( ) const

Get the route cache.

Returns
the route cache

Definition at line 611 of file dsr-routing.cc.

References m_routeCache.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetTypeId()

◆ IncreaseRetransTimer()

void ns3::dsr::DsrRouting::IncreaseRetransTimer ( )

This function is called to increase the retransmission timer for data packet in the network queue.

Definition at line 1851 of file dsr-routing.cc.

References ns3::dsr::DSR_DATA_PACKET, GetPriority(), m_addressForwardTimer, m_priorityQueue, m_retransIncr, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by PriorityScheduler().

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

◆ Insert()

void ns3::dsr::DsrRouting::Insert ( Ptr< dsr::DsrOptions option)

Insert a new Dsr Option.

Parameters
optionthe option to insert

Definition at line 3765 of file dsr-routing.cc.

References m_options.

Referenced by DsrRouting().

+ Here is the caller graph for this function:

◆ IsLinkCache()

bool ns3::dsr::DsrRouting::IsLinkCache ( )

Checks if the link is cached in the route cache See also DsrRouteCache::IsLinkCache.

Returns
true if the link is cached

Definition at line 664 of file dsr-routing.cc.

References m_routeCache.

◆ LinkScheduleTimerExpire()

void ns3::dsr::DsrRouting::LinkScheduleTimerExpire ( DsrMaintainBuffEntry mb,
uint8_t  protocol 
)

◆ LookupRoute()

bool ns3::dsr::DsrRouting::LookupRoute ( Ipv4Address  id,
DsrRouteCacheEntry rt 
)

Lookup route cache entry with destination address dst See also DsrRouteCache::LookupRoute.

Parameters
iddestination address
rtentry with destination address id, if exists
Returns
true on success

Definition at line 676 of file dsr-routing.cc.

References m_routeCache.

◆ NetworkScheduleTimerExpire()

void ns3::dsr::DsrRouting::NetworkScheduleTimerExpire ( DsrMaintainBuffEntry mb,
uint8_t  protocol 
)

◆ NotifyNewAggregate()

void ns3::dsr::DsrRouting::NotifyNewAggregate ( )
overrideprotectedvirtual

Notify all Objects aggregated to this one of a new Object being aggregated.

This function must be implemented in the stack that needs to notify other stacks connected to the node of their presence in the node.

This method is invoked whenever two sets of Objects are aggregated together. It is invoked exactly once for each Object in both sets. This method can be overridden by subclasses who wish to be notified of aggregation events. These subclasses must chain up to their base class NotifyNewAggregate() method.

It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 406 of file dsr-routing.cc.

References m_ip, m_ipv4, m_node, ns3::MakeCallback(), ns3::Object::NotifyNewAggregate(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), ns3::Ipv4L3Protocol::Send(), SetDownTarget(), SetNode(), and Start().

+ Here is the call graph for this function:

◆ PacketNewRoute()

void ns3::dsr::DsrRouting::PacketNewRoute ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
uint8_t  protocol 
)

When route vector corrupted, originate a new packet, normally not happening.

Parameters
packetto route
sourceaddress
destinationaddress
protocolnumber

When found a route and use it, UseExtends to the link cache

Definition at line 1213 of file dsr-routing.cc.

References ns3::dsr::DsrOptionField::AddDsrOption(), ns3::dsr::DsrMaintainBuffer::Enqueue(), ns3::dsr::DsrSendBuffer::Enqueue(), ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), GetIDfromIP(), ns3::dsr::DsrOptionHeader::GetLength(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), ns3::dsr::DsrRouteCacheEntry::GetVector(), ns3::dsr::NetworkKey::m_ackId, ns3::dsr::PassiveKey::m_ackId, m_addressForwardCnt, m_addressReqTimer, ns3::dsr::LinkKey::m_destination, ns3::dsr::NetworkKey::m_destination, ns3::dsr::PassiveKey::m_destination, m_linkAck, m_linkCnt, m_mainAddress, m_maintainBuffer, m_maxMaintainTime, ns3::dsr::LinkKey::m_nextHop, ns3::dsr::NetworkKey::m_nextHop, m_nonPropReqTimer, ns3::dsr::LinkKey::m_ourAdd, ns3::dsr::NetworkKey::m_ourAdd, m_passiveCnt, m_routeCache, ns3::dsr::PassiveKey::m_segsLeft, m_sendBuffer, m_sendBufferTimeout, ns3::dsr::LinkKey::m_source, ns3::dsr::NetworkKey::m_source, ns3::dsr::PassiveKey::m_source, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PacketNewRoute(), ns3::Time::S, ScheduleLinkPacketRetry(), ScheduleNetworkPacketRetry(), SchedulePassivePacketRetry(), SearchNextHop(), SendInitialRequest(), ns3::dsr::DsrFsHeader::SetDestId(), ns3::dsr::DsrFsHeader::SetMessageType(), ns3::dsr::DsrFsHeader::SetNextHeader(), ns3::dsr::DsrOptionSRHeader::SetNodesAddress(), ns3::dsr::DsrFsHeader::SetPayloadLength(), SetRoute(), ns3::dsr::DsrOptionSRHeader::SetSalvage(), ns3::dsr::DsrOptionSRHeader::SetSegmentsLeft(), and ns3::dsr::DsrFsHeader::SetSourceId().

Referenced by CheckSendBuffer(), PacketNewRoute(), RouteRequestTimerExpire(), SalvagePacket(), Send(), SendErrorRequest(), and SendUnreachError().

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

◆ PassiveEntryCheck()

bool ns3::dsr::DsrRouting::PassiveEntryCheck ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
uint8_t  segsLeft,
uint16_t  fragmentOffset,
uint16_t  identification,
bool  saveEntry 
)

◆ PassiveScheduleTimerExpire()

void ns3::dsr::DsrRouting::PassiveScheduleTimerExpire ( DsrMaintainBuffEntry mb,
uint8_t  protocol 
)

◆ PrintVector()

void ns3::dsr::DsrRouting::PrintVector ( std::vector< Ipv4Address > &  vec)

Print the route vector.

Parameters
vecthe vector to print.

Definition at line 738 of file dsr-routing.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by CancelPacketTimerNextHop().

+ Here is the caller graph for this function:

◆ PriorityScheduler()

void ns3::dsr::DsrRouting::PriorityScheduler ( uint32_t  priority,
bool  continueWithFirst 
)

This function is called to schedule sending packets from the network queue by priority.

Parameters
priorityschedule
continueWithFirstuse all priorities

Definition at line 1770 of file dsr-routing.cc.

References ns3::UniformRandomVariable::GetInteger(), IncreaseRetransTimer(), m_numPriorityQueues, m_priorityQueue, m_uniformRandomVariable, ns3::MicroSeconds(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PriorityScheduler(), ns3::Simulator::Schedule(), ns3::Seconds(), and SendRealDown().

Referenced by PriorityScheduler(), and Scheduler().

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

◆ Process()

uint8_t ns3::dsr::DsrRouting::Process ( Ptr< Packet > &  packet,
const Ipv4Header ipv4Header,
Ipv4Address  dst,
uint8_t *  nextHeader,
uint8_t  protocol,
bool &  isDropped 
)

Process method Called from Ipv4L3Protocol::Receive.

Parameters
packetthe packet
ipv4HeaderIPv4 header of the packet
dstdestination address of the packet received (i.e. us)
nextHeaderthe next header
protocolthe protocol number
isDroppedif the packet must be dropped
Returns
the size processed

◆ PromiscReceive()

bool ns3::dsr::DsrRouting::PromiscReceive ( Ptr< NetDevice device,
Ptr< const Packet packet,
uint16_t  protocol,
const Address from,
const Address to,
NetDevice::PacketType  packetType 
)
private

Promiscuous receive data packets destined to some other node.

Parameters
deviceThe network device
packetData packet we just received
protocolThe protocol we receive, need to verify it is dsr protocol
fromThe from address we received the packet
toThe address this packet is destined for
packetTypeThe dsr packet type, 0 is for control packet, 1 for data packet
Returns
true if the packet was processed, false otherwise

This is the ip address we just received data packet from

Remember this is the entry for previous node

Get the previous node's maintenance buffer and passive ack

Definition at line 1100 of file dsr-routing.cc.

References ns3::Mac48Address::ConvertFrom(), data, ns3::dsr::DsrFsHeader::GetDestId(), ns3::Ipv4Header::GetDestination(), ns3::dsr::DsrOptionField::GetDsrOptionsOffset(), GetIPfromID(), GetIPfromMAC(), ns3::dsr::DsrFsHeader::GetMessageType(), ns3::dsr::DsrFsHeader::GetNextHeader(), GetNodeWithAddress(), GetOption(), ns3::Ipv4Header::GetProtocol(), ns3::Ipv4Header::GetSource(), ns3::dsr::DsrFsHeader::GetSourceId(), m_ipv4, m_mainAddress, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_INFO, ns3::NetDevice::PACKET_OTHERHOST, PROT_NUMBER, ns3::Ipv4L3Protocol::PROT_NUMBER, ns3::Time::S, ns3::dsr::DsrMaintainBuffEntry::SetDst(), ns3::dsr::DsrMaintainBuffEntry::SetNextHop(), ns3::dsr::DsrMaintainBuffEntry::SetOurAdd(), ns3::dsr::DsrMaintainBuffEntry::SetPacket(), and ns3::dsr::DsrMaintainBuffEntry::SetSrc().

Referenced by Start().

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

◆ Receive() [1/2]

◆ Receive() [2/2]

IpL4Protocol::RxStatus ns3::dsr::DsrRouting::Receive ( Ptr< Packet p,
const Ipv6Header header,
Ptr< Ipv6Interface incomingInterface 
)
overridevirtual
Parameters
ppacket to forward up
headerIPv6 Header information
incomingInterfacethe Ipv6Interface on which the packet arrived
Returns
receive status

Called from lower-level layers to send the packet up in the stack. Not implemented (IPv6).

Implements ns3::IpL4Protocol.

Definition at line 3733 of file dsr-routing.cc.

References ns3::Ipv6Header::GetDestination(), ns3::Ipv6Header::GetSource(), NS_LOG_FUNCTION, and ns3::IpL4Protocol::RX_ENDPOINT_UNREACH.

+ Here is the call graph for this function:

◆ RouteRequestTimerExpire()

void ns3::dsr::DsrRouting::RouteRequestTimerExpire ( Ptr< Packet packet,
std::vector< Ipv4Address address,
uint32_t  requestId,
uint8_t  protocol 
)

Handle route discovery timer.

Parameters
packetthe original packet
addressList of IPv4 addresses
requestIdUnique request ID
protocolthe protocol number

Set the salvage value to 0

Try to send out data packet from the send buffer if found

Definition at line 3224 of file dsr-routing.cc.

References CancelRreqTimer(), ns3::dsr::DsrSendBuffer::DropPacketWithDst(), ns3::dsr::DsrSendBuffer::Find(), ns3::dsr::DsrSendBuffer::GetSize(), ns3::dsr::DsrRouteCacheEntry::GetVector(), m_discoveryHopLimit, m_mainAddress, m_routeCache, m_rreqRetries, m_rreqTable, m_sendBuffer, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PacketNewRoute(), ScheduleRreqRetry(), SearchNextHop(), SendPacketFromBuffer(), SendRequest(), ns3::dsr::DsrOptionSRHeader::SetNodesAddress(), SetRoute(), ns3::dsr::DsrOptionSRHeader::SetSalvage(), ns3::dsr::DsrOptionSRHeader::SetSegmentsLeft(), and ns3::SocketIpTtlTag::SetTtl().

Referenced by ScheduleRreqRetry().

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

◆ SalvagePacket()

◆ ScheduleCachedReply()

void ns3::dsr::DsrRouting::ScheduleCachedReply ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
Ptr< Ipv4Route route,
double  hops 
)

Schedule the cached reply to a random start time to avoid possible route reply storm.

Parameters
packetthe original packet
sourceIPv4 address of the source (i.e. request originator)
destinationIPv4 address of the destination
routeRoute
hopsnumber of hops

Definition at line 3458 of file dsr-routing.cc.

References ns3::UniformRandomVariable::GetValue(), m_nodeTraversalTime, m_uniformRandomVariable, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SendReply().

+ Here is the call graph for this function:

◆ ScheduleInitialReply()

void ns3::dsr::DsrRouting::ScheduleInitialReply ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  nextHop,
Ptr< Ipv4Route route 
)

this is a generating the initial route reply from the destination address, a random delay time [0, m_broadcastJitter] is used before unicasting back the route reply packet

Parameters
packetthe original packet
sourceIPv4 address of the source (i.e. request originator)
nextHopIPv4 address of the next hop
routeRoute

Definition at line 3448 of file dsr-routing.cc.

References NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), and SendReply().

+ Here is the call graph for this function:

◆ ScheduleInterRequest()

void ns3::dsr::DsrRouting::ScheduleInterRequest ( Ptr< Packet packet)

Schedule the intermediate route request.

Parameters
packetthe original packet

Definition at line 3331 of file dsr-routing.cc.

References ns3::UniformRandomVariable::GetInteger(), m_broadcastJitter, m_mainAddress, m_uniformRandomVariable, ns3::MilliSeconds(), NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SendRequest().

+ Here is the call graph for this function:

◆ ScheduleLinkPacketRetry()

void ns3::dsr::DsrRouting::ScheduleLinkPacketRetry ( DsrMaintainBuffEntry mb,
uint8_t  protocol 
)

◆ ScheduleNetworkPacketRetry()

void ns3::dsr::DsrRouting::ScheduleNetworkPacketRetry ( DsrMaintainBuffEntry mb,
bool  isFirst,
uint8_t  protocol 
)

◆ SchedulePassivePacketRetry()

◆ Scheduler()

void ns3::dsr::DsrRouting::Scheduler ( uint32_t  priority)

This function is called to schedule sending packets from the network queue.

Parameters
priorityfor sending

Definition at line 1763 of file dsr-routing.cc.

References NS_LOG_FUNCTION, and PriorityScheduler().

+ Here is the call graph for this function:

◆ ScheduleRreqRetry()

void ns3::dsr::DsrRouting::ScheduleRreqRetry ( Ptr< Packet packet,
std::vector< Ipv4Address address,
bool  nonProp,
uint32_t  requestId,
uint8_t  protocol 
)

Schedule the route request retry.

Parameters
packetthe original packet
addressList of IPv4 addresses
nonPropflag if RREQ is non-propagating
requestIdUnique request ID
protocolthe protocol number

Definition at line 3147 of file dsr-routing.cc.

References ns3::Time::As(), ns3::Timer::CANCEL_ON_DESTROY, m_addressReqTimer, m_maxRequestPeriod, m_nonPropReqTimer, m_nonpropRequestTimeout, m_requestPeriod, m_rreqTable, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, RouteRequestTimerExpire(), and ns3::Time::S.

Referenced by RouteRequestTimerExpire(), SendErrorRequest(), and SendInitialRequest().

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

◆ SearchNextHop()

Ipv4Address ns3::dsr::DsrRouting::SearchNextHop ( Ipv4Address  ipv4Address,
std::vector< Ipv4Address > &  vec 
)

Get the next hop of the route.

Parameters
ipv4Address
vecRoute
Returns
the next hop address of the route

Definition at line 759 of file dsr-routing.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by AddRoute(), AddRoute_Link(), CheckSendBuffer(), PacketNewRoute(), RouteRequestTimerExpire(), SalvagePacket(), Send(), SendErrorRequest(), and SendUnreachError().

+ Here is the caller graph for this function:

◆ Send()

void ns3::dsr::DsrRouting::Send ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
uint8_t  protocol,
Ptr< Ipv4Route route 
)

This function is called by higher layer protocol when sending packets.

Parameters
packetto send
sourceIP address
destinationIP address
protocolnumber
routeIP route

When found a route and use it, UseExtends to the link cache

Definition at line 1525 of file dsr-routing.cc.

References ns3::dsr::DsrOptionField::AddDsrOption(), ns3::dsr::DsrMaintainBuffer::Enqueue(), ns3::dsr::DsrSendBuffer::Enqueue(), ns3::dsr::DsrSendBuffer::Find(), ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), GetIDfromIP(), ns3::UniformRandomVariable::GetInteger(), ns3::dsr::DsrOptionHeader::GetLength(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrSendBuffer::GetSize(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), ns3::dsr::DsrRouteCacheEntry::GetVector(), ns3::Callback< R, UArgs >::IsNull(), ns3::dsr::NetworkKey::m_ackId, ns3::dsr::PassiveKey::m_ackId, m_addressForwardCnt, m_addressReqTimer, ns3::dsr::LinkKey::m_destination, ns3::dsr::NetworkKey::m_destination, ns3::dsr::PassiveKey::m_destination, m_downTarget, m_linkAck, m_linkCnt, m_mainAddress, m_maintainBuffer, m_maxMaintainTime, ns3::dsr::LinkKey::m_nextHop, ns3::dsr::NetworkKey::m_nextHop, m_nonPropReqTimer, ns3::dsr::LinkKey::m_ourAdd, ns3::dsr::NetworkKey::m_ourAdd, m_passiveCnt, m_routeCache, m_rreqTable, ns3::dsr::PassiveKey::m_segsLeft, m_sendBuffer, m_sendBufferTimeout, ns3::dsr::LinkKey::m_source, ns3::dsr::NetworkKey::m_source, ns3::dsr::PassiveKey::m_source, m_uniformRandomVariable, ns3::MilliSeconds(), ns3::Simulator::Now(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PacketNewRoute(), ns3::Time::S, ns3::Simulator::Schedule(), ScheduleLinkPacketRetry(), ScheduleNetworkPacketRetry(), SchedulePassivePacketRetry(), SearchNextHop(), SendInitialRequest(), SendPacketFromBuffer(), ns3::dsr::DsrFsHeader::SetDestId(), ns3::dsr::DsrFsHeader::SetMessageType(), ns3::dsr::DsrFsHeader::SetNextHeader(), ns3::dsr::DsrOptionSRHeader::SetNodesAddress(), ns3::dsr::DsrFsHeader::SetPayloadLength(), ns3::dsr::DsrOptionSRHeader::SetSalvage(), ns3::dsr::DsrOptionSRHeader::SetSegmentsLeft(), and ns3::dsr::DsrFsHeader::SetSourceId().

Referenced by ns3::DsrHelper::Create().

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

◆ SendAck()

void ns3::dsr::DsrRouting::SendAck ( uint16_t  ackId,
Ipv4Address  destination,
Ipv4Address  realSrc,
Ipv4Address  realDst,
uint8_t  protocol,
Ptr< Ipv4Route route 
)

Send network layer acknowledgment back to the earlier hop to notify the receipt of data packet.

Parameters
ackIdACK ID
destinationIPv4 address of the immediate ACK receiver
realSrcIPv4 address of the real source
realDstIPv4 address of the real destination
protocolthe protocol number
routeRoute
Todo:
New DsrNetworkQueueEntry

Definition at line 3476 of file dsr-routing.cc.

References ns3::dsr::DsrOptionField::AddDsrOption(), ns3::dsr::DSR_CONTROL_PACKET, GetIDfromIP(), ns3::dsr::DsrOptionHeader::GetLength(), GetPriority(), ns3::Callback< R, UArgs >::IsNull(), m_downTarget, m_ip, m_mainAddress, m_priorityQueue, ns3::Simulator::Now(), NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::dsr::DsrOptionAckHeader::SetAckId(), ns3::dsr::DsrFsHeader::SetDestId(), ns3::dsr::DsrFsHeader::SetMessageType(), ns3::dsr::DsrFsHeader::SetNextHeader(), ns3::dsr::DsrFsHeader::SetPayloadLength(), ns3::dsr::DsrOptionAckHeader::SetRealDst(), ns3::dsr::DsrOptionAckHeader::SetRealSrc(), and ns3::dsr::DsrFsHeader::SetSourceId().

+ Here is the call graph for this function: