A Discrete-Event Network Simulator
API
dsr-routing.h
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 */
31
32#ifndef DSR_ROUTING_H
33#define DSR_ROUTING_H
34
35#include <map>
36#include <list>
37#include <vector>
38#include <stdint.h>
39#include <cassert>
40#include <sys/types.h>
41
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"
65
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"
76
77namespace ns3 {
78
79class Packet;
80class Node;
81class Ipv4;
82class Ipv4Address;
83class Ipv4Header;
84class Ipv4Interface;
85class Ipv4L3Protocol;
86class Time;
87
88namespace dsr {
89
90class DsrOptions;
96{
97public:
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);
155
162 bool IsLinkCache ();
163
171
181
191
199 bool AddRoute (DsrRouteCacheEntry & rt);
200
210 void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node);
211
219 bool UpdateRouteEntry (Ipv4Address dst);
220
230 bool FindSourceEntry (Ipv4Address src, Ipv4Address dst, uint16_t id);
231
237 Ptr<NetDevice> GetNetDeviceFromContext (std::string context);
243 std::vector<std::string> GetElementsFromContext (std::string context);
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);
408
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);
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);
628
639 Ipv6Header const &header,
640 Ptr<Ipv6Interface> incomingInterface);
641
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);
694
703 int64_t AssignStreams (int64_t stream);
704
705protected:
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);
720
721private:
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;
749
751
753
755
757
759
760 uint8_t segsLeft;
761
763
765
767
769
771
773
775
777
779
781
783
785
787
789
791
793
795
797
799
801
803
805
807
809
811
812 uint16_t m_ackId;
813
815
817
819
821
823
825
827
829
831
833
835
837
839
841
843
844 std::string m_cacheType;
845
846 std::string m_routeSortType;
847
849
851
853
855
857
859
861
862 std::vector<Ipv4Address> m_finalRoute;
863
864 std::map<Ipv4Address, Timer> m_addressReqTimer;
865
866 std::map<Ipv4Address, Timer> m_nonPropReqTimer;
867
868 std::map<NetworkKey, Timer> m_addressForwardTimer;
869
870 std::map<NetworkKey, uint32_t> m_addressForwardCnt;
871
872 std::map<PassiveKey, uint32_t> m_passiveCnt;
873
874 std::map<PassiveKey, Timer> m_passiveAckTimer;
875
876 std::map<LinkKey, uint32_t> m_linkCnt;
877
878 std::map<LinkKey, Timer> m_linkAckTimer;
879
881
883
885
887
889
890 std::map<uint32_t, Ptr<dsr::DsrNetworkQueue> > m_priorityQueue;
891
893
895
896 std::vector<Ipv4Address> m_clearList;
897
898 std::vector<Ipv4Address> m_addresses;
899
900 std::map <std::string, uint32_t> m_macToNodeIdMap;
901
903};
904} /* namespace dsr */
905} /* namespace ns3 */
906
907#endif /* DSR_ROUTING_H */
a polymophic address class
Definition: address.h:91
L4 Protocol abstract base class.
RxStatus
Rx status codes.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Packet header for IPv4.
Definition: ipv4-header.h:34
Packet header for IPv6.
Definition: ipv6-header.h:36
an EUI-48 address
Definition: mac48-address.h:44
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:297
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
A simple virtual Timer class.
Definition: timer.h:74
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
DSR error buffer.
maintain the gratuitous reply
DSR Maintain Buffer Entry.
DSR Network Queue Entry.
Introspection did not find any typical Config paths.
Route Error (RERR) Unreachable node address option Message Format.
Source Route (SR) Message Format.
DsrRouteCacheEntry class for entries in the route cache.
Definition: dsr-rcache.h:221
std::vector< Ipv4Address > IP_VECTOR
Define the vector to hold Ip address.
Definition: dsr-rcache.h:223
Dsr Routing base.
Definition: dsr-routing.h:96
Ptr< dsr::DsrRreqTable > GetRequestTable() const
Get the request table.
Definition: dsr-routing.cc:609
std::string m_routeSortType
The type of route sort methods.
Definition: dsr-routing.h:846
void ScheduleInterRequest(Ptr< Packet > packet)
Schedule the intermediate route request.
void CheckSendBuffer()
Check the send buffer of packets with route when send buffer timer expire.
Definition: dsr-routing.cc:835
Ptr< Ipv4 > m_ip
The ip ptr.
Definition: dsr-routing.h:754
void ScheduleRreqRetry(Ptr< Packet > packet, std::vector< Ipv4Address > address, bool nonProp, uint32_t requestId, uint8_t protocol)
Schedule the route request retry.
Time m_blacklistTimeout
The black list time out.
Definition: dsr-routing.h:820
void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop, uint8_t protocol)
Send the route error message when the link breaks to the next hop.
std::string m_cacheType
The type of route cache.
Definition: dsr-routing.h:844
std::map< Ipv4Address, Timer > m_nonPropReqTimer
Map IP address + RREQ timer.
Definition: dsr-routing.h:866
void SetNode(Ptr< Node > node)
Set the node.
Definition: dsr-routing.cc:577
void SendBuffTimerExpire()
The send buffer timer expire.
Definition: dsr-routing.cc:825
void SetPassiveBuffer(Ptr< dsr::DsrPassiveBuffer > r)
Set the node.
Definition: dsr-routing.cc:615
std::vector< std::string > GetElementsFromContext(std::string context)
Get the elements from the tracing context.
Definition: dsr-routing.cc:534
void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt)
Extends the lifetime of a route cache entry.
Definition: dsr-routing.cc:651
uint32_t m_maxRreqId
The max number of request ids for a single destination.
Definition: dsr-routing.h:818
void SetDownTarget6(IpL4Protocol::DownTargetCallback6 callback)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
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,...
bool SendRealDown(DsrNetworkQueueEntry &newEntry)
This function is called to send packets down stack.
Time m_sendBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for.
Definition: dsr-routing.h:790
uint8_t segsLeft
The segment left value from SR header.
Definition: dsr-routing.h:760
void SendRequest(Ptr< Packet > packet, Ipv4Address source)
Forward the route request if the node is not the destination.
void CancelPacketTimerNextHop(Ipv4Address nextHop, uint8_t protocol)
Cancel the packet retransmission timer for a all maintenance entries with nextHop address.
bool m_linkAck
define if we use link acknowledgement or not
Definition: dsr-routing.h:888
void PrintVector(std::vector< Ipv4Address > &vec)
Print the route vector.
Definition: dsr-routing.cc:710
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
Definition: dsr-routing.h:902
virtual void DoDispose(void)
Drop trace callback.
Definition: dsr-routing.cc:549
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.
bool CancelPassiveTimer(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft)
Cancel the passive timer.
void PassiveScheduleTimerExpire(DsrMaintainBuffEntry &mb, uint8_t protocol)
This function deals with packet retransmission timer expire using passive acknowledgment.
std::vector< Ipv4Address > m_addresses
The bind ipv4 addresses with next hop, src, destination address in sequence.
Definition: dsr-routing.h:898
void SetDownTarget(IpL4Protocol::DownTargetCallback callback)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
bool AddRoute_Link(DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source)
dd route link to cache See also DsrRouteCache::AddRoute_Link
Definition: dsr-routing.cc:661
uint16_t m_ackId
The ack id assigned to each acknowledge.
Definition: dsr-routing.h:812
DsrRouting()
Constructor.
Definition: dsr-routing.cc:356
void CancelLinkPacketTimer(DsrMaintainBuffEntry &mb)
Cancel the link packet retransmission timer for a specific maintenance entry.
IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
Time m_nonpropRequestTimeout
The non-propagation request timeout.
Definition: dsr-routing.h:774
Time m_gratReplyHoldoff
The max gratuitous reply hold off time.
Definition: dsr-routing.h:838
std::list< Ptr< DsrOptions > > DsrOptionList_t
Define the list to hold DSR options.
Definition: dsr-routing.h:744
uint16_t GetIDfromIP(Ipv4Address address)
Get the node id from ip address.
Definition: dsr-routing.cc:781
std::map< uint32_t, Ptr< dsr::DsrNetworkQueue > > m_priorityQueue
priority queues
Definition: dsr-routing.h:890
uint32_t m_maxEntriesEachDst
Max number of route entries to save for each destination.
Definition: dsr-routing.h:806
std::map< Ipv4Address, Timer > m_addressReqTimer
Map IP address + RREQ timer.
Definition: dsr-routing.h:864
virtual enum IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)
Time m_retransIncr
the increase time for retransmission timer when face network congestion
Definition: dsr-routing.h:860
std::map< NetworkKey, Timer > m_addressForwardTimer
Map network key + forward timer.
Definition: dsr-routing.h:868
DsrNetworkQueue m_networkQueue
The network queue.
Definition: dsr-routing.h:894
uint32_t m_stabilityDecrFactor
The initial decrease factor for link cache.
Definition: dsr-routing.h:848
Time m_nodeTraversalTime
Time estimated for packet to travel between two nodes.
Definition: dsr-routing.h:786
uint32_t m_requestId
The id assigned to each route request.
Definition: dsr-routing.h:810
std::map< NetworkKey, uint32_t > m_addressForwardCnt
Map network key + forward counts.
Definition: dsr-routing.h:870
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Get the netdevice from the context.
Definition: dsr-routing.cc:522
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
Ipv4Address m_broadcast
The broadcast IP address.
Definition: dsr-routing.h:822
Ptr< dsr::DsrPassiveBuffer > GetPassiveBuffer() const
Get the passive buffer.
Definition: dsr-routing.cc:622
Ipv4Address GetIPfromMAC(Mac48Address address)
Get the Ip address from mac address.
Definition: dsr-routing.cc:692
Ptr< dsr::DsrRouteCache > GetRouteCache() const
Get the route cache.
Definition: dsr-routing.cc:596
Time m_maxNetworkDelay
Maximum network delay.
Definition: dsr-routing.h:766
Ptr< dsr::DsrOptions > GetOption(int optionNumber)
Get the option corresponding to optionNumber.
uint32_t m_maxSendBuffLen
The maximum number of packets that we allow a routing protocol to buffer.
Definition: dsr-routing.h:788
IpL4Protocol::DownTargetCallback GetDownTarget(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
TracedCallback< const DsrOptionSRHeader & > m_txPacketTrace
packet trace callback
Definition: dsr-routing.h:719
Time m_passiveAckTimeout
The timeout value for passive acknowledge.
Definition: dsr-routing.h:826
void SetRequestTable(Ptr< dsr::DsrRreqTable > r)
Set the node.
Definition: dsr-routing.cc:602
uint32_t m_maxMaintainLen
Max # of entries for maintenance buffer.
Definition: dsr-routing.h:796
static const uint8_t PROT_NUMBER
Define the dsr protocol number.
Definition: dsr-routing.h:106
uint32_t GetPriority(DsrMessageType messageType)
Set the priority of the packet in network queue.
Definition: dsr-routing.cc:813
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 ScheduleNetworkPacketRetry(DsrMaintainBuffEntry &mb, bool isFirst, uint8_t protocol)
Schedule the packet retransmission based on network layer acknowledgment.
void CallCancelPacketTimer(uint16_t ackId, Ipv4Header const &ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
Call the cancel packet retransmission timer function.
Ipv4Address m_mainAddress
Our own Ip address.
Definition: dsr-routing.h:758
void SendInitialRequest(Ipv4Address source, Ipv4Address destination, uint8_t protocol)
Broadcast the route request packet in subnet.
Timer m_sendBuffTimer
The send buffer timer.
Definition: dsr-routing.h:834
Time m_maxCacheTime
Max time for caching the route cache entry.
Definition: dsr-routing.h:802
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Definition: dsr-routing.cc:397
void SendGratuitousReply(Ipv4Address replyTo, Ipv4Address replyFrom, std::vector< Ipv4Address > &nodeList, uint8_t protocol)
Send the gratuitous reply.
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
DsrOptionList_t m_options
List of DSR Options supported.
Definition: dsr-routing.h:748
std::map< PassiveKey, uint32_t > m_passiveCnt
Map packet key + passive forward counts.
Definition: dsr-routing.h:872
DsrErrorBuffer m_errorBuffer
The error buffer to save the error messages.
Definition: dsr-routing.h:794
void SalvagePacket(Ptr< const Packet > packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol)
Salvage the packet which has been transmitted for 3 times.
bool m_subRoute
Whether to save sub route or not.
Definition: dsr-routing.h:858
void SendPacket(Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol)
This function is called by when really sending out the packet.
bool IsLinkCache()
Checks if the link is cached in the route cache See also DsrRouteCache::IsLinkCache.
Definition: dsr-routing.cc:646
std::map< LinkKey, uint32_t > m_linkCnt
Map packet key + link forward counts.
Definition: dsr-routing.h:876
DsrSendBuffer m_sendBuffer
The send buffer.
Definition: dsr-routing.h:792
uint32_t m_passiveRetries
Definition: dsr-routing.h:778
uint32_t m_rreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
Definition: dsr-routing.h:782
uint8_t m_maxSalvageCount
Maximum # times to salvage a packet.
Definition: dsr-routing.h:770
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
uint16_t AddAckReqHeader(Ptr< Packet > &packet, Ipv4Address nextHop)
This function is called to add ack request header for network acknowledgement.
Time m_maxRreqTime
Max time for caching the route request entry.
Definition: dsr-routing.h:804
uint32_t m_requestTableSize
The max size of the request table size.
Definition: dsr-routing.h:814
DsrGraReply m_graReply
The gratuitous route reply.
Definition: dsr-routing.h:892
void ScheduleLinkPacketRetry(DsrMaintainBuffEntry &mb, uint8_t protocol)
Schedule the packet retransmission based on link-layer acknowledgment.
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.
Time m_sendBuffInterval
how often to check send buffer
Definition: dsr-routing.h:836
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,...
bool LookupRoute(Ipv4Address id, DsrRouteCacheEntry &rt)
Lookup route cache entry with destination address dst See also DsrRouteCache::LookupRoute.
Definition: dsr-routing.cc:656
Time m_initStability
The initial stability value for link cache.
Definition: dsr-routing.h:852
uint32_t m_stabilityIncrFactor
The initial increase factor for link cache.
Definition: dsr-routing.h:850
Time m_useExtends
The use extension of the life time for link cache.
Definition: dsr-routing.h:856
uint32_t m_numPriorityQueues
The number of priority queues used.
Definition: dsr-routing.h:886
Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Get the next hop of the route.
Definition: dsr-routing.cc:730
IpL4Protocol::DownTargetCallback m_downTarget
The callback for down layer.
Definition: dsr-routing.h:762
uint32_t m_graReplyTableSize
Set the gratuitous reply table size.
Definition: dsr-routing.h:842
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.
Ptr< Node > GetNodeWithAddress(Ipv4Address ipv4Address)
Get the node with give ip address.
Definition: dsr-routing.cc:629
Ptr< Ipv4L3Protocol > m_ipv4
Ipv4l3Protocol.
Definition: dsr-routing.h:750
void Scheduler(uint32_t priority)
This function is called to schedule sending packets from the network queue.
void RouteRequestTimerExpire(Ptr< Packet > packet, std::vector< Ipv4Address > address, uint32_t requestId, uint8_t protocol)
Handle route discovery timer.
void NetworkScheduleTimerExpire(DsrMaintainBuffEntry &mb, uint8_t protocol)
This function deals with packet retransmission timer expire using network acknowledgment.
uint32_t m_requestTableIds
The request table identifiers.
Definition: dsr-routing.h:816
TracedCallback< Ptr< const Packet > > m_dropTrace
The trace for drop, receive and send data packets.
Definition: dsr-routing.h:718
uint32_t m_tryPassiveAcks
Maximum number of packet transmission using passive acknowledgment.
Definition: dsr-routing.h:828
std::map< std::string, uint32_t > m_macToNodeIdMap
The map of mac address to node id.
Definition: dsr-routing.h:900
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 LinkScheduleTimerExpire(DsrMaintainBuffEntry &mb, uint8_t protocol)
This function deals with packet retransmission timer expire using link acknowledgment.
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
uint32_t m_maxNetworkSize
Maximum network queue size.
Definition: dsr-routing.h:764
Ptr< Ipv4Route > m_ipv4Route
Ipv4 Route.
Definition: dsr-routing.h:752
Ptr< Node > GetNode() const
Get the node.
Definition: dsr-routing.cc:583
Ipv4Address GetIPfromID(uint16_t id)
Get the ip address from id.
Definition: dsr-routing.cc:797
Time m_maxRequestPeriod
The max request period.
Definition: dsr-routing.h:840
void SchedulePassivePacketRetry(DsrMaintainBuffEntry &mb, uint8_t protocol)
Schedule the packet retransmission based on passive acknowledgment.
Ptr< dsr::DsrPassiveBuffer > m_passiveBuffer
A "drop-front" queue used by the routing layer to cache route request sent.
Definition: dsr-routing.h:884
Ptr< Node > m_node
The node ptr.
Definition: dsr-routing.h:756
Ptr< dsr::DsrRouteCache > m_routeCache
A "drop-front" queue used by the routing layer to cache routes found.
Definition: dsr-routing.h:880
std::map< PassiveKey, Timer > m_passiveAckTimer
The timer for passive acknowledgment.
Definition: dsr-routing.h:874
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn't yet exist in route cache See also DsrRouteCache::AddRoute.
Definition: dsr-routing.cc:668
Time m_maxMaintainTime
Time out for maintenance buffer.
Definition: dsr-routing.h:798
DsrMaintainBuffer m_maintainBuffer
The declaration of maintain buffer.
Definition: dsr-routing.h:808
uint32_t m_maxMaintRexmt
Maximum number of retransmissions of data packets.
Definition: dsr-routing.h:784
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.
Time m_requestPeriod
The base time interval between route requests.
Definition: dsr-routing.h:772
Time m_linkAckTimeout
The timeout value for link acknowledge.
Definition: dsr-routing.h:830
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.
uint32_t m_tryLinkAcks
Maximum number of packet transmission using link acknowledgment.
Definition: dsr-routing.h:832
uint32_t m_discoveryHopLimit
Maximum hops to go for route request.
Definition: dsr-routing.h:768
void CancelRreqTimer(Ipv4Address dst, bool isRemove)
Cancel the route request timer.
std::map< LinkKey, Timer > m_linkAckTimer
The timer for link acknowledgment.
Definition: dsr-routing.h:878
Time m_minLifeTime
The min life time.
Definition: dsr-routing.h:854
static TypeId GetTypeId()
Get the type identificator.
Definition: dsr-routing.cc:108
std::vector< Ipv4Address > m_clearList
The node that is clear to send packet to.
Definition: dsr-routing.h:896
void SendErrorRequest(DsrOptionRerrUnreachHeader &rerr, uint8_t protocol)
Send the error request packet.
void PacketNewRoute(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol)
When route vector corrupted, originate a new packet, normally not happening.
Ptr< dsr::DsrRreqTable > m_rreqTable
A "drop-front" queue used by the routing layer to cache route request sent.
Definition: dsr-routing.h:882
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void IncreaseRetransTimer()
This function is called to increase the retransmission timer for data packet in the network queue.
int GetProtocolNumber(void) const
Get the dsr protocol number.
Definition: dsr-routing.cc:774
void CancelPassivePacketTimer(DsrMaintainBuffEntry &mb)
Cancel the passive packet retransmission timer for a specific maintenance entry.
void CancelNetworkPacketTimer(DsrMaintainBuffEntry &mb)
Cancel the network packet retransmission timer for a specific maintenance entry.
void PriorityScheduler(uint32_t priority, bool continueWithFirst)
This function is called to schedule sending packets from the network queue by priority.
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 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 SetRouteCache(Ptr< dsr::DsrRouteCache > r)
Set the route cache.
Definition: dsr-routing.cc:589
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.
virtual ~DsrRouting()
Destructor.
Definition: dsr-routing.cc:391
void Insert(Ptr< dsr::DsrOptions > option)
Insert a new Dsr Option.
std::vector< Ipv4Address > m_finalRoute
The route cache.
Definition: dsr-routing.h:862
void CancelPacketAllTimer(DsrMaintainBuffEntry &mb)
Cancel all the packet timers.
uint32_t m_broadcastJitter
The max time to delay route request broadcast.
Definition: dsr-routing.h:824
uint32_t m_maxCacheLen
Max # of cache entries for route cache.
Definition: dsr-routing.h:800
DSR send buffer.
address
Definition: first.py:44
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:793
Every class exported by the ns3 library is enclosed in the ns3 namespace.