LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 // | 2 // |
3 // Copyright (c) 2009 INESC Porto | 3 // Copyright (c) 2009 INESC Porto |
4 // | 4 // |
5 // This program is free software; you can redistribute it and/or modify | 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 | 6 // it under the terms of the GNU General Public License version 2 as |
7 // published by the Free Software Foundation; | 7 // published by the Free Software Foundation; |
8 // | 8 // |
9 // This program is distributed in the hope that it will be useful, | 9 // This program is distributed in the hope that it will be useful, |
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 Ipv4FlowProbe::DoDispose () | 283 Ipv4FlowProbe::DoDispose () |
284 { | 284 { |
285 m_ipv4 = 0; | 285 m_ipv4 = 0; |
286 m_classifier = 0; | 286 m_classifier = 0; |
287 FlowProbe::DoDispose (); | 287 FlowProbe::DoDispose (); |
288 } | 288 } |
289 | 289 |
290 void | 290 void |
291 Ipv4FlowProbe::SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet>
ipPayload, uint32_t interface) | 291 Ipv4FlowProbe::SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet>
ipPayload, uint32_t interface) |
292 { | 292 { |
293 NS_UNUSED(interface); | 293 NS_UNUSED (interface); |
294 FlowId flowId; | 294 FlowId flowId; |
295 FlowPacketId packetId; | 295 FlowPacketId packetId; |
296 | 296 |
297 if (!m_ipv4->IsUnicast(ipHeader.GetDestination ())) | 297 if (!m_ipv4->IsUnicast(ipHeader.GetDestination ())) |
298 { | 298 { |
299 // we are not prepared to handle broadcast yet | 299 // we are not prepared to handle broadcast yet |
300 return; | 300 return; |
301 } | 301 } |
302 | 302 |
303 Ipv4FlowProbeTag fTag; | 303 Ipv4FlowProbeTag fTag; |
(...skipping 13 matching lines...) Expand all Loading... |
317 // tag the packet with the flow id and packet id, so that the packet can b
e identified even | 317 // tag the packet with the flow id and packet id, so that the packet can b
e identified even |
318 // when Ipv4Header is not accessible at some non-IPv4 protocol layer | 318 // when Ipv4Header is not accessible at some non-IPv4 protocol layer |
319 Ipv4FlowProbeTag fTag1 (flowId, packetId, size, ipHeader.GetSource (), ipH
eader.GetDestination ()); | 319 Ipv4FlowProbeTag fTag1 (flowId, packetId, size, ipHeader.GetSource (), ipH
eader.GetDestination ()); |
320 ipPayload->AddByteTag (fTag1); | 320 ipPayload->AddByteTag (fTag1); |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 void | 324 void |
325 Ipv4FlowProbe::ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPa
yload, uint32_t interface) | 325 Ipv4FlowProbe::ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPa
yload, uint32_t interface) |
326 { | 326 { |
327 NS_UNUSED(interface); | 327 NS_UNUSED (interface); |
328 Ipv4FlowProbeTag fTag; | 328 Ipv4FlowProbeTag fTag; |
329 bool found = ipPayload->FindFirstMatchingByteTag (fTag); | 329 bool found = ipPayload->FindFirstMatchingByteTag (fTag); |
330 | 330 |
331 if (found) | 331 if (found) |
332 { | 332 { |
333 if (!ipHeader.IsLastFragment () || ipHeader.GetFragmentOffset () != 0) | 333 if (!ipHeader.IsLastFragment () || ipHeader.GetFragmentOffset () != 0) |
334 { | 334 { |
335 NS_LOG_WARN ("Not counting fragmented packets"); | 335 NS_LOG_WARN ("Not counting fragmented packets"); |
336 return; | 336 return; |
337 } | 337 } |
338 if (!fTag.IsSrcDstValid (ipHeader.GetSource (), ipHeader.GetDestination ()
)) | 338 if (!fTag.IsSrcDstValid (ipHeader.GetSource (), ipHeader.GetDestination ()
)) |
339 { | 339 { |
340 NS_LOG_LOGIC ("Not reporting encapsulated packet"); | 340 NS_LOG_LOGIC ("Not reporting encapsulated packet"); |
341 return; | 341 return; |
342 } | 342 } |
343 | 343 |
344 FlowId flowId = fTag.GetFlowId (); | 344 FlowId flowId = fTag.GetFlowId (); |
345 FlowPacketId packetId = fTag.GetPacketId (); | 345 FlowPacketId packetId = fTag.GetPacketId (); |
346 | 346 |
347 uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ()); | 347 uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ()); |
348 NS_LOG_DEBUG ("ReportForwarding ("<<this<<", "<<flowId<<", "<<packetId<<",
"<<size<<");"); | 348 NS_LOG_DEBUG ("ReportForwarding ("<<this<<", "<<flowId<<", "<<packetId<<",
"<<size<<");"); |
349 m_flowMonitor->ReportForwarding (this, flowId, packetId, size); | 349 m_flowMonitor->ReportForwarding (this, flowId, packetId, size); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 void | 353 void |
354 Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ip
Payload, uint32_t interface) | 354 Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ip
Payload, uint32_t interface) |
355 { | 355 { |
356 NS_UNUSED(interface); | 356 NS_UNUSED (interface); |
357 Ipv4FlowProbeTag fTag; | 357 Ipv4FlowProbeTag fTag; |
358 bool found = ipPayload->FindFirstMatchingByteTag (fTag); | 358 bool found = ipPayload->FindFirstMatchingByteTag (fTag); |
359 | 359 |
360 if (found) | 360 if (found) |
361 { | 361 { |
362 if (!fTag.IsSrcDstValid (ipHeader.GetSource (), ipHeader.GetDestination ()
)) | 362 if (!fTag.IsSrcDstValid (ipHeader.GetSource (), ipHeader.GetDestination ()
)) |
363 { | 363 { |
364 NS_LOG_LOGIC ("Not reporting encapsulated packet"); | 364 NS_LOG_LOGIC ("Not reporting encapsulated packet"); |
365 return; | 365 return; |
366 } | 366 } |
367 | 367 |
368 FlowId flowId = fTag.GetFlowId (); | 368 FlowId flowId = fTag.GetFlowId (); |
369 FlowPacketId packetId = fTag.GetPacketId (); | 369 FlowPacketId packetId = fTag.GetPacketId (); |
370 | 370 |
371 uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ()); | 371 uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ()); |
372 NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<
size<<"); " | 372 NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<
size<<"); " |
373 << ipHeader << *ipPayload); | 373 << ipHeader << *ipPayload); |
374 m_flowMonitor->ReportLastRx (this, flowId, packetId, size); | 374 m_flowMonitor->ReportLastRx (this, flowId, packetId, size); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 void | 378 void |
379 Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPaylo
ad, | 379 Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPaylo
ad, |
380 Ipv4L3Protocol::DropReason reason, Ptr<Ipv4> ipv4, ui
nt32_t ifIndex) | 380 Ipv4L3Protocol::DropReason reason, Ptr<Ipv4> ipv4, ui
nt32_t ifIndex) |
381 { | 381 { |
382 NS_UNUSED(ifIndex); | 382 NS_UNUSED (ifIndex); |
383 #if 0 | 383 #if 0 |
384 switch (reason) | 384 switch (reason) |
385 { | 385 { |
386 case Ipv4L3Protocol::DROP_NO_ROUTE: | 386 case Ipv4L3Protocol::DROP_NO_ROUTE: |
387 break; | 387 break; |
388 | 388 |
389 case Ipv4L3Protocol::DROP_TTL_EXPIRED: | 389 case Ipv4L3Protocol::DROP_TTL_EXPIRED: |
390 case Ipv4L3Protocol::DROP_BAD_CHECKSUM: | 390 case Ipv4L3Protocol::DROP_BAD_CHECKSUM: |
391 Ipv4Address addri = m_ipv4->GetAddress (ifIndex); | 391 Ipv4Address addri = m_ipv4->GetAddress (ifIndex); |
392 Ipv4Mask maski = m_ipv4->GetNetworkMask (ifIndex); | 392 Ipv4Mask maski = m_ipv4->GetNetworkMask (ifIndex); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " <
< DROP_QUEUE_DISC | 489 NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " <
< DROP_QUEUE_DISC |
490 << "); "); | 490 << "); "); |
491 | 491 |
492 m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE_DISC); | 492 m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE_DISC); |
493 } | 493 } |
494 | 494 |
495 } // namespace ns3 | 495 } // namespace ns3 |
496 | 496 |
497 | 497 |
LEFT | RIGHT |