|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2010 CTTC |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Author: Nicola Baldo <nbaldo@cttc.es> |
|
19 * : Ghada Badawy <gbadawy@gmail.com> |
|
20 */ |
|
21 |
|
22 #ifndef WIFI_TX_VECTOR_H |
|
23 #define WIFI_TX_VECTOR_H |
|
24 |
|
25 #include <ns3/wifi-mode.h> |
|
26 #include <ostream> |
|
27 |
|
28 namespace ns3 { |
|
29 |
|
30 |
|
31 /** |
|
32 * This class mimics the TXVECTOR which is to be |
|
33 * passed to the PHY in order to define the parameters which are to be |
|
34 * used for a transmission. See IEEE 802.11-2007 15.2.6 "Transmit PLCP", |
|
35 * and also 15.4.4.2 "PMD_SAP peer-to-peer service primitive |
|
36 * parameters". |
|
37 * |
|
38 * \note the above reference is valid for the DSSS PHY only (clause |
|
39 * 15). TXVECTOR is defined also for the other PHYs, however they |
|
40 * don't include the TXPWRLVL explicitly in the TXVECTOR. This is |
|
41 * somewhat strange, since all PHYs actually have a |
|
42 * PMD_TXPWRLVL.request primitive. We decide to include the power |
|
43 * level in WifiTxVector for all PHYs, since it serves better our |
|
44 * purposes, and furthermore it seems close to the way real devices |
|
45 * work (e.g., madwifi). |
|
46 */ |
|
47 class WifiTxVector |
|
48 { |
|
49 public: |
|
50 WifiTxVector (); |
|
51 WifiTxVector (WifiMode m, uint8_t l, uint8_t r, bool sg, uint8_t ns, uint8_t ne, bool Stbc); |
|
52 /** |
|
53 * \returns the txvector payload mode |
|
54 */ |
|
55 WifiMode GetMode (void) const; |
|
56 /** |
|
57 * Sets the selected payload transmission mode |
|
58 */ |
|
59 void SetMode (WifiMode mode); |
|
60 /** |
|
61 * \returns the transmission power level |
|
62 */ |
|
63 uint8_t GetTxPowerLevel (void) const; |
|
64 /** |
|
65 * Sets the selected transmission power level |
|
66 */ |
|
67 void SetTxPowerLevel (uint8_t powerlevel); |
|
68 /** |
|
69 * \returns the number of retries |
|
70 */ |
|
71 uint8_t GetRetries (void) const; |
|
72 /** |
|
73 * Sets the number of retries |
|
74 */ |
|
75 void SetRetries (uint8_t retries); |
|
76 /** |
|
77 * \returns if ShortGuardInterval is used or not |
|
78 */ |
|
79 bool IsShortGuardInterval (void) const; |
|
80 /** |
|
81 * Sets if short gurad interval is being used |
|
82 */ |
|
83 void SetShortGuardInterval (bool guardinterval); |
|
84 /** |
|
85 * \returns the number of Nss |
|
86 */ |
|
87 uint8_t GetNss (void) const; |
|
88 /** |
|
89 * Sets the number of Nss refer to IEEE802.11n Table 20-28 for explanation and range |
|
90 */ |
|
91 void SetNss (uint8_t nss); |
|
92 /** |
|
93 * \returns the number of Ness |
|
94 */ |
|
95 uint8_t GetNess (void) const; |
|
96 /** |
|
97 * Sets the Ness number refer to IEEE802.11n Table 20-6 for explanation |
|
98 */ |
|
99 void SetNess (uint8_t ness); |
|
100 /** |
|
101 * \returns if STBC is used or not |
|
102 */ |
|
103 bool IsStbc (void) const; |
|
104 /** |
|
105 * Sets if STBC is being used |
|
106 */ |
|
107 void SetStbc (bool stbcsatuts); |
|
108 |
|
109 |
|
110 private: |
|
111 |
|
112 WifiMode m_mode; /**< The DATARATE parameter in Table 15-4. |
|
113 It is the value that will be passed |
|
114 to PMD_RATE.request */ |
|
115 uint8_t m_txPowerLevel; /**< The TXPWR_LEVEL parameter in Table 15-4. |
|
116 It is the value that will be passed |
|
117 to PMD_TXPWRLVL.request */ |
|
118 uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter |
|
119 for Click radiotap information */ |
|
120 bool m_shortGuardInterval; //true if short GI is going to be used |
|
121 uint8_t m_nss; //number of streams |
|
122 uint8_t m_ness; //number of stream in beamforming |
|
123 bool m_stbc; //STBC used or not |
|
124 |
|
125 }; |
|
126 |
|
127 std::ostream & operator << (std::ostream & os,const WifiTxVector &v); |
|
128 |
|
129 } // namespace ns3 |
|
130 |
|
131 #endif // WIFI_TX_VECTOR_H |