A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
aodv-packet.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 IITP RAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Based on
18 * NS-2 AODV model developed by the CMU/MONARCH group and optimized and
19 * tuned by Samir Das and Mahesh Marina, University of Cincinnati;
20 *
21 * AODV-UU implementation by Erik Nordström of Uppsala University
22 * https://web.archive.org/web/20100527072022/http://core.it.uu.se/core/index.php/AODV-UU
23 *
24 * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
25 * Pavel Boyko <boyko@iitp.ru>
26 */
27#ifndef AODVPACKET_H
28#define AODVPACKET_H
29
30#include "ns3/enum.h"
31#include "ns3/header.h"
32#include "ns3/ipv4-address.h"
33#include "ns3/nstime.h"
34
35#include <iostream>
36#include <map>
37
38namespace ns3
39{
40namespace aodv
41{
42
43/**
44 * \ingroup aodv
45 * \brief MessageType enumeration
46 */
48{
49 AODVTYPE_RREQ = 1, //!< AODVTYPE_RREQ
50 AODVTYPE_RREP = 2, //!< AODVTYPE_RREP
51 AODVTYPE_RERR = 3, //!< AODVTYPE_RERR
52 AODVTYPE_RREP_ACK = 4 //!< AODVTYPE_RREP_ACK
53};
54
55/**
56 * \ingroup aodv
57 * \brief AODV types
58 */
59class TypeHeader : public Header
60{
61 public:
62 /**
63 * constructor
64 * \param t the AODV RREQ type
65 */
67
68 /**
69 * \brief Get the type ID.
70 * \return the object TypeId
71 */
72 static TypeId GetTypeId();
73 TypeId GetInstanceTypeId() const override;
74 uint32_t GetSerializedSize() const override;
75 void Serialize(Buffer::Iterator start) const override;
77 void Print(std::ostream& os) const override;
78
79 /**
80 * \returns the type
81 */
83 {
84 return m_type;
85 }
86
87 /**
88 * Check that type if valid
89 * \returns true if the type is valid
90 */
91 bool IsValid() const
92 {
93 return m_valid;
94 }
95
96 /**
97 * \brief Comparison operator
98 * \param o header to compare
99 * \return true if the headers are equal
100 */
101 bool operator==(const TypeHeader& o) const;
102
103 private:
104 MessageType m_type; ///< type of the message
105 bool m_valid; ///< Indicates if the message is valid
106};
107
108/**
109 * \brief Stream output operator
110 * \param os output stream
111 * \param h the TypeHeader
112 * \return updated stream
113 */
114std::ostream& operator<<(std::ostream& os, const TypeHeader& h);
115
116/**
117* \ingroup aodv
118* \brief Route Request (RREQ) Message Format
119 \verbatim
120 0 1 2 3
121 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
122 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
123 | Type |J|R|G|D|U| Reserved | Hop Count |
124 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
125 | RREQ ID |
126 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
127 | Destination IP Address |
128 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
129 | Destination Sequence Number |
130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
131 | Originator IP Address |
132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
133 | Originator Sequence Number |
134 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
135 \endverbatim
136*/
137class RreqHeader : public Header
138{
139 public:
140 /**
141 * constructor
142 *
143 * \param flags the message flags (0)
144 * \param reserved the reserved bits (0)
145 * \param hopCount the hop count
146 * \param requestID the request ID
147 * \param dst the destination IP address
148 * \param dstSeqNo the destination sequence number
149 * \param origin the origin IP address
150 * \param originSeqNo the origin sequence number
151 */
152 RreqHeader(uint8_t flags = 0,
153 uint8_t reserved = 0,
154 uint8_t hopCount = 0,
155 uint32_t requestID = 0,
156 Ipv4Address dst = Ipv4Address(),
157 uint32_t dstSeqNo = 0,
158 Ipv4Address origin = Ipv4Address(),
159 uint32_t originSeqNo = 0);
160
161 /**
162 * \brief Get the type ID.
163 * \return the object TypeId
164 */
165 static TypeId GetTypeId();
166 TypeId GetInstanceTypeId() const override;
167 uint32_t GetSerializedSize() const override;
168 void Serialize(Buffer::Iterator start) const override;
169 uint32_t Deserialize(Buffer::Iterator start) override;
170 void Print(std::ostream& os) const override;
171
172 // Fields
173 /**
174 * \brief Set the hop count
175 * \param count the hop count
176 */
177 void SetHopCount(uint8_t count)
178 {
179 m_hopCount = count;
180 }
181
182 /**
183 * \brief Get the hop count
184 * \return the hop count
185 */
186 uint8_t GetHopCount() const
187 {
188 return m_hopCount;
189 }
190
191 /**
192 * \brief Set the request ID
193 * \param id the request ID
194 */
196 {
197 m_requestID = id;
198 }
199
200 /**
201 * \brief Get the request ID
202 * \return the request ID
203 */
205 {
206 return m_requestID;
207 }
208
209 /**
210 * \brief Set the destination address
211 * \param a the destination address
212 */
214 {
215 m_dst = a;
216 }
217
218 /**
219 * \brief Get the destination address
220 * \return the destination address
221 */
223 {
224 return m_dst;
225 }
226
227 /**
228 * \brief Set the destination sequence number
229 * \param s the destination sequence number
230 */
232 {
233 m_dstSeqNo = s;
234 }
235
236 /**
237 * \brief Get the destination sequence number
238 * \return the destination sequence number
239 */
241 {
242 return m_dstSeqNo;
243 }
244
245 /**
246 * \brief Set the origin address
247 * \param a the origin address
248 */
250 {
251 m_origin = a;
252 }
253
254 /**
255 * \brief Get the origin address
256 * \return the origin address
257 */
259 {
260 return m_origin;
261 }
262
263 /**
264 * \brief Set the origin sequence number
265 * \param s the origin sequence number
266 */
268 {
269 m_originSeqNo = s;
270 }
271
272 /**
273 * \brief Get the origin sequence number
274 * \return the origin sequence number
275 */
277 {
278 return m_originSeqNo;
279 }
280
281 // Flags
282 /**
283 * \brief Set the gratuitous RREP flag
284 * \param f the gratuitous RREP flag
285 */
286 void SetGratuitousRrep(bool f);
287 /**
288 * \brief Get the gratuitous RREP flag
289 * \return the gratuitous RREP flag
290 */
291 bool GetGratuitousRrep() const;
292 /**
293 * \brief Set the Destination only flag
294 * \param f the Destination only flag
295 */
296 void SetDestinationOnly(bool f);
297 /**
298 * \brief Get the Destination only flag
299 * \return the Destination only flag
300 */
301 bool GetDestinationOnly() const;
302 /**
303 * \brief Set the unknown sequence number flag
304 * \param f the unknown sequence number flag
305 */
306 void SetUnknownSeqno(bool f);
307 /**
308 * \brief Get the unknown sequence number flag
309 * \return the unknown sequence number flag
310 */
311 bool GetUnknownSeqno() const;
312
313 /**
314 * \brief Comparison operator
315 * \param o RREQ header to compare
316 * \return true if the RREQ headers are equal
317 */
318 bool operator==(const RreqHeader& o) const;
319
320 private:
321 uint8_t m_flags; ///< |J|R|G|D|U| bit flags, see RFC
322 uint8_t m_reserved; ///< Not used (must be 0)
323 uint8_t m_hopCount; ///< Hop Count
324 uint32_t m_requestID; ///< RREQ ID
325 Ipv4Address m_dst; ///< Destination IP Address
326 uint32_t m_dstSeqNo; ///< Destination Sequence Number
327 Ipv4Address m_origin; ///< Originator IP Address
328 uint32_t m_originSeqNo; ///< Source Sequence Number
329};
330
331/**
332 * \brief Stream output operator
333 * \param os output stream
334 * \return updated stream
335 */
336std::ostream& operator<<(std::ostream& os, const RreqHeader&);
337
338/**
339* \ingroup aodv
340* \brief Route Reply (RREP) Message Format
341 \verbatim
342 0 1 2 3
343 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
344 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
345 | Type |R|A| Reserved |Prefix Sz| Hop Count |
346 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
347 | Destination IP address |
348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
349 | Destination Sequence Number |
350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
351 | Originator IP address |
352 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
353 | Lifetime |
354 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
355 \endverbatim
356*/
357class RrepHeader : public Header
358{
359 public:
360 /**
361 * constructor
362 *
363 * \param prefixSize the prefix size (0)
364 * \param hopCount the hop count (0)
365 * \param dst the destination IP address
366 * \param dstSeqNo the destination sequence number
367 * \param origin the origin IP address
368 * \param lifetime the lifetime
369 */
370 RrepHeader(uint8_t prefixSize = 0,
371 uint8_t hopCount = 0,
372 Ipv4Address dst = Ipv4Address(),
373 uint32_t dstSeqNo = 0,
374 Ipv4Address origin = Ipv4Address(),
375 Time lifetime = MilliSeconds(0));
376 /**
377 * \brief Get the type ID.
378 * \return the object TypeId
379 */
380 static TypeId GetTypeId();
381 TypeId GetInstanceTypeId() const override;
382 uint32_t GetSerializedSize() const override;
383 void Serialize(Buffer::Iterator start) const override;
384 uint32_t Deserialize(Buffer::Iterator start) override;
385 void Print(std::ostream& os) const override;
386
387 // Fields
388 /**
389 * \brief Set the hop count
390 * \param count the hop count
391 */
392 void SetHopCount(uint8_t count)
393 {
394 m_hopCount = count;
395 }
396
397 /**
398 * \brief Get the hop count
399 * \return the hop count
400 */
401 uint8_t GetHopCount() const
402 {
403 return m_hopCount;
404 }
405
406 /**
407 * \brief Set the destination address
408 * \param a the destination address
409 */
411 {
412 m_dst = a;
413 }
414
415 /**
416 * \brief Get the destination address
417 * \return the destination address
418 */
420 {
421 return m_dst;
422 }
423
424 /**
425 * \brief Set the destination sequence number
426 * \param s the destination sequence number
427 */
429 {
430 m_dstSeqNo = s;
431 }
432
433 /**
434 * \brief Get the destination sequence number
435 * \return the destination sequence number
436 */
438 {
439 return m_dstSeqNo;
440 }
441
442 /**
443 * \brief Set the origin address
444 * \param a the origin address
445 */
447 {
448 m_origin = a;
449 }
450
451 /**
452 * \brief Get the origin address
453 * \return the origin address
454 */
456 {
457 return m_origin;
458 }
459
460 /**
461 * \brief Set the lifetime
462 * \param t the lifetime
463 */
464 void SetLifeTime(Time t);
465 /**
466 * \brief Get the lifetime
467 * \return the lifetime
468 */
469 Time GetLifeTime() const;
470
471 // Flags
472 /**
473 * \brief Set the ack required flag
474 * \param f the ack required flag
475 */
476 void SetAckRequired(bool f);
477 /**
478 * \brief get the ack required flag
479 * \return the ack required flag
480 */
481 bool GetAckRequired() const;
482 /**
483 * \brief Set the prefix size
484 * \param sz the prefix size
485 */
486 void SetPrefixSize(uint8_t sz);
487 /**
488 * \brief Set the prefix size
489 * \return the prefix size
490 */
491 uint8_t GetPrefixSize() const;
492
493 /**
494 * Configure RREP to be a Hello message
495 *
496 * \param src the source IP address
497 * \param srcSeqNo the source sequence number
498 * \param lifetime the lifetime of the message
499 */
500 void SetHello(Ipv4Address src, uint32_t srcSeqNo, Time lifetime);
501
502 /**
503 * \brief Comparison operator
504 * \param o RREP header to compare
505 * \return true if the RREP headers are equal
506 */
507 bool operator==(const RrepHeader& o) const;
508
509 private:
510 uint8_t m_flags; ///< A - acknowledgment required flag
511 uint8_t m_prefixSize; ///< Prefix Size
512 uint8_t m_hopCount; ///< Hop Count
513 Ipv4Address m_dst; ///< Destination IP Address
514 uint32_t m_dstSeqNo; ///< Destination Sequence Number
515 Ipv4Address m_origin; ///< Source IP Address
516 uint32_t m_lifeTime; ///< Lifetime (in milliseconds)
517};
518
519/**
520 * \brief Stream output operator
521 * \param os output stream
522 * \return updated stream
523 */
524std::ostream& operator<<(std::ostream& os, const RrepHeader&);
525
526/**
527* \ingroup aodv
528* \brief Route Reply Acknowledgment (RREP-ACK) Message Format
529 \verbatim
530 0 1
531 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
532 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
533 | Type | Reserved |
534 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
535 \endverbatim
536*/
537class RrepAckHeader : public Header
538{
539 public:
540 /// constructor
542
543 /**
544 * \brief Get the type ID.
545 * \return the object TypeId
546 */
547 static TypeId GetTypeId();
548 TypeId GetInstanceTypeId() const override;
549 uint32_t GetSerializedSize() const override;
550 void Serialize(Buffer::Iterator start) const override;
551 uint32_t Deserialize(Buffer::Iterator start) override;
552 void Print(std::ostream& os) const override;
553
554 /**
555 * \brief Comparison operator
556 * \param o RREP header to compare
557 * \return true if the RREQ headers are equal
558 */
559 bool operator==(const RrepAckHeader& o) const;
560
561 private:
562 uint8_t m_reserved; ///< Not used (must be 0)
563};
564
565/**
566 * \brief Stream output operator
567 * \param os output stream
568 * \return updated stream
569 */
570std::ostream& operator<<(std::ostream& os, const RrepAckHeader&);
571
572/**
573* \ingroup aodv
574* \brief Route Error (RERR) Message Format
575 \verbatim
576 0 1 2 3
577 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
578 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
579 | Type |N| Reserved | DestCount |
580 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
581 | Unreachable Destination IP Address (1) |
582 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
583 | Unreachable Destination Sequence Number (1) |
584 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
585 | Additional Unreachable Destination IP Addresses (if needed) |
586 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
587 |Additional Unreachable Destination Sequence Numbers (if needed)|
588 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
589 \endverbatim
590*/
591class RerrHeader : public Header
592{
593 public:
594 /// constructor
595 RerrHeader();
596
597 /**
598 * \brief Get the type ID.
599 * \return the object TypeId
600 */
601 static TypeId GetTypeId();
602 TypeId GetInstanceTypeId() const override;
603 uint32_t GetSerializedSize() const override;
604 void Serialize(Buffer::Iterator i) const override;
605 uint32_t Deserialize(Buffer::Iterator start) override;
606 void Print(std::ostream& os) const override;
607
608 // No delete flag
609 /**
610 * \brief Set the no delete flag
611 * \param f the no delete flag
612 */
613 void SetNoDelete(bool f);
614 /**
615 * \brief Get the no delete flag
616 * \return the no delete flag
617 */
618 bool GetNoDelete() const;
619
620 /**
621 * \brief Add unreachable node address and its sequence number in RERR header
622 * \param dst unreachable IPv4 address
623 * \param seqNo unreachable sequence number
624 * \return false if we already added maximum possible number of unreachable destinations
625 */
626 bool AddUnDestination(Ipv4Address dst, uint32_t seqNo);
627 /**
628 * \brief Delete pair (address + sequence number) from REER header, if the number of unreachable
629 * destinations > 0
630 * \param un unreachable pair (address + sequence number)
631 * \return true on success
632 */
633 bool RemoveUnDestination(std::pair<Ipv4Address, uint32_t>& un);
634 /// Clear header
635 void Clear();
636
637 /**
638 * \returns number of unreachable destinations in RERR message
639 */
640 uint8_t GetDestCount() const
641 {
642 return (uint8_t)m_unreachableDstSeqNo.size();
643 }
644
645 /**
646 * \brief Comparison operator
647 * \param o RERR header to compare
648 * \return true if the RERR headers are equal
649 */
650 bool operator==(const RerrHeader& o) const;
651
652 private:
653 uint8_t m_flag; ///< No delete flag
654 uint8_t m_reserved; ///< Not used (must be 0)
655
656 /// List of Unreachable destination: IP addresses and sequence numbers
657 std::map<Ipv4Address, uint32_t> m_unreachableDstSeqNo;
658};
659
660/**
661 * \brief Stream output operator
662 * \param os output stream
663 * \return updated stream
664 */
665std::ostream& operator<<(std::ostream& os, const RerrHeader&);
666
667} // namespace aodv
668} // namespace ns3
669
670#endif /* AODVPACKET_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Route Error (RERR) Message Format.
Definition: aodv-packet.h:592
uint32_t Deserialize(Buffer::Iterator start) override
Definition: aodv-packet.cc:565
uint8_t GetDestCount() const
Definition: aodv-packet.h:640
void Clear()
Clear header.
Definition: aodv-packet.cc:643
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:530
uint8_t m_reserved
Not used (must be 0)
Definition: aodv-packet.h:654
bool GetNoDelete() const
Get the no delete flag.
Definition: aodv-packet.cc:611
uint32_t GetSerializedSize() const override
Definition: aodv-packet.cc:546
RerrHeader()
constructor
Definition: aodv-packet.cc:521
uint8_t m_flag
No delete flag.
Definition: aodv-packet.h:653
bool operator==(const RerrHeader &o) const
Comparison operator.
Definition: aodv-packet.cc:651
void Serialize(Buffer::Iterator i) const override
Definition: aodv-packet.cc:552
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:540
void SetNoDelete(bool f)
Set the no delete flag.
Definition: aodv-packet.cc:598
bool AddUnDestination(Ipv4Address dst, uint32_t seqNo)
Add unreachable node address and its sequence number in RERR header.
Definition: aodv-packet.cc:617
std::map< Ipv4Address, uint32_t > m_unreachableDstSeqNo
List of Unreachable destination: IP addresses and sequence numbers.
Definition: aodv-packet.h:657
void Print(std::ostream &os) const override
Definition: aodv-packet.cc:587
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:630
Route Reply Acknowledgment (RREP-ACK) Message Format.
Definition: aodv-packet.h:538
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:473
void Serialize(Buffer::Iterator start) const override
Definition: aodv-packet.cc:485
void Print(std::ostream &os) const override
Definition: aodv-packet.cc:501
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:463
uint32_t Deserialize(Buffer::Iterator start) override
Definition: aodv-packet.cc:491
bool operator==(const RrepAckHeader &o) const
Comparison operator.
Definition: aodv-packet.cc:506
uint32_t GetSerializedSize() const override
Definition: aodv-packet.cc:479
RrepAckHeader()
constructor
Definition: aodv-packet.cc:455
uint8_t m_reserved
Not used (must be 0)
Definition: aodv-packet.h:562
Route Reply (RREP) Message Format.
Definition: aodv-packet.h:358
bool GetAckRequired() const
get the ack required flag
Definition: aodv-packet.cc:407
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:327
uint8_t GetPrefixSize() const
Set the prefix size.
Definition: aodv-packet.cc:419
uint32_t Deserialize(Buffer::Iterator start) override
Definition: aodv-packet.cc:351
void Print(std::ostream &os) const override
Definition: aodv-packet.cc:369
void Serialize(Buffer::Iterator start) const override
Definition: aodv-packet.cc:339
void SetDstSeqno(uint32_t s)
Set the destination sequence number.
Definition: aodv-packet.h:428
Ipv4Address GetOrigin() const
Get the origin address.
Definition: aodv-packet.h:455
void SetHello(Ipv4Address src, uint32_t srcSeqNo, Time lifetime)
Configure RREP to be a Hello message.
Definition: aodv-packet.cc:433
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:317
uint8_t GetHopCount() const
Get the hop count.
Definition: aodv-packet.h:401
void SetOrigin(Ipv4Address a)
Set the origin address.
Definition: aodv-packet.h:446
void SetHopCount(uint8_t count)
Set the hop count.
Definition: aodv-packet.h:392
uint32_t GetSerializedSize() const override
Definition: aodv-packet.cc:333
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition: aodv-packet.h:514
void SetLifeTime(Time t)
Set the lifetime.
Definition: aodv-packet.cc:381
void SetAckRequired(bool f)
Set the ack required flag.
Definition: aodv-packet.cc:394
void SetPrefixSize(uint8_t sz)
Set the prefix size.
Definition: aodv-packet.cc:413
Time GetLifeTime() const
Get the lifetime.
Definition: aodv-packet.cc:387
void SetDst(Ipv4Address a)
Set the destination address.
Definition: aodv-packet.h:410
Ipv4Address m_dst
Destination IP Address.
Definition: aodv-packet.h:513
uint32_t GetDstSeqno() const
Get the destination sequence number.
Definition: aodv-packet.h:437
uint8_t m_flags
A - acknowledgment required flag.
Definition: aodv-packet.h:510
Ipv4Address GetDst() const
Get the destination address.
Definition: aodv-packet.h:419
uint8_t m_hopCount
Hop Count.
Definition: aodv-packet.h:512
uint8_t m_prefixSize
Prefix Size.
Definition: aodv-packet.h:511
bool operator==(const RrepHeader &o) const
Comparison operator.
Definition: aodv-packet.cc:425
Ipv4Address m_origin
Source IP Address.
Definition: aodv-packet.h:515
uint32_t m_lifeTime
Lifetime (in milliseconds)
Definition: aodv-packet.h:516
Route Request (RREQ) Message Format.
Definition: aodv-packet.h:138
uint32_t GetId() const
Get the request ID.
Definition: aodv-packet.h:204
void SetDst(Ipv4Address a)
Set the destination address.
Definition: aodv-packet.h:213
uint8_t GetHopCount() const
Get the hop count.
Definition: aodv-packet.h:186
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:328
void SetId(uint32_t id)
Set the request ID.
Definition: aodv-packet.h:195
uint32_t GetOriginSeqno() const
Get the origin sequence number.
Definition: aodv-packet.h:276
uint8_t m_hopCount
Hop Count.
Definition: aodv-packet.h:323
void SetUnknownSeqno(bool f)
Set the unknown sequence number flag.
Definition: aodv-packet.cc:268
Ipv4Address GetOrigin() const
Get the origin address.
Definition: aodv-packet.h:258
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:327
bool GetDestinationOnly() const
Get the Destination only flag.
Definition: aodv-packet.cc:262
uint32_t GetSerializedSize() const override
Definition: aodv-packet.cc:176
Ipv4Address m_dst
Destination IP Address.
Definition: aodv-packet.h:325
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:160
uint32_t m_requestID
RREQ ID.
Definition: aodv-packet.h:324
void SetHopCount(uint8_t count)
Set the hop count.
Definition: aodv-packet.h:177
void SetDstSeqno(uint32_t s)
Set the destination sequence number.
Definition: aodv-packet.h:231
void Print(std::ostream &os) const override
Definition: aodv-packet.cc:213
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:170
void Serialize(Buffer::Iterator start) const override
Definition: aodv-packet.cc:182
uint8_t m_reserved
Not used (must be 0)
Definition: aodv-packet.h:322
uint32_t GetDstSeqno() const
Get the destination sequence number.
Definition: aodv-packet.h:240
Ipv4Address GetDst() const
Get the destination address.
Definition: aodv-packet.h:222
void SetOriginSeqno(uint32_t s)
Set the origin sequence number.
Definition: aodv-packet.h:267
bool GetGratuitousRrep() const
Get the gratuitous RREP flag.
Definition: aodv-packet.cc:243
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition: aodv-packet.h:326
uint32_t Deserialize(Buffer::Iterator start) override
Definition: aodv-packet.cc:195
bool operator==(const RreqHeader &o) const
Comparison operator.
Definition: aodv-packet.cc:287
uint8_t m_flags
|J|R|G|D|U| bit flags, see RFC
Definition: aodv-packet.h:321
void SetOrigin(Ipv4Address a)
Set the origin address.
Definition: aodv-packet.h:249
uint32_t Deserialize(Buffer::Iterator start) override
Definition: aodv-packet.cc:74
bool operator==(const TypeHeader &o) const
Comparison operator.
Definition: aodv-packet.cc:123
void Print(std::ostream &os) const override
Definition: aodv-packet.cc:97
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: aodv-packet.cc:56
void Serialize(Buffer::Iterator start) const override
Definition: aodv-packet.cc:68
MessageType m_type
type of the message
Definition: aodv-packet.h:104
bool m_valid
Indicates if the message is valid.
Definition: aodv-packet.h:105
bool IsValid() const
Check that type if valid.
Definition: aodv-packet.h:91
uint32_t GetSerializedSize() const override
Definition: aodv-packet.cc:62
static TypeId GetTypeId()
Get the type ID.
Definition: aodv-packet.cc:46
MessageType Get() const
Definition: aodv-packet.h:82
MessageType
MessageType enumeration.
Definition: aodv-packet.h:48
@ AODVTYPE_RREP
AODVTYPE_RREP.
Definition: aodv-packet.h:50
@ AODVTYPE_RREP_ACK
AODVTYPE_RREP_ACK.
Definition: aodv-packet.h:52
@ AODVTYPE_RERR
AODVTYPE_RERR.
Definition: aodv-packet.h:51
@ AODVTYPE_RREQ
AODVTYPE_RREQ.
Definition: aodv-packet.h:49
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1331
std::ostream & operator<<(std::ostream &os, const TypeHeader &h)
Stream output operator.
Definition: aodv-packet.cc:129
Every class exported by the ns3 library is enclosed in the ns3 namespace.