author | Vedran Miletić <rivanvx@gmail.com> |
Tue, 02 Aug 2011 17:42:33 -0400 | |
changeset 7385 | 10beb0e53130 |
parent 7178 | 1a07cbb68308 |
child 10410 | 4d4eb8097fa3 |
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:
4809
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 |
* |
|
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 |
*/ |
21 |
||
22 |
#include "ns3/node.h" |
|
23 |
#include "ns3/packet.h" |
|
24 |
#include "ns3/log.h" |
|
4967
ba4b79124d30
Fix after update from ns-3-dev: substitute removed NetDevice::GetName() method.
Andrey Mazo <mazo@iitp.ru>
parents:
4953
diff
changeset
|
25 |
#include "ns3/pointer.h" |
4817
1257e4b82e17
L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents:
4815
diff
changeset
|
26 |
#include "ns3/mesh-point-device.h" |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
27 |
#include "ns3/wifi-net-device.h" |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
28 |
#include "ns3/mesh-wifi-interface-mac.h" |
4793 | 29 |
|
4815 | 30 |
NS_LOG_COMPONENT_DEFINE ("MeshPointDevice"); |
4793 | 31 |
|
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
32 |
namespace ns3 { |
4793 | 33 |
|
5129 | 34 |
NS_OBJECT_ENSURE_REGISTERED (MeshPointDevice); |
4793 | 35 |
|
36 |
TypeId |
|
4815 | 37 |
MeshPointDevice::GetTypeId () |
4793 | 38 |
{ |
4815 | 39 |
static TypeId tid = TypeId ("ns3::MeshPointDevice") |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
40 |
.SetParent<NetDevice> () |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
41 |
.AddConstructor<MeshPointDevice> () |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
42 |
.AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
43 |
UintegerValue (0xffff), |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
44 |
MakeUintegerAccessor (&MeshPointDevice::SetMtu, |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
45 |
&MeshPointDevice::GetMtu), |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
46 |
MakeUintegerChecker<uint16_t> ()) |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
47 |
.AddAttribute ( "RoutingProtocol", |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
48 |
"The mesh routing protocol used by this mesh point.", |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
49 |
PointerValue (), |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
50 |
MakePointerAccessor ( |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
51 |
&MeshPointDevice::GetRoutingProtocol, &MeshPointDevice::SetRoutingProtocol), |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
52 |
MakePointerChecker< |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
53 |
MeshL2RoutingProtocol> ()); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
54 |
return tid; |
4793 | 55 |
} |
56 |
||
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
57 |
MeshPointDevice::MeshPointDevice () : |
6183
8a5e1f9db873
[bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5422
diff
changeset
|
58 |
m_ifIndex (0) |
4793 | 59 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
60 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
61 |
m_channel = CreateObject<BridgeChannel> (); |
4793 | 62 |
} |
63 |
||
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
64 |
MeshPointDevice::~MeshPointDevice () |
4793 | 65 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
66 |
NS_LOG_FUNCTION_NOARGS (); |
5416
9800d5479341
release Ptrs in mesh-point-device
Craig Dowell <craigdo@ee.washington.edu>
parents:
5180
diff
changeset
|
67 |
m_node = 0; |
9800d5479341
release Ptrs in mesh-point-device
Craig Dowell <craigdo@ee.washington.edu>
parents:
5180
diff
changeset
|
68 |
m_channel = 0; |
9800d5479341
release Ptrs in mesh-point-device
Craig Dowell <craigdo@ee.washington.edu>
parents:
5180
diff
changeset
|
69 |
m_routingProtocol = 0; |
4793 | 70 |
} |
71 |
||
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
72 |
void |
4815 | 73 |
MeshPointDevice::DoDispose () |
4793 | 74 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
75 |
NS_LOG_FUNCTION_NOARGS (); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
76 |
for (std::vector<Ptr<NetDevice> >::iterator iter = m_ifaces.begin (); iter != m_ifaces.end (); iter++) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
77 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
78 |
*iter = 0; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
79 |
} |
4815 | 80 |
m_ifaces.clear (); |
5422
21a4f34518ff
bug 711: example mesh/mesh fails valgrind.
Andrey Mazo <mazo@iitp.ru>
parents:
5416
diff
changeset
|
81 |
m_node = 0; |
21a4f34518ff
bug 711: example mesh/mesh fails valgrind.
Andrey Mazo <mazo@iitp.ru>
parents:
5416
diff
changeset
|
82 |
m_channel = 0; |
21a4f34518ff
bug 711: example mesh/mesh fails valgrind.
Andrey Mazo <mazo@iitp.ru>
parents:
5416
diff
changeset
|
83 |
m_routingProtocol = 0; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
84 |
NetDevice::DoDispose (); |
4793 | 85 |
|
86 |
} |
|
87 |
||
4815 | 88 |
//----------------------------------------------------------------------------- |
89 |
// NetDevice interface implementation |
|
90 |
//----------------------------------------------------------------------------- |
|
91 |
||
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
92 |
void |
4815 | 93 |
MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
94 |
Address const &src, Address const &dst, PacketType packetType) |
4793 | 95 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
96 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
97 |
NS_LOG_DEBUG ("UID is " << packet->GetUid ()); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
98 |
const Mac48Address src48 = Mac48Address::ConvertFrom (src); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
99 |
const Mac48Address dst48 = Mac48Address::ConvertFrom (dst); |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5070
diff
changeset
|
100 |
uint16_t& realProtocol = protocol; |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
101 |
NS_LOG_DEBUG ("SRC=" << src48 << ", DST = " << dst48 << ", I am: " << m_address); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
102 |
if (!m_promiscRxCallback.IsNull ()) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
103 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
104 |
m_promiscRxCallback (this, packet, protocol, src, dst, packetType); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
105 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
106 |
if (dst48.IsGroup ()) |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5070
diff
changeset
|
107 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
108 |
Ptr<Packet> packet_copy = packet->Copy (); |
5163 | 109 |
if (m_routingProtocol->RemoveRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol)) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
110 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
111 |
m_rxCallback (this, packet_copy, realProtocol, src); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
112 |
Forward (incomingPort, packet, protocol, src48, dst48); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
113 |
|
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
114 |
m_rxStats.broadcastData++; |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
115 |
m_rxStats.broadcastDataBytes += packet->GetSize (); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
116 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
117 |
return; |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5070
diff
changeset
|
118 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
119 |
if (dst48 == m_address) |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5070
diff
changeset
|
120 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
121 |
Ptr<Packet> packet_copy = packet->Copy (); |
5163 | 122 |
if (m_routingProtocol->RemoveRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol)) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
123 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
124 |
m_rxCallback (this, packet_copy, realProtocol, src); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
125 |
m_rxStats.unicastData++; |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
126 |
m_rxStats.unicastDataBytes += packet->GetSize (); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
127 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
128 |
return; |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5070
diff
changeset
|
129 |
} |
4947 | 130 |
else |
131 |
Forward (incomingPort, packet->Copy (), protocol, src48, dst48); |
|
4793 | 132 |
} |
133 |
||
134 |
void |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
135 |
MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet, uint16_t protocol, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
136 |
const Mac48Address src, const Mac48Address dst) |
4793 | 137 |
{ |
4815 | 138 |
// pass through routing protocol |
5163 | 139 |
m_routingProtocol->RequestRoute (inport->GetIfIndex (), src, dst, packet, protocol, MakeCallback ( |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
140 |
&MeshPointDevice::DoSend, this)); |
4793 | 141 |
} |
142 |
||
143 |
void |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
144 |
MeshPointDevice::SetIfIndex (const uint32_t index) |
4793 | 145 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
146 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
147 |
m_ifIndex = index; |
4793 | 148 |
} |
149 |
||
150 |
uint32_t |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
151 |
MeshPointDevice::GetIfIndex () const |
4815 | 152 |
{ |
153 |
NS_LOG_FUNCTION_NOARGS (); |
|
154 |
return m_ifIndex; |
|
155 |
} |
|
4793 | 156 |
|
157 |
Ptr<Channel> |
|
4815 | 158 |
MeshPointDevice::GetChannel () const |
159 |
{ |
|
160 |
NS_LOG_FUNCTION_NOARGS (); |
|
161 |
return m_channel; |
|
162 |
} |
|
4793 | 163 |
|
164 |
Address |
|
4815 | 165 |
MeshPointDevice::GetAddress () const |
166 |
{ |
|
167 |
NS_LOG_FUNCTION_NOARGS (); |
|
168 |
return m_address; |
|
169 |
} |
|
4793 | 170 |
|
5101
41589d492ca3
MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents:
5098
diff
changeset
|
171 |
void |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
172 |
MeshPointDevice::SetAddress (Address a) |
5101
41589d492ca3
MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents:
5098
diff
changeset
|
173 |
{ |
41589d492ca3
MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents:
5098
diff
changeset
|
174 |
NS_LOG_WARN ("Manual changing mesh point address can cause routing errors."); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
175 |
m_address = Mac48Address::ConvertFrom (a); |
5101
41589d492ca3
MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents:
5098
diff
changeset
|
176 |
} |
41589d492ca3
MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents:
5098
diff
changeset
|
177 |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
178 |
bool |
4815 | 179 |
MeshPointDevice::SetMtu (const uint16_t mtu) |
4793 | 180 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
181 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
182 |
m_mtu = mtu; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
183 |
return true; |
4793 | 184 |
} |
185 |
||
186 |
uint16_t |
|
4815 | 187 |
MeshPointDevice::GetMtu () const |
188 |
{ |
|
189 |
NS_LOG_FUNCTION_NOARGS (); |
|
190 |
return m_mtu; |
|
191 |
} |
|
192 |
||
193 |
bool |
|
194 |
MeshPointDevice::IsLinkUp () const |
|
195 |
{ |
|
196 |
NS_LOG_FUNCTION_NOARGS (); |
|
197 |
return true; |
|
198 |
} |
|
199 |
||
200 |
void |
|
5180 | 201 |
MeshPointDevice::AddLinkChangeCallback (Callback<void> callback) |
4815 | 202 |
{ |
203 |
// do nothing |
|
204 |
} |
|
205 |
||
206 |
bool |
|
207 |
MeshPointDevice::IsBroadcast () const |
|
208 |
{ |
|
209 |
NS_LOG_FUNCTION_NOARGS (); |
|
210 |
return true; |
|
211 |
} |
|
212 |
||
213 |
Address |
|
214 |
MeshPointDevice::GetBroadcast () const |
|
215 |
{ |
|
216 |
NS_LOG_FUNCTION_NOARGS (); |
|
217 |
return Mac48Address ("ff:ff:ff:ff:ff:ff"); |
|
218 |
} |
|
219 |
||
220 |
bool |
|
221 |
MeshPointDevice::IsMulticast () const |
|
222 |
{ |
|
223 |
NS_LOG_FUNCTION_NOARGS (); |
|
224 |
return true; |
|
225 |
} |
|
226 |
||
227 |
Address |
|
228 |
MeshPointDevice::GetMulticast (Ipv4Address multicastGroup) const |
|
229 |
{ |
|
230 |
NS_LOG_FUNCTION (this << multicastGroup); |
|
231 |
Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup); |
|
232 |
return multicast; |
|
233 |
} |
|
234 |
||
235 |
bool |
|
236 |
MeshPointDevice::IsPointToPoint () const |
|
237 |
{ |
|
238 |
NS_LOG_FUNCTION_NOARGS (); |
|
239 |
return false; |
|
240 |
} |
|
241 |
||
242 |
bool |
|
243 |
MeshPointDevice::IsBridge () const |
|
244 |
{ |
|
245 |
NS_LOG_FUNCTION_NOARGS (); |
|
246 |
return false; |
|
247 |
} |
|
4793 | 248 |
|
249 |
bool |
|
4815 | 250 |
MeshPointDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) |
4793 | 251 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
252 |
const Mac48Address dst48 = Mac48Address::ConvertFrom (dest); |
5163 | 253 |
return m_routingProtocol->RequestRoute (m_ifIndex, m_address, dst48, packet, protocolNumber, MakeCallback ( |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
254 |
&MeshPointDevice::DoSend, this)); |
4793 | 255 |
} |
256 |
||
257 |
bool |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
258 |
MeshPointDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
259 |
uint16_t protocolNumber) |
4793 | 260 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
261 |
const Mac48Address src48 = Mac48Address::ConvertFrom (src); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
262 |
const Mac48Address dst48 = Mac48Address::ConvertFrom (dest); |
5163 | 263 |
return m_routingProtocol->RequestRoute (m_ifIndex, src48, dst48, packet, protocolNumber, MakeCallback ( |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
264 |
&MeshPointDevice::DoSend, this)); |
4793 | 265 |
} |
266 |
||
267 |
Ptr<Node> |
|
4815 | 268 |
MeshPointDevice::GetNode () const |
269 |
{ |
|
270 |
NS_LOG_FUNCTION_NOARGS (); |
|
271 |
return m_node; |
|
272 |
} |
|
4793 | 273 |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
274 |
void |
4815 | 275 |
MeshPointDevice::SetNode (Ptr<Node> node) |
4793 | 276 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
277 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
278 |
m_node = node; |
4793 | 279 |
} |
280 |
||
281 |
bool |
|
4815 | 282 |
MeshPointDevice::NeedsArp () const |
283 |
{ |
|
284 |
NS_LOG_FUNCTION_NOARGS (); |
|
285 |
return true; |
|
286 |
} |
|
4793 | 287 |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
288 |
void |
4815 | 289 |
MeshPointDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
4793 | 290 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
291 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
292 |
m_rxCallback = cb; |
4793 | 293 |
} |
294 |
||
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
295 |
void |
4815 | 296 |
MeshPointDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) |
4793 | 297 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
298 |
NS_LOG_FUNCTION_NOARGS (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
299 |
m_promiscRxCallback = cb; |
4793 | 300 |
} |
301 |
||
302 |
bool |
|
4815 | 303 |
MeshPointDevice::SupportsSendFrom () const |
304 |
{ |
|
305 |
NS_LOG_FUNCTION_NOARGS (); |
|
4986
73ca74882f12
don't allow bridge mesh points
Pavel Boyko <boyko@iitp.ru>
parents:
4985
diff
changeset
|
306 |
return false; // don't allow to bridge mesh network with something else. |
4815 | 307 |
} |
4793 | 308 |
|
309 |
Address |
|
4815 | 310 |
MeshPointDevice::GetMulticast (Ipv6Address addr) const |
311 |
{ |
|
312 |
NS_LOG_FUNCTION (this << addr); |
|
313 |
return Mac48Address::GetMulticast (addr); |
|
314 |
} |
|
4793 | 315 |
|
4815 | 316 |
//----------------------------------------------------------------------------- |
317 |
// Interfaces |
|
318 |
//----------------------------------------------------------------------------- |
|
319 |
uint32_t |
|
320 |
MeshPointDevice::GetNInterfaces () const |
|
4793 | 321 |
{ |
4815 | 322 |
NS_LOG_FUNCTION_NOARGS (); |
323 |
return m_ifaces.size (); |
|
324 |
} |
|
325 |
||
326 |
Ptr<NetDevice> |
|
327 |
MeshPointDevice::GetInterface (uint32_t n) const |
|
328 |
{ |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
329 |
for (std::vector<Ptr<NetDevice> >::const_iterator i = m_ifaces.begin (); i != m_ifaces.end (); i++) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
330 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
331 |
if ((*i)->GetIfIndex () == n) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
332 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
333 |
return (*i); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
334 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
335 |
} |
5063 | 336 |
NS_FATAL_ERROR ("Mesh point interface is not found by index"); |
4932 | 337 |
return 0; |
4793 | 338 |
} |
4888
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
339 |
std::vector<Ptr<NetDevice> > |
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
340 |
MeshPointDevice::GetInterfaces () const |
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
341 |
{ |
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
342 |
return m_ifaces; |
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
343 |
} |
4793 | 344 |
void |
4815 | 345 |
MeshPointDevice::AddInterface (Ptr<NetDevice> iface) |
346 |
{ |
|
347 |
NS_LOG_FUNCTION_NOARGS (); |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
348 |
|
4815 | 349 |
NS_ASSERT (iface != this); |
350 |
if (!Mac48Address::IsMatchingType (iface->GetAddress ())) |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
351 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
352 |
NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be used as a mesh point interface."); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
353 |
} |
4815 | 354 |
if (!iface->SupportsSendFrom ()) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
355 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
356 |
NS_FATAL_ERROR ("Device does not support SendFrom: cannot be used as a mesh point interface."); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
357 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
358 |
|
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
359 |
// Mesh point has MAC address of it's first interface |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
360 |
if (m_ifaces.empty ()) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
361 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
362 |
m_address = Mac48Address::ConvertFrom (iface->GetAddress ()); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
363 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
364 |
Ptr<WifiNetDevice> wifiNetDev = iface->GetObject<WifiNetDevice> (); |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
365 |
if (wifiNetDev == 0) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
366 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
367 |
NS_FATAL_ERROR ("Device is not a WiFi NIC: cannot be used as a mesh point interface."); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
368 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
369 |
Ptr<MeshWifiInterfaceMac> ifaceMac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> (); |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
370 |
if (ifaceMac == 0) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
371 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
372 |
NS_FATAL_ERROR ( |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
373 |
"WiFi device doesn't have correct MAC installed: cannot be used as a mesh point interface."); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
374 |
} |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
375 |
ifaceMac->SetMeshPointAddress (m_address); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
376 |
|
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4967
diff
changeset
|
377 |
// Receive frames from this interface |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
378 |
m_node->RegisterProtocolHandler (MakeCallback (&MeshPointDevice::ReceiveFromDevice, this), 0, iface, /*promiscuous = */ |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
379 |
true); |
4815 | 380 |
m_ifaces.push_back (iface); |
381 |
m_channel->AddChannel (iface->GetChannel ()); |
|
382 |
} |
|
383 |
||
384 |
//----------------------------------------------------------------------------- |
|
385 |
// Protocols |
|
386 |
//----------------------------------------------------------------------------- |
|
387 |
||
4817
1257e4b82e17
L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents:
4815
diff
changeset
|
388 |
void |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
389 |
MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol) |
4815 | 390 |
{ |
391 |
NS_LOG_FUNCTION_NOARGS (); |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
392 |
NS_ASSERT_MSG (PeekPointer (protocol->GetMeshPoint ()) == this, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
393 |
"Routing protocol must be installed on mesh point to be useful."); |
4928
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
394 |
m_routingProtocol = protocol; |
4815 | 395 |
} |
396 |
||
4928
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
397 |
Ptr<MeshL2RoutingProtocol> |
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
398 |
MeshPointDevice::GetRoutingProtocol () const |
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
399 |
{ |
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
400 |
return m_routingProtocol; |
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
401 |
} |
825037c2d7ab
Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
402 |
|
4815 | 403 |
void |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
404 |
MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
405 |
uint16_t protocol, uint32_t outIface) |
4793 | 406 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
407 |
if (!success) |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
408 |
{ |
4996
33f418524356
Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents:
4987
diff
changeset
|
409 |
NS_LOG_DEBUG ("Resolve failed"); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
410 |
return; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
411 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
412 |
|
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
413 |
// Count statistics |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
414 |
Statistics * stats = ((src == m_address) ? &m_txStats : &m_fwdStats); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
415 |
|
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
416 |
if (dst.IsBroadcast ()) |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
417 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
418 |
stats->broadcastData++; |
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
419 |
stats->broadcastDataBytes += packet->GetSize (); |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
420 |
} |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
421 |
else |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
422 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
423 |
stats->unicastData++; |
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
424 |
stats->unicastDataBytes += packet->GetSize (); |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
425 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
426 |
|
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
427 |
// Send |
4815 | 428 |
if (outIface != 0xffffffff) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
429 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
430 |
GetInterface (outIface)->SendFrom (packet, src, dst, protocol); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
431 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
432 |
else |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
433 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
434 |
for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin (); i != m_ifaces.end (); i++) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
435 |
{ |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
436 |
(*i)->SendFrom (packet->Copy (), src, dst, protocol); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
437 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5101
diff
changeset
|
438 |
} |
4793 | 439 |
} |
5126
8e06088a785d
Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents:
5125
diff
changeset
|
440 |
MeshPointDevice::Statistics::Statistics () : |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
441 |
unicastData (0), unicastDataBytes (0), broadcastData (0), broadcastDataBytes (0) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
442 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5127
diff
changeset
|
443 |
} |
4793 | 444 |
|
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
445 |
void |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
446 |
MeshPointDevice::Report (std::ostream & os) const |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
447 |
{ |
5156 | 448 |
os << "<Statistics" << std::endl << |
7178
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
449 |
"txUnicastData=\"" << m_txStats.unicastData << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
450 |
"txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
451 |
"txBroadcastData=\"" << m_txStats.broadcastData << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
452 |
"txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
453 |
"rxUnicastData=\"" << m_rxStats.unicastData << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
454 |
"rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
455 |
"rxBroadcastData=\"" << m_rxStats.broadcastData << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
456 |
"rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
457 |
"fwdUnicastData=\"" << m_fwdStats.unicastData << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
458 |
"fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
459 |
"fwdBroadcastData=\"" << m_fwdStats.broadcastData << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
460 |
"fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"" << std::endl << |
1a07cbb68308
mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6851
diff
changeset
|
461 |
"/>" << std::endl; |
5096
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
462 |
} |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
463 |
|
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
464 |
void |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
465 |
MeshPointDevice::ResetStats () |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
466 |
{ |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
467 |
m_rxStats = Statistics (); |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
468 |
m_txStats = Statistics (); |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
469 |
m_fwdStats = Statistics (); |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
470 |
} |
79c84012dac7
RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents:
5091
diff
changeset
|
471 |
|
4793 | 472 |
} // namespace ns3 |