author | Kirill Andreev <andreev@iitp.ru> |
Tue, 28 Jul 2009 20:22:15 +0400 | |
changeset 5136 | 6ad13efaccd7 |
parent 5128 | d6e168eba404 |
child 5138 | b193dca2b479 |
permissions | -rw-r--r-- |
5054 | 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 |
*/ |
|
20 |
||
21 |
||
5055
903fb7d81b97
Restructured mesh - helper
Kirill Andreev <andreev@iitp.ru>
parents:
5054
diff
changeset
|
22 |
#include "mesh-interface-helper.h" |
5054 | 23 |
#include "ns3/wifi-mac.h" |
24 |
#include "ns3/pointer.h" |
|
25 |
#include "ns3/dca-txop.h" |
|
26 |
#include "ns3/wifi-remote-station-manager.h" |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
27 |
namespace ns3 |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
28 |
{ |
5054 | 29 |
|
30 |
MeshInterfaceHelper::MeshInterfaceHelper () |
|
31 |
{ |
|
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
32 |
m_queues.insert (std::make_pair (AC_VO, ObjectFactory ())); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
33 |
m_queues.insert (std::make_pair (AC_VI, ObjectFactory ())); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
34 |
m_queues.insert (std::make_pair (AC_BE, ObjectFactory ())); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
35 |
m_queues.insert (std::make_pair (AC_BK, ObjectFactory ())); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
36 |
|
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
37 |
m_queues[AC_VO].SetTypeId ("ns3::DcaTxop"); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
38 |
m_queues[AC_VI].SetTypeId ("ns3::DcaTxop"); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
39 |
m_queues[AC_BE].SetTypeId ("ns3::DcaTxop"); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
40 |
m_queues[AC_BK].SetTypeId ("ns3::DcaTxop"); |
5054 | 41 |
} |
42 |
||
43 |
MeshInterfaceHelper::~MeshInterfaceHelper () |
|
44 |
{} |
|
45 |
||
46 |
MeshInterfaceHelper |
|
47 |
MeshInterfaceHelper::Default (void) |
|
48 |
{ |
|
49 |
MeshInterfaceHelper helper; |
|
50 |
helper.SetType (); |
|
51 |
helper.SetRemoteStationManager ("ns3::ArfWifiManager"); |
|
5136 | 52 |
/* For more details about this default parameters see IEE802.11 section 7.3.2.29 */ |
53 |
helper.SetQueueParameters (AC_VO, "MinCw", UintegerValue (3), "MaxCw", UintegerValue (7), "Aifsn", |
|
54 |
UintegerValue (2)); |
|
55 |
helper.SetQueueParameters (AC_VI, "MinCw", UintegerValue (7), "MaxCw", UintegerValue (15), "Aifsn", |
|
56 |
UintegerValue (2)); |
|
57 |
helper.SetQueueParameters (AC_BE, "MinCw", UintegerValue (15), "MaxCw", UintegerValue (1023), "Aifsn", |
|
58 |
UintegerValue (3)); |
|
59 |
helper.SetQueueParameters (AC_BK, "MinCw", UintegerValue (15), "MaxCw", UintegerValue (1023), "Aifsn", |
|
60 |
UintegerValue (7)); |
|
5054 | 61 |
return helper; |
62 |
} |
|
63 |
||
64 |
void |
|
65 |
MeshInterfaceHelper::SetType (std::string n0, const AttributeValue &v0, |
|
66 |
std::string n1, const AttributeValue &v1, |
|
67 |
std::string n2, const AttributeValue &v2, |
|
68 |
std::string n3, const AttributeValue &v3, |
|
69 |
std::string n4, const AttributeValue &v4, |
|
70 |
std::string n5, const AttributeValue &v5, |
|
71 |
std::string n6, const AttributeValue &v6, |
|
72 |
std::string n7, const AttributeValue &v7) |
|
73 |
{ |
|
74 |
m_mac.SetTypeId ("ns3::MeshWifiInterfaceMac"); |
|
75 |
m_mac.Set (n0, v0); |
|
76 |
m_mac.Set (n1, v1); |
|
77 |
m_mac.Set (n2, v2); |
|
78 |
m_mac.Set (n3, v3); |
|
79 |
m_mac.Set (n4, v4); |
|
80 |
m_mac.Set (n5, v5); |
|
81 |
m_mac.Set (n6, v6); |
|
82 |
m_mac.Set (n7, v7); |
|
83 |
} |
|
84 |
void |
|
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
85 |
MeshInterfaceHelper::SetQueueParameters ( AccessClass ac, |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
86 |
std::string n0, const AttributeValue &v0, |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
87 |
std::string n1, const AttributeValue &v1, |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
88 |
std::string n2, const AttributeValue &v2, |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
89 |
std::string n3, const AttributeValue &v3) |
5054 | 90 |
{ |
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
91 |
std::map<AccessClass, ObjectFactory>::iterator queue = m_queues.find (ac); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
92 |
if (queue != m_queues.end ()) |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
93 |
{ |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
94 |
queue->second.Set (n0, v0); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
95 |
queue->second.Set (n1, v1); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
96 |
queue->second.Set (n2, v2); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
97 |
queue->second.Set (n3, v3); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
98 |
} |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
99 |
else |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
100 |
{ |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
101 |
NS_FATAL_ERROR ("Queue is not set!"); |
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
102 |
} |
5054 | 103 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
104 |
void |
5054 | 105 |
MeshInterfaceHelper::SetRemoteStationManager (std::string type, |
106 |
std::string n0, const AttributeValue &v0, |
|
107 |
std::string n1, const AttributeValue &v1, |
|
108 |
std::string n2, const AttributeValue &v2, |
|
109 |
std::string n3, const AttributeValue &v3, |
|
110 |
std::string n4, const AttributeValue &v4, |
|
111 |
std::string n5, const AttributeValue &v5, |
|
112 |
std::string n6, const AttributeValue &v6, |
|
113 |
std::string n7, const AttributeValue &v7) |
|
114 |
{ |
|
115 |
m_stationManager = ObjectFactory (); |
|
116 |
m_stationManager.SetTypeId (type); |
|
117 |
m_stationManager.Set (n0, v0); |
|
118 |
m_stationManager.Set (n1, v1); |
|
119 |
m_stationManager.Set (n2, v2); |
|
120 |
m_stationManager.Set (n3, v3); |
|
121 |
m_stationManager.Set (n4, v4); |
|
122 |
m_stationManager.Set (n5, v5); |
|
123 |
m_stationManager.Set (n6, v6); |
|
124 |
m_stationManager.Set (n7, v7); |
|
125 |
} |
|
126 |
Ptr<WifiNetDevice> |
|
127 |
MeshInterfaceHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const |
|
128 |
{ |
|
129 |
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> (); |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
130 |
|
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
131 |
Ptr<MeshWifiInterfaceMac> mac = DynamicCast<MeshWifiInterfaceMac> (Create ()); |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5055
diff
changeset
|
132 |
NS_ASSERT (mac != 0); |
5054 | 133 |
mac->SetSsid (Ssid ()); |
134 |
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> (); |
|
135 |
Ptr<WifiPhy> phy = phyHelper.Create (node, device); |
|
136 |
mac->SetAddress (Mac48Address::Allocate ()); |
|
137 |
device->SetMac (mac); |
|
138 |
device->SetPhy (phy); |
|
139 |
device->SetRemoteStationManager (manager); |
|
140 |
node->AddDevice (device); |
|
141 |
mac->SwitchFrequencyChannel (channelId); |
|
142 |
return device; |
|
143 |
} |
|
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5055
diff
changeset
|
144 |
Ptr<WifiMac> |
5054 | 145 |
MeshInterfaceHelper::Create (void) const |
146 |
{ |
|
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5057
diff
changeset
|
147 |
Ptr<MeshWifiInterfaceMac> mac = m_mac.Create<MeshWifiInterfaceMac> (); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
148 |
for (std::map<AccessClass, ObjectFactory>::const_iterator i = m_queues.begin (); i != m_queues.end (); i++) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
149 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
150 |
mac->SetQueue (i->second.Create<DcaTxop> (), i->first); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
151 |
} |
5054 | 152 |
return mac; |
153 |
} |
|
154 |
void |
|
155 |
MeshInterfaceHelper::Report (const Ptr<WifiNetDevice>& device, std::ostream& os) |
|
156 |
{ |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
157 |
Ptr<MeshWifiInterfaceMac> mac = device->GetMac ()->GetObject<MeshWifiInterfaceMac> (); |
5054 | 158 |
NS_ASSERT (mac != 0); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
159 |
mac->Report (os); |
5054 | 160 |
} |
161 |
void |
|
162 |
MeshInterfaceHelper::ResetStats (const Ptr<WifiNetDevice>& device) |
|
163 |
{ |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
164 |
Ptr<MeshWifiInterfaceMac> mac = device->GetMac ()->GetObject<MeshWifiInterfaceMac> (); |
5054 | 165 |
NS_ASSERT (mac != 0); |
166 |
mac->ResetStats (); |
|
167 |
} |
|
168 |
||
169 |
} //namespace ns3 |
|
170 |