A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::RadiotapHeader Class Reference

Radiotap header implementation. More...

#include <radiotap-header.h>

+ Inheritance diagram for ns3::RadiotapHeader:
+ Collaboration diagram for ns3::RadiotapHeader:

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)
 This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. More...
 
uint8_t GetAntennaNoisePower (void) const
 Get the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference. More...
 
uint8_t GetAntennaSignalPower (void) const
 Get the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference. More...
 
uint16_t GetChannelFlags (void) const
 Get the channel flags of the transmitted or received frame. More...
 
uint16_t GetChannelFrequency (void) const
 Get the transmit/receive data rate in units of 500 kbps. More...
 
uint8_t GetFrameFlags (void) const
 Get the frame flags of the transmitted or received frame. More...
 
virtual TypeId GetInstanceTypeId (void) const
 
uint8_t GetRate (void) const
 Get the transmit/receive channel frequency in units of megahertz. More...
 
virtual uint32_t GetSerializedSize (void) const
 This method is used by Packet::AddHeader to store the header into the byte buffer of a packet. More...
 
uint64_t GetTsft (void) const
 Get the Time Synchronization Function Timer (TSFT) value. More...
 
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 stream. More...
 
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. More...
 
void SetAntennaNoisePower (double noise)
 Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference. More...
 
void SetAntennaSignalPower (double signal)
 Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference. More...
 
void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags)
 Set the transmit/receive channel frequency and flags. More...
 
void SetFrameFlags (uint8_t flags)
 Set the frame flags of the transmitted or received frame. More...
 
void SetRate (uint8_t rate)
 Set the transmit/receive channel frequency in units of megahertz. More...
 
void SetTsft (uint64_t tsft)
 Set the Time Synchronization Function Timer (TSFT) value. More...
 
- Public Member Functions inherited from ns3::Header
virtual ~Header ()
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Header
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Chunk
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

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

- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

Detailed Description

Radiotap header implementation.

Doxygen introspection did not find any typical Config paths.

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.

