src/wifi/model/wifi-mode.h
author Nicola Baldo <nbaldo@cttc.es>
Fri, 06 May 2011 18:34:24 +0200
changeset 7139 79dd02ed46ec
parent 6852 8f1a53d3f6ca
child 7141 072fb225b714
permissions -rw-r--r--
doxygen wifi module grouping all wifi classes
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
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    79
 * \ingroup wifi
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    80
 *
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    81
 * 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
    82
 * to lookup in a global array the characteristics of the
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    83
 * associated transmission mode. It is thus extremely cheap to
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    84
 * keep a WifiMode variable around.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    85
 */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
class WifiMode
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
 public:
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
  /**
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
   * \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
    91
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
  uint32_t GetBandwidth (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  /**
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
   * \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
    95
   *
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
   * 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
    97
   * 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
    98
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
  uint32_t GetPhyRate (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
  /**
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
   * \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
   102
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
  uint32_t GetDataRate (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
  /**
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   105
   * \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
   106
   */
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   107
  enum WifiCodeRate GetCodeRate (void) const;
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   108
  /**
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
   * \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
   110
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
  uint8_t GetConstellationSize (void) const;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   113
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   114
   * \returns a human-readable representation of this WifiMode
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   115
   * instance.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   116
   */
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
   117
  std::string GetUniqueName (void) const;
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
   118
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
  /**
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   120
   * \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
   121
   *          otherwise.
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   122
   */
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   123
  bool IsMandatory (void) const;
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   124
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   125
  /**
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
   * \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
   127
   *
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
   * 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
   129
   * 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
   130
   * should have different uids.
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
   */
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
  uint32_t GetUid (void) const;
1920
1d4864775cf8 replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1910
diff changeset
   133
6360
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
   *
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   136
   * \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
   137
   * 9.6.1) to which this WifiMode belongs.
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   138
   */
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   139
  enum WifiModulationClass GetModulationClass () const;
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   140
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   141
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   142
   * Create an invalid WifiMode. Calling any method on the
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   143
   * instance created will trigger an assert. This is useful
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   144
   * to separate the declaration of a WifiMode variable from
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   145
   * its initialization.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   146
   */
1920
1d4864775cf8 replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1910
diff changeset
   147
  WifiMode ();
3879
3a887a06b795 add a string-based constructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3094
diff changeset
   148
  WifiMode (std::string name);
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
private:
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
  friend class WifiModeFactory;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
  WifiMode (uint32_t uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
  uint32_t m_uid;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
};
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
1910
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
   155
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
   156
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
   157
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
   158
2969
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   159
/**
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   160
 * \class ns3::WifiModeValue
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   161
 * \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
   162
 */
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2582
diff changeset
   163
3094
6e787ec9c8aa ATTRIBUTE_HELPER_HEADER_2 -> ATTRIBUTE_HELPER_HEADER
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3093
diff changeset
   164
ATTRIBUTE_HELPER_HEADER (WifiMode);
1910
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
   165
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   166
/**
6372
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   167
 * 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
   168
 * 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
   169
 * 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
   170
 * 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
   171
 */
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   172
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
   173
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
   174
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6360
diff changeset
   175
/**
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   176
 * \brief create WifiMode class instances and keep track of them.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   177
 *
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   178
 * 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
   179
 * and assigns to each of them a unique integer.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   180
 */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   181
class WifiModeFactory
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   182
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
public:
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   184
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   185
   * \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
   186
   *        must be unique accross _all_ instances.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   187
   * \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
   188
   * \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
   189
   * \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
   190
   *        associated WifiMode is used.
a24cd8dce646 bug 767: Incorrect modulation for 802.11a modes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4757
diff changeset
   191
   * \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
   192
   * \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
   193
   * 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
   194
   * 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
   195
   * 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
   196
   * WIFI_CODE_RATE_UNCODED.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   197
   * \param constellationSize the order of the constellation used.
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 3879
diff changeset
   198
   *
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   199
   * Create a WifiMode.
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 3879
diff changeset
   200
   */
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   201
  static WifiMode CreateWifiMode (std::string uniqueName,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   202
                                  enum WifiModulationClass modClass,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   203
                                  bool isMandatory,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   204
                                  uint32_t bandwidth,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   205
                                  uint32_t dataRate,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   206
                                  enum WifiCodeRate codingRate,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   207
                                  uint8_t constellationSize);
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   208
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   209
private:
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   210
  friend class WifiMode;  
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2283
diff changeset
   211
  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
   212
  static WifiModeFactory *GetFactory ();
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   213
  WifiModeFactory ();
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   214
2283
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   215
  /**
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   216
   * This is the data associated to a unique WifiMode.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   217
   * 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
   218
   * in an array of WifiModeItem objects.
506fbc3c5b4a more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   219
   */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
  struct WifiModeItem {
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
    std::string uniqueUid;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
    uint32_t bandwidth;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
    uint32_t dataRate;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   224
    uint32_t phyRate;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   225
    enum WifiModulationClass modClass;
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
    uint8_t constellationSize;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   227
    enum WifiCodeRate codingRate;
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   228
    bool isMandatory;
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
  };
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   231
  WifiMode Search (std::string name);
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  uint32_t AllocateUid (std::string uniqueName);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
  WifiModeItem *Get (uint32_t uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
  typedef std::vector<struct WifiModeItem> WifiModeItemList;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
  WifiModeItemList m_itemList;
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
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
} // namespace ns3
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   241
#endif /* WIFI_MODE_H */