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