A Discrete-Event Network Simulator
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Yufei Cheng
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Yufei Cheng <yfcheng@ittc.ku.edu>
19  *
20  * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21  * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
22  * Information and Telecommunication Technology Center (ITTC)
23  * and Department of Electrical Engineering and Computer Science
24  * The University of Kansas Lawrence, KS USA.
25  *
26  * Work supported in part by NSF FIND (Future Internet Design) Program
27  * under grant CNS-0626918 (Postmodern Internet Architecture),
28  * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
29  * US Department of Defense (DoD), and ITTC at The University of Kansas.
30  */
32 #ifndef DSR_ROUTING_H
33 #define DSR_ROUTING_H
35 #include <map>
36 #include <list>
37 #include <vector>
38 #include <stdint.h>
39 #include <cassert>
40 #include <sys/types.h>
42 #include "ns3/callback.h"
43 #include "ns3/object.h"
44 #include "ns3/node.h"
45 #include "ns3/ptr.h"
46 #include "ns3/buffer.h"
47 #include "ns3/packet.h"
48 #include "ns3/ipv4.h"
49 #include "ns3/ip-l4-protocol.h"
50 #include "ns3/ipv4-l3-protocol.h"
51 #include "ns3/icmpv4-l4-protocol.h"
52 #include "ns3/ipv4-interface.h"
53 #include "ns3/ipv4-header.h"
54 #include "ns3/ipv4-address.h"
55 #include "ns3/traced-callback.h"
56 #include "ns3/random-variable-stream.h"
57 #include "ns3/ipv4-route.h"
58 #include "ns3/timer.h"
59 #include "ns3/net-device.h"
60 #include "ns3/output-stream-wrapper.h"
61 #include "ns3/wifi-mac.h"
62 #include "ns3/socket.h"
63 #include "ns3/event-garbage-collector.h"
64 #include "ns3/test.h"
66 #include "dsr-network-queue.h"
67 #include "dsr-rcache.h"
68 #include "dsr-rreq-table.h"
69 #include "dsr-maintain-buff.h"
70 #include "dsr-passive-buff.h"
71 #include "dsr-option-header.h"
72 #include "dsr-fs-header.h"
73 #include "dsr-rsendbuff.h"
74 #include "dsr-errorbuff.h"
77 namespace ns3 {
79 class Packet;
80 class Node;
81 class Ipv4;
82 class Ipv4Address;
83 class Ipv4Header;
84 class Ipv4Interface;
85 class Ipv4L3Protocol;
86 class Time;
88 namespace dsr {
90 class DsrOptions;
95 class DsrRouting : public IpL4Protocol
96 {
97 public:
102  static TypeId GetTypeId ();
106  static const uint8_t PROT_NUMBER;
110  DsrRouting ();
114  virtual ~DsrRouting ();
119  Ptr<Node> GetNode () const;
124  void SetNode (Ptr<Node> node);
162  bool IsLinkCache ();
199  bool AddRoute (DsrRouteCacheEntry & rt);
210  void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node);
219  bool UpdateRouteEntry (Ipv4Address dst);
230  bool FindSourceEntry (Ipv4Address src, Ipv4Address dst, uint16_t id);
237  Ptr<NetDevice> GetNetDeviceFromContext (std::string context);
243  std::vector<std::string> GetElementsFromContext (std::string context);
249  uint16_t GetIDfromIP (Ipv4Address address);
255  Ipv4Address GetIPfromID (uint16_t id);
272  void PrintVector (std::vector<Ipv4Address>& vec);
279  Ipv4Address SearchNextHop (Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
284  int GetProtocolNumber (void) const;
288  void SendBuffTimerExpire ();
292  void CheckSendBuffer ();
300  void PacketNewRoute (Ptr<Packet> packet,
301  Ipv4Address source,
302  Ipv4Address destination,
303  uint8_t protocol);
311  Ptr<Ipv4Route> SetRoute (Ipv4Address nextHop, Ipv4Address srcAddress);
317  uint32_t GetPriority (DsrMessageType messageType);
326  void SendUnreachError (Ipv4Address unreachNode, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol);
335  DsrOptionSRHeader &sourceRoute,
336  Ipv4Address nextHop,
337  uint8_t protocol,
338  Ptr<Ipv4Route> route);
347  void Send (Ptr<Packet> packet, Ipv4Address source,
348  Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route);
355  uint16_t AddAckReqHeader (Ptr<Packet> &packet, Ipv4Address nextHop);
363  void SendPacket (Ptr<Packet> packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol);
368  void Scheduler (uint32_t priority);
374  void PriorityScheduler (uint32_t priority, bool continueWithFirst);
378  void IncreaseRetransTimer ();
384  bool SendRealDown (DsrNetworkQueueEntry & newEntry);
392  void SendPacketFromBuffer (DsrOptionSRHeader const &sourceRoute,
393  Ipv4Address nextHop,
394  uint8_t protocol);
406  bool PassiveEntryCheck (Ptr<Packet> packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft,
407  uint16_t fragmentOffset, uint16_t identification, bool saveEntry);
422  bool CancelPassiveTimer (Ptr<Packet> packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft);
430  void CallCancelPacketTimer (uint16_t ackId, Ipv4Header const& ipv4Header, Ipv4Address realSrc, Ipv4Address realDst);
451  void CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol);
459  void SalvagePacket (Ptr<const Packet> packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol);
466  uint8_t protocol);
473  uint8_t protocol);
481  bool isFirst,
482  uint8_t protocol);
489  uint8_t protocol);
496  uint8_t protocol);
503  uint8_t protocol);
515  void ForwardPacket (Ptr<const Packet> packet,
516  DsrOptionSRHeader &sourceRoute,
517  Ipv4Header const& ipv4Header,
518  Ipv4Address source,
519  Ipv4Address destination,
520  Ipv4Address targetAddress,
521  uint8_t protocol,
522  Ptr<Ipv4Route> route);
529  void SendInitialRequest (Ipv4Address source,
530  Ipv4Address destination,
531  uint8_t protocol);
537  void SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol);
543  void SendRequest (Ptr<Packet> packet,
544  Ipv4Address source);
549  void ScheduleInterRequest (Ptr<Packet> packet);
557  void SendGratuitousReply (Ipv4Address replyTo,
558  Ipv4Address replyFrom,
559  std::vector<Ipv4Address> &nodeList,
560  uint8_t protocol);
569  void SendReply (Ptr<Packet> packet,
570  Ipv4Address source,
571  Ipv4Address nextHop,
572  Ptr<Ipv4Route> route);
582  void ScheduleInitialReply (Ptr<Packet> packet,
583  Ipv4Address source,
584  Ipv4Address nextHop,
585  Ptr<Ipv4Route> route);
595  void ScheduleCachedReply (Ptr<Packet> packet,
596  Ipv4Address source,
597  Ipv4Address destination,
598  Ptr<Ipv4Route> route,
599  double hops);
610  void SendAck (uint16_t ackId,
611  Ipv4Address destination,
612  Ipv4Address realSrc,
613  Ipv4Address realDst,
614  uint8_t protocol,
615  Ptr<Ipv4Route> route);
626  Ipv4Header const &header,
627  Ptr<Ipv4Interface> incomingInterface);
639  Ipv6Header const &header,
640  Ptr<Ipv6Interface> incomingInterface);
658  uint8_t Process (Ptr<Packet>& packet, Ipv4Header const& ipv4Header, Ipv4Address dst, uint8_t *nextHeader, uint8_t protocol, bool& isDropped);
663  void Insert (Ptr<dsr::DsrOptions> option);
669  Ptr<dsr::DsrOptions> GetOption (int optionNumber);
675  void CancelRreqTimer (Ipv4Address dst, bool isRemove);
684  void ScheduleRreqRetry (Ptr<Packet> packet, std::vector<Ipv4Address> address, bool nonProp, uint32_t requestId, uint8_t protocol);
693  void RouteRequestTimerExpire (Ptr<Packet> packet, std::vector<Ipv4Address> address, uint32_t requestId, uint8_t protocol);
703  int64_t AssignStreams (int64_t stream);
705 protected:
706  /*
707  * * This function will notify other components connected to the node that a new stack member is now connected
708  * * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
709  * */
710  virtual void NotifyNewAggregate ();
714  virtual void DoDispose (void);
721 private:
722  void Start ();
728  void SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop, uint8_t protocol);
739  bool PromiscReceive (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &from,
740  const Address &to, NetDevice::PacketType packetType);
744  typedef std::list<Ptr<DsrOptions> > DsrOptionList_t;
760  uint8_t segsLeft;
764  uint32_t m_maxNetworkSize;
776  uint32_t m_sendRetries;
778  uint32_t m_passiveRetries;
780  uint32_t m_linkRetries;
782  uint32_t m_rreqRetries;
784  uint32_t m_maxMaintRexmt;
788  uint32_t m_maxSendBuffLen;
796  uint32_t m_maxMaintainLen;
800  uint32_t m_maxCacheLen;
810  uint32_t m_requestId;
812  uint16_t m_ackId;
816  uint32_t m_requestTableIds;
818  uint32_t m_maxRreqId;
824  uint32_t m_broadcastJitter;
828  uint32_t m_tryPassiveAcks;
832  uint32_t m_tryLinkAcks;
844  std::string m_cacheType;
846  std::string m_routeSortType;
858  bool m_subRoute;
862  std::vector<Ipv4Address> m_finalRoute;
864  std::map<Ipv4Address, Timer> m_addressReqTimer;
866  std::map<Ipv4Address, Timer> m_nonPropReqTimer;
868  std::map<NetworkKey, Timer> m_addressForwardTimer;
870  std::map<NetworkKey, uint32_t> m_addressForwardCnt;
872  std::map<PassiveKey, uint32_t> m_passiveCnt;
874  std::map<PassiveKey, Timer> m_passiveAckTimer;
876  std::map<LinkKey, uint32_t> m_linkCnt;
878  std::map<LinkKey, Timer> m_linkAckTimer;
888  bool m_linkAck;
890  std::map<uint32_t, Ptr<dsr::DsrNetworkQueue> > m_priorityQueue;
896  std::vector<Ipv4Address> m_clearList;
898  std::vector<Ipv4Address> m_addresses;
900  std::map <std::string, uint32_t> m_macToNodeIdMap;
903 };
904 } /* namespace dsr */
905 } /* namespace ns3 */
907 #endif /* DSR_ROUTING_H */
void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop, uint8_t protocol)
Send the route error message when the link breaks to the next hop.
uint32_t m_stabilityDecrFactor
The initial decrease factor for link cache.
Definition: dsr-routing.h:848
void SetDownTarget(IpL4Protocol::DownTargetCallback callback)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
DSR send buffer.
void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt)
Extends the lifetime of a route cache entry.
Definition: dsr-routing.cc:651
void SetRequestTable(Ptr< dsr::DsrRreqTable > r)
Set the node.
Definition: dsr-routing.cc:602
std::string m_cacheType
The type of route cache.
Definition: dsr-routing.h:844
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
maintain the gratuitous reply
DsrRouteCacheEntry class for entries in the route cache.
Definition: dsr-rcache.h:220
Packet header for IPv6.
Definition: ipv6-header.h:34
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.
virtual void DoDispose(void)
Drop trace callback.
Definition: dsr-routing.cc:549
uint32_t m_maxSendBuffLen
The maximum number of packets that we allow a routing protocol to buffer.
Definition: dsr-routing.h:788
void ScheduleInterRequest(Ptr< Packet > packet)
Schedule the intermediate route request.
uint32_t m_stabilityIncrFactor
The initial increase factor for link cache.
Definition: dsr-routing.h:850
A simple virtual Timer class.
Definition: timer.h:73
bool LookupRoute(Ipv4Address id, DsrRouteCacheEntry &rt)
Lookup route cache entry with destination address dst See also DsrRouteCache::LookupRoute.
Definition: dsr-routing.cc:656
void SendInitialRequest(Ipv4Address source, Ipv4Address destination, uint8_t protocol)
Broadcast the route request packet in subnet.
void SendBuffTimerExpire()
The send buffer timer expire.
Definition: dsr-routing.cc:825
void Scheduler(uint32_t priority)
This function is called to schedule sending packets from the network queue.
DSR Maintain Buffer Entry.
void SalvagePacket(Ptr< const Packet > packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol)
Salvage the packet which has been transmitted for 3 times.
Time m_sendBuffInterval
how often to check send buffer
Definition: dsr-routing.h:836
Time m_passiveAckTimeout
The timeout value for passive acknowledge.
Definition: dsr-routing.h:826
std::map< std::string, uint32_t > m_macToNodeIdMap
The map of mac address to node id.
Definition: dsr-routing.h:900
uint32_t m_discoveryHopLimit
Maximum hops to go for route request.
Definition: dsr-routing.h:768
uint32_t GetPriority(DsrMessageType messageType)
Set the priority of the packet in network queue.
Definition: dsr-routing.cc:813
Ptr< Ipv4 > m_ip
The ip ptr.
Definition: dsr-routing.h:754
Forward calls to a chain of Callback.
TracedCallback< const DsrOptionSRHeader & > m_txPacketTrace
packet trace callback
Definition: dsr-routing.h:719
Ptr< dsr::DsrRouteCache > GetRouteCache() const
Get the route cache.
Definition: dsr-routing.cc:596
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 un...
Definition: dsr-routing.cc:676
Time m_maxRequestPeriod
The max request period.
Definition: dsr-routing.h:840
void PrintVector(std::vector< Ipv4Address > &vec)
Print the route vector.
Definition: dsr-routing.cc:710
uint32_t m_maxEntriesEachDst
Max number of route entries to save for each destination.
Definition: dsr-routing.h:806
void IncreaseRetransTimer()
This function is called to increase the retransmission timer for data packet in the network queue...
Ipv4Address m_mainAddress
Our own Ip address.
Definition: dsr-routing.h:758
Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Get the next hop of the route.
Definition: dsr-routing.cc:730
void CancelPacketAllTimer(DsrMaintainBuffEntry &mb)
Cancel all the packet timers.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:813
bool IsLinkCache()
Checks if the link is cached in the route cache See also DsrRouteCache::IsLinkCache.
Definition: dsr-routing.cc:646
Time m_linkAckTimeout
The timeout value for link acknowledge.
Definition: dsr-routing.h:830
Introspection did not find any typical Config paths.
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.
DSR error buffer.
uint32_t m_requestTableSize
The max size of the request table size.
Definition: dsr-routing.h:814
Source Route (SR) Message Format.
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.
uint32_t m_tryLinkAcks
Maximum number of packet transmission using link acknowledgment.
Definition: dsr-routing.h:832
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
Time m_maxCacheTime
Max time for caching the route cache entry.
Definition: dsr-routing.h:802
Time m_gratReplyHoldoff
The max gratuitous reply hold off time.
Definition: dsr-routing.h:838
a polymophic address class
Definition: address.h:90
uint32_t m_maxMaintainLen
Max # of entries for maintenance buffer.
Definition: dsr-routing.h:796
void SendRequest(Ptr< Packet > packet, Ipv4Address source)
Forward the route request if the node is not the destination.
Ipv4Address GetIPfromID(uint16_t id)
Get the ip address from id.
Definition: dsr-routing.cc:797
std::vector< Ipv4Address > m_finalRoute
The route cache.
Definition: dsr-routing.h:862
static TypeId GetTypeId()
Get the type identificator.
Definition: dsr-routing.cc:108
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
uint32_t m_graReplyTableSize
Set the gratuitous reply table size.
Definition: dsr-routing.h:842
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn&#39;t yet exist in route cache See also DsrRouteCache::AddRoute.
Definition: dsr-routing.cc:668
DsrMaintainBuffer m_maintainBuffer
The declaration of maintain buffer.
Definition: dsr-routing.h:808
Packet header for IPv4.
Definition: ipv4-header.h:33
Time m_maxNetworkDelay
Maximum network delay.
Definition: dsr-routing.h:766
Ptr< dsr::DsrRreqTable > GetRequestTable() const
Get the request table.
Definition: dsr-routing.cc:609
uint16_t m_ackId
The ack id assigned to each acknowledge.
Definition: dsr-routing.h:812
DsrGraReply m_graReply
The gratuitous route reply.
Definition: dsr-routing.h:892
void CancelPassivePacketTimer(DsrMaintainBuffEntry &mb)
Cancel the passive packet retransmission timer for a specific maintenance entry.
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...
Time m_sendBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for.
Definition: dsr-routing.h:790
Ipv4Address m_broadcast
The broadcast IP address.
Definition: dsr-routing.h:822
uint32_t m_numPriorityQueues
The number of priority queues used.
Definition: dsr-routing.h:886
uint32_t m_broadcastJitter
The max time to delay route request broadcast.
Definition: dsr-routing.h:824
void ScheduleLinkPacketRetry(DsrMaintainBuffEntry &mb, uint8_t protocol)
Schedule the packet retransmission based on link-layer acknowledgment.
void SetNode(Ptr< Node > node)
Set the node.
Definition: dsr-routing.cc:577
static const uint8_t PROT_NUMBER
Define the dsr protocol number.
Definition: dsr-routing.h:106
uint32_t m_requestId
The id assigned to each route request.
Definition: dsr-routing.h:810
DsrErrorBuffer m_errorBuffer
The error buffer to save the error messages.
Definition: dsr-routing.h:794
void NetworkScheduleTimerExpire(DsrMaintainBuffEntry &mb, uint8_t protocol)
This function deals with packet retransmission timer expire using network acknowledgment.
void SetDownTarget6(IpL4Protocol::DownTargetCallback6 callback)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
Ptr< Ipv4L3Protocol > m_ipv4
Definition: dsr-routing.h:750
uint32_t m_requestTableIds
The request table identifiers.
Definition: dsr-routing.h:816
bool AddRoute_Link(DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source)
dd route link to cache See also DsrRouteCache::AddRoute_Link
Definition: dsr-routing.cc:661
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.
uint8_t segsLeft
The segment left value from SR header.
Definition: dsr-routing.h:760
DSR Network Queue Entry.
bool UpdateRouteEntry(Ipv4Address dst)
Update route cache entry if it has been recently used and successfully delivered the data packet...
Definition: dsr-routing.cc:681
Time m_minLifeTime
The min life time.
Definition: dsr-routing.h:854
std::vector< Ipv4Address > IP_VECTOR
Define the vector to hold Ip address.
Definition: dsr-rcache.h:223
Time m_useExtends
The use extension of the life time for link cache.
Definition: dsr-routing.h:856
void SchedulePassivePacketRetry(DsrMaintainBuffEntry &mb, uint8_t protocol)
Schedule the packet retransmission based on passive acknowledgment.
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...
std::vector< Ipv4Address > m_addresses
The bind ipv4 addresses with next hop, src, destination address in sequence.
Definition: dsr-routing.h:898
Time m_blacklistTimeout
The black list time out.
Definition: dsr-routing.h:820
IpL4Protocol::DownTargetCallback GetDownTarget(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
std::map< NetworkKey, Timer > m_addressForwardTimer
Map network key + forward timer.
Definition: dsr-routing.h:868
std::map< Ipv4Address, Timer > m_addressReqTimer
Map IP address + RREQ timer.
Definition: dsr-routing.h:864
void SetPassiveBuffer(Ptr< dsr::DsrPassiveBuffer > r)
Set the node.
Definition: dsr-routing.cc:615
void LinkScheduleTimerExpire(DsrMaintainBuffEntry &mb, uint8_t protocol)
This function deals with packet retransmission timer expire using link acknowledgment.
void SendPacketFromBuffer(DsrOptionSRHeader const &sourceRoute, Ipv4Address nextHop, uint8_t protocol)
This function is responsible for sending out data packets when have route, if no route found...
uint8_t m_maxSalvageCount
Maximum # times to salvage a packet.
Definition: dsr-routing.h:770
Time m_initStability
The initial stability value for link cache.
Definition: dsr-routing.h:852
Time m_requestPeriod
The base time interval between route requests.
Definition: dsr-routing.h:772
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< dsr::DsrOptions > GetOption(int optionNumber)
Get the option corresponding to optionNumber.
uint16_t GetIDfromIP(Ipv4Address address)
Get the node id from ip address.
Definition: dsr-routing.cc:781
Ptr< Node > m_node
The node ptr.
Definition: dsr-routing.h:756
Definition: first.py:44
void CallCancelPacketTimer(uint16_t ackId, Ipv4Header const &ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
Call the cancel packet retransmission timer function.
uint32_t m_passiveRetries
Definition: dsr-routing.h:778
uint32_t m_maxNetworkSize
Maximum network queue size.
Definition: dsr-routing.h:764
Ptr< Ipv4Route > SetRoute(Ipv4Address nextHop, Ipv4Address srcAddress)
Set the route to use for data packets, used by the option headers when sending data/control packets...
Definition: dsr-routing.cc:763
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.
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.
uint32_t m_tryPassiveAcks
Maximum number of packet transmission using passive acknowledgment.
Definition: dsr-routing.h:828
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Get the netdevice from the context.
Definition: dsr-routing.cc:522
uint32_t m_maxMaintRexmt
Maximum number of retransmissions of data packets.
Definition: dsr-routing.h:784
Ptr< dsr::DsrPassiveBuffer > GetPassiveBuffer() const
Get the passive buffer.
Definition: dsr-routing.cc:622
void CancelLinkPacketTimer(DsrMaintainBuffEntry &mb)
Cancel the link packet retransmission timer for a specific maintenance entry.
uint16_t AddAckReqHeader(Ptr< Packet > &packet, Ipv4Address nextHop)
This function is called to add ack request header for network acknowledgement.
void PacketNewRoute(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol)
When route vector corrupted, originate a new packet, normally not happening.
an EUI-48 address
Definition: mac48-address.h:43
Time m_retransIncr
the increase time for retransmission timer when face network congestion
Definition: dsr-routing.h:860
void ForwardPacket(Ptr< const Packet > packet, DsrOptionSRHeader &sourceRoute, Ipv4Header const &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.
std::map< LinkKey, Timer > m_linkAckTimer
The timer for link acknowledgment.
Definition: dsr-routing.h:878
L4 Protocol abstract base class.
std::vector< Ipv4Address > m_clearList
The node that is clear to send packet to.
Definition: dsr-routing.h:896
IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
void SendPacket(Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol)
This function is called by when really sending out the packet.
int GetProtocolNumber(void) const
Get the dsr protocol number.
Definition: dsr-routing.cc:774
void ScheduleRreqRetry(Ptr< Packet > packet, std::vector< Ipv4Address > address, bool nonProp, uint32_t requestId, uint8_t protocol)
Schedule the route request retry.
uint32_t m_maxRreqId
The max number of request ids for a single destination.
Definition: dsr-routing.h:818
virtual enum IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)
Ptr< dsr::DsrRouteCache > m_routeCache
A "drop-front" queue used by the routing layer to cache routes found.
Definition: dsr-routing.h:880
uint32_t m_maxCacheLen
Max # of cache entries for route cache.
Definition: dsr-routing.h:800
void PassiveScheduleTimerExpire(DsrMaintainBuffEntry &mb, uint8_t protocol)
This function deals with packet retransmission timer expire using passive acknowledgment.
std::string m_routeSortType
The type of route sort methods.
Definition: dsr-routing.h:846
void CheckSendBuffer()
Check the send buffer of packets with route when send buffer timer expire.
Definition: dsr-routing.cc:835
std::map< uint32_t, Ptr< dsr::DsrNetworkQueue > > m_priorityQueue
priority queues
Definition: dsr-routing.h:890
std::map< PassiveKey, uint32_t > m_passiveCnt
Map packet key + passive forward counts.
Definition: dsr-routing.h:872
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Definition: dsr-routing.cc:397
TracedCallback< Ptr< const Packet > > m_dropTrace
The trace for drop, receive and send data packets.
Definition: dsr-routing.h:718
std::map< PassiveKey, Timer > m_passiveAckTimer
The timer for passive acknowledgment.
Definition: dsr-routing.h:874
Ptr< Node > GetNode() const
Get the node.
Definition: dsr-routing.cc:583
void CancelPacketTimerNextHop(Ipv4Address nextHop, uint8_t protocol)
Cancel the packet retransmission timer for a all maintenance entries with nextHop address...
Ptr< Ipv4Route > m_ipv4Route
Ipv4 Route.
Definition: dsr-routing.h:752
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...
Time m_nodeTraversalTime
Time estimated for packet to travel between two nodes.
Definition: dsr-routing.h:786
void SetRouteCache(Ptr< dsr::DsrRouteCache > r)
Set the route cache.
Definition: dsr-routing.cc:589
bool m_subRoute
Whether to save sub route or not.
Definition: dsr-routing.h:858
Route Error (RERR) Unreachable node address option Message Format.
void ScheduleNetworkPacketRetry(DsrMaintainBuffEntry &mb, bool isFirst, uint8_t protocol)
Schedule the packet retransmission based on network layer acknowledgment.
bool CancelPassiveTimer(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft)
Cancel the passive timer.
void Insert(Ptr< dsr::DsrOptions > option)
Insert a new Dsr Option.
Ipv4Address GetIPfromMAC(Mac48Address address)
Get the Ip address from mac address.
Definition: dsr-routing.cc:692
bool SendRealDown(DsrNetworkQueueEntry &newEntry)
This function is called to send packets down stack.
void RouteRequestTimerExpire(Ptr< Packet > packet, std::vector< Ipv4Address > address, uint32_t requestId, uint8_t protocol)
Handle route discovery timer.
void CancelNetworkPacketTimer(DsrMaintainBuffEntry &mb)
Cancel the network packet retransmission timer for a specific maintenance entry.
uint32_t m_rreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
Definition: dsr-routing.h:782
DsrNetworkQueue m_networkQueue
The network queue.
Definition: dsr-routing.h:894
Time m_maxRreqTime
Max time for caching the route request entry.
Definition: dsr-routing.h:804
void PriorityScheduler(uint32_t priority, bool continueWithFirst)
This function is called to schedule sending packets from the network queue by priority.
Timer m_sendBuffTimer
The send buffer timer.
Definition: dsr-routing.h:834
bool FindSourceEntry(Ipv4Address src, Ipv4Address dst, uint16_t id)
Find the source request entry in the route request queue, return false if not found.
Definition: dsr-routing.cc:686
Rx status codes.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
Definition: dsr-routing.h:902
Ptr< Node > GetNodeWithAddress(Ipv4Address ipv4Address)
Get the node with give ip address.
Definition: dsr-routing.cc:629
DsrOptionList_t m_options
List of DSR Options supported.
Definition: dsr-routing.h:748
void SendGratuitousReply(Ipv4Address replyTo, Ipv4Address replyFrom, std::vector< Ipv4Address > &nodeList, uint8_t protocol)
Send the gratuitous reply.
void SendErrorRequest(DsrOptionRerrUnreachHeader &rerr, uint8_t protocol)
Send the error request packet.
Packet types are used as they are in Linux.
Definition: net-device.h:296
std::map< LinkKey, uint32_t > m_linkCnt
Map packet key + link forward counts.
Definition: dsr-routing.h:876
std::map< NetworkKey, uint32_t > m_addressForwardCnt
Map network key + forward counts.
Definition: dsr-routing.h:870
Dsr Routing base.
Definition: dsr-routing.h:95
a unique identifier for an interface.
Definition: type-id.h:58
Time m_nonpropRequestTimeout
The non-propagation request timeout.
Definition: dsr-routing.h:774
std::map< Ipv4Address, Timer > m_nonPropReqTimer
Map IP address + RREQ timer.
Definition: dsr-routing.h:866
bool m_linkAck
define if we use link acknowledgement or not
Definition: dsr-routing.h:888
std::vector< std::string > GetElementsFromContext(std::string context)
Get the elements from the tracing context.
Definition: dsr-routing.cc:534
Ptr< dsr::DsrRreqTable > m_rreqTable
A "drop-front" queue used by the routing layer to cache route request sent.
Definition: dsr-routing.h:882
Ptr< dsr::DsrPassiveBuffer > m_passiveBuffer
A "drop-front" queue used by the routing layer to cache route request sent.
Definition: dsr-routing.h:884
std::list< Ptr< DsrOptions > > DsrOptionList_t
Define the list to hold DSR options.
Definition: dsr-routing.h:744
IpL4Protocol::DownTargetCallback m_downTarget
The callback for down layer.
Definition: dsr-routing.h:762
Definition: dsr-routing.cc:356
DsrSendBuffer m_sendBuffer
The send buffer.
Definition: dsr-routing.h:792
Time m_maxMaintainTime
Time out for maintenance buffer.
Definition: dsr-routing.h:798
void CancelRreqTimer(Ipv4Address dst, bool isRemove)
Cancel the route request timer.
virtual ~DsrRouting()
Definition: dsr-routing.cc:391