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