1.1 --- a/bindings/python/ns3_module_flow_monitor.py Wed May 06 18:25:16 2009 +0100
1.2 +++ b/bindings/python/ns3_module_flow_monitor.py Wed May 06 18:25:50 2009 +0100
1.3 @@ -17,6 +17,8 @@
1.4 module.add_class('FiveTuple', outer_class=root_module['ns3::Ipv4FlowClassifier'])
1.5 ## ipv4-flow-probe.h: ns3::Ipv4FlowProbe [class]
1.6 module.add_class('Ipv4FlowProbe', parent=root_module['ns3::FlowProbe'])
1.7 + ## ipv4-flow-probe.h: ns3::Ipv4FlowProbe::DropReason [enumeration]
1.8 + module.add_enum('DropReason', ['DROP_NO_ROUTE', 'DROP_TTL_EXPIRE', 'DROP_BAD_CHECKSUM', 'DROP_INVALID_REASON'], outer_class=root_module['ns3::Ipv4FlowProbe'])
1.9 ## flow-monitor.h: ns3::FlowMonitor [class]
1.10 module.add_class('FlowMonitor', parent=root_module['ns3::Object'])
1.11 ## flow-monitor.h: ns3::FlowMonitor::FlowStats [struct]
1.12 @@ -141,6 +143,10 @@
1.13 cls.add_method('AddPacketStats',
1.14 'void',
1.15 [param('ns3::FlowId', 'flowId'), param('uint32_t', 'packetSize'), param('ns3::Time', 'delayFromFirstProbe')])
1.16 + ## flow-probe.h: void ns3::FlowProbe::AddPacketDropStats(ns3::FlowId flowId, uint32_t packetSize, uint32_t reasonCode) [member function]
1.17 + cls.add_method('AddPacketDropStats',
1.18 + 'void',
1.19 + [param('ns3::FlowId', 'flowId'), param('uint32_t', 'packetSize'), param('uint32_t', 'reasonCode')])
1.20 ## flow-probe.h: std::map<unsigned int, ns3::FlowProbe::FlowStats, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ns3::FlowProbe::FlowStats> > > ns3::FlowProbe::GetStats() const [member function]
1.21 cls.add_method('GetStats',
1.22 'std::map< unsigned int, ns3::FlowProbe::FlowStats >',
1.23 @@ -152,6 +158,10 @@
1.24 return
1.25
1.26 def register_Ns3FlowProbeFlowStats_methods(root_module, cls):
1.27 + ## flow-probe.h: ns3::FlowProbe::FlowStats::packetsDropped [variable]
1.28 + cls.add_instance_attribute('packetsDropped', 'std::vector< unsigned int >', is_const=False)
1.29 + ## flow-probe.h: ns3::FlowProbe::FlowStats::bytesDropped [variable]
1.30 + cls.add_instance_attribute('bytesDropped', 'std::vector< unsigned long >', is_const=False)
1.31 ## flow-probe.h: ns3::FlowProbe::FlowStats::delayFromFirstProbeSum [variable]
1.32 cls.add_instance_attribute('delayFromFirstProbeSum', 'ns3::Time', is_const=False)
1.33 ## flow-probe.h: ns3::FlowProbe::FlowStats::bytes [variable]
1.34 @@ -253,6 +263,10 @@
1.35 cls.add_method('ReportLastRx',
1.36 'void',
1.37 [param('ns3::Ptr< ns3::FlowProbe >', 'probe'), param('ns3::FlowId', 'flowId'), param('ns3::FlowPacketId', 'packetId'), param('uint32_t', 'packetSize')])
1.38 + ## flow-monitor.h: void ns3::FlowMonitor::ReportDrop(ns3::Ptr<ns3::FlowProbe> probe, ns3::FlowId flowId, ns3::FlowPacketId packetId, uint32_t packetSize, uint32_t reasonCode) [member function]
1.39 + cls.add_method('ReportDrop',
1.40 + 'void',
1.41 + [param('ns3::Ptr< ns3::FlowProbe >', 'probe'), param('ns3::FlowId', 'flowId'), param('ns3::FlowPacketId', 'packetId'), param('uint32_t', 'packetSize'), param('uint32_t', 'reasonCode')])
1.42 ## flow-monitor.h: void ns3::FlowMonitor::CheckForLostPackets() [member function]
1.43 cls.add_method('CheckForLostPackets',
1.44 'void',
1.45 @@ -307,6 +321,10 @@
1.46 cls.add_instance_attribute('jitterHistogram', 'ns3::Histogram', is_const=False)
1.47 ## flow-monitor.h: ns3::FlowMonitor::FlowStats::packetSizeHistogram [variable]
1.48 cls.add_instance_attribute('packetSizeHistogram', 'ns3::Histogram', is_const=False)
1.49 + ## flow-monitor.h: ns3::FlowMonitor::FlowStats::packetsDropped [variable]
1.50 + cls.add_instance_attribute('packetsDropped', 'std::vector< unsigned int >', is_const=False)
1.51 + ## flow-monitor.h: ns3::FlowMonitor::FlowStats::bytesDropped [variable]
1.52 + cls.add_instance_attribute('bytesDropped', 'std::vector< unsigned long >', is_const=False)
1.53 ## flow-monitor.h: ns3::FlowMonitor::FlowStats::FlowStats(ns3::FlowMonitor::FlowStats const & arg0) [copy constructor]
1.54 cls.add_constructor([param('ns3::FlowMonitor::FlowStats const &', 'arg0')])
1.55 ## flow-monitor.h: ns3::FlowMonitor::FlowStats::FlowStats() [constructor]
2.1 --- a/bindings/python/ns3_module_internet_stack.py Wed May 06 18:25:16 2009 +0100
2.2 +++ b/bindings/python/ns3_module_internet_stack.py Wed May 06 18:25:50 2009 +0100
2.3 @@ -13,6 +13,8 @@
2.4 module.add_class('Ipv4Interface', parent=root_module['ns3::Object'])
2.5 ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol [class]
2.6 module.add_class('Ipv4L3Protocol', parent=root_module['ns3::Object'])
2.7 + ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::DropReason [enumeration]
2.8 + module.add_enum('DropReason', ['DROP_TTL_EXPIRED', 'DROP_NO_ROUTE', 'DROP_BAD_CHECKSUM'], outer_class=root_module['ns3::Ipv4L3Protocol'])
2.9 ## ipv4-static-routing.h: ns3::Ipv4StaticRouting [class]
2.10 module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
2.11
3.1 --- a/bindings/python/ns3modulegen_generated.py Wed May 06 18:25:16 2009 +0100
3.2 +++ b/bindings/python/ns3modulegen_generated.py Wed May 06 18:25:50 2009 +0100
3.3 @@ -251,6 +251,7 @@
3.4 module.add_container('std::vector< unsigned int >', 'unsigned int', container_type='vector')
3.5 module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
3.6 module.add_container('std::set< unsigned int >', 'unsigned int', container_type='set')
3.7 + module.add_container('std::vector< unsigned long >', 'long unsigned int', container_type='vector')
3.8 module.add_container('std::list< unsigned int >', 'unsigned int', container_type='list')
3.9
3.10 ## Register a nested module for the namespace Config
4.1 --- a/examples/flowmon.py Wed May 06 18:25:16 2009 +0100
4.2 +++ b/examples/flowmon.py Wed May 06 18:25:50 2009 +0100
4.3 @@ -93,7 +93,7 @@
4.4 #print i, destaddr
4.5 onOffHelper.SetAttribute("Remote", ns3.AddressValue(ns3.InetSocketAddress(destaddr, port)))
4.6 app = onOffHelper.Install(ns3.NodeContainer(node))
4.7 - app.Start(ns3.Seconds(ns3.UniformVariable(20, 30).GetValue()))
4.8 + app.Start(ns3.Seconds(ns3.UniformVariable(0.1, 1).GetValue()))
4.9
4.10 #internet.EnablePcapAll("wifi-olsr")
4.11 flowmon_helper = ns3.FlowMonitorHelper()
4.12 @@ -119,21 +119,31 @@
4.13 if st.rxPackets > 0:
4.14 print >> os, " Mean{Delay}: ", (st.delaySum.GetSeconds() / st.rxPackets)
4.15 print >> os, " Mean{Hop Count}: ", float(st.timesForwarded) / st.rxPackets + 1
4.16 - print >> os, "Delay Histogram"
4.17 - for i in range(st.delayHistogram.GetSize () ):
4.18 - print >> os, " ",i,"(", st.delayHistogram.GetBinStart (i), "-", st.delayHistogram.GetBinEnd (i), "): ", st.delayHistogram.GetBinCount (i)
4.19 - print >> os, "PacketSize Histogram"
4.20 - for i in range(st.packetSizeHistogram.GetSize () ):
4.21 - print >> os, " ",i,"(", st.packetSizeHistogram.GetBinStart (i), "-", st.packetSizeHistogram.GetBinEnd (i), "): ", st.packetSizeHistogram.GetBinCount (i)
4.22 + if 0:
4.23 + print >> os, "Delay Histogram"
4.24 + for i in range(st.delayHistogram.GetSize () ):
4.25 + print >> os, " ",i,"(", st.delayHistogram.GetBinStart (i), "-",\
4.26 + st.delayHistogram.GetBinEnd (i), "): ", st.delayHistogram.GetBinCount (i)
4.27 + print >> os, "PacketSize Histogram"
4.28 + for i in range(st.packetSizeHistogram.GetSize () ):
4.29 + print >> os, " ",i,"(", st.packetSizeHistogram.GetBinStart (i), "-",\
4.30 + st.packetSizeHistogram.GetBinEnd (i), "): ", st.packetSizeHistogram.GetBinCount (i)
4.31 +
4.32 + for reason, drops in enumerate(st.packetsDropped):
4.33 + print "Packets dropped by reason %i: %i" % (reason, drops)
4.34 + #for reason, drops in enumerate(st.bytesDropped):
4.35 + # print "Bytes dropped by reason %i: %i" % (reason, drops)
4.36
4.37 monitor.CheckForLostPackets()
4.38 classifier = flowmon_helper.GetClassifier()
4.39 +
4.40 for flow_id, flow_stats in monitor.GetFlowStats():
4.41 t = classifier.FindFlow(flow_id)
4.42 proto = {6: 'TCP', 17: 'UDP'} [t.protocol]
4.43 print "FlowID: %i (%s %s/%s --> %s/%i)" % \
4.44 (flow_id, proto, t.sourceAddress, t.sourcePort, t.destinationAddress, t.destinationPort)
4.45 - print_stats(sys.stdout, flow_stats)
4.46 + print_stats(sys.stdout, flow_stats)
4.47 +
4.48
4.49 return 0
4.50
5.1 --- a/src/contrib/flow-monitor/flow-monitor.cc Wed May 06 18:25:16 2009 +0100
5.2 +++ b/src/contrib/flow-monitor/flow-monitor.cc Wed May 06 18:25:50 2009 +0100
5.3 @@ -115,6 +115,8 @@
5.4 tracked.firstSeenTime = now;
5.5 tracked.lastSeenTime = tracked.firstSeenTime;
5.6 tracked.timesForwarded = 0;
5.7 + NS_LOG_DEBUG ("ReportFirstTx: adding tracked packet (flowId=" << flowId << ", packetId=" << packetId
5.8 + << ").");
5.9
5.10 probe->AddPacketStats (flowId, packetSize, Seconds (0));
5.11
5.12 @@ -185,9 +187,45 @@
5.13 stats.timeLastRxPacket = now;
5.14 stats.timesForwarded += tracked->second.timesForwarded;
5.15
5.16 + NS_LOG_DEBUG ("ReportLastTx: removing tracked packet (flowId="
5.17 + << flowId << ", packetId=" << packetId << ").");
5.18 +
5.19 m_trackedPackets.erase (tracked); // we don't need to track this packet anymore
5.20 }
5.21
5.22 +void
5.23 +FlowMonitor::ReportDrop (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize,
5.24 + uint32_t reasonCode)
5.25 +{
5.26 + if (!m_enabled)
5.27 + {
5.28 + return;
5.29 + }
5.30 + TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
5.31 + if (tracked == m_trackedPackets.end ())
5.32 + {
5.33 + NS_LOG_WARN ("Received packet drop report (flowId=" << flowId << ", packetId=" << packetId
5.34 + << ") but not known to be transmitted.");
5.35 + return;
5.36 + }
5.37 + probe->AddPacketDropStats (flowId, packetSize, reasonCode);
5.38 +
5.39 + FlowStats &stats = GetStatsForFlow (flowId);
5.40 + stats.lostPackets++;
5.41 + if (stats.packetsDropped.size () < reasonCode + 1)
5.42 + {
5.43 + stats.packetsDropped.resize (reasonCode + 1, 0);
5.44 + stats.bytesDropped.resize (reasonCode + 1, 0);
5.45 + }
5.46 + ++stats.packetsDropped[reasonCode];
5.47 + stats.bytesDropped[reasonCode] += packetSize;
5.48 +
5.49 + // we don't need to track this packet anymore
5.50 + // FIXME: this will not necessarily be true with broadcast/multicast
5.51 + NS_LOG_DEBUG ("ReportDrop: removing tracked packet (flowId="
5.52 + << flowId << ", packetId=" << packetId << ").");
5.53 + m_trackedPackets.erase (tracked);
5.54 +}
5.55
5.56 std::map<FlowId, FlowMonitor::FlowStats>
5.57 FlowMonitor::GetFlowStats () const
6.1 --- a/src/contrib/flow-monitor/flow-monitor.h Wed May 06 18:25:16 2009 +0100
6.2 +++ b/src/contrib/flow-monitor/flow-monitor.h Wed May 06 18:25:50 2009 +0100
6.3 @@ -55,6 +55,8 @@
6.4 Histogram delayHistogram;
6.5 Histogram jitterHistogram;
6.6 Histogram packetSizeHistogram;
6.7 + std::vector<uint32_t> packetsDropped; // packetsDropped[reasonCode] => number of dropped packets
6.8 + std::vector<uint64_t> bytesDropped; // bytesDropped[reasonCode] => number of dropped bytes
6.9 };
6.10
6.11 // --- basic methods ---
6.12 @@ -72,6 +74,8 @@
6.13 void ReportFirstTx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
6.14 void ReportForwarding (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
6.15 void ReportLastRx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
6.16 + void ReportDrop (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId,
6.17 + uint32_t packetSize, uint32_t reasonCode);
6.18
6.19
6.20 /// Check right now for packets that appear to be lost
7.1 --- a/src/contrib/flow-monitor/flow-probe.cc Wed May 06 18:25:16 2009 +0100
7.2 +++ b/src/contrib/flow-monitor/flow-probe.cc Wed May 06 18:25:50 2009 +0100
7.3 @@ -43,7 +43,21 @@
7.4 flow.bytes += packetSize;
7.5 ++flow.packets;
7.6 }
7.7 -
7.8 +
7.9 +void
7.10 +FlowProbe::AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode)
7.11 +{
7.12 + FlowStats &flow = m_stats[flowId];
7.13 +
7.14 + if (flow.packetsDropped.size () < reasonCode + 1)
7.15 + {
7.16 + flow.packetsDropped.resize (reasonCode + 1, 0);
7.17 + flow.bytesDropped.resize (reasonCode + 1, 0);
7.18 + }
7.19 + ++flow.packetsDropped[reasonCode];
7.20 + flow.bytesDropped[reasonCode] += packetSize;
7.21 +}
7.22 +
7.23 FlowProbe::Stats
7.24 FlowProbe::GetStats () const
7.25 {
8.1 --- a/src/contrib/flow-monitor/flow-probe.h Wed May 06 18:25:16 2009 +0100
8.2 +++ b/src/contrib/flow-monitor/flow-probe.h Wed May 06 18:25:50 2009 +0100
8.3 @@ -22,6 +22,7 @@
8.4 #define __FLOW_PROBE_H__
8.5
8.6 #include <map>
8.7 +#include <vector>
8.8
8.9 #include "ns3/ref-count-base.h"
8.10 #include "ns3/flow-classifier.h"
8.11 @@ -45,6 +46,8 @@
8.12 {
8.13 FlowStats () : delayFromFirstProbeSum (Seconds (0)), bytes (0), packets (0) {}
8.14
8.15 + std::vector<uint32_t> packetsDropped; // packetsDropped[reasonCode] => number of dropped packets
8.16 + std::vector<uint64_t> bytesDropped; // bytesDropped[reasonCode] => number of dropped bytes
8.17 Time delayFromFirstProbeSum; // divide by 'Scalar (packets)' to get the average delay
8.18 uint64_t bytes;
8.19 uint32_t packets;
8.20 @@ -53,6 +56,7 @@
8.21 typedef std::map<FlowId, FlowStats> Stats;
8.22
8.23 void AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
8.24 + void AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
8.25 Stats GetStats () const;
8.26
8.27 protected:
9.1 --- a/src/contrib/flow-monitor/ipv4-flow-classifier.cc Wed May 06 18:25:16 2009 +0100
9.2 +++ b/src/contrib/flow-monitor/ipv4-flow-classifier.cc Wed May 06 18:25:50 2009 +0100
9.3 @@ -103,6 +103,12 @@
9.4 Ipv4FlowClassifier::Classify (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
9.5 uint32_t *out_flowId, uint32_t *out_packetId)
9.6 {
9.7 + if (ipHeader.GetDestination () == Ipv4Address::GetBroadcast ())
9.8 + {
9.9 + // we are not prepared to handle broadcast yet
9.10 + return false;
9.11 + }
9.12 +
9.13 FiveTuple tuple;
9.14 tuple.sourceAddress = ipHeader.GetSource ();
9.15 tuple.destinationAddress = ipHeader.GetDestination ();
10.1 --- a/src/contrib/flow-monitor/ipv4-flow-probe.cc Wed May 06 18:25:16 2009 +0100
10.2 +++ b/src/contrib/flow-monitor/ipv4-flow-probe.cc Wed May 06 18:25:50 2009 +0100
10.3 @@ -21,10 +21,10 @@
10.4 #include "ns3/ipv4-flow-probe.h"
10.5 #include "ns3/ipv4-flow-classifier.h"
10.6 #include "ns3/node.h"
10.7 -#include "ns3/ipv4-l3-protocol.h"
10.8 #include "ns3/packet.h"
10.9 #include "ns3/flow-monitor.h"
10.10 #include "ns3/log.h"
10.11 +#include "ns3/pointer.h"
10.12
10.13 namespace ns3 {
10.14
10.15 @@ -43,7 +43,8 @@
10.16 m_classifier (classifier)
10.17 {
10.18 NS_LOG_FUNCTION (this << node->GetId ());
10.19 -
10.20 +
10.21 + m_ipv4 = node->GetObject<Ipv4> ();
10.22 Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
10.23
10.24 if (!ipv4->TraceConnectWithoutContext ("SendOutgoing",
10.25 @@ -61,6 +62,28 @@
10.26 {
10.27 NS_FATAL_ERROR ("trace fail");
10.28 }
10.29 +
10.30 + if (!ipv4->TraceConnectWithoutContext ("Drop",
10.31 + MakeCallback (&Ipv4FlowProbe::DropLogger, Ptr<Ipv4FlowProbe> (this))))
10.32 + {
10.33 + NS_FATAL_ERROR ("trace fail");
10.34 + }
10.35 +
10.36 +// for (uint32_t ifIndex = 0; ifIndex < m_ipv4->GetNInterfaces (); ifIndex++)
10.37 +// {
10.38 +// Ptr<NetDevice> device = m_ipv4->GetNetDevice (ifIndex);
10.39 +// if (!device)
10.40 +// continue;
10.41 +// PointerValue ptrval;
10.42 +// device->GetAttribute ("TxQueue", ptr);
10.43 +// Ptr<Queue> queue = ptrval.Get<Queue> ();
10.44 +
10.45 +// if (!queue->TraceConnectWithoutContext ("Drop",
10.46 +// MakeCallback (&Ipv4FlowProbe::QueueDropLogger, Ptr<Ipv4FlowProbe> (this))))
10.47 +// {
10.48 +// NS_FATAL_ERROR ("trace fail");
10.49 +// }
10.50 +// }
10.51 }
10.52
10.53 void
10.54 @@ -94,8 +117,7 @@
10.55
10.56 void
10.57 Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
10.58 -{
10.59 -
10.60 +{
10.61 FlowId flowId;
10.62 FlowPacketId packetId;
10.63
10.64 @@ -107,6 +129,62 @@
10.65 }
10.66 }
10.67
10.68 +void
10.69 +Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
10.70 + Ipv4L3Protocol::DropReason reason, uint32_t ifIndex)
10.71 +{
10.72 + switch (reason)
10.73 + {
10.74 + case Ipv4L3Protocol::DROP_NO_ROUTE:
10.75 + break;
10.76 +
10.77 + case Ipv4L3Protocol::DROP_TTL_EXPIRED:
10.78 + case Ipv4L3Protocol::DROP_BAD_CHECKSUM:
10.79 + Ipv4Address addri = m_ipv4->GetAddress (ifIndex);
10.80 + Ipv4Mask maski = m_ipv4->GetNetworkMask (ifIndex);
10.81 + Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski);
10.82 + if (ipHeader.GetDestination () == bcast) // we don't want broadcast packets
10.83 + {
10.84 + return;
10.85 + }
10.86 + }
10.87 +
10.88 + FlowId flowId;
10.89 + FlowPacketId packetId;
10.90 +
10.91 + if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
10.92 + {
10.93 + uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
10.94 + NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << reason
10.95 + << ", destIp=" << ipHeader.GetDestination () << ");");
10.96 +
10.97 + DropReason myReason;
10.98 +
10.99 +
10.100 + switch (reason)
10.101 + {
10.102 + case Ipv4L3Protocol::DROP_TTL_EXPIRED:
10.103 + myReason = DROP_TTL_EXPIRE;
10.104 + NS_LOG_DEBUG ("DROP_TTL_EXPIRE");
10.105 + break;
10.106 + case Ipv4L3Protocol::DROP_NO_ROUTE:
10.107 + myReason = DROP_NO_ROUTE;
10.108 + NS_LOG_DEBUG ("DROP_NO_ROUTE");
10.109 + break;
10.110 + case Ipv4L3Protocol::DROP_BAD_CHECKSUM:
10.111 + myReason = DROP_BAD_CHECKSUM;
10.112 + NS_LOG_DEBUG ("DROP_BAD_CHECKSUM");
10.113 + break;
10.114 + default:
10.115 + myReason = DROP_INVALID_REASON;
10.116 + NS_FATAL_ERROR ("Unexpected drop reason code " << reason);
10.117 + }
10.118 +
10.119 + m_flowMonitor->ReportDrop (this, flowId, packetId, size, myReason);
10.120 + }
10.121 +}
10.122 +
10.123 +
10.124 } // namespace ns3
10.125
10.126
11.1 --- a/src/contrib/flow-monitor/ipv4-flow-probe.h Wed May 06 18:25:16 2009 +0100
11.2 +++ b/src/contrib/flow-monitor/ipv4-flow-probe.h Wed May 06 18:25:50 2009 +0100
11.3 @@ -23,6 +23,7 @@
11.4
11.5 #include "ns3/flow-probe.h"
11.6 #include "ns3/ipv4-flow-classifier.h"
11.7 +#include "ns3/ipv4-l3-protocol.h"
11.8
11.9 namespace ns3 {
11.10
11.11 @@ -36,13 +37,25 @@
11.12 Ipv4FlowProbe (Ptr<FlowMonitor> monitor, Ptr<Ipv4FlowClassifier> classifier, Ptr<Node> node);
11.13 ~Ipv4FlowProbe ();
11.14
11.15 + enum DropReason
11.16 + {
11.17 + DROP_NO_ROUTE = 0,
11.18 + DROP_TTL_EXPIRE,
11.19 + DROP_BAD_CHECKSUM,
11.20 + // DROP_QUEUE, // TODO: this is not easy to do
11.21 + DROP_INVALID_REASON,
11.22 + };
11.23 +
11.24 private:
11.25
11.26 void SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
11.27 void ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
11.28 void ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
11.29 + void DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
11.30 + Ipv4L3Protocol::DropReason reason, uint32_t ifIndex);
11.31
11.32 Ptr<Ipv4FlowClassifier> m_classifier;
11.33 + Ptr<Ipv4> m_ipv4;
11.34 };
11.35
11.36