author | Kirill Andreev <andreev@iitp.ru> |
Wed, 22 Jul 2009 16:43:43 +0400 | |
changeset 5132 | aee541a30256 |
parent 5129 | 5688b8da4526 |
child 5145 | 7f50ab7ce59d |
permissions | -rw-r--r-- |
5079
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
2 |
/* |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
4 |
* |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
8 |
* |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
13 |
* |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
17 |
* |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
18 |
* Author: Kirill Andreev <andreev@iitp.ru> |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
19 |
*/ |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
20 |
|
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
21 |
#include "flame-protocol.h" |
5082 | 22 |
#include "flame-header.h" |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
23 |
#include "ns3/llc-snap-header.h" |
5082 | 24 |
#include "ns3/log.h" |
25 |
#include "ns3/simulator.h" |
|
26 |
#include "ns3/packet.h" |
|
27 |
#include "ns3/mesh-point-device.h" |
|
28 |
#include "ns3/wifi-net-device.h" |
|
29 |
#include "ns3/mesh-point-device.h" |
|
30 |
#include "ns3/mesh-wifi-interface-mac.h" |
|
31 |
#include "ns3/random-variable.h" |
|
32 |
||
5095 | 33 |
NS_LOG_COMPONENT_DEFINE ("FlameProtocol"); |
34 |
||
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
35 |
namespace ns3 { |
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
36 |
namespace flame { |
5080 | 37 |
//----------------------------------------------------------------------------- |
38 |
// FlameTag |
|
39 |
//----------------------------------------------------------------------------- |
|
40 |
NS_OBJECT_ENSURE_REGISTERED (FlameTag); |
|
41 |
||
42 |
TypeId |
|
43 |
FlameTag::GetTypeId () |
|
44 |
{ |
|
5129 | 45 |
static TypeId tid = TypeId ("ns3::flame::FlameTag") .SetParent<Tag> () .AddConstructor<FlameTag> (); |
46 |
return tid; |
|
5080 | 47 |
} |
48 |
||
49 |
TypeId |
|
50 |
FlameTag::GetInstanceTypeId () const |
|
51 |
{ |
|
52 |
return GetTypeId (); |
|
53 |
} |
|
54 |
||
55 |
uint32_t |
|
56 |
FlameTag::GetSerializedSize () const |
|
57 |
{ |
|
5092 | 58 |
return 12; |
5080 | 59 |
} |
60 |
||
61 |
void |
|
62 |
FlameTag::Serialize (TagBuffer i) const |
|
63 |
{ |
|
64 |
uint8_t buf[6]; |
|
5092 | 65 |
receiver.CopyTo (buf); |
5129 | 66 |
for (int j = 0; j < 6; j++) |
67 |
{ |
|
68 |
i.WriteU8 (buf[j]); |
|
69 |
} |
|
5092 | 70 |
transmitter.CopyTo (buf); |
5129 | 71 |
for (int j = 0; j < 6; j++) |
72 |
{ |
|
73 |
i.WriteU8 (buf[j]); |
|
74 |
} |
|
5092 | 75 |
|
5080 | 76 |
} |
77 |
||
78 |
void |
|
79 |
FlameTag::Deserialize (TagBuffer i) |
|
80 |
{ |
|
81 |
uint8_t buf[6]; |
|
5129 | 82 |
for (int j = 0; j < 6; j++) |
83 |
{ |
|
84 |
buf[j] = i.ReadU8 (); |
|
85 |
} |
|
5092 | 86 |
receiver.CopyFrom (buf); |
5129 | 87 |
for (int j = 0; j < 6; j++) |
88 |
{ |
|
89 |
buf[j] = i.ReadU8 (); |
|
90 |
} |
|
5092 | 91 |
transmitter.CopyFrom (buf); |
92 |
||
5080 | 93 |
} |
94 |
||
95 |
void |
|
96 |
FlameTag::Print (std::ostream &os) const |
|
97 |
{ |
|
5092 | 98 |
os << "receiver = " << receiver << ", transmitter = " << transmitter; |
5080 | 99 |
} |
100 |
||
5082 | 101 |
//----------------------------------------------------------------------------- |
5095 | 102 |
// FlameProtocol |
5082 | 103 |
//----------------------------------------------------------------------------- |
104 |
TypeId |
|
105 |
FlameProtocol::GetTypeId () |
|
106 |
{ |
|
107 |
static TypeId tid = TypeId ("ns3::flame::FlameProtocol") |
|
108 |
.SetParent<MeshL2RoutingProtocol> () |
|
109 |
.AddConstructor<FlameProtocol> () |
|
5129 | 110 |
.AddAttribute ( "BroadcastInterval", |
111 |
"How often we must send broadcast packets", |
|
112 |
TimeValue (Seconds (5)), |
|
113 |
MakeTimeAccessor ( |
|
114 |
&FlameProtocol::m_broadcastInterval), |
|
115 |
MakeTimeChecker () |
|
116 |
) |
|
117 |
.AddAttribute ( "MaxCost", |
|
118 |
"Cost threshold after which packet will be dropeed", |
|
119 |
UintegerValue (32), |
|
120 |
MakeUintegerAccessor ( |
|
121 |
&FlameProtocol::m_maxCost), |
|
122 |
MakeUintegerChecker<uint8_t> (3) |
|
123 |
) |
|
124 |
; |
|
5082 | 125 |
return tid; |
126 |
} |
|
127 |
FlameProtocol::FlameProtocol () : |
|
5129 | 128 |
m_address (Mac48Address ()), m_broadcastInterval (Seconds (5)), m_lastBroadcast (Simulator::Now ()), |
129 |
m_maxCost (32), m_myLastSeqno (0), m_rtable (CreateObject<FlameRtable> ()) |
|
5082 | 130 |
{ |
131 |
} |
|
132 |
FlameProtocol::~FlameProtocol () |
|
133 |
{ |
|
134 |
} |
|
135 |
void |
|
136 |
FlameProtocol::DoDispose () |
|
137 |
{ |
|
138 |
} |
|
139 |
bool |
|
5129 | 140 |
FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, |
141 |
Ptr<const Packet> const_packet, uint16_t protocolType, RouteReplyCallback routeReply) |
|
5082 | 142 |
{ |
143 |
Ptr<Packet> packet = const_packet->Copy (); |
|
5092 | 144 |
if (sourceIface == m_mp->GetIfIndex ()) |
5082 | 145 |
{ |
5129 | 146 |
//Packet from upper layer! |
147 |
FlameTag tag; |
|
148 |
if (packet->PeekPacketTag (tag)) |
|
149 |
{ |
|
150 |
NS_FATAL_ERROR ("FLAME tag is not supposed to be received from upper layers"); |
|
151 |
} |
|
152 |
FlameRtable::LookupResult result = m_rtable->Lookup (destination); |
|
153 |
if (result.retransmitter == Mac48Address::GetBroadcast ()) |
|
154 |
{ |
|
155 |
m_lastBroadcast = Simulator::Now (); |
|
156 |
} |
|
157 |
if (m_lastBroadcast + m_broadcastInterval < Simulator::Now ()) |
|
158 |
{ |
|
159 |
result.retransmitter = Mac48Address::GetBroadcast (); |
|
160 |
result.ifIndex = FlameRtable::INTERFACE_ANY; |
|
161 |
m_lastBroadcast = Simulator::Now (); |
|
162 |
} |
|
163 |
FlameHeader flameHdr; |
|
164 |
flameHdr.AddCost (0); |
|
165 |
flameHdr.SetSeqno (m_myLastSeqno++); |
|
166 |
flameHdr.SetProtocol (protocolType); |
|
167 |
flameHdr.SetOrigDst (destination); |
|
168 |
flameHdr.SetOrigSrc (source); |
|
5106
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
169 |
m_stats.txBytes += packet->GetSize (); |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
170 |
packet->AddHeader (flameHdr); |
5129 | 171 |
tag.receiver = result.retransmitter; |
172 |
if (result.retransmitter == Mac48Address::GetBroadcast ()) |
|
173 |
{ |
|
174 |
m_stats.txBroadcast++; |
|
175 |
} |
|
176 |
else |
|
177 |
{ |
|
178 |
m_stats.txUnicast++; |
|
179 |
} |
|
180 |
NS_LOG_DEBUG ("Source: send packet with RA = " << tag.receiver); |
|
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
181 |
packet->AddPacketTag (tag); |
5129 | 182 |
routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex); |
183 |
} |
|
184 |
else |
|
185 |
{ |
|
186 |
FlameHeader flameHdr; |
|
187 |
packet->RemoveHeader (flameHdr); |
|
188 |
FlameTag tag; |
|
189 |
if (!packet->RemovePacketTag (tag)) |
|
190 |
{ |
|
191 |
NS_FATAL_ERROR ("FLAME tag must exust here"); |
|
192 |
} |
|
193 |
if (source == GetAddress ()) |
|
194 |
{ |
|
195 |
if (tag.receiver != Mac48Address::GetBroadcast ()) |
|
196 |
{ |
|
197 |
NS_LOG_DEBUG ("received packet with SA = GetAddress (), RA = " << tag.receiver << ", TA = " |
|
198 |
<< tag.transmitter << ", I am " << GetAddress ()); |
|
199 |
} |
|
200 |
m_stats.totalDropped++; |
|
201 |
return false; |
|
202 |
} |
|
203 |
if (destination == Mac48Address::GetBroadcast ()) |
|
204 |
{ |
|
205 |
//Broadcast always is forwarded as broadcast! |
|
206 |
NS_ASSERT (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface)); |
|
207 |
FlameTag tag (Mac48Address::GetBroadcast ()); |
|
208 |
flameHdr.AddCost (1); |
|
209 |
m_stats.txBytes += packet->GetSize (); |
|
210 |
packet->AddHeader (flameHdr); |
|
211 |
packet->AddPacketTag (tag); |
|
212 |
routeReply (true, packet, source, destination, FLAME_PROTOCOL, FlameRtable::INTERFACE_ANY); |
|
213 |
m_stats.txBroadcast++; |
|
214 |
return true; |
|
215 |
} |
|
216 |
else |
|
217 |
{ |
|
218 |
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface)) |
|
219 |
{ |
|
220 |
return false; |
|
221 |
} |
|
222 |
FlameRtable::LookupResult result = m_rtable->Lookup (destination); |
|
223 |
if (tag.receiver != Mac48Address::GetBroadcast ()) |
|
224 |
{ |
|
225 |
if (result.retransmitter == Mac48Address::GetBroadcast ()) |
|
226 |
{ |
|
227 |
NS_LOG_DEBUG ("unicast packet dropped, because no route! I am " << GetAddress () |
|
228 |
<< ", RA = " << tag.receiver << ", TA = " << tag.transmitter); |
|
229 |
m_stats.totalDropped++; |
|
230 |
return false; |
|
231 |
} |
|
232 |
} |
|
233 |
tag.receiver = result.retransmitter; |
|
234 |
if (result.retransmitter == Mac48Address::GetBroadcast ()) |
|
235 |
{ |
|
236 |
m_stats.txBroadcast++; |
|
237 |
} |
|
238 |
else |
|
239 |
{ |
|
240 |
m_stats.txUnicast++; |
|
241 |
} |
|
242 |
m_stats.txBytes += packet->GetSize (); |
|
243 |
flameHdr.AddCost (1); |
|
244 |
packet->AddHeader (flameHdr); |
|
245 |
packet->AddPacketTag (tag); |
|
246 |
routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex); |
|
247 |
return true; |
|
248 |
} |
|
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
249 |
return true; |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
250 |
} |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
251 |
return false; |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
252 |
} |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
253 |
bool |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
254 |
FlameProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source, |
5129 | 255 |
const Mac48Address destination, Ptr<Packet> packet, uint16_t& protocolType) |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
256 |
{ |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
257 |
//Filter seqno: |
5129 | 258 |
if (source == GetAddress ()) |
259 |
{ |
|
260 |
NS_LOG_DEBUG ("Dropped my own frame!"); |
|
261 |
return false; |
|
262 |
} |
|
5084
ddf23699f0b7
Initial flame implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
263 |
FlameTag tag; |
5129 | 264 |
if (!packet->RemovePacketTag (tag)) |
265 |
{ |
|
266 |
NS_FATAL_ERROR ("FLAME tag must exist when packet is coming to protocol"); |
|
267 |
} |
|
5088
fe6fcf14f2a1
Flame: added correct seqno filtering, added broadcast timers
Kirill Andreev <andreev@iitp.ru>
parents:
5086
diff
changeset
|
268 |
//TODO: send path update |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
269 |
FlameHeader flameHdr; |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
270 |
packet->RemoveHeader (flameHdr); |
5129 | 271 |
NS_ASSERT (protocolType == FLAME_PROTOCOL); |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
272 |
protocolType = flameHdr.GetProtocol (); |
5129 | 273 |
return (!HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface)); |
5082 | 274 |
} |
275 |
bool |
|
276 |
FlameProtocol::Install (Ptr<MeshPointDevice> mp) |
|
277 |
{ |
|
278 |
m_mp = mp; |
|
279 |
std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces (); |
|
5129 | 280 |
for (std::vector<Ptr<NetDevice> >::const_iterator i = interfaces.begin (); i != interfaces.end (); i++) |
5082 | 281 |
{ |
282 |
// Checking for compatible net device |
|
283 |
Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice> (); |
|
284 |
if (wifiNetDev == 0) |
|
5129 | 285 |
{ |
286 |
return false; |
|
287 |
} |
|
288 |
Ptr<MeshWifiInterfaceMac> mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> (); |
|
5082 | 289 |
if (mac == 0) |
5129 | 290 |
{ |
291 |
return false; |
|
292 |
} |
|
5082 | 293 |
// Installing plugins: |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5084
diff
changeset
|
294 |
Ptr<FlameProtocolMac> flameMac = Create<FlameProtocolMac> (wifiNetDev->GetIfIndex (), this); |
5082 | 295 |
m_interfaces[wifiNetDev->GetIfIndex ()] = flameMac; |
5092 | 296 |
mac->SetBeaconGeneration (false); |
5082 | 297 |
mac->InstallPlugin (flameMac); |
298 |
} |
|
299 |
mp->SetRoutingProtocol (this); |
|
300 |
// Mesh point aggregates all installed protocols |
|
301 |
mp->AggregateObject (this); |
|
302 |
m_address = Mac48Address::ConvertFrom (mp->GetAddress ());//* address; |
|
303 |
return true; |
|
304 |
} |
|
305 |
Mac48Address |
|
306 |
FlameProtocol::GetAddress () |
|
307 |
{ |
|
308 |
return m_address; |
|
309 |
} |
|
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
310 |
bool |
5129 | 311 |
FlameProtocol::HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, |
312 |
Mac48Address receiver, uint32_t fromInterface) |
|
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
313 |
{ |
5129 | 314 |
if (source == GetAddress ()) |
315 |
{ |
|
316 |
return true; |
|
317 |
} |
|
5084
ddf23699f0b7
Initial flame implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
318 |
FlameRtable::LookupResult result = m_rtable->Lookup (source); |
ddf23699f0b7
Initial flame implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
319 |
if (result.retransmitter == Mac48Address::GetBroadcast ()) |
5129 | 320 |
{ |
321 |
m_rtable->AddPath (source, receiver, fromInterface, flameHdr.GetCost (), flameHdr.GetSeqno ()); |
|
322 |
return false; |
|
323 |
} |
|
324 |
if (result.seqnum >= seqno) |
|
325 |
{ |
|
326 |
return true; |
|
327 |
} |
|
5090
0facd23819b6
Fixed seqno and ttl filter: changed order
Kirill Andreev <andreev@iitp.ru>
parents:
5089
diff
changeset
|
328 |
if (flameHdr.GetCost () > m_maxCost) |
5129 | 329 |
{ |
330 |
m_stats.droppedTtl++; |
|
331 |
return true; |
|
332 |
} |
|
5088
fe6fcf14f2a1
Flame: added correct seqno filtering, added broadcast timers
Kirill Andreev <andreev@iitp.ru>
parents:
5086
diff
changeset
|
333 |
m_rtable->AddPath (source, receiver, fromInterface, flameHdr.GetCost (), flameHdr.GetSeqno ()); |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
334 |
return false; |
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
335 |
} |
5106
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
336 |
//Statistics: |
5126
8e06088a785d
Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents:
5106
diff
changeset
|
337 |
FlameProtocol::Statistics::Statistics () : |
5129 | 338 |
txUnicast (0), txBroadcast (0), txBytes (0), droppedTtl (0), totalDropped (0) |
339 |
{ |
|
340 |
} |
|
341 |
void |
|
342 |
FlameProtocol::Statistics::Print (std::ostream & os) const |
|
5106
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
343 |
{ |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
344 |
os << "<Statistics " |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
345 |
"txUnicast=\"" << txUnicast << "\" " |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
346 |
"txBroadcast=\"" << txBroadcast << "\" " |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
347 |
"txBytes=\"" << txBytes << "\" " |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
348 |
"droppedTtl=\"" << droppedTtl << "\" " |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
349 |
"totalDropped=\"" << totalDropped << "\"/>\n"; |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
350 |
} |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
351 |
void |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
352 |
FlameProtocol::Report (std::ostream & os) const |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
353 |
{ |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
354 |
os << "<Flame " |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
355 |
"address=\"" << m_address << "\"\n" |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
356 |
"broadcastInterval=\"" << m_broadcastInterval.GetSeconds () << "\"\n" |
5129 | 357 |
"maxCost=\"" << (uint16_t) m_maxCost << "\">\n"; |
5106
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
358 |
m_stats.Print (os); |
5129 | 359 |
for (FlamePluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++) |
360 |
{ |
|
361 |
plugin->second->Report (os); |
|
362 |
} |
|
5106
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
363 |
os << "</Flame>\n"; |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
364 |
} |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
365 |
void |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
366 |
FlameProtocol::ResetStats () |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
367 |
{ |
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
368 |
m_stats = Statistics (); |
5129 | 369 |
for (FlamePluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++) |
370 |
{ |
|
371 |
plugin->second->ResetStats (); |
|
372 |
} |
|
5106
de6fe90556c8
Added comments and statistics to flame
Kirill Andreev <andreev@iitp.ru>
parents:
5095
diff
changeset
|
373 |
} |
5083
5b154b30a8a1
Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents:
5082
diff
changeset
|
374 |
|
5079
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
375 |
} //namespace flame |
245215e5e6ed
Added flame rtable, fixed DoDispose in HwmpRtable
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
376 |
} //namespace ns3 |