Public Types | Public Member Functions | Static Public Member Functions

ns3::RadiotapHeader Class Reference

Radiotap header implementation. More...

#include <radiotap-header.h>

Inheritance diagram for ns3::RadiotapHeader:
Inheritance graph
[legend]
Collaboration diagram for ns3::RadiotapHeader:
Collaboration graph
[legend]

List of all members.

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 TypeId GetInstanceTypeId (void) const
virtual uint32_t GetSerializedSize (void) const
virtual void Serialize (Buffer::Iterator start) const
virtual uint32_t Deserialize (Buffer::Iterator start)
virtual void Print (std::ostream &os) const
void SetTsft (uint64_t tsft)
 Set the Time Synchronization Function Timer (TSFT) value. Valid for received frames only.
uint64_t GetTsft (void) const
 Get the Time Synchronization Function Timer (TSFT) value. Valid for received frames only.
void SetFrameFlags (uint8_t flags)
 Set the frame flags of the transmitted or received frame.
uint8_t GetFrameFlags (void) const
 Get the frame flags of the transmitted or received frame.
void SetRate (uint8_t rate)
 Set the transmit/receive channel frequency in units of megahertz.
uint8_t GetRate (void) const
 Get the transmit/receive channel frequency in units of megahertz.
void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags)
 Set the transmit/receive channel frequency and flags.
uint16_t GetChannelFrequency (void) const
 Get the transmit/receive data rate in units of 500 kbps.
uint16_t GetChannelFlags (void) const
 Get the channel flags of the transmitted or received frame.
void SetAntennaSignalPower (int8_t signal)
 Set the RF signal 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.
uint8_t GetAntennaSignalPower (void) const
 Get the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.
void SetAntennaNoisePower (int8_t noise)
 Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
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.

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::RadiotapHeader.

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.

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)

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)


Member Function Documentation

virtual 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:
start An iterator which points to where the header should written.
Returns:
The number of bytes read.

Implements ns3::Header.

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

Get the channel flags of the transmitted or received frame.

Returns:
The frame flags.
See also:
ChannelFlags.
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.
uint8_t ns3::RadiotapHeader::GetFrameFlags ( void   )  const

Get the frame flags of the transmitted or received frame.

Returns:
The frame flags.
See also:
FrameFlags.
virtual 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.

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.
virtual 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.

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.
static TypeId ns3::RadiotapHeader::GetTypeId ( void   )  [static]

This method returns the TypeId associated to ns3::RadiotapHeader.

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

Reimplemented from ns3::Header.

virtual 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:
os The output stream

Implements ns3::Header.

virtual 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:
start An iterator which points to where the header should be written.

Implements ns3::Header.

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

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

Parameters:
noise The RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
void ns3::RadiotapHeader::SetAntennaNoisePower ( int8_t  noise  ) 

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

Parameters:
noise The RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
void ns3::RadiotapHeader::SetAntennaSignalPower ( int8_t  signal  ) 

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

Parameters:
signal The RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.
void ns3::RadiotapHeader::SetAntennaSignalPower ( double  signal  ) 

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

Parameters:
signal The RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference;
void ns3::RadiotapHeader::SetChannelFrequencyAndFlags ( uint16_t  frequency,
uint16_t  flags 
)

Set the transmit/receive channel frequency and flags.

Parameters:
frequency The transmit/receive data rate in units of 500 kbps.
flags The flags to set.
See also:
ChannelFlags
void ns3::RadiotapHeader::SetFrameFlags ( uint8_t  flags  ) 

Set the frame flags of the transmitted or received frame.

Parameters:
flags flags to set.
void ns3::RadiotapHeader::SetRate ( uint8_t  rate  ) 

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

Parameters:
rate the transmit/receive channel frequency in units of megahertz.
void ns3::RadiotapHeader::SetTsft ( uint64_t  tsft  ) 

Set the Time Synchronization Function Timer (TSFT) value. Valid for received frames only.

Parameters:
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.

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