This file is indexed.

/usr/include/ns3.26/ns3/wifi-mac-header.h is in libns3-dev 3.26+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2006, 2009 INRIA
 * Copyright (c) 2009 MIRKO BANCHI
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
 * Author: Mirko Banchi <mk.banchi@gmail.com>
 */

#ifndef WIFI_MAC_HEADER_H
#define WIFI_MAC_HEADER_H

#include "ns3/header.h"
#include "ns3/mac48-address.h"
#include "ns3/nstime.h"
#include <stdint.h>

namespace ns3 {

/**
 * Combination of valid MAC header type/subtype.
 */
enum WifiMacType
{
  WIFI_MAC_CTL_CTLWRAPPER = 0,
  WIFI_MAC_CTL_RTS,
  WIFI_MAC_CTL_CTS,
  WIFI_MAC_CTL_ACK,
  WIFI_MAC_CTL_BACKREQ,
  WIFI_MAC_CTL_BACKRESP,

  WIFI_MAC_MGT_BEACON,
  WIFI_MAC_MGT_ASSOCIATION_REQUEST,
  WIFI_MAC_MGT_ASSOCIATION_RESPONSE,
  WIFI_MAC_MGT_DISASSOCIATION,
  WIFI_MAC_MGT_REASSOCIATION_REQUEST,
  WIFI_MAC_MGT_REASSOCIATION_RESPONSE,
  WIFI_MAC_MGT_PROBE_REQUEST,
  WIFI_MAC_MGT_PROBE_RESPONSE,
  WIFI_MAC_MGT_AUTHENTICATION,
  WIFI_MAC_MGT_DEAUTHENTICATION,
  WIFI_MAC_MGT_ACTION,
  WIFI_MAC_MGT_ACTION_NO_ACK,
  WIFI_MAC_MGT_MULTIHOP_ACTION,

  WIFI_MAC_DATA,
  WIFI_MAC_DATA_CFACK,
  WIFI_MAC_DATA_CFPOLL,
  WIFI_MAC_DATA_CFACK_CFPOLL,
  WIFI_MAC_DATA_NULL,
  WIFI_MAC_DATA_NULL_CFACK,
  WIFI_MAC_DATA_NULL_CFPOLL,
  WIFI_MAC_DATA_NULL_CFACK_CFPOLL,
  WIFI_MAC_QOSDATA,
  WIFI_MAC_QOSDATA_CFACK,
  WIFI_MAC_QOSDATA_CFPOLL,
  WIFI_MAC_QOSDATA_CFACK_CFPOLL,
  WIFI_MAC_QOSDATA_NULL,
  WIFI_MAC_QOSDATA_NULL_CFPOLL,
  WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL,
};

/**
 * \ingroup wifi
 *
 * Implements the IEEE 802.11 MAC header
 */
class WifiMacHeader : public Header
{
public:
  /**
   * ACK policy for QoS frames.
   */
  enum QosAckPolicy
  {
    NORMAL_ACK = 0,
    NO_ACK = 1,
    NO_EXPLICIT_ACK = 2,
    BLOCK_ACK = 3,
  };

  /**
   * Address types.
   */
  enum AddressType
  {
    ADDR1,
    ADDR2,
    ADDR3,
    ADDR4
  };

  WifiMacHeader ();
  ~WifiMacHeader ();

  static TypeId GetTypeId (void);
  virtual TypeId GetInstanceTypeId (void) const;
  virtual void Print (std::ostream &os) const;
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start);

