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 
112  uint64_t GetTsft (void) const;
113 
118  {
120  FRAME_FLAG_CFP = 0x01,
122  FRAME_FLAG_WEP = 0x04,
128  };
129 
134  void SetFrameFlags (uint8_t flags);
135 
141  uint8_t GetFrameFlags (void) const;
142 
147  void SetRate (uint8_t rate);
148 
153  uint8_t GetRate (void) const;
154 
159  {
160  CHANNEL_FLAG_NONE = 0x0000,
162  CHANNEL_FLAG_CCK = 0x0020,
163  CHANNEL_FLAG_OFDM = 0x0040,
169  };
170 
177  void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags);
178 
183  uint16_t GetChannelFrequency (void) const;
184 
190  uint16_t GetChannelFlags (void) const;
191 
199  void SetAntennaSignalPower (double signal);
200 
208  uint8_t GetAntennaSignalPower (void) const;
209 
217  void SetAntennaNoisePower (double noise);
218 
226  uint8_t GetAntennaNoisePower (void) const;
227 
231  enum McsKnown
232  {
233  MCS_KNOWN_NONE = 0x00,
239  MCS_KNOWN_STBC = 0x20,
240  MCS_KNOWN_NESS = 0x40,
242  };
243 
247  enum McsFlags
248  {
249  MCS_FLAGS_NONE = 0x00,
258  };
259 
267  void SetMcsFields (uint8_t known, uint8_t flags, uint8_t mcs);
268 
274  uint8_t GetMcsKnown (void) const;
280  uint8_t GetMcsFlags (void) const;
286  uint8_t GetMcsRate (void) const;
287 
292  {
300  };
301 
309  void SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc);
310 
316  uint32_t GetAmpduStatusRef (void) const;
322  uint16_t GetAmpduStatusFlags (void) const;
323 
327  enum VhtKnown
328  {
329  VHT_KNOWN_NONE = 0x0000,
330  VHT_KNOWN_STBC = 0x0001,
339  };
340 
344  enum VhtFlags
345  {
346  VHT_FLAGS_NONE = 0x00,
347  VHT_FLAGS_STBC = 0x01,
353  };
354 
366  void SetVhtFields (uint16_t known, uint8_t flags,
367  uint8_t bandwidth, uint8_t mcs_nss [4],
368  uint8_t coding, uint8_t group_id,
369  uint16_t partial_aid);
370 
376  uint16_t GetVhtKnown (void) const;
382  uint8_t GetVhtFlags (void) const;
388  uint8_t GetVhtBandwidth (void) const;
394  uint8_t GetVhtMcsNssUser1 () const;
400  uint8_t GetVhtMcsNssUser2 () const;
406  uint8_t GetVhtMcsNssUser3 () const;
412  uint8_t GetVhtMcsNssUser4 () const;
418  uint8_t GetVhtCoding (void) const;
424  uint8_t GetVhtGroupId (void) const;
430  uint8_t GetVhtPartialAid (void) const;
431 
432 
433 private:
438  {
439  RADIOTAP_TSFT = 0x00000001,
440  RADIOTAP_FLAGS = 0x00000002,
441  RADIOTAP_RATE = 0x00000004,
442  RADIOTAP_CHANNEL = 0x00000008,
443  RADIOTAP_FHSS = 0x00000010,
445  RADIOTAP_DBM_ANTNOISE = 0x00000040,
446  RADIOTAP_LOCK_QUALITY = 0x00000080,
449  RADIOTAP_DBM_TX_POWER = 0x00000400,
450  RADIOTAP_ANTENNA = 0x00000800,
451  RADIOTAP_DB_ANTSIGNAL = 0x00001000,
452  RADIOTAP_DB_ANTNOISE = 0x00002000,
453  RADIOTAP_RX_FLAGS = 0x00004000,
454  RADIOTAP_MCS = 0x00080000,
455  RADIOTAP_AMPDU_STATUS = 0x00100000,
456  RADIOTAP_VHT = 0x00200000,
457  RADIOTAP_EXT = 0x10000000
458  };
459 
460  uint16_t m_length;
461  uint32_t m_present;
462 
463  uint64_t m_tsft;
464  uint8_t m_flags;
465  uint8_t m_rate;
466  uint8_t m_channelPad;
467  uint16_t m_channelFreq;
468  uint16_t m_channelFlags;
470  int8_t m_antennaNoise;
471 
472  uint8_t m_mcsKnown;
473  uint8_t m_mcsFlags;
474  uint8_t m_mcsRate;
475 
477  uint32_t m_ampduStatusRef;
480 
481  uint8_t m_vhtPad;
482  uint16_t m_vhtKnown;
483  uint8_t m_vhtFlags;
484  uint8_t m_vhtBandwidth;
485  uint8_t m_vhtMcsNss[4];
486  uint8_t m_vhtCoding;
487  uint8_t m_vhtGroupId;
488  uint16_t m_vhtPartialAid;
489 };
490 
491 } // namespace ns3
492 
493 #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.
uint16_t GetVhtKnown(void) const
Get the VHT known bitmap.
McsKnown
MCS known bits.
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.
uint64_t GetTsft(void) const
Get the Time Synchronization Function Timer (TSFT) value.
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...
Set if one or more users are using LDPC and the encoding process resulted in extra OFDM symbol(s) ...
uint8_t GetRate(void) const
Get the transmit/receive channel frequency in units of megahertz.
def start()
Definition: core.py:1790
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...
virtual uint32_t GetSerializedSize(void) const
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet...
uint8_t GetVhtGroupId(void) const
Get the VHT group_id field value.
uint16_t m_channelFreq
Tx/Rx frequency in MHz.
uint8_t m_mcsFlags
MCS Flags, flags field.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint32_t GetAmpduStatusRef(void) const
Get the A-MPDU reference number.
void SetAntennaNoisePower(double noise)
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference...
uint8_t GetAntennaNoisePower(void) const
Get 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.
uint8_t GetVhtMcsNssUser3() const
Get the VHT mcs_nss field value for user 3.
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.
uint8_t GetVhtFlags(void) const
Get the VHT flags.
uint8_t GetVhtMcsNssUser4() const
Get the VHT mcs_nss field value for user 4.
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. ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t GetMcsKnown(void) const
Get the MCS known bitmap.
uint8_t GetVhtPartialAid(void) const
Get the VHT partial_aid field value.
uint8_t m_flags
Properties of transmitted and received frames.
uint8_t GetFrameFlags(void) const
Get the frame flags of the transmitted or received frame.
Ness data - bit 1 (MSB) of Number of extension spatial streams.
uint16_t GetChannelFlags(void) const
Get the channel flags of the transmitted or received frame.
void SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs)
Set the MCS fields.
uint8_t GetVhtBandwidth(void) const
Get the VHT bandwidth field value.
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.
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
uint16_t m_vhtPartialAid
VHT partial_aid field.
uint8_t GetAntennaSignalPower(void) const
Get the RF signal power at the antenna as a decibel 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.
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 GetAmpduStatusFlags(void) const
Get the A-MPDU status flags.
uint16_t m_vhtKnown
VHT known field.
20L (20 MHz in lower half of 40 MHz channel)
uint8_t GetMcsRate(void) const
Get the MCS index value.
uint8_t GetMcsFlags(void) const
Get the MCS flags.
Last subframe is known (should be set for all subframes in an A-MPDU)
uint8_t GetVhtCoding(void) const
Get the VHT coding field value.
20U (20 MHz in upper half of 40 MHz channel)
uint16_t m_length
entire length of radiotap data + header
uint8_t GetVhtMcsNssUser2() const
Get the VHT mcs_nss field value for user 2.
Frame sent/received during CFP.
Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type.
uint8_t GetVhtMcsNssUser1() const
Get the VHT mcs_nss field value for user 1.
uint8_t m_rate
TX/RX data rate in units of 500 kbps.
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...
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 GetChannelFrequency(void) const
Get the transmit/receive data rate in units of 500 kbps.
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...