A Discrete-Event Network Simulator
API
dsr-test-suite.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 Yufei Cheng
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Yufei Cheng <yfcheng@ittc.ku.edu>
19 *
20 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21 * ResiliNets Research Group https://resilinets.org/
22 * Information and Telecommunication Technology Center (ITTC)
23 * and Department of Electrical Engineering and Computer Science
24 * The University of Kansas Lawrence, KS USA.
25 *
26 * Work supported in part by NSF FIND (Future Internet Design) Program
27 * under grant CNS-0626918 (Postmodern Internet Architecture),
28 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
29 * US Department of Defense (DoD), and ITTC at The University of Kansas.
30 */
31
32#include <vector>
33#include "ns3/ptr.h"
34#include "ns3/boolean.h"
35#include "ns3/test.h"
36#include "ns3/ipv4-route.h"
37#include "ns3/mesh-helper.h"
38#include "ns3/simulator.h"
39#include "ns3/double.h"
40#include "ns3/uinteger.h"
41#include "ns3/string.h"
42#include "ns3/ipv4-address-helper.h"
43
44#include "ns3/dsr-fs-header.h"
45#include "ns3/dsr-option-header.h"
46#include "ns3/dsr-rreq-table.h"
47#include "ns3/dsr-rcache.h"
48#include "ns3/dsr-rsendbuff.h"
49#include "ns3/dsr-main-helper.h"
50#include "ns3/dsr-helper.h"
51
52using namespace ns3;
53using namespace dsr;
54
55// -----------------------------------------------------------------------------
70{
71public:
74 virtual void
75 DoRun (void);
76};
78 : TestCase ("DSR Fixed size Header")
79{
80}
82{
83}
84void
86{
88 dsr::DsrOptionRreqHeader rreqHeader;
89 header.AddDsrOption (rreqHeader); // has an alignment of 4n+0
90
91 NS_TEST_EXPECT_MSG_EQ (header.GetSerializedSize () % 2, 0, "length of routing header is not a multiple of 4");
92 Buffer buf;
93 buf.AddAtStart (header.GetSerializedSize ());
94 header.Serialize (buf.Begin ());
95
96 const uint8_t* data = buf.PeekData ();
97 NS_TEST_EXPECT_MSG_EQ (*(data + 8), rreqHeader.GetType (), "expect the rreqHeader after fixed size header");
98}
99// -----------------------------------------------------------------------------
108{
109public:
112 virtual void
113 DoRun (void);
114};
116 : TestCase ("DSR RREQ")
117{
118}
120{
121}
122void
124{
126 std::vector<Ipv4Address> nodeList;
127 nodeList.push_back (Ipv4Address ("1.1.1.0"));
128 nodeList.push_back (Ipv4Address ("1.1.1.1"));
129 nodeList.push_back (Ipv4Address ("1.1.1.2"));
130
131 h.SetTarget (Ipv4Address ("1.1.1.3"));
132 NS_TEST_EXPECT_MSG_EQ (h.GetTarget (), Ipv4Address ("1.1.1.3"), "trivial");
133 h.SetNodesAddress (nodeList);
134 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (0), Ipv4Address ("1.1.1.0"), "trivial");
135 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (1), Ipv4Address ("1.1.1.1"), "trivial");
136 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (2), Ipv4Address ("1.1.1.2"), "trivial");
137 h.SetId (1);
138 NS_TEST_EXPECT_MSG_EQ (h.GetId (), 1, "trivial");
139
140 Ptr<Packet> p = Create<Packet> ();
142 header.AddDsrOption (h);
143 p->AddHeader (header);
144 p->RemoveAtStart (8);
146 h2.SetNumberAddress (3);
147 uint32_t bytes = p->RemoveHeader (h2);
148 NS_TEST_EXPECT_MSG_EQ (bytes, 20, "Total RREP is 20 bytes long");
149}
150// -----------------------------------------------------------------------------
159{
160public:
163 virtual void
164 DoRun (void);
165};
167 : TestCase ("DSR RREP")
168{
169}
171{
172}
173void
175{
177
178 std::vector<Ipv4Address> nodeList;
179 nodeList.push_back (Ipv4Address ("1.1.1.0"));
180 nodeList.push_back (Ipv4Address ("1.1.1.1"));
181 nodeList.push_back (Ipv4Address ("1.1.1.2"));
182 h.SetNodesAddress (nodeList);
183 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (0), Ipv4Address ("1.1.1.0"), "trivial");
184 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (1), Ipv4Address ("1.1.1.1"), "trivial");
185 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (2), Ipv4Address ("1.1.1.2"), "trivial");
186
187 Ptr<Packet> p = Create<Packet> ();
189 header.AddDsrOption (h);
190 p->AddHeader (header);
191 p->RemoveAtStart (8);
193 h2.SetNumberAddress (3);
194 uint32_t bytes = p->RemoveHeader (h2);
195 NS_TEST_EXPECT_MSG_EQ (bytes, 16, "Total RREP is 16 bytes long");
196}
197// -----------------------------------------------------------------------------
206{
207public:
210 virtual void
211 DoRun (void);
212};
214 : TestCase ("DSR Source Route")
215{
216}
218{
219}
220void
222{
224 std::vector<Ipv4Address> nodeList;
225 nodeList.push_back (Ipv4Address ("1.1.1.0"));
226 nodeList.push_back (Ipv4Address ("1.1.1.1"));
227 nodeList.push_back (Ipv4Address ("1.1.1.2"));
228 h.SetNodesAddress (nodeList);
229 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (0), Ipv4Address ("1.1.1.0"), "trivial");
230 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (1), Ipv4Address ("1.1.1.1"), "trivial");
231 NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (2), Ipv4Address ("1.1.1.2"), "trivial");
232
233 h.SetSalvage (1);
234 NS_TEST_EXPECT_MSG_EQ (h.GetSalvage (), 1, "trivial");
235 h.SetSegmentsLeft (2);
236 NS_TEST_EXPECT_MSG_EQ (h.GetSegmentsLeft (), 2, "trivial");
237
238 Ptr<Packet> p = Create<Packet> ();
240 header.AddDsrOption (h);
241 p->AddHeader (header);
242 p->RemoveAtStart (8);
244 h2.SetNumberAddress (3);
245 uint32_t bytes = p->RemoveHeader (h2);
246 NS_TEST_EXPECT_MSG_EQ (bytes, 16, "Total RREP is 16 bytes long");
247}
248// -----------------------------------------------------------------------------
257{
258public:
261 virtual void
262 DoRun (void);
263};
265 : TestCase ("DSR RERR")
266{
267}
269{
270}
271void
273{
275 h.SetErrorSrc (Ipv4Address ("1.1.1.0"));
276 NS_TEST_EXPECT_MSG_EQ (h.GetErrorSrc (), Ipv4Address ("1.1.1.0"), "trivial");
277 h.SetErrorDst (Ipv4Address ("1.1.1.1"));
278 NS_TEST_EXPECT_MSG_EQ (h.GetErrorDst (), Ipv4Address ("1.1.1.1"), "trivial");
279 h.SetSalvage (1);
280 NS_TEST_EXPECT_MSG_EQ (h.GetSalvage (), 1, "trivial");
281 h.SetUnreachNode (Ipv4Address ("1.1.1.2"));
282 NS_TEST_EXPECT_MSG_EQ (h.GetUnreachNode (), Ipv4Address ("1.1.1.2"), "trivial");
283
284 Ptr<Packet> p = Create<Packet> ();
286 header.AddDsrOption (h);
287 p->AddHeader (header);
288 p->RemoveAtStart (8);
290 uint32_t bytes = p->RemoveHeader (h2);
291 NS_TEST_EXPECT_MSG_EQ (bytes, 20, "Total RREP is 20 bytes long");
292}
293// -----------------------------------------------------------------------------
302{
303public:
306 virtual void
307 DoRun (void);
308};
310 : TestCase ("DSR Ack Req")
311{
312}
314{
315}
316void
318{
320
321 h.SetAckId (1);
322 NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial");
323
324 Ptr<Packet> p = Create<Packet> ();
326 header.AddDsrOption (h);
327 p->AddHeader (header);
328 p->RemoveAtStart (8);
329 p->AddHeader (header);
331 p->RemoveAtStart (8);
332 uint32_t bytes = p->RemoveHeader (h2);
333 NS_TEST_EXPECT_MSG_EQ (bytes, 4, "Total RREP is 4 bytes long");
334}
335// -----------------------------------------------------------------------------
344{
345public:
348 virtual void
349 DoRun (void);
350};
352 : TestCase ("DSR ACK")
353{
354}
356{
357}
358void
360{
362
363 h.SetRealSrc (Ipv4Address ("1.1.1.0"));
364 NS_TEST_EXPECT_MSG_EQ (h.GetRealSrc (), Ipv4Address ("1.1.1.0"), "trivial");
365 h.SetRealDst (Ipv4Address ("1.1.1.1"));
366 NS_TEST_EXPECT_MSG_EQ (h.GetRealDst (), Ipv4Address ("1.1.1.1"), "trivial");
367 h.SetAckId (1);
368 NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial");
369
370 Ptr<Packet> p = Create<Packet> ();
372 header.AddDsrOption (h);
373 p->AddHeader (header);
374 p->RemoveAtStart (8);
375 p->AddHeader (header);
377 p->RemoveAtStart (8);
378 uint32_t bytes = p->RemoveHeader (h2);
379 NS_TEST_EXPECT_MSG_EQ (bytes, 12, "Total RREP is 12 bytes long");
380}
381// -----------------------------------------------------------------------------
390{
391public:
394 virtual void
395 DoRun (void);
396};
398 : TestCase ("DSR ACK")
399{
400}
402{
403}
404void
406{
407 Ptr<dsr::DsrRouteCache> rcache = CreateObject<dsr::DsrRouteCache> ();
408 std::vector<Ipv4Address> ip;
409 ip.push_back (Ipv4Address ("0.0.0.0"));
410 ip.push_back (Ipv4Address ("0.0.0.1"));
411 Ipv4Address dst = Ipv4Address ("0.0.0.1");
412 dsr::DsrRouteCacheEntry entry (ip, dst, Seconds (1));
413 NS_TEST_EXPECT_MSG_EQ (entry.GetVector ().size (), 2, "trivial");
414 NS_TEST_EXPECT_MSG_EQ (entry.GetDestination (), Ipv4Address ("0.0.0.1"), "trivial");
415 NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (1), "trivial");
416
417 entry.SetExpireTime (Seconds (3));
418 NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (3), "trivial");
419 entry.SetDestination (Ipv4Address ("1.1.1.1"));
420 NS_TEST_EXPECT_MSG_EQ (entry.GetDestination (), Ipv4Address ("1.1.1.1"), "trivial");
421 ip.push_back (Ipv4Address ("0.0.0.2"));
422 entry.SetVector (ip);
423 NS_TEST_EXPECT_MSG_EQ (entry.GetVector ().size (), 3, "trivial");
424
425 NS_TEST_EXPECT_MSG_EQ (rcache->AddRoute (entry), true, "trivial");
426
427 std::vector<Ipv4Address> ip2;
428 ip2.push_back (Ipv4Address ("1.1.1.0"));
429 ip2.push_back (Ipv4Address ("1.1.1.1"));
430 Ipv4Address dst2 = Ipv4Address ("1.1.1.1");
431 dsr::DsrRouteCacheEntry entry2 (ip2, dst2, Seconds (2));
433 NS_TEST_EXPECT_MSG_EQ (rcache->AddRoute (entry2), true, "trivial");
434 NS_TEST_EXPECT_MSG_EQ (rcache->LookupRoute (dst2, newEntry), true, "trivial");
435 NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("2.2.2.2")), false, "trivial");
436
437 NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("1.1.1.1")), true, "trivial");
438 NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("1.1.1.1")), false, "trivial");
439}
440// -----------------------------------------------------------------------------
449{
450public:
453 virtual void
454 DoRun (void);
456 void CheckSizeLimit ();
458 void CheckTimeout ();
459
461};
463 : TestCase ("DSR SendBuff"),
464 q ()
465{
466}
468{
469}
470void
472{
473 q.SetMaxQueueLen (32);
474 NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 32, "trivial");
477
478 Ptr<const Packet> packet = Create<Packet> ();
479 Ipv4Address dst1 = Ipv4Address ("0.0.0.1");
480 dsr::DsrSendBuffEntry e1 (packet, dst1, Seconds (1));
481 q.Enqueue (e1);
482 q.Enqueue (e1);
483 q.Enqueue (e1);
484 NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.1")), true, "trivial");
485 NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("1.1.1.1")), false, "trivial");
486 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 1, "trivial");
487 q.DropPacketWithDst (Ipv4Address ("0.0.0.1"));
488 NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.1")), false, "trivial");
489 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "trivial");
490
491 Ipv4Address dst2 = Ipv4Address ("0.0.0.2");
492 dsr::DsrSendBuffEntry e2 (packet, dst2, Seconds (1));
493 q.Enqueue (e1);
494 q.Enqueue (e2);
495 Ptr<Packet> packet2 = Create<Packet> ();
496 dsr::DsrSendBuffEntry e3 (packet2, dst2, Seconds (1));
497 NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("0.0.0.3"), e3), false, "trivial");
498 NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("0.0.0.2"), e3), true, "trivial");
499 NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.2")), false, "trivial");
500 q.Enqueue (e2);
501 q.Enqueue (e3);
502 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
503 Ptr<Packet> packet4 = Create<Packet> ();
504 Ipv4Address dst4 = Ipv4Address ("0.0.0.4");
505 dsr::DsrSendBuffEntry e4 (packet4, dst4, Seconds (20));
506 q.Enqueue (e4);
507 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
508 q.DropPacketWithDst (Ipv4Address ("0.0.0.4"));
509 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
510
512
513 Simulator::Schedule (q.GetSendBufferTimeout () + Seconds (1), &DsrSendBuffTest::CheckTimeout, this);
514
516 Simulator::Destroy ();
517}
518void
520{
521 Ptr<Packet> packet = Create<Packet> ();
522 Ipv4Address dst;
523 dsr::DsrSendBuffEntry e1 (packet, dst, Seconds (1));
524
525 for (uint32_t i = 0; i < q.GetMaxQueueLen (); ++i)
526 {
527 q.Enqueue (e1);
528 }
529 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
530
531 for (uint32_t i = 0; i < q.GetMaxQueueLen (); ++i)
532 {
533 q.Enqueue (e1);
534 }
535 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
536}
537void
539{
540 NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "Must be empty now");
541}
542// -----------------------------------------------------------------------------
551{
552public:
555 virtual void
556 DoRun (void);
557};
559 : TestCase ("DSR RreqTable")
560{
561}
563{
564}
565void
567{
569
570 rt.m_reqNo = 2;
571 NS_TEST_EXPECT_MSG_EQ (rt.m_reqNo, 2, "trivial");
572}
573// -----------------------------------------------------------------------------
582{
583public:
584 DsrTestSuite () : TestSuite ("routing-dsr", UNIT)
585 {
586 AddTestCase (new DsrFsHeaderTest, TestCase::QUICK);
587 AddTestCase (new DsrRreqHeaderTest, TestCase::QUICK);
588 AddTestCase (new DsrRrepHeaderTest, TestCase::QUICK);
589 AddTestCase (new DsrSRHeaderTest, TestCase::QUICK);
590 AddTestCase (new DsrRerrHeaderTest, TestCase::QUICK);
591 AddTestCase (new DsrAckReqHeaderTest, TestCase::QUICK);
592 AddTestCase (new DsrAckHeaderTest, TestCase::QUICK);
593 AddTestCase (new DsrCacheEntryTest, TestCase::QUICK);
594 AddTestCase (new DsrSendBuffTest, TestCase::QUICK);
595 }
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
Unit test for ACK.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for ACK-REQ.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for DSR route cache entry.
~DsrCacheEntryTest()
virtual void DoRun(void)
Implementation to actually run this TestCase.
DsrCacheEntryTest()
Unit test for DSR Fixed Size Header.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for RERR.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for RREP.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for RREQ.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for DSR routing table entry.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for Source Route.
virtual void DoRun(void)
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
virtual void DoRun(void)
Implementation to actually run this TestCase.
DSR test suite.
automatically resized byte buffer
Definition: buffer.h:93
void AddAtStart(uint32_t start)
Definition: buffer.cc:309
uint8_t const * PeekData(void) const
Definition: buffer.cc:710
Buffer::Iterator Begin(void) const
Definition: buffer.h:1069
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
Definition: packet.cc:362
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1197
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(DsrOptionHeader const &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.
virtual void SetErrorSrc(Ipv4Address errorSrcAddress)
Set the route error source address.
void SetUnreachNode(Ipv4Address unreachNode)
Set the unreachable node ip address.
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
virtual Ipv4Address GetErrorSrc() const
Get the route error source address.
virtual uint8_t GetSalvage() const
Get the salvage value of the packet.
virtual void SetSalvage(uint8_t salvage)
Set the salvage value of the packet.
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
Ipv4Address GetUnreachNode() const
Get the unreachable node 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:221
IP_VECTOR GetVector() const
Get the IP vector.
Definition: dsr-rcache.h:293
void SetDestination(Ipv4Address d)
Set destination address.
Definition: dsr-rcache.h:285
Ipv4Address GetDestination() const
Get destination address.
Definition: dsr-rcache.h:277
Time GetExpireTime() const
Get expire time.
Definition: dsr-rcache.h:317
void SetExpireTime(Time exp)
Set expire time.
Definition: dsr-rcache.h:309
void SetVector(IP_VECTOR v)
Sets the IP vector.
Definition: dsr-rcache.h:301
Header of Dsr Routing.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
DSR Send Buffer Entry.
Definition: dsr-rsendbuff.h:46
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:240
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
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.