1.1 --- a/bindings/python/ns3_module_core.py Wed Apr 29 11:42:22 2009 +0100
1.2 +++ b/bindings/python/ns3_module_core.py Wed Apr 29 12:57:03 2009 +0100
1.3 @@ -160,6 +160,7 @@
1.4 ## traced-value.h: ns3::TracedValue<unsigned int> [class]
1.5 root_module['ns3::TracedValue< unsigned int >'].implicitly_converts_to(root_module['ns3::EnumValue'])
1.6 module.add_container('std::set< ns3::TypeId >', 'ns3::TypeId', container_type='set')
1.7 + module.add_container('std::vector< ns3::Ptr< ns3::FlowProbe > >', 'ns3::Ptr< ns3::FlowProbe >', container_type='vector')
1.8
1.9 ## Register a nested module for the namespace Config
1.10
2.1 --- a/bindings/python/ns3_module_flow_monitor.py Wed Apr 29 11:42:22 2009 +0100
2.2 +++ b/bindings/python/ns3_module_flow_monitor.py Wed Apr 29 12:57:03 2009 +0100
2.3 @@ -167,6 +167,10 @@
2.4 is_const=True, is_virtual=True)
2.5 ## flow-monitor.h: ns3::FlowMonitor::FlowMonitor() [constructor]
2.6 cls.add_constructor([])
2.7 + ## flow-monitor.h: void ns3::FlowMonitor::AddProbe(ns3::Ptr<ns3::FlowProbe> probe) [member function]
2.8 + cls.add_method('AddProbe',
2.9 + 'void',
2.10 + [param('ns3::Ptr< ns3::FlowProbe >', 'probe')])
2.11 ## flow-monitor.h: void ns3::FlowMonitor::ReportFirstTx(ns3::Ptr<ns3::FlowProbe> probe, ns3::FlowId flowId, ns3::FlowPacketId packetId, uint32_t packetSize) [member function]
2.12 cls.add_method('ReportFirstTx',
2.13 'void',
2.14 @@ -192,6 +196,11 @@
2.15 'std::map< unsigned int, ns3::FlowMonitor::FlowStats >',
2.16 [],
2.17 is_const=True)
2.18 + ## flow-monitor.h: std::vector<ns3::Ptr<ns3::FlowProbe>, std::allocator<ns3::Ptr<ns3::FlowProbe> > > ns3::FlowMonitor::GetAllProbes() const [member function]
2.19 + cls.add_method('GetAllProbes',
2.20 + 'std::vector< ns3::Ptr< ns3::FlowProbe > >',
2.21 + [],
2.22 + is_const=True)
2.23 ## flow-monitor.h: void ns3::FlowMonitor::NotifyConstructionCompleted() [member function]
2.24 cls.add_method('NotifyConstructionCompleted',
2.25 'void',
3.1 --- a/bindings/python/ns3_module_helper.py Wed Apr 29 11:42:22 2009 +0100
3.2 +++ b/bindings/python/ns3_module_helper.py Wed Apr 29 12:57:03 2009 +0100
3.3 @@ -9,6 +9,8 @@
3.4 module.add_class('BridgeHelper', allow_subclassing=False)
3.5 ## csma-helper.h: ns3::CsmaHelper [class]
3.6 module.add_class('CsmaHelper', allow_subclassing=False)
3.7 + ## flow-monitor-helper.h: ns3::FlowMonitorHelper [class]
3.8 + module.add_class('FlowMonitorHelper', allow_subclassing=False)
3.9 ## internet-stack-helper.h: ns3::InternetStackHelper [class]
3.10 module.add_class('InternetStackHelper', allow_subclassing=False)
3.11 ## ipv4-address-helper.h: ns3::Ipv4AddressHelper [class]
3.12 @@ -86,6 +88,7 @@
3.13 register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
3.14 register_Ns3BridgeHelper_methods(root_module, root_module['ns3::BridgeHelper'])
3.15 register_Ns3CsmaHelper_methods(root_module, root_module['ns3::CsmaHelper'])
3.16 + register_Ns3FlowMonitorHelper_methods(root_module, root_module['ns3::FlowMonitorHelper'])
3.17 register_Ns3InternetStackHelper_methods(root_module, root_module['ns3::InternetStackHelper'])
3.18 register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
3.19 register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
3.20 @@ -239,6 +242,25 @@
3.21 [param('ns3::NodeContainer const &', 'c'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')])
3.22 return
3.23
3.24 +def register_Ns3FlowMonitorHelper_methods(root_module, cls):
3.25 + ## flow-monitor-helper.h: ns3::FlowMonitorHelper::FlowMonitorHelper(ns3::FlowMonitorHelper const & arg0) [copy constructor]
3.26 + cls.add_constructor([param('ns3::FlowMonitorHelper const &', 'arg0')])
3.27 + ## flow-monitor-helper.h: ns3::FlowMonitorHelper::FlowMonitorHelper() [constructor]
3.28 + cls.add_constructor([])
3.29 + ## flow-monitor-helper.h: void ns3::FlowMonitorHelper::SetMonitorAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
3.30 + cls.add_method('SetMonitorAttribute',
3.31 + 'void',
3.32 + [param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
3.33 + ## flow-monitor-helper.h: ns3::Ptr<ns3::FlowMonitor> ns3::FlowMonitorHelper::Install(ns3::NodeContainer nodes) [member function]
3.34 + cls.add_method('Install',
3.35 + 'ns3::Ptr< ns3::FlowMonitor >',
3.36 + [param('ns3::NodeContainer', 'nodes')])
3.37 + ## flow-monitor-helper.h: ns3::Ptr<ns3::FlowMonitor> ns3::FlowMonitorHelper::Install(ns3::Ptr<ns3::Node> node) [member function]
3.38 + cls.add_method('Install',
3.39 + 'ns3::Ptr< ns3::FlowMonitor >',
3.40 + [param('ns3::Ptr< ns3::Node >', 'node')])
3.41 + return
3.42 +
3.43 def register_Ns3InternetStackHelper_methods(root_module, cls):
3.44 ## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper(ns3::InternetStackHelper const & arg0) [copy constructor]
3.45 cls.add_constructor([param('ns3::InternetStackHelper const &', 'arg0')])
4.1 --- a/bindings/python/ns3_module_node.py Wed Apr 29 11:42:22 2009 +0100
4.2 +++ b/bindings/python/ns3_module_node.py Wed Apr 29 12:57:03 2009 +0100
4.3 @@ -487,6 +487,11 @@
4.4 'ns3::Ipv4Mask',
4.5 [],
4.6 is_static=True)
4.7 + ## ipv4-address.h: static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function]
4.8 + cls.add_method('GetOnes',
4.9 + 'ns3::Ipv4Mask',
4.10 + [],
4.11 + is_static=True)
4.12 ## ipv4-address.h: static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function]
4.13 cls.add_method('GetZero',
4.14 'ns3::Ipv4Mask',
5.1 --- a/src/contrib/flow-monitor/flow-monitor.cc Wed Apr 29 11:42:22 2009 +0100
5.2 +++ b/src/contrib/flow-monitor/flow-monitor.cc Wed Apr 29 12:57:03 2009 +0100
5.3 @@ -28,6 +28,8 @@
5.4
5.5 NS_LOG_COMPONENT_DEFINE ("FlowMonitor");
5.6
5.7 +NS_OBJECT_ENSURE_REGISTERED (FlowMonitor);
5.8 +
5.9
5.10 TypeId
5.11 FlowMonitor::GetTypeId (void)
5.12 @@ -192,6 +194,18 @@
5.13 Simulator::Schedule (PERIODIC_CHECK_INTERVAL, &FlowMonitor::PeriodicCheckForLostPackets, this);
5.14 }
5.15
5.16 +void
5.17 +FlowMonitor::AddProbe (Ptr<FlowProbe> probe)
5.18 +{
5.19 + m_flowProbes.push_back (probe);
5.20 +}
5.21 +
5.22 +std::vector< Ptr<FlowProbe> >
5.23 +FlowMonitor::GetAllProbes () const
5.24 +{
5.25 + return m_flowProbes;
5.26 +}
5.27 +
5.28
5.29 } // namespace ns3
5.30
6.1 --- a/src/contrib/flow-monitor/flow-monitor.h Wed Apr 29 11:42:22 2009 +0100
6.2 +++ b/src/contrib/flow-monitor/flow-monitor.h Wed Apr 29 12:57:03 2009 +0100
6.3 @@ -48,26 +48,26 @@
6.4 uint32_t timesForwarded; // number of times a packet was forwarded, summed for all packets
6.5 };
6.6
6.7 - // basic methods
6.8 + // --- basic methods ---
6.9 static TypeId GetTypeId ();
6.10 TypeId GetInstanceTypeId () const;
6.11 -
6.12 FlowMonitor ();
6.13
6.14 - //void AddProbe (Ptr<FlowProbe> probe);
6.15 - // common scenario utility methods
6.16 - //void MonitorIpv4AllNodes ();
6.17 -
6.18 - // methods to be used by the FlowMonitorProbe's
6.19 + // --- methods to be used by the FlowMonitorProbe's only ---
6.20 + void AddProbe (Ptr<FlowProbe> probe);
6.21 void ReportFirstTx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
6.22 void ReportForwarding (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
6.23 void ReportLastRx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
6.24
6.25 + /// Check right now for packets that appear to be lost
6.26 void CheckForLostPackets ();
6.27 - void CheckForLostPackets (Time maxDelay);
6.28 -
6.29 + void CheckForLostPackets (Time maxDelay);
6.30 +
6.31 + // --- methods to get the results ---
6.32 // remember to call CheckForLostPackets first!
6.33 std::map<FlowId, FlowStats> GetFlowStats () const;
6.34 + std::vector< Ptr<FlowProbe> > GetAllProbes () const;
6.35 +
6.36
6.37 protected:
6.38
6.39 @@ -89,7 +89,7 @@
6.40 typedef std::map< std::pair<FlowId, FlowPacketId>, TrackedPacket> TrackedPacketMap;
6.41 TrackedPacketMap m_trackedPackets;
6.42 Time m_maxPerHopDelay;
6.43 -
6.44 + std::vector< Ptr<FlowProbe> > m_flowProbes;
6.45
6.46 FlowStats& GetStatsForFlow (FlowId flowId);
6.47 void PeriodicCheckForLostPackets ();
7.1 --- a/src/contrib/flow-monitor/flow-probe.cc Wed Apr 29 11:42:22 2009 +0100
7.2 +++ b/src/contrib/flow-monitor/flow-probe.cc Wed Apr 29 12:57:03 2009 +0100
7.3 @@ -32,6 +32,7 @@
7.4 FlowProbe::FlowProbe (Ptr<FlowMonitor> flowMonitor)
7.5 : m_flowMonitor (flowMonitor)
7.6 {
7.7 + m_flowMonitor->AddProbe (this);
7.8 }
7.9
7.10 void
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/helper/flow-monitor-helper.cc Wed Apr 29 12:57:03 2009 +0100
8.3 @@ -0,0 +1,63 @@
8.4 +// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
8.5 +//
8.6 +// Copyright (c) 2009 INESC Porto
8.7 +//
8.8 +// This program is free software; you can redistribute it and/or modify
8.9 +// it under the terms of the GNU General Public License version 2 as
8.10 +// published by the Free Software Foundation;
8.11 +//
8.12 +// This program is distributed in the hope that it will be useful,
8.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
8.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.15 +// GNU General Public License for more details.
8.16 +//
8.17 +// You should have received a copy of the GNU General Public License
8.18 +// along with this program; if not, write to the Free Software
8.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8.20 +//
8.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
8.22 +//
8.23 +#include "flow-monitor-helper.h"
8.24 +
8.25 +#include "ns3/flow-monitor.h"
8.26 +#include "ns3/ipv4-flow-classifier.h"
8.27 +#include "ns3/ipv4-flow-probe.h"
8.28 +#include "ns3/node.h"
8.29 +
8.30 +namespace ns3 {
8.31 +
8.32 +FlowMonitorHelper::FlowMonitorHelper ()
8.33 +{
8.34 + m_monitorFactory.SetTypeId ("ns3::FlowMonitor");
8.35 +}
8.36 +
8.37 +void
8.38 +FlowMonitorHelper::SetMonitorAttribute (std::string n1, const AttributeValue &v1)
8.39 +{
8.40 + m_monitorFactory.Set (n1, v1);
8.41 +}
8.42 +
8.43 +Ptr<FlowMonitor>
8.44 +FlowMonitorHelper::Install (Ptr<Node> node)
8.45 +{
8.46 + if (!m_flowMonitor)
8.47 + {
8.48 + m_flowMonitor = m_monitorFactory.Create<FlowMonitor> ();
8.49 + m_flowClassifier = Create<Ipv4FlowClassifier> ();
8.50 + }
8.51 + Ptr<Ipv4FlowProbe> probe = Create<Ipv4FlowProbe> (m_flowMonitor, m_flowClassifier, node);
8.52 + return m_flowMonitor;
8.53 +}
8.54 +
8.55 +
8.56 +Ptr<FlowMonitor>
8.57 +FlowMonitorHelper::Install (NodeContainer nodes)
8.58 +{
8.59 + for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
8.60 + {
8.61 + Install (*i);
8.62 + }
8.63 + return m_flowMonitor;
8.64 +}
8.65 +
8.66 +} // namespace ns3
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/src/helper/flow-monitor-helper.h Wed Apr 29 12:57:03 2009 +0100
9.3 @@ -0,0 +1,50 @@
9.4 +// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
9.5 +//
9.6 +// Copyright (c) 2009 INESC Porto
9.7 +//
9.8 +// This program is free software; you can redistribute it and/or modify
9.9 +// it under the terms of the GNU General Public License version 2 as
9.10 +// published by the Free Software Foundation;
9.11 +//
9.12 +// This program is distributed in the hope that it will be useful,
9.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
9.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.15 +// GNU General Public License for more details.
9.16 +//
9.17 +// You should have received a copy of the GNU General Public License
9.18 +// along with this program; if not, write to the Free Software
9.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9.20 +//
9.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
9.22 +//
9.23 +#ifndef FLOW_MONITOR_HELPER_H
9.24 +#define FLOW_MONITOR_HELPER_H
9.25 +
9.26 +#include "node-container.h"
9.27 +#include "ns3/object-factory.h"
9.28 +#include "ns3/flow-monitor.h"
9.29 +#include <string>
9.30 +
9.31 +namespace ns3 {
9.32 +
9.33 +class AttributeValue;
9.34 +class Ipv4FlowClassifier;
9.35 +
9.36 +class FlowMonitorHelper
9.37 +{
9.38 +public:
9.39 + FlowMonitorHelper ();
9.40 + void SetMonitorAttribute (std::string n1, const AttributeValue &v1);
9.41 + Ptr<FlowMonitor> Install (NodeContainer nodes);
9.42 + Ptr<FlowMonitor> Install (Ptr<Node> node);
9.43 +
9.44 +private:
9.45 + ObjectFactory m_monitorFactory;
9.46 + Ptr<FlowMonitor> m_flowMonitor;
9.47 + Ptr<Ipv4FlowClassifier> m_flowClassifier;
9.48 +};
9.49 +
9.50 +} // namespace ns3
9.51 +
9.52 +
9.53 +#endif /* FLOW_MONITOR_HELPER_H */
10.1 --- a/src/helper/wscript Wed Apr 29 11:42:22 2009 +0100
10.2 +++ b/src/helper/wscript Wed Apr 29 12:57:03 2009 +0100
10.3 @@ -21,6 +21,7 @@
10.4 'ipv4-interface-container.cc',
10.5 'udp-echo-helper.cc',
10.6 'bridge-helper.cc',
10.7 + 'flow-monitor-helper.cc',
10.8 ]
10.9
10.10 headers = bld.create_obj('ns3header')
10.11 @@ -44,4 +45,5 @@
10.12 'ipv4-interface-container.h',
10.13 'udp-echo-helper.h',
10.14 'bridge-helper.h',
10.15 + 'flow-monitor-helper.h',
10.16 ]