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