00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2008 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef WIFI_HELPER_H 00021 #define WIFI_HELPER_H 00022 00023 #include <string> 00024 #include "ns3/attribute.h" 00025 #include "ns3/object-factory.h" 00026 #include "ns3/node-container.h" 00027 #include "ns3/net-device-container.h" 00028 00029 namespace ns3 { 00030 00031 class WifiPhy; 00032 class WifiNetDevice; 00033 class Node; 00034 00035 /** 00036 * \brief create PHY objects 00037 * 00038 * This base class must be implemented by new PHY implementation which wish to integrate 00039 * with the \ref ns3::WifiHelper class. 00040 */ 00041 class WifiPhyHelper 00042 { 00043 public: 00044 virtual ~WifiPhyHelper (); 00045 /** 00046 * \param node the node on which the PHY object will reside 00047 * \param device the device within which the PHY object will reside 00048 * \returns a new PHY object. 00049 * 00050 * Subclasses must implement this method to allow the ns3::WifiHelper class 00051 * to create PHY objects from ns3::WifiHelper::Install. 00052 */ 00053 virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const = 0; 00054 }; 00055 00056 /** 00057 * \brief helps to create WifiNetDevice objects 00058 * 00059 * This class can help to create a large set of similar 00060 * WifiNetDevice objects and to configure a large set of 00061 * their attributes during creation. 00062 */ 00063 class WifiHelper 00064 { 00065 public: 00066 /** 00067 * Create a Wifi helper in an empty state: all its parameters 00068 * must be set before calling ns3::WifiHelper::Install 00069 */ 00070 WifiHelper (); 00071 00072 /** 00073 * \returns a new WifiHelper in a default state 00074 * 00075 * The default state is defined as being an Adhoc MAC layer with an ARF rate control algorithm 00076 * and both objects using their default attribute values. 00077 */ 00078 static WifiHelper Default (void); 00079 00080 /** 00081 * \param type the type of ns3::WifiRemoteStationManager to create. 00082 * \param n0 the name of the attribute to set 00083 * \param v0 the value of the attribute to set 00084 * \param n1 the name of the attribute to set 00085 * \param v1 the value of the attribute to set 00086 * \param n2 the name of the attribute to set 00087 * \param v2 the value of the attribute to set 00088 * \param n3 the name of the attribute to set 00089 * \param v3 the value of the attribute to set 00090 * \param n4 the name of the attribute to set 00091 * \param v4 the value of the attribute to set 00092 * \param n5 the name of the attribute to set 00093 * \param v5 the value of the attribute to set 00094 * \param n6 the name of the attribute to set 00095 * \param v6 the value of the attribute to set 00096 * \param n7 the name of the attribute to set 00097 * \param v7 the value of the attribute to set 00098 * 00099 * All the attributes specified in this method should exist 00100 * in the requested station manager. 00101 */ 00102 void SetRemoteStationManager (std::string type, 00103 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), 00104 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), 00105 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), 00106 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), 00107 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), 00108 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), 00109 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), 00110 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); 00111 00112 /** 00113 * \param type the type of ns3::WifiMac to create. 00114 * \param n0 the name of the attribute to set 00115 * \param v0 the value of the attribute to set 00116 * \param n1 the name of the attribute to set 00117 * \param v1 the value of the attribute to set 00118 * \param n2 the name of the attribute to set 00119 * \param v2 the value of the attribute to set 00120 * \param n3 the name of the attribute to set 00121 * \param v3 the value of the attribute to set 00122 * \param n4 the name of the attribute to set 00123 * \param v4 the value of the attribute to set 00124 * \param n5 the name of the attribute to set 00125 * \param v5 the value of the attribute to set 00126 * \param n6 the name of the attribute to set 00127 * \param v6 the value of the attribute to set 00128 * \param n7 the name of the attribute to set 00129 * \param v7 the value of the attribute to set 00130 * 00131 * All the attributes specified in this method should exist 00132 * in the requested mac. 00133 */ 00134 void SetMac (std::string type, 00135 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), 00136 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), 00137 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), 00138 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), 00139 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), 00140 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), 00141 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), 00142 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); 00143 00144 /** 00145 * \param phy the PHY helper to create PHY objects 00146 * \param c the set of nodes on which a wifi device must be created 00147 * \returns a device container which contains all the devices created by this method. 00148 */ 00149 NetDeviceContainer Install (const WifiPhyHelper &phy, NodeContainer c) const; 00150 /** 00151 * \param phy the PHY helper to create PHY objects 00152 * \param node the node on which a wifi device must be created 00153 * \returns a device container which contains all the devices created by this method. 00154 */ 00155 NetDeviceContainer Install (const WifiPhyHelper &phy, Ptr<Node> node) const; 00156 00157 private: 00158 ObjectFactory m_stationManager; 00159 ObjectFactory m_mac; 00160 }; 00161 00162 } // namespace ns3 00163 00164 #endif /* WIFI_HELPER_H */