A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
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
37
TypeHeader::TypeHeader
(
MessageType
t)
38
: m_type (t),
39
m_valid (true)
40
{
41
}
42
43
TypeId
44
TypeHeader::GetTypeId
()
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
55
TypeHeader::GetInstanceTypeId
()
const
56
{
57
return
GetTypeId
();
58
}
59
60
uint32_t
61
TypeHeader::GetSerializedSize
()
const
62
{
63
return
1;
64
}
65
66
void
67
TypeHeader::Serialize
(
Buffer::Iterator
i)
const
68
{
69
i.
WriteU8
((uint8_t)
m_type
);
70
}
71
72
uint32_t
73
TypeHeader::Deserialize
(
Buffer::Iterator
start
)
74
{
75
Buffer::Iterator
i =
start
;
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
127
TypeHeader::operator==
(
TypeHeader
const
& o)
const
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
155
NS_OBJECT_ENSURE_REGISTERED
(
RreqHeader
);
156
157
TypeId
158
RreqHeader::GetTypeId
()
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
169
RreqHeader::GetInstanceTypeId
()
const
170
{
171
return
GetTypeId
();
172
}
173
174
uint32_t
175
RreqHeader::GetSerializedSize
()
const
176
{
177
return
23;
178
}
179
180
void
181
RreqHeader::Serialize
(
Buffer::Iterator
i)
const
182
{
183
i.
WriteU8
(
m_flags
);
184
i.
WriteU8
(
m_reserved
);
185
i.
WriteU8
(
m_hopCount
);
186
i.
WriteHtonU32
(
m_requestID
);
187
WriteTo
(i,
m_dst
);
188
i.
WriteHtonU32
(
m_dstSeqNo
);
189
WriteTo
(i,
m_origin
);
190
i.
WriteHtonU32
(
m_originSeqNo
);
191
}
192
193
uint32_t
194
RreqHeader::Deserialize
(
Buffer::Iterator
start
)
195
{
196
Buffer::Iterator
i =
start
;
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
230
RreqHeader::SetGratuitousRrep
(
bool
f
)
231
{
232
if
(
f
)
233
{
234
m_flags
|= (1 << 5);
235
}
236
else
237
{
238
m_flags
&= ~(1 << 5);
239
}
240
}
241
242
bool
243
RreqHeader::GetGratuitousRrep
()
const
244
{
245
return
(
m_flags
& (1 << 5));
246
}
247
248
void
249
RreqHeader::SetDestinationOnly
(
bool
f
)
250
{
251
if
(
f
)
252
{
253
m_flags
|= (1 << 4);
254
}
255
else
256
{
257
m_flags
&= ~(1 << 4);
258
}
259
}
260
261
bool
262
RreqHeader::GetDestinationOnly
()
const
263
{
264
return
(
m_flags
& (1 << 4));
265
}
266
267
void
268
RreqHeader::SetUnknownSeqno
(
bool
f
)
269
{
270
if
(
f
)
271
{
272
m_flags
|= (1 << 3);
273
}
274
else
275
{
276
m_flags
&= ~(1 << 3);
277
}
278
}
279
280
bool
281
RreqHeader::GetUnknownSeqno
()
const
282
{
283
return
(
m_flags
& (1 << 3));
284
}
285
286
bool
287
RreqHeader::operator==
(
RreqHeader
const
& o)
const
288
{
289
return
(
m_flags
== o.
m_flags
&&
m_reserved
== o.
m_reserved
290
&&
m_hopCount
== o.
m_hopCount
&&
m_requestID
== o.
m_requestID
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
311
NS_OBJECT_ENSURE_REGISTERED
(
RrepHeader
);
312
313
TypeId
314
RrepHeader::GetTypeId
()
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
325
RrepHeader::GetInstanceTypeId
()
const
326
{
327
return
GetTypeId
();
328
}
329
330
uint32_t
331
RrepHeader::GetSerializedSize
()
const
332
{
333
return
19;
334
}
335
336
void
337
RrepHeader::Serialize
(
Buffer::Iterator
i)
const
338
{
339
i.
WriteU8
(
m_flags
);
340
i.
WriteU8
(
m_prefixSize
);
341
i.
WriteU8
(
m_hopCount
);
342
WriteTo
(i,
m_dst
);
343
i.
WriteHtonU32
(
m_dstSeqNo
);
344
WriteTo
(i,
m_origin
);
345
i.
WriteHtonU32
(
m_lifeTime
);
346
}
347
348
uint32_t
349
RrepHeader::Deserialize
(
Buffer::Iterator
start
)
350
{
351
Buffer::Iterator
i =
start
;
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
379
RrepHeader::SetLifeTime
(
Time
t)
380
{
381
m_lifeTime
= t.
GetMilliSeconds
();
382
}
383
384
Time
385
RrepHeader::GetLifeTime
()
const
386
{
387
Time
t (
MilliSeconds
(
m_lifeTime
));
388
return
t;
389
}
390
391
void
392
RrepHeader::SetAckRequired
(
bool
f
)
393
{
394
if
(
f
)
395
{
396
m_flags
|= (1 << 6);
397
}
398
else
399
{
400
m_flags
&= ~(1 << 6);
401
}
402
}
403
404
bool
405
RrepHeader::GetAckRequired
()
const
406
{
407
return
(
m_flags
& (1 << 6));
408
}
409
410
void
411
RrepHeader::SetPrefixSize
(uint8_t sz)
412
{
413
m_prefixSize
= sz;
414
}
415
416
uint8_t
417
RrepHeader::GetPrefixSize
()
const
418
{
419
return
m_prefixSize
;
420
}
421
422
bool
423
RrepHeader::operator==
(
RrepHeader
const
& o)
const
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
453
RrepAckHeader::RrepAckHeader
()
454
: m_reserved (0)
455
{
456
}
457
458
NS_OBJECT_ENSURE_REGISTERED
(
RrepAckHeader
);
459
460
TypeId
461
RrepAckHeader::GetTypeId
()
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
472
RrepAckHeader::GetInstanceTypeId
()
const
473
{
474
return
GetTypeId
();
475
}
476
477
uint32_t
478
RrepAckHeader::GetSerializedSize
()
const
479
{
480
return
1;
481
}
482
483
void
484
RrepAckHeader::Serialize
(
Buffer::Iterator
i )
const
485
{
486
i.
WriteU8
(
m_reserved
);
487
}
488
489
uint32_t
490
RrepAckHeader::Deserialize
(
Buffer::Iterator
start
)
491
{
492
Buffer::Iterator
i =
start
;
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
505
RrepAckHeader::operator==
(
RrepAckHeader
const
& o )
const
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
//-----------------------------------------------------------------------------
520
RerrHeader::RerrHeader
()
521
: m_flag (0),
522
m_reserved (0)
523
{
524
}
525
526
NS_OBJECT_ENSURE_REGISTERED
(
RerrHeader
);
527
528
TypeId
529
RerrHeader::GetTypeId
()
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
540
RerrHeader::GetInstanceTypeId
()
const
541
{
542
return
GetTypeId
();
543
}
544
545
uint32_t
546
RerrHeader::GetSerializedSize
()
const
547
{
548
return
(3 + 8 *
GetDestCount
());
549
}
550
551
void
552
RerrHeader::Serialize
(
Buffer::Iterator
i )
const
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
566
RerrHeader::Deserialize
(
Buffer::Iterator
start
)
567
{
568
Buffer::Iterator
i =
start
;
569
m_flag
= i.
ReadU8
();
570
m_reserved
= i.
ReadU8
();
571
uint8_t dest = i.
ReadU8
();
572
m_unreachableDstSeqNo
.clear ();
573
Ipv4Address
address
;
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
600
RerrHeader::SetNoDelete
(
bool
f
)
601
{
602
if
(
f
)
603
{
604
m_flag
|= (1 << 0);
605
}
606
else
607
{
608
m_flag
&= ~(1 << 0);
609
}
610
}
611
612
bool
613
RerrHeader::GetNoDelete
()
const
614
{
615
return
(
m_flag
& (1 << 0));
616
}
617
618
bool
619
RerrHeader::AddUnDestination
(
Ipv4Address
dst, uint32_t seqNo )
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
645
RerrHeader::Clear
()
646
{
647
m_unreachableDstSeqNo
.clear ();
648
m_flag
= 0;
649
m_reserved
= 0;
650
}
651
652
bool
653
RerrHeader::operator==
(
RerrHeader
const
& o )
const
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
}
ns3::aodv::RrepHeader::GetLifeTime
Time GetLifeTime() const
Get the lifetime.
Definition:
aodv-packet.cc:385
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::aodv::TypeHeader::m_valid
bool m_valid
Indicates if the message is valid.
Definition:
aodv-packet.h:100
ns3::aodv::RreqHeader::SetDestinationOnly
void SetDestinationOnly(bool f)
Set the Destination only flag.
Definition:
aodv-packet.cc:249
ns3::aodv::TypeHeader::operator==
bool operator==(TypeHeader const &o) const
Comparison operator.
Definition:
aodv-packet.cc:127
ns3::aodv::RrepHeader::m_lifeTime
uint32_t m_lifeTime
Lifetime (in milliseconds)
Definition:
aodv-packet.h:482
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
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:67
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:299
ns3::aodv::RrepHeader::m_dst
Ipv4Address m_dst
Destination IP Address.
Definition:
aodv-packet.h:479
ns3::aodv::RrepAckHeader::m_reserved
uint8_t m_reserved
Not used (must be 0)
Definition:
aodv-packet.h:527
ns3::aodv::RrepAckHeader::Serialize
void Serialize(Buffer::Iterator start) const
Definition:
aodv-packet.cc:484
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::aodv::RreqHeader::m_reserved
uint8_t m_reserved
Not used (must be 0)
Definition:
aodv-packet.h:300
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(Iterator const &o) const
Definition:
buffer.cc:788
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:142
ns3::aodv::AODVTYPE_RREP
@ AODVTYPE_RREP
AODVTYPE_RREP.
Definition:
aodv-packet.h:48
ns3::aodv::RerrHeader::m_flag
uint8_t m_flag
No delete flag.
Definition:
aodv-packet.h:616
ns3::aodv::RerrHeader::Serialize
void Serialize(Buffer::Iterator i) const
Definition:
aodv-packet.cc:552
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8(void)
Definition:
buffer.h:1021
ns3::aodv::RerrHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
aodv-packet.cc:529
ns3::aodv::RrepHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
aodv-packet.cc:314
ns3::aodv::RreqHeader::m_origin
Ipv4Address m_origin
Originator IP Address.
Definition:
aodv-packet.h:305
ns3::aodv::RreqHeader::Print
void Print(std::ostream &os) const
Definition:
aodv-packet.cc:212
ns3::aodv::RreqHeader::m_dstSeqNo
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition:
aodv-packet.h:304
ns3::aodv::TypeHeader::Serialize
void Serialize(Buffer::Iterator start) const
Definition:
aodv-packet.cc:67
ns3::aodv::RrepHeader::SetHello
void SetHello(Ipv4Address src, uint32_t srcSeqNo, Time lifetime)
Configure RREP to be a Hello message.
Definition:
aodv-packet.cc:431
ns3::aodv::RrepHeader::m_hopCount
uint8_t m_hopCount
Hop Count.
Definition:
aodv-packet.h:478
ns3::aodv::RreqHeader::m_dst
Ipv4Address m_dst
Destination IP Address.
Definition:
aodv-packet.h:303
ns3::aodv::RrepHeader::operator==
bool operator==(RrepHeader const &o) const
Comparison operator.
Definition:
aodv-packet.cc:423
ns3::aodv::RerrHeader::RerrHeader
RerrHeader()
constructor
Definition:
aodv-packet.cc:520
ns3::Buffer::Iterator::WriteU8
void WriteU8(uint8_t data)
Definition:
buffer.h:869
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:41
ns3::aodv::RreqHeader::m_hopCount
uint8_t m_hopCount
Hop Count.
Definition:
aodv-packet.h:301
ns3::aodv::RerrHeader::Clear
void Clear()
Clear header.
Definition:
aodv-packet.cc:645
ns3::aodv::RerrHeader::operator==
bool operator==(RerrHeader const &o) const
Comparison operator.
Definition:
aodv-packet.cc:653
ns3::aodv::RrepHeader::GetSerializedSize
uint32_t GetSerializedSize() const
Definition:
aodv-packet.cc:331
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
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:619
ns3::aodv::RreqHeader::GetUnknownSeqno
bool GetUnknownSeqno() const
Get the unknown sequence number flag.
Definition:
aodv-packet.cc:281
ns3::aodv::RrepHeader::m_flags
uint8_t m_flags
A - acknowledgment required flag.
Definition:
aodv-packet.h:476
ns3::aodv::RrepAckHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition:
aodv-packet.cc:472
ns3::aodv::RreqHeader::GetSerializedSize
uint32_t GetSerializedSize() const
Definition:
aodv-packet.cc:175
ns3::aodv::RreqHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
aodv-packet.cc:158
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:620
ns3::aodv::RrepHeader::GetAckRequired
bool GetAckRequired() const
get the ack required flag
Definition:
aodv-packet.cc:405
ns3::aodv::RreqHeader::SetGratuitousRrep
void SetGratuitousRrep(bool f)
Set the gratuitous RREP flag.
Definition:
aodv-packet.cc:230
visualizer.core.start
def start()
Definition:
core.py:1855
ns3::aodv::RreqHeader
Route Request (RREQ) Message Format.
Definition:
aodv-packet.h:132
ns3::aodv::TypeHeader
AODV types.
Definition:
aodv-packet.h:58
ns3::aodv::RreqHeader::m_requestID
uint32_t m_requestID
RREQ ID.
Definition:
aodv-packet.h:302
ns3::aodv::AODVTYPE_RREP_ACK
@ AODVTYPE_RREP_ACK
AODVTYPE_RREP_ACK.
Definition:
aodv-packet.h:50
ns3::aodv::RerrHeader::Print
void Print(std::ostream &os) const
Definition:
aodv-packet.cc:588
bianchi11ax.k
int k
Definition:
bianchi11ax.py:129
ns3::aodv::RerrHeader
Route Error (RERR) Message Format.
Definition:
aodv-packet.h:558
ns3::aodv::operator<<
std::ostream & operator<<(std::ostream &os, TypeHeader const &h)
Stream output operator.
Definition:
aodv-packet.cc:133
ns3::aodv::RrepAckHeader::RrepAckHeader
RrepAckHeader()
constructor
Definition:
aodv-packet.cc:453
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1297
ns3::aodv::RrepHeader::Serialize
void Serialize(Buffer::Iterator start) const
Definition:
aodv-packet.cc:337
ns3::aodv::RreqHeader::GetGratuitousRrep
bool GetGratuitousRrep() const
Get the gratuitous RREP flag.
Definition:
aodv-packet.cc:243
ns3::aodv::AODVTYPE_RREQ
@ AODVTYPE_RREQ
AODVTYPE_RREQ.
Definition:
aodv-packet.h:47
ns3::aodv::RrepHeader::Print
void Print(std::ostream &os) const
Definition:
aodv-packet.cc:367
ns3::aodv::RerrHeader::GetNoDelete
bool GetNoDelete() const
Get the no delete flag.
Definition:
aodv-packet.cc:613
first.address
address
Definition:
first.py:44
ns3::aodv::RrepAckHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
aodv-packet.cc:461
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:104
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:43
ns3::aodv::RrepAckHeader::operator==
bool operator==(RrepAckHeader const &o) const
Comparison operator.
Definition:
aodv-packet.cc:505
ns3::aodv::RreqHeader::GetDestinationOnly
bool GetDestinationOnly() const
Get the Destination only flag.
Definition:
aodv-packet.cc:262
ns3::aodv::TypeHeader::Print
void Print(std::ostream &os) const
Definition:
aodv-packet.cc:97
ns3::aodv::RreqHeader::SetUnknownSeqno
void SetUnknownSeqno(bool f)
Set the unknown sequence number flag.
Definition:
aodv-packet.cc:268
ns3::aodv::RrepHeader::GetPrefixSize
uint8_t GetPrefixSize() const
Set the pefix size.
Definition:
aodv-packet.cc:417
ns3::aodv::RerrHeader::m_reserved
uint8_t m_reserved
Not used (must be 0)
Definition:
aodv-packet.h:617
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::aodv::RrepHeader::m_prefixSize
uint8_t m_prefixSize
Prefix Size.
Definition:
aodv-packet.h:477
ns3::aodv::RrepHeader::SetLifeTime
void SetLifeTime(Time t)
Set the lifetime.
Definition:
aodv-packet.cc:379
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:99
ns3::Time::GetMilliSeconds
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition:
nstime.h:384
ns3::aodv::RrepHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition:
aodv-packet.cc:325
ns3::aodv::RrepHeader
Route Reply (RREP) Message Format.
Definition:
aodv-packet.h:336
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:632
ns3::aodv::RrepHeader::m_dstSeqNo
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition:
aodv-packet.h:480
ns3::aodv::RreqHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition:
aodv-packet.cc:169
ns3::aodv::TypeHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
aodv-packet.cc:44
ns3::aodv::RreqHeader::m_originSeqNo
uint32_t m_originSeqNo
Source Sequence Number.
Definition:
aodv-packet.h:306
ns3::aodv::AODVTYPE_RERR
@ AODVTYPE_RERR
AODVTYPE_RERR.
Definition:
aodv-packet.h:49
ns3::aodv::RrepHeader::SetPrefixSize
void SetPrefixSize(uint8_t sz)
Set the prefix size.
Definition:
aodv-packet.cc:411
ns3::aodv::RrepHeader::m_origin
Ipv4Address m_origin
Source IP Address.
Definition:
aodv-packet.h:481
ns3::aodv::RerrHeader::GetDestCount
uint8_t GetDestCount() const
Definition:
aodv-packet.h:604
ns3::aodv::TypeHeader::TypeHeader
TypeHeader(MessageType t=AODVTYPE_RREQ)
constructor
Definition:
aodv-packet.cc:37
f
double f(double x, void *params)
Definition:
80211b.c:70
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition:
address-utils.cc:28
ns3::aodv::TypeHeader::m_type
MessageType m_type
type of the message
Definition:
aodv-packet.h:99
ns3::aodv::RrepAckHeader::Print
void Print(std::ostream &os) const
Definition:
aodv-packet.cc:500
ns3::aodv::TypeHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition:
aodv-packet.cc:55
aodv-packet.h
ns3::aodv::RerrHeader::SetNoDelete
void SetNoDelete(bool f)
Set the no delete flag.
Definition:
aodv-packet.cc:600
ns3::aodv::RreqHeader::Serialize
void Serialize(Buffer::Iterator start) const
Definition:
aodv-packet.cc:181
ns3::aodv::RreqHeader::operator==
bool operator==(RreqHeader const &o) const
Comparison operator.
Definition:
aodv-packet.cc:287
ns3::aodv::RrepAckHeader
Route Reply Acknowledgment (RREP-ACK) Message Format.
Definition:
aodv-packet.h:504
ns3::aodv::RrepHeader::SetAckRequired
void SetAckRequired(bool f)
Set the ack required flag.
Definition:
aodv-packet.cc:392
ns3::aodv::MessageType
MessageType
MessageType enumeration.
Definition:
aodv-packet.h:46
ns3::aodv::RerrHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition:
aodv-packet.cc:540
ns3::aodv::TypeHeader::GetSerializedSize
uint32_t GetSerializedSize() const
Definition:
aodv-packet.cc:61
ns3::Buffer::Iterator::ReadNtohU32
uint32_t ReadNtohU32(void)
Definition:
buffer.h:970
ns3::aodv::RrepAckHeader::GetSerializedSize
uint32_t GetSerializedSize() const
Definition:
aodv-packet.cc:478
ns3::Buffer::Iterator::WriteHtonU32
void WriteHtonU32(uint32_t data)
Definition:
buffer.h:924
ns3::aodv::RreqHeader::m_flags
uint8_t m_flags
|J|R|G|D|U| bit flags, see RFC
Definition:
aodv-packet.h:299
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition:
address-utils.cc:70
ns3::aodv::RerrHeader::GetSerializedSize
uint32_t GetSerializedSize() const
Definition:
aodv-packet.cc:546
src
aodv
model
aodv-packet.cc
Generated on Fri Oct 1 2021 17:02:54 for ns-3 by
1.8.20