author | Tom Henderson <tomh@tomh.org> |
Fri, 24 Aug 2012 19:11:51 -0700 | |
changeset 9010 | d6cc76205833 |
parent 8992 | 4fdf03b24af6 |
child 10921 | f96c9e2b49c0 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7178
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4793 | 2 |
/* |
3 |
* Copyright (c) 2008,2009 IITP RAS |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4811
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4793 | 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 |
* |
|
4811
080b8f23fa4a
Added license information to some files.
Andrey Mazo <mazo@iitp.ru>
parents:
4796
diff
changeset
|
18 |
* Author: Kirill Andreev <andreev@iitp.ru> |
4817
1257e4b82e17
L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents:
4815
diff
changeset
|
19 |
* Pavel Boyko <boyko@iitp.ru> |
4793 | 20 |
*/ |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5081
diff
changeset
|
21 |
#include "mesh-helper.h" |
5012 | 22 |
#include "ns3/simulator.h" |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
23 |
#include "ns3/mesh-point-device.h" |
4793 | 24 |
#include "ns3/wifi-net-device.h" |
9010
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
25 |
#include "ns3/minstrel-wifi-manager.h" |
5164
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
26 |
#include "ns3/mesh-wifi-interface-mac.h" |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
27 |
namespace ns3 |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
28 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
29 |
MeshHelper::MeshHelper () : |
5163 | 30 |
m_nInterfaces (1), |
5164
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
31 |
m_spreadChannelPolicy (ZERO_CHANNEL), |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
32 |
m_stack (0), |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
33 |
m_standard (WIFI_PHY_STANDARD_80211a) |
4793 | 34 |
{ |
35 |
} |
|
5417
899604299046
plug leaks (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5164
diff
changeset
|
36 |
MeshHelper::~MeshHelper () |
899604299046
plug leaks (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5164
diff
changeset
|
37 |
{ |
899604299046
plug leaks (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5164
diff
changeset
|
38 |
m_stack = 0; |
899604299046
plug leaks (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5164
diff
changeset
|
39 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
40 |
void |
5163 | 41 |
MeshHelper::SetSpreadInterfaceChannels (enum ChannelPolicy policy) |
4937
7211ebc93e69
Add spread interfaces frequency channels option
Pavel Boyko <boyko@iitp.ru>
parents:
4932
diff
changeset
|
42 |
{ |
5163 | 43 |
m_spreadChannelPolicy = policy; |
4937
7211ebc93e69
Add spread interfaces frequency channels option
Pavel Boyko <boyko@iitp.ru>
parents:
4932
diff
changeset
|
44 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
45 |
void |
5141
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
46 |
MeshHelper::SetStackInstaller (std::string type, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
47 |
std::string n0, const AttributeValue &v0, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
48 |
std::string n1, const AttributeValue &v1, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
49 |
std::string n2, const AttributeValue &v2, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
50 |
std::string n3, const AttributeValue &v3, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
51 |
std::string n4, const AttributeValue &v4, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
52 |
std::string n5, const AttributeValue &v5, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
53 |
std::string n6, const AttributeValue &v6, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
54 |
std::string n7, const AttributeValue &v7) |
5081 | 55 |
{ |
56 |
m_stackFactory.SetTypeId (type); |
|
5141
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
57 |
m_stackFactory.Set (n0, v0); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
58 |
m_stackFactory.Set (n1, v1); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
59 |
m_stackFactory.Set (n2, v2); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
60 |
m_stackFactory.Set (n3, v3); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
61 |
m_stackFactory.Set (n4, v4); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
62 |
m_stackFactory.Set (n5, v5); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
63 |
m_stackFactory.Set (n6, v6); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
64 |
m_stackFactory.Set (n7, v7); |
22e79c2a4c5f
Added root mesh point as argument of command line
Kirill Andreev <andreev@iitp.ru>
parents:
5128
diff
changeset
|
65 |
|
5081 | 66 |
m_stack = m_stackFactory.Create<MeshStack> (); |
67 |
if (m_stack == 0) |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
68 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
69 |
NS_FATAL_ERROR ("Stack has not been created: " << type); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
70 |
} |
5081 | 71 |
} |
72 |
||
5163 | 73 |
void |
74 |
MeshHelper::SetNumberOfInterfaces (uint32_t nInterfaces) |
|
75 |
{ |
|
76 |
m_nInterfaces = nInterfaces; |
|
77 |
} |
|
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
78 |
NetDeviceContainer |
5164
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
79 |
MeshHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const |
4793 | 80 |
{ |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
81 |
NetDeviceContainer devices; |
5081 | 82 |
NS_ASSERT (m_stack != 0); |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
83 |
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
5055
903fb7d81b97
Restructured mesh - helper
Kirill Andreev <andreev@iitp.ru>
parents:
5054
diff
changeset
|
84 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
85 |
Ptr<Node> node = *i; |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
86 |
// Create a mesh point device |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
87 |
Ptr<MeshPointDevice> mp = CreateObject<MeshPointDevice> (); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
88 |
node->AddDevice (mp); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
89 |
// Create wifi interfaces (single interface by default) |
5163 | 90 |
for (uint32_t i = 0; i < m_nInterfaces; ++i) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
91 |
{ |
5164
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
92 |
uint32_t channel = 0; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
93 |
if (m_spreadChannelPolicy == ZERO_CHANNEL) |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
94 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
95 |
channel = 0; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
96 |
} |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
97 |
if (m_spreadChannelPolicy == SPREAD_CHANNELS) |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
98 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
99 |
channel = i * 5; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
100 |
} |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
101 |
Ptr<WifiNetDevice> iface = CreateInterface (phyHelper, node, channel); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
102 |
mp->AddInterface (iface); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
103 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
104 |
if (!m_stack->InstallStack (mp)) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
105 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
106 |
NS_FATAL_ERROR ("Stack is not installed!"); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
107 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
108 |
devices.Add (mp); |
5055
903fb7d81b97
Restructured mesh - helper
Kirill Andreev <andreev@iitp.ru>
parents:
5054
diff
changeset
|
109 |
} |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
110 |
return devices; |
4793 | 111 |
} |
5164
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
112 |
MeshHelper |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
113 |
MeshHelper::Default (void) |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
114 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
115 |
MeshHelper helper; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
116 |
helper.SetMacType (); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
117 |
helper.SetRemoteStationManager ("ns3::ArfWifiManager"); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
118 |
helper.SetSpreadInterfaceChannels (SPREAD_CHANNELS); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
119 |
return helper; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
120 |
} |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
121 |
|
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
122 |
void |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
123 |
MeshHelper::SetMacType (std::string n0, const AttributeValue &v0, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
124 |
std::string n1, const AttributeValue &v1, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
125 |
std::string n2, const AttributeValue &v2, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
126 |
std::string n3, const AttributeValue &v3, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
127 |
std::string n4, const AttributeValue &v4, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
128 |
std::string n5, const AttributeValue &v5, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
129 |
std::string n6, const AttributeValue &v6, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
130 |
std::string n7, const AttributeValue &v7) |
5164
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
131 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
132 |
m_mac.SetTypeId ("ns3::MeshWifiInterfaceMac"); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
133 |
m_mac.Set (n0, v0); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
134 |
m_mac.Set (n1, v1); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
135 |
m_mac.Set (n2, v2); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
136 |
m_mac.Set (n3, v3); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
137 |
m_mac.Set (n4, v4); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
138 |
m_mac.Set (n5, v5); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
139 |
m_mac.Set (n6, v6); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
140 |
m_mac.Set (n7, v7); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
141 |
} |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
142 |
void |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
143 |
MeshHelper::SetRemoteStationManager (std::string type, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
144 |
std::string n0, const AttributeValue &v0, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
145 |
std::string n1, const AttributeValue &v1, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
146 |
std::string n2, const AttributeValue &v2, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
147 |
std::string n3, const AttributeValue &v3, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
148 |
std::string n4, const AttributeValue &v4, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
149 |
std::string n5, const AttributeValue &v5, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
150 |
std::string n6, const AttributeValue &v6, |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
151 |
std::string n7, const AttributeValue &v7) |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
152 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
153 |
m_stationManager = ObjectFactory (); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
154 |
m_stationManager.SetTypeId (type); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
155 |
m_stationManager.Set (n0, v0); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
156 |
m_stationManager.Set (n1, v1); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
157 |
m_stationManager.Set (n2, v2); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
158 |
m_stationManager.Set (n3, v3); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
159 |
m_stationManager.Set (n4, v4); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
160 |
m_stationManager.Set (n5, v5); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
161 |
m_stationManager.Set (n6, v6); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
162 |
m_stationManager.Set (n7, v7); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
163 |
} |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
164 |
void |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
165 |
MeshHelper::SetStandard (enum WifiPhyStandard standard) |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
166 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
167 |
m_standard = standard; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
168 |
} |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
169 |
|
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
170 |
Ptr<WifiNetDevice> |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
171 |
MeshHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
172 |
{ |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
173 |
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> (); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
174 |
|
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
175 |
Ptr<MeshWifiInterfaceMac> mac = m_mac.Create<MeshWifiInterfaceMac> (); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
176 |
NS_ASSERT (mac != 0); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
177 |
mac->SetSsid (Ssid ()); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
178 |
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> (); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
179 |
NS_ASSERT (manager != 0); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
180 |
Ptr<WifiPhy> phy = phyHelper.Create (node, device); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
181 |
mac->SetAddress (Mac48Address::Allocate ()); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
182 |
mac->ConfigureStandard (m_standard); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
183 |
phy->ConfigureStandard (m_standard); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
184 |
device->SetMac (mac); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
185 |
device->SetPhy (phy); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
186 |
device->SetRemoteStationManager (manager); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
187 |
node->AddDevice (device); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
188 |
mac->SwitchFrequencyChannel (channelId); |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
189 |
return device; |
b81ab8394a61
Restructured helper - removed MeshInterfaceHelper
Kirill Andreev <andreev@iitp.ru>
parents:
5163
diff
changeset
|
190 |
} |
5011
79b4af29924a
Infrastructure for statistics is done
Kirill Andreev <andreev@iitp.ru>
parents:
4963
diff
changeset
|
191 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5081
diff
changeset
|
192 |
MeshHelper::Report (const ns3::Ptr<ns3::NetDevice>& device, std::ostream& os) |
5011
79b4af29924a
Infrastructure for statistics is done
Kirill Andreev <andreev@iitp.ru>
parents:
4963
diff
changeset
|
193 |
{ |
5081 | 194 |
NS_ASSERT (m_stack != 0); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
195 |
Ptr<MeshPointDevice> mp = device->GetObject<MeshPointDevice> (); |
5012 | 196 |
NS_ASSERT (mp != 0); |
197 |
std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces (); |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
198 |
os << "<MeshPointDevice time=\"" << Simulator::Now ().GetSeconds () << "\" address=\"" |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6856
diff
changeset
|
199 |
<< Mac48Address::ConvertFrom (mp->GetAddress ()) << "\">\n"; |
5081 | 200 |
m_stack->Report (mp, os); |
5015 | 201 |
os << "</MeshPointDevice>\n"; |
5011
79b4af29924a
Infrastructure for statistics is done
Kirill Andreev <andreev@iitp.ru>
parents:
4963
diff
changeset
|
202 |
} |
5015 | 203 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5081
diff
changeset
|
204 |
MeshHelper::ResetStats (const ns3::Ptr<ns3::NetDevice>& device) |
5015 | 205 |
{ |
5081 | 206 |
NS_ASSERT (m_stack != 0); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
207 |
Ptr<MeshPointDevice> mp = device->GetObject<MeshPointDevice> (); |
5058 | 208 |
NS_ASSERT (mp != 0); |
5081 | 209 |
m_stack->ResetStats (mp); |
5015 | 210 |
} |
8992
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
211 |
int64_t |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
212 |
MeshHelper::AssignStreams (NetDeviceContainer c, int64_t stream) |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
213 |
{ |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
214 |
int64_t currentStream = stream; |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
215 |
Ptr<NetDevice> netDevice; |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
216 |
for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
217 |
{ |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
218 |
netDevice = (*i); |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
219 |
Ptr<MeshPointDevice> mpd = DynamicCast<MeshPointDevice> (netDevice); |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
220 |
Ptr<WifiNetDevice> wifi; |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
221 |
Ptr<MeshWifiInterfaceMac> mac; |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
222 |
if (mpd) |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
223 |
{ |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
224 |
// To access, we need the underlying WifiNetDevices |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
225 |
std::vector<Ptr<NetDevice> > ifaces = mpd->GetInterfaces (); |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
226 |
for (std::vector<Ptr<NetDevice> >::iterator i = ifaces.begin (); i != ifaces.end (); i++) |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
227 |
{ |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
228 |
wifi = DynamicCast<WifiNetDevice> (*i); |
9010
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
229 |
|
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
230 |
// Handle any random numbers in the PHY objects. |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
231 |
currentStream += wifi->GetPhy ()->AssignStreams (currentStream); |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
232 |
|
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
233 |
// Handle any random numbers in the station managers. |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
234 |
Ptr<WifiRemoteStationManager> manager = wifi->GetRemoteStationManager (); |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
235 |
Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> (manager); |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
236 |
if (minstrel) |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
237 |
{ |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
238 |
currentStream += minstrel->AssignStreams (currentStream); |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
239 |
} |
d6cc76205833
Update mesh test traces due to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
8992
diff
changeset
|
240 |
// Handle any random numbers in the mesh mac and plugins |
8992
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
241 |
mac = DynamicCast<MeshWifiInterfaceMac> (wifi->GetMac ()); |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
242 |
if (mac) |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
243 |
{ |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
244 |
currentStream += mac->AssignStreams (currentStream); |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
245 |
} |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
246 |
} |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
247 |
} |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
248 |
} |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
249 |
return (currentStream - stream); |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
250 |
} |
4fdf03b24af6
Update mesh model, tests and reference traces for new random variable usage
Tom Henderson <tomh@tomh.org>
parents:
7386
diff
changeset
|
251 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
252 |
} // namespace ns3 |
4793 | 253 |