A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
dsr-options.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_OPTION_H
32#define DSR_OPTION_H
33
35#include "dsr-maintain-buff.h"
36#include "dsr-option-header.h"
37#include "dsr-rcache.h"
38#include "dsr-routing.h"
39#include "dsr-rsendbuff.h"
40
41#include "ns3/buffer.h"
42#include "ns3/callback.h"
43#include "ns3/ipv4-address.h"
44#include "ns3/ipv4-header.h"
45#include "ns3/ipv4-interface.h"
46#include "ns3/ipv4-route.h"
47#include "ns3/ipv4.h"
48#include "ns3/node.h"
49#include "ns3/object.h"
50#include "ns3/output-stream-wrapper.h"
51#include "ns3/packet.h"
52#include "ns3/ptr.h"
53#include "ns3/timer.h"
54#include "ns3/traced-callback.h"
55#include "ns3/udp-l4-protocol.h"
56
57#include <list>
58#include <map>
59
60namespace ns3
61{
62
63class Packet;
64class NetDevice;
65class Node;
66class Ipv4Address;
67class Ipv4Interface;
68class Ipv4Route;
69class Ipv4;
70class Time;
71
72namespace dsr
73{
74
75class DsrOptions : public Object
76{
77 public:
78 /**
79 * \brief Get the type identificator.
80 * \return type identificator
81 */
82 static TypeId GetTypeId();
83 /**
84 * \brief Constructor.
85 */
86 DsrOptions();
87 /**
88 * \brief Destructor.
89 */
90 ~DsrOptions() override;
91 /**
92 * \brief Get the option number.
93 * \return option number
94 */
95 virtual uint8_t GetOptionNumber() const = 0;
96 /**
97 * \brief Set the node.
98 * \param node the node to set
99 */
100 void SetNode(Ptr<Node> node);
101 /**
102 * \brief Get the node.
103 * \return the node
104 */
105 Ptr<Node> GetNode() const;
106 /**
107 * \brief Search for the ipv4 address in the node list.
108 *
109 * \param ipv4Address IPv4 address to search for
110 * \param destAddress IPv4 address in the list that we begin the search
111 * \param nodeList List of IPv4 addresses
112 * \return true if contain ip address
113 */
114 bool ContainAddressAfter(Ipv4Address ipv4Address,
115 Ipv4Address destAddress,
116 std::vector<Ipv4Address>& nodeList);
117 /**
118 * \brief Cut the route from ipv4Address to the end of the route vector
119 *
120 * \param ipv4Address the address to begin cutting
121 * \param nodeList List of IPv4 addresses
122 * \return the vector after the route cut
123 */
124 std::vector<Ipv4Address> CutRoute(Ipv4Address ipv4Address, std::vector<Ipv4Address>& nodeList);
125 /**
126 * \brief Set the route to use for data packets,
127 * used by the option headers when sending data/control packets
128 *
129 * \param nextHop IPv4 address of the next hop
130 * \param srcAddress IPv4 address of the source
131 * \return the route
132 */
133 virtual Ptr<Ipv4Route> SetRoute(Ipv4Address nextHop, Ipv4Address srcAddress);
134 /**
135 * \brief Reverse the routes.
136 *
137 * \param vec List of IPv4 addresses
138 * \return true if successfully reversed
139 */
140 bool ReverseRoutes(std::vector<Ipv4Address>& vec);
141 /**
142 * \brief Search for the next hop in the route
143 *
144 * \param ipv4Address the IPv4 address of the node we are looking for its next hop address
145 * \param vec List of IPv4 addresses
146 * \return the next hop address if found
147 */
148 Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
149 /**
150 * \brief Reverse search for the next hop in the route
151 *
152 * \param ipv4Address the IPv4 address of the node we are looking for its next hop address
153 * \param vec List of IPv4 addresses
154 * \return the previous next hop address if found
155 */
156 Ipv4Address ReverseSearchNextHop(Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
157 /**
158 * \brief Reverse search for the next two hop in the route
159 *
160 * \param ipv4Address the IPv4 address of the node we are looking for its next two hop address
161 * \param vec List of IPv4 addresses
162 * \return the previous next two hop address if found
163 */
164 Ipv4Address ReverseSearchNextTwoHop(Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
165 /**
166 * \brief Print out the elements in the route vector
167 * \param vec The route vector to print.
168 */
169 void PrintVector(std::vector<Ipv4Address>& vec);
170 /**
171 * \brief Check if the two vectors contain duplicate or not
172 *
173 * \param vec the first list of IPv4 addresses
174 * \param vec2 the second list of IPv4 addresses
175 * \return true if contains duplicate
176 */
177 bool IfDuplicates(std::vector<Ipv4Address>& vec, std::vector<Ipv4Address>& vec2);
178 /**
179 * \brief Check if the route already contains the node ip address
180 *
181 * \param ipv4Address the IPv4 address that we are looking for
182 * \param vec List of IPv4 addresses
183 * \return true if it already exists
184 */
185 bool CheckDuplicates(Ipv4Address ipv4Address, std::vector<Ipv4Address>& vec);
186 /**
187 * \brief Remove the duplicates from the route
188 *
189 * \param [in,out] vec List of IPv4 addresses to clean
190 */
191 void RemoveDuplicates(std::vector<Ipv4Address>& vec);
192 /**
193 * \brief Schedule the intermediate node route request broadcast
194 * \param packet the original packet
195 * \param nodeList The list of IPv4 addresses
196 * \param source address
197 * \param destination address
198 */
200 std::vector<Ipv4Address>& nodeList,
201 Ipv4Address& source,
202 Ipv4Address& destination);
203 /**
204 * \brief Get the node id with Ipv4Address
205 *
206 * \param address IPv4 address to look for ID
207 * \return the id of the node
208 */
210 /**
211 * \brief Get the node object with Ipv4Address
212 *
213 * \param ipv4Address IPv4 address of the node
214 * \return the object of the node
215 */
217 /**
218 * \brief Process method
219 *
220 * Called from DsrRouting::Receive.
221 * \param packet the packet
222 * \param dsrP the clean packet with payload
223 * \param ipv4Address the IPv4 address
224 * \param source IPv4 address of the source
225 * \param ipv4Header the IPv4 header of packet received
226 * \param protocol the protocol number of the up layer
227 * \param isPromisc if the packet must be dropped
228 * \param promiscSource IPv4 address
229 * \return the processed size
230 */
231 virtual uint8_t Process(Ptr<Packet> packet,
232 Ptr<Packet> dsrP,
233 Ipv4Address ipv4Address,
234 Ipv4Address source,
235 const Ipv4Header& ipv4Header,
236 uint8_t protocol,
237 bool& isPromisc,
238 Ipv4Address promiscSource) = 0;
239
240 protected:
241 /**
242 * \brief Drop trace callback.
243 */
245 /**
246 * \brief The broadcast IP address.
247 */
249 /**
250 * \brief The route request table.
251 */
253 /**
254 * \brief The route cache table.
255 */
257 /**
258 * \brief The ipv4 route.
259 */
261 /**
262 * \brief The ipv4.
263 */
265 /**
266 * \brief The vector of Ipv4 address.
267 */
268 std::vector<Ipv4Address> m_ipv4Address;
269 /**
270 * \brief The vector of final Ipv4 address.
271 */
272 std::vector<Ipv4Address> m_finalRoute;
273 /**
274 * \brief The active route timeout value.
275 */
277 /**
278 * The receive trace back, only triggered when final destination receive data packet
279 */
281
282 private:
283 Ptr<Node> m_node; ///< the node
284};
285
286/**
287 * \class DsrOptionPad1
288 * \brief Dsr Option Pad1
289 */
291{
292 public:
293 /**
294 * \brief Pad1 option number.
295 */
296 static const uint8_t OPT_NUMBER = 224;
297
298 /**
299 * \brief Get the type ID.
300 * \return the object TypeId
301 */
302 static TypeId GetTypeId();
303
305 ~DsrOptionPad1() override;
306
307 uint8_t GetOptionNumber() const override;
308 uint8_t Process(Ptr<Packet> packet,
309 Ptr<Packet> dsrP,
310 Ipv4Address ipv4Address,
311 Ipv4Address source,
312 const Ipv4Header& ipv4Header,
313 uint8_t protocol,
314 bool& isPromisc,
315 Ipv4Address promiscSource) override;
316};
317
318/**
319 * \class DsrOptionPadn
320 * \brief IPv4 Option Padn
321 */
323{
324 public:
325 /**
326 * \brief PadN option number.
327 */
328 static const uint8_t OPT_NUMBER = 0;
329
330 /**
331 * \brief Get the type ID.
332 * \return the object TypeId
333 */
334 static TypeId GetTypeId();
335
337 ~DsrOptionPadn() override;
338
339 uint8_t GetOptionNumber() const override;
340 uint8_t Process(Ptr<Packet> packet,
341 Ptr<Packet> dsrP,
342 Ipv4Address ipv4Address,
343 Ipv4Address source,
344 const Ipv4Header& ipv4Header,
345 uint8_t protocol,
346 bool& isPromisc,
347 Ipv4Address promiscSource) override;
348};
349
350/**
351 * \class DsrOptionRreq
352 * \brief Dsr Option Rreq
353 */
355{
356 public:
357 /**
358 * \brief Rreq option number.
359 */
360 static const uint8_t OPT_NUMBER = 1;
361
362 /**
363 * \brief Get the type ID.
364 * \return the object TypeId
365 */
366 static TypeId GetTypeId();
367 /**
368 * \brief Get the instance type ID.
369 * \return instance type ID
370 */
371 TypeId GetInstanceTypeId() const override;
372 /**
373 * \brief Constructor.
374 */
376 /**
377 * \brief Destructor.
378 */
379 ~DsrOptionRreq() override;
380
381 uint8_t GetOptionNumber() const override;
382 uint8_t Process(Ptr<Packet> packet,
383 Ptr<Packet> dsrP,
384 Ipv4Address ipv4Address,
385 Ipv4Address source,
386 const Ipv4Header& ipv4Header,
387 uint8_t protocol,
388 bool& isPromisc,
389 Ipv4Address promiscSource) override;
390
391 private:
392 /**
393 * \brief The route cache.
394 */
396 /**
397 * \brief The ipv4.
398 */
400};
401
402/**
403 * \class DsrOptionRrep
404 * \brief Dsr Option Route Reply
405 */
407{
408 public:
409 /**
410 * \brief Router alert option number.
411 */
412 static const uint8_t OPT_NUMBER = 2;
413
414 /**
415 * \brief Get the type ID.
416 * \return the object TypeId
417 */
418 static TypeId GetTypeId();
419 /**
420 * \brief Get the instance type ID.
421 * \return instance type ID
422 */
423 TypeId GetInstanceTypeId() const override;
424
426 ~DsrOptionRrep() override;
427
428 uint8_t GetOptionNumber() const override;
429 uint8_t Process(Ptr<Packet> packet,
430 Ptr<Packet> dsrP,
431 Ipv4Address ipv4Address,
432 Ipv4Address source,
433 const Ipv4Header& ipv4Header,
434 uint8_t protocol,
435 bool& isPromisc,
436 Ipv4Address promiscSource) override;
437
438 private:
439 /**
440 * \brief The route cache.
441 */
443 /**
444 * \brief The ip layer 3.
445 */
447};
448
449/**
450 * \class DsrOptionSR
451 * \brief Dsr Option Source Route
452 */
454{
455 public:
456 /**
457 * \brief Source Route option number.
458 */
459 static const uint8_t OPT_NUMBER = 96;
460
461 /**
462 * \brief Get the type ID.
463 * \return the object TypeId
464 */
465 static TypeId GetTypeId();
466 /**
467 * \brief Get the instance type ID.
468 * \return instance type ID
469 */
470 TypeId GetInstanceTypeId() const override;
471
472 DsrOptionSR();
473 ~DsrOptionSR() override;
474
475 uint8_t GetOptionNumber() const override;
476 uint8_t Process(Ptr<Packet> packet,
477 Ptr<Packet> dsrP,
478 Ipv4Address ipv4Address,
479 Ipv4Address source,
480 const Ipv4Header& ipv4Header,
481 uint8_t protocol,
482 bool& isPromisc,
483 Ipv4Address promiscSource) override;
484
485 private:
486 /**
487 * \brief The ip layer 3.
488 */
490};
491
492/**
493 * \class DsrOptionRerr
494 * \brief Dsr Option Route Error
495 */
497{
498 public:
499 /**
500 * \brief Dsr Route Error option number.
501 */
502 static const uint8_t OPT_NUMBER = 3;
503
504 /**
505 * \brief Get the type ID.
506 * \return the object TypeId
507 */
508 static TypeId GetTypeId();
509 /**
510 * \brief Get the instance type ID.
511 * \return instance type ID
512 */
513 TypeId GetInstanceTypeId() const override;
514
516 ~DsrOptionRerr() override;
517
518 uint8_t GetOptionNumber() const override;
519 uint8_t Process(Ptr<Packet> packet,
520 Ptr<Packet> dsrP,
521 Ipv4Address ipv4Address,
522 Ipv4Address source,
523 const Ipv4Header& ipv4Header,
524 uint8_t protocol,
525 bool& isPromisc,
526 Ipv4Address promiscSource) override;
527 /**
528 * \brief Do Send error message
529 *
530 * \param p the packet
531 * \param rerr the DsrOptionRerrUnreachHeader header
532 * \param rerrSize the route error header size
533 * \param ipv4Address ipv4 address of our own
534 * \param protocol the protocol number of the up layer
535 * \return the processed size
536 */
537 uint8_t DoSendError(Ptr<Packet> p,
539 uint32_t rerrSize,
540 Ipv4Address ipv4Address,
541 uint8_t protocol);
542
543 private:
544 /**
545 * \brief The route cache.
546 */
548 /**
549 * \brief The ipv4 layer 3.
550 */
552};
553
554/**
555 * \class DsrOptionAckReq
556 * \brief Dsr Option
557 */
559{
560 public:
561 /**
562 * \brief Dsr ack request option number.
563 */
564 static const uint8_t OPT_NUMBER = 160;
565
566 /**
567 * \brief Get the type ID.
568 * \return the object TypeId
569 */
570 static TypeId GetTypeId();
571 /**
572 * \brief Get the instance type ID.
573 * \return instance type ID
574 */
575 TypeId GetInstanceTypeId() const override;
576
578 ~DsrOptionAckReq() override;
579
580 uint8_t GetOptionNumber() const override;
581 uint8_t Process(Ptr<Packet> packet,
582 Ptr<Packet> dsrP,
583 Ipv4Address ipv4Address,
584 Ipv4Address source,
585 const Ipv4Header& ipv4Header,
586 uint8_t protocol,
587 bool& isPromisc,
588 Ipv4Address promiscSource) override;
589
590 private:
591 /**
592 * \brief The route cache.
593 */
595 /**
596 * \brief The ipv4 layer 3.
597 */
599};
600
601/**
602 * \class DsrOptionAck
603 * \brief Dsr Option Ack
604 */
606{
607 public:
608 /**
609 * \brief The Dsr Ack option number.
610 */
611 static const uint8_t OPT_NUMBER = 32;
612
613 /**
614 * \brief Get the type ID.
615 * \return the object TypeId
616 */
617 static TypeId GetTypeId();
618 /**
619 * \brief Get the instance type ID.
620 * \return instance type ID
621 */
622 TypeId GetInstanceTypeId() const override;
623
624 DsrOptionAck();
625 ~DsrOptionAck() override;
626
627 uint8_t GetOptionNumber() const override;
628 uint8_t Process(Ptr<Packet> packet,
629 Ptr<Packet> dsrP,
630 Ipv4Address ipv4Address,
631 Ipv4Address source,
632 const Ipv4Header& ipv4Header,
633 uint8_t protocol,
634 bool& isPromisc,
635 Ipv4Address promiscSource) override;
636
637 private:
638 /**
639 * \brief The route cache.
640 */
642 /**
643 * \brief The ipv4 layer 3.
644 */
646};
647} // namespace dsr
648} // Namespace ns3
649
650#endif
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Packet header for IPv4.
Definition: ipv4-header.h:34
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Dsr Option Ack.
Definition: dsr-options.h:606
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
Ptr< Ipv4 > m_ipv4
The ipv4 layer 3.
Definition: dsr-options.h:645
TypeId GetInstanceTypeId() const override
Get the instance type ID.
static const uint8_t OPT_NUMBER
The Dsr Ack option number.
Definition: dsr-options.h:611
static TypeId GetTypeId()
Get the type ID.
Ptr< dsr::DsrRouteCache > m_routeCache
The route cache.
Definition: dsr-options.h:641
uint8_t GetOptionNumber() const override
Get the option number.
static TypeId GetTypeId()
Get the type ID.
uint8_t GetOptionNumber() const override
Get the option number.
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
static const uint8_t OPT_NUMBER
Dsr ack request option number.
Definition: dsr-options.h:564
Ptr< dsr::DsrRouteCache > m_routeCache
The route cache.
Definition: dsr-options.h:594
Ptr< Ipv4 > m_ipv4
The ipv4 layer 3.
Definition: dsr-options.h:598
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Dsr Option Pad1.
Definition: dsr-options.h:291
uint8_t GetOptionNumber() const override
Get the option number.
Definition: dsr-options.cc:400
static TypeId GetTypeId()
Get the type ID.
Definition: dsr-options.cc:380
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
Definition: dsr-options.cc:408
static const uint8_t OPT_NUMBER
Pad1 option number.
Definition: dsr-options.h:296
IPv4 Option Padn.
Definition: dsr-options.h:323
static const uint8_t OPT_NUMBER
PadN option number.
Definition: dsr-options.h:328
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
Definition: dsr-options.cc:458
static TypeId GetTypeId()
Get the type ID.
Definition: dsr-options.cc:431
uint8_t GetOptionNumber() const override
Get the option number.
Definition: dsr-options.cc:451
Dsr Option Route Error.
Definition: dsr-options.h:497
Ptr< Ipv4 > m_ipv4
The ipv4 layer 3.
Definition: dsr-options.h:551
uint8_t DoSendError(Ptr< Packet > p, DsrOptionRerrUnreachHeader &rerr, uint32_t rerrSize, Ipv4Address ipv4Address, uint8_t protocol)
Do Send error message.
Ptr< dsr::DsrRouteCache > m_routeCache
The route cache.
Definition: dsr-options.h:547
static const uint8_t OPT_NUMBER
Dsr Route Error option number.
Definition: dsr-options.h:502
static TypeId GetTypeId()
Get the type ID.
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
uint8_t GetOptionNumber() const override
Get the option number.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Route Error (RERR) Unreachable node address option Message Format.
Dsr Option Route Reply.
Definition: dsr-options.h:407
Ptr< Ipv4 > m_ipv4
The ip layer 3.
Definition: dsr-options.h:446
static const uint8_t OPT_NUMBER
Router alert option number.
Definition: dsr-options.h:412
static TypeId GetTypeId()
Get the type ID.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint8_t GetOptionNumber() const override
Get the option number.
Ptr< dsr::DsrRouteCache > m_routeCache
The route cache.
Definition: dsr-options.h:442
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
Dsr Option Rreq.
Definition: dsr-options.h:355
static TypeId GetTypeId()
Get the type ID.
Definition: dsr-options.cc:482
Ptr< Ipv4 > m_ipv4
The ipv4.
Definition: dsr-options.h:399
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition: dsr-options.cc:492
static const uint8_t OPT_NUMBER
Rreq option number.
Definition: dsr-options.h:360
Ptr< dsr::DsrRouteCache > m_routeCache
The route cache.
Definition: dsr-options.h:395
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
Definition: dsr-options.cc:516
uint8_t GetOptionNumber() const override
Get the option number.
Definition: dsr-options.cc:508
~DsrOptionRreq() override
Destructor.
Definition: dsr-options.cc:502
DsrOptionRreq()
Constructor.
Definition: dsr-options.cc:497
Dsr Option Source Route.
Definition: dsr-options.h:454
TypeId GetInstanceTypeId() const override
Get the instance type ID.
static const uint8_t OPT_NUMBER
Source Route option number.
Definition: dsr-options.h:459
Ptr< Ipv4 > m_ipv4
The ip layer 3.
Definition: dsr-options.h:489
uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource) override
Process method.
uint8_t GetOptionNumber() const override
Get the option number.
static TypeId GetTypeId()
Get the type ID.
Introspection did not find any typical Config paths.
Definition: dsr-options.h:76
Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Search for the next hop in the route.
Definition: dsr-options.cc:175
Ipv4Address ReverseSearchNextTwoHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Reverse search for the next two hop in the route.
Definition: dsr-options.cc:234
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, const Ipv4Header &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)=0
Process method.
TracedCallback< Ptr< const Packet > > m_dropTrace
Drop trace callback.
Definition: dsr-options.h:244
Ptr< Node > GetNodeWithAddress(Ipv4Address ipv4Address)
Get the node object with Ipv4Address.
Definition: dsr-options.cc:360
DsrOptions()
Constructor.
Definition: dsr-options.cc:98
Ptr< Node > GetNode() const
Get the node.
Definition: dsr-options.cc:116
Time ActiveRouteTimeout
The active route timeout value.
Definition: dsr-options.h:276
bool CheckDuplicates(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Check if the route already contains the node ip address.
Definition: dsr-options.cc:292
void SetNode(Ptr< Node > node)
Set the node.
Definition: dsr-options.cc:109
virtual uint8_t GetOptionNumber() const =0
Get the option number.
Ptr< dsr::DsrRreqTable > m_rreqTable
The route request table.
Definition: dsr-options.h:252
~DsrOptions() override
Destructor.
Definition: dsr-options.cc:103
std::vector< Ipv4Address > m_finalRoute
The vector of final Ipv4 address.
Definition: dsr-options.h:272
void PrintVector(std::vector< Ipv4Address > &vec)
Print out the elements in the route vector.
Definition: dsr-options.cc:254
bool IfDuplicates(std::vector< Ipv4Address > &vec, std::vector< Ipv4Address > &vec2)
Check if the two vectors contain duplicate or not.
Definition: dsr-options.cc:275
bool ReverseRoutes(std::vector< Ipv4Address > &vec)
Reverse the routes.
Definition: dsr-options.cc:165
void RemoveDuplicates(std::vector< Ipv4Address > &vec)
Remove the duplicates from the route.
Definition: dsr-options.cc:306
uint32_t GetIDfromIP(Ipv4Address address)
Get the node id with Ipv4Address.
Definition: dsr-options.cc:343
Ipv4Address Broadcast
The broadcast IP address.
Definition: dsr-options.h:248
static TypeId GetTypeId()
Get the type identificator.
Definition: dsr-options.cc:77
std::vector< Ipv4Address > CutRoute(Ipv4Address ipv4Address, std::vector< Ipv4Address > &nodeList)
Cut the route from ipv4Address to the end of the route vector.
Definition: dsr-options.cc:141
bool ContainAddressAfter(Ipv4Address ipv4Address, Ipv4Address destAddress, std::vector< Ipv4Address > &nodeList)
Search for the ipv4 address in the node list.
Definition: dsr-options.cc:123
TracedCallback< const DsrOptionSRHeader & > m_rxPacketTrace
The receive trace back, only triggered when final destination receive data packet.
Definition: dsr-options.h:280
Ipv4Address ReverseSearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Reverse search for the next hop in the route.
Definition: dsr-options.cc:208
Ptr< Ipv4 > m_ipv4
The ipv4.
Definition: dsr-options.h:264
void ScheduleReply(Ptr< Packet > &packet, std::vector< Ipv4Address > &nodeList, Ipv4Address &source, Ipv4Address &destination)
Schedule the intermediate node route request broadcast.
Ptr< dsr::DsrRouteCache > m_routeCache
The route cache table.
Definition: dsr-options.h:256
Ptr< Ipv4Route > m_ipv4Route
The ipv4 route.
Definition: dsr-options.h:260
std::vector< Ipv4Address > m_ipv4Address
The vector of Ipv4 address.
Definition: dsr-options.h:268
virtual 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-options.cc:154
Ptr< Node > m_node
the node
Definition: dsr-options.h:283
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.