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 // -----------------------------------------------------------------------------
56 // / Unit test for DSR Fixed Size Header
57 class DsrFsHeaderTest : public TestCase
58 {
59 public:
60  DsrFsHeaderTest ();
61  ~DsrFsHeaderTest ();
62  virtual void
63  DoRun (void);
64 };
66  : TestCase ("DSR Fixed size Header")
67 {
68 }
70 {
71 }
72 void
74 {
75  dsr::DsrRoutingHeader header;
76  dsr::DsrOptionRreqHeader rreqHeader;
77  header.AddDsrOption (rreqHeader); // has an alignment of 4n+0
78 
79  NS_TEST_EXPECT_MSG_EQ (header.GetSerializedSize () % 2, 0, "length of routing header is not a multiple of 4");
80  Buffer buf;
81  buf.AddAtStart (header.GetSerializedSize ());
82  header.Serialize (buf.Begin ());
83 
84  const uint8_t* data = buf.PeekData ();
85  NS_TEST_EXPECT_MSG_EQ (*(data + 8), rreqHeader.GetType (), "expect the rreqHeader after fixed size header");
86 }
87 // -----------------------------------------------------------------------------
88 // / Unit test for RREQ
90 {
91 public:
94  virtual void
95  DoRun (void);
96 };
98  : TestCase ("DSR RREQ")
99 {
100 }
102 {
103 }
104 void
106 {
108  std::vector<Ipv4Address> nodeList;
109  nodeList.push_back (Ipv4Address ("1.1.1.0"));
110  nodeList.push_back (Ipv4Address ("1.1.1.1"));
111  nodeList.push_back (Ipv4Address ("1.1.1.2"));
112 
113  h.SetTarget (Ipv4Address ("1.1.1.3"));
114  NS_TEST_EXPECT_MSG_EQ (h.GetTarget (), Ipv4Address ("1.1.1.3"), "trivial");
115  h.SetNodesAddress (nodeList);
116  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (0), Ipv4Address ("1.1.1.0"), "trivial");
117  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (1), Ipv4Address ("1.1.1.1"), "trivial");
118  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (2), Ipv4Address ("1.1.1.2"), "trivial");
119  h.SetId (1);
120  NS_TEST_EXPECT_MSG_EQ (h.GetId (), 1, "trivial");
121 
122  Ptr<Packet> p = Create<Packet> ();
123  dsr::DsrRoutingHeader header;
124  header.AddDsrOption (h);
125  p->AddHeader (header);
126  p->RemoveAtStart (8);
128  h2.SetNumberAddress (3);
129  uint32_t bytes = p->RemoveHeader (h2);
130  NS_TEST_EXPECT_MSG_EQ (bytes, 20, "Total RREP is 20 bytes long");
131 }
132 // -----------------------------------------------------------------------------
133 // / Unit test for RREP
135 {
136 public:
139  virtual void
140  DoRun (void);
141 };
143  : TestCase ("DSR RREP")
144 {
145 }
147 {
148 }
149 void
151 {
153 
154  std::vector<Ipv4Address> nodeList;
155  nodeList.push_back (Ipv4Address ("1.1.1.0"));
156  nodeList.push_back (Ipv4Address ("1.1.1.1"));
157  nodeList.push_back (Ipv4Address ("1.1.1.2"));
158  h.SetNodesAddress (nodeList);
159  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (0), Ipv4Address ("1.1.1.0"), "trivial");
160  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (1), Ipv4Address ("1.1.1.1"), "trivial");
161  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (2), Ipv4Address ("1.1.1.2"), "trivial");
162 
163  Ptr<Packet> p = Create<Packet> ();
164  dsr::DsrRoutingHeader header;
165  header.AddDsrOption (h);
166  p->AddHeader (header);
167  p->RemoveAtStart (8);
169  h2.SetNumberAddress (3);
170  uint32_t bytes = p->RemoveHeader (h2);
171  NS_TEST_EXPECT_MSG_EQ (bytes, 16, "Total RREP is 16 bytes long");
172 }
173 // -----------------------------------------------------------------------------
174 // / Unit test for Source Route
175 class DsrSRHeaderTest : public TestCase
176 {
177 public:
178  DsrSRHeaderTest ();
179  ~DsrSRHeaderTest ();
180  virtual void
181  DoRun (void);
182 };
184  : TestCase ("DSR Source Route")
185 {
186 }
188 {
189 }
190 void
192 {
194  std::vector<Ipv4Address> nodeList;
195  nodeList.push_back (Ipv4Address ("1.1.1.0"));
196  nodeList.push_back (Ipv4Address ("1.1.1.1"));
197  nodeList.push_back (Ipv4Address ("1.1.1.2"));
198  h.SetNodesAddress (nodeList);
199  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (0), Ipv4Address ("1.1.1.0"), "trivial");
200  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (1), Ipv4Address ("1.1.1.1"), "trivial");
201  NS_TEST_EXPECT_MSG_EQ (h.GetNodeAddress (2), Ipv4Address ("1.1.1.2"), "trivial");
202 
203  h.SetSalvage (1);
204  NS_TEST_EXPECT_MSG_EQ (h.GetSalvage (), 1, "trivial");
205  h.SetSegmentsLeft (2);
206  NS_TEST_EXPECT_MSG_EQ (h.GetSegmentsLeft (), 2, "trivial");
207 
208  Ptr<Packet> p = Create<Packet> ();
209  dsr::DsrRoutingHeader header;
210  header.AddDsrOption (h);
211  p->AddHeader (header);
212  p->RemoveAtStart (8);
214  h2.SetNumberAddress (3);
215  uint32_t bytes = p->RemoveHeader (h2);
216  NS_TEST_EXPECT_MSG_EQ (bytes, 16, "Total RREP is 16 bytes long");
217 }
218 // -----------------------------------------------------------------------------
219 // / Unit test for RERR
221 {
222 public:
225  virtual void
226  DoRun (void);
227 };
229  : TestCase ("DSR RERR")
230 {
231 }
233 {
234 }
235 void
237 {
239  h.SetErrorSrc (Ipv4Address ("1.1.1.0"));
240  NS_TEST_EXPECT_MSG_EQ (h.GetErrorSrc (), Ipv4Address ("1.1.1.0"), "trivial");
241  h.SetErrorDst (Ipv4Address ("1.1.1.1"));
242  NS_TEST_EXPECT_MSG_EQ (h.GetErrorDst (), Ipv4Address ("1.1.1.1"), "trivial");
243  h.SetSalvage (1);
244  NS_TEST_EXPECT_MSG_EQ (h.GetSalvage (), 1, "trivial");
245  h.SetUnreachNode (Ipv4Address ("1.1.1.2"));
246  NS_TEST_EXPECT_MSG_EQ (h.GetUnreachNode (), Ipv4Address ("1.1.1.2"), "trivial");
247 
248  Ptr<Packet> p = Create<Packet> ();
249  dsr::DsrRoutingHeader header;
250  header.AddDsrOption (h);
251  p->AddHeader (header);
252  p->RemoveAtStart (8);
254  uint32_t bytes = p->RemoveHeader (h2);
255  NS_TEST_EXPECT_MSG_EQ (bytes, 20, "Total RREP is 20 bytes long");
256 }
257 // -----------------------------------------------------------------------------
258 // / Unit test for ACK-REQ
260 {
261 public:
264  virtual void
265  DoRun (void);
266 };
268  : TestCase ("DSR Ack Req")
269 {
270 }
272 {
273 }
274 void
276 {
278 
279  h.SetAckId (1);
280  NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial");
281 
282  Ptr<Packet> p = Create<Packet> ();
283  dsr::DsrRoutingHeader header;
284  header.AddDsrOption (h);
285  p->AddHeader (header);
286  p->RemoveAtStart (8);
287  p->AddHeader (header);
289  p->RemoveAtStart (8);
290  uint32_t bytes = p->RemoveHeader (h2);
291  NS_TEST_EXPECT_MSG_EQ (bytes, 4, "Total RREP is 4 bytes long");
292 }
293 // -----------------------------------------------------------------------------
294 // / Unit test for ACK
296 {
297 public:
298  DsrAckHeaderTest ();
300  virtual void
301  DoRun (void);
302 };
304  : TestCase ("DSR ACK")
305 {
306 }
308 {
309 }
310 void
312 {
314 
315  h.SetRealSrc (Ipv4Address ("1.1.1.0"));
316  NS_TEST_EXPECT_MSG_EQ (h.GetRealSrc (), Ipv4Address ("1.1.1.0"), "trivial");
317  h.SetRealDst (Ipv4Address ("1.1.1.1"));
318  NS_TEST_EXPECT_MSG_EQ (h.GetRealDst (), Ipv4Address ("1.1.1.1"), "trivial");
319  h.SetAckId (1);
320  NS_TEST_EXPECT_MSG_EQ (h.GetAckId (), 1, "trivial");
321 
322  Ptr<Packet> p = Create<Packet> ();
323  dsr::DsrRoutingHeader header;
324  header.AddDsrOption (h);
325  p->AddHeader (header);
326  p->RemoveAtStart (8);
327  p->AddHeader (header);
329  p->RemoveAtStart (8);
330  uint32_t bytes = p->RemoveHeader (h2);
331  NS_TEST_EXPECT_MSG_EQ (bytes, 12, "Total RREP is 12 bytes long");
332 }
333 // -----------------------------------------------------------------------------
334 // / Unit test for DSR route cache entry
336 {
337 public:
340  virtual void
341  DoRun (void);
342 };
344  : TestCase ("DSR ACK")
345 {
346 }
348 {
349 }
350 void
352 {
353  Ptr<dsr::DsrRouteCache> rcache = CreateObject<dsr::DsrRouteCache> ();
354  std::vector<Ipv4Address> ip;
355  ip.push_back (Ipv4Address ("0.0.0.0"));
356  ip.push_back (Ipv4Address ("0.0.0.1"));
357  Ipv4Address dst = Ipv4Address ("0.0.0.1");
358  dsr::DsrRouteCacheEntry entry (ip, dst, Seconds (1));
359  NS_TEST_EXPECT_MSG_EQ (entry.GetVector ().size (), 2, "trivial");
360  NS_TEST_EXPECT_MSG_EQ (entry.GetDestination (), Ipv4Address ("0.0.0.1"), "trivial");
361  NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (1), "trivial");
362 
363  entry.SetExpireTime (Seconds (3));
364  NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (3), "trivial");
365  entry.SetDestination (Ipv4Address ("1.1.1.1"));
366  NS_TEST_EXPECT_MSG_EQ (entry.GetDestination (), Ipv4Address ("1.1.1.1"), "trivial");
367  ip.push_back (Ipv4Address ("0.0.0.2"));
368  entry.SetVector (ip);
369  NS_TEST_EXPECT_MSG_EQ (entry.GetVector ().size (), 3, "trivial");
370 
371  NS_TEST_EXPECT_MSG_EQ (rcache->AddRoute (entry), true, "trivial");
372 
373  std::vector<Ipv4Address> ip2;
374  ip2.push_back (Ipv4Address ("1.1.1.0"));
375  ip2.push_back (Ipv4Address ("1.1.1.1"));
376  Ipv4Address dst2 = Ipv4Address ("1.1.1.1");
377  dsr::DsrRouteCacheEntry entry2 (ip2, dst2, Seconds (2));
378  dsr::DsrRouteCacheEntry newEntry;
379  NS_TEST_EXPECT_MSG_EQ (rcache->AddRoute (entry2), true, "trivial");
380  NS_TEST_EXPECT_MSG_EQ (rcache->LookupRoute (dst2, newEntry), true, "trivial");
381  NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("2.2.2.2")), false, "trivial");
382 
383  NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("1.1.1.1")), true, "trivial");
384  NS_TEST_EXPECT_MSG_EQ (rcache->DeleteRoute (Ipv4Address ("1.1.1.1")), false, "trivial");
385 }
386 // -----------------------------------------------------------------------------
387 // / Unit test for Send Buffer
388 class DsrSendBuffTest : public TestCase
389 {
390 public:
391  DsrSendBuffTest ();
392  ~DsrSendBuffTest ();
393  virtual void
394  DoRun (void);
395  void CheckSizeLimit ();
396  void CheckTimeout ();
397 
399 };
401  : TestCase ("DSR SendBuff"),
402  q ()
403 {
404 }
406 {
407 }
408 void
410 {
411  q.SetMaxQueueLen (32);
412  NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 32, "trivial");
414  NS_TEST_EXPECT_MSG_EQ (q.GetSendBufferTimeout (), Seconds (10), "trivial");
415 
416  Ptr<const Packet> packet = Create<Packet> ();
417  Ipv4Address dst1 = Ipv4Address ("0.0.0.1");
418  dsr::DsrSendBuffEntry e1 (packet, dst1, Seconds (1));
419  q.Enqueue (e1);
420  q.Enqueue (e1);
421  q.Enqueue (e1);
422  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.1")), true, "trivial");
423  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("1.1.1.1")), false, "trivial");
424  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 1, "trivial");
425  q.DropPacketWithDst (Ipv4Address ("0.0.0.1"));
426  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.1")), false, "trivial");
427  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "trivial");
428 
429  Ipv4Address dst2 = Ipv4Address ("0.0.0.2");
430  dsr::DsrSendBuffEntry e2 (packet, dst2, Seconds (1));
431  q.Enqueue (e1);
432  q.Enqueue (e2);
433  Ptr<Packet> packet2 = Create<Packet> ();
434  dsr::DsrSendBuffEntry e3 (packet2, dst2, Seconds (1));
435  NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("0.0.0.3"), e3), false, "trivial");
436  NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("0.0.0.2"), e3), true, "trivial");
437  NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("0.0.0.2")), false, "trivial");
438  q.Enqueue (e2);
439  q.Enqueue (e3);
440  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
441  Ptr<Packet> packet4 = Create<Packet> ();
442  Ipv4Address dst4 = Ipv4Address ("0.0.0.4");
443  dsr::DsrSendBuffEntry e4 (packet4, dst4, Seconds (20));
444  q.Enqueue (e4);
445  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
446  q.DropPacketWithDst (Ipv4Address ("0.0.0.4"));
447  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 2, "trivial");
448 
449  CheckSizeLimit ();
450 
451  Simulator::Schedule (q.GetSendBufferTimeout () + Seconds (1), &DsrSendBuffTest::CheckTimeout, this);
452 
453  Simulator::Run ();
454  Simulator::Destroy ();
455 }
456 void
458 {
459  Ptr<Packet> packet = Create<Packet> ();
460  Ipv4Address dst;
461  dsr::DsrSendBuffEntry e1 (packet, dst, Seconds (1));
462 
463  for (uint32_t i = 0; i < q.GetMaxQueueLen (); ++i)
464  {
465  q.Enqueue (e1);
466  }
467  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
468 
469  for (uint32_t i = 0; i < q.GetMaxQueueLen (); ++i)
470  {
471  q.Enqueue (e1);
472  }
473  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial");
474 }
475 void
477 {
478  NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 0, "Must be empty now");
479 }
480 // -----------------------------------------------------------------------------
481 // / Unit test for DSR routing table entry
483 {
484 public:
485  DsrRreqTableTest ();
487  virtual void
488  DoRun (void);
489 };
491  : TestCase ("DSR RreqTable")
492 {
493 }
495 {
496 }
497 void
499 {
501 
502  rt.m_reqNo = 2;
503  NS_TEST_EXPECT_MSG_EQ (rt.m_reqNo, 2, "trivial");
504 }
505 // -----------------------------------------------------------------------------
506 class DsrTestSuite : public TestSuite
507 {
508 public:
509  DsrTestSuite () : TestSuite ("routing-dsr", UNIT)
510  {
511  AddTestCase (new DsrFsHeaderTest, TestCase::QUICK);
512  AddTestCase (new DsrRreqHeaderTest, TestCase::QUICK);
513  AddTestCase (new DsrRrepHeaderTest, TestCase::QUICK);
514  AddTestCase (new DsrSRHeaderTest, TestCase::QUICK);
515  AddTestCase (new DsrRerrHeaderTest, TestCase::QUICK);
516  AddTestCase (new DsrAckReqHeaderTest, TestCase::QUICK);
517  AddTestCase (new DsrAckHeaderTest, TestCase::QUICK);
518  AddTestCase (new DsrCacheEntryTest, TestCase::QUICK);
519  AddTestCase (new DsrSendBuffTest, TestCase::QUICK);
520  }
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
Ipv4Address GetDestination() const
Definition: dsr-rcache.h:203
Definition: dsr-rcache.h:174
void SetDestination(Ipv4Address d)
Definition: dsr-rcache.h:207
void SetAckId(uint16_t identification)
Set the Ack request id number.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
Time GetSendBufferTimeout() const
Return the entry lifetime in the queue.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ipv4Address GetTarget()
Get the target ipv4 address.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
virtual Ipv4Address GetErrorSrc() const
Get the route error source address.
uint16_t GetId() const
Set the request id number.
A suite of tests to run.
Definition: test.h:1333
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.
IP_VECTOR GetVector() const
Definition: dsr-rcache.h:211
#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:278
void SetSegmentsLeft(uint8_t segmentsLeft)
virtual void DoRun(void)
Implementation to actually run this TestCase.
encapsulates test code
Definition: test.h:1147
This test suite implements a Unit Test.
Definition: test.h:1343
Source Route (SR) Message Format.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Acknowledgement Request (ACK_RREQ) Message Format.
Ipv4Address GetUnreachNode() const
Get the unreachable node ip address.
virtual void SetSalvage(uint8_t salvage)
Set the salvage value of the packet.
Route Reply (RREP) Message Format.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Definition: test.cc:298
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
uint16_t GetAckId() const
Set the Ack request id number.
~DsrCacheEntryTest()
uint8_t data[writeSize]
void SetSendBufferTimeout(Time t)
Set the entry lifetime in the queue.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
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
Ipv4Address GetRealSrc() const
Get Error source ip address.
Time GetExpireTime() const
Definition: dsr-rcache.h:223
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.
bool Enqueue(DsrSendBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...
bool DeleteRoute(Ipv4Address dst)
Delete the route with certain destination address.
Definition: dsr-rcache.cc:760
Route Request (RREQ) Message Format.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
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.
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
DSR Send Buffer Entry.
Definition: dsr-rsendbuff.h:45
Ipv4Address GetRealDst() const
Get Error source ip address.
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
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)
Definition: dsr-rcache.h:215
uint32_t GetMaxQueueLen() const
Return the maximum queue length.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
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)
Definition: dsr-rcache.h:219
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
void SetNumberAddress(uint8_t n)
Set the number of ipv4 address.
bool AddRoute(DsrRouteCacheEntry &rt)
Add route cache entry if it doesn'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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Header of Dsr Routing.
void SetAckId(uint16_t identification)
Set the Ack id number.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual uint8_t GetSalvage() const
Get the salvage value of the packet.
uint8_t GetType() const
Get the type of the option.
DsrCacheEntryTest()
void SetSalvage(uint8_t salvage)
dsr::DsrSendBuffer q
bool Dequeue(Ipv4Address dst, DsrSendBuffEntry &entry)
Return first found (the earliest) entry for the given destination.