Warning
the radiotap header specification says that the fields included in the header should be aligned to their natural ize (e.g., 16-bit fields aligned to 16-bit boundaries, 32-bit fields aligned to 32-bit boundaries, and so on. This implementation does not enforce this. However, the radiotap specification enforces an order in which fields have to appear (if they appear), and this ordering is such that, provided you don't leave gaps, all fields will end up aligned without the need of inserting padding space. By the term "gap" I mean not using a field which would appear between two used fields. Moral: don't leave gaps, or if you do be careful about how you do it.


No Attributes are defined for this type.
No TraceSources are defined for this type.

Definition at line 48 of file radiotap-header.h.

Member Enumeration Documentation

anonymous enum
Enumerator
FRAME_FLAG_NONE 

No flags set.

FRAME_FLAG_CFP 

Frame sent/received during CFP.

FRAME_FLAG_SHORT_PREAMBLE 

Frame sent/received with short preamble.

FRAME_FLAG_WEP 

Frame sent/received with WEP encryption.

FRAME_FLAG_FRAGMENTED 

Frame sent/received with fragmentation.

FRAME_FLAG_FCS_INCLUDED 

Frame includes FCS.

FRAME_FLAG_DATA_PADDING 

Frame has padding between 802.11 header and payload (to 32-bit boundary)

FRAME_FLAG_BAD_FCS 

Frame failed FCS check.

FRAME_FLAG_SHORT_GUARD 

Frame used short guard interval (HT)

Definition at line 120 of file radiotap-header.h.

anonymous enum
Enumerator
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.

anonymous enum
private
Enumerator
RADIOTAP_TSFT 
RADIOTAP_FLAGS 
RADIOTAP_RATE 
RADIOTAP_CHANNEL 
RADIOTAP_FHSS 
RADIOTAP_DBM_ANTSIGNAL 
RADIOTAP_DBM_ANTNOISE 
RADIOTAP_LOCK_QUALITY 
RADIOTAP_TX_ATTENUATION 
RADIOTAP_DB_TX_ATTENUATION 
RADIOTAP_DBM_TX_POWER 
RADIOTAP_ANTENNA 
RADIOTAP_DB_ANTSIGNAL 
RADIOTAP_DB_ANTNOISE 
RADIOTAP_EXT 

Definition at line 227 of file radiotap-header.h.

Constructor & Destructor Documentation

ns3::RadiotapHeader::RadiotapHeader ( )

Definition at line 33 of file radiotap-header.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

void ns3::RadiotapHeader::CheckAddChannelField ( )
private
uint32_t ns3::RadiotapHeader::Deserialize ( Buffer::Iterator  start)
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.

Parameters
startAn iterator which points to where the header should written.
Returns
The number of bytes read.

Implements ns3::Header.

Definition at line 133 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().

+ Here is the call graph for this function:

uint8_t ns3::RadiotapHeader::GetAntennaNoisePower ( void  ) const

Get the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.

Returns
The RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.

Definition at line 386 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.

Returns
The RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.

Definition at line 353 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.

Returns
The frame flags.
See also
ChannelFlags.

Definition at line 320 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.

Returns
The transmit/receive data rate in units of 500 kbps.

Definition at line 313 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.

Returns
The frame flags.
See also
FrameFlags.

Definition at line 268 of file radiotap-header.cc.

References m_flags, and NS_LOG_FUNCTION.

TypeId ns3::RadiotapHeader::GetInstanceTypeId ( void  ) const
virtual
Returns
the TypeId associated to the most-derived type of this instance.

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 57 of file radiotap-header.cc.

References GetTypeId().

+ Here is the call graph for this function:

uint8_t ns3::RadiotapHeader::GetRate ( void  ) const

Get the transmit/receive channel frequency in units of megahertz.

Returns
The transmit/receive channel frequency in units of megahertz.

Definition at line 290 of file radiotap-header.cc.

References m_rate, and NS_LOG_FUNCTION.

uint32_t ns3::RadiotapHeader::GetSerializedSize ( void  ) const
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.

Returns
The expected size of the header.

Implements ns3::Header.

Definition at line 63 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.

Returns
The 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 246 of file radiotap-header.cc.

References m_tsft, and NS_LOG_FUNCTION.

TypeId ns3::RadiotapHeader::GetTypeId ( void  )
static

Definition at line 47 of file radiotap-header.cc.

References ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::RadiotapHeader::Print ( std::ostream &  os) const
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

Parameters
osThe output stream

Implements ns3::Header.

Definition at line 218 of file radiotap-header.cc.

References m_antennaNoise, m_antennaSignal, m_channelFlags, m_channelFreq, m_flags, m_rate, m_tsft, and NS_LOG_FUNCTION.

void ns3::RadiotapHeader::Serialize ( Buffer::Iterator  start) const
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.

Parameters
startAn iterator which points to where the header should be written.

Implements ns3::Header.

Definition at line 70 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().

+ Here is the call graph for this function:

void ns3::RadiotapHeader::SetAntennaNoisePower ( double  noise)

Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.

Parameters
noiseThe RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.

Definition at line 360 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().

+ Here is the caller graph for this function:

void ns3::RadiotapHeader::SetAntennaSignalPower ( double  signal)

Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.

Parameters
signalThe RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference;

Definition at line 327 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().

+ Here is the caller graph for this function:

void ns3::RadiotapHeader::SetChannelFrequencyAndFlags ( uint16_t  frequency,
uint16_t  flags 
)

Set the transmit/receive channel frequency and flags.

Parameters
frequencyThe transmit/receive data rate in units of 500 kbps.
flagsThe flags to set.
See also
ChannelFlags

Definition at line 297 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().

+ Here is the caller graph for this function:

void ns3::RadiotapHeader::SetFrameFlags ( uint8_t  flags)

Set the frame flags of the transmitted or received frame.

Parameters
flagsflags to set.

Definition at line 253 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().

+ Here is the caller graph for this function:

void ns3::RadiotapHeader::SetRate ( uint8_t  rate)

Set the transmit/receive channel frequency in units of megahertz.

Parameters
ratethe transmit/receive channel frequency in units of megahertz.

Definition at line 275 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().

+ Here is the caller graph for this function:

void ns3::RadiotapHeader::SetTsft ( uint64_t  tsft)

Set the Time Synchronization Function Timer (TSFT) value.

Valid for received frames only.

Parameters
tsftValue 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 231 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().

+ Here is the caller graph for this function:

Member Data Documentation

int8_t ns3::RadiotapHeader::m_antennaNoise
private
int8_t ns3::RadiotapHeader::m_antennaSignal
private
uint16_t ns3::RadiotapHeader::m_channelFlags
private
uint16_t ns3::RadiotapHeader::m_channelFreq
private
uint8_t ns3::RadiotapHeader::m_flags
private

Definition at line 251 of file radiotap-header.h.

Referenced by Deserialize(), GetFrameFlags(), Print(), Serialize(), and SetFrameFlags().

uint16_t ns3::RadiotapHeader::m_length
private
uint32_t ns3::RadiotapHeader::m_present
private
uint8_t ns3::RadiotapHeader::m_rate
private

Definition at line 252 of file radiotap-header.h.

Referenced by Deserialize(), GetRate(), Print(), Serialize(), and SetRate().

uint64_t ns3::RadiotapHeader::m_tsft
private

Definition at line 250 of file radiotap-header.h.

Referenced by Deserialize(), GetTsft(), Print(), Serialize(), and SetTsft().


The documentation for this class was generated from the following files: