A Discrete-Event Network Simulator
API
aodv-packet.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 IITP RAS
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  * Based on
19  * NS-2 AODV model developed by the CMU/MONARCH group and optimized and
20  * tuned by Samir Das and Mahesh Marina, University of Cincinnati;
21  *
22  * AODV-UU implementation by Erik Nordström of Uppsala University
23  * http://core.it.uu.se/core/index.php/AODV-UU
24  *
25  * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
26  * Pavel Boyko <boyko@iitp.ru>
27  */
28 #include "aodv-packet.h"
29 #include "ns3/address-utils.h"
30 #include "ns3/packet.h"
31 
32 namespace ns3 {
33 namespace aodv {
34 
35 NS_OBJECT_ENSURE_REGISTERED (TypeHeader);
36 
38  : m_type (t),
39  m_valid (true)
40 {
41 }
42 
43 TypeId
45 {
46  static TypeId tid = TypeId ("ns3::aodv::TypeHeader")
47  .SetParent<Header> ()
48  .SetGroupName ("Aodv")
49  .AddConstructor<TypeHeader> ()
50  ;
51  return tid;
52 }
53 
54 TypeId
56 {
57  return GetTypeId ();
58 }
59 
60 uint32_t
62 {
63  return 1;
64 }
65 
66 void
68 {
69  i.WriteU8 ((uint8_t) m_type);
70 }
71 
72 uint32_t
74 {
76  uint8_t type = i.ReadU8 ();
77  m_valid = true;
78  switch (type)
79  {
80  case AODVTYPE_RREQ:
81  case AODVTYPE_RREP:
82  case AODVTYPE_RERR:
83  case AODVTYPE_RREP_ACK:
84  {
85  m_type = (MessageType) type;
86  break;
87  }
88  default:
89  m_valid = false;
90  }
91  uint32_t dist = i.GetDistanceFrom (start);
92  NS_ASSERT (dist == GetSerializedSize ());
93  return dist;
94 }
95 
96 void
97 TypeHeader::Print (std::ostream &os) const
98 {
99  switch (m_type)
100  {
101  case AODVTYPE_RREQ:
102  {
103  os << "RREQ";
104  break;
105  }
106  case AODVTYPE_RREP:
107  {
108  os << "RREP";
109  break;
110  }
111  case AODVTYPE_RERR:
112  {
113  os << "RERR";
114  break;
115  }
116  case AODVTYPE_RREP_ACK:
117  {
118  os << "RREP_ACK";
119  break;
120  }
121  default:
122  os << "UNKNOWN_TYPE";
123  }
124 }
125 
126 bool
128 {
129  return (m_type == o.m_type && m_valid == o.m_valid);
130 }
131 
132 std::ostream &
133 operator<< (std::ostream & os, TypeHeader const & h)
134 {
135  h.Print (os);
136  return os;
137 }
138 
139 //-----------------------------------------------------------------------------
140 // RREQ
141 //-----------------------------------------------------------------------------
142 RreqHeader::RreqHeader (uint8_t flags, uint8_t reserved, uint8_t hopCount, uint32_t requestID, Ipv4Address dst,
143  uint32_t dstSeqNo, Ipv4Address origin, uint32_t originSeqNo)
144  : m_flags (flags),
145  m_reserved (reserved),
146  m_hopCount (hopCount),
147  m_requestID (requestID),
148  m_dst (dst),
149  m_dstSeqNo (dstSeqNo),
150  m_origin (origin),
151  m_originSeqNo (originSeqNo)
152 {
153 }
154 
156 
157 TypeId
159 {
160  static TypeId tid = TypeId ("ns3::aodv::RreqHeader")
161  .SetParent<Header> ()
162  .SetGroupName ("Aodv")
163  .AddConstructor<RreqHeader> ()
164  ;
165  return tid;
166 }
167 
168 TypeId
170 {
171  return GetTypeId ();
172 }
173 
174 uint32_t
176 {
177  return 23;
178 }
179 
180 void
182 {
183  i.WriteU8 (m_flags);
184  i.WriteU8 (m_reserved);
185  i.WriteU8 (m_hopCount);
187  WriteTo (i, m_dst);
189  WriteTo (i, m_origin);
191 }
192 
193 uint32_t
195 {
197  m_flags = i.ReadU8 ();
198  m_reserved = i.ReadU8 ();
199  m_hopCount = i.ReadU8 ();
200  m_requestID = i.ReadNtohU32 ();
201  ReadFrom (i, m_dst);
202  m_dstSeqNo = i.ReadNtohU32 ();
203  ReadFrom (i, m_origin);
204  m_originSeqNo = i.ReadNtohU32 ();
205 
206  uint32_t dist = i.GetDistanceFrom (start);
207  NS_ASSERT (dist == GetSerializedSize ());
208  return dist;
209 }
210 
211 void
212 RreqHeader::Print (std::ostream &os) const
213 {
214  os << "RREQ ID " << m_requestID << " destination: ipv4 " << m_dst
215  << " sequence number " << m_dstSeqNo << " source: ipv4 "
216  << m_origin << " sequence number " << m_originSeqNo
217  << " flags:" << " Gratuitous RREP " << (*this).GetGratuitousRrep ()
218  << " Destination only " << (*this).GetDestinationOnly ()
219  << " Unknown sequence number " << (*this).GetUnknownSeqno ();
220 }
221 
222 std::ostream &
223 operator<< (std::ostream & os, RreqHeader const & h)
224 {
225  h.Print (os);
226  return os;
227 }
228 
229 void
231 {
232  if (f)
233  {
234  m_flags |= (1 << 5);
235  }
236  else
237  {
238  m_flags &= ~(1 << 5);
239  }
240 }
241 
242 bool
244 {
245  return (m_flags & (1 << 5));
246 }
247 
248 void
250 {
251  if (f)
252  {
253  m_flags |= (1 << 4);
254  }
255  else
256  {
257  m_flags &= ~(1 << 4);
258  }
259 }
260 
261 bool
263 {
264  return (m_flags & (1 << 4));
265 }
266 
267 void
269 {
270  if (f)
271  {
272  m_flags |= (1 << 3);
273  }
274  else
275  {
276  m_flags &= ~(1 << 3);
277  }
278 }
279 
280 bool
282 {
283  return (m_flags & (1 << 3));
284 }
285 
286 bool
288 {
289  return (m_flags == o.m_flags && m_reserved == o.m_reserved
291  && m_dst == o.m_dst && m_dstSeqNo == o.m_dstSeqNo
292  && m_origin == o.m_origin && m_originSeqNo == o.m_originSeqNo);
293 }
294 
295 //-----------------------------------------------------------------------------
296 // RREP
297 //-----------------------------------------------------------------------------
298 
299 RrepHeader::RrepHeader (uint8_t prefixSize, uint8_t hopCount, Ipv4Address dst,
300  uint32_t dstSeqNo, Ipv4Address origin, Time lifeTime)
301  : m_flags (0),
302  m_prefixSize (prefixSize),
303  m_hopCount (hopCount),
304  m_dst (dst),
305  m_dstSeqNo (dstSeqNo),
306  m_origin (origin)
307 {
308  m_lifeTime = uint32_t (lifeTime.GetMilliSeconds ());
309 }
310 
312 
313 TypeId
315 {
316  static TypeId tid = TypeId ("ns3::aodv::RrepHeader")
317  .SetParent<Header> ()
318  .SetGroupName ("Aodv")
319  .AddConstructor<RrepHeader> ()
320  ;
321  return tid;
322 }
323 
324 TypeId
326 {
327  return GetTypeId ();
328 }
329 
330 uint32_t
332 {
333  return 19;
334 }
335 
336 void
338 {
339  i.WriteU8 (m_flags);
340  i.WriteU8 (m_prefixSize);
341  i.WriteU8 (m_hopCount);
342  WriteTo (i, m_dst);
344  WriteTo (i, m_origin);
346 }
347 
348 uint32_t
350 {
352 
353  m_flags = i.ReadU8 ();
354  m_prefixSize = i.ReadU8 ();
355  m_hopCount = i.ReadU8 ();
356  ReadFrom (i, m_dst);
357  m_dstSeqNo = i.ReadNtohU32 ();
358  ReadFrom (i, m_origin);
359  m_lifeTime = i.ReadNtohU32 ();
360 
361  uint32_t dist = i.GetDistanceFrom (start);
362  NS_ASSERT (dist == GetSerializedSize ());
363  return dist;
364 }
365 
366 void
367 RrepHeader::Print (std::ostream &os) const
368 {
369  os << "destination: ipv4 " << m_dst << " sequence number " << m_dstSeqNo;
370  if (m_prefixSize != 0)
371  {
372  os << " prefix size " << m_prefixSize;
373  }
374  os << " source ipv4 " << m_origin << " lifetime " << m_lifeTime
375  << " acknowledgment required flag " << (*this).GetAckRequired ();
376 }
377 
378 void
380 {
382 }
383 
384 Time
386 {
388  return t;
389 }
390 
391 void
393 {
394  if (f)
395  {
396  m_flags |= (1 << 6);
397  }
398  else
399  {
400  m_flags &= ~(1 << 6);
401  }
402 }
403 
404 bool
406 {
407  return (m_flags & (1 << 6));
408 }
409 
410 void
412 {
413  m_prefixSize = sz;
414 }
415 
416 uint8_t
418 {
419  return m_prefixSize;
420 }
421 
422 bool
424 {
425  return (m_flags == o.m_flags && m_prefixSize == o.m_prefixSize
426  && m_hopCount == o.m_hopCount && m_dst == o.m_dst && m_dstSeqNo == o.m_dstSeqNo
427  && m_origin == o.m_origin && m_lifeTime == o.m_lifeTime);
428 }
429 
430 void
431 RrepHeader::SetHello (Ipv4Address origin, uint32_t srcSeqNo, Time lifetime)
432 {
433  m_flags = 0;
434  m_prefixSize = 0;
435  m_hopCount = 0;
436  m_dst = origin;
437  m_dstSeqNo = srcSeqNo;
438  m_origin = origin;
439  m_lifeTime = lifetime.GetMilliSeconds ();
440 }
441 
442 std::ostream &
443 operator<< (std::ostream & os, RrepHeader const & h)
444 {
445  h.Print (os);
446  return os;
447 }
448 
449 //-----------------------------------------------------------------------------
450 // RREP-ACK
451 //-----------------------------------------------------------------------------
452 
454  : m_reserved (0)
455 {
456 }
457 
459 
460 TypeId
462 {
463  static TypeId tid = TypeId ("ns3::aodv::RrepAckHeader")
464  .SetParent<Header> ()
465  .SetGroupName ("Aodv")
466  .AddConstructor<RrepAckHeader> ()
467  ;
468  return tid;
469 }
470 
471 TypeId
473 {
474  return GetTypeId ();
475 }
476 
477 uint32_t
479 {
480  return 1;
481 }
482 
483 void
485 {
486  i.WriteU8 (m_reserved);
487 }
488 
489 uint32_t
491 {
493  m_reserved = i.ReadU8 ();
494  uint32_t dist = i.GetDistanceFrom (start);
495  NS_ASSERT (dist == GetSerializedSize ());
496  return dist;
497 }
498 
499 void
500 RrepAckHeader::Print (std::ostream &os ) const
501 {
502 }
503 
504 bool
506 {
507  return m_reserved == o.m_reserved;
508 }
509 
510 std::ostream &
511 operator<< (std::ostream & os, RrepAckHeader const & h )
512 {
513  h.Print (os);
514  return os;
515 }
516 
517 //-----------------------------------------------------------------------------
518 // RERR
519 //-----------------------------------------------------------------------------
521  : m_flag (0),
522  m_reserved (0)
523 {
524 }
525 
527 
528 TypeId
530 {
531  static TypeId tid = TypeId ("ns3::aodv::RerrHeader")
532  .SetParent<Header> ()
533  .SetGroupName ("Aodv")
534  .AddConstructor<RerrHeader> ()
535  ;
536  return tid;
537 }
538 
539 TypeId
541 {
542  return GetTypeId ();
543 }
544 
545 uint32_t
547 {
548  return (3 + 8 * GetDestCount ());
549 }
550 
551 void
553 {
554  i.WriteU8 (m_flag);
555  i.WriteU8 (m_reserved);
556  i.WriteU8 (GetDestCount ());
557  std::map<Ipv4Address, uint32_t>::const_iterator j;
558  for (j = m_unreachableDstSeqNo.begin (); j != m_unreachableDstSeqNo.end (); ++j)
559  {
560  WriteTo (i, (*j).first);
561  i.WriteHtonU32 ((*j).second);
562  }
563 }
564 
565 uint32_t
567 {
569  m_flag = i.ReadU8 ();
570  m_reserved = i.ReadU8 ();
571  uint8_t dest = i.ReadU8 ();
572  m_unreachableDstSeqNo.clear ();
574  uint32_t seqNo;
575  for (uint8_t k = 0; k < dest; ++k)
576  {
577  ReadFrom (i, address);
578  seqNo = i.ReadNtohU32 ();
579  m_unreachableDstSeqNo.insert (std::make_pair (address, seqNo));
580  }
581 
582  uint32_t dist = i.GetDistanceFrom (start);
583  NS_ASSERT (dist == GetSerializedSize ());
584  return dist;
585 }
586 
587 void
588 RerrHeader::Print (std::ostream &os ) const
589 {
590  os << "Unreachable destination (ipv4 address, seq. number):";
591  std::map<Ipv4Address, uint32_t>::const_iterator j;
592  for (j = m_unreachableDstSeqNo.begin (); j != m_unreachableDstSeqNo.end (); ++j)
593  {
594  os << (*j).first << ", " << (*j).second;
595  }
596  os << "No delete flag " << (*this).GetNoDelete ();
597 }
598 
599 void
601 {
602  if (f)
603  {
604  m_flag |= (1 << 0);
605  }
606  else
607  {
608  m_flag &= ~(1 << 0);
609  }
610 }
611 
612 bool
614 {
615  return (m_flag & (1 << 0));
616 }
617 
618 bool
620 {
621  if (m_unreachableDstSeqNo.find (dst) != m_unreachableDstSeqNo.end ())
622  {
623  return true;
624  }
625 
626  NS_ASSERT (GetDestCount () < 255); // can't support more than 255 destinations in single RERR
627  m_unreachableDstSeqNo.insert (std::make_pair (dst, seqNo));
628  return true;
629 }
630 
631 bool
632 RerrHeader::RemoveUnDestination (std::pair<Ipv4Address, uint32_t> & un )
633 {
634  if (m_unreachableDstSeqNo.empty ())
635  {
636  return false;
637  }
638  std::map<Ipv4Address, uint32_t>::iterator i = m_unreachableDstSeqNo.begin ();
639  un = *i;
640  m_unreachableDstSeqNo.erase (i);
641  return true;
642 }
643 
644 void
646 {
647  m_unreachableDstSeqNo.clear ();
648  m_flag = 0;
649  m_reserved = 0;
650 }
651 
652 bool
654 {
655  if (m_flag != o.m_flag || m_reserved != o.m_reserved || GetDestCount () != o.GetDestCount ())
656  {
657  return false;
658  }
659 
660  std::map<Ipv4Address, uint32_t>::const_iterator j = m_unreachableDstSeqNo.begin ();
661  std::map<Ipv4Address, uint32_t>::const_iterator k = o.m_unreachableDstSeqNo.begin ();
662  for (uint8_t i = 0; i < GetDestCount (); ++i)
663  {
664  if ((j->first != k->first) || (j->second != k->second))
665  {
666  return false;
667  }
668 
669  j++;
670  k++;
671  }
672  return true;
673 }
674 
675 std::ostream &
676 operator<< (std::ostream & os, RerrHeader const & h )
677 {
678  h.Print (os);
679  return os;
680 }
681 }
682 }
double f(double x, void *params)
Definition: 80211b.c:70
iterator in a Buffer instance
Definition: buffer.h:99
void WriteU8(uint8_t data)
Definition: buffer.h:869
uint8_t ReadU8(void)
Definition: buffer.h:1021
void WriteHtonU32(uint32_t data)
Definition: buffer.h:924
uint32_t GetDistanceFrom(Iterator const &o) const
Definition: buffer.cc:788
uint32_t ReadNtohU32(void)
Definition: buffer.h:970
Protocol header serialization and deserialization.
Definition: header.h:43
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:383
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Route Error (RERR) Message Format.
Definition: aodv-packet.h:558
uint8_t GetDestCount() const
Definition: aodv-packet.h:604
bool operator==(RerrHeader const &o) const
Comparison operator.
Definition: aodv-packet.cc:653
void Clear()
Clear header.
Definition: aodv-packet.cc:645
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:529
uint8_t m_reserved
Not used (must be 0)
Definition: aodv-packet.h:617
bool GetNoDelete() const
Get the no delete flag.
Definition: aodv-packet.cc:613
RerrHeader()
constructor
Definition: aodv-packet.cc:520
uint8_t m_flag
No delete flag.
Definition: aodv-packet.h:616
void Print(std::ostream &os) const
Definition: aodv-packet.cc:588
void SetNoDelete(bool f)
Set the no delete flag.
Definition: aodv-packet.cc:600
bool AddUnDestination(Ipv4Address dst, uint32_t seqNo)
Add unreachable node address and its sequence number in RERR header.
Definition: aodv-packet.cc:619
std::map< Ipv4Address, uint32_t > m_unreachableDstSeqNo
List of Unreachable destination: IP addresses and sequence numbers.
Definition: aodv-packet.h:620
bool RemoveUnDestination(std::pair< Ipv4Address, uint32_t > &un)
Delete pair (address + sequence number) from REER header, if the number of unreachable destinations >...
Definition: aodv-packet.cc:632
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:540
uint32_t GetSerializedSize() const
Definition: aodv-packet.cc:546
void Serialize(Buffer::Iterator i) const
Definition: aodv-packet.cc:552
Route Reply Acknowledgment (RREP-ACK) Message Format.
Definition: aodv-packet.h:504
void Serialize(Buffer::Iterator start) const
Definition: aodv-packet.cc:484
uint32_t GetSerializedSize() const
Definition: aodv-packet.cc:478
bool operator==(RrepAckHeader const &o) const
Comparison operator.
Definition: aodv-packet.cc:505
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:472
void Print(std::ostream &os) const
Definition: aodv-packet.cc:500
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:461
RrepAckHeader()
constructor
Definition: aodv-packet.cc:453
uint8_t m_reserved
Not used (must be 0)
Definition: aodv-packet.h:527
Route Reply (RREP) Message Format.
Definition: aodv-packet.h:336
void Serialize(Buffer::Iterator start) const
Definition: aodv-packet.cc:337
bool GetAckRequired() const
get the ack required flag
Definition: aodv-packet.cc:405
uint8_t GetPrefixSize() const
Set the pefix size.
Definition: aodv-packet.cc:417
void SetHello(Ipv4Address src, uint32_t srcSeqNo, Time lifetime)
Configure RREP to be a Hello message.
Definition: aodv-packet.cc:431
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:314
bool operator==(RrepHeader const &o) const
Comparison operator.
Definition: aodv-packet.cc:423
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:325
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition: aodv-packet.h:480
void SetLifeTime(Time t)
Set the lifetime.
Definition: aodv-packet.cc:379
void SetAckRequired(bool f)
Set the ack required flag.
Definition: aodv-packet.cc:392
void SetPrefixSize(uint8_t sz)
Set the prefix size.
Definition: aodv-packet.cc:411
RrepHeader(uint8_t prefixSize=0, uint8_t hopCount=0, Ipv4Address dst=Ipv4Address(), uint32_t dstSeqNo=0, Ipv4Address origin=Ipv4Address(), Time lifetime=MilliSeconds(0))
constructor
Definition: aodv-packet.cc:299
Time GetLifeTime() const
Get the lifetime.
Definition: aodv-packet.cc:385
Ipv4Address m_dst
Destination IP Address.
Definition: aodv-packet.h:479
uint8_t m_flags
A - acknowledgment required flag.
Definition: aodv-packet.h:476
uint8_t m_hopCount
Hop Count.
Definition: aodv-packet.h:478
uint32_t GetSerializedSize() const
Definition: aodv-packet.cc:331
uint8_t m_prefixSize
Prefix Size.
Definition: aodv-packet.h:477
void Print(std::ostream &os) const
Definition: aodv-packet.cc:367
Ipv4Address m_origin
Source IP Address.
Definition: aodv-packet.h:481
uint32_t m_lifeTime
Lifetime (in milliseconds)
Definition: aodv-packet.h:482
Route Request (RREQ) Message Format.
Definition: aodv-packet.h:132
bool GetUnknownSeqno() const
Get the unknown sequence number flag.
Definition: aodv-packet.cc:281
uint32_t m_originSeqNo
Source Sequence Number.
Definition: aodv-packet.h:306
void Serialize(Buffer::Iterator start) const
Definition: aodv-packet.cc:181
RreqHeader(uint8_t flags=0, uint8_t reserved=0, uint8_t hopCount=0, uint32_t requestID=0, Ipv4Address dst=Ipv4Address(), uint32_t dstSeqNo=0, Ipv4Address origin=Ipv4Address(), uint32_t originSeqNo=0)
constructor
Definition: aodv-packet.cc:142
uint8_t m_hopCount
Hop Count.
Definition: aodv-packet.h:301
void SetUnknownSeqno(bool f)
Set the unknown sequence number flag.
Definition: aodv-packet.cc:268
void SetGratuitousRrep(bool f)
Set the gratuitous RREP flag.
Definition: aodv-packet.cc:230
void SetDestinationOnly(bool f)
Set the Destination only flag.
Definition: aodv-packet.cc:249
Ipv4Address m_origin
Originator IP Address.
Definition: aodv-packet.h:305
bool GetDestinationOnly() const
Get the Destination only flag.
Definition: aodv-packet.cc:262
Ipv4Address m_dst
Destination IP Address.
Definition: aodv-packet.h:303
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:158
uint32_t m_requestID
RREQ ID.
Definition: aodv-packet.h:302
void Print(std::ostream &os) const
Definition: aodv-packet.cc:212
uint32_t GetSerializedSize() const
Definition: aodv-packet.cc:175
bool operator==(RreqHeader const &o) const
Comparison operator.
Definition: aodv-packet.cc:287
uint8_t m_reserved
Not used (must be 0)
Definition: aodv-packet.h:300
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:169
bool GetGratuitousRrep() const
Get the gratuitous RREP flag.
Definition: aodv-packet.cc:243
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition: aodv-packet.h:304
uint8_t m_flags
|J|R|G|D|U| bit flags, see RFC
Definition: aodv-packet.h:299
void Print(std::ostream &os) const
Definition: aodv-packet.cc:97
TypeHeader(MessageType t=AODVTYPE_RREQ)
constructor
Definition: aodv-packet.cc:37
MessageType m_type
type of the message
Definition: aodv-packet.h:99
uint32_t GetSerializedSize() const
Definition: aodv-packet.cc:61
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:55
void Serialize(Buffer::Iterator start) const
Definition: aodv-packet.cc:67
bool m_valid
Indicates if the message is valid.
Definition: aodv-packet.h:100
bool operator==(TypeHeader const &o) const
Comparison operator.
Definition: aodv-packet.cc:127
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:44
MessageType
MessageType enumeration.
Definition: aodv-packet.h:46
@ AODVTYPE_RREP
AODVTYPE_RREP.
Definition: aodv-packet.h:48
@ AODVTYPE_RREP_ACK
AODVTYPE_RREP_ACK.
Definition: aodv-packet.h:50
@ AODVTYPE_RERR
AODVTYPE_RERR.
Definition: aodv-packet.h:49
@ AODVTYPE_RREQ
AODVTYPE_RREQ.
Definition: aodv-packet.h:47
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
address
Definition: first.py:44
std::ostream & operator<<(std::ostream &os, TypeHeader const &h)
Stream output operator.
Definition: aodv-packet.cc:133
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
def start()
Definition: core.py:1853