  /**
   * Set Type/Subtype values for an association request header.
   */
  void SetAssocReq (void);
  /**
   * Set Type/Subtype values for an association response header.
   */
  void SetAssocResp (void);
  /**
   * Set Type/Subtype values for a probe request header.
   */
  void SetProbeReq (void);
  /**
   * Set Type/Subtype values for a probe response header.
   */
  void SetProbeResp (void);
  /**
   * Set Type/Subtype values for a beacon header.
   */
  void SetBeacon (void);
  /**
   * Set Type/Subtype values for a data packet with
   * no subtype equal to 0.
   */
  void SetTypeData (void);
  /**
   * Set Type/Subtype values for an action header.
   */
  void SetAction ();
  /**
   * Set Type/Subtype values for a Block Ack Request header.
   */
  void SetBlockAckReq (void);
  /**
   * Set Type/Subtype values for a Block Ack header.
   */
  void SetBlockAck (void);
  /**
   * Set Type/Subtype values for a multihop action header.
   */
  void SetMultihopAction ();
  /**
   * Set the From DS bit in the Frame Control field.
   */
  void SetDsFrom (void);
  /**
   * Un-set the From DS bit in the Frame Control field.
   */
  void SetDsNotFrom (void);
  /**
   * Set the To DS bit in the Frame Control field.
   */
  void SetDsTo (void);
  /**
   * Un-set the To DS bit in the Frame Control field.
   */
  void SetDsNotTo (void);
  /**
   * Fill the Address 1 field with the given address.
   *
   * \param address the address to be used in the Address 1 field
   */
  void SetAddr1 (Mac48Address address);
  /**
   * Fill the Address 2 field with the given address.
   *
   * \param address the address to be used in the Address 2 field
   */
  void SetAddr2 (Mac48Address address);
  /**
   * Fill the Address 3 field with the given address.
   *
   * \param address the address to be used in the Address 3 field
   */
  void SetAddr3 (Mac48Address address);
  /**
   * Fill the Address 4 field with the given address.
   *
   * \param address the address to be used in the Address 4 field
   */
  void SetAddr4 (Mac48Address address);
  /**
   * Set Type/Subtype values with the correct values depending
   * on the given type.
   *
   * \param type the WifiMacType for the header
   */
  void SetType (enum WifiMacType type);
  /**
   * Set the Duration/ID field with the given raw uint16_t value.
   *
   * \param duration the raw duration in uint16_t
   */
  void SetRawDuration (uint16_t duration);
  /**
   * Set the Duration/ID field with the given duration (Time object).
   * The method converts the given time to microseconds.
   *
   * \param duration the duration (Time object)
   */
  void SetDuration (Time duration);
  /**
   * Set the Duration/ID field with the given ID.
   *
   * \param id the ID
   */
  void SetId (uint16_t id);
  /**
   * Set the sequence number of the header.
   *
   * \param seq the given sequence number
   */
  void SetSequenceNumber (uint16_t seq);
  /**
   * Set the fragment number of the header.
   *
   * \param frag the given fragment number
   */
  void SetFragmentNumber (uint8_t frag);
  /**
   * Un-set the More Fragment bit in the Frame Control Field
   */
  void SetNoMoreFragments (void);
  /**
   * Set the More Fragment bit in the Frame Control field
   */
  void SetMoreFragments (void);
  /**
   * Set the Retry bit in the Frame Control field.
   */
  void SetRetry (void);
  /**
   * Un-set the Retry bit in the Frame Control field.
   */
  void SetNoRetry (void);
  /**
   * Set the TID for the QoS header.
   *
   * \param tid the TID for the QoS header
   */
  void SetQosTid (uint8_t tid);
  /**
   * Set the end of service period (EOSP) bit in the QoS control field.
   */
  void SetQosEosp ();
  /**
   * Un-set the end of service period (EOSP) bit in the QoS control field.
   */
  void SetQosNoEosp ();
  /**
   * Set the QoS ACK policy in the QoS control field.
   *
   * \param policy
   */
  void SetQosAckPolicy (enum QosAckPolicy policy);
  /**
   * Set the QoS ACK policy in the QoS control field to normal ACK.
   */
  void SetQosNormalAck (void);
  /**
   * Set the QoS ACK policy in the QoS control field to block ACK.
   */
  void SetQosBlockAck (void);
  /**
   * Set the QoS ACK policy in the QoS control field to no ACK.
   */
  void SetQosNoAck (void);
  /**
   * Set that A-MSDU is present.
   */
  void SetQosAmsdu (void);
  /**
   * Set that A-MSDU is not present.
   */
  void SetQosNoAmsdu (void);
  /**
   * Set TXOP limit in the QoS control field.
   *
   * \param txop
   */
  void SetQosTxopLimit (uint8_t txop);
  /**
   * Set the Mesh Control Present flag for the QoS header.
   */
  void SetQosMeshControlPresent ();
  /**
   * Clear the Mesh Control Present flag for the QoS header.
   */
  void SetQosNoMeshControlPresent ();
  /**
   * Set order bit in the frame control field.
   */
  void SetOrder (void);
  /**
   * Unset order bit in the frame control field.
   */
  void SetNoOrder (void);

