ns-3
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:

List of all members.

Public Member Functions

 DsrRouting ()
 Constructor.
virtual ~DsrRouting ()
 Destructor.
Ptr< NodeGetNode () const
 Get the node.
void SetNode (Ptr< Node > node)
 Set the node.
void SetRouteCache (Ptr< dsr::RouteCache > r)
 Set the route cache.
Ptr< dsr::RouteCacheGetRouteCache () const
 Get the route cache.
void SetRequestTable (Ptr< dsr::RreqTable > r)
 Set the node.
Ptr< dsr::RreqTableGetRequestTable () const
 Get the request table.
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.
void PrintVector (std::vector< Ipv4Address > &vec)
 Print the route vector.
Ipv4Address SearchNextHop (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
 Get the next hop of the route.
int GetProtocolNumber (void) const
 Get the dsr protocol number.
void SendBuffTimerExpire ()
 The send buffer timer expire.
void CheckSendBuffer ()
 Check the send buffer of packets with route when send buffer timer expire.
void PacketNewRoute (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol)
 When route vector corrupted, originate a new packet, normally not happening.
Ptr< Ipv4RouteSetRoute (Ipv4Address nextHop, Ipv4Address srcAddress)
uint32_t GetPriority (DsrMessageType messageType)
void SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol)
void ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr, DsrOptionSRHeader &sourceRoute, Ipv4Address nextHop, uint8_t protocol, Ptr< Ipv4Route > route)
void Send (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
uint16_t AddAckReqHeader (Ptr< Packet > &packet, Ipv4Address nextHop)
void SendPacket (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol)
void Scheduler (uint32_t priority)
void PriorityScheduler (uint32_t priority, bool continueWithFirst)
void IncreaseRetransTimer ()
bool SendRealDown (DsrNetworkQueueEntry &newEntry)
void SendPacketFromBuffer (DsrOptionSRHeader const &sourceRoute, Ipv4Address nextHop, uint8_t protocol)
bool FindSamePackets (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft)
void CallCancelPacketTimer (uint16_t ackId, Ipv4Header const &ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
void CancelNetworkPacketTimer (MaintainBuffEntry &mb)
void CancelPassivePacketTimer (MaintainBuffEntry &mb)
void CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol)
void SalvagePacket (Ptr< const Packet > packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol)
void SchedulePassivePacketRetry (MaintainBuffEntry &mb, bool onlyPassive, uint8_t protocol)
void ScheduleNetworkPacketRetry (MaintainBuffEntry &mb, bool isFirst, uint8_t protocol)
void NetworkScheduleTimerExpire (MaintainBuffEntry &mb, uint8_t protocol)
void PassiveScheduleTimerExpire (MaintainBuffEntry &mb, bool onlyPassive, uint8_t protocol)
void ForwardPacket (Ptr< const Packet > packet, DsrOptionSRHeader &sourceRoute, Ipv4Header const &ipv4Header, Ipv4Address source, Ipv4Address destination, Ipv4Address targetAddress, uint8_t protocol, Ptr< Ipv4Route > route)
void SendInitialRequest (Ipv4Address source, Ipv4Address destination, uint8_t protocol)
void SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol)
void SendRequestAndIncrement (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination)
void SendRequest (Ptr< Packet > packet, Ipv4Address source)
void ScheduleInterRequest (Ptr< Packet > packet)
void SendGratuitousReply (Ipv4Address replyTo, Ipv4Address replyFrom, std::vector< Ipv4Address > &nodeList, uint8_t protocol)
void SendReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, Ptr< Ipv4Route > route)
void ScheduleInitialReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, Ptr< Ipv4Route > route)
void ScheduleCachedReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, Ptr< Ipv4Route > route, double hops)
void SendAck (uint16_t ackId, Ipv4Address destination, Ipv4Address realSrc, Ipv4Address realDst, uint8_t protocol, Ptr< Ipv4Route > route)
Ptr< NodeGetNodeWithAddress (Ipv4Address ipv4Address)
virtual enum IpL4Protocol::RxStatus Receive (Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)
virtual enum IpL4Protocol::RxStatus Receive (Ptr< Packet > p, Ipv6Address &src, Ipv6Address &dst, Ptr< Ipv6Interface > incomingInterface)
void SetDownTarget (IpL4Protocol::DownTargetCallback callback)
void SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback)
IpL4Protocol::DownTargetCallback GetDownTarget (void) const
IpL4Protocol::DownTargetCallback6 GetDownTarget6 (void) const
uint8_t GetExtensionNumber () const
 Get the extension number.
