LEFT | RIGHT |
(no file at all) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle. |
| 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 * Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu> |
| 19 */ |
| 20 |
| 21 #ifndef NSL_WIFI_HELPER |
| 22 #define NSL_WIFI_HELPER |
| 23 |
| 24 #include "ns3/wifi-helper.h" |
| 25 #include "ns3/trace-helper.h" |
| 26 #include "ns3/nsl-wifi-channel.h" |
| 27 #include "ns3/deprecated.h" |
| 28 |
| 29 namespace ns3 { |
| 30 |
| 31 /** |
| 32 * This class is identical to the YansWifiChannelHelper. |
| 33 */ |
| 34 class NslWifiChannelHelper |
| 35 { |
| 36 public: |
| 37 /** |
| 38 * Create a channel helper without any parameter set. The user must set |
| 39 * them all to be able to call Create later. |
| 40 */ |
| 41 NslWifiChannelHelper (); |
| 42 |
| 43 /** |
| 44 * Create a channel helper in a default working state. By default, we create |
| 45 * a channel model with a propagation delay equal to a constant, the speed of |
| 46 * light, and a propagation loss based on a log distance model with a |
| 47 * reference loss of 46.6777 dB at reference distance of 1m. |
| 48 */ |
| 49 static NslWifiChannelHelper Default (void); |
| 50 |
| 51 /** |
| 52 * \param name the name of the model to add |
| 53 * \param n0 the name of the attribute to set |
| 54 * \param v0 the value of the attribute to set |
| 55 * \param n1 the name of the attribute to set |
| 56 * \param v1 the value of the attribute to set |
| 57 * \param n2 the name of the attribute to set |
| 58 * \param v2 the value of the attribute to set |
| 59 * \param n3 the name of the attribute to set |
| 60 * \param v3 the value of the attribute to set |
| 61 * \param n4 the name of the attribute to set |
| 62 * \param v4 the value of the attribute to set |
| 63 * \param n5 the name of the attribute to set |
| 64 * \param v5 the value of the attribute to set |
| 65 * \param n6 the name of the attribute to set |
| 66 * \param v6 the value of the attribute to set |
| 67 * \param n7 the name of the attribute to set |
| 68 * \param v7 the value of the attribute to set |
| 69 * |
| 70 * Add a propagation loss model to the set of currently-configured loss |
| 71 * models. This method is additive to allow you to construct complex |
| 72 * propagation loss models such as a log distance + jakes model, etc. |
| 73 */ |
| 74 void AddPropagationLoss (std::string name, |
| 75 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
| 76 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
| 77 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
| 78 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
| 79 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
| 80 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
| 81 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
| 82 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
| 83 /** |
| 84 * \param name the name of the model to set |
| 85 * \param n0 the name of the attribute to set |
| 86 * \param v0 the value of the attribute to set |
| 87 * \param n1 the name of the attribute to set |
| 88 * \param v1 the value of the attribute to set |
| 89 * \param n2 the name of the attribute to set |
| 90 * \param v2 the value of the attribute to set |
| 91 * \param n3 the name of the attribute to set |
| 92 * \param v3 the value of the attribute to set |
| 93 * \param n4 the name of the attribute to set |
| 94 * \param v4 the value of the attribute to set |
| 95 * \param n5 the name of the attribute to set |
| 96 * \param v5 the value of the attribute to set |
| 97 * \param n6 the name of the attribute to set |
| 98 * \param v6 the value of the attribute to set |
| 99 * \param n7 the name of the attribute to set |
| 100 * \param v7 the value of the attribute to set |
| 101 * |
| 102 * Configure a propagation delay for this channel. |
| 103 */ |
| 104 void SetPropagationDelay (std::string name, |
| 105 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
| 106 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
| 107 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
| 108 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
| 109 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
| 110 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
| 111 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
| 112 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
| 113 |
| 114 /** |
| 115 * \returns a new channel |
| 116 * |
| 117 * Create a channel based on the configuration parameters set previously. |
| 118 */ |
| 119 Ptr<NslWifiChannel> Create (void) const; |
| 120 |
| 121 private: |
| 122 std::vector<ObjectFactory> m_propagationLoss; |
| 123 ObjectFactory m_propagationDelay; |
| 124 }; |
| 125 |
| 126 //----------------------------------------------------------------------------// |
| 127 |
| 128 /** |
| 129 * \brief Make it easy to create and manage NslPhy objects. This class is |
| 130 * identical to the YansWifiPhyHelper |
| 131 */ |
| 132 class NslWifiPhyHelper : public WifiPhyHelper, |
| 133 public PcapHelperForDevice, |
| 134 public AsciiTraceHelperForDevice |
| 135 { |
| 136 public: |
| 137 /** |
| 138 * Create a phy helper without any parameter set. The user must set |
| 139 * them all to be able to call Install later. |
| 140 */ |
| 141 NslWifiPhyHelper (); |
| 142 |
| 143 /** |
| 144 * Create a phy helper in a default working state. |
| 145 */ |
| 146 static NslWifiPhyHelper Default (void); |
| 147 |
| 148 /** |
| 149 * \param channel the channel to associate to this helper |
| 150 * |
| 151 * Every PHY created by a call to Install is associated to this channel. |
| 152 */ |
| 153 void SetChannel (Ptr<NslWifiChannel> channel); |
| 154 /** |
| 155 * \param channelName The name of the channel to associate to this helper |
| 156 * |
| 157 * Every PHY created by a call to Install is associated to this channel. |
| 158 */ |
| 159 void SetChannel (std::string channelName); |
| 160 /** |
| 161 * \param name the name of the attribute to set |
| 162 * \param v the value of the attribute |
| 163 * |
| 164 * Set an attribute of the underlying PHY object. |
| 165 */ |
| 166 void Set (std::string name, const AttributeValue &v); |
| 167 /** |
| 168 * \param name the name of the error rate model to set. |
| 169 * \param n0 the name of the attribute to set |
| 170 * \param v0 the value of the attribute to set |
| 171 * \param n1 the name of the attribute to set |
| 172 * \param v1 the value of the attribute to set |
| 173 * \param n2 the name of the attribute to set |
| 174 * \param v2 the value of the attribute to set |
| 175 * \param n3 the name of the attribute to set |
| 176 * \param v3 the value of the attribute to set |
| 177 * \param n4 the name of the attribute to set |
| 178 * \param v4 the value of the attribute to set |
| 179 * \param n5 the name of the attribute to set |
| 180 * \param v5 the value of the attribute to set |
| 181 * \param n6 the name of the attribute to set |
| 182 * \param v6 the value of the attribute to set |
| 183 * \param n7 the name of the attribute to set |
| 184 * \param v7 the value of the attribute to set |
| 185 * |
| 186 * Set the error rate model and its attributes to use when Install is called. |
| 187 */ |
| 188 void SetErrorRateModel (std::string name, |
| 189 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
| 190 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
| 191 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
| 192 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
| 193 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
| 194 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
| 195 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
| 196 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
| 197 |
| 198 /** |
| 199 * An enumeration of the pcap data link types (DLTs) which this helper |
| 200 * supports. See http://wiki.wireshark.org/Development/LibpcapFileFormat |
| 201 * for more information on these formats. |
| 202 */ |
| 203 enum SupportedPcapDataLinkTypes { |
| 204 DLT_IEEE802_11 = PcapHelper::DLT_IEEE802_11, /**< IEEE 802.11 Wi
reless LAN headers on packets */ |
| 205 DLT_PRISM_HEADER = PcapHelper::DLT_PRISM_HEADER, /**< Include Prism
monitor mode information */ |
| 206 DLT_IEEE802_11_RADIO = PcapHelper::DLT_IEEE802_11_RADIO /**< Include Radiot
ap link layer information */ |
| 207 }; |
| 208 |
| 209 /** |
| 210 * Set the data link type of PCAP traces to be used. This function has to be |
| 211 * called before EnablePcap(), so that the header of the pcap file can be |
| 212 * written correctly. |
| 213 * |
| 214 * \see SupportedPcapDataLinkTypes |
| 215 * |
| 216 * \param dlt The data link type of the pcap file (and packets) to be used |
| 217 */ |
| 218 void SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt); |
| 219 |
| 220 private: |
| 221 /** |
| 222 * \param node the node on which we wish to create a wifi PHY |
| 223 * \param device the device within which this PHY will be created |
| 224 * \returns a newly-created PHY object. |
| 225 * |
| 226 * This method implements the pure virtual method defined in \ref ns3::WifiPhy
Helper. |
| 227 */ |
| 228 virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const; |
| 229 |
| 230 /** |
| 231 * \brief Enable pcap output the indicated net device. |
| 232 * |
| 233 * NetDevice-specific implementation mechanism for hooking the trace and |
| 234 * writing to the trace file. |
| 235 * |
| 236 * \param prefix Filename prefix to use for pcap files. |
| 237 * \param nd Net device for which you want to enable tracing. |
| 238 * \param promiscuous If true capture all possible packets available at the de
vice. |
| 239 * \param explicitFilename Treat the prefix as an explicit filename if true |
| 240 */ |
| 241 virtual void EnablePcapInternal (std::string prefix, |
| 242 Ptr<NetDevice> nd, |
| 243 bool promiscuous, |
| 244 bool explicitFilename); |
| 245 |
| 246 /** |
| 247 * \brief Enable ascii trace output on the indicated net device. |
| 248 * \internal |
| 249 * |
| 250 * NetDevice-specific implementation mechanism for hooking the trace and |
| 251 * writing to the trace file. |
| 252 * |
| 253 * \param stream The output stream object to use when logging ascii traces. |
| 254 * \param prefix Filename prefix to use for ascii trace files. |
| 255 * \param nd Net device for which you want to enable tracing. |
| 256 */ |
| 257 virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream, |
| 258 std::string prefix, |
| 259 Ptr<NetDevice> nd, |
| 260 bool explicitFilename); |
| 261 |
| 262 ObjectFactory m_phy; |
| 263 ObjectFactory m_errorRateModel; |
| 264 Ptr<NslWifiChannel> m_channel; |
| 265 uint32_t m_pcapDlt; |
| 266 }; |
| 267 |
| 268 } // namespace ns3 |
| 269 |
| 270 #endif /* NSL_WIFI_HELPER */ |
LEFT | RIGHT |