  /**
   * Return the address in the Address 1 field.
   *
   * \return the address in the Address 1 field
   */
  Mac48Address GetAddr1 (void) const;
  /**
   * Return the address in the Address 2 field.
   *
   * \return the address in the Address 2 field
   */
  Mac48Address GetAddr2 (void) const;
  /**
   * Return the address in the Address 3 field.
   *
   * \return the address in the Address 3 field
   */
  Mac48Address GetAddr3 (void) const;
  /**
   * Return the address in the Address 4 field.
   *
   * \return the address in the Address 4 field
   */
  Mac48Address GetAddr4 (void) const;
  /**
   * Return the type (enum WifiMacType)
   *
   * \return the type (enum WifiMacType)
   */
  enum WifiMacType GetType (void) const;
  /**
   * \return true if From DS bit is set, false otherwise
   */
  bool IsFromDs (void) const;
  /**
   * \return true if To DS bit is set, false otherwise
   */
  bool IsToDs (void) const;
  /**
   * Return true if the Type is DATA.  The method does
   * not check the Subtype field. (e.g. the header may be
   * DATA with QoS)
   *
   * \return true if Type is DATA, false otherwise
   */
  bool IsData (void) const;
  /**
   * Return true if the Type is DATA and Subtype is one of the
   * possible values for QoS DATA.
   *
   * \return true if Type is QoS DATA, false otherwise
   */
  bool IsQosData (void) const;
  /**
   * Return true if the Type is Control.
   *
   * \return true if Type is Control, false otherwise
   */
  bool IsCtl (void) const;
  /**
   * Return true if the Type is Management.
   *
   * \return true if Type is Management, false otherwise
   */
  bool IsMgt (void) const;
  /**
   * Return true if the Type/Subtype is one of the possible CF-Poll headers.
   *
   * \return true if the Type/Subtype is one of the possible CF-Poll headers, false otherwise
   */
  bool IsCfpoll (void) const;
  /**
   * Return true if the header is a RTS header.
   *
   * \return true if the header is a RTS header, false otherwise
   */
  bool IsRts (void) const;
  /**
   * Return true if the header is a CTS header.
   *
   * \return true if the header is a CTS header, false otherwise
   */
  bool IsCts (void) const;
  /**
   * Return true if the header is an ACK header.
   *
   * \return true if the header is an ACK header, false otherwise
   */
  bool IsAck (void) const;
  /**
   * Return true if the header is a Block ACK Request header.
   *
   * \return true if the header is a Block ACK Request header, false otherwise
   */
  bool IsBlockAckReq (void) const;
  /**
   * Return true if the header is a Block ACK header.
   *
   * \return true if the header is a Block ACK header, false otherwise
   */
  bool IsBlockAck (void) const;
  /**
   * Return true if the header is an Association Request header.
   *
   * \return true if the header is an Association Request header, false otherwise
   */
  bool IsAssocReq (void) const;
  /**
   * Return true if the header is an Association Response header.
   *
   * \return true if the header is an Association Response header, false otherwise
   */
  bool IsAssocResp (void) const;
  /**
   * Return true if the header is a Reassociation Request header.
   *
   * \return true if the header is a Reassociation Request header, false otherwise
   */
  bool IsReassocReq (void) const;
  /**
   * Return true if the header is a Reassociation Response header.
   *
   * \return true if the header is a Reassociation Response header, false otherwise
   */
  bool IsReassocResp (void) const;
  /**
   * Return true if the header is a Probe Request header.
   *
   * \return true if the header is a Probe Request header, false otherwise
   */
  bool IsProbeReq (void) const;
  /**
   * Return true if the header is a Probe Response header.
   *
   * \return true if the header is a Probe Response header, false otherwise
   */
  bool IsProbeResp (void) const;
  /**
   * Return true if the header is a Beacon header.
   *
   * \return true if the header is a Beacon header, false otherwise
   */
  bool IsBeacon (void) const;
  /**
   * Return true if the header is a Disassociation header.
   *
   * \return true if the header is a Disassociation header, false otherwise
   */
  bool IsDisassociation (void) const;
  /**
   * Return true if the header is an Authentication header.
   *
   * \return true if the header is an Authentication header, false otherwise
   */
  bool IsAuthentication (void) const;
  /**
   * Return true if the header is a Deauthentication header.
   *
   * \return true if the header is a Deauthentication header, false otherwise
   */
  bool IsDeauthentication (void) const;
  /**
   * Return true if the header is an Action header.
   *
   * \return true if the header is an Action header, false otherwise
   */
  bool IsAction () const;
  /**
   * Check if the header is a Multihop action header.
   *
   * \return true if the header is a Multihop action header,
   *         false otherwise
   */
  bool IsMultihopAction () const;
  /**
   * Return the raw duration from the Duration/ID field.
   *
   * \return the raw duration from the Duration/ID field
   */
  uint16_t GetRawDuration (void) const;
  /**
   * Return the duration from the Duration/ID field (Time object).
   *
   * \return the duration from the Duration/ID field (Time object)
   */
  Time GetDuration (void) const;
  /**
   * Return the raw Sequence Control field.
   *
   * \return the raw Sequence Control field
   */
  uint16_t GetSequenceControl (void) const;
  /**
   * Return the sequence number of the header.
   *
   * \return the sequence number of the header
   */
  uint16_t GetSequenceNumber (void) const;
  /**
   * Return the fragment number of the header.
   *
   * \return the fragment number of the header
   */
  uint16_t GetFragmentNumber (void) const;
  /**
   * Return if the Retry bit is set.
   *
   * \return true if the Retry bit is set, false otherwise
   */
  bool IsRetry (void) const;
  /**
   * Return if the More Fragment bit is set.
   *
   * \return true if the More Fragment bit is set, false otherwise
   */
  bool IsMoreFragments (void) const;
  /**
   * Return if the QoS ACK policy is Block ACK.
   *
   * \return true if the QoS ACK policy is Block ACK, false otherwise
   */
  bool IsQosBlockAck (void) const;
  /**
   * Return if the QoS ACK policy is No ACK.
   *
   * \return true if the QoS ACK policy is No ACK, false otherwise
   */
  bool IsQosNoAck (void) const;
  /**
   * Return if the QoS ACK policy is Normal ACK.
   *
   * \return true if the QoS ACK policy is No ACK, false otherwise
   */
  bool IsQosAck (void) const;
  /**
   * Return if the end of service period (EOSP) is set.
   *
   * \return true if the end of service period (EOSP) is set, false otherwise
   */
  bool IsQosEosp (void) const;
  /**
   * Check if the A-MSDU present bit is set in the QoS control field.
   *
   * \return true if the A-MSDU present bit is set,
   *         false otherwise
   */
  bool IsQosAmsdu (void) const;
  /**
   * Return the Traffic ID of a QoS header.
   *
   * \return the Traffic ID of a QoS header
   */
  uint8_t GetQosTid (void) const;
  /**
   * Return the QoS ACK Policy of a QoS header.
   *
   * \return the QoS ACK Policy of a QoS header
   */
  enum QosAckPolicy GetQosAckPolicy (void) const;
  /**
   * Return the TXOP limit.
   *
   * \return the TXOP limit
   */
  uint8_t GetQosTxopLimit (void) const;
  /**
   * Return the size of the WifiMacHeader in octets.
   * GetSerializedSize calls this function.
   *
   * \return the size of the WifiMacHeader in octets
   */
  uint32_t GetSize (void) const;
  /**
   * Return a string corresponds to the header type.
   *
   * \returns a string corresponds to the header type.
   */
  const char * GetTypeString (void) const;