uint8_t Process (Ptr< Packet > &packet, Ipv4Header const &ipv4Header, Ipv4Address dst, uint8_t *nextHeader, uint8_t protocol, bool &isDropped)
 Process method Called from Ipv4L3Protocol::Receive.
void Insert (Ptr< dsr::DsrOptions > option)
 Insert a new Dsr Option.
Ptr< dsr::DsrOptionsGetOption (int optionNumber)
 Get the option corresponding to optionNumber.
void CancelRreqTimer (Ipv4Address dst, bool isRemove)
 Cancel the route request timer.
void ScheduleRreqRetry (Ptr< Packet > packet, std::vector< Ipv4Address > address, bool nonProp, uint32_t requestId, uint8_t protocol)
 Schedule the route request retry.
void RouteRequestTimerExpire (Ptr< Packet > packet, std::vector< Ipv4Address > address, uint32_t requestId, uint8_t protocol)
bool IsLinkCache ()
 used to direct to route cache
void UseExtends (RouteCacheEntry::IP_VECTOR rt)
bool LookupRoute (Ipv4Address id, RouteCacheEntry &rt)
bool AddRoute_Link (RouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source)
bool AddRoute (RouteCacheEntry &rt)
void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node)
bool UpdateRouteEntry (Ipv4Address dst)
- Public Member Functions inherited from ns3::IpL4Protocol
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])
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])
- Public Member Functions inherited from ns3::Object
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Dispose (void)
void AggregateObject (Ptr< Object > other)
AggregateIterator GetAggregateIterator (void) const
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount (const SimpleRefCount &o)
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
uint32_t GetReferenceCount (void) const
- Public Member Functions inherited from ns3::ObjectBase
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
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 ()
 Get the type identificator.

Static Public Attributes

static const uint8_t PROT_NUMBER = 48
 Define the dsr protocol number.

Protected Member Functions

virtual void NotifyNewAggregate ()
virtual void DoDispose (void)
 Drop trace callback.

Protected Attributes

TracedCallback< Ptr< const
Packet > > 
m_dropTrace
TracedCallback< const
DsrOptionSRHeader & > 
m_txPacketTrace

Additional Inherited Members

- Public Types inherited from ns3::IpL4Protocol
enum  RxStatus { RX_OK, RX_CSUM_FAILED, RX_ENDPOINT_CLOSED, RX_ENDPOINT_UNREACH }
typedef Callback< void, Ptr
< Packet >, Ipv4Address,
Ipv4Address, uint8_t, Ptr
< Ipv4Route > > 
DownTargetCallback
typedef Callback< void, Ptr
< Packet >, Ipv6Address,
Ipv6Address, uint8_t, Ptr
< Ipv6Route > > 
DownTargetCallback6

Detailed Description

Dsr Routing base.


Member Function Documentation

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

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

IpL4Protocol::DownTargetCallback ns3::dsr::DsrRouting::GetDownTarget ( void  ) const
virtual

This method allows a caller to get the current down target callback set for this L4 protocol, for

Returns:
current Callback for the L4 protocol

Implements ns3::IpL4Protocol.

uint8_t ns3::dsr::DsrRouting::GetExtensionNumber ( ) const

Get the extension number.

Returns:
extension number
uint16_t ns3::dsr::DsrRouting::GetIDfromIP ( Ipv4Address  address)

Get the node id from ip address.

Returns:
the node id

References ns3::Ipv4::GetAddress(), ns3::NodeList::GetNNodes(), GetNode(), and ns3::Object::GetObject().

Referenced by CheckSendBuffer(), PacketNewRoute(), and SendGratuitousReply().

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

Get the ip address from id.

Returns:
the ip address for the id

