A Discrete-Event Network Simulator
API
radiotap-header.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 CTTC
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Nicola Baldo <nbaldo@cttc.es>
18  * Sébastien Deronne <sebastien.deronne@gmail.com>
19  */
20 
21 #ifndef RADIOTAP_HEADER_H
22 #define RADIOTAP_HEADER_H
23 
24 #include <ns3/header.h>
25 
26 namespace ns3
27 {
28 
37 class RadiotapHeader : public Header
38 {
39  public:
45  static TypeId GetTypeId();
46  TypeId GetInstanceTypeId() const override;
47 
55  uint32_t GetSerializedSize() const override;
56 
65  void Serialize(Buffer::Iterator start) const override;
66 
76  uint32_t Deserialize(Buffer::Iterator start) override;
77 
91  void Print(std::ostream& os) const override;
92 
101  void SetTsft(uint64_t tsft);
102 
107  {
109  FRAME_FLAG_CFP = 0x01,
111  FRAME_FLAG_WEP = 0x04,
115  0x20,
117  FRAME_FLAG_SHORT_GUARD = 0x80
118  };
119 
124  void SetFrameFlags(uint8_t flags);
125 
130  void SetRate(uint8_t rate);
131 
136  {
137  CHANNEL_FLAG_NONE = 0x0000,
139  CHANNEL_FLAG_CCK = 0x0020,
140  CHANNEL_FLAG_OFDM = 0x0040,
145  CHANNEL_FLAG_GFSK = 0x0800
146  };
147 
154  void SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags);
155 
163  void SetAntennaSignalPower(double signal);
164 
172  void SetAntennaNoisePower(double noise);
173 
177  enum McsKnown
178  {
179  MCS_KNOWN_NONE = 0x00,
185  MCS_KNOWN_STBC = 0x20,
186  MCS_KNOWN_NESS = 0x40,
188  0x80,
189  };
190 
194  enum McsFlags
195  {
197  0x00,
206  0x80,
207  };
208 
216  void SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs);
217 
222  {
226  0x02,
228  0x04,
232  0x20
233  };
234 
243  void SetAmpduStatus(uint32_t referenceNumber, uint16_t flags, uint8_t crc);
244 
248  enum VhtKnown
249  {
250  VHT_KNOWN_NONE = 0x0000,
251  VHT_KNOWN_STBC = 0x0001,
257  VHT_KNOWN_BEAMFORMED = 0x0020,
262  };
263 
267  enum VhtFlags
268  {
269  VHT_FLAGS_NONE = 0x00,
271  0x01,
273  0x02,
276  0x08,
278  0x10,
281  };
282 
294  void SetVhtFields(uint16_t known,
295  uint8_t flags,
296  uint8_t bandwidth,
297  uint8_t mcs_nss[4],
298  uint8_t coding,
299  uint8_t group_id,
300  uint16_t partial_aid);
301 
305  enum HeData1
306  {
319  0x0400,
320  HE_DATA1_SPTL_REUSE2_KNOWN = 0x0800,
326  };
327 
331  enum HeData2
332  {
334  HE_DATA2_GI_KNOWN = 0x0002,
344  };
345 
349  enum HeData5
350  {
361  HE_DATA5_GI_1_6 = 0x0010,
362  HE_DATA5_GI_3_2 = 0x0020,
366  HE_DATA5_TXBF = 0x4000,
368  };
369 
380  void SetHeFields(uint16_t data1,
381  uint16_t data2,
382  uint16_t data3,
383  uint16_t data4,
384  uint16_t data5,
385  uint16_t data6);
386 
391  {
403  };
404 
409  {
412  0x0004,
415  0x00f0,
417  0x0300,
419  0x0400,
421  };
422 
431  void SetHeMuFields(uint16_t flags1,
432  uint16_t flags2,
433  const std::array<uint8_t, 4>& ruChannel1,
434  const std::array<uint8_t, 4>& ruChannel2);
435 
440  {
449  };
450 
459  void SetHeMuPerUserFields(uint16_t perUser1,
460  uint16_t perUser2,
461  uint8_t perUserPosition,
462  uint8_t perUserKnown);
463 
464  private:
469  {
470  RADIOTAP_TSFT = 0x00000001,
471  RADIOTAP_FLAGS = 0x00000002,
472  RADIOTAP_RATE = 0x00000004,
473  RADIOTAP_CHANNEL = 0x00000008,
474  RADIOTAP_FHSS = 0x00000010,
476  RADIOTAP_DBM_ANTNOISE = 0x00000040,
477  RADIOTAP_LOCK_QUALITY = 0x00000080,
480  RADIOTAP_DBM_TX_POWER = 0x00000400,
481  RADIOTAP_ANTENNA = 0x00000800,
482  RADIOTAP_DB_ANTSIGNAL = 0x00001000,
483  RADIOTAP_DB_ANTNOISE = 0x00002000,
484  RADIOTAP_RX_FLAGS = 0x00004000,
485  RADIOTAP_MCS = 0x00080000,
486  RADIOTAP_AMPDU_STATUS = 0x00100000,
487  RADIOTAP_VHT = 0x00200000,
488  RADIOTAP_HE = 0x00800000,
489  RADIOTAP_HE_MU = 0x01000000,
492  RADIOTAP_LSIG = 0x08000000,
493  RADIOTAP_EXT = 0x80000000
494  };
495 
496  uint16_t m_length;
497  uint32_t m_present;
498 
499  uint64_t m_tsft;
501  uint8_t m_flags;
502  uint8_t m_rate;
503  uint8_t m_channelPad;
504  uint16_t m_channelFreq;
505  uint16_t m_channelFlags;
508  int8_t m_antennaNoise;
510 
511  uint8_t m_mcsKnown;
512  uint8_t m_mcsFlags;
513  uint8_t m_mcsRate;
514 
516  uint32_t m_ampduStatusRef;
519 
520  uint8_t m_vhtPad;
521  uint16_t m_vhtKnown;
522  uint8_t m_vhtFlags;
523  uint8_t m_vhtBandwidth;
524  uint8_t m_vhtMcsNss[4];
525  uint8_t m_vhtCoding;
526  uint8_t m_vhtGroupId;
527  uint16_t m_vhtPartialAid;
528 
529  uint8_t m_hePad;
530  uint16_t m_heData1;
531  uint16_t m_heData2;
532  uint16_t m_heData3;
533  uint16_t m_heData4;
534  uint16_t m_heData5;
535  uint16_t m_heData6;
536 
537  uint8_t m_heMuPad;
538  uint16_t m_heMuFlags1;
539  uint16_t m_heMuFlags2;
540 
542  uint16_t m_heMuPerUser1;
543  uint16_t m_heMuPerUser2;
546 };
547 
548 } // namespace ns3
549 
550 #endif /* RADIOTAP_HEADER_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Radiotap header implementation.
uint8_t m_ampduStatusCRC
A-MPDU Status Flags, delimiter CRC value.
uint8_t m_rate
TX/RX data rate in units of 500 kbps.
uint16_t m_heMuPerUser1
HE MU per_user_1 field.
uint8_t m_mcsRate
MCS Flags, mcs rate index.
uint8_t m_vhtGroupId
VHT group_id field.
uint16_t m_ampduStatusFlags
A-MPDU Status Flags, information about the received A-MPDU.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_heMuPerUserPosition
HE MU per_user_position field.
uint8_t m_ampduStatusPad
A-MPDU Status Flags, padding before A-MPDU Status Field.
void SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs)
Set the MCS fields.
ChannelFlags
Channel flags.
@ CHANNEL_FLAG_GFSK
GFSK channel (FHSS PHY)
@ CHANNEL_FLAG_TURBO
Turbo Channel.
@ CHANNEL_FLAG_DYNAMIC
Dynamic CCK-OFDM channel.
@ CHANNEL_FLAG_PASSIVE
Only passive scan allowed.
@ CHANNEL_FLAG_OFDM
OFDM channel.
@ CHANNEL_FLAG_CCK
CCK channel.
@ CHANNEL_FLAG_NONE
No flags set.
@ CHANNEL_FLAG_SPECTRUM_5GHZ
5 GHz spectrum channel
@ CHANNEL_FLAG_SPECTRUM_2GHZ
2 GHz spectrum channel
uint8_t m_mcsKnown
MCS Flags, known information field.
uint16_t m_heData4
HE data4 field.
VhtKnown
VHT known bits.
@ VHT_KNOWN_GROUP_ID
Group ID known.
@ VHT_KNOWN_NONE
No flags set.
@ VHT_KNOWN_BANDWIDTH
Bandwidth known.
@ VHT_KNOWN_STBC
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
@ VHT_KNOWN_GUARD_INTERVAL
Guard interval.
@ VHT_KNOWN_LDPC_EXTRA_OFDM_SYMBOL
LDPC extra OFDM symbol known.
@ VHT_KNOWN_PARTIAL_AID
Partial AID known/applicable.
@ VHT_KNOWN_BEAMFORMED
Beamformed known/applicable (this flag should be set to zero for MU PPDUs).
@ VHT_KNOWN_SHORT_GI_NSYM_DISAMBIGUATION
Short GI NSYM disambiguation known.
@ VHT_KNOWN_TXOP_PS_NOT_ALLOWED
TXOP_PS_NOT_ALLOWED known.
uint16_t m_vhtPartialAid
VHT partial_aid field.
uint16_t m_heMuFlags1
HE MU flags1 field.
void SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags)
Set the transmit/receive channel frequency and flags.
uint8_t m_heMuPad
HE MU padding.
@ FRAME_FLAG_FRAGMENTED
Frame sent/received with fragmentation.
@ FRAME_FLAG_BAD_FCS
Frame failed FCS check.
@ FRAME_FLAG_SHORT_PREAMBLE
Frame sent/received with short preamble.
@ FRAME_FLAG_SHORT_GUARD
Frame used short guard interval (HT)
@ FRAME_FLAG_CFP
Frame sent/received during CFP.
@ FRAME_FLAG_WEP
Frame sent/received with WEP encryption.
@ FRAME_FLAG_DATA_PADDING
Frame has padding between 802.11 header and payload (to 32-bit boundary)
@ FRAME_FLAG_FCS_INCLUDED
Frame includes FCS.
@ FRAME_FLAG_NONE
No flags set.
void Print(std::ostream &os) const override
This method is used by Packet::Print to print the content of the header as ascii data to a C++ output...
uint16_t m_heData1
HE data1 field.
uint8_t m_heMuOtherUserPad
HE MU other user padding.
uint8_t m_hePad
HE padding.
@ HE_DATA2_PRISEC_80_SEC
pri/sec 80 MHz
@ HE_DATA2_PRE_FEC_PAD_KNOWN
Pre-FEC Padding Factor known.
@ HE_DATA2_TXOP_KNOWN
TXOP known.
@ HE_DATA2_GI_KNOWN
GI known.
@ HE_DATA2_PE_DISAMBIG_KNOWN
PE Disambiguity known.
@ HE_DATA2_RU_OFFSET
RU allocation offset.
@ HE_DATA2_NUM_LTF_SYMS_KNOWN
number of LTF symbols known
@ HE_DATA2_TXBF_KNOWN
TxBF known.
@ HE_DATA2_RU_OFFSET_KNOWN
RU allocation offset known.
@ HE_DATA2_MIDAMBLE_KNOWN
midamble periodicity known
@ HE_DATA2_PRISEC_80_KNOWN
pri/sec 80 MHz known
void SetRate(uint8_t rate)
Set the transmit/receive channel frequency in units of megahertz.
uint16_t m_heMuPerUser2
HE MU per_user_2 field.
int8_t m_antennaSignal
RF signal power at the antenna, dB difference from an arbitrary, fixed reference.
void SetVhtFields(uint16_t known, uint8_t flags, uint8_t bandwidth, uint8_t mcs_nss[4], uint8_t coding, uint8_t group_id, uint16_t partial_aid)
Set the VHT fields.
void SetAntennaSignalPower(double signal)
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.
uint8_t m_vhtBandwidth
VHT bandwidth field.
void SetTsft(uint64_t tsft)
Set the Time Synchronization Function Timer (TSFT) value.
uint16_t m_length
entire length of radiotap data + header
uint16_t m_heData6
HE data6 field.
void Serialize(Buffer::Iterator start) const override
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet.
uint8_t m_vhtCoding
VHT coding field.
@ VHT_FLAGS_LDPC_EXTRA_OFDM_SYMBOL
Set if one or more users are using LDPC and the encoding process resulted in extra OFDM symbol(s)
@ VHT_FLAGS_TXOP_PS_NOT_ALLOWED
Set if STAs may not doze during TXOP (valid only for AP transmitters).
@ VHT_FLAGS_NONE
No flags set.
@ VHT_FLAGS_STBC
Set if all spatial streams of all users have space-time block coding.
@ VHT_FLAGS_BEAMFORMED
Set if beamforming is used (valid for SU PPDUs only).
@ VHT_FLAGS_GUARD_INTERVAL
Short guard interval.
@ VHT_FLAGS_SHORT_GI_NSYM_DISAMBIGUATION
Set if NSYM mod 10 = 9 (valid only if short GI is used).
void SetHeFields(uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data4, uint16_t data5, uint16_t data6)
Set the HE fields.
HeMuFlags2
HE MU flags2.
@ HE_MU_FLAGS2_BW_FROM_SIGA_KNOWN
Bandwidth from Bandwidth field in HE-SIG-A known.
@ HE_MU_FLAGS2_CH2_CENTER_26T_RU
(Channel 2) Center 26-tone RU value
@ HE_MU_FLAGS2_BW_FROM_SIGA
Bandwidth from Bandwidth field in HE-SIG-A.
@ HE_MU_FLAGS2_PREAMBLE_PUNCTURING_FROM_SIGA_BW_FIELD_KNOWN
Preamble puncturing from Bandwidth field in HE-SIG-A known.
@ HE_MU_FLAGS2_PREAMBLE_PUNCTURING_FROM_SIGA_BW_FIELD
Preamble puncturing from Bandwidth field in HE-SIG-A.
@ HE_MU_FLAGS2_SIGB_COMPRESSION_FROM_SIGA
SIG-B compression from SIG-A.
uint8_t m_vhtMcsNss[4]
VHT mcs_nss field.
uint16_t m_heData5
HE data5 field.
@ MCS_FLAGS_BANDWIDTH_20L
20L (20 MHz in lower half of 40 MHz channel)
@ MCS_FLAGS_NESS_BIT_0
Ness - bit 0 (LSB) of Number of extension spatial streams.
@ MCS_FLAGS_NONE
Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type.
@ MCS_FLAGS_STBC_STREAMS
STBC enabled.
@ MCS_FLAGS_FEC_TYPE
LDPC FEC type.
@ MCS_FLAGS_HT_GREENFIELD
Greenfield HT format.
@ MCS_FLAGS_GUARD_INTERVAL
Short guard interval.
@ MCS_FLAGS_BANDWIDTH_20U
20U (20 MHz in upper half of 40 MHz channel)
uint16_t m_channelFlags
Tx/Rx channel flags.
@ HE_DATA1_SPTL_REUSE_KNOWN
Spatial Reuse known (Spatial Reuse 1 for HE TRIG PPDU format)
@ HE_DATA1_DATA_DCM_KNOWN
data DCM known
@ HE_DATA1_CODING_KNOWN
Coding known.
@ HE_DATA1_FORMAT_TRIG
HE TRIG PPDU format.
@ HE_DATA1_STBC_KNOWN
STBC known.
@ HE_DATA1_SPTL_REUSE4_KNOWN
Spatial Reuse 4 known (HE TRIG PPDU format)
@ HE_DATA1_FORMAT_MU
HE MU PPDU format.
@ HE_DATA1_BSS_COLOR_KNOWN
BSS Color known.
@ HE_DATA1_LDPC_XSYMSEG_KNOWN
LDPC extra symbol segment known.
@ HE_DATA1_FORMAT_EXT_SU
HE EXT SU PPDU format.
@ HE_DATA1_SPTL_REUSE3_KNOWN
Spatial Reuse 3 known (HE TRIG PPDU format)
@ HE_DATA1_BEAM_CHANGE_KNOWN
Beam Change known.
@ HE_DATA1_DATA_MCS_KNOWN
data MCS known
@ HE_DATA1_SPTL_REUSE2_KNOWN
Spatial Reuse 2 known (HE TRIG PPDU format), STA-ID known (HE MU PPDU format)
@ HE_DATA1_BW_RU_ALLOC_KNOWN
data BW/RU allocation known
@ HE_DATA1_UL_DL_KNOWN
UL/DL known.
@ HE_DATA1_DOPPLER_KNOWN
Doppler known.
uint32_t m_present
bits describing which fields follow header
uint32_t m_ampduStatusRef
A-MPDU Status Flags, reference number.
void SetAmpduStatus(uint32_t referenceNumber, uint16_t flags, uint8_t crc)
Set the A-MPDU status fields.
uint16_t m_heData2
HE data2 field.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetHeMuPerUserFields(uint16_t perUser1, uint16_t perUser2, uint8_t perUserPosition, uint8_t perUserKnown)
Set the HE MU per user fields.
AmpduFlags
A-MPDU status flags.
@ A_MPDU_STATUS_IS_ZERO_LENGTH
Frame is 0-length subframe (valid only if 0x0001 is set)
@ A_MPDU_STATUS_NONE
No flags set.
@ A_MPDU_STATUS_REPORT_ZERO_LENGTH
Driver reports 0-length subframes.
@ A_MPDU_STATUS_DELIMITER_CRC_KNOWN
Delimiter CRC value known: the delimiter CRC value field is valid.
@ A_MPDU_STATUS_DELIMITER_CRC_ERROR
Delimiter CRC error.
@ A_MPDU_STATUS_LAST_KNOWN
Last subframe is known (should be set for all subframes in an A-MPDU)
@ A_MPDU_STATUS_LAST
This frame is the last subframe.
HeMuPerUserKnown
HE MU per_user_known.
@ HE_MU_PER_USER_CODING_KNOWN
Coding known.
@ HE_MU_PER_USER_POSITION_KNOWN
User field position known.
@ HE_MU_PER_USER_SPATIAL_CONFIGURATION_KNOWN
Spatial Configuration known.
@ HE_MU_PER_USER_MCS_KNOWN
MCS known.
@ HE_MU_PER_USER_TX_BF_KNOWN
Tx Beamforming known.
@ HE_MU_PER_USER_NSTS_KNOWN
NSTS known.
@ HE_MU_PER_USER_STA_ID_KNOWN
STA-ID known.
@ HE_MU_PER_USER_DCM_KNOWN
DCM known.
McsKnown
MCS known bits.
@ MCS_KNOWN_FEC_TYPE
FEC type.
@ MCS_KNOWN_GUARD_INTERVAL
Guard interval.
@ MCS_KNOWN_NONE
No flags set.
@ MCS_KNOWN_BANDWIDTH
Bandwidth.
@ MCS_KNOWN_NESS_BIT_1
Ness data - bit 1 (MSB) of Number of extension spatial streams.
@ MCS_KNOWN_HT_FORMAT
HT format.
@ MCS_KNOWN_NESS
Ness known (Number of extension spatial streams)
@ MCS_KNOWN_INDEX
MCS index known.
@ MCS_KNOWN_STBC
STBC known.
uint8_t m_mcsFlags
MCS Flags, flags field.
void SetHeMuFields(uint16_t flags1, uint16_t flags2, const std::array< uint8_t, 4 > &ruChannel1, const std::array< uint8_t, 4 > &ruChannel2)
Set the HE MU fields.
void SetAntennaNoisePower(double noise)
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
uint16_t m_heMuFlags2
HE MU flags2 field.
uint32_t GetSerializedSize() const override
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet.
HeMuFlags1
HE MU flags1.
@ HE_MU_FLAGS1_SIGB_DCM_KNOWN
SIG-B DCM known.
@ HE_MU_FLAGS1_SIGB_MCS_KNOWN
SIG-B MCS known.
@ HE_MU_FLAGS1_CH1_RUS_KNOWN
Channel 1 RUs known (which depends on BW)
@ HE_MU_FLAGS1_SIGB_DCM
SIG-B DCM (from SIG-A)
@ HE_MU_FLAGS1_CH2_RUS_KNOWN
Channel 2 RUs known (which depends on BW)
@ HE_MU_FLAGS1_CH1_CENTER_26T_RU_KNOWN
(Channel 1) Center 26-tone RU bit known
@ HE_MU_FLAGS1_CH2_CENTER_26T_RU_KNOWN
(Channel 2) Center 26-tone RU bit known
@ HE_MU_FLAGS1_CH1_CENTER_26T_RU
(Channel 1) Center 26-tone RU value
@ HE_MU_FLAGS1_SIGB_COMPRESSION_KNOWN
SIG-B Compression known.
@ HE_MU_FLAGS1_SIGB_MCS
SIG-B MCS (from SIG-A)
uint16_t m_vhtKnown
VHT known field.
uint16_t m_heData3
HE data3 field.
uint8_t m_vhtFlags
VHT flags field.
uint8_t m_channelPad
Tx/Rx channel padding.
@ HE_DATA5_PE_DISAMBIG
PE Disambiguity.
@ HE_DATA5_DATA_BW_RU_ALLOC_26T
26-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_484T
484-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_40MHZ
40 MHz data Bandwidth
@ HE_DATA5_DATA_BW_RU_ALLOC_2x996T
2x996-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_242T
242-tone RU allocation
@ HE_DATA5_NUM_LTF_SYMS
number of LTF symbols
@ HE_DATA5_DATA_BW_RU_ALLOC_52T
52-tone RU allocation
@ HE_DATA5_PRE_FEC_PAD
Pre-FEC Padding Factor.
@ HE_DATA5_LTF_SYM_SIZE
LTF symbol size.
@ HE_DATA5_DATA_BW_RU_ALLOC_160MHZ
160 MHz data Bandwidth
@ HE_DATA5_DATA_BW_RU_ALLOC_106T
106-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_996T
996-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_80MHZ
80 MHz data Bandwidth
uint8_t m_vhtPad
VHT padding.
uint16_t m_channelFreq
Tx/Rx frequency in MHz.
uint8_t m_flags
Properties of transmitted and received frames.
uint8_t m_heMuPerUserKnown
HE MU per_user_known field.
void SetFrameFlags(uint8_t flags)
Set the frame flags of the transmitted or received frame.
uint64_t m_tsft
Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC)
RadiotapFlags
Radiotap flags.
int8_t m_antennaNoise
RF noise power at the antenna, dB difference from an arbitrary, fixed reference.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.