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

Radiotap header implementation. More...

#include <radiotap-header.h>

+ Inheritance 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

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. 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
 
uint64_t GetTsft (void) const
 Get the Time Synchronization Function Timer (TSFT) value. Valid for received frames only. More...
 
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. 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. Valid for received frames only. More...
 
- Public Member Functions inherited from ns3::ObjectBase
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)
 

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)
 

Detailed Description

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.

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.

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.

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.

Member Function Documentation

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

References NS_ASSERT_MSG, NS_LOG_FUNCTION, 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.

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

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

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

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

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

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

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

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

References NS_LOG_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 217 of file radiotap-header.cc.

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

References NS_LOG_FUNCTION, 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.

Parameters
noiseThe 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 NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

Set the frame flags of the transmitted or received frame.

Parameters
flagsflags to set.

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.


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