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  }
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual Ipv4Address GetErrorSrc() const
Get the route error source address.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
uint32_t GetSize()
Number of entries.
uint16_t GetAckId() const
Set the Ack id number.
DSR send buffer.
uint32_t m_reqNo
Route request number.
void AddAtStart(uint32_t start)
Definition: buffer.cc:309
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
DsrRouteCacheEntry class for entries in the route cache.
Definition: dsr-rcache.h:220
void SetDestination(Ipv4Address d)
Set destination address.
Definition: dsr-rcache.h:285
void SetAckId(uint16_t identification)
Set the Ack request id number.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint16_t GetId() const
Set the request id number.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
Ipv4Address GetTarget()
Get the target ipv4 address.
Unit test for RERR.
Unit test for Source Route.
A suite of tests to run.
Definition: test.h:1342
automatically resized byte buffer
Definition: buffer.h:92
virtual void SetErrorSrc(Ipv4Address errorSrcAddress)
Set the route error source address.
virtual void DoRun(void)
Implementation to actually run this TestCase.
#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:285
void SetSegmentsLeft(uint8_t segmentsLeft)
Set the number of segments left to send.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t GetMaxQueueLen() const
Return the maximum queue length.
encapsulates test code
Definition: test.h:1155
void CheckSizeLimit()
Check size limit function.
Ipv4Address GetRealSrc() const
Get Error source ip address.
Unit test for ACK.
Unit test for ACK-REQ.
Source Route (SR) Message Format.
Acknowledgement Request (ACK_RREQ) Message Format.
Unit test for RREP.
virtual void SetSalvage(uint8_t salvage)
Set the salvage value of the packet.
Route Reply (RREP) Message Format.
IP_VECTOR GetVector() const
Get the IP vector.
Definition: dsr-rcache.h:293
virtual void DoRun(void)
Implementation to actually run this TestCase.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
Ipv4Address GetDestination() const
Get destination address.
Definition: dsr-rcache.h:277
Unit test for DSR routing table entry.
~DsrCacheEntryTest()
uint16_t GetAckId() const
Set the Ack request id number.
DSR test suite.
uint8_t data[writeSize]
void SetSendBufferTimeout(Time t)
Set the entry lifetime in the queue.
Ipv4Address GetUnreachNode() const
Get the unreachable node ip address.
Unit test for DSR route cache entry.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Unit test for RREQ.
bool Find(Ipv4Address dst)
Check if a packet with destination dst exists in the queue.
bool LookupRoute(Ipv4Address id, DsrRouteCacheEntry &rt)
Lookup route cache entry with destination address dst.
Definition: dsr-rcache.cc:208
Time GetExpireTime() const
Get expire time.
Definition: dsr-rcache.h:317
Acknowledgement (ACK) Message Format.
void SetTarget(Ipv4Address target)
Set the target ipv4 address.
void SetRealDst(Ipv4Address realDstAddress)
Set Error source ip address.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t GetType() const
Get the type of the option.
bool Enqueue(DsrSendBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...
virtual uint8_t GetSalvage() const
Get the salvage value of the packet.
bool DeleteRoute(Ipv4Address dst)
Delete the route with certain destination address.
Definition: dsr-rcache.cc:760
Route Request (RREQ) Message Format.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
void SetId(uint16_t identification)
Set the request id number.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Unit test for DSR Fixed Size Header.
DSR Send Buffer Entry.
Definition: dsr-rsendbuff.h:45
Unit test for Send Buffer.
Time GetSendBufferTimeout() const
Return the entry lifetime in the queue.
void SetUnreachNode(Ipv4Address unreachNode)
Set the unreachable node ip address.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
void SetMaxQueueLen(uint32_t len)
Set the maximum queue length.
DsrTestSuite g_dsrTestSuite
void CheckTimeout()
Check timeout function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void AddDsrOption(DsrOptionHeader const &option)
Serialize the option, prepending pad1 or padn option as necessary.
void SetVector(IP_VECTOR v)
Sets the IP vector.
Definition: dsr-rcache.h:301
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1014
Route Error (RERR) Unreachable node address option Message Format.
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
void SetRealSrc(Ipv4Address realSrcAddress)
Set Error source ip address.
void SetExpireTime(Time exp)
Set expire time.
Definition: dsr-rcache.h:309
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
Ipv4Address GetRealDst() const
Get Error source ip address.
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn&#39;t yet exist in route cache.
Definition: dsr-rcache.cc:657
virtual void DoRun(void)
Implementation to actually run this TestCase.
The route request table entries.
uint8_t GetSegmentsLeft() const
Get the number of segments left to send.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Header of Dsr Routing.
This test suite implements a Unit Test.
Definition: test.h:1352
void SetAckId(uint16_t identification)
Set the Ack id number.
virtual void DoRun(void)
Implementation to actually run this TestCase.
DsrCacheEntryTest()
void SetSalvage(uint8_t salvage)
Set the salvage value for a packet.
uint8_t GetSalvage() const
Get the salvage value for a packet.
dsr::DsrSendBuffer q
send buffer
bool Dequeue(Ipv4Address dst, DsrSendBuffEntry &entry)
Return first found (the earliest) entry for the given destination.