Radiotap header implementation. More...
#include <radiotap-header.h>
Public Types | |
enum | { FRAME_FLAG_NONE = 0x00, FRAME_FLAG_CFP = 0x01, FRAME_FLAG_SHORT_PREAMBLE = 0x02, FRAME_FLAG_WEP = 0x04, FRAME_FLAG_FRAGMENTED = 0x08, FRAME_FLAG_FCS_INCLUDED = 0x10, FRAME_FLAG_DATA_PADDING = 0x20, FRAME_FLAG_BAD_FCS = 0x40, FRAME_FLAG_SHORT_GUARD = 0x80 } |
enum | { CHANNEL_FLAG_NONE = 0x0000, CHANNEL_FLAG_TURBO = 0x0010, CHANNEL_FLAG_CCK = 0x0020, CHANNEL_FLAG_OFDM = 0x0040, CHANNEL_FLAG_SPECTRUM_2GHZ = 0x0080, CHANNEL_FLAG_SPECTRUM_5GHZ = 0x0100, CHANNEL_FLAG_PASSIVE = 0x0200, CHANNEL_FLAG_DYNAMIC = 0x0400, CHANNEL_FLAG_GFSK = 0x0800 } |
Public Member Functions | |
RadiotapHeader () | |
virtual uint32_t | Deserialize (Buffer::Iterator start) |
uint8_t | GetAntennaNoisePower (void) const |
Get the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference. | |
uint8_t | GetAntennaSignalPower (void) const |
Get the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference. | |
uint16_t | GetChannelFlags (void) const |
Get the channel flags of the transmitted or received frame. | |
uint16_t | GetChannelFrequency (void) const |
Get the transmit/receive data rate in units of 500 kbps. | |
uint8_t | GetFrameFlags (void) const |
Get the frame flags of the transmitted or received frame. | |
virtual TypeId | GetInstanceTypeId (void) const |
uint8_t | GetRate (void) const |
Get the transmit/receive channel frequency in units of megahertz. | |
virtual uint32_t | GetSerializedSize (void) const |
uint64_t | GetTsft (void) const |
Get the Time Synchronization Function Timer (TSFT) value. Valid for received frames only. | |
virtual void | Print (std::ostream &os) const |
virtual void | Serialize (Buffer::Iterator start) const |
void | SetAntennaNoisePower (double noise) |
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference. | |
void | SetAntennaSignalPower (double signal) |
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference. | |
void | SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags) |
Set the transmit/receive channel frequency and flags. | |
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. | |
void | SetTsft (uint64_t tsft) |
Set the Time Synchronization Function Timer (TSFT) value. Valid for received frames only. | |
![]() | |
virtual | ~Header () |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Private Types | |
enum | { RADIOTAP_TSFT = 0x00000001, RADIOTAP_FLAGS = 0x00000002, RADIOTAP_RATE = 0x00000004, RADIOTAP_CHANNEL = 0x00000008, RADIOTAP_FHSS = 0x00000010, RADIOTAP_DBM_ANTSIGNAL = 0x00000020, RADIOTAP_DBM_ANTNOISE = 0x00000040, RADIOTAP_LOCK_QUALITY = 0x00000080, RADIOTAP_TX_ATTENUATION = 0x00000100, RADIOTAP_DB_TX_ATTENUATION = 0x00000200, RADIOTAP_DBM_TX_POWER = 0x00000200, RADIOTAP_ANTENNA = 0x00000400, RADIOTAP_DB_ANTSIGNAL = 0x00000800, RADIOTAP_DB_ANTNOISE = 0x00001000, RADIOTAP_EXT = 0x10000000 } |
Private Member Functions | |
void | CheckAddChannelField () |
Private Attributes | |
int8_t | m_antennaNoise |
int8_t | m_antennaSignal |
uint16_t | m_channelFlags |
uint16_t | m_channelFreq |
uint8_t | m_flags |
uint16_t | m_length |
uint32_t | m_present |
uint8_t | m_rate |
uint64_t | m_tsft |
Additional Inherited Members | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
Radiotap header implementation.
Radiotap is a de facto standard for 802.11 frame injection and reception. The radiotap header format is a mechanism to supply additional information about frames, from the driver to userspace applications such as libpcap, and from a userspace application to the driver for transmission.
Doxygen introspection did not find any typical Config paths.
No Attributes are defined for this type.
No TraceSources are defined for this type.
Definition at line 48 of file radiotap-header.h.
anonymous enum |
Definition at line 120 of file radiotap-header.h.
anonymous enum |
CHANNEL_FLAG_NONE |
No flags set |
CHANNEL_FLAG_TURBO |
Turbo Channel |
CHANNEL_FLAG_CCK |
CCK channel |
CHANNEL_FLAG_OFDM |
OFDM channel |
CHANNEL_FLAG_SPECTRUM_2GHZ |
2 GHz spectrum channel |
CHANNEL_FLAG_SPECTRUM_5GHZ |
5 GHz spectrum channel |
CHANNEL_FLAG_PASSIVE |
Only passive scan allowed |
CHANNEL_FLAG_DYNAMIC |
Dynamic CCK-OFDM channel |
CHANNEL_FLAG_GFSK |
GFSK channel (FHSS PHY) |
Definition at line 157 of file radiotap-header.h.
|
private |
Definition at line 227 of file radiotap-header.h.
ns3::RadiotapHeader::RadiotapHeader | ( | ) |
Definition at line 32 of file radiotap-header.cc.
References NS_LOG_FUNCTION.
|
private |
|
virtual |
This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.
start | An iterator which points to where the header should written. |
Implements ns3::Header.
Definition at line 132 of file radiotap-header.cc.
References m_antennaNoise, m_antennaSignal, m_channelFlags, m_channelFreq, m_flags, m_length, m_present, m_rate, m_tsft, NS_ASSERT_MSG, NS_LOG_FUNCTION, RADIOTAP_CHANNEL, RADIOTAP_DBM_ANTNOISE, RADIOTAP_DBM_ANTSIGNAL, RADIOTAP_FHSS, RADIOTAP_FLAGS, RADIOTAP_RATE, RADIOTAP_TSFT, ns3::Buffer::Iterator::ReadU16(), ns3::Buffer::Iterator::ReadU32(), ns3::Buffer::Iterator::ReadU64(), and ns3::Buffer::Iterator::ReadU8().
uint8_t ns3::RadiotapHeader::GetAntennaNoisePower | ( | void | ) | const |
Get the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
Definition at line 385 of file radiotap-header.cc.
References m_antennaNoise, and NS_LOG_FUNCTION.
uint8_t ns3::RadiotapHeader::GetAntennaSignalPower | ( | void | ) | const |
Get the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.
Definition at line 352 of file radiotap-header.cc.
References m_antennaSignal, and NS_LOG_FUNCTION.
uint16_t ns3::RadiotapHeader::GetChannelFlags | ( | void | ) | const |
Get the channel flags of the transmitted or received frame.
Definition at line 319 of file radiotap-header.cc.
References m_channelFlags, and NS_LOG_FUNCTION.
uint16_t ns3::RadiotapHeader::GetChannelFrequency | ( | void | ) | const |
Get the transmit/receive data rate in units of 500 kbps.
Definition at line 312 of file radiotap-header.cc.
References m_channelFreq, and NS_LOG_FUNCTION.
uint8_t ns3::RadiotapHeader::GetFrameFlags | ( | void | ) | const |
Get the frame flags of the transmitted or received frame.
Definition at line 267 of file radiotap-header.cc.
References m_flags, and NS_LOG_FUNCTION.
|
virtual |
This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.
Implements ns3::ObjectBase.
Definition at line 56 of file radiotap-header.cc.
References GetTypeId().
uint8_t ns3::RadiotapHeader::GetRate | ( | void | ) | const |
Get the transmit/receive channel frequency in units of megahertz.
Definition at line 289 of file radiotap-header.cc.
References m_rate, and NS_LOG_FUNCTION.
|
virtual |
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet. This method returns the number of bytes which are needed to store the header data during a Serialize.
Implements ns3::Header.
Definition at line 62 of file radiotap-header.cc.
References m_length, and NS_LOG_FUNCTION.
uint64_t ns3::RadiotapHeader::GetTsft | ( | void | ) | const |
Get the Time Synchronization Function Timer (TSFT) value. Valid for received frames only.
Definition at line 245 of file radiotap-header.cc.
References m_tsft, and NS_LOG_FUNCTION.
|
static |
Reimplemented from ns3::Header.
Definition at line 46 of file radiotap-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
virtual |
This method is used by Packet::Print to print the content of the header as ascii data to a C++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace.
eg: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
os | The output stream |
Implements ns3::Header.
Definition at line 217 of file radiotap-header.cc.
References m_antennaNoise, m_antennaSignal, m_channelFlags, m_channelFreq, m_flags, m_rate, m_tsft, and NS_LOG_FUNCTION.
|
virtual |
This method is used by Packet::AddHeader to store the header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.
start | An iterator which points to where the header should be written. |
Implements ns3::Header.
Definition at line 69 of file radiotap-header.cc.
References m_antennaNoise, m_antennaSignal, m_channelFlags, m_channelFreq, m_flags, m_length, m_present, m_rate, m_tsft, NS_LOG_FUNCTION, RADIOTAP_CHANNEL, RADIOTAP_DBM_ANTNOISE, RADIOTAP_DBM_ANTSIGNAL, RADIOTAP_FLAGS, RADIOTAP_RATE, RADIOTAP_TSFT, ns3::Buffer::Iterator::WriteU16(), ns3::Buffer::Iterator::WriteU32(), ns3::Buffer::Iterator::WriteU64(), and ns3::Buffer::Iterator::WriteU8().
void ns3::RadiotapHeader::SetAntennaNoisePower | ( | double | noise | ) |
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
noise | The RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference. |
Definition at line 359 of file radiotap-header.cc.
References m_antennaNoise, m_length, m_present, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RADIOTAP_DBM_ANTNOISE.
Referenced by ns3::PcapSniffRxEvent().
void ns3::RadiotapHeader::SetAntennaSignalPower | ( | double | signal | ) |
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.
signal | The RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference; |
Definition at line 326 of file radiotap-header.cc.
References m_antennaSignal, m_length, m_present, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RADIOTAP_DBM_ANTSIGNAL.
Referenced by ns3::PcapSniffRxEvent().
void ns3::RadiotapHeader::SetChannelFrequencyAndFlags | ( | uint16_t | frequency, |
uint16_t | flags | ||
) |
Set the transmit/receive channel frequency and flags.
frequency | The transmit/receive data rate in units of 500 kbps. |
flags | The flags to set. |
Definition at line 296 of file radiotap-header.cc.
References m_channelFlags, m_channelFreq, m_length, m_present, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RADIOTAP_CHANNEL.
Referenced by ns3::PcapSniffRxEvent(), and ns3::PcapSniffTxEvent().
void ns3::RadiotapHeader::SetFrameFlags | ( | uint8_t | flags | ) |
Set the frame flags of the transmitted or received frame.
flags | flags to set. |
Definition at line 252 of file radiotap-header.cc.
References m_flags, m_length, m_present, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RADIOTAP_FLAGS.
Referenced by ns3::PcapSniffRxEvent(), and ns3::PcapSniffTxEvent().
void ns3::RadiotapHeader::SetRate | ( | uint8_t | rate | ) |
Set the transmit/receive channel frequency in units of megahertz.
rate | the transmit/receive channel frequency in units of megahertz. |
Definition at line 274 of file radiotap-header.cc.
References m_length, m_present, m_rate, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RADIOTAP_RATE.
Referenced by ns3::PcapSniffRxEvent(), and ns3::PcapSniffTxEvent().
void ns3::RadiotapHeader::SetTsft | ( | uint64_t | tsft | ) |
Set the Time Synchronization Function Timer (TSFT) value. Valid for received frames only.
tsft | Value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC. |
Definition at line 230 of file radiotap-header.cc.
References m_length, m_present, m_tsft, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RADIOTAP_TSFT.
Referenced by ns3::PcapSniffRxEvent(), and ns3::PcapSniffTxEvent().
|
private |
Definition at line 256 of file radiotap-header.h.
Referenced by Deserialize(), GetAntennaNoisePower(), Print(), Serialize(), and SetAntennaNoisePower().
|
private |
Definition at line 255 of file radiotap-header.h.
Referenced by Deserialize(), GetAntennaSignalPower(), Print(), Serialize(), and SetAntennaSignalPower().
|
private |
Definition at line 254 of file radiotap-header.h.
Referenced by Deserialize(), GetChannelFlags(), Print(), Serialize(), and SetChannelFrequencyAndFlags().
|
private |
Definition at line 253 of file radiotap-header.h.
Referenced by Deserialize(), GetChannelFrequency(), Print(), Serialize(), and SetChannelFrequencyAndFlags().
|
private |
Definition at line 251 of file radiotap-header.h.
Referenced by Deserialize(), GetFrameFlags(), Print(), Serialize(), and SetFrameFlags().
|
private |
Definition at line 247 of file radiotap-header.h.
Referenced by Deserialize(), GetSerializedSize(), Serialize(), SetAntennaNoisePower(), SetAntennaSignalPower(), SetChannelFrequencyAndFlags(), SetFrameFlags(), SetRate(), and SetTsft().
|
private |
Definition at line 248 of file radiotap-header.h.
Referenced by Deserialize(), Serialize(), SetAntennaNoisePower(), SetAntennaSignalPower(), SetChannelFrequencyAndFlags(), SetFrameFlags(), SetRate(), and SetTsft().
|
private |
Definition at line 252 of file radiotap-header.h.
Referenced by Deserialize(), GetRate(), Print(), Serialize(), and SetRate().
|
private |
Definition at line 250 of file radiotap-header.h.
Referenced by Deserialize(), GetTsft(), Print(), Serialize(), and SetTsft().