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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Yufei Cheng <yfcheng@ittc.ku.edu>
7 * Modified by: Tommaso Pecorella <tommaso.pecorella@unifi.it>
8 * Lorenzo Bartolini <l.bartolini02@gmail.com>
9 *
10 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
11 * ResiliNets Research Group https://resilinets.org/
12 * Information and Telecommunication Technology Center (ITTC)
13 * and Department of Electrical Engineering and Computer Science
14 * The University of Kansas Lawrence, KS USA.
15 *
16 * Work supported in part by NSF FIND (Future Internet Design) Program
17 * under grant CNS-0626918 (Postmodern Internet Architecture),
18 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
19 * US Department of Defense (DoD), and ITTC at The University of Kansas.
20 */
21
22#ifndef DSR_ROUTING_H
23#define DSR_ROUTING_H
24
25#include "dsr-errorbuff.h"
27#include "dsr-maintain-buff.h"
28#include "dsr-network-queue.h"
29#include "dsr-option-header.h"
30#include "dsr-passive-buff.h"
31#include "dsr-rcache.h"
32#include "dsr-rreq-table.h"
33#include "dsr-rsendbuff.h"
34
35#include "ns3/buffer.h"
36#include "ns3/callback.h"
37#include "ns3/event-garbage-collector.h"
38#include "ns3/icmpv4-l4-protocol.h"
39#include "ns3/ip-l4-protocol.h"
40#include "ns3/ipv4-address.h"
41#include "ns3/ipv4-header.h"
42#include "ns3/ipv4-interface.h"
43#include "ns3/ipv4-l3-protocol.h"
44#include "ns3/ipv4-route.h"
45#include "ns3/ipv4.h"
46#include "ns3/net-device.h"
47#include "ns3/node.h"
48#include "ns3/object.h"
49#include "ns3/output-stream-wrapper.h"
50#include "ns3/packet.h"
51#include "ns3/ptr.h"
52#include "ns3/random-variable-stream.h"
53#include "ns3/socket.h"
54#include "ns3/test.h"
55#include "ns3/timer.h"
56#include "ns3/traced-callback.h"
57#include "ns3/wifi-mac.h"
58
59#include <cassert>
60#include <list>
61#include <map>
62#include <stdint.h>
63#include <sys/types.h>
64#include <vector>
65
66namespace ns3
67{
68
69class Packet;
70class Node;
71class Ipv4;
72class Ipv4Address;
73class Ipv4Header;
74class Ipv4Interface;
75class Ipv4L3Protocol;
76class Time;
77
78namespace dsr
79{
80
81class DsrOptions;
82
83/**
84 * @defgroup dsr Dynamic Source Routing (DSR)
85 *
86 * This section documents the API of the Dynamic Source Routing Protocol based on RFC 4728
87 * with some modifications. For a generic functional description, please refer to the ns-3
88 * model library document.
89 */
90
91/**
92 * @ingroup dsr
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 NS_DEPRECATED_3_49("Use the numbers in iana-intenernet-protocols-numbers.h instead")
109 static constexpr uint8_t PROT_NUMBER = 48;
110 /**
111 * @brief Define the NO_NEXT_HEADER to set in control packets.
112 */
113 NS_DEPRECATED_3_49("Use the numbers in iana-intenernet-protocols-numbers.h instead")
114 static constexpr uint8_t NO_NEXT_HEADER = 59;
115 /**
116 * @brief Constructor.
117 */
118 DsrRouting();
119 /**
120 * @brief Destructor.
121 */
122 ~DsrRouting() override;
123 /**
124 * @brief Get the node.
125 * @return the node
126 */
127 Ptr<Node> GetNode() const;
128 /**
129 * @brief Set the node.
130 * @param node the node to set
131 */
132 void SetNode(Ptr<Node> node);
133 /**
134 * @brief Set the route cache.
135 * @param r the route cache to set
136 */
138 /**
139 * @brief Get the route cache.
140 * @return the route cache
141 */
143 /**
144 * @brief Set the node.
145 * @param r the request table to set
146 */
148 /**
149 * @brief Get the request table.
150 * @return the request table
151 */
153 /**
154 * @brief Set the node.
155 * @param r the passive buffer to set
156 */
158 /**
159 * @brief Get the passive buffer
160 * @return the passive buffer
161 */
163
164 /**
165 * @brief Checks if the link is cached in the route cache
166 * See also DsrRouteCache::IsLinkCache
167 *
168 * @return true if the link is cached
169 */
170 bool IsLinkCache();
171
172 /**
173 * @brief Extends the lifetime of a route cache entry.
174 * See also DsrRouteCache::UseExtends
175 *
176 * @param rt the route to extend
177 */
178 void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt);
179
180 /**
181 * @brief Lookup route cache entry with destination address dst
182 * See also DsrRouteCache::LookupRoute
183 *
184 * @param id destination address
185 * @param rt entry with destination address id, if exists
186 * @return true on success
187 */
189
190 /**
191 * @brief dd route link to cache
192 * See also DsrRouteCache::AddRoute_Link
193 *
194 * @param nodelist vector of nodes
195 * @param source ip address of node to add
196 * @return true if the link is cached
197 */
198 bool AddRoute_Link(DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source);
199
200 /**
201 * @brief Add route cache entry if it doesn't yet exist in route cache
202 * See also DsrRouteCache::AddRoute
203 *
204 * @param rt route cache entry
205 * @return true on success
206 */
208
209 /**
210 * @brief Delete all the routes which includes the link from next hop address that has just been
211 * notified as unreachable. See also DsrRouteCache::DeleteAllRoutesIncludeLink
212 *
213 * @param errorSrc The error source address
214 * @param unreachNode The unreachable node
215 * @param node This node's ip address
216 */
218 Ipv4Address unreachNode,
219 Ipv4Address node);
220
221 /**
222 * @brief Update route cache entry if it has been recently used and successfully delivered the
223 * data packet. See also DsrRouteCache::UpdateRouteEntry
224 *
225 * @param dst destination address of the route
226 * @return true in success
227 */
229
230 /**
231 * Find the source request entry in the route request queue, return false if not found.
232 * See also DsrRreqTable::FindSourceEntry
233 *
234 * @param src the source address we just received the source request
235 * @param dst the destination address the request is targeted at
236 * @param id the identification number for this request
237 * @return true if found, false otherwise
238 */
239 bool FindSourceEntry(Ipv4Address src, Ipv4Address dst, uint16_t id);
240
241 /**
242 * @brief Get the netdevice from the context.
243 * @param context context
244 * @return the netdevice we are looking for
245 */
246 Ptr<NetDevice> GetNetDeviceFromContext(std::string context);
247 /**
248 * @brief Get the elements from the tracing context.
249 * @param context context
250 * @return the elements we are looking for
251 */
252 std::vector<std::string> GetElementsFromContext(std::string context);
253 /**
254 * @brief Get the Ip address from mac address.
255 * @param address Mac48Address
256 * @return the ip address
257 */
259 /**
260 * @brief Get the node with give ip address.
261 * @param ipv4Address IPv4 address
262 * @return the node associated with the ip address
263 */
265 /**
266 * @brief Print the route vector.
267 * @param vec the vector to print.
268 */
269 void PrintVector(std::vector<Ipv4Address>& vec);
270 /**
271 * @brief Get the next hop of the route.
272 * @param ipv4Address
273 * @param vec Route
274 * @return the next hop address of the route
275 */
277 /**
278 * @brief Get the dsr protocol number.
279 * @return protocol number
280 */
281 int GetProtocolNumber() const override;
282 /**
283 * @brief The send buffer timer expire.
284 */
285 void SendBuffTimerExpire();
286 /**
287 * @brief Check the send buffer of packets with route when send buffer timer expire.
288 */
289 void CheckSendBuffer();
290 /**
291 * @brief When route vector corrupted, originate a new packet, normally not happening.
292 * @param packet to route
293 * @param source address
294 * @param destination address
295 * @param protocol number
296 */
297 void PacketNewRoute(Ptr<Packet> packet,
298 Ipv4Address source,
299 Ipv4Address destination,
300 uint8_t protocol);
301 /**
302 * @brief Set the route to use for data packets,
303 * used by the option headers when sending data/control packets
304 * @param nextHop next hop IPv4 address
305 * @param srcAddress IPv4 address of the source
306 * @return the route
307 */
308 Ptr<Ipv4Route> SetRoute(Ipv4Address nextHop, Ipv4Address srcAddress);
309 /**
310 * @brief Set the priority of the packet in network queue
311 * @param messageType Message type
312 * @return the priority value
313 */
315 /**
316 * @brief This function is responsible for sending error packets in case of break link to next
317 * hop
318 * @param unreachNode unreachable node
319 * @param destination address
320 * @param originalDst address
321 * @param salvage packet flag
322 * @param protocol number
323 */
324 void SendUnreachError(Ipv4Address unreachNode,
325 Ipv4Address destination,
326 Ipv4Address originalDst,
327 uint8_t salvage,
328 uint8_t protocol);
329
330 /**
331 * @brief This function is responsible for forwarding error packets along the route
332 * @param rerr unreachable header
333 * @param sourceRoute source routing header
334 * @param nextHop IP address of next hop
335 * @param route IP route
336 */
338 DsrOptionSRHeader& sourceRoute,
339 Ipv4Address nextHop,
340 Ptr<Ipv4Route> route);
341 /**
342 * @brief This function is called by higher layer protocol when sending packets
343 * @param packet to send
344 * @param source IP address
345 * @param destination IP address
346 * @param protocol number
347 * @param route IP route
348 */
349 void Send(Ptr<Packet> packet,
350 Ipv4Address source,
351 Ipv4Address destination,
352 uint8_t protocol,
353 Ptr<Ipv4Route> route);
354 /**
355 * @brief This function is called to add ack request header for network acknowledgement
356 * @param packet for ack req
357 * @param nextHop IP address of the next hop
358 * @return ack ID
359 */
360 uint16_t AddAckReqHeader(Ptr<Packet>& packet, Ipv4Address nextHop);
361 /**
362 * @brief This function is called by when really sending out the packet
363 * @param packet to send
364 * @param source IP address
365 * @param nextHop IP address
366 */
367 void SendPacket(Ptr<Packet> packet, Ipv4Address source, Ipv4Address nextHop);
368 /**
369 * @brief This function is called to schedule sending packets from the network queue
370 * @param priority for sending
371 */
372 void Scheduler(uint32_t priority);
373 /**
374 * @brief This function is called to schedule sending packets from the network queue by priority
375 * @param priority schedule
376 * @param continueWithFirst use all priorities
377 */
378 void PriorityScheduler(uint32_t priority, bool continueWithFirst);
379 /**
380 * @brief This function is called to increase the retransmission timer for data packet in the
381 * network queue
382 */
384 /**
385 * @brief This function is called to send packets down stack
386 * @param newEntry queue entry
387 * @return true if success
388 */
389 bool SendRealDown(DsrNetworkQueueEntry& newEntry);
390 /**
391 * @brief This function is responsible for sending out data packets when have route, if no route
392 * found, it will cache the packet and send out route requests
393 * @param sourceRoute source route
394 * @param nextHop next hop IP address
395 * @param protocol number
396 */
397 void SendPacketFromBuffer(const DsrOptionSRHeader& sourceRoute,
398 Ipv4Address nextHop,
399 uint8_t protocol);
400 /**
401 * @brief Find the same passive entry
402 * @param packet to process
403 * @param source IP address
404 * @param destination IP address
405 * @param segsLeft segments left
406 * @param fragmentOffset
407 * @param identification
408 * @param saveEntry
409 * @return true if passive buffer entry
410 */
411 bool PassiveEntryCheck(Ptr<Packet> packet,
412 Ipv4Address source,
413 Ipv4Address destination,
414 uint8_t segsLeft,
415 uint16_t fragmentOffset,
416 uint16_t identification,
417 bool saveEntry);
418
419 /**
420 * @brief Cancel all the packet timers
421 * @param mb maintain buffer entry
422 */
424 /**
425 * @brief Cancel the passive timer
426 * @param packet to process
427 * @param source IP address
428 * @param destination IP address
429 * @param segsLeft segments left
430 * @return
431 */
432 bool CancelPassiveTimer(Ptr<Packet> packet,
433 Ipv4Address source,
434 Ipv4Address destination,
435 uint8_t segsLeft);
436 /**
437 * @brief Call the cancel packet retransmission timer function
438 * @param ackId acknowledge ID
439 * @param ipv4Header header
440 * @param realSrc source IP address
441 * @param realDst destination IP address
442 */
443 void CallCancelPacketTimer(uint16_t ackId,
444 const Ipv4Header& ipv4Header,
445 Ipv4Address realSrc,
446 Ipv4Address realDst);
447 /**
448 * @brief Cancel the network packet retransmission timer for a specific maintenance entry
449 * @param mb maintain buffer entry
450 */
452 /**
453 * @brief Cancel the passive packet retransmission timer for a specific maintenance entry
454 * @param mb maintain buffer entry
455 */
457 /**
458 * @brief Cancel the link packet retransmission timer for a specific maintenance entry
459 * @param mb maintain buffer entry
460 */
462 /**
463 * @brief Cancel the packet retransmission timer for a all maintenance entries with nextHop
464 * address
465 * @param nextHop next hop IP address
466 * @param protocol number
467 */
468 void CancelPacketTimerNextHop(Ipv4Address nextHop, uint8_t protocol);
469 /**
470 * @brief Salvage the packet which has been transmitted for 3 times
471 * @param packet to process
472 * @param source IP address
473 * @param dst destination IP address
474 * @param protocol number
475 */
476 void SalvagePacket(Ptr<const Packet> packet,
477 Ipv4Address source,
478 Ipv4Address dst,
479 uint8_t protocol);
480 /**
481 * @brief Schedule the packet retransmission based on link-layer acknowledgment
482 * @param mb maintenance buffer entry
483 * @param protocol the protocol number
484 */
485 void ScheduleLinkPacketRetry(DsrMaintainBuffEntry& mb, uint8_t protocol);
486 /**
487 * @brief Schedule the packet retransmission based on passive acknowledgment
488 * @param mb maintenance buffer entry
489 * @param protocol the protocol number
490 */
491 void SchedulePassivePacketRetry(DsrMaintainBuffEntry& mb, uint8_t protocol);
492 /**
493 * @brief Schedule the packet retransmission based on network layer acknowledgment
494 * @param mb maintenance buffer entry
495 * @param isFirst see if this is the first packet retry or not
496 * @param protocol the protocol number
497 */
498 void ScheduleNetworkPacketRetry(DsrMaintainBuffEntry& mb, bool isFirst, uint8_t protocol);
499 /**
500 * @brief This function deals with packet retransmission timer expire using link acknowledgment
501 * @param mb maintenance buffer entry
502 * @param protocol the protocol number
503 */
504 void LinkScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
505 /**
506 * @brief This function deals with packet retransmission timer expire using network
507 * acknowledgment
508 * @param mb maintenance buffer entry
509 * @param protocol the protocol number
510 */
511 void NetworkScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
512 /**
513 * @brief This function deals with packet retransmission timer expire using passive
514 * acknowledgment
515 * @param mb maintenance buffer entry
516 * @param protocol the protocol number
517 */
518 void PassiveScheduleTimerExpire(DsrMaintainBuffEntry& mb, uint8_t protocol);
519 /**
520 * @brief Forward the packet using the route saved in the source route option header
521 * @param packet The packet
522 * @param sourceRoute Source route saved in option header
523 * @param ipv4Header IPv4 Header
524 * @param source source address
525 * @param destination destination address
526 * @param targetAddress target address
527 * @param protocol protocol number
528 * @param route route
529 */
530 void ForwardPacket(Ptr<const Packet> packet,
531 DsrOptionSRHeader& sourceRoute,
532 const Ipv4Header& ipv4Header,
533 Ipv4Address source,
534 Ipv4Address destination,
535 Ipv4Address targetAddress,
536 uint8_t protocol,
537 Ptr<Ipv4Route> route);
538 /**
539 * @brief Broadcast the route request packet in subnet
540 * @param source source address
541 * @param destination destination address
542 */
543 void SendInitialRequest(Ipv4Address source, Ipv4Address destination);
544 /**
545 * @brief Send the error request packet
546 * @param rerr the route error header
547 * @param protocol the protocol number
548 */
549 void SendErrorRequest(DsrOptionRerrUnreachHeader& rerr, uint8_t protocol);
550 /**
551 * @brief Forward the route request if the node is not the destination
552 * @param packet the original packet
553 * @param source address
554 */
555 void SendRequest(Ptr<Packet> packet, Ipv4Address source);
556 /**
557 * @brief Schedule the intermediate route request
558 * @param packet the original packet
559 * @param source the original source IP address to preserve in the IP header
560 */
561 void ScheduleInterRequest(Ptr<Packet> packet, Ipv4Address source);
562 /**
563 * @brief Send the gratuitous reply
564 * @param replyTo The destination address to send the reply to
565 * @param replyFrom The source address sending the reply
566 * @param nodeList Route
567 * @param protocol the protocol number
568 */
569 void SendGratuitousReply(Ipv4Address replyTo,
570 Ipv4Address replyFrom,
571 std::vector<Ipv4Address>& nodeList,
572 uint8_t protocol);
573 /**
574 * Send the route reply back to the request originator with the cumulated route
575 *
576 * @param packet the original packet
577 * @param source IPv4 address of the source (i.e. request originator)
578 * @param nextHop IPv4 address of the next hop
579 * @param route Route
580 */
581 void SendReply(Ptr<Packet> packet,
582 Ipv4Address source,
583 Ipv4Address nextHop,
584 Ptr<Ipv4Route> route);
585 /**
586 * this is a generating the initial route reply from the destination address, a random delay
587 * time [0, m_broadcastJitter] is used before unicasting back the route reply packet
588 *
589 * @param packet the original packet
590 * @param source IPv4 address of the source (i.e. request originator)
591 * @param nextHop IPv4 address of the next hop
592 * @param route Route
593 */
594 void ScheduleInitialReply(Ptr<Packet> packet,
595 Ipv4Address source,
596 Ipv4Address nextHop,
597 Ptr<Ipv4Route> route);
598 /**
599 * Schedule the cached reply to a random start time to avoid possible route reply storm
600 *
601 * @param packet the original packet
602 * @param source IPv4 address of the source (i.e. request originator)
603 * @param destination IPv4 address of the destination
604 * @param route Route
605 * @param hops number of hops
606 */
607 void ScheduleCachedReply(Ptr<Packet> packet,
608 Ipv4Address source,
609 Ipv4Address destination,
610 Ptr<Ipv4Route> route,
611 double hops);
612 /**
613 * Send network layer acknowledgment back to the earlier hop to notify the receipt of data
614 * packet
615 *
616 * @param ackId ACK ID
617 * @param destination IPv4 address of the immediate ACK receiver
618 * @param realSrc IPv4 address of the real source
619 * @param realDst IPv4 address of the real destination
620 * @param route Route
621 */
622 void SendAck(uint16_t ackId,
623 Ipv4Address destination,
624 Ipv4Address realSrc,
625 Ipv4Address realDst,
626 Ptr<Ipv4Route> route);
627 /**
628 * @param p packet to forward up
629 * @param header IPv4 Header information
630 * @param incomingInterface the Ipv4Interface on which the packet arrived
631 * @return receive status
632 *
633 * Called from lower-level layers to send the packet up
634 * in the stack.
635 */
637 const Ipv4Header& header,
638 Ptr<Ipv4Interface> incomingInterface) override;
639
640 /**
641 * @param p packet to forward up
642 * @param header IPv6 Header information
643 * @param incomingInterface the Ipv6Interface on which the packet arrived
644 * @return receive status
645 *
646 * Called from lower-level layers to send the packet up
647 * in the stack. Not implemented (IPv6).
648 */
650 const Ipv6Header& header,
651 Ptr<Ipv6Interface> incomingInterface) override;
652
653 void SetDownTarget(IpL4Protocol::DownTargetCallback callback) override;
654 void SetDownTarget6(IpL4Protocol::DownTargetCallback6 callback) override;
657 /**
658 * @brief Process method
659 * Called from Ipv4L3Protocol::Receive.
660 *
661 * @param packet the packet
662 * @param ipv4Header IPv4 header of the packet
663 * @param dst destination address of the packet received (i.e. us)
664 * @param nextHeader the next header
665 * @param protocol the protocol number
666 * @param isDropped if the packet must be dropped
667 * @return the size processed
668 */
669 uint8_t Process(Ptr<Packet>& packet,
670 const Ipv4Header& ipv4Header,
671 Ipv4Address dst,
672 uint8_t* nextHeader,
673 uint8_t protocol,
674 bool& isDropped);
675 /**
676 * @brief Insert a new Dsr Option.
677 * @param option the option to insert
678 */
679 void Insert(Ptr<dsr::DsrOptions> option);
680 /**
681 * @brief Get the option corresponding to optionNumber.
682 * @param optionNumber the option number of the option to retrieve
683 * @return a matching Dsr option
684 */
685 Ptr<dsr::DsrOptions> GetOption(int optionNumber);
686 /**
687 * @brief Cancel the route request timer.
688 * @param dst The dst address of the route request timer
689 * @param isRemove whether to remove the route request entry or not
690 */
691 void CancelRreqTimer(Ipv4Address dst, bool isRemove);
692 /**
693 * @brief Schedule the route request retry.
694 * @param packet the original packet
695 * @param address List of IPv4 addresses
696 * @param nonProp flag if RREQ is non-propagating
697 * @param requestId Unique request ID
698 * @param protocol the protocol number
699 */
700 void ScheduleRreqRetry(Ptr<Packet> packet,
701 std::vector<Ipv4Address> address,
702 bool nonProp,
703 uint32_t requestId,
704 uint8_t protocol);
705 /**
706 * Handle route discovery timer
707 *
708 * @param packet the original packet
709 * @param address List of IPv4 addresses
710 * @param requestId Unique request ID
711 * @param protocol the protocol number
712 */
714 std::vector<Ipv4Address> address,
715 uint32_t requestId,
716 uint8_t protocol);
717
718 /**
719 * Assign a fixed random variable stream number to the random variables
720 * used by this model. Return the number of streams (possibly zero) that
721 * have been assigned.
722 *
723 * @param stream first stream index to use
724 * @return the number of stream indices assigned by this model
725 */
726 int64_t AssignStreams(int64_t stream);
727
728 protected:
729 /*
730 * * This function will notify other components connected to the node that a new stack member
731 * is now connected
732 * * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect
733 * them together.
734 * */
735 void NotifyNewAggregate() override;
736 /**
737 * @brief Drop trace callback.
738 */
739 void DoDispose() override;
740 /**
741 * The trace for drop, receive and send data packets
742 */
743 TracedCallback<Ptr<const Packet>> m_dropTrace; ///< packet drop trace callback
744 TracedCallback<const DsrOptionSRHeader&> m_txPacketTrace; ///< packet trace callback
745
746 private:
747 /**
748 * @brief Starts the routing protocol
749 */
750 void Start();
751 /**
752 * @brief Send the route error message when the link breaks to the next hop.
753 * @param nextHop next hop address
754 * @param protocol protocol number
755 */
756 void SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop, uint8_t protocol);
757 /**
758 * @brief Promiscuous receive data packets destined to some other node.
759 * @param device The network device
760 * @param packet Data packet we just received
761 * @param protocol The protocol we receive, need to verify it is dsr protocol
762 * @param from The from address we received the packet
763 * @param to The address this packet is destined for
764 * @param packetType The dsr packet type, 0 is for control packet, 1 for data packet
765 * @return true if the packet was processed, false otherwise
766 */
767 bool PromiscReceive(Ptr<NetDevice> device,
768 Ptr<const Packet> packet,
769 uint16_t protocol,
770 const Address& from,
771 const Address& to,
772 NetDevice::PacketType packetType);
773 /**
774 * @brief Define the list to hold DSR options.
775 */
777 /**
778 * @brief List of DSR Options supported.
779 */
781
782 Ptr<Ipv4L3Protocol> m_ipv4; ///< Ipv4l3Protocol
783
784 Ptr<Ipv4Route> m_ipv4Route; ///< Ipv4 Route
785
786 Ptr<Ipv4> m_ip; ///< The ip ptr
787
788 Ptr<Node> m_node; ///< The node ptr
789
790 Ipv4Address m_mainAddress; ///< Our own Ip address
791
792 uint8_t segsLeft; ///< The segment left value from SR header
793
794 IpL4Protocol::DownTargetCallback m_downTarget; ///< The callback for down layer
795
796 uint32_t m_maxNetworkSize; ///< Maximum network queue size
797
798 Time m_maxNetworkDelay; ///< Maximum network delay
799
800 uint32_t m_discoveryHopLimit; ///< Maximum hops to go for route request
801
802 uint8_t m_maxSalvageCount; ///< Maximum # times to salvage a packet
803
804 Time m_requestPeriod; ///< The base time interval between route requests
805
806 Time m_nonpropRequestTimeout; ///< The non-propagation request timeout
807
808 uint32_t m_sendRetries; ///< # of retries have been sent for network acknowledgment
809
810 uint32_t m_passiveRetries; ///< # of retries have been sent for passive acknowledgment
811
812 uint32_t m_linkRetries; ///< # of retries have been sent for link acknowledgment
813
814 uint32_t m_rreqRetries; ///< Maximum number of retransmissions of RREQ with TTL = NetDiameter to
815 ///< discover a route
816
817 uint32_t m_maxMaintRexmt; ///< Maximum number of retransmissions of data packets
818
819 Time m_nodeTraversalTime; ///< Time estimated for packet to travel between two nodes
820
821 uint32_t m_maxSendBuffLen; ///< The maximum number of packets that we allow a routing protocol
822 ///< to buffer.
823
824 Time m_sendBufferTimeout; ///< The maximum period of time that a routing protocol is allowed to
825 ///< buffer a packet for.
826
827 DsrSendBuffer m_sendBuffer; ///< The send buffer
828
829 DsrErrorBuffer m_errorBuffer; ///< The error buffer to save the error messages
830
831 uint32_t m_maxMaintainLen; ///< Max # of entries for maintenance buffer
832
833 Time m_maxMaintainTime; ///< Time out for maintenance buffer
834
835 uint32_t m_maxCacheLen; ///< Max # of cache entries for route cache
836
837 Time m_maxCacheTime; ///< Max time for caching the route cache entry
838
839 Time m_maxRreqTime; ///< Max time for caching the route request entry
840
841 uint32_t m_maxEntriesEachDst; ///< Max number of route entries to save for each destination
842
843 DsrMaintainBuffer m_maintainBuffer; ///< The declaration of maintain buffer
844
845 uint32_t m_requestId; ///< The id assigned to each route request
846
847 uint16_t m_ackId; ///< The ack id assigned to each acknowledge
848
849 uint32_t m_requestTableSize; ///< The max size of the request table size
850
851 uint32_t m_requestTableIds; ///< The request table identifiers
852
853 uint32_t m_maxRreqId; ///< The max number of request ids for a single destination
854
855 Time m_blacklistTimeout; ///< The black list time out
856
857 Ipv4Address m_broadcast; ///< The broadcast IP address
858
859 uint32_t m_broadcastJitter; ///< The max time to delay route request broadcast.
860
861 Time m_passiveAckTimeout; ///< The timeout value for passive acknowledge
862
864 m_tryPassiveAcks; ///< Maximum number of packet transmission using passive acknowledgment
865
866 Time m_linkAckTimeout; ///< The timeout value for link acknowledge
867
868 uint32_t m_tryLinkAcks; ///< Maximum number of packet transmission using link acknowledgment
869
870 Timer m_sendBuffTimer; ///< The send buffer timer
871
872 Time m_sendBuffInterval; ///< how often to check send buffer
873
874 Time m_gratReplyHoldoff; ///< The max gratuitous reply hold off time
875
876 Time m_maxRequestPeriod; ///< The max request period
877
878 uint32_t m_graReplyTableSize; ///< Set the gratuitous reply table size
879
880 std::string m_cacheType; ///< The type of route cache
881
882 std::string m_routeSortType; ///< The type of route sort methods
883
884 uint32_t m_stabilityDecrFactor; ///< The initial decrease factor for link cache
885
886 uint32_t m_stabilityIncrFactor; ///< The initial increase factor for link cache
887
888 Time m_initStability; ///< The initial stability value for link cache
889
890 Time m_minLifeTime; ///< The min life time
891
892 Time m_useExtends; ///< The use extension of the life time for link cache
893
894 bool m_subRoute; ///< Whether to save sub route or not
895
896 Time m_retransIncr; ///< the increase time for retransmission timer when face network congestion
897
898 std::vector<Ipv4Address> m_finalRoute; ///< The route cache
899
900 std::map<Ipv4Address, Timer> m_addressReqTimer; ///< Map IP address + RREQ timer.
901
902 std::map<Ipv4Address, Timer> m_nonPropReqTimer; ///< Map IP address + RREQ timer.
903
904 std::map<NetworkKey, Timer> m_addressForwardTimer; ///< Map network key + forward timer.
905
906 std::map<NetworkKey, uint32_t> m_addressForwardCnt; ///< Map network key + forward counts.
907
908 std::map<PassiveKey, uint32_t> m_passiveCnt; ///< Map packet key + passive forward counts.
909
910 std::map<PassiveKey, Timer> m_passiveAckTimer; ///< The timer for passive acknowledgment
911
912 std::map<LinkKey, uint32_t> m_linkCnt; ///< Map packet key + link forward counts.
913
914 std::map<LinkKey, Timer> m_linkAckTimer; ///< The timer for link acknowledgment
915
917 m_routeCache; ///< A "drop-front" queue used by the routing layer to cache routes found.
918
919 Ptr<dsr::DsrRreqTable> m_rreqTable; ///< A "drop-front" queue used by the routing layer to cache
920 ///< route request sent.
921
922 Ptr<dsr::DsrPassiveBuffer> m_passiveBuffer; ///< A "drop-front" queue used by the routing layer
923 ///< to cache route request sent.
924
925 uint32_t m_numPriorityQueues; ///< The number of priority queues used
926
927 bool m_linkAck; ///< define if we use link acknowledgement or not
928
929 std::map<uint32_t, Ptr<dsr::DsrNetworkQueue>> m_priorityQueue; ///< priority queues
930
931 DsrGraReply m_graReply; ///< The gratuitous route reply.
932
933 DsrNetworkQueue m_networkQueue; ///< The network queue.
934
935 std::vector<Ipv4Address> m_clearList; ///< The node that is clear to send packet to
936
937 std::vector<Ipv4Address> m_addresses; ///< The bind ipv4 addresses with next hop, src,
938 ///< destination address in sequence
939
940 std::map<std::string, uint32_t> m_macToNodeIdMap; ///< The map of mac address to node id
941
942 Ptr<UniformRandomVariable> m_uniformRandomVariable; ///< Provides uniform random variables.
943};
944} /* namespace dsr */
945} /* namespace ns3 */
946
947#endif /* DSR_ROUTING_H */
uint32_t r
a polymophic address class
Definition address.h:114
L4 Protocol abstract base class.
Callback< void, Ptr< Packet >, Ipv4Address, Ipv4Address, uint8_t, Ptr< Ipv4Route > > DownTargetCallback
callback to send packets over IPv4
Callback< void, Ptr< Packet >, Ipv6Address, Ipv6Address, uint8_t, Ptr< Ipv6Route > > DownTargetCallback6
callback to send packets over IPv6
RxStatus
Rx status codes.
Ipv4 addresses are stored in host order in this class.
Packet header for IPv4.
Definition ipv4-header.h:23
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition ipv4.h:69
The IPv4 representation of a network interface.
Implement the IPv4 layer.
IPv4 route cache entry (similar to Linux struct rtable).
Definition ipv4-route.h:31
Packet header for IPv6.
Definition ipv6-header.h:24
The IPv6 representation of a network interface.
an EUI-48 address
Network layer to device interface.
Definition net-device.h:87
A network Node.
Definition node.h:46
network packets
Definition packet.h:228
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
A simple virtual Timer class.
Definition timer.h:67
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:50
The uniform distribution Random Number Generator (RNG).
maintain the gratuitous reply
DSR Maintain Buffer Entry.
DSR Network Queue Entry.
Route Error (RERR) Unreachable node address option Message Format.
Header of Dsr Option Source Route.
DsrRouteCacheEntry class for entries in the route cache.
Definition dsr-rcache.h:218
DSR route request queue Since DSR is an on demand routing we queue requests while looking for route.
Definition dsr-rcache.h:365
Ptr< dsr::DsrRreqTable > GetRequestTable() const
Get the request table.
std::string m_routeSortType
The type of route sort methods.
void CheckSendBuffer()
Check the send buffer of packets with route when send buffer timer expire.
Ptr< Ipv4 > m_ip
The ip ptr.
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.
Time m_blacklistTimeout
The black list time out.
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.
std::map< Ipv4Address, Timer > m_nonPropReqTimer
Map IP address + RREQ timer.
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.
void SendBuffTimerExpire()
The send buffer timer expire.
void SetPassiveBuffer(Ptr< dsr::DsrPassiveBuffer > r)
Set the node.
std::vector< std::string > GetElementsFromContext(std::string context)
Get the elements from the tracing context.
void UseExtends(DsrRouteCacheEntry::IP_VECTOR rt)
Extends the lifetime of a route cache entry.
uint32_t m_maxRreqId
The max number of request ids for a single destination.
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.
uint8_t segsLeft
The segment left value from SR header.
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
void PrintVector(std::vector< Ipv4Address > &vec)
Print the route vector.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
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.
static constexpr uint8_t PROT_NUMBER
Define the dsr protocol number.
bool AddRoute_Link(DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source)
dd route link to cache See also DsrRouteCache::AddRoute_Link
uint16_t m_ackId
The ack id assigned to each acknowledge.
DsrRouting()
Constructor.
void CancelLinkPacketTimer(DsrMaintainBuffEntry &mb)
Cancel the link packet retransmission timer for a specific maintenance entry.
Time m_nonpropRequestTimeout
The non-propagation request timeout.
Time m_gratReplyHoldoff
The max gratuitous reply hold off time.
std::list< Ptr< DsrOptions > > DsrOptionList_t
Define the list to hold DSR options.
std::map< uint32_t, Ptr< dsr::DsrNetworkQueue > > m_priorityQueue
priority queues
uint32_t m_maxEntriesEachDst
Max number of route entries to save for each destination.
std::map< Ipv4Address, Timer > m_addressReqTimer
Map IP address + RREQ timer.
void ForwardErrPacket(DsrOptionRerrUnreachHeader &rerr, DsrOptionSRHeader &sourceRoute, Ipv4Address nextHop, Ptr< Ipv4Route > route)
This function is responsible for forwarding error packets along the route.
Time m_retransIncr
the increase time for retransmission timer when face network congestion
std::map< NetworkKey, Timer > m_addressForwardTimer
Map network key + forward timer.
DsrNetworkQueue m_networkQueue
The network queue.
uint32_t m_stabilityDecrFactor
The initial decrease factor for link cache.
Time m_nodeTraversalTime
Time estimated for packet to travel between two nodes.
uint32_t m_requestId
The id assigned to each route request.
std::map< NetworkKey, uint32_t > m_addressForwardCnt
Map network key + forward counts.
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Get the netdevice from the context.
bool FindSourceEntry(Ipv4Address src, Ipv4Address dst, uint16_t id)
Find the source request entry in the route request queue, return false if not found.
Ipv4Address m_broadcast
The broadcast IP address.
Ptr< dsr::DsrPassiveBuffer > GetPassiveBuffer() const
Get the passive buffer.
Ipv4Address GetIPfromMAC(Mac48Address address)
Get the Ip address from mac address.
Ptr< dsr::DsrRouteCache > GetRouteCache() const
Get the route cache.
Time m_maxNetworkDelay
Maximum network delay.
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.
Time m_passiveAckTimeout
The timeout value for passive acknowledge.
void SetRequestTable(Ptr< dsr::DsrRreqTable > r)
Set the node.
void ScheduleInterRequest(Ptr< Packet > packet, Ipv4Address source)
Schedule the intermediate route request.
uint32_t m_maxMaintainLen
Max # of entries for maintenance buffer.
uint32_t GetPriority(DsrMessageType messageType)
Set the priority of the packet in network queue.
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.
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.
Time m_maxCacheTime
Max time for caching the route cache entry.
void SendGratuitousReply(Ipv4Address replyTo, Ipv4Address replyFrom, std::vector< Ipv4Address > &nodeList, uint8_t protocol)
Send the gratuitous reply.
static constexpr uint8_t NO_NEXT_HEADER
Define the NO_NEXT_HEADER to set in control packets.
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...
DsrOptionList_t m_options
List of DSR Options supported.
std::map< PassiveKey, uint32_t > m_passiveCnt
Map packet key + passive forward counts.
DsrErrorBuffer m_errorBuffer
The error buffer to save the error messages.
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.
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.
std::map< LinkKey, uint32_t > m_linkCnt
Map packet key + link forward counts.
DsrSendBuffer m_sendBuffer
The send buffer.
uint32_t m_rreqRetries
Maximum number of retransmissions of RREQ with TTL = NetDiameter to discover a route.
uint8_t m_maxSalvageCount
Maximum # times to salvage a packet.
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.
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.
uint32_t m_requestTableSize
The max size of the request table size.
DsrGraReply m_graReply
The gratuitous route reply.
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
TracedCallback< const DsrOptionSRHeader & > m_txPacketTrace
packet trace callback
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.
Time m_initStability
The initial stability value for link cache.
uint32_t m_stabilityIncrFactor
The initial increase factor for link cache.
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.
uint32_t m_numPriorityQueues
The number of priority queues used.
Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Get the next hop of the route.
IpL4Protocol::DownTargetCallback m_downTarget
The callback for down layer.
uint32_t m_graReplyTableSize
Set the gratuitous reply table size.
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.
Ptr< Ipv4L3Protocol > m_ipv4
Ipv4l3Protocol.
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 Start()
Starts the routing protocol.
void SendPacket(Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop)
This function is called by when really sending out the packet.
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.
TracedCallback< Ptr< const Packet > > m_dropTrace
The trace for drop, receive and send data packets.
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.
std::map< std::string, uint32_t > m_macToNodeIdMap
The map of mac address to node id.
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.
uint32_t m_maxNetworkSize
Maximum network queue size.
Ptr< Ipv4Route > m_ipv4Route
Ipv4 Route.
void SendAck(uint16_t ackId, Ipv4Address destination, Ipv4Address realSrc, Ipv4Address realDst, Ptr< Ipv4Route > route)
Send network layer acknowledgment back to the earlier hop to notify the receipt of data packet.
Ptr< Node > GetNode() const
Get the node.
Time m_maxRequestPeriod
The max request period.
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.
Ptr< Node > m_node
The node ptr.
Ptr< dsr::DsrRouteCache > m_routeCache
A "drop-front" queue used by the routing layer to cache routes found.
std::map< PassiveKey, Timer > m_passiveAckTimer
The timer for passive acknowledgment.
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn't yet exist in route cache See also DsrRouteCache::AddRoute.
Time m_maxMaintainTime
Time out for maintenance buffer.
DsrMaintainBuffer m_maintainBuffer
The declaration of maintain buffer.
uint32_t m_maxMaintRexmt
Maximum number of retransmissions of data packets.
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.
Time m_linkAckTimeout
The timeout value for link acknowledge.
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.
uint32_t m_discoveryHopLimit
Maximum hops to go for route request.
void CancelRreqTimer(Ipv4Address dst, bool isRemove)
Cancel the route request timer.
std::map< LinkKey, Timer > m_linkAckTimer
The timer for link acknowledgment.
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.
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.
std::vector< Ipv4Address > m_clearList
The node that is clear to send packet to.
void SendErrorRequest(DsrOptionRerrUnreachHeader &rerr, uint8_t protocol)
Send the error request packet.
void DoDispose() override
Drop trace callback.
int GetProtocolNumber() const override
Get the dsr protocol number.
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.
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 SendInitialRequest(Ipv4Address source, Ipv4Address destination)
Broadcast the route request packet in subnet.
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 SetRouteCache(Ptr< dsr::DsrRouteCache > r)
Set the route cache.
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.
void CancelPacketAllTimer(DsrMaintainBuffEntry &mb)
Cancel all the packet timers.
uint32_t m_broadcastJitter
The max time to delay route request broadcast.
uint32_t m_maxCacheLen
Max # of cache entries for route cache.
maintain list of DsrRreqTable entry
STL class.
#define NS_DEPRECATED_3_49(msg)
Tag for things deprecated in version ns-3.49.
Definition deprecated.h:91
DsrMessageType
Flag used to prioritize packets.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
STL namespace.
#define private
#define list
NetworkKey structure.
PassiveKey structure.