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 * 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#include "ns3/boolean.h"
32#include "ns3/double.h"
33#include "ns3/dsr-fs-header.h"
34#include "ns3/dsr-helper.h"
35#include "ns3/dsr-main-helper.h"
36#include "ns3/dsr-option-header.h"
37#include "ns3/dsr-rcache.h"
38#include "ns3/dsr-rreq-table.h"
39#include "ns3/dsr-rsendbuff.h"
40#include "ns3/ipv4-address-helper.h"
41#include "ns3/ipv4-route.h"
42#include "ns3/mesh-helper.h"
43#include "ns3/ptr.h"
44#include "ns3/simulator.h"
45#include "ns3/string.h"
46#include "ns3/test.h"
47#include "ns3/uinteger.h"
48
49#include <vector>
50
51using namespace ns3;
52using namespace dsr;
53
54// -----------------------------------------------------------------------------
68{
69 public:
71 ~DsrFsHeaderTest() override;
72 void DoRun() override;
73};
74
76 : TestCase("DSR Fixed size Header")
77{
78}
79
81{
82}
83
84void
86{
88 dsr::DsrOptionRreqHeader rreqHeader;
89 header.AddDsrOption(rreqHeader); // has an alignment of 4n+0
90
92 0,
93 "length of routing header is not a multiple of 4");
94 Buffer buf;
95 buf.AddAtStart(header.GetSerializedSize());
96 header.Serialize(buf.Begin());
97
98 const uint8_t* data = buf.PeekData();
100 rreqHeader.GetType(),
101 "expect the rreqHeader after fixed size header");
102}
103
104// -----------------------------------------------------------------------------
113{
114 public:
116 ~DsrRreqHeaderTest() override;
117 void DoRun() override;
118};
119
121 : TestCase("DSR RREQ")
122{
123}
124
126{
127}
128
129void
131{
133
134 const std::vector<Ipv4Address> nodeList{
135 Ipv4Address("1.1.1.0"),
136 Ipv4Address("1.1.1.1"),
137 Ipv4Address("1.1.1.2"),
138 };
139
140 h.SetTarget(Ipv4Address("1.1.1.3"));
141 NS_TEST_EXPECT_MSG_EQ(h.GetTarget(), Ipv4Address("1.1.1.3"), "trivial");
142 h.SetNodesAddress(nodeList);
143 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(0), Ipv4Address("1.1.1.0"), "trivial");
144 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(1), Ipv4Address("1.1.1.1"), "trivial");
145 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(2), Ipv4Address("1.1.1.2"), "trivial");
146 h.SetId(1);
147 NS_TEST_EXPECT_MSG_EQ(h.GetId(), 1, "trivial");
148
149 Ptr<Packet> p = Create<Packet>();
151 header.AddDsrOption(h);
152 p->AddHeader(header);
153 p->RemoveAtStart(8);
155 h2.SetNumberAddress(3);
156 uint32_t bytes = p->RemoveHeader(h2);
157 NS_TEST_EXPECT_MSG_EQ(bytes, 20, "Total RREP is 20 bytes long");
158}
159
160// -----------------------------------------------------------------------------
169{
170 public:
172 ~DsrRrepHeaderTest() override;
173 void DoRun() override;
174};
175
177 : TestCase("DSR RREP")
178{
179}
180
182{
183}
184
185void
187{
189
190 const std::vector<Ipv4Address> nodeList{
191 Ipv4Address("1.1.1.0"),
192 Ipv4Address("1.1.1.1"),
193 Ipv4Address("1.1.1.2"),
194 };
195
196 h.SetNodesAddress(nodeList);
197 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(0), Ipv4Address("1.1.1.0"), "trivial");
198 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(1), Ipv4Address("1.1.1.1"), "trivial");
199 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(2), Ipv4Address("1.1.1.2"), "trivial");
200
201 Ptr<Packet> p = Create<Packet>();
203 header.AddDsrOption(h);
204 p->AddHeader(header);
205 p->RemoveAtStart(8);
207 h2.SetNumberAddress(3);
208 uint32_t bytes = p->RemoveHeader(h2);
209 NS_TEST_EXPECT_MSG_EQ(bytes, 16, "Total RREP is 16 bytes long");
210}
211
212// -----------------------------------------------------------------------------
221{
222 public:
224 ~DsrSRHeaderTest() override;
225 void DoRun() override;
226};
227
229 : TestCase("DSR Source Route")
230{
231}
232
234{
235}
236
237void
239{
241
242 const std::vector<Ipv4Address> nodeList{
243 Ipv4Address("1.1.1.0"),
244 Ipv4Address("1.1.1.1"),
245 Ipv4Address("1.1.1.2"),
246 };
247
248 h.SetNodesAddress(nodeList);
249 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(0), Ipv4Address("1.1.1.0"), "trivial");
250 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(1), Ipv4Address("1.1.1.1"), "trivial");
251 NS_TEST_EXPECT_MSG_EQ(h.GetNodeAddress(2), Ipv4Address("1.1.1.2"), "trivial");
252
253 h.SetSalvage(1);
254 NS_TEST_EXPECT_MSG_EQ(h.GetSalvage(), 1, "trivial");
255 h.SetSegmentsLeft(2);
256 NS_TEST_EXPECT_MSG_EQ(h.GetSegmentsLeft(), 2, "trivial");
257
258 Ptr<Packet> p = Create<Packet>();
260 header.AddDsrOption(h);
261 p->AddHeader(header);
262 p->RemoveAtStart(8);
264 h2.SetNumberAddress(3);
265 uint32_t bytes = p->RemoveHeader(h2);
266 NS_TEST_EXPECT_MSG_EQ(bytes, 16, "Total RREP is 16 bytes long");
267}
268
269// -----------------------------------------------------------------------------
278{
279 public:
281 ~DsrRerrHeaderTest() override;
282 void DoRun() override;
283};
284
286 : TestCase("DSR RERR")
287{
288}
289
291{
292}
293
294void
296{
298 h.SetErrorSrc(Ipv4Address("1.1.1.0"));
299 NS_TEST_EXPECT_MSG_EQ(h.GetErrorSrc(), Ipv4Address("1.1.1.0"), "trivial");
300 h.SetErrorDst(Ipv4Address("1.1.1.1"));
301 NS_TEST_EXPECT_MSG_EQ(h.GetErrorDst(), Ipv4Address("1.1.1.1"), "trivial");
302 h.SetSalvage(1);
303 NS_TEST_EXPECT_MSG_EQ(h.GetSalvage(), 1, "trivial");
304 h.SetUnreachNode(Ipv4Address("1.1.1.2"));
305 NS_TEST_EXPECT_MSG_EQ(h.GetUnreachNode(), Ipv4Address("1.1.1.2"), "trivial");
306
307 Ptr<Packet> p = Create<Packet>();
309 header.AddDsrOption(h);
310 p->AddHeader(header);
311 p->RemoveAtStart(8);
313 uint32_t bytes = p->RemoveHeader(h2);
314 NS_TEST_EXPECT_MSG_EQ(bytes, 20, "Total RREP is 20 bytes long");
315}
316
317// -----------------------------------------------------------------------------
326{
327 public:
329 ~DsrAckReqHeaderTest() override;
330 void DoRun() override;
331};
332
334 : TestCase("DSR Ack Req")
335{
336}
337
339{
340}
341
342void
344{
346
347 h.SetAckId(1);
348 NS_TEST_EXPECT_MSG_EQ(h.GetAckId(), 1, "trivial");
349
350 Ptr<Packet> p = Create<Packet>();
352 header.AddDsrOption(h);
353 p->AddHeader(header);
354 p->RemoveAtStart(8);
355 p->AddHeader(header);
357 p->RemoveAtStart(8);
358 uint32_t bytes = p->RemoveHeader(h2);
359 NS_TEST_EXPECT_MSG_EQ(bytes, 4, "Total RREP is 4 bytes long");
360}
361
362// -----------------------------------------------------------------------------
371{
372 public:
374 ~DsrAckHeaderTest() override;
375 void DoRun() override;
376};
377
379 : TestCase("DSR ACK")
380{
381}
382
384{
385}
386
387void
389{
391
392 h.SetRealSrc(Ipv4Address("1.1.1.0"));
393 NS_TEST_EXPECT_MSG_EQ(h.GetRealSrc(), Ipv4Address("1.1.1.0"), "trivial");
394 h.SetRealDst(Ipv4Address("1.1.1.1"));
395 NS_TEST_EXPECT_MSG_EQ(h.GetRealDst(), Ipv4Address("1.1.1.1"), "trivial");
396 h.SetAckId(1);
397 NS_TEST_EXPECT_MSG_EQ(h.GetAckId(), 1, "trivial");
398
399 Ptr<Packet> p = Create<Packet>();
401 header.AddDsrOption(h);
402 p->AddHeader(header);
403 p->RemoveAtStart(8);
404 p->AddHeader(header);
406 p->RemoveAtStart(8);
407 uint32_t bytes = p->RemoveHeader(h2);
408 NS_TEST_EXPECT_MSG_EQ(bytes, 12, "Total RREP is 12 bytes long");
409}
410
411// -----------------------------------------------------------------------------
420{
421 public:
423 ~DsrCacheEntryTest() override;
424 void DoRun() override;
425};
426
428 : TestCase("DSR ACK")
429{
430}
431
433{
434}
435
436void
438{
439 Ptr<dsr::DsrRouteCache> rcache = CreateObject<dsr::DsrRouteCache>();
440
441 std::vector<Ipv4Address> ip{
442 Ipv4Address("0.0.0.0"),
443 Ipv4Address("0.0.0.1"),
444 };
445
446 Ipv4Address dst("0.0.0.1");
447 dsr::DsrRouteCacheEntry entry(ip, dst, Seconds(1));
448 NS_TEST_EXPECT_MSG_EQ(entry.GetVector().size(), 2, "trivial");
449 NS_TEST_EXPECT_MSG_EQ(entry.GetDestination(), Ipv4Address("0.0.0.1"), "trivial");
450 NS_TEST_EXPECT_MSG_EQ(entry.GetExpireTime(), Seconds(1), "trivial");
451
452 entry.SetExpireTime(Seconds(3));
453 NS_TEST_EXPECT_MSG_EQ(entry.GetExpireTime(), Seconds(3), "trivial");
454 entry.SetDestination(Ipv4Address("1.1.1.1"));
455 NS_TEST_EXPECT_MSG_EQ(entry.GetDestination(), Ipv4Address("1.1.1.1"), "trivial");
456 ip.emplace_back("0.0.0.2");
457 entry.SetVector(ip);
458 NS_TEST_EXPECT_MSG_EQ(entry.GetVector().size(), 3, "trivial");
459
460 NS_TEST_EXPECT_MSG_EQ(rcache->AddRoute(entry), true, "trivial");
461
462 std::vector<Ipv4Address> ip2{
463 Ipv4Address("1.1.1.0"),
464 Ipv4Address("1.1.1.1"),
465 };
466
467 Ipv4Address dst2("1.1.1.1");
468 dsr::DsrRouteCacheEntry entry2(ip2, dst2, Seconds(2));
470 NS_TEST_EXPECT_MSG_EQ(rcache->AddRoute(entry2), true, "trivial");
471 NS_TEST_EXPECT_MSG_EQ(rcache->LookupRoute(dst2, newEntry), true, "trivial");
472 NS_TEST_EXPECT_MSG_EQ(rcache->DeleteRoute(Ipv4Address("2.2.2.2")), false, "trivial");
473
474 NS_TEST_EXPECT_MSG_EQ(rcache->DeleteRoute(Ipv4Address("1.1.1.1")), true, "trivial");
475 NS_TEST_EXPECT_MSG_EQ(rcache->DeleteRoute(Ipv4Address("1.1.1.1")), false, "trivial");
476}
477
478// -----------------------------------------------------------------------------
487{
488 public:
490 ~DsrSendBuffTest() override;
491 void DoRun() override;
493 void CheckSizeLimit();
495 void CheckTimeout();
496
498};
499
501 : TestCase("DSR SendBuff"),
502 q()
503{
504}
505
507{
508}
509
510void
512{
513 q.SetMaxQueueLen(32);
514 NS_TEST_EXPECT_MSG_EQ(q.GetMaxQueueLen(), 32, "trivial");
517
518 Ptr<const Packet> packet = Create<Packet>();
519 Ipv4Address dst1("0.0.0.1");
520 dsr::DsrSendBuffEntry e1(packet, dst1, Seconds(1));
521 q.Enqueue(e1);
522 q.Enqueue(e1);
523 q.Enqueue(e1);
524 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("0.0.0.1")), true, "trivial");
525 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("1.1.1.1")), false, "trivial");
526 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 1, "trivial");
527 q.DropPacketWithDst(Ipv4Address("0.0.0.1"));
528 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("0.0.0.1")), false, "trivial");
529 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 0, "trivial");
530
531 Ipv4Address dst2("0.0.0.2");
532 dsr::DsrSendBuffEntry e2(packet, dst2, Seconds(1));
533 q.Enqueue(e1);
534 q.Enqueue(e2);
535 Ptr<Packet> packet2 = Create<Packet>();
536 dsr::DsrSendBuffEntry e3(packet2, dst2, Seconds(1));
537 NS_TEST_EXPECT_MSG_EQ(q.Dequeue(Ipv4Address("0.0.0.3"), e3), false, "trivial");
538 NS_TEST_EXPECT_MSG_EQ(q.Dequeue(Ipv4Address("0.0.0.2"), e3), true, "trivial");
539 NS_TEST_EXPECT_MSG_EQ(q.Find(Ipv4Address("0.0.0.2")), false, "trivial");
540 q.Enqueue(e2);
541 q.Enqueue(e3);
542 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 2, "trivial");
543 Ptr<Packet> packet4 = Create<Packet>();
544 Ipv4Address dst4("0.0.0.4");
545 dsr::DsrSendBuffEntry e4(packet4, dst4, Seconds(20));
546 q.Enqueue(e4);
547 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 3, "trivial");
548 q.DropPacketWithDst(Ipv4Address("0.0.0.4"));
549 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 2, "trivial");
550
552
555 this);
556
559}
560
561void
563{
564 Ptr<Packet> packet = Create<Packet>();
565 Ipv4Address dst;
566 dsr::DsrSendBuffEntry e1(packet, dst, Seconds(1));
567
568 for (uint32_t i = 0; i < q.GetMaxQueueLen(); ++i)
569 {
570 q.Enqueue(e1);
571 }
572 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 3, "trivial");
573
574 for (uint32_t i = 0; i < q.GetMaxQueueLen(); ++i)
575 {
576 q.Enqueue(e1);
577 }
578 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 3, "trivial");
579}
580
581void
583{
584 NS_TEST_EXPECT_MSG_EQ(q.GetSize(), 0, "Must be empty now");
585}
586
587// -----------------------------------------------------------------------------
596{
597 public:
599 ~DsrRreqTableTest() override;
600 void DoRun() override;
601};
602
604 : TestCase("DSR RreqTable")
605{
606}
607
609{
610}
611
612void
614{
616
617 rt.m_reqNo = 2;
618 NS_TEST_EXPECT_MSG_EQ(rt.m_reqNo, 2, "trivial");
619}
620
621// -----------------------------------------------------------------------------
630{
631 public:
633 : TestSuite("routing-dsr", Type::UNIT)
634 {
635 AddTestCase(new DsrFsHeaderTest, TestCase::Duration::QUICK);
636 AddTestCase(new DsrRreqHeaderTest, TestCase::Duration::QUICK);
637 AddTestCase(new DsrRrepHeaderTest, TestCase::Duration::QUICK);
638 AddTestCase(new DsrSRHeaderTest, TestCase::Duration::QUICK);
639 AddTestCase(new DsrRerrHeaderTest, TestCase::Duration::QUICK);
640 AddTestCase(new DsrAckReqHeaderTest, TestCase::Duration::QUICK);
641 AddTestCase(new DsrAckHeaderTest, TestCase::Duration::QUICK);
642 AddTestCase(new DsrCacheEntryTest, TestCase::Duration::QUICK);
643 AddTestCase(new DsrSendBuffTest, TestCase::Duration::QUICK);
644 }
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:94
void AddAtStart(uint32_t start)
Definition: buffer.cc:314
Buffer::Iterator Begin() const
Definition: buffer.h:1074
const uint8_t * PeekData() const
Definition: buffer.cc:703
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static void Run()
Run the simulation.
Definition: simulator.cc:178
encapsulates test code
Definition: test.h:1061
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1268
Type
Type of test.
Definition: test.h:1275
static constexpr auto UNIT
Definition: test.h:1286
Acknowledgement (ACK) Message Format.
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.
Acknowledgement Request (ACK_RREQ) Message Format.
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.
Route Reply (RREP) Message Format.
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.
Route Request (RREQ) Message Format.
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.
Source Route (SR) Message Format.
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:229
IP_VECTOR GetVector() const
Get the IP vector.
Definition: dsr-rcache.h:309
void SetDestination(Ipv4Address d)
Set destination address.
Definition: dsr-rcache.h:300
Ipv4Address GetDestination() const
Get destination address.
Definition: dsr-rcache.h:291
Time GetExpireTime() const
Get expire time.
Definition: dsr-rcache.h:336
void SetExpireTime(Time exp)
Set expire time.
Definition: dsr-rcache.h:327
void SetVector(IP_VECTOR v)
Sets the IP vector.
Definition: dsr-rcache.h:318
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.
Definition: dsr-rsendbuff.h:48
DSR send buffer.
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
#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:252
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
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.