  /**
   * TracedCallback signature for WifiMacHeader
   *
   * \param [in] header The header
   */
  typedef void (* TracedCallback)(const WifiMacHeader &header);


private:
  /**
   * Return the raw Frame Control field.
   *
   * \return the raw Frame Control field
   */
  uint16_t GetFrameControl (void) const;
  /**
   * Return the raw QoS Control field.
   *
   * \return the raw QoS Control field
   */
  uint16_t GetQosControl (void) const;
  /**
   * Set the Frame Control field with the given raw value.
   *
   * \param control the raw Frame Control field value
   */
  void SetFrameControl (uint16_t control);
  /**
   * Set the Sequence Control field with the given raw value.
   *
   * \param seq the raw Sequence Control field value
   */
  void SetSequenceControl (uint16_t seq);
  /**
   * Set the QoS Control field with the given raw value.
   *
   * \param qos the raw QoS Control field value
   */
  void SetQosControl (uint16_t qos);
  /**
   * Print the Frame Control field to the output stream.
   *
   * \param os the output stream to print to
   */
  void PrintFrameControl (std::ostream &os) const;

  uint8_t m_ctrlType;
  uint8_t m_ctrlSubtype;
  uint8_t m_ctrlToDs;
  uint8_t m_ctrlFromDs;
  uint8_t m_ctrlMoreFrag;
  uint8_t m_ctrlRetry;
  uint8_t m_ctrlMoreData;
  uint8_t m_ctrlWep;
  uint8_t m_ctrlOrder;
  uint16_t m_duration;
  Mac48Address m_addr1;
  Mac48Address m_addr2;
  Mac48Address m_addr3;
  uint8_t m_seqFrag;
  uint16_t m_seqSeq;
  Mac48Address m_addr4;
  uint8_t m_qosTid;
  uint8_t m_qosEosp;
  uint8_t m_qosAckPolicy;
  uint8_t m_amsduPresent;
  uint16_t m_qosStuff;
};

} //namespace ns3

#endif /* WIFI_MAC_HEADER_H */