A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
dsr-routing.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Yufei Cheng
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Yufei Cheng <yfcheng@ittc.ku.edu>
18 *
19 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
20 * ResiliNets Research Group https://resilinets.org/
21 * Information and Telecommunication Technology Center (ITTC)
22 * and Department of Electrical Engineering and Computer Science
23 * The University of Kansas Lawrence, KS USA.
24 *
25 * Work supported in part by NSF FIND (Future Internet Design) Program
26 * under grant CNS-0626918 (Postmodern Internet Architecture),
27 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
28 * US Department of Defense (DoD), and ITTC at The University of Kansas.
29 */
30
31#ifndef DSR_ROUTING_H
32#define DSR_ROUTING_H
33
34#include "dsr-errorbuff.h"
35#include "dsr-fs-header.h"
37#include "dsr-maintain-buff.h"
38#include "dsr-network-queue.h"
39#include "dsr-option-header.h"
40#include "dsr-passive-buff.h"
41#include "dsr-rcache.h"
42#include "dsr-rreq-table.h"
43#include "dsr-rsendbuff.h"
44
45#include "ns3/buffer.h"
46#include "ns3/callback.h"
47#include "ns3/event-garbage-collector.h"
48#include "ns3/icmpv4-l4-protocol.h"
49#include "ns3/ip-l4-protocol.h"
50#include "ns3/ipv4-address.h"
51#include "ns3/ipv4-header.h"
52#include "ns3/ipv4-interface.h"
53#include "ns3/ipv4-l3-protocol.h"
54#include "ns3/ipv4-route.h"
55#include "ns3/ipv4.h"
56#include "ns3/net-device.h"
57#include "ns3/node.h"
58#include "ns3/object.h"
59#include "ns3/output-stream-wrapper.h"
60#include "ns3/packet.h"
61#include "ns3/ptr.h"
62#include "ns3/random-variable-stream.h"
63#include "ns3/socket.h"
64#include "ns3/test.h"
65#include "ns3/timer.h"
66#include "ns3/traced-callback.h"
67#include "ns3/wifi-mac.h"
68
69#include <cassert>
70#include <list>
71#include <map>
72#include <stdint.h>
73#include <sys/types.h>
74#include <vector>
75
76namespace ns3
77{
78
79class Packet;
80class Node;
81class Ipv4;
82class Ipv4Address;
83class Ipv4Header;
84class Ipv4Interface;
85class Ipv4L3Protocol;
86class Time;
87
88namespace dsr
89{
90
91class DsrOptions;
92
98{
99 public:
104 static TypeId GetTypeId();
108 static const uint8_t PROT_NUMBER;
112 DsrRouting();
116 ~DsrRouting() override;
121 Ptr<Node> GetNode() const;
126 void SetNode(Ptr<Node> node);
157
164 bool IsLinkCache();
165
173
183
193
202
212 Ipv4Address unreachNode,
213 Ipv4Address node);
214
223
233 bool FindSourceEntry(Ipv4Address src, Ipv4Address dst, uint16_t id);
234
240 Ptr<NetDevice> GetNetDeviceFromContext(std::string context);
246 std::vector<std::string> GetElementsFromContext(std::string context);
252 uint16_t GetIDfromIP(Ipv4Address address);
258 Ipv4Address GetIPfromID(uint16_t id);
275 void PrintVector(std::vector<Ipv4Address>& vec);
282 Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
287 int GetProtocolNumber() const override;
291 void SendBuffTimerExpire();
295 void CheckSendBuffer();
303 void PacketNewRoute(Ptr<Packet> packet,
304 Ipv4Address source,
305 Ipv4Address destination,
306 uint8_t protocol);
314 Ptr<Ipv4Route> SetRoute(Ipv4Address nextHop, Ipv4Address srcAddress);
330 void SendUnreachError(Ipv4Address unreachNode,
331 Ipv4Address destination,
332 Ipv4Address originalDst,
333 uint8_t salvage,
334 uint8_t protocol);
335
345 DsrOptionSRHeader& sourceRoute,
346 Ipv4Address nextHop,
347 uint8_t protocol,
348 Ptr<Ipv4Route> route);
357 void Send(Ptr<Packet> packet,
358 Ipv4Address source,
359 Ipv4Address destination,
360 uint8_t protocol,
361 Ptr<Ipv4Route> route);
368 uint16_t AddAckReqHeader(Ptr<Packet>& packet, Ipv4Address nextHop);
376 void SendPacket(Ptr<Packet> packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol);
381 void Scheduler(uint32_t priority);
387 void PriorityScheduler(uint32_t priority, bool continueWithFirst);
398 bool SendRealDown(DsrNetworkQueueEntry& newEntry);
406 void SendPacketFromBuffer(const DsrOptionSRHeader& sourceRoute,
407 Ipv4Address nextHop,
408 uint8_t protocol);
420 bool PassiveEntryCheck(Ptr<Packet> packet,
421 Ipv4Address source,
422 Ipv4Address destination,
423 uint8_t segsLeft,
424 uint16_t fragmentOffset,
425 uint16_t identification,
426 bool saveEntry);
427
442 Ipv4Address source,
443 Ipv4Address destination,
444 uint8_t segsLeft);
452 void CallCancelPacketTimer(uint16_t ackId,
453 const Ipv4Header& ipv4Header,
454 Ipv4Address realSrc,
455 Ipv4Address realDst);
477 void CancelPacketTimerNextHop(Ipv4Address nextHop, uint8_t protocol);
486 Ipv4Address source,
487 Ipv4Address dst,
488 uint8_t protocol);
494 void ScheduleLinkPacketRetry(DsrMaintainBuffEntry& mb, uint8_t protocol);
500 void SchedulePassivePacketRetry(DsrMaintainBuffEntry& mb, uint8_t protocol);
507 void ScheduleNetworkPacketRetry(DsrMaintainBuffEntry& mb, bool isFirst, uint8_t protocol);
513 void LinkScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
520 void NetworkScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
527 void PassiveScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
540 DsrOptionSRHeader& sourceRoute,
541 const Ipv4Header& ipv4Header,
542 Ipv4Address source,
543 Ipv4Address destination,
544 Ipv4Address targetAddress,
545 uint8_t protocol,
546 Ptr<Ipv4Route> route);
553 void SendInitialRequest(Ipv4Address source, Ipv4Address destination, uint8_t protocol);
559 void SendErrorRequest(DsrOptionRerrUnreachHeader& rerr, uint8_t protocol);
565 void SendRequest(Ptr<Packet> packet, Ipv4Address source);
578 void SendGratuitousReply(Ipv4Address replyTo,
579 Ipv4Address replyFrom,
580 std::vector<Ipv4Address>& nodeList,
581 uint8_t protocol);
590 void SendReply(Ptr<Packet> packet,
591 Ipv4Address source,
592 Ipv4Address nextHop,
593 Ptr<Ipv4Route> route);
604 Ipv4Address source,
605 Ipv4Address nextHop,
606 Ptr<Ipv4Route> route);
617 Ipv4Address source,
618 Ipv4Address destination,
619 Ptr<Ipv4Route> route,
620 double hops);
632 void SendAck(uint16_t ackId,
633 Ipv4Address destination,
634 Ipv4Address realSrc,
635 Ipv4Address realDst,
636 uint8_t protocol,
637 Ptr<Ipv4Route> route);
648 const Ipv4Header& header,
649 Ptr<Ipv4Interface> incomingInterface) override;
650
661 const Ipv6Header& header,
662 Ptr<Ipv6Interface> incomingInterface) override;
663
664 void SetDownTarget(IpL4Protocol::DownTargetCallback callback) override;
680 uint8_t Process(Ptr<Packet>& packet,
681 const Ipv4Header& ipv4Header,
682 Ipv4Address dst,
683 uint8_t* nextHeader,
684 uint8_t protocol,
685 bool& isDropped);
690 void Insert(Ptr<dsr::DsrOptions> option);
696 Ptr<dsr::DsrOptions> GetOption(int optionNumber);
702 void CancelRreqTimer(Ipv4Address dst, bool isRemove);
711 void ScheduleRreqRetry(Ptr<Packet> packet,
712 std::vector<Ipv4Address> address,
713 bool nonProp,
714 uint32_t requestId,
715 uint8_t protocol);
725 std::vector<Ipv4Address> address,
726 uint32_t requestId,
727 uint8_t protocol);
728
737 int64_t AssignStreams(int64_t stream);
738
739 protected:
740 /*
741 * * This function will notify other components connected to the node that a new stack member
742 * is now connected
743 * * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect
744 * them together.
745 * */
746 void NotifyNewAggregate() override;
750 void DoDispose() override;
756
757 private:
758 void Start();
764 void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop, uint8_t protocol);
775 bool PromiscReceive(Ptr<NetDevice> device,
776 Ptr<const Packet> packet,
777 uint16_t protocol,
778 const Address& from,
779 const Address& to,
780 NetDevice::PacketType packetType);
784 typedef std::list<Ptr<DsrOptions>> DsrOptionList_t;
789
791
793
795
797
799
800 uint8_t segsLeft;
801
803
805
807
809
811
813
815
817
819
821
824
826
828
831
834
836
838
840
842
844
846
848
850
852
854
855 uint16_t m_ackId;
856
858
860
862
864
866
868
870
873
875
877
879
881
883
885
887
888 std::string m_cacheType;
889
890 std::string m_routeSortType;
891
893
895
897
899
901
903
905
906 std::vector<Ipv4Address> m_finalRoute;
907
908 std::map<Ipv4Address, Timer> m_addressReqTimer;
909
910 std::map<Ipv4Address, Timer> m_nonPropReqTimer;
911
912 std::map<NetworkKey, Timer> m_addressForwardTimer;
913
914 std::map<NetworkKey, uint32_t> m_addressForwardCnt;
915
916 std::map<PassiveKey, uint32_t> m_passiveCnt;
917
918 std::map<PassiveKey, Timer> m_passiveAckTimer;
919
920 std::map<LinkKey, uint32_t> m_linkCnt;
921
922 std::map<LinkKey, Timer> m_linkAckTimer;
923
926
929
932
934
936
937 std::map<uint32_t, Ptr<dsr::DsrNetworkQueue>> m_priorityQueue;
938
940
942
943 std::vector<Ipv4Address> m_clearList;
944
945 std::vector<Ipv4Address> m_addresses;
947
948 std::map<std::string, uint32_t> m_macToNodeIdMap;
949
951};
952} /* namespace dsr */
953} /* namespace ns3 */
954
955#endif /* DSR_ROUTING_H */
a polymophic address class
Definition: address.h:100
L4 Protocol abstract base class.
RxStatus
Rx status codes.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Packet header for IPv4.
Definition: ipv4-header.h:34
Packet header for IPv6.
Definition: ipv6-header.h:35
an EUI-48 address
Definition: mac48-address.h:46
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:300
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Maintain the event list.
Definition: scheduler.h:157
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
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:229
std::vector< Ipv4Address > IP_VECTOR
Define the vector to hold Ip address.
Definition: dsr-rcache.h:231
Dsr Routing base.
Definition: dsr-routing.h:98
Ptr< dsr::DsrRreqTable > GetRequestTable() const
Get the request table.
Definition: dsr-routing.cc:625
std::string m_routeSortType
The type of route sort methods.
Definition: dsr-routing.h:890
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:864
Ptr< Ipv4 > m_ip
The ip ptr.
Definition: dsr-routing.h:794
void ScheduleRreqRetry(Ptr< Packet > packet, std::vector< Ipv4Address > address, bool nonProp, uint32_t requestId, uint8_t protocol)
Schedule the route request retry.
void NotifyNewAggregate() override
Notify all Objects aggregated to this one of a new Object being aggregated.
Definition: dsr-routing.cc:406
Time m_blacklistTimeout
The black list time out.
Definition: dsr-routing.h:863
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:888
std::map< Ipv4Address, Timer > m_nonPropReqTimer
Map IP address + RREQ timer.
Definition: dsr-routing.h:910
IpL4Protocol::DownTargetCallback GetDownTarget() const override
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
void SetNode(Ptr< Node > node)
Set the node.
Definition: dsr-routing.cc:591
void SendBuffTimerExpire()
The send buffer timer expire.
Definition: dsr-routing.cc:853
void SetPassiveBuffer(Ptr< dsr::DsrPassiveBuffer > r)
Set the node.
Definition: dsr-routing.cc:632
std::vector< std::string > GetElementsFromContext(std::string context)
Get the elements from the tracing context.
Definition: dsr-routing.cc:549
void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt)
Extends the lifetime of a route cache entry.
Definition: dsr-routing.cc:670
uint32_t m_maxRreqId
The max number of request ids for a single destination.
Definition: dsr-routing.h:861
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:832
uint8_t segsLeft
The segment left value from SR header.
Definition: dsr-routing.h:800
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:935
void PrintVector(std::vector< Ipv4Address > &vec)
Print the route vector.
Definition: dsr-routing.cc:738
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
Definition: dsr-routing.h:950
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.
IpL4Protocol::RxStatus Receive(Ptr< Packet > p, const Ipv4Header &header, Ptr< Ipv4Interface > incomingInterface) override
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:945
bool AddRoute_Link(DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source)
dd route link to cache See also DsrRouteCache::AddRoute_Link
Definition: dsr-routing.cc:682
uint16_t m_ackId
The ack id assigned to each acknowledge.
Definition: dsr-routing.h:855
DsrRouting()
Constructor.
Definition: dsr-routing.cc:364
void CancelLinkPacketTimer(DsrMaintainBuffEntry &mb)
Cancel the link packet retransmission timer for a specific maintenance entry.
Time m_nonpropRequestTimeout
The non-propagation request timeout.
Definition: dsr-routing.h:814
Time m_gratReplyHoldoff
The max gratuitous reply hold off time.
Definition: dsr-routing.h:882
std::list< Ptr< DsrOptions > > DsrOptionList_t
Define the list to hold DSR options.
Definition: dsr-routing.h:784
uint16_t GetIDfromIP(Ipv4Address address)
Get the node id from ip address.
Definition: dsr-routing.cc:810
std::map< uint32_t, Ptr< dsr::DsrNetworkQueue > > m_priorityQueue
priority queues
Definition: dsr-routing.h:937
uint32_t m_maxEntriesEachDst
Max number of route entries to save for each destination.
Definition: dsr-routing.h:849
std::map< Ipv4Address, Timer > m_addressReqTimer
Map IP address + RREQ timer.
Definition: dsr-routing.h:908
Time m_retransIncr
the increase time for retransmission timer when face network congestion
Definition: dsr-routing.h:904
std::map< NetworkKey, Timer > m_addressForwardTimer
Map network key + forward timer.
Definition: dsr-routing.h:912
DsrNetworkQueue m_networkQueue
The network queue.
Definition: dsr-routing.h:941
uint32_t m_stabilityDecrFactor
The initial decrease factor for link cache.
Definition: dsr-routing.h:892
Time m_nodeTraversalTime
Time estimated for packet to travel between two nodes.
Definition: dsr-routing.h:827
uint32_t m_requestId
The id assigned to each route request.
Definition: dsr-routing.h:853
std::map< NetworkKey, uint32_t > m_addressForwardCnt
Map network key + forward counts.
Definition: dsr-routing.h:914
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Get the netdevice from the context.
Definition: dsr-routing.cc:537
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:713
Ipv4Address m_broadcast
The broadcast IP address.
Definition: dsr-routing.h:865
Ptr< dsr::DsrPassiveBuffer > GetPassiveBuffer() const
Get the passive buffer.
Definition: dsr-routing.cc:639
Ipv4Address GetIPfromMAC(Mac48Address address)
Get the Ip address from mac address.
Definition: dsr-routing.cc:719
Ptr< dsr::DsrRouteCache > GetRouteCache() const
Get the route cache.
Definition: dsr-routing.cc:611
Time m_maxNetworkDelay
Maximum network delay.
Definition: dsr-routing.h:806
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:829
Time m_passiveAckTimeout
The timeout value for passive acknowledge.
Definition: dsr-routing.h:869
void SetRequestTable(Ptr< dsr::DsrRreqTable > r)
Set the node.
Definition: dsr-routing.cc:618
uint32_t m_maxMaintainLen
Max # of entries for maintenance buffer.
Definition: dsr-routing.h:839
static const uint8_t PROT_NUMBER
Define the dsr protocol number.
Definition: dsr-routing.h:108
uint32_t GetPriority(DsrMessageType messageType)
Set the priority of the packet in network queue.
Definition: dsr-routing.cc:840
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.
Ipv4Address m_mainAddress
Our own Ip address.
Definition: dsr-routing.h:798
void SendInitialRequest(Ipv4Address source, Ipv4Address destination, uint8_t protocol)
Broadcast the route request packet in subnet.
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.
Timer m_sendBuffTimer
The send buffer timer.
Definition: dsr-routing.h:878
Time m_maxCacheTime
Max time for caching the route cache entry.
Definition: dsr-routing.h:845
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:699
DsrOptionList_t m_options
List of DSR Options supported.
Definition: dsr-routing.h:788
std::map< PassiveKey, uint32_t > m_passiveCnt
Map packet key + passive forward counts.
Definition: dsr-routing.h:916
DsrErrorBuffer m_errorBuffer
The error buffer to save the error messages.
Definition: dsr-routing.h:837
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:902
void SendPacket(Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol)
This function is called by when really sending out the packet.
void SetDownTarget(IpL4Protocol::DownTargetCallback callback) override
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
bool IsLinkCache()
Checks if the link is cached in the route cache See also DsrRouteCache::IsLinkCache.
Definition: dsr-routing.cc:664
std::map< LinkKey, uint32_t > m_linkCnt
Map packet key + link forward counts.
Definition: dsr-routing.h:920
~DsrRouting() override
Destructor.
Definition: dsr-routing.cc:400
DsrSendBuffer m_sendBuffer
The send buffer.
Definition: dsr-routing.h:835
uint32_t m_passiveRetries
Definition: dsr-routing.h:818
uint32_t m_rreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
Definition: dsr-routing.h:822
uint8_t m_maxSalvageCount
Maximum # times to salvage a packet.
Definition: dsr-routing.h:810
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:792
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:847
uint32_t m_requestTableSize
The max size of the request table size.
Definition: dsr-routing.h:857
DsrGraReply m_graReply
The gratuitous route reply.
Definition: dsr-routing.h:939
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:880
TracedCallback< const DsrOptionSRHeader & > m_txPacketTrace
packet trace callback
Definition: dsr-routing.h:755
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:676
Time m_initStability
The initial stability value for link cache.
Definition: dsr-routing.h:896
uint32_t m_stabilityIncrFactor
The initial increase factor for link cache.
Definition: dsr-routing.h:894
void SetDownTarget6(IpL4Protocol::DownTargetCallback6 callback) override
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
Time m_useExtends
The use extension of the life time for link cache.
Definition: dsr-routing.h:900
uint32_t m_numPriorityQueues
The number of priority queues used.
Definition: dsr-routing.h:933
Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Get the next hop of the route.
Definition: dsr-routing.cc:759
IpL4Protocol::DownTargetCallback m_downTarget
The callback for down layer.
Definition: dsr-routing.h:802
uint32_t m_graReplyTableSize
Set the gratuitous reply table size.
Definition: dsr-routing.h:886
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:646
Ptr< Ipv4L3Protocol > m_ipv4
Ipv4l3Protocol.
Definition: dsr-routing.h:790
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:859
TracedCallback< Ptr< const Packet > > m_dropTrace
The trace for drop, receive and send data packets.
Definition: dsr-routing.h:754
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,...
uint32_t m_tryPassiveAcks
Maximum number of packet transmission using passive acknowledgment.
Definition: dsr-routing.h:872
std::map< std::string, uint32_t > m_macToNodeIdMap
The map of mac address to node id.
Definition: dsr-routing.h:948
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:707
uint32_t m_maxNetworkSize
Maximum network queue size.
Definition: dsr-routing.h:804
Ptr< Ipv4Route > m_ipv4Route
Ipv4 Route.
Definition: dsr-routing.h:792
Ptr< Node > GetNode() const
Get the node.
Definition: dsr-routing.cc:597
Ipv4Address GetIPfromID(uint16_t id)
Get the ip address from id.
Definition: dsr-routing.cc:826
Time m_maxRequestPeriod
The max request period.
Definition: dsr-routing.h:884
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:930
Ptr< Node > m_node
The node ptr.
Definition: dsr-routing.h:796
Ptr< dsr::DsrRouteCache > m_routeCache
A "drop-front" queue used by the routing layer to cache routes found.
Definition: dsr-routing.h:925
std::map< PassiveKey, Timer > m_passiveAckTimer
The timer for passive acknowledgment.
Definition: dsr-routing.h:918
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:690
Time m_maxMaintainTime
Time out for maintenance buffer.
Definition: dsr-routing.h:841
DsrMaintainBuffer m_maintainBuffer
The declaration of maintain buffer.
Definition: dsr-routing.h:851
uint32_t m_maxMaintRexmt
Maximum number of retransmissions of data packets.
Definition: dsr-routing.h:825
void CallCancelPacketTimer(uint16_t ackId, const Ipv4Header &ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
Call the cancel packet retransmission timer function.
Time m_requestPeriod
The base time interval between route requests.
Definition: dsr-routing.h:812
Time m_linkAckTimeout
The timeout value for link acknowledge.
Definition: dsr-routing.h:874
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:876
uint32_t m_discoveryHopLimit
Maximum hops to go for route request.
Definition: dsr-routing.h:808
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:922
IpL4Protocol::DownTargetCallback6 GetDownTarget6() const override
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
Time m_minLifeTime
The min life time.
Definition: dsr-routing.h:898
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.
static TypeId GetTypeId()
Get the type identificator.
Definition: dsr-routing.cc:116
std::vector< Ipv4Address > m_clearList
The node that is clear to send packet to.
Definition: dsr-routing.h:943
void SendErrorRequest(DsrOptionRerrUnreachHeader &rerr, uint8_t protocol)
Send the error request packet.
void DoDispose() override
Drop trace callback.
Definition: dsr-routing.cc:565
int GetProtocolNumber() const override
Get the dsr protocol number.
Definition: dsr-routing.cc:803
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:927
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.
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:604
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 Insert(Ptr< dsr::DsrOptions > option)
Insert a new Dsr Option.
std::vector< Ipv4Address > m_finalRoute
The route cache.
Definition: dsr-routing.h:906
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:867
uint32_t m_maxCacheLen
Max # of cache entries for route cache.
Definition: dsr-routing.h:843
DSR send buffer.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:848
Every class exported by the ns3 library is enclosed in the ns3 namespace.