A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
wifi
model
wifi-mac-header.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2006, 2009 INRIA
4
* Copyright (c) 2009 MIRKO BANCHI
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Mirko Banchi <mk.banchi@gmail.com>
21
*/
22
23
#include "ns3/nstime.h"
24
#include "ns3/address-utils.h"
25
#include "
wifi-mac-header.h
"
26
27
namespace
ns3
{
28
29
NS_OBJECT_ENSURE_REGISTERED
(WifiMacHeader);
30
32
enum
33
{
34
TYPE_MGT
= 0,
35
TYPE_CTL
= 1,
36
TYPE_DATA
= 2
37
};
38
40
enum
41
{
42
//Reserved: 0 - 6
43
SUBTYPE_CTL_CTLWRAPPER
= 7,
44
SUBTYPE_CTL_BACKREQ
= 8,
45
SUBTYPE_CTL_BACKRESP
= 9,
46
SUBTYPE_CTL_RTS
= 11,
47
SUBTYPE_CTL_CTS
= 12,
48
SUBTYPE_CTL_ACK
= 13,
49
SUBTYPE_CTL_END
= 14,
50
SUBTYPE_CTL_END_ACK
= 15
51
};
52
53
WifiMacHeader::WifiMacHeader
()
54
: m_ctrlMoreData (0),
55
m_ctrlWep (0),
56
m_ctrlOrder (0),
57
m_amsduPresent (0)
58
{
59
}
60
61
WifiMacHeader::~WifiMacHeader
()
62
{
63
}
64
65
void
66
WifiMacHeader::SetDsFrom
(
void
)
67
{
68
m_ctrlFromDs
= 1;
69
}
70
71
void
72
WifiMacHeader::SetDsNotFrom
(
void
)
73
{
74
m_ctrlFromDs
= 0;
75
}
76
77
void
78
WifiMacHeader::SetDsTo
(
void
)
79
{
80
m_ctrlToDs
= 1;
81
}
82
83
void
84
WifiMacHeader::SetDsNotTo
(
void
)
85
{
86
m_ctrlToDs
= 0;
87
}
88
89
void
90
WifiMacHeader::SetAddr1
(
Mac48Address
address
)
91
{
92
m_addr1
=
address
;
93
}
94
95
void
96
WifiMacHeader::SetAddr2
(
Mac48Address
address
)
97
{
98
m_addr2
=
address
;
99
}
100
101
void
102
WifiMacHeader::SetAddr3
(
Mac48Address
address
)
103
{
104
m_addr3
=
address
;
105
}
106
107
void
108
WifiMacHeader::SetAddr4
(
Mac48Address
address
)
109
{
110
m_addr4
=
address
;
111
}
112
113
void
114
WifiMacHeader::SetType
(
WifiMacType
type,
bool
resetToDsFromDs)
115
{
116
switch
(type)
117
{
118
case
WIFI_MAC_CTL_CTLWRAPPER
:
119
m_ctrlType
=
TYPE_CTL
;
120
m_ctrlSubtype
=
SUBTYPE_CTL_CTLWRAPPER
;
121
break
;
122
case
WIFI_MAC_CTL_BACKREQ
:
123
m_ctrlType
=
TYPE_CTL
;
124
m_ctrlSubtype
=
SUBTYPE_CTL_BACKREQ
;
125
break
;
126
case
WIFI_MAC_CTL_BACKRESP
:
127
m_ctrlType
=
TYPE_CTL
;
128
m_ctrlSubtype
=
SUBTYPE_CTL_BACKRESP
;
129
break
;
130
case
WIFI_MAC_CTL_RTS
:
131
m_ctrlType
=
TYPE_CTL
;
132
m_ctrlSubtype
=
SUBTYPE_CTL_RTS
;
133
break
;
134
case
WIFI_MAC_CTL_CTS
:
135
m_ctrlType
=
TYPE_CTL
;
136
m_ctrlSubtype
=
SUBTYPE_CTL_CTS
;
137
break
;
138
case
WIFI_MAC_CTL_ACK
:
139
m_ctrlType
=
TYPE_CTL
;
140
m_ctrlSubtype
=
SUBTYPE_CTL_ACK
;
141
break
;
142
case
WIFI_MAC_CTL_END
:
143
m_ctrlType
=
TYPE_CTL
;
144
m_ctrlSubtype
=
SUBTYPE_CTL_END
;
145
break
;
146
case
WIFI_MAC_CTL_END_ACK
:
147
m_ctrlType
=
TYPE_CTL
;
148
m_ctrlSubtype
=
SUBTYPE_CTL_END_ACK
;
149
break
;
150
case
WIFI_MAC_MGT_ASSOCIATION_REQUEST
:
151
m_ctrlType
=
TYPE_MGT
;
152
m_ctrlSubtype
= 0;
153
break
;
154
case
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
:
155
m_ctrlType
=
TYPE_MGT
;
156
m_ctrlSubtype
= 1;
157
break
;
158
case
WIFI_MAC_MGT_REASSOCIATION_REQUEST
:
159
m_ctrlType
=
TYPE_MGT
;
160
m_ctrlSubtype
= 2;
161
break
;
162
case
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
:
163
m_ctrlType
=
TYPE_MGT
;
164
m_ctrlSubtype
= 3;
165
break
;
166
case
WIFI_MAC_MGT_PROBE_REQUEST
:
167
m_ctrlType
=
TYPE_MGT
;
168
m_ctrlSubtype
= 4;
169
break
;
170
case
WIFI_MAC_MGT_PROBE_RESPONSE
:
171
m_ctrlType
=
TYPE_MGT
;
172
m_ctrlSubtype
= 5;
173
break
;
174
case
WIFI_MAC_MGT_BEACON
:
175
m_ctrlType
=
TYPE_MGT
;
176
m_ctrlSubtype
= 8;
177
break
;
178
case
WIFI_MAC_MGT_DISASSOCIATION
:
179
m_ctrlType
=
TYPE_MGT
;
180
m_ctrlSubtype
= 10;
181
break
;
182
case
WIFI_MAC_MGT_AUTHENTICATION
:
183
m_ctrlType
=
TYPE_MGT
;
184
m_ctrlSubtype
= 11;
185
break
;
186
case
WIFI_MAC_MGT_DEAUTHENTICATION
:
187
m_ctrlType
=
TYPE_MGT
;
188
m_ctrlSubtype
= 12;
189
break
;
190
case
WIFI_MAC_MGT_ACTION
:
191
m_ctrlType
=
TYPE_MGT
;
192
m_ctrlSubtype
= 13;
193
break
;
194
case
WIFI_MAC_MGT_ACTION_NO_ACK
:
195
m_ctrlType
=
TYPE_MGT
;
196
m_ctrlSubtype
= 14;
197
break
;
198
case
WIFI_MAC_MGT_MULTIHOP_ACTION
:
199
m_ctrlType
=
TYPE_MGT
;
200
m_ctrlSubtype
= 15;
201
break
;
202
case
WIFI_MAC_DATA
:
203
m_ctrlType
=
TYPE_DATA
;
204
m_ctrlSubtype
= 0;
205
break
;
206
case
WIFI_MAC_DATA_CFACK
:
207
m_ctrlType
=
TYPE_DATA
;
208
m_ctrlSubtype
= 1;
209
break
;
210
case
WIFI_MAC_DATA_CFPOLL
:
211
m_ctrlType
=
TYPE_DATA
;
212
m_ctrlSubtype
= 2;
213
break
;
214
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
215
m_ctrlType
=
TYPE_DATA
;
216
m_ctrlSubtype
= 3;
217
break
;
218
case
WIFI_MAC_DATA_NULL
:
219
m_ctrlType
=
TYPE_DATA
;
220
m_ctrlSubtype
= 4;
221
break
;
222
case
WIFI_MAC_DATA_NULL_CFACK
:
223
m_ctrlType
=
TYPE_DATA
;
224
m_ctrlSubtype
= 5;
225
break
;
226
case
WIFI_MAC_DATA_NULL_CFPOLL
:
227
m_ctrlType
=
TYPE_DATA
;
228
m_ctrlSubtype
= 6;
229
break
;
230
case
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
:
231
m_ctrlType
=
TYPE_DATA
;
232
m_ctrlSubtype
= 7;
233
break
;
234
case
WIFI_MAC_QOSDATA
:
235
m_ctrlType
=
TYPE_DATA
;
236
m_ctrlSubtype
= 8;
237
break
;
238
case
WIFI_MAC_QOSDATA_CFACK
:
239
m_ctrlType
=
TYPE_DATA
;
240
m_ctrlSubtype
= 9;
241
break
;
242
case
WIFI_MAC_QOSDATA_CFPOLL
:
243
m_ctrlType
=
TYPE_DATA
;
244
m_ctrlSubtype
= 10;
245
break
;
246
case
WIFI_MAC_QOSDATA_CFACK_CFPOLL
:
247
m_ctrlType
=
TYPE_DATA
;
248
m_ctrlSubtype
= 11;
249
break
;
250
case
WIFI_MAC_QOSDATA_NULL
:
251
m_ctrlType
=
TYPE_DATA
;
252
m_ctrlSubtype
= 12;
253
break
;
254
case
WIFI_MAC_QOSDATA_NULL_CFPOLL
:
255
m_ctrlType
=
TYPE_DATA
;
256
m_ctrlSubtype
= 14;
257
break
;
258
case
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
:
259
m_ctrlType
=
TYPE_DATA
;
260
m_ctrlSubtype
= 15;
261
break
;
262
}
263
if
(resetToDsFromDs)
264
{
265
m_ctrlToDs
= 0;
266
m_ctrlFromDs
= 0;
267
}
268
}
269
270
void
271
WifiMacHeader::SetRawDuration
(uint16_t duration)
272
{
273
NS_ASSERT
(duration <= 32768);
274
m_duration
= duration;
275
}
276
277
void
278
WifiMacHeader::SetDuration
(
Time
duration)
279
{
280
int64_t duration_us =
static_cast<
int64_t
>
(ceil (static_cast<double> (duration.
GetNanoSeconds
()) / 1000));
281
NS_ASSERT
(duration_us >= 0 && duration_us <= 0x7fff);
282
m_duration
=
static_cast<
uint16_t
>
(duration_us);
283
}
284
285
void
WifiMacHeader::SetId
(uint16_t
id
)
286
{
287
m_duration
= id;
288
}
289
290
void
WifiMacHeader::SetSequenceNumber
(uint16_t seq)
291
{
292
m_seqSeq
= seq;
293
}
294
295
void
WifiMacHeader::SetFragmentNumber
(uint8_t frag)
296
{
297
m_seqFrag
= frag;
298
}
299
300
void
WifiMacHeader::SetNoMoreFragments
(
void
)
301
{
302
m_ctrlMoreFrag
= 0;
303
}
304
305
void
WifiMacHeader::SetMoreFragments
(
void
)
306
{
307
m_ctrlMoreFrag
= 1;
308
}
309
310
void
WifiMacHeader::SetOrder
(
void
)
311
{
312
m_ctrlOrder
= 1;
313
}
314
315
void
WifiMacHeader::SetNoOrder
(
void
)
316
{
317
m_ctrlOrder
= 0;
318
}
319
320
void
WifiMacHeader::SetRetry
(
void
)
321
{
322
m_ctrlRetry
= 1;
323
}
324
325
void
WifiMacHeader::SetNoRetry
(
void
)
326
{
327
m_ctrlRetry
= 0;
328
}
329
330
void
WifiMacHeader::SetQosTid
(uint8_t tid)
331
{
332
m_qosTid
= tid;
333
}
334
335
void
WifiMacHeader::SetQosEosp
()
336
{
337
m_qosEosp
= 1;
338
}
339
340
void
WifiMacHeader::SetQosNoEosp
()
341
{
342
m_qosEosp
= 0;
343
}
344
345
void
WifiMacHeader::SetQosAckPolicy
(
QosAckPolicy
policy)
346
{
347
switch
(policy)
348
{
349
case
NORMAL_ACK
:
350
m_qosAckPolicy
= 0;
351
break
;
352
case
NO_ACK
:
353
m_qosAckPolicy
= 1;
354
break
;
355
case
NO_EXPLICIT_ACK
:
356
m_qosAckPolicy
= 2;
357
break
;
358
case
BLOCK_ACK
:
359
m_qosAckPolicy
= 3;
360
break
;
361
}
362
}
363
364
void
WifiMacHeader::SetQosAmsdu
(
void
)
365
{
366
m_amsduPresent
= 1;
367
}
368
369
void
WifiMacHeader::SetQosNoAmsdu
(
void
)
370
{
371
m_amsduPresent
= 0;
372
}
373
374
void
WifiMacHeader::SetQosTxopLimit
(uint8_t txop)
375
{
376
m_qosStuff
= txop;
377
}
378
379
void
WifiMacHeader::SetQosMeshControlPresent
(
void
)
380
{
381
//Mark bit 0 of this variable instead of bit 8, since m_qosStuff is
382
//shifted by one byte when serialized
383
m_qosStuff
=
m_qosStuff
| 0x01;
//bit 8 of QoS Control Field
384
}
385
386
void
WifiMacHeader::SetQosNoMeshControlPresent
()
387
{
388
//Clear bit 0 of this variable instead of bit 8, since m_qosStuff is
389
//shifted by one byte when serialized
390
m_qosStuff
=
m_qosStuff
& 0xfe;
//bit 8 of QoS Control Field
391
}
392
393
394
Mac48Address
395
WifiMacHeader::GetAddr1
(
void
)
const
396
{
397
return
m_addr1
;
398
}
399
400
Mac48Address
401
WifiMacHeader::GetAddr2
(
void
)
const
402
{
403
return
m_addr2
;
404
}
405
406
Mac48Address
407
WifiMacHeader::GetAddr3
(
void
)
const
408
{
409
return
m_addr3
;
410
}
411
412
Mac48Address
413
WifiMacHeader::GetAddr4
(
void
)
const
414
{
415
return
m_addr4
;
416
}
417
418
WifiMacType
419
WifiMacHeader::GetType
(
void
)
const
420
{
421
switch
(
m_ctrlType
)
422
{
423
case
TYPE_MGT
:
424
switch
(
m_ctrlSubtype
)
425
{
426
case
0:
427
return
WIFI_MAC_MGT_ASSOCIATION_REQUEST
;
428
case
1:
429
return
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
;
430
case
2:
431
return
WIFI_MAC_MGT_REASSOCIATION_REQUEST
;
432
case
3:
433
return
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
;
434
case
4:
435
return
WIFI_MAC_MGT_PROBE_REQUEST
;
436
case
5:
437
return
WIFI_MAC_MGT_PROBE_RESPONSE
;
438
case
8:
439
return
WIFI_MAC_MGT_BEACON
;
440
case
10:
441
return
WIFI_MAC_MGT_DISASSOCIATION
;
442
case
11:
443
return
WIFI_MAC_MGT_AUTHENTICATION
;
444
case
12:
445
return
WIFI_MAC_MGT_DEAUTHENTICATION
;
446
case
13:
447
return
WIFI_MAC_MGT_ACTION
;
448
case
14:
449
return
WIFI_MAC_MGT_ACTION_NO_ACK
;
450
case
15:
451
return
WIFI_MAC_MGT_MULTIHOP_ACTION
;
452
}
453
break
;
454
case
TYPE_CTL
:
455
switch
(
m_ctrlSubtype
)
456
{
457
case
SUBTYPE_CTL_BACKREQ
:
458
return
WIFI_MAC_CTL_BACKREQ
;
459
case
SUBTYPE_CTL_BACKRESP
:
460
return
WIFI_MAC_CTL_BACKRESP
;
461
case
SUBTYPE_CTL_RTS
:
462
return
WIFI_MAC_CTL_RTS
;
463
case
SUBTYPE_CTL_CTS
:
464
return
WIFI_MAC_CTL_CTS
;
465
case
SUBTYPE_CTL_ACK
:
466
return
WIFI_MAC_CTL_ACK
;
467
case
SUBTYPE_CTL_END
:
468
return
WIFI_MAC_CTL_END
;
469
case
SUBTYPE_CTL_END_ACK
:
470
return
WIFI_MAC_CTL_END_ACK
;
471
}
472
break
;
473
case
TYPE_DATA
:
474
switch
(
m_ctrlSubtype
)
475
{
476
case
0:
477
return
WIFI_MAC_DATA
;
478
case
1:
479
return
WIFI_MAC_DATA_CFACK
;
480
case
2:
481
return
WIFI_MAC_DATA_CFPOLL
;
482
case
3:
483
return
WIFI_MAC_DATA_CFACK_CFPOLL
;
484
case
4:
485
return
WIFI_MAC_DATA_NULL
;
486
case
5:
487
return
WIFI_MAC_DATA_NULL_CFACK
;
488
case
6:
489
return
WIFI_MAC_DATA_NULL_CFPOLL
;
490
case
7:
491
return
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
;
492
case
8:
493
return
WIFI_MAC_QOSDATA
;
494
case
9:
495
return
WIFI_MAC_QOSDATA_CFACK
;
496
case
10:
497
return
WIFI_MAC_QOSDATA_CFPOLL
;
498
case
11:
499
return
WIFI_MAC_QOSDATA_CFACK_CFPOLL
;
500
case
12:
501
return
WIFI_MAC_QOSDATA_NULL
;
502
case
14:
503
return
WIFI_MAC_QOSDATA_NULL_CFPOLL
;
504
case
15:
505
return
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
;
506
}
507
break
;
508
}
509
// NOTREACHED
510
NS_ASSERT
(
false
);
511
return
(
WifiMacType
) - 1;
512
}
513
514
bool
515
WifiMacHeader::IsFromDs
(
void
)
const
516
{
517
return
m_ctrlFromDs
== 1;
518
}
519
520
bool
521
WifiMacHeader::IsToDs
(
void
)
const
522
{
523
return
m_ctrlToDs
== 1;
524
}
525
526
bool
527
WifiMacHeader::IsData
(
void
)
const
528
{
529
return
(
m_ctrlType
==
TYPE_DATA
);
530
531
}
532
533
bool
534
WifiMacHeader::IsQosData
(
void
)
const
535
{
536
return
(
m_ctrlType
==
TYPE_DATA
&& (
m_ctrlSubtype
& 0x08));
537
}
538
539
bool
540
WifiMacHeader::IsCtl
(
void
)
const
541
{
542
return
(
m_ctrlType
==
TYPE_CTL
);
543
}
544
545
bool
546
WifiMacHeader::IsMgt
(
void
)
const
547
{
548
return
(
m_ctrlType
==
TYPE_MGT
);
549
}
550
551
bool
552
WifiMacHeader::IsCfPoll
(
void
)
const
553
{
554
switch
(
GetType
())
555
{
556
case
WIFI_MAC_DATA_CFPOLL
:
557
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
558
case
WIFI_MAC_DATA_NULL_CFPOLL
:
559
case
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
:
560
case
WIFI_MAC_QOSDATA_CFPOLL
:
561
case
WIFI_MAC_QOSDATA_CFACK_CFPOLL
:
562
case
WIFI_MAC_QOSDATA_NULL_CFPOLL
:
563
case
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
:
564
return
true
;
565
default
:
566
return
false
;
567
}
568
}
569
570
bool
571
WifiMacHeader::IsCfEnd
(
void
)
const
572
{
573
switch
(
GetType
())
574
{
575
case
WIFI_MAC_CTL_END
:
576
case
WIFI_MAC_CTL_END_ACK
:
577
return
true
;
578
default
:
579
return
false
;
580
}
581
}
582
583
bool
584
WifiMacHeader::IsCfAck
(
void
)
const
585
{
586
switch
(
GetType
())
587
{
588
case
WIFI_MAC_DATA_CFACK
:
589
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
590
case
WIFI_MAC_DATA_NULL_CFACK
:
591
case
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
:
592
case
WIFI_MAC_CTL_END_ACK
:
593
return
true
;
594
default
:
595
return
false
;
596
break
;
597
}
598
}
599
600
bool
601
WifiMacHeader::HasData
(
void
)
const
602
{
603
switch
(
GetType
())
604
{
605
case
WIFI_MAC_DATA
:
606
case
WIFI_MAC_DATA_CFACK
:
607
case
WIFI_MAC_DATA_CFPOLL
:
608
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
609
case
WIFI_MAC_QOSDATA
:
610
case
WIFI_MAC_QOSDATA_CFACK
:
611
case
WIFI_MAC_QOSDATA_CFPOLL
:
612
case
WIFI_MAC_QOSDATA_CFACK_CFPOLL
:
613
return
true
;
614
default
:
615
return
false
;
616
}
617
}
618
619
bool
620
WifiMacHeader::IsRts
(
void
)
const
621
{
622
return
(
GetType
() ==
WIFI_MAC_CTL_RTS
);
623
}
624
625
bool
626
WifiMacHeader::IsCts
(
void
)
const
627
{
628
return
(
GetType
() ==
WIFI_MAC_CTL_CTS
);
629
}
630
631
bool
632
WifiMacHeader::IsAck
(
void
)
const
633
{
634
return
(
GetType
() ==
WIFI_MAC_CTL_ACK
);
635
}
636
637
bool
638
WifiMacHeader::IsAssocReq
(
void
)
const
639
{
640
return
(
GetType
() ==
WIFI_MAC_MGT_ASSOCIATION_REQUEST
);
641
}
642
643
bool
644
WifiMacHeader::IsAssocResp
(
void
)
const
645
{
646
return
(
GetType
() ==
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
);
647
}
648
649
bool
650
WifiMacHeader::IsReassocReq
(
void
)
const
651
{
652
return
(
GetType
() ==
WIFI_MAC_MGT_REASSOCIATION_REQUEST
);
653
}
654
655
bool
656
WifiMacHeader::IsReassocResp
(
void
)
const
657
{
658
return
(
GetType
() ==
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
);
659
}
660
661
bool
662
WifiMacHeader::IsProbeReq
(
void
)
const
663
{
664
return
(
GetType
() ==
WIFI_MAC_MGT_PROBE_REQUEST
);
665
}
666
667
bool
668
WifiMacHeader::IsProbeResp
(
void
)
const
669
{
670
return
(
GetType
() ==
WIFI_MAC_MGT_PROBE_RESPONSE
);
671
}
672
673
bool
674
WifiMacHeader::IsBeacon
(
void
)
const
675
{
676
return
(
GetType
() ==
WIFI_MAC_MGT_BEACON
);
677
}
678
679
bool
680
WifiMacHeader::IsDisassociation
(
void
)
const
681
{
682
return
(
GetType
() ==
WIFI_MAC_MGT_DISASSOCIATION
);
683
}
684
685
bool
686
WifiMacHeader::IsAuthentication
(
void
)
const
687
{
688
return
(
GetType
() ==
WIFI_MAC_MGT_AUTHENTICATION
);
689
}
690
691
bool
692
WifiMacHeader::IsDeauthentication
(
void
)
const
693
{
694
return
(
GetType
() ==
WIFI_MAC_MGT_DEAUTHENTICATION
);
695
}
696
697
bool
698
WifiMacHeader::IsAction
(
void
)
const
699
{
700
return
(
GetType
() ==
WIFI_MAC_MGT_ACTION
);
701
}
702
703
bool
704
WifiMacHeader::IsMultihopAction
(
void
)
const
705
{
706
return
(
GetType
() ==
WIFI_MAC_MGT_MULTIHOP_ACTION
);
707
}
708
709
bool
710
WifiMacHeader::IsBlockAckReq
(
void
)
const
711
{
712
return
(
GetType
() ==
WIFI_MAC_CTL_BACKREQ
) ? true :
false
;
713
}
714
715
bool
716
WifiMacHeader::IsBlockAck
(
void
)
const
717
{
718
return
(
GetType
() ==
WIFI_MAC_CTL_BACKRESP
) ? true :
false
;
719
}
720
721
uint16_t
722
WifiMacHeader::GetRawDuration
(
void
)
const
723
{
724
return
m_duration
;
725
}
726
727
Time
728
WifiMacHeader::GetDuration
(
void
)
const
729
{
730
return
MicroSeconds
(
m_duration
);
731
}
732
733
uint16_t
734
WifiMacHeader::GetSequenceControl
(
void
)
const
735
{
736
return
(
m_seqSeq
<< 4) |
m_seqFrag
;
737
}
738
739
uint16_t
740
WifiMacHeader::GetSequenceNumber
(
void
)
const
741
{
742
return
m_seqSeq
;
743
}
744
745
uint8_t
746
WifiMacHeader::GetFragmentNumber
(
void
)
const
747
{
748
return
m_seqFrag
;
749
}
750
751
bool
752
WifiMacHeader::IsRetry
(
void
)
const
753
{
754
return
(
m_ctrlRetry
== 1);
755
}
756
757
bool
758
WifiMacHeader::IsMoreFragments
(
void
)
const
759
{
760
return
(
m_ctrlMoreFrag
== 1);
761
}
762
763
bool
764
WifiMacHeader::IsQosBlockAck
(
void
)
const
765
{
766
NS_ASSERT
(
IsQosData
());
767
return
(
m_qosAckPolicy
== 3);
768
}
769
770
bool
771
WifiMacHeader::IsQosNoAck
(
void
)
const
772
{
773
NS_ASSERT
(
IsQosData
());
774
return
(
m_qosAckPolicy
== 1);
775
}
776
777
bool
778
WifiMacHeader::IsQosAck
(
void
)
const
779
{
780
NS_ASSERT
(
IsQosData
());
781
return
(
m_qosAckPolicy
== 0);
782
}
783
784
bool
785
WifiMacHeader::IsQosEosp
(
void
)
const
786
{
787
NS_ASSERT
(
IsQosData
());
788
return
(
m_qosEosp
== 1);
789
}
790
791
bool
792
WifiMacHeader::IsQosAmsdu
(
void
)
const
793
{
794
NS_ASSERT
(
IsQosData
());
795
return
(
m_amsduPresent
== 1);
796
}
797
798
uint8_t
799
WifiMacHeader::GetQosTid
(
void
)
const
800
{
801
NS_ASSERT
(
IsQosData
());
802
return
m_qosTid
;
803
}
804
805
uint16_t
806
WifiMacHeader::GetFrameControl
(
void
)
const
807
{
808
uint16_t val = 0;
809
val |= (
m_ctrlType
<< 2) & (0x3 << 2);
810
val |= (
m_ctrlSubtype
<< 4) & (0xf << 4);
811
val |= (
m_ctrlToDs
<< 8) & (0x1 << 8);
812
val |= (
m_ctrlFromDs
<< 9) & (0x1 << 9);
813
val |= (
m_ctrlMoreFrag
<< 10) & (0x1 << 10);
814
val |= (
m_ctrlRetry
<< 11) & (0x1 << 11);
815
val |= (
m_ctrlMoreData
<< 13) & (0x1 << 13);
816
val |= (
m_ctrlWep
<< 14) & (0x1 << 14);
817
val |= (
m_ctrlOrder
<< 15) & (0x1 << 15);
818
return
val;
819
}
820
821
uint16_t
822
WifiMacHeader::GetQosControl
(
void
)
const
823
{
824
uint16_t val = 0;
825
val |=
m_qosTid
;
826
val |=
m_qosEosp
<< 4;
827
val |=
m_qosAckPolicy
<< 5;
828
val |=
m_amsduPresent
<< 7;
829
val |=
m_qosStuff
<< 8;
830
return
val;
831
}
832
833
void
834
WifiMacHeader::SetFrameControl
(uint16_t ctrl)
835
{
836
m_ctrlType
= (ctrl >> 2) & 0x03;
837
m_ctrlSubtype
= (ctrl >> 4) & 0x0f;
838
m_ctrlToDs
= (ctrl >> 8) & 0x01;
839
m_ctrlFromDs
= (ctrl >> 9) & 0x01;
840
m_ctrlMoreFrag
= (ctrl >> 10) & 0x01;
841
m_ctrlRetry
= (ctrl >> 11) & 0x01;
842
m_ctrlMoreData
= (ctrl >> 13) & 0x01;
843
m_ctrlWep
= (ctrl >> 14) & 0x01;
844
m_ctrlOrder
= (ctrl >> 15) & 0x01;
845
}
846
void
847
WifiMacHeader::SetSequenceControl
(uint16_t seq)
848
{
849
m_seqFrag
= seq & 0x0f;
850
m_seqSeq
= (seq >> 4) & 0x0fff;
851
}
852
void
853
WifiMacHeader::SetQosControl
(uint16_t qos)
854
{
855
m_qosTid
= qos & 0x000f;
856
m_qosEosp
= (qos >> 4) & 0x0001;
857
m_qosAckPolicy
= (qos >> 5) & 0x0003;
858
m_amsduPresent
= (qos >> 7) & 0x0001;
859
m_qosStuff
= (qos >> 8) & 0x00ff;
860
}
861
862
uint32_t
863
WifiMacHeader::GetSize
(
void
)
const
864
{
865
uint32_t size = 0;
866
switch
(
m_ctrlType
)
867
{
868
case
TYPE_MGT
:
869
size = 2 + 2 + 6 + 6 + 6 + 2;
870
break
;
871
case
TYPE_CTL
:
872
switch
(
m_ctrlSubtype
)
873
{
874
case
SUBTYPE_CTL_RTS
:
875
case
SUBTYPE_CTL_BACKREQ
:
876
case
SUBTYPE_CTL_BACKRESP
:
877
case
SUBTYPE_CTL_END
:
878
case
SUBTYPE_CTL_END_ACK
:
879
size = 2 + 2 + 6 + 6;
880
break
;
881
case
SUBTYPE_CTL_CTS
:
882
case
SUBTYPE_CTL_ACK
:
883
size = 2 + 2 + 6;
884
break
;
885
case
SUBTYPE_CTL_CTLWRAPPER
:
886
size = 2 + 2 + 6 + 2 + 4;
887
break
;
888
}
889
break
;
890
case
TYPE_DATA
:
891
size = 2 + 2 + 6 + 6 + 6 + 2;
892
if
(
m_ctrlToDs
&&
m_ctrlFromDs
)
893
{
894
size += 6;
895
}
896
if
(
m_ctrlSubtype
& 0x08)
897
{
898
size += 2;
899
}
900
break
;
901
}
902
return
size;
903
}
904
905
const
char
*
906
WifiMacHeader::GetTypeString
(
void
)
const
907
{
908
#define FOO(x) \
909
case WIFI_MAC_ ## x: \
910
return # x; \
911
break;
912
913
switch
(
GetType
())
914
{
915
FOO
(CTL_RTS);
916
FOO
(CTL_CTS);
917
FOO
(CTL_ACK);
918
FOO
(CTL_BACKREQ);
919
FOO
(CTL_BACKRESP);
920
FOO
(CTL_END);
921
FOO
(CTL_END_ACK);
922
923
FOO
(MGT_BEACON);
924
FOO
(MGT_ASSOCIATION_REQUEST);
925
FOO
(MGT_ASSOCIATION_RESPONSE);
926
FOO
(MGT_DISASSOCIATION);
927
FOO
(MGT_REASSOCIATION_REQUEST);
928
FOO
(MGT_REASSOCIATION_RESPONSE);
929
FOO
(MGT_PROBE_REQUEST);
930
FOO
(MGT_PROBE_RESPONSE);
931
FOO
(MGT_AUTHENTICATION);
932
FOO
(MGT_DEAUTHENTICATION);
933
FOO
(MGT_ACTION);
934
FOO
(MGT_ACTION_NO_ACK);
935
FOO
(MGT_MULTIHOP_ACTION);
936
937
FOO
(
DATA
);
938
FOO
(DATA_CFACK);
939
FOO
(DATA_CFPOLL);
940
FOO
(DATA_CFACK_CFPOLL);
941
FOO
(DATA_NULL);
942
FOO
(DATA_NULL_CFACK);
943
FOO
(DATA_NULL_CFPOLL);
944
FOO
(DATA_NULL_CFACK_CFPOLL);
945
FOO
(QOSDATA);
946
FOO
(QOSDATA_CFACK);
947
FOO
(QOSDATA_CFPOLL);
948
FOO
(QOSDATA_CFACK_CFPOLL);
949
FOO
(QOSDATA_NULL);
950
FOO
(QOSDATA_NULL_CFPOLL);
951
FOO
(QOSDATA_NULL_CFACK_CFPOLL);
952
default
:
953
return
"ERROR"
;
954
}
955
#undef FOO
956
#ifndef _WIN32
957
// needed to make gcc 4.0.1 ppc darwin happy.
958
return
"BIG_ERROR"
;
959
#endif
960
}
961
962
TypeId
963
WifiMacHeader::GetTypeId
(
void
)
964
{
965
static
TypeId
tid =
TypeId
(
"ns3::WifiMacHeader"
)
966
.
SetParent
<
Header
> ()
967
.SetGroupName (
"Wifi"
)
968
.AddConstructor<
WifiMacHeader
> ()
969
;
970
return
tid;
971
}
972
973
TypeId
974
WifiMacHeader::GetInstanceTypeId
(
void
)
const
975
{
976
return
GetTypeId
();
977
}
978
979
void
980
WifiMacHeader::PrintFrameControl
(std::ostream &os)
const
981
{
982
os <<
"ToDS="
<< std::hex << (int)
m_ctrlToDs
<<
", FromDS="
<< std::hex << (
int
)
m_ctrlFromDs
983
<<
", MoreFrag="
<< std::hex << (int)
m_ctrlMoreFrag
<<
", Retry="
<< std::hex << (
int
)
m_ctrlRetry
984
<<
", MoreData="
<< std::hex << (int)
m_ctrlMoreData
<< std::dec
985
;
986
}
987
988
void
989
WifiMacHeader::Print
(std::ostream &os)
const
990
{
991
os <<
GetTypeString
() <<
" "
;
992
switch
(
GetType
())
993
{
994
case
WIFI_MAC_CTL_RTS
:
995
os <<
"Duration/ID="
<<
m_duration
<<
"us"
996
<<
", RA="
<<
m_addr1
<<
", TA="
<<
m_addr2
;
997
break
;
998
case
WIFI_MAC_CTL_CTS
:
999
case
WIFI_MAC_CTL_ACK
:
1000
os <<
"Duration/ID="
<<
m_duration
<<
"us"
1001
<<
", RA="
<<
m_addr1
;
1002
break
;
1003
case
WIFI_MAC_MGT_BEACON
:
1004
case
WIFI_MAC_MGT_ASSOCIATION_REQUEST
:
1005
case
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
:
1006
case
WIFI_MAC_MGT_DISASSOCIATION
:
1007
case
WIFI_MAC_MGT_REASSOCIATION_REQUEST
:
1008
case
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
:
1009
case
WIFI_MAC_MGT_PROBE_REQUEST
:
1010
case
WIFI_MAC_MGT_PROBE_RESPONSE
:
1011
case
WIFI_MAC_MGT_AUTHENTICATION
:
1012
case
WIFI_MAC_MGT_DEAUTHENTICATION
:
1013
PrintFrameControl
(os);
1014
os <<
" Duration/ID="
<<
m_duration
<<
"us"
1015
<<
", DA="
<<
m_addr1
<<
", SA="
<<
m_addr2
1016
<<
", BSSID="
<<
m_addr3
<<
", FragNumber="
<< std::hex << (int)
m_seqFrag
<< std::dec
1017
<<
", SeqNumber="
<<
m_seqSeq
;
1018
break
;
1019
case
WIFI_MAC_MGT_ACTION
:
1020
case
WIFI_MAC_MGT_ACTION_NO_ACK
:
1021
PrintFrameControl
(os);
1022
os <<
" Duration/ID="
<<
m_duration
<<
"us"
1023
<<
", DA="
<<
m_addr1
<<
", SA="
<<
m_addr2
<<
", BSSID="
<<
m_addr3
1024
<<
", FragNumber="
<< std::hex << (int)
m_seqFrag
<< std::dec <<
", SeqNumber="
<<
m_seqSeq
;
1025
break
;
1026
case
WIFI_MAC_MGT_MULTIHOP_ACTION
:
1027
os <<
" Duration/ID="
<<
m_duration
<<
"us"
1028
<<
", RA="
<<
m_addr1
<<
", TA="
<<
m_addr2
<<
", DA="
<<
m_addr3
1029
<<
", FragNumber="
<< std::hex << (int)
m_seqFrag
<< std::dec <<
", SeqNumber="
<<
m_seqSeq
;
1030
break
;
1031
case
WIFI_MAC_DATA
:
1032
PrintFrameControl
(os);
1033
os <<
" Duration/ID="
<<
m_duration
<<
"us"
;
1034
if
(!
m_ctrlToDs
&& !
m_ctrlFromDs
)
1035
{
1036
os <<
", DA="
<<
m_addr1
<<
", SA="
<<
m_addr2
<<
", BSSID="
<<
m_addr3
;
1037
}
1038
else
if
(!
m_ctrlToDs
&&
m_ctrlFromDs
)
1039
{
1040
os <<
", DA="
<<
m_addr1
<<
", SA="
<<
m_addr3
<<
", BSSID="
<<
m_addr2
;
1041
}
1042
else
if
(
m_ctrlToDs
&& !
m_ctrlFromDs
)
1043
{
1044
os <<
", DA="
<<
m_addr3
<<
", SA="
<<
m_addr2
<<
", BSSID="
<<
m_addr1
;
1045
}
1046
else
if
(
m_ctrlToDs
&&
m_ctrlFromDs
)
1047
{
1048
os <<
", DA="
<<
m_addr3
<<
", SA="
<<
m_addr4
<<
", RA="
<<
m_addr1
<<
", TA="
<<
m_addr2
;
1049
}
1050
else
1051
{
1052
NS_FATAL_ERROR
(
"Impossible ToDs and FromDs flags combination"
);
1053
}
1054
os <<
", FragNumber="
<< std::hex << (int)
m_seqFrag
<< std::dec
1055
<<
", SeqNumber="
<<
m_seqSeq
;
1056
break
;
1057
case
WIFI_MAC_CTL_BACKREQ
:
1058
case
WIFI_MAC_CTL_BACKRESP
:
1059
case
WIFI_MAC_CTL_CTLWRAPPER
:
1060
case
WIFI_MAC_CTL_END
:
1061
case
WIFI_MAC_CTL_END_ACK
:
1062
case
WIFI_MAC_DATA_CFACK
:
1063
case
WIFI_MAC_DATA_CFPOLL
:
1064
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
1065
case
WIFI_MAC_DATA_NULL
:
1066
case
WIFI_MAC_DATA_NULL_CFACK
:
1067
case
WIFI_MAC_DATA_NULL_CFPOLL
:
1068
case
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
:
1069
case
WIFI_MAC_QOSDATA
:
1070
case
WIFI_MAC_QOSDATA_CFACK
:
1071
case
WIFI_MAC_QOSDATA_CFPOLL
:
1072
case
WIFI_MAC_QOSDATA_CFACK_CFPOLL
:
1073
case
WIFI_MAC_QOSDATA_NULL
:
1074
case
WIFI_MAC_QOSDATA_NULL_CFPOLL
:
1075
case
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
:
1076
default
:
1077
break
;
1078
}
1079
}
1080
1081
uint32_t
1082
WifiMacHeader::GetSerializedSize
(
void
)
const
1083
{
1084
return
GetSize
();
1085
}
1086
1087
void
1088
WifiMacHeader::Serialize
(
Buffer::Iterator
i)
const
1089
{
1090
i.
WriteHtolsbU16
(
GetFrameControl
());
1091
i.
WriteHtolsbU16
(
m_duration
);
1092
WriteTo
(i,
m_addr1
);
1093
switch
(
m_ctrlType
)
1094
{
1095
case
TYPE_MGT
:
1096
WriteTo
(i,
m_addr2
);
1097
WriteTo
(i,
m_addr3
);
1098
i.
WriteHtolsbU16
(
GetSequenceControl
());
1099
break
;
1100
case
TYPE_CTL
:
1101
switch
(
m_ctrlSubtype
)
1102
{
1103
case
SUBTYPE_CTL_RTS
:
1104
case
SUBTYPE_CTL_BACKREQ
:
1105
case
SUBTYPE_CTL_BACKRESP
:
1106
case
SUBTYPE_CTL_END
:
1107
case
SUBTYPE_CTL_END_ACK
:
1108
WriteTo
(i,
m_addr2
);
1109
break
;
1110
case
SUBTYPE_CTL_CTS
:
1111
case
SUBTYPE_CTL_ACK
:
1112
break
;
1113
default
:
1114
//NOTREACHED
1115
NS_ASSERT
(
false
);
1116
break
;
1117
}
1118
break
;
1119
case
TYPE_DATA
:
1120
{
1121
WriteTo
(i,
m_addr2
);
1122
WriteTo
(i,
m_addr3
);
1123
i.
WriteHtolsbU16
(
GetSequenceControl
());
1124
if
(
m_ctrlToDs
&&
m_ctrlFromDs
)
1125
{
1126
WriteTo
(i,
m_addr4
);
1127
}
1128
if
(
m_ctrlSubtype
& 0x08)
1129
{
1130
i.
WriteHtolsbU16
(
GetQosControl
());
1131
}
1132
}
break
;
1133
default
:
1134
//NOTREACHED
1135
NS_ASSERT
(
false
);
1136
break
;
1137
}
1138
}
1139
1140
uint32_t
1141
WifiMacHeader::Deserialize
(
Buffer::Iterator
start
)
1142
{
1143
Buffer::Iterator
i =
start
;
1144
uint16_t frame_control = i.
ReadLsbtohU16
();
1145
SetFrameControl
(frame_control);
1146
m_duration
= i.
ReadLsbtohU16
();
1147
ReadFrom
(i,
m_addr1
);
1148
switch
(
m_ctrlType
)
1149
{
1150
case
TYPE_MGT
:
1151
ReadFrom
(i,
m_addr2
);
1152
ReadFrom
(i,
m_addr3
);
1153
SetSequenceControl
(i.
ReadLsbtohU16
());
1154
break
;
1155
case
TYPE_CTL
:
1156
switch
(
m_ctrlSubtype
)
1157
{
1158
case
SUBTYPE_CTL_RTS
:
1159
case
SUBTYPE_CTL_BACKREQ
:
1160
case
SUBTYPE_CTL_BACKRESP
:
1161
case
SUBTYPE_CTL_END
:
1162
case
SUBTYPE_CTL_END_ACK
:
1163
ReadFrom
(i,
m_addr2
);
1164
break
;
1165
case
SUBTYPE_CTL_CTS
:
1166
case
SUBTYPE_CTL_ACK
:
1167
break
;
1168
}
1169
break
;
1170
case
TYPE_DATA
:
1171
ReadFrom
(i,
m_addr2
);
1172
ReadFrom
(i,
m_addr3
);
1173
SetSequenceControl
(i.
ReadLsbtohU16
());
1174
if
(
m_ctrlToDs
&&
m_ctrlFromDs
)
1175
{
1176
ReadFrom
(i,
m_addr4
);
1177
}
1178
if
(
m_ctrlSubtype
& 0x08)
1179
{
1180
SetQosControl
(i.
ReadLsbtohU16
());
1181
}
1182
break
;
1183
}
1184
return
i.
GetDistanceFrom
(
start
);
1185
}
1186
1187
}
//namespace ns3
ns3::WifiMacHeader::m_ctrlMoreData
uint8_t m_ctrlMoreData
control more data
Definition:
wifi-mac-header.h:607
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:42
ns3::DATA
Definition:
ul-job.h:39
ns3::WIFI_MAC_QOSDATA_CFACK_CFPOLL
Definition:
wifi-mac-header.h:72
ns3::WIFI_MAC_CTL_CTS
Definition:
wifi-mac-header.h:40
ns3::WifiMacHeader::IsRetry
bool IsRetry(void) const
Return if the Retry bit is set.
Definition:
wifi-mac-header.cc:752
ns3::WifiMacHeader::SetRetry
void SetRetry(void)
Set the Retry bit in the Frame Control field.
Definition:
wifi-mac-header.cc:320
ns3::WifiMacHeader::IsCfEnd
bool IsCfEnd(void) const
Return true if the header is a CF-END header.
Definition:
wifi-mac-header.cc:571
ns3::WifiMacHeader::IsDisassociation
bool IsDisassociation(void) const
Return true if the header is a Disassociation header.
Definition:
wifi-mac-header.cc:680
ns3::WifiMacHeader::SetMoreFragments
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
Definition:
wifi-mac-header.cc:305
ns3::WIFI_MAC_CTL_CTLWRAPPER
Definition:
wifi-mac-header.h:38
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::WIFI_MAC_QOSDATA_NULL
Definition:
wifi-mac-header.h:73
ns3::WIFI_MAC_MGT_PROBE_REQUEST
Definition:
wifi-mac-header.h:53
ns3::WifiMacHeader::GetFrameControl
uint16_t GetFrameControl(void) const
Return the raw Frame Control field.
Definition:
wifi-mac-header.cc:806
ns3::WifiMacHeader::SetRawDuration
void SetRawDuration(uint16_t duration)
Set the Duration/ID field with the given raw uint16_t value.
Definition:
wifi-mac-header.cc:271
ns3::WifiMacHeader::SetFrameControl
void SetFrameControl(uint16_t control)
Set the Frame Control field with the given raw value.
Definition:
wifi-mac-header.cc:834
ns3::WIFI_MAC_DATA_NULL_CFACK
Definition:
wifi-mac-header.h:66
ns3::WIFI_MAC_MGT_ACTION_NO_ACK
Definition:
wifi-mac-header.h:58
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::WifiMacHeader::SetDuration
void SetDuration(Time duration)
Set the Duration/ID field with the given duration (Time object).
Definition:
wifi-mac-header.cc:278
ns3::WifiMacHeader::IsCtl
bool IsCtl(void) const
Return true if the Type is Control.
Definition:
wifi-mac-header.cc:540
ns3::WIFI_MAC_DATA_CFACK_CFPOLL
Definition:
wifi-mac-header.h:64
ns3::WifiMacHeader::m_ctrlType
uint8_t m_ctrlType
control type
Definition:
wifi-mac-header.h:601
ns3::WIFI_MAC_MGT_ASSOCIATION_REQUEST
Definition:
wifi-mac-header.h:48
ns3::WIFI_MAC_MGT_AUTHENTICATION
Definition:
wifi-mac-header.h:55
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition:
address-utils.cc:70
visualizer.core.start
def start()
Definition:
core.py:1844
ns3::WifiMacHeader::m_addr2
Mac48Address m_addr2
address 2
Definition:
wifi-mac-header.h:612
ns3::WifiMacHeader::GetSize
uint32_t GetSize(void) const
Return the size of the WifiMacHeader in octets.
Definition:
wifi-mac-header.cc:863
ns3::WifiMacHeader::SetNoMoreFragments
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
Definition:
wifi-mac-header.cc:300
ns3::WifiMacHeader::m_qosAckPolicy
uint8_t m_qosAckPolicy
QOS ack policy.
Definition:
wifi-mac-header.h:619
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition:
wifi-mac-header.cc:395
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::WifiMacHeader::IsQosEosp
bool IsQosEosp(void) const
Return if the end of service period (EOSP) is set.
Definition:
wifi-mac-header.cc:785
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition:
address-utils.cc:28
ns3::WifiMacHeader::m_qosEosp
uint8_t m_qosEosp
QOS EOSP.
Definition:
wifi-mac-header.h:618
ns3::WifiMacHeader::Print
void Print(std::ostream &os) const
Definition:
wifi-mac-header.cc:989
ns3::WifiMacHeader::SetId
void SetId(uint16_t id)
Set the Duration/ID field with the given ID.
Definition:
wifi-mac-header.cc:285
ns3::TYPE_DATA
Definition:
wifi-mac-header.cc:36
ns3::WIFI_MAC_QOSDATA_NULL_CFPOLL
Definition:
wifi-mac-header.h:74
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition:
fatal-error.h:162
ns3::WifiMacHeader::GetType
WifiMacType GetType(void) const
Return the type (enum WifiMacType)
Definition:
wifi-mac-header.cc:419
ns3::SUBTYPE_CTL_CTS
Definition:
wifi-mac-header.cc:47
ns3::WifiMacHeader::SetQosControl
void SetQosControl(uint16_t qos)
Set the QoS Control field with the given raw value.
Definition:
wifi-mac-header.cc:853
ns3::WifiMacHeader::GetTypeString
const char * GetTypeString(void) const
Return a string corresponds to the header type.
Definition:
wifi-mac-header.cc:906
ns3::WifiMacHeader::IsCfPoll
bool IsCfPoll(void) const
Return true if the Type/Subtype is one of the possible CF-Poll headers.
Definition:
wifi-mac-header.cc:552
ns3::WifiMacHeader::m_seqFrag
uint8_t m_seqFrag
sequence fragment
Definition:
wifi-mac-header.h:614
ns3::WifiMacHeader::m_addr1
Mac48Address m_addr1
address 1
Definition:
wifi-mac-header.h:611
ns3::WifiMacHeader::m_addr3
Mac48Address m_addr3
address 3
Definition:
wifi-mac-header.h:613
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::WIFI_MAC_DATA_CFACK
Definition:
wifi-mac-header.h:62
ns3::WifiMacHeader::IsBlockAck
bool IsBlockAck(void) const
Return true if the header is a Block ACK header.
Definition:
wifi-mac-header.cc:716
ns3::WIFI_MAC_DATA_NULL
Definition:
wifi-mac-header.h:65
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(Iterator const &o) const
Definition:
buffer.cc:783
ns3::SUBTYPE_CTL_ACK
Definition:
wifi-mac-header.cc:48
ns3::WifiMacHeader::IsBlockAckReq
bool IsBlockAckReq(void) const
Return true if the header is a Block ACK Request header.
Definition:
wifi-mac-header.cc:710
ns3::WIFI_MAC_MGT_REASSOCIATION_REQUEST
Definition:
wifi-mac-header.h:51
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition:
wifi-mac-header.cc:90
ns3::WifiMacHeader::m_ctrlToDs
uint8_t m_ctrlToDs
control to DS
Definition:
wifi-mac-header.h:603
ns3::WifiMacHeader::IsQosNoAck
bool IsQosNoAck(void) const
Return if the QoS ACK policy is No ACK.
Definition:
wifi-mac-header.cc:771
ns3::WifiMacHeader::SetDsNotTo
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
Definition:
wifi-mac-header.cc:84
ns3::WifiMacHeader::IsQosAmsdu
bool IsQosAmsdu(void) const
Check if the A-MSDU present bit is set in the QoS control field.
Definition:
wifi-mac-header.cc:792
ns3::WifiMacHeader::SetAddr3
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
Definition:
wifi-mac-header.cc:102
ns3::WifiMacHeader::IsBeacon
bool IsBeacon(void) const
Return true if the header is a Beacon header.
Definition:
wifi-mac-header.cc:674
ns3::WifiMacHeader::SetAddr4
void SetAddr4(Mac48Address address)
Fill the Address 4 field with the given address.
Definition:
wifi-mac-header.cc:108
ns3::WifiMacType
WifiMacType
Combination of valid MAC header type/subtype.
Definition:
wifi-mac-header.h:36
ns3::WIFI_MAC_MGT_MULTIHOP_ACTION
Definition:
wifi-mac-header.h:59
ns3::WifiMacHeader::IsMultihopAction
bool IsMultihopAction() const
Check if the header is a Multihop action header.
Definition:
wifi-mac-header.cc:704
ns3::WifiMacHeader::SetOrder
void SetOrder(void)
Set order bit in the frame control field.
Definition:
wifi-mac-header.cc:310
ns3::WIFI_MAC_CTL_END
Definition:
wifi-mac-header.h:44
ns3::WifiMacHeader::IsFromDs
bool IsFromDs(void) const
Definition:
wifi-mac-header.cc:515
ns3::WifiMacHeader::GetAddr3
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
Definition:
wifi-mac-header.cc:407
wifi-mac-header.h
ns3::WifiMacHeader::GetQosTid
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Definition:
wifi-mac-header.cc:799
ns3::WifiMacHeader::IsCts
bool IsCts(void) const
Return true if the header is a CTS header.
Definition:
wifi-mac-header.cc:626
ns3::WifiMacHeader::NORMAL_ACK
Definition:
wifi-mac-header.h:91
ns3::TYPE_MGT
Definition:
wifi-mac-header.cc:34
ns3::WifiMacHeader::Serialize
void Serialize(Buffer::Iterator start) const
Definition:
wifi-mac-header.cc:1088
ns3::WifiMacHeader::m_amsduPresent
uint8_t m_amsduPresent
AMSDU present.
Definition:
wifi-mac-header.h:620
ns3::WifiMacHeader::m_addr4
Mac48Address m_addr4
address 4
Definition:
wifi-mac-header.h:616
ns3::WifiMacHeader::m_ctrlMoreFrag
uint8_t m_ctrlMoreFrag
control more fragments
Definition:
wifi-mac-header.h:605
ns3::WifiMacHeader::NO_ACK
Definition:
wifi-mac-header.h:92
ns3::WifiMacHeader::m_ctrlFromDs
uint8_t m_ctrlFromDs
control from DS
Definition:
wifi-mac-header.h:604
ns3::WifiMacHeader::IsAssocResp
bool IsAssocResp(void) const
Return true if the header is an Association Response header.
Definition:
wifi-mac-header.cc:644
ns3::WifiMacHeader::IsQosAck
bool IsQosAck(void) const
Return if the QoS ACK policy is Normal ACK.
Definition:
wifi-mac-header.cc:778
ns3::WifiMacHeader::IsAssocReq
bool IsAssocReq(void) const
Return true if the header is an Association Request header.
Definition:
wifi-mac-header.cc:638
ns3::WifiMacHeader::GetAddr2
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
Definition:
wifi-mac-header.cc:401
ns3::WifiMacHeader::m_ctrlOrder
uint8_t m_ctrlOrder
control order (set to 1 for QoS Data and Management frames to signify that HT/VHT/HE control field is...
Definition:
wifi-mac-header.h:609
ns3::WifiMacHeader::SetQosTid
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Definition:
wifi-mac-header.cc:330
ns3::WifiMacHeader::GetAddr4
Mac48Address GetAddr4(void) const
Return the address in the Address 4 field.
Definition:
wifi-mac-header.cc:413
ns3::WifiMacHeader::SetSequenceControl
void SetSequenceControl(uint16_t seq)
Set the Sequence Control field with the given raw value.
Definition:
wifi-mac-header.cc:847
ns3::WifiMacHeader::IsCfAck
bool IsCfAck(void) const
Return true if the header is a CF-ACK header.
Definition:
wifi-mac-header.cc:584
ns3::WifiMacHeader::SetNoRetry
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
Definition:
wifi-mac-header.cc:325
ns3::WIFI_MAC_CTL_END_ACK
Definition:
wifi-mac-header.h:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiMacHeader::GetSequenceNumber
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
Definition:
wifi-mac-header.cc:740
ns3::WifiMacHeader::IsData
bool IsData(void) const
Return true if the Type is DATA.
Definition:
wifi-mac-header.cc:527
ns3::Time::GetNanoSeconds
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition:
nstime.h:367
first.address
address
Definition:
first.py:37
ns3::WifiMacHeader::m_seqSeq
uint16_t m_seqSeq
sequence sequence
Definition:
wifi-mac-header.h:615
ns3::WifiMacHeader::m_qosStuff
uint8_t m_qosStuff
QOS stuff.
Definition:
wifi-mac-header.h:621
ns3::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition:
wifi-mac-header.cc:96
ns3::WifiMacHeader::GetDuration
Time GetDuration(void) const
Return the duration from the Duration/ID field (Time object).
Definition:
wifi-mac-header.cc:728
ns3::WIFI_MAC_MGT_DISASSOCIATION
Definition:
wifi-mac-header.h:50
ns3::WIFI_MAC_MGT_PROBE_RESPONSE
Definition:
wifi-mac-header.h:54
ns3::SUBTYPE_CTL_BACKREQ
Definition:
wifi-mac-header.cc:44
ns3::WifiMacHeader::IsProbeReq
bool IsProbeReq(void) const
Return true if the header is a Probe Request header.
Definition:
wifi-mac-header.cc:662
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:43
ns3::SUBTYPE_CTL_END_ACK
Definition:
wifi-mac-header.cc:50
ns3::WIFI_MAC_DATA
Definition:
wifi-mac-header.h:61
ns3::WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
Definition:
wifi-mac-header.h:75
ns3::WifiMacHeader::GetInstanceTypeId
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
wifi-mac-header.cc:974
ns3::SUBTYPE_CTL_END
Definition:
wifi-mac-header.cc:49
ns3::WifiMacHeader::QosAckPolicy
QosAckPolicy
ACK policy for QoS frames.
Definition:
wifi-mac-header.h:89
ns3::WIFI_MAC_DATA_NULL_CFPOLL
Definition:
wifi-mac-header.h:67
FOO
#define FOO(x)
ns3::Buffer::Iterator::WriteHtolsbU16
void WriteHtolsbU16(uint16_t data)
Definition:
buffer.cc:910
ns3::WifiMacHeader::IsMoreFragments
bool IsMoreFragments(void) const
Return if the More Fragment bit is set.
Definition:
wifi-mac-header.cc:758
ns3::WifiMacHeader::WifiMacHeader
WifiMacHeader()
Definition:
wifi-mac-header.cc:53
ns3::WifiMacHeader::m_duration
uint16_t m_duration
duration
Definition:
wifi-mac-header.h:610
ns3::WifiMacHeader::GetRawDuration
uint16_t GetRawDuration(void) const
Return the raw duration from the Duration/ID field.
Definition:
wifi-mac-header.cc:722
ns3::WifiMacHeader::SetType
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition:
wifi-mac-header.cc:114
ns3::WifiMacHeader::m_ctrlRetry
uint8_t m_ctrlRetry
control retry
Definition:
wifi-mac-header.h:606
ns3::WifiMacHeader::IsQosBlockAck
bool IsQosBlockAck(void) const
Return if the QoS ACK policy is Block ACK.
Definition:
wifi-mac-header.cc:764
ns3::WifiMacHeader::GetQosControl
uint16_t GetQosControl(void) const
Return the raw QoS Control field.
Definition:
wifi-mac-header.cc:822
ns3::WIFI_MAC_QOSDATA_CFPOLL
Definition:
wifi-mac-header.h:71
ns3::WifiMacHeader::IsDeauthentication
bool IsDeauthentication(void) const
Return true if the header is a Deauthentication header.
Definition:
wifi-mac-header.cc:692
ns3::WifiMacHeader::SetQosTxopLimit
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
Definition:
wifi-mac-header.cc:374
ns3::WifiMacHeader::IsMgt
bool IsMgt(void) const
Return true if the Type is Management.
Definition:
wifi-mac-header.cc:546
ns3::WifiMacHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
Definition:
wifi-mac-header.cc:290
ns3::WIFI_MAC_DATA_NULL_CFACK_CFPOLL
Definition:
wifi-mac-header.h:68
ns3::WifiMacHeader::IsProbeResp
bool IsProbeResp(void) const
Return true if the header is a Probe Response header.
Definition:
wifi-mac-header.cc:668
ns3::WIFI_MAC_QOSDATA
Definition:
wifi-mac-header.h:69
ns3::WifiMacHeader::GetSerializedSize
uint32_t GetSerializedSize(void) const
Definition:
wifi-mac-header.cc:1082
ns3::WIFI_MAC_CTL_BACKREQ
Definition:
wifi-mac-header.h:42
ns3::WifiMacHeader::SetQosNoAmsdu
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
Definition:
wifi-mac-header.cc:369
ns3::WifiMacHeader::IsReassocReq
bool IsReassocReq(void) const
Return true if the header is a Reassociation Request header.
Definition:
wifi-mac-header.cc:650
ns3::WIFI_MAC_MGT_BEACON
Definition:
wifi-mac-header.h:47
ns3::WIFI_MAC_MGT_REASSOCIATION_RESPONSE
Definition:
wifi-mac-header.h:52
ns3::WifiMacHeader::SetDsTo
void SetDsTo(void)
Set the To DS bit in the Frame Control field.
Definition:
wifi-mac-header.cc:78
ns3::WifiMacHeader::SetQosEosp
void SetQosEosp()
Set the end of service period (EOSP) bit in the QoS control field.
Definition:
wifi-mac-header.cc:335
ns3::WifiMacHeader::IsRts
bool IsRts(void) const
Return true if the header is a RTS header.
Definition:
wifi-mac-header.cc:620
ns3::WifiMacHeader::~WifiMacHeader
virtual ~WifiMacHeader()
Definition:
wifi-mac-header.cc:61
ns3::WifiMacHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start)
Definition:
wifi-mac-header.cc:1141
ns3::WifiMacHeader::SetDsFrom
void SetDsFrom(void)
Set the From DS bit in the Frame Control field.
Definition:
wifi-mac-header.cc:66
ns3::WifiMacHeader::SetNoOrder
void SetNoOrder(void)
Unset order bit in the frame control field.
Definition:
wifi-mac-header.cc:315
ns3::WifiMacHeader::IsQosData
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
Definition:
wifi-mac-header.cc:534
ns3::Buffer::Iterator::ReadLsbtohU16
uint16_t ReadLsbtohU16(void)
Definition:
buffer.cc:1065
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1030
ns3::WIFI_MAC_CTL_BACKRESP
Definition:
wifi-mac-header.h:43
ns3::WifiMacHeader::IsAck
bool IsAck(void) const
Return true if the header is an ACK header.
Definition:
wifi-mac-header.cc:632
ns3::WifiMacHeader::IsAction
bool IsAction() const
Return true if the header is an Action header.
Definition:
wifi-mac-header.cc:698
ns3::WIFI_MAC_MGT_ASSOCIATION_RESPONSE
Definition:
wifi-mac-header.h:49
ns3::TYPE_CTL
Definition:
wifi-mac-header.cc:35
ns3::WIFI_MAC_CTL_ACK
Definition:
wifi-mac-header.h:41
ns3::WIFI_MAC_CTL_RTS
Definition:
wifi-mac-header.h:39
ns3::WifiMacHeader::m_qosTid
uint8_t m_qosTid
QOS TID.
Definition:
wifi-mac-header.h:617
ns3::WifiMacHeader::SetQosMeshControlPresent
void SetQosMeshControlPresent()
Set the Mesh Control Present flag for the QoS header.
Definition:
wifi-mac-header.cc:379
ns3::WifiMacHeader::SetQosNoMeshControlPresent
void SetQosNoMeshControlPresent()
Clear the Mesh Control Present flag for the QoS header.
Definition:
wifi-mac-header.cc:386
ns3::WifiMacHeader::m_ctrlSubtype
uint8_t m_ctrlSubtype
control subtype
Definition:
wifi-mac-header.h:602
ns3::WIFI_MAC_MGT_ACTION
Definition:
wifi-mac-header.h:57
ns3::SUBTYPE_CTL_BACKRESP
Definition:
wifi-mac-header.cc:45
ns3::WifiMacHeader::SetQosNoEosp
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
Definition:
wifi-mac-header.cc:340
ns3::WifiMacHeader::GetFragmentNumber
uint8_t GetFragmentNumber(void) const
Return the fragment number of the header.
Definition:
wifi-mac-header.cc:746
ns3::WifiMacHeader::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
wifi-mac-header.cc:963
ns3::WifiMacHeader::NO_EXPLICIT_ACK
Definition:
wifi-mac-header.h:93
ns3::WifiMacHeader::IsAuthentication
bool IsAuthentication(void) const
Return true if the header is an Authentication header.
Definition:
wifi-mac-header.cc:686
ns3::WifiMacHeader::SetFragmentNumber
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
Definition:
wifi-mac-header.cc:295
ns3::WIFI_MAC_DATA_CFPOLL
Definition:
wifi-mac-header.h:63
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::WifiMacHeader::SetQosAmsdu
void SetQosAmsdu(void)
Set that A-MSDU is present.
Definition:
wifi-mac-header.cc:364
ns3::WifiMacHeader::PrintFrameControl
void PrintFrameControl(std::ostream &os) const
Print the Frame Control field to the output stream.
Definition:
wifi-mac-header.cc:980
ns3::WifiMacHeader::BLOCK_ACK
Definition:
wifi-mac-header.h:94
ns3::WIFI_MAC_MGT_DEAUTHENTICATION
Definition:
wifi-mac-header.h:56
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition:
wifi-mac-header.h:83
ns3::WifiMacHeader::IsToDs
bool IsToDs(void) const
Definition:
wifi-mac-header.cc:521
ns3::WifiMacHeader::m_ctrlWep
uint8_t m_ctrlWep
control WEP
Definition:
wifi-mac-header.h:608
ns3::WifiMacHeader::IsReassocResp
bool IsReassocResp(void) const
Return true if the header is a Reassociation Response header.
Definition:
wifi-mac-header.cc:656
ns3::WifiMacHeader::HasData
bool HasData(void) const
Return true if the header type is DATA and is not DATA_NULL.
Definition:
wifi-mac-header.cc:601
ns3::SUBTYPE_CTL_CTLWRAPPER
Definition:
wifi-mac-header.cc:43
ns3::WifiMacHeader::GetSequenceControl
uint16_t GetSequenceControl(void) const
Return the raw Sequence Control field.
Definition:
wifi-mac-header.cc:734
ns3::WifiMacHeader::SetDsNotFrom
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
Definition:
wifi-mac-header.cc:72
ns3::WIFI_MAC_QOSDATA_CFACK
Definition:
wifi-mac-header.h:70
ns3::SUBTYPE_CTL_RTS
Definition:
wifi-mac-header.cc:46
ns3::WifiMacHeader::SetQosAckPolicy
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.
Definition:
wifi-mac-header.cc:345
Generated on Wed Nov 7 2018 10:02:15 for ns-3 by
1.8.14