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