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