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 
114  enum
115  {
117  FRAME_FLAG_CFP = 0x01,
119  FRAME_FLAG_WEP = 0x04,
125  };
126 
131  void SetFrameFlags (uint8_t flags);
132 
138  uint8_t GetFrameFlags (void) const;
139 
144  void SetRate (uint8_t rate);
145 
150  uint8_t GetRate (void) const;
151 
152  enum
153  {
154  CHANNEL_FLAG_NONE = 0x0000,
156  CHANNEL_FLAG_CCK = 0x0020,
157  CHANNEL_FLAG_OFDM = 0x0040,
163  };
164 
171  void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags);
172 
177  uint16_t GetChannelFrequency (void) const;
178 
184  uint16_t GetChannelFlags (void) const;
185 
193  void SetAntennaSignalPower (double signal);
194 
202  uint8_t GetAntennaSignalPower (void) const;
203 
211  void SetAntennaNoisePower (double noise);
212 
220  uint8_t GetAntennaNoisePower (void) const;
221 
222  enum
223  {
224  MCS_KNOWN_NONE = 0x00,
230  MCS_KNOWN_STBC = 0x20,
231  MCS_KNOWN_NESS = 0x40,
233  };
234 
235  enum
236  {
237  MCS_FLAGS_NONE = 0x00,
246  };
247 
255  void SetMcsFields (uint8_t known, uint8_t flags, uint8_t mcs);
256 
262  uint8_t GetMcsKnown (void) const;
268  uint8_t GetMcsFlags (void) const;
274  uint8_t GetMcsRate (void) const;
275 
276  enum
277  {
285  };
286 
294  void SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc);
295 
301  uint32_t GetAmpduStatusRef (void) const;
307  uint16_t GetAmpduStatusFlags (void) const;
308 
309  enum
310  {
311  VHT_KNOWN_NONE = 0x0000,
312  VHT_KNOWN_STBC = 0x0001,
321  };
322 
323  enum
324  {
325  VHT_FLAGS_NONE = 0x00,
326  VHT_FLAGS_STBC = 0x01,
332  };
333 
345  void SetVhtFields (uint16_t known, uint8_t flags,
346  uint8_t bandwidth, uint8_t mcs_nss [4],
347  uint8_t coding, uint8_t group_id,
348  uint16_t partial_aid);
349 
355  uint16_t GetVhtKnown (void) const;
361  uint8_t GetVhtFlags (void) const;
367  uint8_t GetVhtBandwidth (void) const;
373  uint8_t GetVhtMcsNssUser1 () const;
379  uint8_t GetVhtMcsNssUser2 () const;
385  uint8_t GetVhtMcsNssUser3 () const;
391  uint8_t GetVhtMcsNssUser4 () const;
397  uint8_t GetVhtCoding (void) const;
403  uint8_t GetVhtGroupId (void) const;
409  uint8_t GetVhtPartialAid (void) const;
410 
411 
412 private:
413  enum
414  {
415  RADIOTAP_TSFT = 0x00000001,
416  RADIOTAP_FLAGS = 0x00000002,
417  RADIOTAP_RATE = 0x00000004,
418  RADIOTAP_CHANNEL = 0x00000008,
419  RADIOTAP_FHSS = 0x00000010,
421  RADIOTAP_DBM_ANTNOISE = 0x00000040,
422  RADIOTAP_LOCK_QUALITY = 0x00000080,
425  RADIOTAP_DBM_TX_POWER = 0x00000400,
426  RADIOTAP_ANTENNA = 0x00000800,
427  RADIOTAP_DB_ANTSIGNAL = 0x00001000,
428  RADIOTAP_DB_ANTNOISE = 0x00002000,
429  RADIOTAP_RX_FLAGS = 0x00004000,
430  RADIOTAP_MCS = 0x00080000,
431  RADIOTAP_AMPDU_STATUS = 0x00100000,
432  RADIOTAP_VHT = 0x00200000,
433  RADIOTAP_EXT = 0x10000000
434  };
435 
436  uint16_t m_length;
437  uint32_t m_present;
438 
439  uint64_t m_tsft;
440  uint8_t m_flags;
441  uint8_t m_rate;
442  uint8_t m_channelPad;
443  uint16_t m_channelFreq;
444  uint16_t m_channelFlags;
446  int8_t m_antennaNoise;
447 
448  uint8_t m_mcsKnown;
449  uint8_t m_mcsFlags;
450  uint8_t m_mcsRate;
451 
453  uint32_t m_ampduStatusRef;
456 
457  uint8_t m_vhtPad;
458  uint16_t m_vhtKnown;
459  uint8_t m_vhtFlags;
460  uint8_t m_vhtBandwidth;
461  uint8_t m_vhtMcsNss[4];
462  uint8_t m_vhtCoding;
463  uint8_t m_vhtGroupId;
464  uint16_t m_vhtPartialAid;
465 };
466 
467 } // namespace ns3
468 
469 #endif /* RADIOTAP_HEADER_H */
Protocol header serialization and deserialization.
Definition: header.h:42
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.
uint8_t m_vhtPad
VHT padding.
Set if one or more users are using LDPC and the encoding process resulted in extra OFDM symbol(s) ...
uint8_t m_ampduStatusCRC
A-MPDU Status Flags, delimiter CRC value.
Set if beamforming is used (valid for SU PPDUs only).
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...
uint8_t GetRate(void) const
Get the transmit/receive channel frequency in units of megahertz.
def start()
Definition: core.py:1482
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.
This frame is the last subframe.
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...
void SetTsft(uint64_t tsft)
Set the Time Synchronization Function Timer (TSFT) value.
20U (20 MHz in upper half of 40 MHz channel)
Set if NSYM mod 10 = 9 (valid only if short GI is used).
static TypeId GetTypeId(void)
Get the type ID.
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.
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 sent/received with short preamble.
uint8_t GetVhtMcsNssUser3() const
Get the VHT mcs_nss field value for user 3.
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.
uint8_t m_vhtFlags
VHT flags field.
uint8_t m_mcsRate
MCS Flags, mcs rate index.
int8_t m_antennaNoise
RF noise power at the antenna, dB difference from an arbitrary, fixed reference.
uint8_t m_vhtBandwidth
VHT bandwidth field.
uint8_t GetVhtFlags(void) const
Get the VHT flags.
Ness known (Number of extension spatial streams)
uint8_t GetVhtMcsNssUser4() const
Get the VHT mcs_nss field value for user 4.
Beamformed known/applicable (this flag should be set to zero for MU PPDUs).
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.
Ness data - bit 1 (MSB) of Number of extension spatial streams.
void SetRate(uint8_t rate)
Set the transmit/receive channel frequency in units of megahertz.
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
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.
Delimiter CRC value known: the delimiter CRC value field is valid.
Frame used short guard interval (HT)
uint16_t GetChannelFlags(void) const
Get the channel flags of the transmitted or received frame.
Last subframe is known (should be set for all subframes in an A-MPDU)
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.
Partial AID known/applicable.
uint32_t m_present
bits describing which fields follow header
20L (20 MHz in lower half of 40 MHz channel)
uint8_t m_vhtGroupId
VHT group_id field.
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.
Frame is 0-length subframe (valid only if 0x0001 is set)
Frame sent/received with WEP encryption.
uint16_t GetAmpduStatusFlags(void) const
Get the A-MPDU status flags.
uint16_t m_vhtKnown
VHT known field.
uint8_t GetMcsRate(void) const
Get the MCS index value.
uint8_t GetMcsFlags(void) const
Get the MCS flags.
Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type.
uint8_t GetVhtCoding(void) const
Get the VHT coding field value.
Frame sent/received with fragmentation.
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.
uint8_t GetVhtMcsNssUser1() const
Get the VHT mcs_nss field value for user 1.
Ness - bit 0 (LSB) of Number of extension spatial streams.
uint8_t m_rate
TX/RX data rate in units of 500 kbps.
Set if STAs may not doze during TXOP (valid only for AP transmitters).
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
void SetAntennaSignalPower(double signal)
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference...