|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2008,2009 IITP RAS |
|
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: Kirill Andreev <andreev@iitp.ru> |
|
19 * Pavel Boyko <boyko@iitp.ru> |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef MESH_HELPER_H |
|
24 #define MESH_HELPER_H |
|
25 |
|
26 #include "ns3/wifi-helper.h" |
|
27 #include "ns3/mesh-stack-installer.h" |
|
28 |
|
29 namespace ns3 { |
|
30 |
|
31 class WifiChannel; |
|
32 |
|
33 /** |
|
34 * \ingroup dot11s |
|
35 * |
|
36 * \brief Helper to create IEEE 802.11s mesh networks |
|
37 */ |
|
38 class MeshHelper |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Construct a MeshHelper used to make life easier when creating 802.11s networks. |
|
43 */ |
|
44 MeshHelper (); |
|
45 |
|
46 /** |
|
47 * Destroy a MeshHelper. |
|
48 */ |
|
49 ~MeshHelper (); |
|
50 |
|
51 /** |
|
52 * \brief Set the helper to the default values for the MAC type, remote |
|
53 * station manager and channel policy. |
|
54 */ |
|
55 static MeshHelper Default (); |
|
56 |
|
57 /** |
|
58 * \param n0 the name of the attribute to set |
|
59 * \param v0 the value of the attribute to set |
|
60 * \param n1 the name of the attribute to set |
|
61 * \param v1 the value of the attribute to set |
|
62 * \param n2 the name of the attribute to set |
|
63 * \param v2 the value of the attribute to set |
|
64 * \param n3 the name of the attribute to set |
|
65 * \param v3 the value of the attribute to set |
|
66 * \param n4 the name of the attribute to set |
|
67 * \param v4 the value of the attribute to set |
|
68 * \param n5 the name of the attribute to set |
|
69 * \param v5 the value of the attribute to set |
|
70 * \param n6 the name of the attribute to set |
|
71 * \param v6 the value of the attribute to set |
|
72 * \param n7 the name of the attribute to set |
|
73 * \param v7 the value of the attribute to set |
|
74 * |
|
75 * All the attributes specified in this method should exist |
|
76 * in the requested mac. |
|
77 */ |
|
78 void SetMacType (std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
|
79 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
|
80 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
|
81 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
|
82 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
|
83 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
|
84 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
|
85 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
|
86 /** |
|
87 * \param type the type of ns3::WifiRemoteStationManager to create. |
|
88 * \param n0 the name of the attribute to set |
|
89 * \param v0 the value of the attribute to set |
|
90 * \param n1 the name of the attribute to set |
|
91 * \param v1 the value of the attribute to set |
|
92 * \param n2 the name of the attribute to set |
|
93 * \param v2 the value of the attribute to set |
|
94 * \param n3 the name of the attribute to set |
|
95 * \param v3 the value of the attribute to set |
|
96 * \param n4 the name of the attribute to set |
|
97 * \param v4 the value of the attribute to set |
|
98 * \param n5 the name of the attribute to set |
|
99 * \param v5 the value of the attribute to set |
|
100 * \param n6 the name of the attribute to set |
|
101 * \param v6 the value of the attribute to set |
|
102 * \param n7 the name of the attribute to set |
|
103 * \param v7 the value of the attribute to set |
|
104 * |
|
105 * All the attributes specified in this method should exist |
|
106 * in the requested station manager. |
|
107 */ |
|
108 void |
|
109 SetRemoteStationManager (std::string type, |
|
110 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
|
111 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
|
112 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
|
113 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
|
114 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
|
115 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
|
116 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
|
117 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
|
118 /** |
|
119 * Set PHY standard |
|
120 */ |
|
121 void SetStandard (enum WifiPhyStandard standard); |
|
122 //void SetMeshId (std::string s); // XXX |
|
123 /** |
|
124 * \brief Spread/not spread frequency channels of MP interfaces. |
|
125 * |
|
126 * If set to true different non-overlapping 20MHz frequency |
|
127 * channels will be assigned to different mesh point interfaces. |
|
128 */ |
|
129 enum ChannelPolicy |
|
130 { |
|
131 SPREAD_CHANNELS, |
|
132 ZERO_CHANNEL |
|
133 }; |
|
134 |
|
135 /** |
|
136 * \brief set the channel policy |
|
137 */ |
|
138 void SetSpreadInterfaceChannels (ChannelPolicy); |
|
139 /** |
|
140 * \brief Set a number of interfaces in a mesh network |
|
141 * \param nInterfaces is the number of interfaces |
|
142 */ |
|
143 void SetNumberOfInterfaces (uint32_t nInterfaces); |
|
144 |
|
145 /** |
|
146 * \brief Install 802.11s mesh device & protocols on given node list |
|
147 * |
|
148 * \param phyHelper Wifi PHY helper |
|
149 * \param c List of nodes to install |
|
150 * |
|
151 * \return list of created mesh point devices, see MeshPointDevice |
|
152 */ |
|
153 NetDeviceContainer |
|
154 Install (const WifiPhyHelper &phyHelper, NodeContainer c) const; |
|
155 /** |
|
156 * \param type the type of ns3::MeshStack. |
|
157 * \param n0 the name of the attribute to set |
|
158 * \param v0 the value of the attribute to set |
|
159 * \param n1 the name of the attribute to set |
|
160 * \param v1 the value of the attribute to set |
|
161 * \param n2 the name of the attribute to set |
|
162 * \param v2 the value of the attribute to set |
|
163 * \param n3 the name of the attribute to set |
|
164 * \param v3 the value of the attribute to set |
|
165 * \param n4 the name of the attribute to set |
|
166 * \param v4 the value of the attribute to set |
|
167 * \param n5 the name of the attribute to set |
|
168 * \param v5 the value of the attribute to set |
|
169 * \param n6 the name of the attribute to set |
|
170 * \param v6 the value of the attribute to set |
|
171 * \param n7 the name of the attribute to set |
|
172 * \param v7 the value of the attribute to set |
|
173 */ |
|
174 void SetStackInstaller (std::string type, |
|
175 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
|
176 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
|
177 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
|
178 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
|
179 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
|
180 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
|
181 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
|
182 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
|
183 |
|
184 /** |
|
185 * \brief Print statistics. |
|
186 */ |
|
187 void Report (const ns3::Ptr<ns3::NetDevice>&, std::ostream&); |
|
188 |
|
189 /** |
|
190 * \brief Reset statistics. |
|
191 */ |
|
192 void ResetStats (const ns3::Ptr<ns3::NetDevice>&); |
|
193 private: |
|
194 /** |
|
195 * \internal |
|
196 * \returns a WifiNetDevice with ready-to-use interface |
|
197 */ |
|
198 Ptr<WifiNetDevice> CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const; |
|
199 uint32_t m_nInterfaces; |
|
200 ChannelPolicy m_spreadChannelPolicy; |
|
201 Ptr<MeshStack> m_stack; |
|
202 ObjectFactory m_stackFactory; |
|
203 ///\name Interface factory |
|
204 ///\{ |
|
205 ObjectFactory m_mac; |
|
206 ObjectFactory m_stationManager; |
|
207 enum WifiPhyStandard m_standard; |
|
208 ///\} |
|
209 }; |
|
210 } //namespace ns3 |
|
211 |
|
212 #endif /* MESH_HELPER_H */ |
|
213 |