A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
dsr-test-suite.cc
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 *
8 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
9 * ResiliNets Research Group https://resilinets.org/
10 * Information and Telecommunication Technology Center (ITTC)
11 * and Department of Electrical Engineering and Computer Science
12 * The University of Kansas Lawrence, KS USA.
13 *
14 * Work supported in part by NSF FIND (Future Internet Design) Program
15 * under grant CNS-0626918 (Postmodern Internet Architecture),
16 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
17 * US Department of Defense (DoD), and ITTC at The University of Kansas.
18 */
19
20#include "ns3/boolean.h"
21#include "ns3/double.h"
22#include "ns3/dsr-fs-header.h"
23#include "ns3/dsr-helper.h"
24#include "ns3/dsr-main-helper.h"
25#include "ns3/dsr-option-header.h"
26#include "ns3/dsr-rcache.h"
27#include "ns3/dsr-rreq-table.h"
28#include "ns3/dsr-rsendbuff.h"
29#include "ns3/ipv4-address-helper.h"
30#include "ns3/ipv4-route.h"
31#include "ns3/mesh-helper.h"
32#include "ns3/ptr.h"
33#include "ns3/simulator.h"
34#include "ns3/string.h"
35#include "ns3/test.h"
36#include "ns3/uinteger.h"
37
38#include <vector>
39
40using namespace ns3;
41using namespace dsr;
42
43// -----------------------------------------------------------------------------
44/**
45 * \ingroup dsr
46 * \defgroup dsr-test DSR routing module tests
47 */
48
49/**
50 * \ingroup dsr-test
51 * \ingroup tests
52 *
53 * \class DsrFsHeaderTest
54 * \brief Unit test for DSR Fixed Size Header
55 */
57{
58 public:
60 ~DsrFsHeaderTest() override;
61 void DoRun() override;
62};
63
65 : TestCase("DSR Fixed size Header")
66{
67}
68
72
73void
75{
77 dsr::DsrOptionRreqHeader rreqHeader;
78 header.AddDsrOption(rreqHeader); // has an alignment of 4n+0
79
81 0,
82 "length of routing header is not a multiple of 4");
83 Buffer buf;
84 buf.AddAtStart(header.GetSerializedSize());
85 header.Serialize(buf.Begin());
86
87 const uint8_t* data = buf.PeekData();
89 rreqHeader.GetType(),
90 "expect the rreqHeader after fixed size header");
91}
92
93// -----------------------------------------------------------------------------
94/**
95 * \ingroup dsr-test
96 * \ingroup tests
97 *
98 * \class DsrRreqHeaderTest
99 * \brief Unit test for RREQ
100 */
102{
103 public:
105 ~DsrRreqHeaderTest() override;
106 void DoRun() override;
107};
108
110 : TestCase("DSR RREQ")
111{
112}
113
117
118void
120{
122
123 const std::vector<Ipv4Address> nodeList{
124 Ipv4Address("1.1.1.0"),
125 Ipv4Address("1.1.1.1"),
126 Ipv4Address("1.1.1.2"),
127 };
128
129 h.SetTarget(Ipv4Address("1.1.1.3"));
130 NS_TEST_EXPECT_MSG_EQ(h.GetTarget(), Ipv4Address("1.1.1.3"), "trivial");
131 h.SetNodesAddress(nodeList);
132 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(0), Ipv4Address("1.1.1.0"), "trivial");
133 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(1), Ipv4Address("1.1.1.1"), "trivial");
134 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(2), Ipv4Address("1.1.1.2"), "trivial");
135 h.SetId(1);
136 NS_TEST_EXPECT_MSG_EQ(h.GetId(), 1, "trivial");
137
140 header.AddDsrOption(h);
141 p->AddHeader(header);
142 p->RemoveAtStart(8);
144 h2.SetNumberAddress(3);
145 uint32_t bytes = p->RemoveHeader(h2);
146 NS_TEST_EXPECT_MSG_EQ(bytes, 20, "Total RREP is 20 bytes long");
147}
148
149// -----------------------------------------------------------------------------
150/**
151 * \ingroup dsr-test
152 * \ingroup tests
153 *
154 * \class DsrRrepHeaderTest
155 * \brief Unit test for RREP
156 */
158{
159 public:
161 ~DsrRrepHeaderTest() override;
162 void DoRun() override;
163};
164
166 : TestCase("DSR RREP")
167{
168}
169
173
174void
176{
178
179 const std::vector<Ipv4Address> nodeList{
180 Ipv4Address("1.1.1.0"),
181 Ipv4Address("1.1.1.1"),
182 Ipv4Address("1.1.1.2"),
183 };
184
185 h.SetNodesAddress(nodeList);
186 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(0), Ipv4Address("1.1.1.0"), "trivial");
187 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(1), Ipv4Address("1.1.1.1"), "trivial");
188 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(2), Ipv4Address("1.1.1.2"), "trivial");
189
192 header.AddDsrOption(h);
193 p->AddHeader(header);
194 p->RemoveAtStart(8);
196 h2.SetNumberAddress(3);
197 uint32_t bytes = p->RemoveHeader(h2);
198 NS_TEST_EXPECT_MSG_EQ(bytes, 16, "Total RREP is 16 bytes long");
199}
200
201// -----------------------------------------------------------------------------
202/**
203 * \ingroup dsr-test
204 * \ingroup tests
205 *
206 * \class DsrSRHeaderTest
207 * \brief Unit test for Source Route
208 */
210{
211 public:
213 ~DsrSRHeaderTest() override;
214 void DoRun() override;
215};
216
218 : TestCase("DSR Source Route")
219{
220}
221
225
226void
228{
230
231 const std::vector<Ipv4Address> nodeList{
232 Ipv4Address("1.1.1.0"),
233 Ipv4Address("1.1.1.1"),
234 Ipv4Address("1.1.1.2"),
235 };
236
237 h.SetNodesAddress(nodeList);
238 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(0), Ipv4Address("1.1.1.0"), "trivial");
239 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(1), Ipv4Address("1.1.1.1"), "trivial");
240 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(2), Ipv4Address("1.1.1.2"), "trivial");
241
242 h.SetSalvage(1);
243 NS_TEST_EXPECT_MSG_EQ(h.GetSalvage(), 1, "trivial");
244 h.SetSegmentsLeft(2);
245 NS_TEST_EXPECT_MSG_EQ(h.GetSegmentsLeft(), 2, "trivial");
246
249 header.AddDsrOption(h);
250 p->AddHeader(header);
251 p->RemoveAtStart(8);
253 h2.SetNumberAddress(3);
254 uint32_t bytes = p->RemoveHeader(h2);
255 NS_TEST_EXPECT_MSG_EQ(bytes, 16, "Total RREP is 16 bytes long");
256}
257
258// -----------------------------------------------------------------------------
259/**
260 * \ingroup dsr-test
261 * \ingroup tests
262 *
263 * \class DsrRerrHeaderTest
264 * \brief Unit test for RERR
265 */
267{
268 public:
270 ~DsrRerrHeaderTest() override;
271 void DoRun() override;
272};
273
275 : TestCase("DSR RERR")
276{
277}
278
282
283void
285{
287 h.SetErrorSrc(Ipv4Address("1.1.1.0"));
288 NS_TEST_EXPECT_MSG_EQ(h.GetErrorSrc(), Ipv4Address("1.1.1.0"), "trivial");
289 h.SetErrorDst(Ipv4Address("1.1.1.1"));
290 NS_TEST_EXPECT_MSG_EQ(h.GetErrorDst(), Ipv4Address("1.1.1.1"), "trivial");
291 h.SetSalvage(1);
292 NS_TEST_EXPECT_MSG_EQ(h.GetSalvage(), 1, "trivial");
293 h.SetUnreachNode(Ipv4Address("1.1.1.2"));
294 NS_TEST_EXPECT_MSG_EQ(h.GetUnreachNode(), Ipv4Address("1.1.1.2"), "trivial");
295
298 header.AddDsrOption(h);
299 p->AddHeader(header);
300 p->RemoveAtStart(8);
302 uint32_t bytes = p->RemoveHeader(h2);
303 NS_TEST_EXPECT_MSG_EQ(bytes, 20, "Total RREP is 20 bytes long");
304}
305
306// -----------------------------------------------------------------------------
307/**
308 * \ingroup dsr-test
309 * \ingroup tests
310 *
311 * \class DsrAckReqHeaderTest
312 * \brief Unit test for ACK-REQ
313 */
315{
316 public:
318 ~DsrAckReqHeaderTest() override;
319 void DoRun() override;
320};
321
323 : TestCase("DSR Ack Req")
324{
325}
326
330
331void
333{
335
336 h.SetAckId(1);
337 NS_TEST_EXPECT_MSG_EQ(h.GetAckId(), 1, "trivial");
338
341 header.AddDsrOption(h);
342 p->AddHeader(header);
343 p->RemoveAtStart(8);
344 p->AddHeader(header);
346 p->RemoveAtStart(8);
347 uint32_t bytes = p->RemoveHeader(h2);
348 NS_TEST_EXPECT_MSG_EQ(bytes, 4, "Total RREP is 4 bytes long");
349}
350
351// -----------------------------------------------------------------------------
352/**
353 * \ingroup dsr-test
354 * \ingroup tests
355 *
356 * \class DsrAckHeaderTest
357 * \brief Unit test for ACK
358 */
360{
361 public:
363 ~DsrAckHeaderTest() override;
364 void DoRun() override;
365};
366
368 : TestCase("DSR ACK")
369{
370}
371
375
376void
378{
380
381 h.SetRealSrc(Ipv4Address("1.1.1.0"));
382 NS_TEST_EXPECT_MSG_EQ(h.GetRealSrc(), Ipv4Address("1.1.1.0"), "trivial");
383 h.SetRealDst(Ipv4Address("1.1.1.1"));
384 NS_TEST_EXPECT_MSG_EQ(h.GetRealDst(), Ipv4Address("1.1.1.1"), "trivial");
385 h.SetAckId(1);
386 NS_TEST_EXPECT_MSG_EQ(h.GetAckId(), 1, "trivial");
387
390 header.AddDsrOption(h);
391 p->AddHeader(header);
392 p->RemoveAtStart(8);
393 p->AddHeader(header);
395 p->RemoveAtStart(8);
396 uint32_t bytes = p->RemoveHeader(h2);
397 NS_TEST_EXPECT_MSG_EQ(bytes, 12, "Total RREP is 12 bytes long");
398}
399
400// -----------------------------------------------------------------------------
401/**
402 * \ingroup dsr-test
403 * \ingroup tests
404 *
405 * \class DsrCacheEntryTest
406 * \brief Unit test for DSR route cache entry
407 */
409{
410 public:
412 ~DsrCacheEntryTest() override;
413 void DoRun() override;
414};
415
420
424
425void
427{
429
430 std::vector<Ipv4Address> ip{
431 Ipv4Address("0.0.0.0"),
432 Ipv4Address("0.0.0.1"),
433 };
434
435 Ipv4Address dst("0.0.0.1");
436 dsr::DsrRouteCacheEntry entry(ip, dst, Seconds(1));
437 NS_TEST_EXPECT_MSG_EQ(entry.GetVector().size(), 2, "trivial");
438 NS_TEST_EXPECT_MSG_EQ(entry.GetDestination(), Ipv4Address("0.0.0.1"), "trivial");
439 NS_TEST_EXPECT_MSG_EQ(entry.GetExpireTime(), Seconds(1), "trivial");
440
441 entry.SetExpireTime(Seconds(3));
442 NS_TEST_EXPECT_MSG_EQ(entry.GetExpireTime(), Seconds(3), "trivial");
443 entry.SetDestination(Ipv4Address("1.1.1.1"));
444 NS_TEST_EXPECT_MSG_EQ(entry.GetDestination(), Ipv4Address("1.1.1.1"), "trivial");
445 ip.emplace_back("0.0.0.2");
446 entry.SetVector(ip);
447 NS_TEST_EXPECT_MSG_EQ(entry.GetVector().size(), 3, "trivial");
448
449 NS_TEST_EXPECT_MSG_EQ(rcache->AddRoute(entry), true, "trivial");
450
451 std::vector<Ipv4Address> ip2{
452 Ipv4Address("1.1.1.0"),
453 Ipv4Address("1.1.1.1"),
454 };
455
456 Ipv4Address dst2("1.1.1.1");
457 dsr::DsrRouteCacheEntry entry2(ip2, dst2, Seconds(2));
459 NS_TEST_EXPECT_MSG_EQ(rcache->AddRoute(entry2), true, "trivial");
460 NS_TEST_EXPECT_MSG_EQ(rcache->LookupRoute(dst2, newEntry), true, "trivial");
461 NS_TEST_EXPECT_MSG_EQ(rcache->DeleteRoute(Ipv4Address("2.2.2.2")), false, "trivial");
462
463 NS_TEST_EXPECT_MSG_EQ(rcache->DeleteRoute(Ipv4Address("1.1.1.1")), true, "trivial");
464 NS_TEST_EXPECT_MSG_EQ(rcache->DeleteRoute(Ipv4Address("1.1.1.1")), false, "trivial");
465}
466
467// -----------------------------------------------------------------------------
468/**
469 * \ingroup dsr-test
470 * \ingroup tests
471 *
472 * \class DsrSendBuffTest
473 * \brief Unit test for Send Buffer
474 */
476{
477 public:
479 ~DsrSendBuffTest() override;
480 void DoRun() override;
481 /// Check size limit function
482 void CheckSizeLimit();
483 /// Check timeout function
484 void CheckTimeout();
485
486 dsr::DsrSendBuffer q; ///< send buffer
487};
488
490 : TestCase("DSR SendBuff"),
491 q()
492{
493}
494
498
499void
501{
502 q.SetMaxQueueLen(32);
503 NS_TEST_EXPECT_MSG_EQ(q.GetMaxQueueLen(), 32, "trivial");
506
508 Ipv4Address dst1("0.0.0.1");
509 dsr::DsrSendBuffEntry e1(packet, dst1, Seconds(1));
510 q.Enqueue(e1);
511 q.Enqueue(e1);
512 q.Enqueue(e1);
513 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("0.0.0.1")), true, "trivial");
514 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("1.1.1.1")), false, "trivial");
515 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 1, "trivial");
516 q.DropPacketWithDst(Ipv4Address("0.0.0.1"));
517 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("0.0.0.1")), false, "trivial");
518 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 0, "trivial");
519
520 Ipv4Address dst2("0.0.0.2");
521 dsr::DsrSendBuffEntry e2(packet, dst2, Seconds(1));
522 q.Enqueue(e1);
523 q.Enqueue(e2);
524 Ptr<Packet> packet2 = Create<Packet>();
525 dsr::DsrSendBuffEntry e3(packet2, dst2, Seconds(1));
526 NS_TEST_EXPECT_MSG_EQ(q.Dequeue(Ipv4Address("0.0.0.3"), e3), false, "trivial");
527 NS_TEST_EXPECT_MSG_EQ(q.Dequeue(Ipv4Address("0.0.0.2"), e3), true, "trivial");
528 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("0.0.0.2")), false, "trivial");
529 q.Enqueue(e2);
530 q.Enqueue(e3);
531 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 2, "trivial");
532 Ptr<Packet> packet4 = Create<Packet>();
533 Ipv4Address dst4("0.0.0.4");
534 dsr::DsrSendBuffEntry e4(packet4, dst4, Seconds(20));
535 q.Enqueue(e4);
536 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 3, "trivial");
537 q.DropPacketWithDst(Ipv4Address("0.0.0.4"));
538 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 2, "trivial");
539
541
544 this);
545
548}
549
550void
552{
553 Ptr<Packet> packet = Create<Packet>();
554 Ipv4Address dst;
555 dsr::DsrSendBuffEntry e1(packet, dst, Seconds(1));
556
557 for (uint32_t i = 0; i < q.GetMaxQueueLen(); ++i)
558 {
559 q.Enqueue(e1);
560 }
561 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 3, "trivial");
562
563 for (uint32_t i = 0; i < q.GetMaxQueueLen(); ++i)
564 {
565 q.Enqueue(e1);
566 }
567 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 3, "trivial");
568}
569
570void
572{
573 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 0, "Must be empty now");
574}
575
576// -----------------------------------------------------------------------------
577/**
578 * \ingroup dsr-test
579 * \ingroup tests
580 *
581 * \class DsrRreqTableTest
582 * \brief Unit test for DSR routing table entry
583 */
585{
586 public:
588 ~DsrRreqTableTest() override;
589 void DoRun() override;
590};
591
593 : TestCase("DSR RreqTable")
594{
595}
596
600
601void
603{
605
606 rt.m_reqNo = 2;
607 NS_TEST_EXPECT_MSG_EQ(rt.m_reqNo, 2, "trivial");
608}
609
610// -----------------------------------------------------------------------------
611/**
612 * \ingroup dsr-test
613 * \ingroup tests
614 *
615 * \class DsrTestSuite
616 * \brief DSR test suite
617 */
619{
620 public:
622 : TestSuite("routing-dsr", Type::UNIT)
623 {
624 AddTestCase(new DsrFsHeaderTest, TestCase::Duration::QUICK);
625 AddTestCase(new DsrRreqHeaderTest, TestCase::Duration::QUICK);
626 AddTestCase(new DsrRrepHeaderTest, TestCase::Duration::QUICK);
627 AddTestCase(new DsrSRHeaderTest, TestCase::Duration::QUICK);
628 AddTestCase(new DsrRerrHeaderTest, TestCase::Duration::QUICK);
629 AddTestCase(new DsrAckReqHeaderTest, TestCase::Duration::QUICK);
630 AddTestCase(new DsrAckHeaderTest, TestCase::Duration::QUICK);
631 AddTestCase(new DsrCacheEntryTest, TestCase::Duration::QUICK);
632 AddTestCase(new DsrSendBuffTest, TestCase::Duration::QUICK);
633 }
Unit test for ACK.
void DoRun() override
Implementation to actually run this TestCase.
~DsrAckHeaderTest() override
Unit test for ACK-REQ.
~DsrAckReqHeaderTest() override
void DoRun() override
Implementation to actually run this TestCase.
Unit test for DSR route cache entry.
~DsrCacheEntryTest() override
void DoRun() override
Implementation to actually run this TestCase.
DsrCacheEntryTest()
Unit test for DSR Fixed Size Header.
void DoRun() override
Implementation to actually run this TestCase.
~DsrFsHeaderTest() override
Unit test for RERR.
void DoRun() override
Implementation to actually run this TestCase.
~DsrRerrHeaderTest() override
Unit test for RREP.
void DoRun() override
Implementation to actually run this TestCase.
~DsrRrepHeaderTest() override
Unit test for RREQ.
void DoRun() override
Implementation to actually run this TestCase.
~DsrRreqHeaderTest() override
Unit test for DSR routing table entry.
void DoRun() override
Implementation to actually run this TestCase.
~DsrRreqTableTest() override
Unit test for Source Route.
~DsrSRHeaderTest() override
void DoRun() override
Implementation to actually run this TestCase.
Unit test for Send Buffer.
void CheckSizeLimit()
Check size limit function.
void CheckTimeout()
Check timeout function.
dsr::DsrSendBuffer q
send buffer
~DsrSendBuffTest() override
void DoRun() override
Implementation to actually run this TestCase.
DSR test suite.
automatically resized byte buffer
Definition buffer.h:83
void AddAtStart(uint32_t start)
Definition buffer.cc:303
Buffer::Iterator Begin() const
Definition buffer.h:1063
const uint8_t * PeekData() const
Definition buffer.cc:692
Ipv4 addresses are stored in host order in this class.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void Run()
Run the simulation.
Definition simulator.cc:167
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
static constexpr auto UNIT
Definition test.h:1291
Header of Dsr Option ack.
void SetAckId(uint16_t identification)
Set the Ack id number.
uint16_t GetAckId() const
Set the Ack id number.
void SetRealSrc(Ipv4Address realSrcAddress)
Set Error source ip address.
void SetRealDst(Ipv4Address realDstAddress)
Set Error source ip address.
Ipv4Address GetRealDst() const
Get Error source ip address.
Ipv4Address GetRealSrc() const
Get Error source ip address.
Header of Dsr Option ack request.
void SetAckId(uint16_t identification)
Set the Ack request id number.
uint16_t GetAckId() const
Set the Ack request id number.
void AddDsrOption(const DsrOptionHeader &option)
Serialize the option, prepending pad1 or padn option as necessary.
uint8_t GetType() const
Get the type of the option.
Route Error (RERR) Unreachable node address option Message Format.
Ipv4Address GetErrorSrc() const override
Get the route error source address.
void SetErrorDst(Ipv4Address errorDstAddress) override
Set the error destination ip address.
void SetErrorSrc(Ipv4Address errorSrcAddress) override
Set the route error source address.
uint8_t GetSalvage() const override
Get the salvage value of the packet.
void SetUnreachNode(Ipv4Address unreachNode)
Set the unreachable node ip address.
void SetSalvage(uint8_t salvage) override
Set the salvage value of the packet.
Ipv4Address GetUnreachNode() const
Get the unreachable node ip address.
Ipv4Address GetErrorDst() const override
Get the error destination ip address.
Header of Dsr Option Route Reply.
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Header of Dsr Option Route Request.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
void SetTarget(Ipv4Address target)
Set the target ipv4 address.
Ipv4Address GetTarget()
Get the target ipv4 address.
uint16_t GetId() const
Set the request id number.
void SetId(uint16_t identification)
Set the request id number.
Header of Dsr Option Source Route.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
void SetSalvage(uint8_t salvage)
Set the salvage value for a packet.
void SetSegmentsLeft(uint8_t segmentsLeft)
Set the number of segments left to send.
uint8_t GetSalvage() const
Get the salvage value for a packet.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
uint8_t GetSegmentsLeft() const
Get the number of segments left to send.
DsrRouteCacheEntry class for entries in the route cache.
Definition dsr-rcache.h:218
IP_VECTOR GetVector() const
Get the IP vector.
Definition dsr-rcache.h:298
void SetDestination(Ipv4Address d)
Set destination address.
Definition dsr-rcache.h:289
Ipv4Address GetDestination() const
Get destination address.
Definition dsr-rcache.h:280
Time GetExpireTime() const
Get expire time.
Definition dsr-rcache.h:325
void SetExpireTime(Time exp)
Set expire time.
Definition dsr-rcache.h:316
void SetVector(IP_VECTOR v)
Sets the IP vector.
Definition dsr-rcache.h:307
Header of Dsr Routing.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
DSR Send Buffer Entry.
void SetMaxQueueLen(uint32_t len)
Set the maximum queue length.
Time GetSendBufferTimeout() const
Return the entry lifetime in the queue.
uint32_t GetSize()
Number of entries.
bool Dequeue(Ipv4Address dst, DsrSendBuffEntry &entry)
Return first found (the earliest) entry for the given destination.
uint32_t GetMaxQueueLen() const
Return the maximum queue length.
void SetSendBufferTimeout(Time t)
Set the entry lifetime in the queue.
bool Enqueue(DsrSendBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
bool Find(Ipv4Address dst)
Check if a packet with destination dst exists in the queue.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
DsrTestSuite g_dsrTestSuite
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:241
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t data[writeSize]
The route request table entries.
uint32_t m_reqNo
Route request number.