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 
26 #include <ns3/header.h>
27 
28 namespace ns3 {
29 
38 class RadiotapHeader : public Header
39 {
40 public:
41  RadiotapHeader ();
46  static TypeId GetTypeId (void);
47  virtual TypeId GetInstanceTypeId (void) const;
48 
56  virtual uint32_t GetSerializedSize (void) const;
57 
66  virtual void Serialize (Buffer::Iterator start) const;
67 
77  virtual uint32_t Deserialize (Buffer::Iterator start);
78 
92  virtual void Print (std::ostream &os) const;
93 
102  void SetTsft (uint64_t tsft);
103 
108  {
110  FRAME_FLAG_CFP = 0x01,
112  FRAME_FLAG_WEP = 0x04,
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,
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  };
189 
193  enum McsFlags
194  {
195  MCS_FLAGS_NONE = 0x00,
204  };
205 
213  void SetMcsFields (uint8_t known, uint8_t flags, uint8_t mcs);
214 
219  {
227  };
228 
236  void SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc);
237 
241  enum VhtKnown
242  {
243  VHT_KNOWN_NONE = 0x0000,
244  VHT_KNOWN_STBC = 0x0001,
253  };
254 
258  enum VhtFlags
259  {
260  VHT_FLAGS_NONE = 0x00,
261  VHT_FLAGS_STBC = 0x01,
267  };
268 
280  void SetVhtFields (uint16_t known, uint8_t flags,
281  uint8_t bandwidth, uint8_t mcs_nss [4],
282  uint8_t coding, uint8_t group_id,
283  uint16_t partial_aid);
284 
288  enum HeData1
289  {
307  };
308 
312  enum HeData2
313  {
315  HE_DATA2_GI_KNOWN = 0x0002,
325  };
326 
330  enum HeData3
331  {
334  HE_DATA3_UL_DL = 0x0080,
335  HE_DATA3_DATA_MCS = 0x0f00,
336  HE_DATA3_DATA_DCM = 0x1000,
337  HE_DATA3_CODING = 0x2000,
339  HE_DATA3_STBC = 0x8000,
340  };
341 
345  enum HeData5
346  {
357  HE_DATA5_GI_1_6 = 0x0010,
358  HE_DATA5_GI_3_2 = 0x0020,
362  HE_DATA5_TXBF = 0x4000,
364  };
365 
374  void SetHeFields (uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data5);
375 
376 private:
381  {
382  RADIOTAP_TSFT = 0x00000001,
383  RADIOTAP_FLAGS = 0x00000002,
384  RADIOTAP_RATE = 0x00000004,
385  RADIOTAP_CHANNEL = 0x00000008,
386  RADIOTAP_FHSS = 0x00000010,
388  RADIOTAP_DBM_ANTNOISE = 0x00000040,
389  RADIOTAP_LOCK_QUALITY = 0x00000080,
392  RADIOTAP_DBM_TX_POWER = 0x00000400,
393  RADIOTAP_ANTENNA = 0x00000800,
394  RADIOTAP_DB_ANTSIGNAL = 0x00001000,
395  RADIOTAP_DB_ANTNOISE = 0x00002000,
396  RADIOTAP_RX_FLAGS = 0x00004000,
397  RADIOTAP_MCS = 0x00080000,
398  RADIOTAP_AMPDU_STATUS = 0x00100000,
399  RADIOTAP_VHT = 0x00200000,
400  RADIOTAP_HE = 0x00800000,
401  RADIOTAP_EXT = 0x10000000
402  };
403 
404  uint16_t m_length;
405  uint32_t m_present;
406 
407  uint64_t m_tsft;
408  uint8_t m_flags;
409  uint8_t m_rate;
410  uint8_t m_channelPad;
411  uint16_t m_channelFreq;
412  uint16_t m_channelFlags;
414  int8_t m_antennaNoise;
415 
416  uint8_t m_mcsKnown;
417  uint8_t m_mcsFlags;
418  uint8_t m_mcsRate;
419 
421  uint32_t m_ampduStatusRef;
424 
425  uint8_t m_vhtPad;
426  uint16_t m_vhtKnown;
427  uint8_t m_vhtFlags;
428  uint8_t m_vhtBandwidth;
429  uint8_t m_vhtMcsNss[4];
430  uint8_t m_vhtCoding;
431  uint8_t m_vhtGroupId;
432  uint16_t m_vhtPartialAid;
433 
434  uint8_t m_hePad;
435  uint16_t m_heData1;
436  uint16_t m_heData2;
437  uint16_t m_heData3;
438  uint16_t m_heData5;
439 };
440 
441 } // namespace ns3
442 
443 #endif /* RADIOTAP_HEADER_H */
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).
uint8_t m_ampduStatusCRC
A-MPDU Status Flags, delimiter CRC value.
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:1844
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.
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.
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.
uint8_t m_vhtBandwidth
VHT bandwidth 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.
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_flags
Properties of transmitted and received frames.
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
Ness known (Number of extension spatial streams)
uint8_t m_vhtGroupId
VHT group_id field.
Spatial Reuse 3 known (HE TRIG PPDU format)
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
uint16_t m_vhtPartialAid
VHT partial_aid field.
Set if all spatial streams of all users have space-time block coding.
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.
20L (20 MHz in lower half of 40 MHz channel)
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.
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.
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.
void SetHeFields(uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data5)
Set the HE 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...