src/devices/wifi/wifi-mode.h
author Dean Armstrong <deanarm@gmail.com>
Wed, 23 Jun 2010 08:47:29 +0100
changeset 6372 0fafd9716f44
parent 6360 d8975477ff6a
permissions -rw-r--r--
Bug 853: Consider mandatory rates for Wi-Fi control responses This changeset modifies the GetControlAnswerMode() method of class WifiRemoteStationManager to correctly identify rates within the same modulation class as the received frame, and then adds a search for a suitable mandatory rate in the case where no suitable (per IEEE Std. 802.11-2007, Section 9.6) basic rate has been found. I've also taken the opportunity to "tidy" the code up a bit - primarily through renaming of variables to something more in line with the nomenclature used in the standard. Note that this change exposes issues in some of the test and example code that uses the Wi-Fi models. These issues are addressed in a following changelist.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2034
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     2
/*
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     3
 * Copyright (c) 2005,2006,2007 INRIA
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     4
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     7
 * published by the Free Software Foundation;
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     8
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    12
 * GNU General Public License for more details.
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    13
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    14
 * You should have received a copy of the GNU General Public License
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    15
 * along with this program; if not, write to the Free Software
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    17
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
    19
 */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#ifndef WIFI_MODE_H
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#define WIFI_MODE_H
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include <stdint.h>
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <string>
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include <vector>
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
    26
#include <ostream>
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2283
diff changeset
    27
#include "ns3/attribute-helper.h"
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
    28
#include "ns3/wifi-phy-standard.h"
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    32
/**
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    33
 * This enumeration defines the modulation classes per IEEE
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    34
 * 802.11-2007, Section 9.6.1, Table 9-2.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    35
 */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    36
