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
93/**
94 * \class DsrRouting
95 * \brief Dsr Routing base
96 */
98{
99 public:
100 /**
101 * \brief Get the type identificator.
102 * \return type identificator
103 */
104 static TypeId GetTypeId();
105 /**
106 * \brief Define the dsr protocol number.
107 */
108 static const uint8_t PROT_NUMBER;
109 /**
110 * \brief Constructor.
111 */
112 DsrRouting();
113 /**
114 * \brief Destructor.
115 */
116 ~DsrRouting() override;
117 /**
118 * \brief Get the node.
119 * \return the node
120 */
121 Ptr<Node> GetNode() const;
122 /**
123 * \brief Set the node.
124 * \param node the node to set
125 */
126 void SetNode(Ptr<Node> node);
127 /**
128 * \brief Set the route cache.
129 * \param r the route cache to set
130 */
132 /**
133 * \brief Get the route cache.
134 * \return the route cache
135 */
137 /**
138 * \brief Set the node.
139 * \param r the request table to set
140 */
142 /**
143 * \brief Get the request table.
144 * \return the request table
145 */
147 /**
148 * \brief Set the node.
149 * \param r the passive buffer to set
150 */
152 /**
153 * \brief Get the passive buffer
154 * \return the passive buffer
155 */
157
158 /**
159 * \brief Checks if the link is cached in the route cache
160 * See also DsrRouteCache::IsLinkCache
161 *
162 * \return true if the link is cached
163 */
164 bool IsLinkCache();
165
166 /**
167 * \brief Extends the lifetime of a route cache entry.
168 * See also DsrRouteCache::UseExtends
169 *
170 * \param rt the route to extend
171 */
173
174 /**
175 * \brief Lookup route cache entry with destination address dst
176 * See also DsrRouteCache::LookupRoute
177 *
178 * \param id destination address
179 * \param rt entry with destination address id, if exists
180 * \return true on success
181 */
183
184 /**
185 * \brief dd route link to cache
186 * See also DsrRouteCache::AddRoute_Link
187 *
188 * \param nodelist vector of nodes
189 * \param source ip address of node to add
190 * \return true if the link is cached
191 */
193
194 /**
195 * \brief Add route cache entry if it doesn't yet exist in route cache
196 * See also DsrRouteCache::AddRoute
197 *
198 * \param rt route cache entry
199 * \return true on success
200 */
202
203 /**
204 * \brief Delete all the routes which includes the link from next hop address that has just been
205 * notified as unreachable. See also DsrRouteCache::DeleteAllRoutesIncludeLink
206 *
207 * \param errorSrc The error source address
208 * \param unreachNode The unreachable node
209 * \param node This node's ip address
210 */
212 Ipv4Address unreachNode,
213 Ipv4Address node);
214
215 /**
216 * \brief Update route cache entry if it has been recently used and successfully delivered the
217 * data packet. See also DsrRouteCache::UpdateRouteEntry
218 *
219 * \param dst destination address of the route
220 * \return true in success
221 */
223
224 /**
225 * Find the source request entry in the route request queue, return false if not found.
226 * See also DsrRreqTable::FindSourceEntry
227 *
228 * \param src the source address we just received the source request
229 * \param dst the destination address the request is targeted at
230 * \param id the identification number for this request
231 * \return true if found, false otherwise
232 */
233 bool FindSourceEntry(Ipv4Address src, Ipv4Address dst, uint16_t id);
234
235 /**
236 * \brief Get the netdevice from the context.
237 * \param context context
238 * \return the netdevice we are looking for
239 */
240 Ptr<NetDevice> GetNetDeviceFromContext(std::string context);
241 /**
242 * \brief Get the elements from the tracing context.
243 * \param context context
244 * \return the elements we are looking for
245 */
246 std::vector<std::string> GetElementsFromContext(std::string context);
247 /**
248 * \brief Get the node id from ip address.
249 * \param address IPv4 address
250 * \return the node id
251 */
252 uint16_t GetIDfromIP(Ipv4Address address);
253 /**
254 * \brief Get the ip address from id.
255 * \param id unique ID
256 * \return the ip address for the id
257 */
258 Ipv4Address GetIPfromID(uint16_t id);
259 /**
260 * \brief Get the Ip address from mac address.
261 * \param address Mac48Address
262 * \return the ip address
263 */
265 /**
266 * \brief Get the node with give ip address.
267 * \param ipv4Address IPv4 address
268 * \return the node associated with the ip address
269 */
271 /**
272 * \brief Print the route vector.
273 * \param vec the vector to print.
274 */
275 void PrintVector(std::vector<Ipv4Address>& vec);
276 /**
277 * \brief Get the next hop of the route.
278 * \param ipv4Address
279 * \param vec Route
280 * \return the next hop address of the route
281 */
282 Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
283 /**
284 * \brief Get the dsr protocol number.
285 * \return protocol number
286 */
287 int GetProtocolNumber() const override;
288 /**
289 * \brief The send buffer timer expire.
290 */
291 void SendBuffTimerExpire();
292 /**
293 * \brief Check the send buffer of packets with route when send buffer timer expire.
294 */
295 void CheckSendBuffer();
296 /**
297 * \brief When route vector corrupted, originate a new packet, normally not happening.
298 * \param packet to route
299 * \param source address
300 * \param destination address
301 * \param protocol number
302 */
303 void PacketNewRoute(Ptr<Packet> packet,
304 Ipv4Address source,
305 Ipv4Address destination,
306 uint8_t protocol);
307 /**
308 * \brief Set the route to use for data packets,
309 * used by the option headers when sending data/control packets
310 * \param nextHop next hop IPv4 address
311 * \param srcAddress IPv4 address of the source
312 * \return the route
313 */
314 Ptr<Ipv4Route> SetRoute(Ipv4Address nextHop, Ipv4Address srcAddress);
315 /**
316 * \brief Set the priority of the packet in network queue
317 * \param messageType Message type
318 * \return the priority value
319 */
321 /**
322 * \brief This function is responsible for sending error packets in case of break link to next
323 * hop
324 * \param unreachNode unreachable node
325 * \param destination address
326 * \param originalDst address
327 * \param salvage packet flag
328 * \param protocol number
329 */
330 void SendUnreachError(Ipv4Address unreachNode,
331 Ipv4Address destination,
332 Ipv4Address originalDst,
333 uint8_t salvage,
334 uint8_t protocol);
335
336 /**
337 * \brief This function is responsible for forwarding error packets along the route
338 * \param rerr unreachable header
339 * \param sourceRoute source routing header
340 * \param nextHop IP address of next hop
341 * \param protocol number
342 * \param route IP route
343 */
345 DsrOptionSRHeader& sourceRoute,
346 Ipv4Address nextHop,
347 uint8_t protocol,
348 Ptr<Ipv4Route> route);
349 /**
350 * \brief This function is called by higher layer protocol when sending packets
351 * \param packet to send
352 * \param source IP address
353 * \param destination IP address
354 * \param protocol number
355 * \param route IP route
356 */
357 void Send(Ptr<Packet> packet,
358 Ipv4Address source,
359 Ipv4Address destination,
360 uint8_t protocol,
361 Ptr<Ipv4Route> route);
362 /**
363 * \brief This function is called to add ack request header for network acknowledgement
364 * \param packet for ack req
365 * \param nextHop IP address of the next hop
366 * \return ack ID
367 */
368 uint16_t AddAckReqHeader(Ptr<Packet>& packet, Ipv4Address nextHop);
369 /**
370 * \brief This function is called by when really sending out the packet
371 * \param packet to send
372 * \param source IP address
373 * \param nextHop IP address
374 * \param protocol number
375 */
376 void SendPacket(Ptr<Packet> packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol);
377 /**
378 * \brief This function is called to schedule sending packets from the network queue
379 * \param priority for sending
380 */
381 void Scheduler(uint32_t priority);
382 /**
383 * \brief This function is called to schedule sending packets from the network queue by priority
384 * \param priority schedule
385 * \param continueWithFirst use all priorities
386 */
387 void PriorityScheduler(uint32_t priority, bool continueWithFirst);
388 /**
389 * \brief This function is called to increase the retransmission timer for data packet in the
390 * network queue
391 */
393 /**
394 * \brief This function is called to send packets down stack
395 * \param newEntry queue entry
396 * \return true if success
397 */
398 bool SendRealDown(DsrNetworkQueueEntry& newEntry);
399 /**
400 * \brief This function is responsible for sending out data packets when have route, if no route
401 * found, it will cache the packet and send out route requests
402 * \param sourceRoute source route
403 * \param nextHop next hop IP address
404 * \param protocol number
405 */
406 void SendPacketFromBuffer(const DsrOptionSRHeader& sourceRoute,
407 Ipv4Address nextHop,
408 uint8_t protocol);
409 /**
410 * \brief Find the same passive entry
411 * \param packet to process
412 * \param source IP address
413 * \param destination IP address
414 * \param segsLeft segments left
415 * \param fragmentOffset
416 * \param identification
417 * \param saveEntry
418 * \return true if passive buffer entry
419 */
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
428 /**
429 * \brief Cancel all the packet timers
430 * \param mb maintain buffer entry
431 */
433 /**
434 * \brief Cancel the passive timer
435 * \param packet to process
436 * \param source IP address
437 * \param destination IP address
438 * \param segsLeft segments left
439 * \return
440 */
442 Ipv4Address source,
443 Ipv4Address destination,
444 uint8_t segsLeft);
445 /**
446 * \brief Call the cancel packet retransmission timer function
447 * \param ackId acknowledge ID
448 * \param ipv4Header header
449 * \param realSrc source IP address
450 * \param realDst destination IP address
451 */
452 void CallCancelPacketTimer(uint16_t ackId,
453 const Ipv4Header& ipv4Header,
454 Ipv4Address realSrc,
455 Ipv4Address realDst);
456 /**
457 * \brief Cancel the network packet retransmission timer for a specific maintenance entry
458 * \param mb maintain buffer entry
459 */
461 /**
462 * \brief Cancel the passive packet retransmission timer for a specific maintenance entry
463 * \param mb maintain buffer entry
464 */
466 /**
467 * \brief Cancel the link packet retransmission timer for a specific maintenance entry
468 * \param mb maintain buffer entry
469 */
471 /**
472 * \brief Cancel the packet retransmission timer for a all maintenance entries with nextHop
473 * address
474 * \param nextHop next hop IP address
475 * \param protocol number
476 */
477 void CancelPacketTimerNextHop(Ipv4Address nextHop, uint8_t protocol);
478 /**
479 * \brief Salvage the packet which has been transmitted for 3 times
480 * \param packet to process
481 * \param source IP address
482 * \param dst destination IP address
483 * \param protocol number
484 */
486 Ipv4Address source,
487 Ipv4Address dst,
488 uint8_t protocol);
489 /**
490 * \brief Schedule the packet retransmission based on link-layer acknowledgment
491 * \param mb maintenance buffer entry
492 * \param protocol the protocol number
493 */
494 void ScheduleLinkPacketRetry(DsrMaintainBuffEntry& mb, uint8_t protocol);
495 /**
496 * \brief Schedule the packet retransmission based on passive acknowledgment
497 * \param mb maintenance buffer entry
498 * \param protocol the protocol number
499 */
500 void SchedulePassivePacketRetry(DsrMaintainBuffEntry& mb, uint8_t protocol);
501 /**
502 * \brief Schedule the packet retransmission based on network layer acknowledgment
503 * \param mb maintenance buffer entry
504 * \param isFirst see if this is the first packet retry or not
505 * \param protocol the protocol number
506 */
507 void ScheduleNetworkPacketRetry(DsrMaintainBuffEntry& mb, bool isFirst, uint8_t protocol);
508 /**
509 * \brief This function deals with packet retransmission timer expire using link acknowledgment
510 * \param mb maintenance buffer entry
511 * \param protocol the protocol number
512 */
513 void LinkScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
514 /**
515 * \brief This function deals with packet retransmission timer expire using network
516 * acknowledgment
517 * \param mb maintenance buffer entry
518 * \param protocol the protocol number
519 */
520 void NetworkScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
521 /**
522 * \brief This function deals with packet retransmission timer expire using passive
523 * acknowledgment
524 * \param mb maintenance buffer entry
525 * \param protocol the protocol number
526 */
527 void PassiveScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
528 /**
529 * \brief Forward the packet using the route saved in the source route option header
530 * \param packet The packet
531 * \param sourceRoute Source route saved in option header
532 * \param ipv4Header IPv4 Header
533 * \param source source address
534 * \param destination destination address
535 * \param targetAddress target address
536 * \param protocol protocol number
537 * \param route route
538 */
540 DsrOptionSRHeader& sourceRoute,
541 const Ipv4Header& ipv4Header,
542 Ipv4Address source,
543 Ipv4Address destination,
544 Ipv4Address targetAddress,
545 uint8_t protocol,
546 Ptr<Ipv4Route> route);
547 /**
548 * \brief Broadcast the route request packet in subnet
549 * \param source source address
550 * \param destination destination address
551 * \param protocol protocol number
552 */
553 void SendInitialRequest(Ipv4Address source, Ipv4Address destination, uint8_t protocol);
554 /**
555 * \brief Send the error request packet
556 * \param rerr the route error header
557 * \param protocol the protocol number
558 */
559 void SendErrorRequest(DsrOptionRerrUnreachHeader& rerr, uint8_t protocol);
560 /**
561 * \brief Forward the route request if the node is not the destination
562 * \param packet the original packet
563 * \param source address
564 */
565 void SendRequest(Ptr<Packet> packet, Ipv4Address source);
566 /**
567 * \brief Schedule the intermediate route request
568 * \param packet the original packet
569 */
571 /**
572 * \brief Send the gratuitous reply
573 * \param replyTo The destination address to send the reply to
574 * \param replyFrom The source address sending the reply
575 * \param nodeList Route
576 * \param protocol the protocol number
577 */
578 void SendGratuitousReply(Ipv4Address replyTo,
579 Ipv4Address replyFrom,
580 std::vector<Ipv4Address>& nodeList,
581 uint8_t protocol);
582 /**
583 * Send the route reply back to the request originator with the cumulated route
584 *
585 * \param packet the original packet
586 * \param source IPv4 address of the source (i.e. request originator)
587 * \param nextHop IPv4 address of the next hop
588 * \param route Route
589 */
590 void SendReply(Ptr<Packet> packet,
591 Ipv4Address source,
592 Ipv4Address nextHop,
593 Ptr<Ipv4Route> route);
594 /**
595 * this is a generating the initial route reply from the destination address, a random delay
596 * time [0, m_broadcastJitter] is used before unicasting back the route reply packet
597 *
598 * \param packet the original packet
599 * \param source IPv4 address of the source (i.e. request originator)
600 * \param nextHop IPv4 address of the next hop
601 * \param route Route
602 */
604 Ipv4Address source,
605 Ipv4Address nextHop,
606 Ptr<Ipv4Route> route);
607 /**
608 * Schedule the cached reply to a random start time to avoid possible route reply storm
609 *
610 * \param packet the original packet
611 * \param source IPv4 address of the source (i.e. request originator)
612 * \param destination IPv4 address of the destination
613 * \param route Route
614 * \param hops number of hops
615 */
617 Ipv4Address source,
618 Ipv4Address destination,
619 Ptr<Ipv4Route> route,
620 double hops);
621 /**
622 * Send network layer acknowledgment back to the earlier hop to notify the receipt of data
623 * packet
624 *
625 * \param ackId ACK ID
626 * \param destination IPv4 address of the immediate ACK receiver
627 * \param realSrc IPv4 address of the real source
628 * \param realDst IPv4 address of the real destination
629 * \param protocol the protocol number
630 * \param route Route
631 */
632 void SendAck(uint16_t ackId,
633 Ipv4Address destination,
634 Ipv4Address realSrc,
635 Ipv4Address realDst,
636 uint8_t protocol,
637 Ptr<Ipv4Route> route);
638 /**
639 * \param p packet to forward up
640 * \param header IPv4 Header information
641 * \param incomingInterface the Ipv4Interface on which the packet arrived
642 * \return receive status
643 *
644 * Called from lower-level layers to send the packet up
645 * in the stack.
646 */
648 const Ipv4Header& header,
649 Ptr<Ipv4Interface> incomingInterface) override;
650
651 /**
652 * \param p packet to forward up
653 * \param header IPv6 Header information
654 * \param incomingInterface the Ipv6Interface on which the packet arrived
655 * \return receive status
656 *
657 * Called from lower-level layers to send the packet up
658 * in the stack. Not implemented (IPv6).
659 */
661 const Ipv6Header& header,
662 Ptr<Ipv6Interface> incomingInterface) override;
663
664 void SetDownTarget(IpL4Protocol::DownTargetCallback callback) override;
668 /**
669 * \brief Process method
670 * Called from Ipv4L3Protocol::Receive.
671 *
672 * \param packet the packet
673 * \param ipv4Header IPv4 header of the packet
674 * \param dst destination address of the packet received (i.e. us)
675 * \param nextHeader the next header
676 * \param protocol the protocol number
677 * \param isDropped if the packet must be dropped
678 * \return the size processed
679 */
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);
686 /**
687 * \brief Insert a new Dsr Option.
688 * \param option the option to insert
689 */
690 void Insert(Ptr<dsr::DsrOptions> option);
691 /**
692 * \brief Get the option corresponding to optionNumber.
693 * \param optionNumber the option number of the option to retrieve
694 * \return a matching Dsr option
695 */
696 Ptr<dsr::DsrOptions> GetOption(int optionNumber);
697 /**
698 * \brief Cancel the route request timer.
699 * \param dst The dst address of the route request timer
700 * \param isRemove whether to remove the route request entry or not
701 */
702 void CancelRreqTimer(Ipv4Address dst, bool isRemove);
703 /**
704 * \brief Schedule the route request retry.
705 * \param packet the original packet
706 * \param address List of IPv4 addresses
707 * \param nonProp flag if RREQ is non-propagating
708 * \param requestId Unique request ID
709 * \param protocol the protocol number
710 */
711 void ScheduleRreqRetry(Ptr<Packet> packet,
712 std::vector<Ipv4Address> address,
713 bool nonProp,
714 uint32_t requestId,
715 uint8_t protocol);
716 /**
717 * Handle route discovery timer
718 *
719 * \param packet the original packet
720 * \param address List of IPv4 addresses
721 * \param requestId Unique request ID
722 * \param protocol the protocol number
723 */
725 std::vector<Ipv4Address> address,
726 uint32_t requestId,
727 uint8_t protocol);
728
729 /**
730 * Assign a fixed random variable stream number to the random variables
731 * used by this model. Return the number of streams (possibly zero) that
732 * have been assigned.
733 *
734 * \param stream first stream index to use
735 * \return the number of stream indices assigned by this model
736 */
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;
747 /**
748 * \brief Drop trace callback.
749 */
750 void DoDispose() override;
751 /**
752 * The trace for drop, receive and send data packets
753 */
754 TracedCallback<Ptr<const Packet>> m_dropTrace; ///< packet drop trace callback
756
757 private:
758 void Start();
759 /**
760 * \brief Send the route error message when the link breaks to the next hop.
761 * \param nextHop next hop address
762 * \param protocol protocol number
763 */
764 void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop, uint8_t protocol);
765 /**
766 * \brief Promiscuous receive data packets destined to some other node.
767 * \param device The network device
768 * \param packet Data packet we just received
769 * \param protocol The protocol we receive, need to verify it is dsr protocol
770 * \param from The from address we received the packet
771 * \param to The address this packet is destined for
772 * \param packetType The dsr packet type, 0 is for control packet, 1 for data packet
773 * \return true if the packet was processed, false otherwise
774 */
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);
781 /**
782 * \brief Define the list to hold DSR options.
783 */
784 typedef std::list<Ptr<DsrOptions>> DsrOptionList_t;
785 /**
786 * \brief List of DSR Options supported.
787 */
789
790 Ptr<Ipv4L3Protocol> m_ipv4; ///< Ipv4l3Protocol
791
793
794 Ptr<Ipv4> m_ip; ///< The ip ptr
795
796 Ptr<Node> m_node; ///< The node ptr
797
798 Ipv4Address m_mainAddress; ///< Our own Ip address
799
800 uint8_t segsLeft; ///< The segment left value from SR header
801
802 IpL4Protocol::DownTargetCallback m_downTarget; ///< The callback for down layer
803
804 uint32_t m_maxNetworkSize; ///< Maximum network queue size
805
806 Time m_maxNetworkDelay; ///< Maximum network delay
807
808 uint32_t m_discoveryHopLimit; ///< Maximum hops to go for route request
809
810 uint8_t m_maxSalvageCount; ///< Maximum # times to salvage a packet
811
812 Time m_requestPeriod; ///< The base time interval between route requests
813
814 Time m_nonpropRequestTimeout; ///< The non-propagation request timeout
815
816 uint32_t m_sendRetries; ///< # of retries have been sent for network acknowledgment
817
818 uint32_t m_passiveRetries; ///< # of retries have been sent for passive acknowledgment
819
820 uint32_t m_linkRetries; ///< # of retries have been sent for link acknowledgment
821
822 uint32_t m_rreqRetries; ///< Maximum number of retransmissions of RREQ with TTL = NetDiameter to
823 ///< discover a route
824
825 uint32_t m_maxMaintRexmt; ///< Maximum number of retransmissions of data packets
826
827 Time m_nodeTraversalTime; ///< Time estimated for packet to travel between two nodes
828
829 uint32_t m_maxSendBuffLen; ///< The maximum number of packets that we allow a routing protocol
830 ///< to buffer.
831
832 Time m_sendBufferTimeout; ///< The maximum period of time that a routing protocol is allowed to
833 ///< buffer a packet for.
834
835 DsrSendBuffer m_sendBuffer; ///< The send buffer
836
837 DsrErrorBuffer m_errorBuffer; ///< The error buffer to save the error messages
838
839 uint32_t m_maxMaintainLen; ///< Max # of entries for maintenance buffer
840
841 Time m_maxMaintainTime; ///< Time out for maintenance buffer
842
843 uint32_t m_maxCacheLen; ///< Max # of cache entries for route cache
844
845 Time m_maxCacheTime; ///< Max time for caching the route cache entry
846
847 Time m_maxRreqTime; ///< Max time for caching the route request entry
848
849 uint32_t m_maxEntriesEachDst; ///< Max number of route entries to save for each destination
850
851 DsrMaintainBuffer m_maintainBuffer; ///< The declaration of maintain buffer
852
853 uint32_t m_requestId; ///< The id assigned to each route request
854
855 uint16_t m_ackId; ///< The ack id assigned to each acknowledge
856
857 uint32_t m_requestTableSize; ///< The max size of the request table size
858
859 uint32_t m_requestTableIds; ///< The request table identifiers
860
861 uint32_t m_maxRreqId; ///< The max number of request ids for a single destination
862
863 Time m_blacklistTimeout; ///< The black list time out
864
865 Ipv4Address m_broadcast; ///< The broadcast IP address
866
867 uint32_t m_broadcastJitter; ///< The max time to delay route request broadcast.
868
869 Time m_passiveAckTimeout; ///< The timeout value for passive acknowledge
870
872 m_tryPassiveAcks; ///< Maximum number of packet transmission using passive acknowledgment
873
874 Time m_linkAckTimeout; ///< The timeout value for link acknowledge
875
876 uint32_t m_tryLinkAcks; ///< Maximum number of packet transmission using link acknowledgment
877
878 Timer m_sendBuffTimer; ///< The send buffer timer
879
880 Time m_sendBuffInterval; ///< how often to check send buffer
881
882 Time m_gratReplyHoldoff; ///< The max gratuitous reply hold off time
883
884 Time m_maxRequestPeriod; ///< The max request period
885
886 uint32_t m_graReplyTableSize; ///< Set the gratuitous reply table size
887
888 std::string m_cacheType; ///< The type of route cache
889
890 std::string m_routeSortType; ///< The type of route sort methods
891
892 uint32_t m_stabilityDecrFactor; ///< The initial decrease factor for link cache
893
894 uint32_t m_stabilityIncrFactor; ///< The initial increase factor for link cache
895
896 Time m_initStability; ///< The initial stability value for link cache
897
898 Time m_minLifeTime; ///< The min life time
899
900 Time m_useExtends; ///< The use extension of the life time for link cache
901
902 bool m_subRoute; ///< Whether to save sub route or not
903
904 Time m_retransIncr; ///< the increase time for retransmission timer when face network congestion
905
906 std::vector<Ipv4Address> m_finalRoute; ///< The route cache
907
908 std::map<Ipv4Address, Timer> m_addressReqTimer; ///< Map IP address + RREQ timer.
909
910 std::map<Ipv4Address, Timer> m_nonPropReqTimer; ///< Map IP address + RREQ timer.
911
912 std::map<NetworkKey, Timer> m_addressForwardTimer; ///< Map network key + forward timer.
913
914 std::map<NetworkKey, uint32_t> m_addressForwardCnt; ///< Map network key + forward counts.
915
916 std::map<PassiveKey, uint32_t> m_passiveCnt; ///< Map packet key + passive forward counts.
917
918 std::map<PassiveKey, Timer> m_passiveAckTimer; ///< The timer for passive acknowledgment
919
920 std::map<LinkKey, uint32_t> m_linkCnt; ///< Map packet key + link forward counts.
921
922 std::map<LinkKey, Timer> m_linkAckTimer; ///< The timer for link acknowledgment
923
925 m_routeCache; ///< A "drop-front" queue used by the routing layer to cache routes found.
926
927 Ptr<dsr::DsrRreqTable> m_rreqTable; ///< A "drop-front" queue used by the routing layer to cache
928 ///< route request sent.
929
930 Ptr<dsr::DsrPassiveBuffer> m_passiveBuffer; ///< A "drop-front" queue used by the routing layer
931 ///< to cache route request sent.
932
933 uint32_t m_numPriorityQueues; ///< The number of priority queues used
934
935 bool m_linkAck; ///< define if we use link acknowledgement or not
936
937 std::map<uint32_t, Ptr<dsr::DsrNetworkQueue>> m_priorityQueue; ///< priority queues
938
939 DsrGraReply m_graReply; ///< The gratuitous route reply.
940
941 DsrNetworkQueue m_networkQueue; ///< The network queue.
942
943 std::vector<Ipv4Address> m_clearList; ///< The node that is clear to send packet to
944
945 std::vector<Ipv4Address> m_addresses; ///< The bind ipv4 addresses with next hop, src,
946 ///< destination address in sequence
947
948 std::map<std::string, uint32_t> m_macToNodeIdMap; ///< The map of mac address to node id
949
950 Ptr<UniformRandomVariable> m_uniformRandomVariable; ///< Provides uniform random variables.
951};
952} /* namespace dsr */
953} /* namespace ns3 */
954
955#endif /* DSR_ROUTING_H */
a polymophic address class
Definition: address.h:101
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:77
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:78
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:624
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:863
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:590
void SendBuffTimerExpire()
The send buffer timer expire.
Definition: dsr-routing.cc:852
void SetPassiveBuffer(Ptr< dsr::DsrPassiveBuffer > r)
Set the node.
Definition: dsr-routing.cc:631
std::vector< std::string > GetElementsFromContext(std::string context)
Get the elements from the tracing context.
Definition: dsr-routing.cc:548
void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt)
Extends the lifetime of a route cache entry.
Definition: dsr-routing.cc:669
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:737
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:681
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:809
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:536
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:712
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:638
Ipv4Address GetIPfromMAC(Mac48Address address)
Get the Ip address from mac address.
Definition: dsr-routing.cc:718
Ptr< dsr::DsrRouteCache > GetRouteCache() const
Get the route cache.
Definition: dsr-routing.cc:610
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:617
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:839
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:698
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:663
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:791
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:675
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:758
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:645
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:706
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:596
Ipv4Address GetIPfromID(uint16_t id)
Get the ip address from id.
Definition: dsr-routing.cc:825
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:689
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:564
int GetProtocolNumber() const override
Get the dsr protocol number.
Definition: dsr-routing.cc:802
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:603
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:839
Every class exported by the ns3 library is enclosed in the ns3 namespace.