References ns3::Ipv4::GetAddress(), GetNode(), ns3::Object::GetObject(), and NS_LOG_DEBUG.

Referenced by Receive().

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

Get the Ip address from mac address.

Returns:
the ip address

References ns3::Ipv4::GetAddress(), ns3::Ipv4::GetNetDevice(), ns3::NodeList::GetNNodes(), GetNode(), ns3::Object::GetObject(), and NS_LOG_FUNCTION.

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

Get the node.

Returns:
the node

References NS_LOG_FUNCTION_NOARGS.

Referenced by GetIDfromIP(), GetIPfromID(), GetIPfromMAC(), and Receive().

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

Referenced by Receive().

int ns3::dsr::DsrRouting::GetProtocolNumber ( void  ) const
virtual

Get the dsr protocol number.

Returns:
protocol number

Implements ns3::IpL4Protocol.

References PROT_NUMBER.

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

Get the request table.

Returns:
the request table

Referenced by GetTypeId().

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

Get the route cache.

Returns:
the route cache

Referenced by GetTypeId().

TypeId ns3::dsr::DsrRouting::GetTypeId ( void  )
static

Get the type identificator.

This method returns the TypeId associated to ns3::dsr::DsrRouting.

Returns:
type identificator

Attributes defined for this type:

  • RouteCache: The route cache for saving routes from route discovery process.
  • RreqTable: The request table to manage route requests.
  • MaxSendBuffLen: Maximum number of packets that can be stored in send buffer.
  • MaxSendBuffTime: Maximum time packets can be queued in the send buffer .
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +30000000000.0ns
    • Flags: construct write read
  • MaxMaintLen: Maximum number of packets that can be stored in maintenance buffer.
  • MaxMaintTime: Maximum time packets can be queued in maintenance buffer.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +30000000000.0ns
    • Flags: construct write read
  • MaxCacheLen: Maximum number of route entries that can be stored in route cache.
  • RouteCacheTimeout: Maximum time the route cache can be queued in route cache.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +300000000000.0ns
    • Flags: construct write read
  • MaxEntriesEachDst: Maximum number of route entries for a single destination to respond.
  • SendBuffInterval: How often to check send buffer for packet with route.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +500000000000.0ns
    • Flags: construct write read
  • NodeTraversalTime: The time it takes to traverse two neighboring nodes.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +40000000.0ns
    • Flags: construct write read
  • RreqRetries: Maximum number of retransmissions for request discovery of a route.
  • MaintenanceRetries: Maximum number of retransmissions for data packets from maintenance buffer.
  • RequestTableSize: Maximum number of request entries in the request table.
  • RequestIdSize: Maximum number of request source Ids in the request table.
  • UniqueRequestIdSize: Maximum number of request Ids in the request table for a single destination.
  • NonPropRequestTimeout: The timeout value for non-propagation request.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +30000000.0ns
    • Flags: construct write read
  • DiscoveryHopLimit: The max discovery hop limit for route requests.
    • Set with class: ns3::DoubleValue
    • Underlying type: uint32_t 1:4.29497e+09
    • Initial value: 255
    • Flags: construct write read
  • MaxSalvageCount: The max salvage count for a single data packet.
  • BlacklistTimeout: The time for a neighbor to stay in blacklist.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +3000000000.0ns
    • Flags: construct write read
  • GratReplyHoldoff: The time for gratuitous reply entry to expire.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +1000000000.0ns
    • Flags: construct write read
  • BroadcastJitter: The jitter time to avoid collision for broadcast packets.
  • PassiveAckTimeout: The time a packet in maintenance buffer wait for passive acknowledgment.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +100000000.0ns
    • Flags: construct write read
  • TryPassiveAcks: The number of passive acknowledgment to use.
  • RequestPeriod: The base time interval between route requests.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +500000000.0ns
    • Flags: construct write read
  • MaxRequestPeriod: The max time interval between route requests.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +10000000000.0ns
    • Flags: construct write read
  • GraReplyTableSize: The gratuitous reply table size.
  • CacheType: Use Link Cache or use Path Cache
    • Set with class: StringValue
    • Underlying type: std::string
    • Initial value: LinkCache
    • Flags: construct write read
  • StabilityDecrFactor: The stability decrease factor for link cache
    • Set with class: ns3::UintegerValue
    • Underlying type: uint64_t 0:18446744073709551615
    • Initial value: 2
    • Flags: construct write read
  • StabilityIncrFactor: The stability increase factor for link cache
    • Set with class: ns3::UintegerValue
    • Underlying type: uint64_t 0:18446744073709551615
    • Initial value: 4
    • Flags: construct write read
  • InitStability: The initial stability factor for link cache
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +25000000000.0ns
    • Flags: construct write read
  • MinLifeTime: The minimal life time for link cache
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +1000000000.0ns
    • Flags: construct write read
  • UseExtends: The extension time for link cache
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +120000000000.0ns
    • Flags: construct write read
  • EnableSubRoute: Enables saving of sub route when receiving route error messages, only available when using path route cache
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • RetransIncr: The increase time for retransmission timer when facing network congestion
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +20000000.0ns
    • Flags: construct write read
  • MaxNetworkQueueSize: The max number of packet to save in the network queue.
  • MaxNetworkQueueDelay: The max time for a packet to stay in the network queue.
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +30000000000.0ns
    • Flags: construct write read
  • NumPriorityQueues: The max number of packet to save in the network queue.

