author | Kirill Andreev <andreev@iitp.ru> |
Wed, 22 Jul 2009 16:43:43 +0400 | |
changeset 5132 | aee541a30256 |
parent 5129 | 5688b8da4526 |
child 5141 | 22e79c2a4c5f |
permissions | -rw-r--r-- |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
2 |
/* |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008,2009 IITP RAS |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
4 |
* |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
8 |
* |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
13 |
* |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
17 |
* |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
18 |
* Authors: Kirill Andreev <andreev@iitp.ru> |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
19 |
*/ |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
20 |
#include "ns3/mesh-interface-helper.h" |
5061 | 21 |
#include "dot11s-installer.h" |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
22 |
#include "peer-management-protocol.h" |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
23 |
#include "hwmp-protocol.h" |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
24 |
|
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
25 |
namespace ns3 { |
5081 | 26 |
using namespace dot11s; |
27 |
NS_OBJECT_ENSURE_REGISTERED (Dot11sStack); |
|
28 |
TypeId |
|
29 |
Dot11sStack::GetTypeId () |
|
30 |
{ |
|
31 |
static TypeId tid = TypeId ("ns3::Dot11sStack") |
|
32 |
.SetParent<Object> () |
|
5129 | 33 |
.AddConstructor<Dot11sStack> (); |
5081 | 34 |
return tid; |
35 |
} |
|
36 |
Dot11sStack::Dot11sStack () |
|
5129 | 37 |
{ |
38 |
} |
|
5081 | 39 |
Dot11sStack::~Dot11sStack () |
5129 | 40 |
{ |
41 |
} |
|
5081 | 42 |
void |
43 |
Dot11sStack::DoDispose () |
|
44 |
{ |
|
45 |
} |
|
46 |
void |
|
47 |
Dot11sStack::SetRoot (Ptr<MeshPointDevice> mp) |
|
48 |
{ |
|
5129 | 49 |
Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> (); |
50 |
NS_ASSERT (hwmp != 0); |
|
51 |
hwmp->SetRoot (); |
|
5081 | 52 |
} |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
53 |
bool |
5081 | 54 |
Dot11sStack::InstallStack (Ptr<MeshPointDevice> mp) |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
55 |
{ |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
56 |
//Install Peer management protocol: |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
57 |
Ptr<PeerManagementProtocol> pmp = CreateObject<PeerManagementProtocol> (); |
5129 | 58 |
pmp->SetMeshId ("mesh"); |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
59 |
bool install_ok = pmp->Install (mp); |
5124
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
60 |
if (!install_ok) |
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
61 |
{ |
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
62 |
return false; |
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
63 |
} |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
64 |
//Install HWMP: |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
65 |
Ptr<HwmpProtocol> hwmp = CreateObject<HwmpProtocol> (); |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
66 |
install_ok = hwmp->Install (mp); |
5124
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
67 |
if (!install_ok) |
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
68 |
{ |
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
69 |
return false; |
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
70 |
} |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
71 |
//Install interaction between HWMP and Peer management protocol: |
5129 | 72 |
pmp->SetPeerLinkStatusCallback (MakeCallback (&HwmpProtocol::PeerLinkStatus, hwmp)); |
73 |
hwmp->SetNeighboursCallback (MakeCallback (&PeerManagementProtocol::GetActiveLinks, pmp)); |
|
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
74 |
return true; |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
75 |
} |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
76 |
void |
5081 | 77 |
Dot11sStack::Report (const Ptr<MeshPointDevice> mp, std::ostream& os) |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
78 |
{ |
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5081
diff
changeset
|
79 |
mp->Report (os); |
5129 | 80 |
|
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
81 |
std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces (); |
5124
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
82 |
for (std::vector<Ptr<NetDevice> >::const_iterator i = ifaces.begin (); i != ifaces.end (); ++i) |
5129 | 83 |
{ |
84 |
Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> (); |
|
85 |
NS_ASSERT (device != 0); |
|
86 |
MeshInterfaceHelper::Report (device, os); |
|
87 |
} |
|
88 |
Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> (); |
|
5124
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
89 |
NS_ASSERT (hwmp != 0); |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
90 |
hwmp->Report (os); |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
91 |
|
5129 | 92 |
Ptr<PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> (); |
5124
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
93 |
NS_ASSERT (pmp != 0); |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
94 |
pmp->Report (os); |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
95 |
} |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
96 |
void |
5081 | 97 |
Dot11sStack::ResetStats (const Ptr<MeshPointDevice> mp) |
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
98 |
{ |
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5081
diff
changeset
|
99 |
mp->ResetStats (); |
5129 | 100 |
|
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
101 |
std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces (); |
5124
e206046b2e44
removed GetElementId from *.h files. Fixed spaces before '(' and added {} when needed.
Kirill Andreev <andreev@iitp.ru>
parents:
5096
diff
changeset
|
102 |
for (std::vector<Ptr<NetDevice> >::const_iterator i = ifaces.begin (); i != ifaces.end (); ++i) |
5129 | 103 |
{ |
104 |
Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> (); |
|
105 |
NS_ASSERT (device != 0); |
|
106 |
MeshInterfaceHelper::ResetStats (device); |
|
107 |
} |
|
108 |
Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> (); |
|
109 |
NS_ASSERT (hwmp != 0); |
|
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
110 |
hwmp->ResetStats (); |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
111 |
|
5129 | 112 |
Ptr<PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> (); |
113 |
NS_ASSERT (pmp != 0); |
|
5057
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
114 |
pmp->ResetStats (); |
95a72c98f08d
Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
115 |
} |
5081 | 116 |
} //namespace ns3 |