src/network/utils/radiotap-header.h
author Vedran Miletić <rivanvx@gmail.com>
Tue, 02 Aug 2011 17:42:33 -0400
changeset 7385 10beb0e53130
parent 7256 b04ba6772f8c
child 10657 6531a8817def
permissions -rw-r--r--
standardize emacs c++ mode comments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7256
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * Copyright (c) 2009 CTTC
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
 * Foundation, Include., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
 * Author: Nicola Baldo <nbaldo@cttc.es>
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
 */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
#ifndef RADIOTAP_HEADER_H
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
#define RADIOTAP_HEADER_H
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
#include <ns3/header.h> 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
namespace ns3 {
7182
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
    28
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
/**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
 * @brief Radiotap header implementation
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
 * Radiotap is a de facto standard for 802.11 frame injection and reception. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
 * The radiotap header format is a mechanism to supply additional information 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
 * about frames, from the driver to userspace applications such as libpcap, and 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
 * from a userspace application to the driver for transmission. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
 *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
 * @warning the radiotap header specification says that the fields included in
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
 * the header should be aligned to their natural ize (e.g., 16-bit fields 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
 * aligned to 16-bit boundaries, 32-bit fields aligned to 32-bit boundaries, 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
 * and so on.  This implementation does not enforce this.  However, the radiotap
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
 * specification enforces an order in which fields have to appear (if they 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
 * appear), and this ordering is such that, provided you don't leave gaps, all
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
 * fields will end up aligned without the need of inserting padding space.  By 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
 * the term "gap" I mean not using a field which would appear between two used 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
 * fields.  Moral: don't leave gaps, or if you do be careful about how you
7182
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
    46
 * do it.
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
 */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
class RadiotapHeader : public Header
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
{
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    50
public:
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
  RadiotapHeader();
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
  static TypeId GetTypeId (void);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    53
  virtual TypeId GetInstanceTypeId (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    54
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    55
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    56
   * This method is used by Packet::AddHeader to store the header into the byte
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    57
   * buffer of a packet.  This method returns the number of bytes which are 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    58
   * needed to store the header data during a Serialize.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    60
   * @returns The expected size of the header.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    61
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    62
  virtual uint32_t GetSerializedSize (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    63
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    64
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    65
   * This method is used by Packet::AddHeader to store the header into the byte
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    66
   * buffer of a packet.  The data written is expected to match bit-for-bit the 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    67
   * representation of this header in a real network.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    68
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    69
   * @param start An iterator which points to where the header should
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    70
   *              be written.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    71
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    72
  virtual void Serialize (Buffer::Iterator start) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    73
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    74
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    75
   * This method is used by Packet::RemoveHeader to re-create a header from the 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    76
   * byte buffer of a packet.  The data read is expected to match bit-for-bit 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    77
   * the representation of this header in real networks.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    78
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    79
   * @param start An iterator which points to where the header should
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    80
   *              written.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    81
   * @returns The number of bytes read.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    82
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    83
  virtual uint32_t Deserialize (Buffer::Iterator start);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    84
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    85
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    86
   * This method is used by Packet::Print to print the content of the header as 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    87
   * ascii data to a C++ output stream.  Although the header is free to format 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    88
   * its output as it wishes, it is recommended to follow a few rules to integrate
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    89
   * with the packet pretty printer: start with flags, small field 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    90
   * values located between a pair of parens. Values should be separated 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    91
   * by whitespace. Follow the parens with the important fields, 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    92
   * separated by whitespace.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    93
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    94
   * eg: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    95
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    96
   * @param os The output stream
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    98
  virtual void Print (std::ostream &os) const;
7182
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
    99
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   100
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   101
   * @brief Set the Time Synchronization Function Timer (TSFT) value.  Valid for
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   102
   * received frames only. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   103
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   104
   * @param tsft Value in microseconds of the MAC's 64-bit 802.11 Time 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   105
   *             Synchronization Function timer when the first bit of the MPDU
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   106
   *             arrived at the MAC.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   107
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   108
  void SetTsft (uint64_t tsft);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   109
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   110
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   111
   * @brief Get the Time Synchronization Function Timer (TSFT) value.  Valid for
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   112
   * received frames only. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   113
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   114
   * @returns The value in microseconds of the MAC's 64-bit 802.11 Time 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   115
   *          Synchronization Function timer when the first bit of the MPDU
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   116
   *          arrived at the MAC.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   117
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   118
  uint64_t GetTsft (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   119
6041
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   120
  enum {
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   121
    FRAME_FLAG_NONE           = 0x00, /**< No flags set */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   122
    FRAME_FLAG_CFP            = 0x01, /**< Frame sent/received during CFP */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   123
    FRAME_FLAG_SHORT_PREAMBLE = 0x02, /**< Frame sent/received with short preamble */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   124
    FRAME_FLAG_WEP            = 0x04, /**< Frame sent/received with WEP encryption */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   125
    FRAME_FLAG_FRAGMENTED     = 0x08, /**< Frame sent/received with fragmentation */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   126
    FRAME_FLAG_FCS_INCLUDED   = 0x10, /**< Frame includes FCS */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   127
    FRAME_FLAG_DATA_PADDING   = 0x20, /**< Frame has padding between 802.11 header and payload (to 32-bit boundary) */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   128
    FRAME_FLAG_BAD_FCS        = 0x40, /**< Frame failed FCS check */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   129
    FRAME_FLAG_SHORT_GUARD    = 0x80  /**< Frame used short guard interval (HT) */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   130
  };
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   131
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   132
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   133
   * @brief Set the frame flags of the transmitted or received frame.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   134
   * @param flags flags to set.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   135
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   136
  void SetFrameFlags (uint8_t flags);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   137
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   138
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   139
   * @brief Get the frame flags of the transmitted or received frame.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   140
   * @returns The frame flags.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   141
   * @see FrameFlags.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   142
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   143
  uint8_t GetFrameFlags (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   144
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   145
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   146
   * @brief Set the transmit/receive channel frequency in units of megahertz
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   147
   * @param rate the transmit/receive channel frequency in units of megahertz.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   148
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   149
  void SetRate (uint8_t rate);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   150
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   151
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   152
   * @brief Get the transmit/receive channel frequency in units of megahertz.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   153
   * @returns The transmit/receive channel frequency in units of megahertz.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   154
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   155
  uint8_t GetRate (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   156
6041
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   157
  enum {
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   158
    CHANNEL_FLAG_NONE          = 0x0000, /**< No flags set */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   159
    CHANNEL_FLAG_TURBO         = 0x0010, /**< Turbo Channel */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   160
    CHANNEL_FLAG_CCK           = 0x0020, /**< CCK channel */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   161
    CHANNEL_FLAG_OFDM          = 0x0040, /**< OFDM channel */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   162
    CHANNEL_FLAG_SPECTRUM_2GHZ = 0x0080, /**< 2 GHz spectrum channel */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   163
    CHANNEL_FLAG_SPECTRUM_5GHZ = 0x0100, /**< 5 GHz spectrum channel */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   164
    CHANNEL_FLAG_PASSIVE       = 0x0200, /**< Only passive scan allowed */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   165
    CHANNEL_FLAG_DYNAMIC       = 0x0400, /**< Dynamic CCK-OFDM channel */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   166
    CHANNEL_FLAG_GFSK          = 0x0800  /**< GFSK channel (FHSS PHY) */
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   167
  };
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   168
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   169
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   170
   * @brief Set the transmit/receive channel frequency and flags
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   171
   * @param frequency The transmit/receive data rate in units of 500 kbps.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   172
   * @param flags The flags to set.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   173
   * @see ChannelFlags
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   174
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   175
  void SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   176
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   177
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   178
   * @brief Get the transmit/receive data rate in units of 500 kbps.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   179
   * @returns The transmit/receive data rate in units of 500 kbps.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   180
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   181
  uint16_t GetChannelFrequency (void) const;
7182
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   182
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   183
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   184
   * @brief Get the channel flags of the transmitted or received frame.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   185
   * @returns The frame flags.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   186
   * @see ChannelFlags.
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   187
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   188
  uint16_t GetChannelFlags (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   189
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   190
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   191
   * @brief Set the RF signal power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   192
   * from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   193
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   194
   * @param signal The RF signal power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   195
   *               from an arbitrary, fixed reference;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   196
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   197
  void SetAntennaSignalPower (double signal);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   198
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   199
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   200
   * @brief Get the RF signal power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   201
   * from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   202
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   203
   * @returns The RF signal power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   204
   *          from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   205
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   206
  uint8_t GetAntennaSignalPower (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   207
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   208
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   209
   * @brief Set the RF noise power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   210
   * from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   211
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   212
   * @param noise The RF noise power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   213
   *              from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   214
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   215
  void SetAntennaNoisePower (double noise);
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   216
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   217
  /**
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   218
   * @brief Get the RF noise power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   219
   * from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   220
   *
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   221
   * @returns The RF noise power at the antenna as a decibel difference
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   222
   *          from an arbitrary, fixed reference. 
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   223
   */
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   224
  uint8_t GetAntennaNoisePower (void) const;
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   225
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   226
private:
6041
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   227
  enum {
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   228
    RADIOTAP_TSFT              = 0x00000001,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   229
    RADIOTAP_FLAGS             = 0x00000002,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   230
    RADIOTAP_RATE              = 0x00000004,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   231
    RADIOTAP_CHANNEL           = 0x00000008,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   232
    RADIOTAP_FHSS              = 0x00000010,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   233
    RADIOTAP_DBM_ANTSIGNAL     = 0x00000020,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   234
    RADIOTAP_DBM_ANTNOISE      = 0x00000040,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   235
    RADIOTAP_LOCK_QUALITY      = 0x00000080,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   236
    RADIOTAP_TX_ATTENUATION    = 0x00000100,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   237
    RADIOTAP_DB_TX_ATTENUATION = 0x00000200,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   238
    RADIOTAP_DBM_TX_POWER      = 0x00000200,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   239
    RADIOTAP_ANTENNA           = 0x00000400,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   240
    RADIOTAP_DB_ANTSIGNAL      = 0x00000800,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   241
    RADIOTAP_DB_ANTNOISE       = 0x00001000,
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   242
    RADIOTAP_EXT               = 0x10000000
b65c6d6794f8 Review feedback
Craig Dowell <craigdo@ee.washington.edu>
parents: 6009
diff changeset
   243
  };
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   244
 
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7182
diff changeset
   245
  void CheckAddChannelField ();
7182
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   246
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   247
  uint16_t m_length;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   248
  uint32_t m_present;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   249
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   250
  uint64_t m_tsft;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   251
  uint8_t m_flags;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   252
  uint8_t m_rate;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   253
  uint16_t m_channelFreq;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   254
  uint16_t m_channelFlags;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   255
  int8_t m_antennaSignal;
5ecfee5d17de network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7027
diff changeset
   256
  int8_t m_antennaNoise;
6009
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   257
};
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   258
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   259
} // namespace ns3
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   260
e1b696a1ed28 redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   261
#endif /*  RADIOTAP_HEADER_H */