Attributes defined in parent class ns3::IpL4Protocol:

  • ProtocolNumber: The Ip protocol number.

TraceSources defined for this type:

  • Tx: Send DSR packet.
  • Drop: Drop DSR packet

Reimplemented from ns3::IpL4Protocol.

References GetRequestTable(), GetRouteCache(), ns3::MakeTraceSourceAccessor(), ns3::MilliSeconds(), ns3::Seconds(), ns3::TypeId::SetParent(), SetRequestTable(), and SetRouteCache().

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

Insert a new Dsr Option.

Parameters:
optionthe option to insert

Referenced by DsrRouting().

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

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 overriden 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.

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

Reimplemented from ns3::Object.

References ns3::Object::GetObject(), ns3::Ipv4L3Protocol::Insert(), ns3::MakeCallback(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), ns3::Ipv4L3Protocol::Send(), SetDownTarget(), and SetNode().

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

Process method Called from Ipv4L3Protocol::Receive.

Parameters:
packetthe packet
offsetthe offset of the extension to process
dstdestination address of the packet received (i.e. us)
nextHeaderthe next header
isDroppedif the packet must be dropped
Returns:
the size processed
enum IpL4Protocol::RxStatus ns3::dsr::DsrRouting::Receive ( Ptr< Packet p,
Ipv6Address src,
Ipv6Address dst,
Ptr< Ipv6Interface incomingInterface 
)
virtual
Parameters:
ppacket to forward up
srcsource IPv6 address
dstdestination IPv6 address
incomingInterfacethe Ipv6Interface on which the packet arrived

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

Implements ns3::IpL4Protocol.

References NS_LOG_FUNCTION.

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:
dstThe dst address of the route request

References ns3::Timer::CANCEL_ON_DESTROY, ns3::Time::GetSeconds(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

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

Get the next hop of the route.

Returns:
the next hop address of the route

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by CheckSendBuffer(), and PacketNewRoute().

void ns3::dsr::DsrRouting::SetDownTarget ( IpL4Protocol::DownTargetCallback  cb)
virtual

This method allows a caller to set the current down target callback set for this L4 protocol

Parameters:
cbcurrent Callback for the L4 protocol

Implements ns3::IpL4Protocol.

Referenced by ns3::DsrHelper::Create(), and NotifyNewAggregate().

void ns3::dsr::DsrRouting::SetNode ( Ptr< Node node)

Set the node.

Parameters:
nodethe node to set

Referenced by NotifyNewAggregate().

void ns3::dsr::DsrRouting::SetRequestTable ( Ptr< dsr::RreqTable r)

Set the node.

Parameters:
therequest table to set

Referenced by GetTypeId().

void ns3::dsr::DsrRouting::SetRouteCache ( Ptr< dsr::RouteCache r)

Set the route cache.

Parameters:
theroute cache to set

Referenced by GetTypeId().


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