enum WifiModulationClass {
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    37
  /** Modulation class unknown or unspecified. A WifiMode with this
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    38
  WifiModulationClass has not been properly initialised. */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    39
  WIFI_MOD_CLASS_UNKNOWN = 0,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    40
  /** Infrared (IR) (Clause 16) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    41
  WIFI_MOD_CLASS_IR,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    42
  /** Frequency-hopping spread spectrum (FHSS) PHY (Clause 14) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    43
  WIFI_MOD_CLASS_FHSS,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    44
  /** DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    45
  WIFI_MOD_CLASS_DSSS,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    46
  /** ERP-PBCC PHY (19.6) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    47
  WIFI_MOD_CLASS_ERP_PBCC,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    48
  /** DSSS-OFDM PHY (19.7) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    49
  WIFI_MOD_CLASS_DSSS_OFDM,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    50
  /** ERP-OFDM PHY (19.5) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    51
  WIFI_MOD_CLASS_ERP_OFDM,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    52
  /** OFDM PHY (Clause 17) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    53
  WIFI_MOD_CLASS_OFDM,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    54
  /** HT PHY (Clause 20) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    55
  WIFI_MOD_CLASS_HT
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    56
};
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    57
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    58
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    59
/**
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    60
 * This enumeration defines the various convolutional coding rates
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    61
 * used for the OFDM transmission modes in the IEEE 802.11
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    62
 * standard. DSSS (for example) rates which do not have an explicit
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    63
 * coding stage in their generation should have this parameter set to
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    64
 * WIFI_CODE_RATE_UNDEFINED.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    65
 */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    66
enum WifiCodeRate {
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    67
  /** No explicit coding (e.g., DSSS rates) */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    68
  WIFI_CODE_RATE_UNDEFINED,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    69
  /** Rate 3/4 */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    70
  WIFI_CODE_RATE_3_4,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    71
  /** Rate 2/3 */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    72
  WIFI_CODE_RATE_2_3,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    73
  /** Rate 1/2 */
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    74
  WIFI_CODE_RATE_1_2
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    75
};
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    76
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
    77
/**
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    78
 * \brief represent a single transmission mode
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    79
 *
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    80
 * A WifiMode is implemented by a single integer which is used
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    81
 * to lookup in a global array the characteristics of the
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    82
 * associated transmission mode. It is thus extremely cheap to
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    83
 * keep a WifiMode variable around.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    84
 */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
class WifiMode
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
 public:
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
  /**
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
   * \returns the number of Hz used by this signal
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
  uint32_t GetBandwidth (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
  /**
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
   * \returns the physical bit rate of this signal.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
   *
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
   * If a transmission mode uses 1/2 FEC, and if its
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
   * data rate is 3Mbs, the phy rate is 6Mbs
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
  uint32_t GetPhyRate (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
  /**
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
   * \returns the data bit rate of this signal.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
  uint32_t GetDataRate (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
  /**
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   104
   * \returns the coding rate of this transmission mode
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
   */
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   106
  enum WifiCodeRate GetCodeRate (void) const;
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   107
  /**
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
   * \returns the size of the modulation constellation.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
  uint8_t GetConstellationSize (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   112
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   113
   * \returns a human-readable representation of this WifiMode
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   114
   * instance.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   115
   */
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
   116
  std::string GetUniqueName (void) const;
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
   117
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
  /**
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   119
   * \returns true if this mode is a mandatory mode, false
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   120
   *          otherwise.
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   121
   */
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   122
  bool IsMandatory (void) const;
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   123
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   124
  /**
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
   * \returns the uid associated to this wireless mode.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
   *
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
   * Each specific wireless mode should have a different uid.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
   * For example, the 802.11b 1Mbs and the 802.11b 2Mbs modes
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
   * should have different uids.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
  uint32_t GetUid (void) const;
1920
1d4864775cf8 replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1910
diff changeset
   132
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   133
  /**
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   134
   *
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   135
   * \returns the Modulation Class (see IEEE 802.11-2007 Section
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   136
   * 9.6.1) to which this WifiMode belongs.
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   137
   */
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   138
  enum WifiModulationClass GetModulationClass () const;
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   139
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   140
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   141
   * Create an invalid WifiMode. Calling any method on the
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   142
   * instance created will trigger an assert. This is useful
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   143
   * to separate the declaration of a WifiMode variable from
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   144
   * its initialization.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   145
   */
1920
1d4864775cf8 replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1910
diff changeset
   146
  WifiMode ();
3879
3a887a06b795 add a string-based constructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3094
diff changeset
   147
  WifiMode (std::string name);
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
private:
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
  friend class WifiModeFactory;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
  WifiMode (uint32_t uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
  uint32_t m_uid;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
};
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
1910
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
   154
bool operator == (const WifiMode &a, const WifiMode &b);
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
   155
std::ostream & operator << (std::ostream & os, const WifiMode &mode);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2283
diff changeset
   156
std::istream & operator >> (std::istream &is, WifiMode &mode);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2283
diff changeset
   157
2969
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   158
/**
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   159
 * \class ns3::WifiModeValue
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   160
 * \brief hold objects of type ns3::WifiMode
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   161
 */
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   162
3094
6e787ec9c8aa ATTRIBUTE_HELPER_HEADER_2 -> ATTRIBUTE_HELPER_HEADER
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3093
diff changeset
   163
ATTRIBUTE_HELPER_HEADER (WifiMode);
1910
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
   164
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   165
/**
6372
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   166
 * In various parts of the code, folk are interested in maintaining a
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   167
 * list of transmission modes. The vector class provides a good basis
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   168
 * for this, but we here add some syntactic sugar by defining a
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   169
 * WifiModeList type, and a corresponding iterator.
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   170
 */
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   171
typedef std::vector<WifiMode> WifiModeList;
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   172
typedef WifiModeList::const_iterator WifiModeListIterator;
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   173
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   174
/**
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   175
 * \brief create WifiMode class instances and keep track of them.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   176
 *
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   177
 * This factory ensures that each WifiMode created has a unique name
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   178
 * and assigns to each of them a unique integer.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   179
 */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   180
class WifiModeFactory
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   181
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   182
public:
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   183
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   184
   * \param uniqueName the name of the associated WifiMode. This name
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   185
   *        must be unique accross _all_ instances.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   186
   * \param modClass the class of modulation
5901
a24cd8dce646 bug 767: Incorrect modulation for 802.11a modes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4757
diff changeset
   187
   * \param isMandatory true if this WifiMode is mandatory, false otherwise.
a24cd8dce646 bug 767: Incorrect modulation for 802.11a modes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4757
diff changeset
   188
   * \param bandwidth the bandwidth (Hz) of the signal generated when the
a24cd8dce646 bug 767: Incorrect modulation for 802.11a modes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4757
diff changeset
   189
   *        associated WifiMode is used.
a24cd8dce646 bug 767: Incorrect modulation for 802.11a modes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4757
diff changeset
   190
   * \param dataRate the rate (bits/second) at which the user data is transmitted
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   191
   * \param codingRate if convolutional coding is used for this rate
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   192
   * then this parameter specifies the convolutional coding rate
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   193
   * used. If there is no explicit convolutional coding step (e.g.,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   194
   * for DSSS rates) then the caller should set this parameter to
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   195
   * WIFI_CODE_RATE_UNCODED.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   196
   * \param constellationSize the order of the constellation used.
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 3879
diff changeset
   197
   *
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   198
   * Create a WifiMode.
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 3879
diff changeset
   199
   */
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   200
  static WifiMode CreateWifiMode (std::string uniqueName,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   201
                                  enum WifiModulationClass modClass,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   202
                                  bool isMandatory,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   203
                                  uint32_t bandwidth,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   204
                                  uint32_t dataRate,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   205
                                  enum WifiCodeRate codingRate,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   206
                                  uint8_t constellationSize);
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   207
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   208
private:
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   209
  friend class WifiMode;  
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2283
diff changeset
   210
  friend std::istream & operator >> (std::istream &is, WifiMode &mode);
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   211
  static WifiModeFactory *GetFactory ();
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   212
  WifiModeFactory ();
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   213
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   214
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   215
   * This is the data associated to a unique WifiMode.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   216
   * The integer stored in a WifiMode is in fact an index
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   217
   * in an array of WifiModeItem objects.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   218
   */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   219
  struct WifiModeItem {
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
    std::string uniqueUid;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
    uint32_t bandwidth;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
    uint32_t dataRate;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
    uint32_t phyRate;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   224
    enum WifiModulationClass modClass;
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
    uint8_t constellationSize;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   226
    enum WifiCodeRate codingRate;
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   227
    bool isMandatory;
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
  };
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   230
  WifiMode Search (std::string name);
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
  uint32_t AllocateUid (std::string uniqueName);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  WifiModeItem *Get (uint32_t uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
  typedef std::vector<struct WifiModeItem> WifiModeItemList;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
  WifiModeItemList m_itemList;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
};
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   238
} // namespace ns3
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
#endif /* WIFI_MODE_H */