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 http://wiki.ittc.ku.edu/resilinets
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 
52 using namespace ns3;
53 using namespace dsr;
54 
55 // -----------------------------------------------------------------------------
69 class DsrFsHeaderTest : public TestCase
70 {
71 public:
72  DsrFsHeaderTest ();
73  ~DsrFsHeaderTest ();
74  virtual void
75  DoRun (void);
76 };
78  : TestCase ("DSR Fixed size Header")
79 {
80 }
82 {
83 }
84 void
86 {
87  dsr::DsrRoutingHeader header;
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 {
109 public:
112  virtual void
113  DoRun (void);
114 };
116  : TestCase ("DSR RREQ")
117 {
118 }
120 {
121 }
122 void
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> ();
141  dsr::DsrRoutingHeader header;
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 {
160 public:
163  virtual void
164  DoRun (void);
165 };
167  : TestCase ("DSR RREP")
168 {
169 }
171 {
172 }
173 void
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> ();
188  dsr::DsrRoutingHeader header;
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 // -----------------------------------------------------------------------------
205 class DsrSRHeaderTest : public TestCase
206 {
207 public:
208  DsrSRHeaderTest ();
209  ~DsrSRHeaderTest ();
210  virtual void
211  DoRun (void);
212 };
214  : TestCase ("DSR Source Route")
215 {
216 }
218 {
219 }
220 void
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> ();
239  dsr::DsrRoutingHeader header;
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 {
258 public:
261  virtual void
262  DoRun (void);
263 };
265  : TestCase ("DSR RERR")
266 {
267 }
269 {
270 }
271 void
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> ();
285  dsr::DsrRoutingHeader header;
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 {
303 public:
306  virtual void
307  DoRun (void);
308 };
310  : TestCase ("DSR Ack Req")
311 {
312 }
314 {
315 }
316 void
318 {
320 
321  h.SetAckId (1);
322  NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial");
323 
324  Ptr<Packet> p = Create<Packet> ();
325  dsr::DsrRoutingHeader header;
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 {
345 public:
346  DsrAckHeaderTest ();
348  virtual void
349  DoRun (void);
350 };
352  : TestCase ("DSR ACK")
353 {
354 }
356 {
357 }
358 void
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> ();
371  dsr::DsrRoutingHeader header;
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 {
391 public:
394  virtual void
395  DoRun (void);
396 };
398  : TestCase ("DSR ACK")
399 {
400 }
402 {
403 }
404 void
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));
432  dsr::DsrRouteCacheEntry newEntry;
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 // -----------------------------------------------------------------------------
448 class DsrSendBuffTest : public TestCase
449 {
450 public:
451  DsrSendBuffTest ();
452  ~DsrSendBuffTest ();
453  virtual void
454  DoRun (void);
456  void CheckSizeLimit ();
458  void CheckTimeout ();
459 
461 };
463  : TestCase ("DSR SendBuff"),
464  q ()
465 {
466 }
468 {
469 }
470 void
472 {
473  q.SetMaxQueueLen (32);
474  NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 32, "trivial");
476  NS_TEST_EXPECT_MSG_EQ (q.GetSendBufferTimeout (), Seconds (10), "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 
511  CheckSizeLimit ();
512 
513  Simulator::Schedule (q.GetSendBufferTimeout () + Seconds (1), &DsrSendBuffTest::CheckTimeout, this);
514 
515  Simulator::Run ();
516  Simulator::Destroy ();
517 }
518 void
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 }
537 void
539 {
540  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "Must be empty now");
541 }
542 // -----------------------------------------------------------------------------
551 {
552 public:
553  DsrRreqTableTest ();
555  virtual void
556  DoRun (void);
557 };
559  : TestCase ("DSR RreqTable")
560 {
561 }
563 {
564 }
565 void
567 {
569 
570  rt.m_reqNo = 2;
571  NS_TEST_EXPECT_MSG_EQ (rt.m_reqNo, 2, "trivial");
572 }
573 // -----------------------------------------------------------------------------
581 class DsrTestSuite : public TestSuite
582 {
583 public:
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  }
ns3::dsr::DsrOptionRreqHeader::SetId
void SetId(uint16_t identification)
Set the request id number.
Definition: dsr-option-header.cc:325
ns3::dsr::DsrRouteCacheEntry::SetDestination
void SetDestination(Ipv4Address d)
Set destination address.
Definition: dsr-rcache.h:285
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
ns3::dsr::DsrRouteCacheEntry::GetDestination
Ipv4Address GetDestination() const
Get destination address.
Definition: dsr-rcache.h:277
ns3::dsr::DsrOptionField::AddDsrOption
void AddDsrOption(DsrOptionHeader const &option)
Serialize the option, prepending pad1 or padn option as necessary.
Definition: dsr-fs-header.cc:224
ns3::dsr::DsrRouteCache::AddRoute
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn't yet exist in route cache.
Definition: dsr-rcache.cc:657
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
ns3::dsr::DsrRoutingHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: dsr-fs-header.cc:302
ns3::dsr::DsrOptionRreqHeader::SetNumberAddress
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
Definition: dsr-option-header.cc:277
ns3::dsr::DsrOptionAckReqHeader
Acknowledgement Request (ACK_RREQ) Message Format.
Definition: dsr-option-header.h:1158
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::dsr::DsrRouteCacheEntry
DsrRouteCacheEntry class for entries in the route cache.
Definition: dsr-rcache.h:221
DsrFsHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:85
ns3::dsr::DsrOptionRerrUnreachHeader::GetUnreachNode
Ipv4Address GetUnreachNode() const
Get the unreachable node ip address.
Definition: dsr-option-header.cc:849
ns3::dsr::DsrRoutingHeader::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
Definition: dsr-fs-header.cc:296
ns3::dsr::DsrOptionSRHeader::GetNodeAddress
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
Definition: dsr-option-header.cc:590
ns3::dsr::DsrOptionHeader::GetType
uint8_t GetType() const
Get the type of the option.
Definition: dsr-option-header.cc:79
DsrRerrHeaderTest
Unit test for RERR.
Definition: dsr-test-suite.cc:257
ns3::dsr::DsrRouteCache::DeleteRoute
bool DeleteRoute(Ipv4Address dst)
Delete the route with certain destination address.
Definition: dsr-rcache.cc:760
ns3::dsr::DsrSendBuffer::Enqueue
bool Enqueue(DsrSendBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
Definition: dsr-rsendbuff.cc:53
ns3::dsr::DsrRouteCacheEntry::SetVector
void SetVector(IP_VECTOR v)
Sets the IP vector.
Definition: dsr-rcache.h:301
DsrRrepHeaderTest::~DsrRrepHeaderTest
~DsrRrepHeaderTest()
Definition: dsr-test-suite.cc:170
ns3::dsr::DsrOptionSRHeader::SetNumberAddress
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
Definition: dsr-option-header.cc:568
ns3::dsr::DsrOptionRerrUnreachHeader::GetSalvage
virtual uint8_t GetSalvage() const
Get the salvage value of the packet.
Definition: dsr-option-header.cc:819
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::dsr::DsrOptionRreqHeader::GetTarget
Ipv4Address GetTarget()
Get the target ipv4 address.
Definition: dsr-option-header.cc:283
ns3::dsr::DsrOptionAckHeader::GetRealSrc
Ipv4Address GetRealSrc() const
Get Error source ip address.
Definition: dsr-option-header.cc:1150
ns3::dsr::DsrOptionRerrUnreachHeader::GetErrorDst
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
Definition: dsr-option-header.cc:839
DsrRreqHeaderTest::~DsrRreqHeaderTest
~DsrRreqHeaderTest()
Definition: dsr-test-suite.cc:119
DsrCacheEntryTest::~DsrCacheEntryTest
~DsrCacheEntryTest()
Definition: dsr-test-suite.cc:401
ns3::dsr::DsrSendBuffEntry
DSR Send Buffer Entry.
Definition: dsr-rsendbuff.h:46
ns3::dsr::DsrRouteCacheEntry::GetVector
IP_VECTOR GetVector() const
Get the IP vector.
Definition: dsr-rcache.h:293
DsrRrepHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:174
DsrSendBuffTest
Unit test for Send Buffer.
Definition: dsr-test-suite.cc:449
ns3::Buffer::AddAtStart
void AddAtStart(uint32_t start)
Definition: buffer.cc:309
DsrRreqTableTest::DsrRreqTableTest
DsrRreqTableTest()
Definition: dsr-test-suite.cc:558
ns3::dsr::DsrOptionRrepHeader
Route Reply (RREP) Message Format.
Definition: dsr-option-header.h:445
ns3::TestCase
encapsulates test code
Definition: test.h:1154
DsrRrepHeaderTest
Unit test for RREP.
Definition: dsr-test-suite.cc:159
ns3::dsr::DsrOptionAckReqHeader::GetAckId
uint16_t GetAckId() const
Set the Ack request id number.
Definition: dsr-option-header.cc:1065
ns3::dsr::DsrOptionRerrUnreachHeader::SetSalvage
virtual void SetSalvage(uint8_t salvage)
Set the salvage value of the packet.
Definition: dsr-option-header.cc:814
ns3::dsr::DsrOptionRreqHeader::GetId
uint16_t GetId() const
Set the request id number.
Definition: dsr-option-header.cc:330
ns3::dsr::DsrOptionAckHeader
Acknowledgement (ACK) Message Format.
Definition: dsr-option-header.h:1244
DsrAckReqHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:317
ns3::Ptr< Packet >
ns3::dsr::DsrSendBuffer::Find
bool Find(Ipv4Address dst)
Check if a packet with destination dst exists in the queue.
Definition: dsr-rsendbuff.cc:125
DsrSendBuffTest::CheckTimeout
void CheckTimeout()
Check timeout function.
Definition: dsr-test-suite.cc:538
ns3::dsr::DsrRoutingHeader
Header of Dsr Routing.
Definition: dsr-fs-header.h:278
DsrCacheEntryTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:405
ns3::Packet::RemoveAtStart
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
Definition: packet.cc:362
ns3::dsr::RreqTableEntry::m_reqNo
uint32_t m_reqNo
Route request number.
Definition: dsr-rreq-table.h:79
DsrAckHeaderTest::DsrAckHeaderTest
DsrAckHeaderTest()
Definition: dsr-test-suite.cc:351
ns3::dsr::DsrOptionAckHeader::SetAckId
void SetAckId(uint16_t identification)
Set the Ack id number.
Definition: dsr-option-header.cc:1135
ns3::dsr::DsrRouteCacheEntry::SetExpireTime
void SetExpireTime(Time exp)
Set expire time.
Definition: dsr-rcache.h:309
DsrFsHeaderTest
Unit test for DSR Fixed Size Header.
Definition: dsr-test-suite.cc:70
data
uint8_t data[writeSize]
Definition: socket-bound-tcp-static-routing.cc:53
ns3::dsr::DsrRouteCacheEntry::GetExpireTime
Time GetExpireTime() const
Get expire time.
Definition: dsr-rcache.h:317
DsrTestSuite
DSR test suite.
Definition: dsr-test-suite.cc:582
DsrSendBuffTest::~DsrSendBuffTest
~DsrSendBuffTest()
Definition: dsr-test-suite.cc:467
DsrCacheEntryTest
Unit test for DSR route cache entry.
Definition: dsr-test-suite.cc:390
ns3::dsr::DsrSendBuffer::GetMaxQueueLen
uint32_t GetMaxQueueLen() const
Return the maximum queue length.
Definition: dsr-rsendbuff.h:208
ns3::dsr::DsrOptionRrepHeader::SetNodesAddress
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Definition: dsr-option-header.cc:431
ns3::Packet::RemoveHeader
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
DsrAckReqHeaderTest::DsrAckReqHeaderTest
DsrAckReqHeaderTest()
Definition: dsr-test-suite.cc:309
DsrRerrHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:272
DsrRerrHeaderTest::~DsrRerrHeaderTest
~DsrRerrHeaderTest()
Definition: dsr-test-suite.cc:268
DsrSendBuffTest::q
dsr::DsrSendBuffer q
send buffer
Definition: dsr-test-suite.cc:460
ns3::Buffer
automatically resized byte buffer
Definition: buffer.h:93
ns3::dsr::DsrOptionRreqHeader::SetTarget
void SetTarget(Ipv4Address target)
Set the target ipv4 address.
Definition: dsr-option-header.cc:288
ns3::dsr::RreqTableEntry
The route request table entries.
Definition: dsr-rreq-table.h:78
ns3::Buffer::PeekData
uint8_t const * PeekData(void) const
Definition: buffer.cc:710
DsrRreqHeaderTest
Unit test for RREQ.
Definition: dsr-test-suite.cc:108
NS_TEST_EXPECT_MSG_EQ
#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:283
DsrCacheEntryTest::DsrCacheEntryTest
DsrCacheEntryTest()
Definition: dsr-test-suite.cc:397
DsrRerrHeaderTest::DsrRerrHeaderTest
DsrRerrHeaderTest()
Definition: dsr-test-suite.cc:264
ns3::Buffer::Begin
Buffer::Iterator Begin(void) const
Definition: buffer.h:1069
DsrSRHeaderTest
Unit test for Source Route.
Definition: dsr-test-suite.cc:206
ns3::dsr::DsrOptionRerrUnreachHeader::GetErrorSrc
virtual Ipv4Address GetErrorSrc() const
Get the route error source address.
Definition: dsr-option-header.cc:829
ns3::dsr::DsrSendBuffer::Dequeue
bool Dequeue(Ipv4Address dst, DsrSendBuffEntry &entry)
Return first found (the earliest) entry for the given destination.
Definition: dsr-rsendbuff.cc:105
DsrRreqTableTest::~DsrRreqTableTest
~DsrRreqTableTest()
Definition: dsr-test-suite.cc:562
ns3::dsr::DsrOptionSRHeader::GetSalvage
uint8_t GetSalvage() const
Get the salvage value for a packet.
Definition: dsr-option-header.cc:563
ns3::dsr::DsrOptionAckHeader::SetRealDst
void SetRealDst(Ipv4Address realDstAddress)
Set Error source ip address.
Definition: dsr-option-header.cc:1155
ns3::dsr::DsrSendBuffer::GetSize
uint32_t GetSize()
Number of entries.
Definition: dsr-rsendbuff.cc:46
ns3::dsr::DsrOptionSRHeader::SetSegmentsLeft
void SetSegmentsLeft(uint8_t segmentsLeft)
Set the number of segments left to send.
Definition: dsr-option-header.cc:548
ns3::dsr::DsrOptionRerrUnreachHeader
Route Error (RERR) Unreachable node address option Message Format.
Definition: dsr-option-header.h:874
ns3::dsr::DsrOptionRrepHeader::GetNodeAddress
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
Definition: dsr-option-header.cc:447
DsrSendBuffTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:471
ns3::dsr::DsrOptionAckHeader::GetAckId
uint16_t GetAckId() const
Set the Ack id number.
Definition: dsr-option-header.cc:1140
DsrSRHeaderTest::DsrSRHeaderTest
DsrSRHeaderTest()
Definition: dsr-test-suite.cc:213
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
ns3::dsr::DsrOptionAckReqHeader::SetAckId
void SetAckId(uint16_t identification)
Set the Ack request id number.
Definition: dsr-option-header.cc:1060
ns3::dsr::DsrOptionRerrUnreachHeader::SetErrorSrc
virtual void SetErrorSrc(Ipv4Address errorSrcAddress)
Set the route error source address.
Definition: dsr-option-header.cc:824
ns3::dsr::DsrSendBuffer::SetSendBufferTimeout
void SetSendBufferTimeout(Time t)
Set the entry lifetime in the queue.
Definition: dsr-rsendbuff.h:235
DsrRreqTableTest
Unit test for DSR routing table entry.
Definition: dsr-test-suite.cc:551
DsrSRHeaderTest::~DsrSRHeaderTest
~DsrSRHeaderTest()
Definition: dsr-test-suite.cc:217
ns3::TestSuite::UNIT
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1353
DsrRreqTableTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:566
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
DsrAckReqHeaderTest::~DsrAckReqHeaderTest
~DsrAckReqHeaderTest()
Definition: dsr-test-suite.cc:313
ns3::dsr::DsrOptionRreqHeader::GetNodeAddress
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
Definition: dsr-option-header.cc:320
ns3::dsr::DsrSendBuffer
DSR send buffer.
Definition: dsr-rsendbuff.h:157
DsrTestSuite::DsrTestSuite
DsrTestSuite()
Definition: dsr-test-suite.cc:584
DsrSendBuffTest::CheckSizeLimit
void CheckSizeLimit()
Check size limit function.
Definition: dsr-test-suite.cc:519
DsrAckHeaderTest
Unit test for ACK.
Definition: dsr-test-suite.cc:344
ns3::dsr::DsrOptionRreqHeader
Route Request (RREQ) Message Format.
Definition: dsr-option-header.h:270
ns3::dsr::DsrSendBuffer::GetSendBufferTimeout
Time GetSendBufferTimeout() const
Return the entry lifetime in the queue.
Definition: dsr-rsendbuff.h:226
ns3::dsr::DsrSendBuffer::DropPacketWithDst
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
Definition: dsr-rsendbuff.cc:84
ns3::dsr::DsrOptionSRHeader
Source Route (SR) Message Format.
Definition: dsr-option-header.h:566
ns3::dsr::DsrOptionSRHeader::SetNodesAddress
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Definition: dsr-option-header.cc:574
DsrRreqHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:123
DsrFsHeaderTest::~DsrFsHeaderTest
~DsrFsHeaderTest()
Definition: dsr-test-suite.cc:81
ns3::dsr::DsrOptionRerrUnreachHeader::SetErrorDst
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
Definition: dsr-option-header.cc:834
DsrAckHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:359
ns3::dsr::DsrSendBuffer::SetMaxQueueLen
void SetMaxQueueLen(uint32_t len)
Set the maximum queue length.
Definition: dsr-rsendbuff.h:217
ns3::dsr::DsrOptionSRHeader::GetSegmentsLeft
uint8_t GetSegmentsLeft() const
Get the number of segments left to send.
Definition: dsr-option-header.cc:553
DsrRrepHeaderTest::DsrRrepHeaderTest
DsrRrepHeaderTest()
Definition: dsr-test-suite.cc:166
ns3::dsr::DsrOptionAckHeader::GetRealDst
Ipv4Address GetRealDst() const
Get Error source ip address.
Definition: dsr-option-header.cc:1160
ns3::dsr::DsrRouteCache::LookupRoute
bool LookupRoute(Ipv4Address id, DsrRouteCacheEntry &rt)
Lookup route cache entry with destination address dst.
Definition: dsr-rcache.cc:208
DsrSRHeaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: dsr-test-suite.cc:221
ns3::dsr::DsrOptionAckHeader::SetRealSrc
void SetRealSrc(Ipv4Address realSrcAddress)
Set Error source ip address.
Definition: dsr-option-header.cc:1145
g_dsrTestSuite
DsrTestSuite g_dsrTestSuite
ns3::dsr::DsrOptionSRHeader::SetSalvage
void SetSalvage(uint8_t salvage)
Set the salvage value for a packet.
Definition: dsr-option-header.cc:558
DsrAckReqHeaderTest
Unit test for ACK-REQ.
Definition: dsr-test-suite.cc:302
DsrFsHeaderTest::DsrFsHeaderTest
DsrFsHeaderTest()
Definition: dsr-test-suite.cc:77
ns3::dsr::DsrOptionRerrUnreachHeader::SetUnreachNode
void SetUnreachNode(Ipv4Address unreachNode)
Set the unreachable node ip address.
Definition: dsr-option-header.cc:844
DsrRreqHeaderTest::DsrRreqHeaderTest
DsrRreqHeaderTest()
Definition: dsr-test-suite.cc:115
ns3::dsr::DsrOptionRreqHeader::SetNodesAddress
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Definition: dsr-option-header.cc:299
DsrAckHeaderTest::~DsrAckHeaderTest
~DsrAckHeaderTest()
Definition: dsr-test-suite.cc:355
ns3::dsr::DsrOptionRrepHeader::SetNumberAddress
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
Definition: dsr-option-header.cc:425
DsrSendBuffTest::DsrSendBuffTest
DsrSendBuffTest()
Definition: dsr-test-suite.cc:462