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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
31
enum
32
{
33
TYPE_MGT
= 0,
34
TYPE_CTL
= 1,
35
TYPE_DATA
= 2
36
};
37
38
enum
39
{
40
SUBTYPE_CTL_BACKREQ
= 8,
41
SUBTYPE_CTL_BACKRESP
= 9,
42
SUBTYPE_CTL_RTS
= 11,
43
SUBTYPE_CTL_CTS
= 12,
44
SUBTYPE_CTL_ACK
= 13,
45
SUBTYPE_CTL_CTLWRAPPER
=7
46
47
};
48
49
WifiMacHeader::WifiMacHeader
()
50
:
51
m_ctrlMoreData (0),
52
m_ctrlWep (0),
53
m_ctrlOrder (1),
54
m_amsduPresent (0)
55
{
56
}
57
WifiMacHeader::~WifiMacHeader
()
58
{
59
}
60
61
void
62
WifiMacHeader::SetDsFrom
(
void
)
63
{
64
m_ctrlFromDs
= 1;
65
}
66
void
67
WifiMacHeader::SetDsNotFrom
(
void
)
68
{
69
m_ctrlFromDs
= 0;
70
}
71
void
72
WifiMacHeader::SetDsTo
(
void
)
73
{
74
m_ctrlToDs
= 1;
75
}
76
void
77
WifiMacHeader::SetDsNotTo
(
void
)
78
{
79
m_ctrlToDs
= 0;
80
}
81
82
void
83
WifiMacHeader::SetAddr1
(
Mac48Address
address
)
84
{
85
m_addr1
=
address
;
86
}
87
void
88
WifiMacHeader::SetAddr2
(
Mac48Address
address
)
89
{
90
m_addr2
=
address
;
91
}
92
void
93
WifiMacHeader::SetAddr3
(
Mac48Address
address
)
94
{
95
m_addr3
=
address
;
96
}
97
void
98
WifiMacHeader::SetAddr4
(
Mac48Address
address
)
99
{
100
m_addr4
=
address
;
101
}
102
void
103
WifiMacHeader::SetAssocReq
(
void
)
104
{
105
m_ctrlType
=
TYPE_MGT
;
106
m_ctrlSubtype
= 0;
107
}
108
void
109
WifiMacHeader::SetAssocResp
(
void
)
110
{
111
m_ctrlType
=
TYPE_MGT
;
112
m_ctrlSubtype
= 1;
113
}
114
void
115
WifiMacHeader::SetProbeReq
(
void
)
116
{
117
m_ctrlType
=
TYPE_MGT
;
118
m_ctrlSubtype
= 4;
119
}
120
void
121
WifiMacHeader::SetProbeResp
(
void
)
122
{
123
m_ctrlType
=
TYPE_MGT
;
124
m_ctrlSubtype
= 5;
125
}
126
void
127
WifiMacHeader::SetBeacon
(
void
)
128
{
129
m_ctrlType
=
TYPE_MGT
;
130
m_ctrlSubtype
= 8;
131
}
132
void
133
WifiMacHeader::SetBlockAckReq
(
void
)
134
{
135
m_ctrlType
=
TYPE_CTL
;
136
m_ctrlSubtype
= 8;
137
}
138
void
139
WifiMacHeader::SetBlockAck
(
void
)
140
{
141
m_ctrlType
=
TYPE_CTL
;
142
m_ctrlSubtype
= 9;
143
}
144
145
void
146
WifiMacHeader::SetTypeData
(
void
)
147
{
148
m_ctrlType
=
TYPE_DATA
;
149
m_ctrlSubtype
= 0;
150
}
151
void
152
WifiMacHeader::SetAction
(
void
)
153
{
154
m_ctrlType
=
TYPE_MGT
;
155
m_ctrlSubtype
= 0x0D;
156
}
157
void
158
WifiMacHeader::SetMultihopAction
(
void
)
159
{
160
m_ctrlType
=
TYPE_MGT
;
161
m_ctrlSubtype
= 0x0F;
162
}
163
void
164
WifiMacHeader::SetType
(
enum
WifiMacType
type)
165
{
166
switch
(type)
167
{
168
case
WIFI_MAC_CTL_BACKREQ
:
169
m_ctrlType
=
TYPE_CTL
;
170
m_ctrlSubtype
=
SUBTYPE_CTL_BACKREQ
;
171
break
;
172
case
WIFI_MAC_CTL_BACKRESP
:
173
m_ctrlType
=
TYPE_CTL
;
174
m_ctrlSubtype
=
SUBTYPE_CTL_BACKRESP
;
175
break
;
176
case
WIFI_MAC_CTL_RTS
:
177
m_ctrlType
=
TYPE_CTL
;
178
m_ctrlSubtype
=
SUBTYPE_CTL_RTS
;
179
break
;
180
case
WIFI_MAC_CTL_CTS
:
181
m_ctrlType
=
TYPE_CTL
;
182
m_ctrlSubtype
=
SUBTYPE_CTL_CTS
;
183
break
;
184
case
WIFI_MAC_CTL_ACK
:
185
m_ctrlType
=
TYPE_CTL
;
186
m_ctrlSubtype
=
SUBTYPE_CTL_ACK
;
187
break
;
188
case
WIFI_MAC_CTL_CTLWRAPPER
:
189
m_ctrlType
=
TYPE_CTL
;
190
m_ctrlSubtype
=
SUBTYPE_CTL_CTLWRAPPER
;
191
break
;
192
case
WIFI_MAC_MGT_ASSOCIATION_REQUEST
:
193
m_ctrlType
=
TYPE_MGT
;
194
m_ctrlSubtype
= 0;
195
break
;
196
case
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
:
197
m_ctrlType
=
TYPE_MGT
;
198
m_ctrlSubtype
= 1;
199
break
;
200
case
WIFI_MAC_MGT_REASSOCIATION_REQUEST
:
201
m_ctrlType
=
TYPE_MGT
;
202
m_ctrlSubtype
= 2;
203
break
;
204
case
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
:
205
m_ctrlType
=
TYPE_MGT
;
206
m_ctrlSubtype
= 3;
207
break
;
208
case
WIFI_MAC_MGT_PROBE_REQUEST
:
209
m_ctrlType
=
TYPE_MGT
;
210
m_ctrlSubtype
= 4;
211
break
;
212
case
WIFI_MAC_MGT_PROBE_RESPONSE
:
213
m_ctrlType
=
TYPE_MGT
;
214
m_ctrlSubtype
= 5;
215
break
;
216
case
WIFI_MAC_MGT_BEACON
:
217
m_ctrlType
=
TYPE_MGT
;
218
m_ctrlSubtype
= 8;
219
break
;
220
case
WIFI_MAC_MGT_DISASSOCIATION
:
221
m_ctrlType
=
TYPE_MGT
;
222
m_ctrlSubtype
= 10;
223
break
;
224
case
WIFI_MAC_MGT_AUTHENTICATION
:
225
m_ctrlType
=
TYPE_MGT
;
226
m_ctrlSubtype
= 11;
227
break
;
228
case
WIFI_MAC_MGT_DEAUTHENTICATION
:
229
m_ctrlType
=
TYPE_MGT
;
230
m_ctrlSubtype
= 12;
231
break
;
232
case
WIFI_MAC_MGT_ACTION
:
233
m_ctrlType
=
TYPE_MGT
;
234
m_ctrlSubtype
= 13;
235
break
;
236
case
WIFI_MAC_MGT_ACTION_NO_ACK
:
237
m_ctrlType
=
TYPE_MGT
;
238
m_ctrlSubtype
= 14;
239
break
;
240
case
WIFI_MAC_MGT_MULTIHOP_ACTION
:
241
m_ctrlType
=
TYPE_MGT
;
242
m_ctrlSubtype
= 15;
243
break
;
244
245
case
WIFI_MAC_DATA
:
246
m_ctrlType
=
TYPE_DATA
;
247
m_ctrlSubtype
= 0;
248
break
;
249
case
WIFI_MAC_DATA_CFACK
:
250
m_ctrlType
=
TYPE_DATA
;
251
m_ctrlSubtype
= 1;
252
break
;
253
case
WIFI_MAC_DATA_CFPOLL
:
254
m_ctrlType
=
TYPE_DATA
;
255
m_ctrlSubtype
= 2;
256
break
;
257
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
258
m_ctrlType
=
TYPE_DATA
;
259
m_ctrlSubtype
= 3;
260
break
;
261
case
WIFI_MAC_DATA_NULL
:
262
m_ctrlType
=
TYPE_DATA
;
263
m_ctrlSubtype
= 4;
264
break
;
265
case
WIFI_MAC_DATA_NULL_CFACK
:
266
m_ctrlType
=
TYPE_DATA
;
267
m_ctrlSubtype
= 5;
268
break
;
269
case
WIFI_MAC_DATA_NULL_CFPOLL
:
270
m_ctrlType
=
TYPE_DATA
;
271
m_ctrlSubtype
= 6;
272
break
;
273
case
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
:
274
m_ctrlType
=
TYPE_DATA
;
275
m_ctrlSubtype
= 7;
276
break
;
277
case
WIFI_MAC_QOSDATA
:
278
m_ctrlType
=
TYPE_DATA
;
279
m_ctrlSubtype
= 8;
280
break
;
281
case
WIFI_MAC_QOSDATA_CFACK
:
282
m_ctrlType
=
TYPE_DATA
;
283
m_ctrlSubtype
= 9;
284
break
;
285
case
WIFI_MAC_QOSDATA_CFPOLL
:
286
m_ctrlType
=
TYPE_DATA
;
287
m_ctrlSubtype
= 10;
288
break
;
289
case
WIFI_MAC_QOSDATA_CFACK_CFPOLL
:
290
m_ctrlType
=
TYPE_DATA
;
291
m_ctrlSubtype
= 11;
292
break
;
293
case
WIFI_MAC_QOSDATA_NULL
:
294
m_ctrlType
=
TYPE_DATA
;
295
m_ctrlSubtype
= 12;
296
break
;
297
case
WIFI_MAC_QOSDATA_NULL_CFPOLL
:
298
m_ctrlType
=
TYPE_DATA
;
299
m_ctrlSubtype
= 14;
300
break
;
301
case
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
:
302
m_ctrlType
=
TYPE_DATA
;
303
m_ctrlSubtype
= 15;
304
break
;
305
}
306
m_ctrlToDs
= 0;
307
m_ctrlFromDs
= 0;
308
}
309
void
310
WifiMacHeader::SetRawDuration
(uint16_t duration)
311
{
312
m_duration
= duration;
313
}
314
void
315
WifiMacHeader::SetDuration
(
Time
duration)
316
{
317
int64_t duration_us = duration.
GetMicroSeconds
();
318
NS_ASSERT
(duration_us >= 0 && duration_us <= 0x7fff);
319
m_duration
=
static_cast<
uint16_t
>
(duration_us);
320
}
321
322
void
WifiMacHeader::SetId
(uint16_t
id
)
323
{
324
m_duration
= id;
325
}
326
void
WifiMacHeader::SetSequenceNumber
(uint16_t seq)
327
{
328
m_seqSeq
= seq;
329
}
330
void
WifiMacHeader::SetFragmentNumber
(uint8_t frag)
331
{
332
m_seqFrag
= frag;
333
}
334
void
WifiMacHeader::SetNoMoreFragments
(
void
)
335
{
336
m_ctrlMoreFrag
= 0;
337
}
338
void
WifiMacHeader::SetMoreFragments
(
void
)
339
{
340
m_ctrlMoreFrag
= 1;
341
}
342
void
WifiMacHeader::SetOrder
(
void
)
343
{
344
m_ctrlOrder
= 1;
345
}
346
void
WifiMacHeader::SetNoOrder
(
void
)
347
{
348
m_ctrlOrder
= 0;
349
}
350
void
WifiMacHeader::SetRetry
(
void
)
351
{
352
m_ctrlRetry
= 1;
353
}
354
void
WifiMacHeader::SetNoRetry
(
void
)
355
{
356
m_ctrlRetry
= 0;
357
}
358
void
WifiMacHeader::SetQosTid
(uint8_t tid)
359
{
360
m_qosTid
= tid;
361
}
362
void
WifiMacHeader::SetQosEosp
()
363
{
364
m_qosEosp
= 1;
365
}
366
void
WifiMacHeader::SetQosNoEosp
()
367
{
368
m_qosEosp
= 0;
369
}
370
void
WifiMacHeader::SetQosAckPolicy
(
enum
QosAckPolicy
policy)
371
{
372
switch
(policy)
373
{
374
case
NORMAL_ACK
:
375
m_qosAckPolicy
= 0;
376
break
;
377
case
NO_ACK
:
378
m_qosAckPolicy
= 1;
379
break
;
380
case
NO_EXPLICIT_ACK
:
381
m_qosAckPolicy
= 2;
382
break
;
383
case
BLOCK_ACK
:
384
m_qosAckPolicy
= 3;
385
break
;
386
}
387
}
388
void
389
WifiMacHeader::SetQosNormalAck
()
390
{
391
m_qosAckPolicy
= 0;
392
}
393
void
394
WifiMacHeader::SetQosBlockAck
()
395
{
396
m_qosAckPolicy
= 3;
397
}
398
void
399
WifiMacHeader::SetQosNoAck
()
400
{
401
m_qosAckPolicy
= 1;
402
}
403
void
WifiMacHeader::SetQosAmsdu
(
void
)
404
{
405
m_amsduPresent
= 1;
406
}
407
void
WifiMacHeader::SetQosNoAmsdu
(
void
)
408
{
409
m_amsduPresent
= 0;
410
}
411
void
WifiMacHeader::SetQosTxopLimit
(uint8_t txop)
412
{
413
m_qosStuff
= txop;
414
}
415
416
Mac48Address
417
WifiMacHeader::GetAddr1
(
void
)
const
418
{
419
return
m_addr1
;
420
}
421
Mac48Address
422
WifiMacHeader::GetAddr2
(
void
)
const
423
{
424
return
m_addr2
;
425
}
426
Mac48Address
427
WifiMacHeader::GetAddr3
(
void
)
const
428
{
429
return
m_addr3
;
430
}
431
Mac48Address
432
WifiMacHeader::GetAddr4
(
void
)
const
433
{
434
return
m_addr4
;
435
}
436
437
enum
WifiMacType
438
WifiMacHeader::GetType
(
void
)
const
439
{
440
switch
(
m_ctrlType
)
441
{
442
case
TYPE_MGT
:
443
switch
(
m_ctrlSubtype
)
444
{
445
case
0:
446
return
WIFI_MAC_MGT_ASSOCIATION_REQUEST
;
447
break
;
448
case
1:
449
return
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
;
450
break
;
451
case
2:
452
return
WIFI_MAC_MGT_REASSOCIATION_REQUEST
;
453
break
;
454
case
3:
455
return
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
;
456
break
;
457
case
4:
458
return
WIFI_MAC_MGT_PROBE_REQUEST
;
459
break
;
460
case
5:
461
return
WIFI_MAC_MGT_PROBE_RESPONSE
;
462
break
;
463
case
8:
464
return
WIFI_MAC_MGT_BEACON
;
465
break
;
466
case
10:
467
return
WIFI_MAC_MGT_DISASSOCIATION
;
468
break
;
469
case
11:
470
return
WIFI_MAC_MGT_AUTHENTICATION
;
471
break
;
472
case
12:
473
return
WIFI_MAC_MGT_DEAUTHENTICATION
;
474
break
;
475
case
13:
476
return
WIFI_MAC_MGT_ACTION
;
477
break
;
478
case
14:
479
return
WIFI_MAC_MGT_ACTION_NO_ACK
;
480
break
;
481
case
15:
482
return
WIFI_MAC_MGT_MULTIHOP_ACTION
;
483
break
;
484
485
}
486
break
;
487
case
TYPE_CTL
:
488
switch
(
m_ctrlSubtype
)
489
{
490
case
SUBTYPE_CTL_BACKREQ
:
491
return
WIFI_MAC_CTL_BACKREQ
;
492
break
;
493
case
SUBTYPE_CTL_BACKRESP
:
494
return
WIFI_MAC_CTL_BACKRESP
;
495
break
;
496
case
SUBTYPE_CTL_RTS
:
497
return
WIFI_MAC_CTL_RTS
;
498
break
;
499
case
SUBTYPE_CTL_CTS
:
500
return
WIFI_MAC_CTL_CTS
;
501
break
;
502
case
SUBTYPE_CTL_ACK
:
503
return
WIFI_MAC_CTL_ACK
;
504
break
;
505
}
506
break
;
507
case
TYPE_DATA
:
508
switch
(
m_ctrlSubtype
)
509
{
510
case
0:
511
return
WIFI_MAC_DATA
;
512
break
;
513
case
1:
514
return
WIFI_MAC_DATA_CFACK
;
515
break
;
516
case
2:
517
return
WIFI_MAC_DATA_CFPOLL
;
518
break
;
519
case
3:
520
return
WIFI_MAC_DATA_CFACK_CFPOLL
;
521
break
;
522
case
4:
523
return
WIFI_MAC_DATA_NULL
;
524
break
;
525
case
5:
526
return
WIFI_MAC_DATA_NULL_CFACK
;
527
break
;
528
case
6:
529
return
WIFI_MAC_DATA_NULL_CFPOLL
;
530
break
;
531
case
7:
532
return
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
;
533
break
;
534
case
8:
535
return
WIFI_MAC_QOSDATA
;
536
break
;
537
case
9:
538
return
WIFI_MAC_QOSDATA_CFACK
;
539
break
;
540
case
10:
541
return
WIFI_MAC_QOSDATA_CFPOLL
;
542
break
;
543
case
11:
544
return
WIFI_MAC_QOSDATA_CFACK_CFPOLL
;
545
break
;
546
case
12:
547
return
WIFI_MAC_QOSDATA_NULL
;
548
break
;
549
case
14:
550
return
WIFI_MAC_QOSDATA_NULL_CFPOLL
;
551
break
;
552
case
15:
553
return
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
;
554
break
;
555
556
}
557
break
;
558
}
559
// NOTREACHED
560
NS_ASSERT
(
false
);
561
return
(
enum
WifiMacType
)-1;
562
}
563
bool
564
WifiMacHeader::IsFromDs
(
void
)
const
565
{
566
return
m_ctrlFromDs
== 1;
567
}
568
bool
569
WifiMacHeader::IsToDs
(
void
)
const
570
{
571
return
m_ctrlToDs
== 1;
572
}
573
574
bool
575
WifiMacHeader::IsData
(
void
)
const
576
{
577
return
(
m_ctrlType
==
TYPE_DATA
);
578
579
}
580
bool
581
WifiMacHeader::IsQosData
(
void
)
const
582
{
583
return
(
m_ctrlType
==
TYPE_DATA
&& (
m_ctrlSubtype
& 0x08));
584
}
585
bool
586
WifiMacHeader::IsCtl
(
void
)
const
587
{
588
return
(
m_ctrlType
==
TYPE_CTL
);
589
}
590
bool
591
WifiMacHeader::IsMgt
(
void
)
const
592
{
593
return
(
m_ctrlType
==
TYPE_MGT
);
594
}
595
bool
596
WifiMacHeader::IsCfpoll
(
void
)
const
597
{
598
switch
(
GetType
())
599
{
600
case
WIFI_MAC_DATA_CFPOLL
:
601
case
WIFI_MAC_DATA_CFACK_CFPOLL
:
602
case
WIFI_MAC_DATA_NULL_CFPOLL
:
603
case
WIFI_MAC_DATA_NULL_CFACK_CFPOLL
:
604
case
WIFI_MAC_QOSDATA_CFPOLL
:
605
case
WIFI_MAC_QOSDATA_CFACK_CFPOLL
:
606
case
WIFI_MAC_QOSDATA_NULL_CFPOLL
:
607
case
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
:
608
return
true
;
609
break
;
610
default
:
611
return
false
;
612
break
;
613
}
614
}
615
bool
616
WifiMacHeader::IsRts
(
void
)
const
617
{
618
return
(
GetType
() ==
WIFI_MAC_CTL_RTS
);
619
}
620
bool
621
WifiMacHeader::IsCts
(
void
)
const
622
{
623
return
(
GetType
() ==
WIFI_MAC_CTL_CTS
);
624
}
625
bool
626
WifiMacHeader::IsAck
(
void
)
const
627
{
628
return
(
GetType
() ==
WIFI_MAC_CTL_ACK
);
629
}
630
bool
631
WifiMacHeader::IsAssocReq
(
void
)
const
632
{
633
return
(
GetType
() ==
WIFI_MAC_MGT_ASSOCIATION_REQUEST
);
634
}
635
bool
636
WifiMacHeader::IsAssocResp
(
void
)
const
637
{
638
return
(
GetType
() ==
WIFI_MAC_MGT_ASSOCIATION_RESPONSE
);
639
}
640
bool
641
WifiMacHeader::IsReassocReq
(
void
)
const
642
{
643
return
(
GetType
() ==
WIFI_MAC_MGT_REASSOCIATION_REQUEST
);
644
}
645
bool
646
WifiMacHeader::IsReassocResp
(
void
)
const
647
{
648
return
(
GetType
() ==
WIFI_MAC_MGT_REASSOCIATION_RESPONSE
);
649
}
650
bool
651
WifiMacHeader::IsProbeReq
(
void
)
const
652
{
653
return
(
GetType
() ==
WIFI_MAC_MGT_PROBE_REQUEST
);
654
}
655
bool
656
WifiMacHeader::IsProbeResp
(
void
)
const
657
{
658
return
(
GetType
() ==
WIFI_MAC_MGT_PROBE_RESPONSE
);
659
}
660
bool
661
WifiMacHeader::IsBeacon
(
void
)
const
662
{
663
return
(
GetType
() ==
WIFI_MAC_MGT_BEACON
);
664
}
665
bool
666
WifiMacHeader::IsDisassociation
(
void
)
const
667
{
668
return
(
GetType
() ==
WIFI_MAC_MGT_DISASSOCIATION
);
669
}
670
bool
671
WifiMacHeader::IsAuthentication
(
void
)
const
672
{
673
return
(
GetType
() ==
WIFI_MAC_MGT_AUTHENTICATION
);
674
}
675
bool
676
WifiMacHeader::IsDeauthentication
(
void
)
const
677
{
678
return
(
GetType
() ==
WIFI_MAC_MGT_DEAUTHENTICATION
);
679
}
680
bool
681
WifiMacHeader::IsAction
(
void
)
const
682
{
683
return
(
GetType
() ==
WIFI_MAC_MGT_ACTION
);
684
}
685
bool
686
WifiMacHeader::IsMultihopAction
(
void
)
const
687
{
688
return
(
GetType
() ==
WIFI_MAC_MGT_MULTIHOP_ACTION
);
689
}
690
bool
691
WifiMacHeader::IsBlockAckReq
(
void
)
const
692
{
693
return
(
GetType
() ==
WIFI_MAC_CTL_BACKREQ
) ?
true
:
false
;
694
}
695
bool
696
WifiMacHeader::IsBlockAck
(
void
)
const
697
{
698
return
(
GetType
() ==
WIFI_MAC_CTL_BACKRESP
) ?
true
:
false
;
699
}
700
701
702
uint16_t
703
WifiMacHeader::GetRawDuration
(
void
)
const
704
{
705
return
m_duration
;
706
}
707
Time
708
WifiMacHeader::GetDuration
(
void
)
const
709
{
710
return
MicroSeconds (
m_duration
);
711
}
712
uint16_t
713
WifiMacHeader::GetSequenceControl
(
void
)
const
714
{
715
return
(
m_seqSeq
<< 4) |
m_seqFrag
;
716
}
717
uint16_t
718
WifiMacHeader::GetSequenceNumber
(
void
)
const
719
{
720
return
m_seqSeq
;
721
}
722
uint16_t
723
WifiMacHeader::GetFragmentNumber
(
void
)
const
724
{
725
return
m_seqFrag
;
726
}
727
bool
728
WifiMacHeader::IsRetry
(
void
)
const
729
{
730
return
(
m_ctrlRetry
== 1);
731
}
732
bool
733
WifiMacHeader::IsMoreFragments
(
void
)
const
734
{
735
return
(
m_ctrlMoreFrag
== 1);
736
}
737
bool
738
WifiMacHeader::IsQosBlockAck
(
void
)
const
739
{
740
NS_ASSERT
(
IsQosData
());
741
return
(
m_qosAckPolicy
== 3);
742
}
743
bool
744
WifiMacHeader::IsQosNoAck
(
void
)
const
745
{
746
NS_ASSERT
(
IsQosData
());
747
return
(
m_qosAckPolicy
== 1);
748
}
749
bool
750
WifiMacHeader::IsQosAck
(
void
)
const
751
{
752
NS_ASSERT
(
IsQosData
());
753
return
(
m_qosAckPolicy
== 0);
754
}
755
bool
756
WifiMacHeader::IsQosEosp
(
void
)
const
757
{
758
NS_ASSERT
(
IsQosData
());
759
return
(
m_qosEosp
== 1);
760
}
761
bool
762
WifiMacHeader::IsQosAmsdu
(
void
)
const
763
{
764
NS_ASSERT
(
IsQosData
());
765
return
(
m_amsduPresent
== 1);
766
}
767
uint8_t
768
WifiMacHeader::GetQosTid
(
void
)
const
769
{
770
NS_ASSERT
(
IsQosData
());
771
return
m_qosTid
;
772
}
773
enum
WifiMacHeader::QosAckPolicy
774
WifiMacHeader::GetQosAckPolicy
(
void
)
const
775
{
776
switch
(
m_qosAckPolicy
)
777
{
778
case
0:
779
return
NORMAL_ACK
;
780
break
;
781
case
1:
782
return
NO_ACK
;
783
break
;
784
case
2:
785
return
NO_EXPLICIT_ACK
;
786
break
;
787
case
3:
788
return
BLOCK_ACK
;
789
break
;
790
}
791
// NOTREACHED
792
NS_ASSERT
(
false
);
793
return
(
enum
QosAckPolicy
)-1;
794
}
795
796
uint8_t
797
WifiMacHeader::GetQosTxopLimit
(
void
)
const
798
{
799
NS_ASSERT
(
IsQosData
());
800
return
m_qosStuff
;
801
}
802
803
uint16_t
804
WifiMacHeader::GetFrameControl
(
void
)
const
805
{
806
uint16_t val = 0;
807
val |= (
m_ctrlType
<< 2) & (0x3 << 2);
808
val |= (
m_ctrlSubtype
<< 4) & (0xf << 4);
809
val |= (
m_ctrlToDs
<< 8) & (0x1 << 8);
810
val |= (
m_ctrlFromDs
<< 9) & (0x1 << 9);
811
val |= (
m_ctrlMoreFrag
<< 10) & (0x1 << 10);
812
val |= (
m_ctrlRetry
<< 11) & (0x1 << 11);
813
val |= (
m_ctrlMoreData
<< 13) & (0x1 << 13);
814
val |= (
m_ctrlWep
<< 14) & (0x1 << 14);
815
val |= (
m_ctrlOrder
<< 15) & (0x1 << 15);
816
return
val;
817
}
818
819
uint16_t
820
WifiMacHeader::GetQosControl
(
void
)
const
821
{
822
uint16_t val = 0;
823
val |=
m_qosTid
;
824
val |=
m_qosEosp
<< 4;
825
val |=
m_qosAckPolicy
<< 5;
826
val |=
m_amsduPresent
<< 7;
827
val |=
m_qosStuff
<< 8;
828
return
val;
829
}
830
831
void
832
WifiMacHeader::SetFrameControl
(uint16_t ctrl)
833
{
834
m_ctrlType
= (ctrl >> 2) & 0x03;
835
m_ctrlSubtype
= (ctrl >> 4) & 0x0f;
836
m_ctrlToDs
= (ctrl >> 8) & 0x01;
837
m_ctrlFromDs
= (ctrl >> 9) & 0x01;
838
m_ctrlMoreFrag
= (ctrl >> 10) & 0x01;
839
m_ctrlRetry
= (ctrl >> 11) & 0x01;
840
m_ctrlMoreData
= (ctrl >> 13) & 0x01;
841
m_ctrlWep
= (ctrl >> 14) & 0x01;
842
m_ctrlOrder
= (ctrl >> 15) & 0x01;
843
}
844
void
845
WifiMacHeader::SetSequenceControl
(uint16_t seq)
846
{
847
m_seqFrag
= seq & 0x0f;
848
m_seqSeq
= (seq >> 4) & 0x0fff;
849
}
850
void
851
WifiMacHeader::SetQosControl
(uint16_t qos)
852
{
853
m_qosTid
= qos & 0x000f;
854
m_qosEosp
= (qos >> 4) & 0x0001;
855
m_qosAckPolicy
= (qos >> 5) & 0x0003;
856
m_amsduPresent
= (qos >> 7) & 0x0001;
857
m_qosStuff
= (qos >> 8) & 0x00ff;
858
}
859
860
uint32_t
861
WifiMacHeader::GetSize
(
void
)
const
862
{
863
uint32_t size = 0;
864
switch
(
m_ctrlType
)
865
{
866
case
TYPE_MGT
:
867
size = 2 + 2 + 6 + 6 + 6 + 2;
868
break
;
869
case
TYPE_CTL
:
870
switch
(
m_ctrlSubtype
)
871
{
872
case
SUBTYPE_CTL_RTS
:
873
size = 2 + 2 + 6 + 6;
874
break
;
875
case
SUBTYPE_CTL_CTS
:
876
case
SUBTYPE_CTL_ACK
:
877
size = 2 + 2 + 6;
878
break
;
879
case
SUBTYPE_CTL_BACKREQ
:
880
case
SUBTYPE_CTL_BACKRESP
:
881
size = 2 + 2 + 6 + 6;
882
break
;
883
case
SUBTYPE_CTL_CTLWRAPPER
:
884
size = 2 +2 +6 +2 +4;
885
break
;
886
}
887
break
;
888
case
TYPE_DATA
:
889
size = 2 + 2 + 6 + 6 + 6 + 2;
890
if
(
m_ctrlToDs
&&
m_ctrlFromDs
)
891
{
892
size += 6;
893
}
894
if
(
m_ctrlSubtype
& 0x08)
895
{
896
size += 2;
897
}
898
break
;
899
}
900
return
size;
901
}
902
const
char
*
903
WifiMacHeader::GetTypeString
(
void
)
const
904
{
905
#define FOO(x) \
906
case WIFI_MAC_ ## x: \
907
return # x; \
908
break;
909
910
switch
(
GetType
())
911
{
912
FOO
(CTL_RTS);
913
FOO
(CTL_CTS);
914
FOO
(CTL_ACK);
915
FOO
(CTL_BACKREQ);
916
FOO
(CTL_BACKRESP);
917
918
FOO
(MGT_BEACON);
919
FOO
(MGT_ASSOCIATION_REQUEST);
920
FOO
(MGT_ASSOCIATION_RESPONSE);
921
FOO
(MGT_DISASSOCIATION);
922
FOO
(MGT_REASSOCIATION_REQUEST);
923
FOO
(MGT_REASSOCIATION_RESPONSE);
924
FOO
(MGT_PROBE_REQUEST);
925
FOO
(MGT_PROBE_RESPONSE);
926
FOO
(MGT_AUTHENTICATION);
927
FOO
(MGT_DEAUTHENTICATION);
928
FOO
(MGT_ACTION);
929
FOO
(MGT_ACTION_NO_ACK);
930
FOO
(MGT_MULTIHOP_ACTION);
931
932
FOO
(
DATA
);
933
FOO
(DATA_CFACK);
934
FOO
(DATA_CFPOLL);
935
FOO
(DATA_CFACK_CFPOLL);
936
FOO
(DATA_NULL);
937
FOO
(DATA_NULL_CFACK);
938
FOO
(DATA_NULL_CFPOLL);
939
FOO
(DATA_NULL_CFACK_CFPOLL);
940
FOO
(QOSDATA);
941
FOO
(QOSDATA_CFACK);
942
FOO
(QOSDATA_CFPOLL);
943
FOO
(QOSDATA_CFACK_CFPOLL);
944
FOO
(QOSDATA_NULL);
945
FOO
(QOSDATA_NULL_CFPOLL);
946
FOO
(QOSDATA_NULL_CFACK_CFPOLL);
947
default
:
948
return
"ERROR"
;
949
}
950
#undef FOO
951
// needed to make gcc 4.0.1 ppc darwin happy.
952
return
"BIG_ERROR"
;
953
}
954
955
TypeId
956
WifiMacHeader::GetTypeId
(
void
)
957
{
958
static
TypeId
tid =
TypeId
(
"ns3::WifiMacHeader"
)
959
.
SetParent
<
Header
> ()
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:630
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:42
ns3::DATA
Definition:
ul-job.h:38
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:661
ns3::WifiMacHeader::SetAction
void SetAction()
Set Type/Subtype values for an action header.
Definition:
wifi-mac-header.cc:152
ns3::WifiMacHeader::SetRetry
void SetRetry(void)
Set the Retry bit in the Frame Control field.
Definition:
wifi-mac-header.cc:350
ns3::WifiMacHeader::SetMoreFragments
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
Definition:
wifi-mac-header.cc:338
ns3::WIFI_MAC_CTL_CTLWRAPPER
Definition:
wifi-mac-header.h:42
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
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:861
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:723
ns3::WifiMacHeader::SetQosAckPolicy
void SetQosAckPolicy(enum QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.
Definition:
wifi-mac-header.cc:370
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:310
ns3::WifiMacHeader::SetFrameControl
void SetFrameControl(uint16_t control)
Set the Frame Control field with the given raw value.
Definition:
wifi-mac-header.cc:832
ns3::TYPE_DATA
Definition:
wifi-mac-header.cc:35
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:646
ns3::WifiMacHeader::SetProbeReq
void SetProbeReq(void)
Set Type/Subtype values for a probe request header.
Definition:
wifi-mac-header.cc:115
ns3::WifiMacHeader::GetRawDuration
uint16_t GetRawDuration(void) const
Return the raw duration from the Duration/ID field.
Definition:
wifi-mac-header.cc:703
ns3::WifiMacHeader::SetDuration
void SetDuration(Time duration)
Set the Duration/ID field with the given duration (Time object).
Definition:
wifi-mac-header.cc:315
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:624
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:681
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition:
address-utils.cc:70
ns3::WifiMacHeader::m_addr2
Mac48Address m_addr2
Definition:
wifi-mac-header.h:635
ns3::WifiMacHeader::GetAddr3
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
Definition:
wifi-mac-header.cc:427
ns3::TYPE_CTL
Definition:
wifi-mac-header.cc:34
ns3::WifiMacHeader::SetNoMoreFragments
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
Definition:
wifi-mac-header.cc:334
ns3::WifiMacHeader::m_qosAckPolicy
uint8_t m_qosAckPolicy
Definition:
wifi-mac-header.h:642
ns3::WifiMacHeader::GetAddr4
Mac48Address GetAddr4(void) const
Return the address in the Address 4 field.
Definition:
wifi-mac-header.cc:432
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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:438
ns3::WifiMacHeader::m_qosEosp
uint8_t m_qosEosp
Definition:
wifi-mac-header.h:641
ns3::WifiMacHeader::SetId
void SetId(uint16_t id)
Set the Duration/ID field with the given ID.
Definition:
wifi-mac-header.cc:322
ns3::WifiMacHeader::IsAssocReq
bool IsAssocReq(void) const
Return true if the header is an Association Request header.
Definition:
wifi-mac-header.cc:631
ns3::WifiMacHeader::GetQosControl
uint16_t GetQosControl(void) const
Return the raw QoS Control field.
Definition:
wifi-mac-header.cc:820
ns3::WIFI_MAC_QOSDATA_NULL_CFPOLL
Definition:
wifi-mac-header.h:71
ns3::WifiMacHeader::IsBlockAck
bool IsBlockAck(void) const
Return true if the header is a Block ACK header.
Definition:
wifi-mac-header.cc:696
visualizer.core.start
def start
Definition:
core.py:1482
ns3::WifiMacHeader::IsAssocResp
bool IsAssocResp(void) const
Return true if the header is an Association Response header.
Definition:
wifi-mac-header.cc:636
ns3::WifiMacHeader::SetQosControl
void SetQosControl(uint16_t qos)
Set the QoS Control field with the given raw value.
Definition:
wifi-mac-header.cc:851
ns3::WifiMacHeader::GetFrameControl
uint16_t GetFrameControl(void) const
Return the raw Frame Control field.
Definition:
wifi-mac-header.cc:804
ns3::WifiMacHeader::IsCtl
bool IsCtl(void) const
Return true if the Type is Control.
Definition:
wifi-mac-header.cc:586
ns3::WifiMacHeader::SetProbeResp
void SetProbeResp(void)
Set Type/Subtype values for a probe response header.
Definition:
wifi-mac-header.cc:121
ns3::WifiMacHeader::m_seqFrag
uint8_t m_seqFrag
Definition:
wifi-mac-header.h:637
ns3::WifiMacHeader::SetQosNoAck
void SetQosNoAck(void)
Set the QoS ACK policy in the QoS control field to no ACK.
Definition:
wifi-mac-header.cc:399
ns3::SUBTYPE_CTL_BACKREQ
Definition:
wifi-mac-header.cc:40
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:762
ns3::WifiMacHeader::IsProbeResp
bool IsProbeResp(void) const
Return true if the header is a Probe Response header.
Definition:
wifi-mac-header.cc:656
ns3::WifiMacHeader::m_addr1
Mac48Address m_addr1
Definition:
wifi-mac-header.h:634
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(Iterator const &o) const
Definition:
buffer.cc:807
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition:
fatal-error.h:72
ns3::WifiMacHeader::m_addr3
Mac48Address m_addr3
Definition:
wifi-mac-header.h:636
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::SUBTYPE_CTL_CTS
Definition:
wifi-mac-header.cc:43
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:596
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:733
ns3::WifiMacHeader::GetDuration
Time GetDuration(void) const
Return the duration from the Duration/ID field (Time object).
Definition:
wifi-mac-header.cc:708
ns3::WifiMacHeader::GetQosTid
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Definition:
wifi-mac-header.cc:768
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:641
ns3::WifiMacHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
wifi-mac-header.cc:1074
ns3::SUBTYPE_CTL_ACK
Definition:
wifi-mac-header.cc:44
ns3::WifiMacHeader::GetQosTxopLimit
uint8_t GetQosTxopLimit(void) const
Return the TXOP limit.
Definition:
wifi-mac-header.cc:797
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition:
wifi-mac-header.cc:83
ns3::WifiMacHeader::m_ctrlToDs
uint8_t m_ctrlToDs
Definition:
wifi-mac-header.h:626
ns3::Time::GetMicroSeconds
int64_t GetMicroSeconds(void) const
Definition:
nstime.h:291
ns3::WifiMacHeader::SetBeacon
void SetBeacon(void)
Set Type/Subtype values for a beacon header.
Definition:
wifi-mac-header.cc:127
ns3::WifiMacHeader::SetDsNotTo
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
Definition:
wifi-mac-header.cc:77
ns3::WifiMacHeader::SetAddr3
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
Definition:
wifi-mac-header.cc:93
ns3::WifiMacHeader::SetAddr4
void SetAddr4(Mac48Address address)
Fill the Address 4 field with the given address.
Definition:
wifi-mac-header.cc:98
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:713
ns3::WifiMacHeader::IsProbeReq
bool IsProbeReq(void) const
Return true if the header is a Probe Request header.
Definition:
wifi-mac-header.cc:651
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:342
ns3::WifiMacHeader::IsAuthentication
bool IsAuthentication(void) const
Return true if the header is an Authentication header.
Definition:
wifi-mac-header.cc:671
wifi-mac-header.h
ns3::WifiMacHeader::NORMAL_ACK
Definition:
wifi-mac-header.h:88
ns3::WifiMacHeader::IsQosBlockAck
bool IsQosBlockAck(void) const
Return if the QoS ACK policy is Block ACK.
Definition:
wifi-mac-header.cc:738
ns3::WifiMacHeader::m_amsduPresent
uint8_t m_amsduPresent
Definition:
wifi-mac-header.h:643
ns3::WifiMacHeader::m_addr4
Mac48Address m_addr4
Definition:
wifi-mac-header.h:639
ns3::WifiMacHeader::m_ctrlMoreFrag
uint8_t m_ctrlMoreFrag
Definition:
wifi-mac-header.h:628
ns3::WifiMacHeader::NO_ACK
Definition:
wifi-mac-header.h:89
ns3::WifiMacHeader::m_ctrlFromDs
uint8_t m_ctrlFromDs
Definition:
wifi-mac-header.h:627
ns3::WifiMacHeader::IsMgt
bool IsMgt(void) const
Return true if the Type is Management.
Definition:
wifi-mac-header.cc:591
ns3::WifiMacHeader::SetAssocReq
void SetAssocReq(void)
Set Type/Subtype values for an association request header.
Definition:
wifi-mac-header.cc:103
ns3::SUBTYPE_CTL_RTS
Definition:
wifi-mac-header.cc:42
ns3::WifiMacHeader::m_ctrlOrder
uint8_t m_ctrlOrder
Definition:
wifi-mac-header.h:632
ns3::WifiMacHeader::SetQosTid
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Definition:
wifi-mac-header.cc:358
ns3::WifiMacHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
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:845
ns3::WifiMacHeader::SetNoRetry
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
Definition:
wifi-mac-header.cc:354
ns3::WifiMacHeader::IsToDs
bool IsToDs(void) const
Definition:
wifi-mac-header.cc:569
ns3::WifiMacHeader::m_seqSeq
uint16_t m_seqSeq
Definition:
wifi-mac-header.h:638
ns3::WifiMacHeader::IsDisassociation
bool IsDisassociation(void) const
Return true if the header is a Disassociation header.
Definition:
wifi-mac-header.cc:666
ns3::SUBTYPE_CTL_BACKRESP
Definition:
wifi-mac-header.cc:41
ns3::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition:
wifi-mac-header.cc:88
ns3::WIFI_MAC_MGT_DISASSOCIATION
Definition:
wifi-mac-header.h:47
ns3::WIFI_MAC_MGT_PROBE_RESPONSE
Definition:
wifi-mac-header.h:51
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:41
ns3::WIFI_MAC_DATA
Definition:
wifi-mac-header.h:58
ns3::WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL
Definition:
wifi-mac-header.h:72
ns3::WifiMacHeader::SetBlockAck
void SetBlockAck(void)
Set Type/Subtype values for a Block Ack header.
Definition:
wifi-mac-header.cc:139
ns3::WifiMacHeader::QosAckPolicy
QosAckPolicy
ACK policy for QoS frames.
Definition:
wifi-mac-header.h:86
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:903
FOO
#define FOO(x)
ns3::Buffer::Iterator::WriteHtolsbU16
void WriteHtolsbU16(uint16_t data)
Definition:
buffer.cc:935
ns3::WifiMacHeader::WifiMacHeader
WifiMacHeader()
Definition:
wifi-mac-header.cc:49
ns3::WifiMacHeader::m_duration
uint16_t m_duration
Definition:
wifi-mac-header.h:633
ns3::WifiMacHeader::SetAssocResp
void SetAssocResp(void)
Set Type/Subtype values for an association response header.
Definition:
wifi-mac-header.cc:109
ns3::WifiMacHeader::m_ctrlRetry
uint8_t m_ctrlRetry
Definition:
wifi-mac-header.h:629
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:411
ns3::WifiMacHeader::m_qosStuff
uint16_t m_qosStuff
Definition:
wifi-mac-header.h:644
ns3::WifiMacHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
Definition:
wifi-mac-header.cc:326
ns3::WifiMacHeader::IsData
bool IsData(void) const
Return true if the Type is DATA.
Definition:
wifi-mac-header.cc:575
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:581
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:691
ns3::WifiMacHeader::SetQosNormalAck
void SetQosNormalAck(void)
Set the QoS ACK policy in the QoS control field to normal ACK.
Definition:
wifi-mac-header.cc:389
ns3::SUBTYPE_CTL_CTLWRAPPER
Definition:
wifi-mac-header.cc:45
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:146
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:407
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
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:72
ns3::WifiMacHeader::IsFromDs
bool IsFromDs(void) const
Definition:
wifi-mac-header.cc:564
ns3::WifiMacHeader::SetQosEosp
void SetQosEosp()
Set the end of service period (EOSP) bit in the QoS control field.
Definition:
wifi-mac-header.cc:362
ns3::WifiMacHeader::IsQosEosp
bool IsQosEosp(void) const
Return if the end of service period (EOSP) is set.
Definition:
wifi-mac-header.cc:756
ns3::WifiMacHeader::~WifiMacHeader
~WifiMacHeader()
Definition:
wifi-mac-header.cc:57
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:62
ns3::WifiMacHeader::SetNoOrder
void SetNoOrder(void)
Unset order bit in the frame control field.
Definition:
wifi-mac-header.cc:346
ns3::Buffer::Iterator::ReadLsbtohU16
uint16_t ReadLsbtohU16(void)
Definition:
buffer.cc:1090
ns3::WifiMacHeader::IsMultihopAction
bool IsMultihopAction() const
Check if the header is a Multihop action header.
Definition:
wifi-mac-header.cc:686
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:164
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:621
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition:
wifi-mac-header.cc:417
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:640
ns3::WifiMacHeader::m_ctrlSubtype
uint8_t m_ctrlSubtype
Definition:
wifi-mac-header.h:625
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:158
ns3::WifiMacHeader::IsDeauthentication
bool IsDeauthentication(void) const
Return true if the header is a Deauthentication header.
Definition:
wifi-mac-header.cc:676
ns3::WifiMacHeader::IsRts
bool IsRts(void) const
Return true if the header is a RTS header.
Definition:
wifi-mac-header.cc:616
ns3::WifiMacHeader::SetQosNoEosp
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
Definition:
wifi-mac-header.cc:366
ns3::WifiMacHeader::IsAck
bool IsAck(void) const
Return true if the header is an ACK header.
Definition:
wifi-mac-header.cc:626
ns3::WifiMacHeader::GetTypeId
static TypeId GetTypeId(void)
Definition:
wifi-mac-header.cc:956
ns3::WifiMacHeader::NO_EXPLICIT_ACK
Definition:
wifi-mac-header.h:90
ns3::WifiMacHeader::SetFragmentNumber
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
Definition:
wifi-mac-header.cc:330
ns3::WifiMacHeader::SetBlockAckReq
void SetBlockAckReq(void)
Set Type/Subtype values for a Block Ack Request header.
Definition:
wifi-mac-header.cc:133
ns3::WIFI_MAC_DATA_CFPOLL
Definition:
wifi-mac-header.h:60
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
ns3::WifiMacHeader::SetQosAmsdu
void SetQosAmsdu(void)
Set that A-MSDU is present.
Definition:
wifi-mac-header.cc:403
ns3::WifiMacHeader::GetQosAckPolicy
enum QosAckPolicy GetQosAckPolicy(void) const
Return the QoS ACK Policy of a QoS header.
Definition:
wifi-mac-header.cc:774
ns3::TYPE_MGT
Definition:
wifi-mac-header.cc:33
ns3::WifiMacHeader::BLOCK_ACK
Definition:
wifi-mac-header.h:91
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:728
ns3::WifiMacHeader::GetAddr2
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
Definition:
wifi-mac-header.cc:422
ns3::WifiMacHeader::IsQosNoAck
bool IsQosNoAck(void) const
Return if the QoS ACK policy is No ACK.
Definition:
wifi-mac-header.cc:744
ns3::WifiMacHeader::SetQosBlockAck
void SetQosBlockAck(void)
Set the QoS ACK policy in the QoS control field to block ACK.
Definition:
wifi-mac-header.cc:394
ns3::WifiMacHeader::m_ctrlWep
uint8_t m_ctrlWep
Definition:
wifi-mac-header.h:631
ns3::WifiMacHeader::IsQosAck
bool IsQosAck(void) const
Return if the QoS ACK policy is Normal ACK.
Definition:
wifi-mac-header.cc:750
ns3::WifiMacHeader::SetDsNotFrom
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
Definition:
wifi-mac-header.cc:67
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:718
src
wifi
model
wifi-mac-header.cc
Generated on Sat Apr 19 2014 14:07:11 for ns-3 by
1.8.6