A Discrete-Event Network Simulator
API
radiotap-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Nicola Baldo <nbaldo@cttc.es>
19  * S├ębastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #ifndef RADIOTAP_HEADER_H
23 #define RADIOTAP_HEADER_H
24 
25 #include <ns3/header.h>
26 
27 namespace ns3 {
28 
37 class RadiotapHeader : public Header
38 {
39 public:
40  RadiotapHeader ();
45  static TypeId GetTypeId (void);
46  virtual TypeId GetInstanceTypeId (void) const;
47 
55  virtual uint32_t GetSerializedSize (void) const;
56 
65  virtual void Serialize (Buffer::Iterator start) const;
66 
76  virtual uint32_t Deserialize (Buffer::Iterator start);
77 
91  virtual void Print (std::ostream &os) const;
92 
101  void SetTsft (uint64_t tsft);
102 
107  {
109  FRAME_FLAG_CFP = 0x01,
111  FRAME_FLAG_WEP = 0x04,
117  };
118 
123  void SetFrameFlags (uint8_t flags);
124 
129  void SetRate (uint8_t rate);
130 
135  {
136  CHANNEL_FLAG_NONE = 0x0000,
138  CHANNEL_FLAG_CCK = 0x0020,
139  CHANNEL_FLAG_OFDM = 0x0040,
145  };
146 
153  void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags);
154 
162  void SetAntennaSignalPower (double signal);
163 
171  void SetAntennaNoisePower (double noise);
172 
176  enum McsKnown
177  {
178  MCS_KNOWN_NONE = 0x00,
184  MCS_KNOWN_STBC = 0x20,
185  MCS_KNOWN_NESS = 0x40,
187  };
188 
192  enum McsFlags
193  {
194  MCS_FLAGS_NONE = 0x00,
203  };
204 
212  void SetMcsFields (uint8_t known, uint8_t flags, uint8_t mcs);
213 
218  {
226  };
227 
235  void SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc);
236 
240  enum VhtKnown
241  {
242  VHT_KNOWN_NONE = 0x0000,
243  VHT_KNOWN_STBC = 0x0001,
252  };
253 
257  enum VhtFlags
258  {
259  VHT_FLAGS_NONE = 0x00,
260  VHT_FLAGS_STBC = 0x01,
266  };
267 
279  void SetVhtFields (uint16_t known, uint8_t flags,
280  uint8_t bandwidth, uint8_t mcs_nss [4],
281  uint8_t coding, uint8_t group_id,
282  uint16_t partial_aid);
283 
287  enum HeData1
288  {
306  };
307 
311  enum HeData2
312  {
314  HE_DATA2_GI_KNOWN = 0x0002,
324  };
325 
329  enum HeData5
330  {
341  HE_DATA5_GI_1_6 = 0x0010,
342  HE_DATA5_GI_3_2 = 0x0020,
346  HE_DATA5_TXBF = 0x4000,
348  };
349 
360  void SetHeFields (uint16_t data1,
361  uint16_t data2,
362  uint16_t data3,
363  uint16_t data4,
364  uint16_t data5,
365  uint16_t data6);
366 
371  {
383  };
384 
389  {
397  };
398 
407  void SetHeMuFields (uint16_t flags1, uint16_t flags2, const std::array<uint8_t, 4> &ruChannel1, const std::array<uint8_t, 4> &ruChannel2);
408 
413  {
422  };
423 
432  void SetHeMuPerUserFields (uint16_t perUser1, uint16_t perUser2, uint8_t perUserPosition, uint8_t perUserKnown);
433 
434 private:
439  {
440  RADIOTAP_TSFT = 0x00000001,
441  RADIOTAP_FLAGS = 0x00000002,
442  RADIOTAP_RATE = 0x00000004,
443  RADIOTAP_CHANNEL = 0x00000008,
444  RADIOTAP_FHSS = 0x00000010,
446  RADIOTAP_DBM_ANTNOISE = 0x00000040,
447  RADIOTAP_LOCK_QUALITY = 0x00000080,
450  RADIOTAP_DBM_TX_POWER = 0x00000400,
451  RADIOTAP_ANTENNA = 0x00000800,
452  RADIOTAP_DB_ANTSIGNAL = 0x00001000,
453  RADIOTAP_DB_ANTNOISE = 0x00002000,
454  RADIOTAP_RX_FLAGS = 0x00004000,
455  RADIOTAP_MCS = 0x00080000,
456  RADIOTAP_AMPDU_STATUS = 0x00100000,
457  RADIOTAP_VHT = 0x00200000,
458  RADIOTAP_HE = 0x00800000,
459  RADIOTAP_HE_MU = 0x01000000,
462  RADIOTAP_LSIG = 0x08000000,
463  RADIOTAP_EXT = 0x80000000
464  };
465 
466  uint16_t m_length;
467  uint32_t m_present;
468 
469  uint64_t m_tsft;
470  uint8_t m_flags;
471  uint8_t m_rate;
472  uint8_t m_channelPad;
473  uint16_t m_channelFreq;
474  uint16_t m_channelFlags;
476  int8_t m_antennaNoise;
477 
478  uint8_t m_mcsKnown;
479  uint8_t m_mcsFlags;
480  uint8_t m_mcsRate;
481 
483  uint32_t m_ampduStatusRef;
486 
487  uint8_t m_vhtPad;
488  uint16_t m_vhtKnown;
489  uint8_t m_vhtFlags;
490  uint8_t m_vhtBandwidth;
491  uint8_t m_vhtMcsNss[4];
492  uint8_t m_vhtCoding;
493  uint8_t m_vhtGroupId;
494  uint16_t m_vhtPartialAid;
495 
496  uint8_t m_hePad;
497  uint16_t m_heData1;
498  uint16_t m_heData2;
499  uint16_t m_heData3;
500  uint16_t m_heData4;
501  uint16_t m_heData5;
502  uint16_t m_heData6;
503 
504  uint8_t m_heMuPad;
505  uint16_t m_heMuFlags1;
506  uint16_t m_heMuFlags2;
507 
509  uint16_t m_heMuPerUser1;
510  uint16_t m_heMuPerUser2;
513 };
514 
515 } // namespace ns3
516 
517 #endif /* RADIOTAP_HEADER_H */
uint16_t m_heMuFlags1
HE MU flags1 field.
Protocol header serialization and deserialization.
Definition: header.h:42
Frame used short guard interval (HT)
Frame sent/received with fragmentation.
uint8_t m_channelPad
Tx/Rx channel padding.
uint8_t m_mcsKnown
MCS Flags, known information field.
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.
virtual uint32_t GetSerializedSize(void) const
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet...
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
McsKnown
MCS known bits.
Spatial Reuse known (Spatial Reuse 1 for HE TRIG PPDU format)
uint8_t m_vhtPad
VHT padding.
Beamformed known/applicable (this flag should be set to zero for MU PPDUs).
uint16_t m_heData6
HE data6 field.
uint8_t m_ampduStatusCRC
A-MPDU Status Flags, delimiter CRC value.
uint16_t m_heMuPerUser1
HE MU per_user_1 field.
Radiotap header implementation.
uint16_t m_ampduStatusFlags
A-MPDU Status Flags, information about the received A-MPDU.
uint16_t m_heData5
HE data5 field.
Set if one or more users are using LDPC and the encoding process resulted in extra OFDM symbol(s) ...
def start()
Definition: core.py:1855
HeMuPerUserKnown
HE MU per_user_known.
virtual uint32_t Deserialize(Buffer::Iterator start)
This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet...
uint16_t m_channelFreq
Tx/Rx frequency in MHz.
uint8_t m_mcsFlags
MCS Flags, flags field.
uint16_t m_heMuPerUser2
HE MU per_user_2 field.
uint8_t m_hePad
HE padding.
virtual void Print(std::ostream &os) const
This method is used by Packet::Print to print the content of the header as ascii data to a C++ output...
void SetAntennaNoisePower(double noise)
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference...
Frame sent/received with short preamble.
void SetTsft(uint64_t tsft)
Set the Time Synchronization Function Timer (TSFT) value.
FrameFlag
Frame flags.
static TypeId GetTypeId(void)
Get the type ID.
Delimiter CRC value known: the delimiter CRC value field is valid.
iterator in a Buffer instance
Definition: buffer.h:98
uint8_t m_vhtMcsNss[4]
VHT mcs_nss field.
uint8_t m_vhtCoding
VHT coding field.
ChannelFlags
Channel flags.
Preamble puncturing from Bandwidth field in HE-SIG-A.
This frame is the last subframe.
Set if NSYM mod 10 = 9 (valid only if short GI is used).
uint64_t m_tsft
Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC) ...
void SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags)
Set the transmit/receive channel frequency and flags.
VhtKnown
VHT known bits.
uint8_t m_vhtFlags
VHT flags field.
uint8_t m_mcsRate
MCS Flags, mcs rate index.
Ness - bit 0 (LSB) of Number of extension spatial streams.
int8_t m_antennaNoise
RF noise power at the antenna, dB difference from an arbitrary, fixed reference.
Partial AID known/applicable.
RadiotapFlags
Radiotap flags.
void SetHeFields(uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data4, uint16_t data5, uint16_t data6)
Set the HE fields.
uint8_t m_vhtBandwidth
VHT bandwidth field.
uint8_t m_heMuPerUserPosition
HE MU per_user_position field.
uint16_t m_channelFlags
Tx/Rx channel flags.
uint8_t m_ampduStatusPad
A-MPDU Status Flags, padding before A-MPDU Status Field.
void SetFrameFlags(uint8_t flags)
Set the frame flags of the transmitted or received frame.
Channel 2 RUs known (which depends on BW)
void SetRate(uint8_t rate)
Set the transmit/receive channel frequency in units of megahertz.
int8_t m_antennaSignal
RF signal power at the antenna, dB difference from an arbitrary, fixed reference. ...
uint16_t m_heData2
HE data2 field.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_heMuPad
HE MU padding.
void SetHeMuPerUserFields(uint16_t perUser1, uint16_t perUser2, uint8_t perUserPosition, uint8_t perUserKnown)
Set the HE MU per user fields.
uint8_t m_flags
Properties of transmitted and received frames.
Bandwidth from Bandwidth field in HE-SIG-A.
Ness data - bit 1 (MSB) of Number of extension spatial streams.
Spatial Reuse 4 known (HE TRIG PPDU format)
void SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs)
Set the MCS fields.
Set if STAs may not doze during TXOP (valid only for AP transmitters).
uint32_t m_present
bits describing which fields follow header
(Channel 1) Center 26-tone RU bit known
Ness known (Number of extension spatial streams)
uint8_t m_heMuPerUserKnown
HE MU per_user_known field.
uint8_t m_vhtGroupId
VHT group_id field.
(Channel 1) Center 26-tone RU value
Spatial Reuse 3 known (HE TRIG PPDU format)
Channel 1 RUs known (which depends on BW)
HeMuFlags1
HE MU flags1.
uint16_t m_heData4
HE data4 field.
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
uint16_t m_vhtPartialAid
VHT partial_aid field.
uint16_t m_heMuFlags2
HE MU flags2 field.
Preamble puncturing from Bandwidth field in HE-SIG-A known.
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.
Set if all spatial streams of all users have space-time block coding.
Bandwidth from Bandwidth field in HE-SIG-A known.
Frame has padding between 802.11 header and payload (to 32-bit boundary)
Frame is 0-length subframe (valid only if 0x0001 is set)
uint16_t m_vhtKnown
VHT known field.
(Channel 2) Center 26-tone RU value
20L (20 MHz in lower half of 40 MHz channel)
(Channel 2) Center 26-tone RU bit known
Last subframe is known (should be set for all subframes in an A-MPDU)
20U (20 MHz in upper half of 40 MHz channel)
uint16_t m_length
entire length of radiotap data + header
Spatial Reuse 2 known (HE TRIG PPDU format), STA-ID known (HE MU PPDU format)
Frame sent/received during CFP.
uint8_t m_heMuOtherUserPad
HE MU other user padding.
Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type.
virtual void Serialize(Buffer::Iterator start) const
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet...
uint8_t m_rate
TX/RX data rate in units of 500 kbps.
HeMuFlags2
HE MU flags2.
uint16_t m_heData3
HE data3 field.
uint16_t m_heData1
HE data1 field.
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.
a unique identifier for an interface.
Definition: type-id.h:58
Set if beamforming is used (valid for SU PPDUs only).
AmpduFlags
A-MPDU status flags.
Frame sent/received with WEP encryption.
void SetAntennaSignalPower(double signal)
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference...