1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/contrib/flow-monitor/design.txt Tue Apr 21 19:04:32 2009 +0100
1.3 @@ -0,0 +1,31 @@
1.4 +
1.5 +* One FlowMonitor per simulation
1.6 +
1.7 +* One FlowClassifier per simulation
1.8 + - Assigns integer simulation unique identifiers to each flow
1.9 + - Contains a classification method that maps parameters
1.10 + (e.g. packets or packet headers) to the corresponding flow
1.11 + identifier;
1.12 + - FlowClassifier is abstract, needs a concrete subclass
1.13 + > Ipv4FlowClassifier
1.14 +
1.15 +* Typically (but not necessarily) one FlowProbe node
1.16 + - Is responsible for acquiring the packet data
1.17 + - Works with FlowClassifier
1.18 + - FlowProbe is abstract, needs a concrete subclass
1.19 + > Ipv4FlowProbe
1.20 + - Ipv4FlowProbe needs a matching classifier, Ipv4FlowClassifier
1.21 +
1.22 +* One ProbeFlowStats object per simulation flow per FlowProbe
1.23 + - Indexed by the FlowId
1.24 + - Bytes
1.25 + - Packets
1.26 + - Delay from first probe until the packet is received in this probe
1.27 +
1.28 +* One EndToEndFlowStats object per flow per FlowMonitor
1.29 + - Lost packets
1.30 + - Lost bytes
1.31 + - Bytes
1.32 + - Packets
1.33 + - End-to-end delays
1.34 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/src/contrib/flow-monitor/flow-classifier.cc Tue Apr 21 19:04:32 2009 +0100
2.3 @@ -0,0 +1,57 @@
2.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2.5 +//
2.6 +// Copyright (c) 2009 INESC Porto
2.7 +//
2.8 +// This program is free software; you can redistribute it and/or modify
2.9 +// it under the terms of the GNU General Public License version 2 as
2.10 +// published by the Free Software Foundation;
2.11 +//
2.12 +// This program is distributed in the hope that it will be useful,
2.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 +// GNU General Public License for more details.
2.16 +//
2.17 +// You should have received a copy of the GNU General Public License
2.18 +// along with this program; if not, write to the Free Software
2.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2.20 +//
2.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
2.22 +//
2.23 +
2.24 +#include "flow-classifier.h"
2.25 +
2.26 +namespace ns3 {
2.27 +
2.28 +TypeId
2.29 +FlowClassifier::GetTypeId (void)
2.30 +{
2.31 + static TypeId tid = TypeId ("ns3::FlowClassifier")
2.32 + .SetParent<Object> ()
2.33 + ;
2.34 + return tid;
2.35 +}
2.36 +
2.37 +
2.38 +TypeId
2.39 +FlowClassifier::GetInstanceTypeId (void) const
2.40 +{
2.41 + return GetTypeId ();
2.42 +}
2.43 +
2.44 +
2.45 +FlowClassifier::FlowClassifier ()
2.46 + :
2.47 + m_lastNewFlowId (0)
2.48 +{
2.49 +}
2.50 +
2.51 +
2.52 +FlowId
2.53 +FlowClassifier::GetNewFlowId ()
2.54 +{
2.55 + return ++m_lastNewFlowId;
2.56 +}
2.57 +
2.58 +
2.59 +} // namespace ns3
2.60 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/contrib/flow-monitor/flow-classifier.h Tue Apr 21 19:04:32 2009 +0100
3.3 @@ -0,0 +1,50 @@
3.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3.5 +//
3.6 +// Copyright (c) 2009 INESC Porto
3.7 +//
3.8 +// This program is free software; you can redistribute it and/or modify
3.9 +// it under the terms of the GNU General Public License version 2 as
3.10 +// published by the Free Software Foundation;
3.11 +//
3.12 +// This program is distributed in the hope that it will be useful,
3.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.15 +// GNU General Public License for more details.
3.16 +//
3.17 +// You should have received a copy of the GNU General Public License
3.18 +// along with this program; if not, write to the Free Software
3.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3.20 +//
3.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
3.22 +//
3.23 +
3.24 +#ifndef __FLOW_MONITOR_PROBE_H__
3.25 +#define __FLOW_MONITOR_PROBE_H__
3.26 +
3.27 +#include "ns3/object.h"
3.28 +
3.29 +namespace ns3 {
3.30 +
3.31 +typedef uint32_t FlowId;
3.32 +
3.33 +
3.34 +class FlowClassifier : public Object
3.35 +{
3.36 + FlowId m_lastNewFlowId;
3.37 +
3.38 +public:
3.39 +
3.40 + static TypeId GetTypeId (void);
3.41 + virtual TypeId GetInstanceTypeId (void) const;
3.42 + FlowClassifier ();
3.43 +
3.44 +protected:
3.45 + FlowId GetNewFlowId ();
3.46 +
3.47 +};
3.48 +
3.49 +
3.50 +} // namespace ns3
3.51 +
3.52 +#endif
3.53 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/contrib/flow-monitor/flow-monitor.cc Tue Apr 21 19:04:32 2009 +0100
4.3 @@ -0,0 +1,52 @@
4.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4.5 +//
4.6 +// Copyright (c) 2009 INESC Porto
4.7 +//
4.8 +// This program is free software; you can redistribute it and/or modify
4.9 +// it under the terms of the GNU General Public License version 2 as
4.10 +// published by the Free Software Foundation;
4.11 +//
4.12 +// This program is distributed in the hope that it will be useful,
4.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.15 +// GNU General Public License for more details.
4.16 +//
4.17 +// You should have received a copy of the GNU General Public License
4.18 +// along with this program; if not, write to the Free Software
4.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4.20 +//
4.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
4.22 +//
4.23 +
4.24 +#include "flow-monitor.h"
4.25 +
4.26 +namespace ns3 {
4.27 +
4.28 +
4.29 +FlowMonitor::FlowMonitor ()
4.30 +{
4.31 +}
4.32 +
4.33 +void
4.34 +FlowMonitor::ReportFirstTx (uint32_t flowId, uint32_t packetId)
4.35 +{
4.36 +}
4.37 +
4.38 +
4.39 +void
4.40 +FlowMonitor::ReportLastRx (uint32_t flowId, uint32_t packetId)
4.41 +{
4.42 +}
4.43 +
4.44 +
4.45 +std::vector<FlowMonitor::Flow>
4.46 +FlowMonitor::GetFlows () const
4.47 +{
4.48 + std::vector<FlowMonitor::Flow> retval;
4.49 + // TODO
4.50 + return retval;
4.51 +}
4.52 +
4.53 +
4.54 +} // namespace ns3
4.55 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/src/contrib/flow-monitor/flow-monitor.h Tue Apr 21 19:04:32 2009 +0100
5.3 @@ -0,0 +1,82 @@
5.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
5.5 +//
5.6 +// Copyright (c) 2009 INESC Porto
5.7 +//
5.8 +// This program is free software; you can redistribute it and/or modify
5.9 +// it under the terms of the GNU General Public License version 2 as
5.10 +// published by the Free Software Foundation;
5.11 +//
5.12 +// This program is distributed in the hope that it will be useful,
5.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
5.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.15 +// GNU General Public License for more details.
5.16 +//
5.17 +// You should have received a copy of the GNU General Public License
5.18 +// along with this program; if not, write to the Free Software
5.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5.20 +//
5.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
5.22 +//
5.23 +
5.24 +#ifndef __FLOW_MONITOR_H__
5.25 +#define __FLOW_MONITOR_H__
5.26 +
5.27 +#include <vector>
5.28 +#include <map>
5.29 +
5.30 +#include "ns3/ptr.h"
5.31 +#include "ns3/flow-probe.h"
5.32 +#include "ns3/nstime.h"
5.33 +
5.34 +namespace ns3 {
5.35 +
5.36 +
5.37 +class FlowMonitor
5.38 +{
5.39 +public:
5.40 +
5.41 + struct FlowStats
5.42 + {
5.43 + uint64_t txPackets;
5.44 + uint64_t rxPackets;
5.45 + uint64_t lostPackets;
5.46 + uint64_t txBytes;
5.47 + uint64_t rxBytes;
5.48 + Time delaySum; // delayCount == rxPackets
5.49 + };
5.50 +
5.51 + struct Flow
5.52 + {
5.53 + uint32_t flowId;
5.54 + FlowStats flowStats;
5.55 + };
5.56 +
5.57 + // basic methods
5.58 + FlowMonitor ();
5.59 + //void AddProbe (Ptr<FlowProbe> probe);
5.60 +
5.61 + // common scenario utility methods
5.62 + //void MonitorIpv4AllNodes ();
5.63 +
5.64 + // methods to be used by the FlowMonitorProbe's
5.65 + void ReportFirstTx (uint32_t flowId, uint32_t packetId);
5.66 + void ReportLastRx (uint32_t flowId, uint32_t packetId);
5.67 +
5.68 + std::vector<Flow> GetFlows () const;
5.69 +
5.70 +private:
5.71 +
5.72 + struct TrackedPacket
5.73 + {
5.74 + Time firstTxTime;
5.75 + };
5.76 +
5.77 + std::map<uint32_t, FlowStats> m_flowStats;
5.78 + std::map<uint32_t, TrackedPacket> m_trackedPackets;
5.79 +};
5.80 +
5.81 +
5.82 +} // namespace ns3
5.83 +
5.84 +#endif
5.85 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/contrib/flow-monitor/flow-probe.h Tue Apr 21 19:04:32 2009 +0100
6.3 @@ -0,0 +1,39 @@
6.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6.5 +//
6.6 +// Copyright (c) 2009 INESC Porto
6.7 +//
6.8 +// This program is free software; you can redistribute it and/or modify
6.9 +// it under the terms of the GNU General Public License version 2 as
6.10 +// published by the Free Software Foundation;
6.11 +//
6.12 +// This program is distributed in the hope that it will be useful,
6.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
6.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.15 +// GNU General Public License for more details.
6.16 +//
6.17 +// You should have received a copy of the GNU General Public License
6.18 +// along with this program; if not, write to the Free Software
6.19 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6.20 +//
6.21 +// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
6.22 +//
6.23 +
6.24 +#ifndef __FLOW_PROBE_H__
6.25 +#define __FLOW_PROBE_H__
6.26 +
6.27 +#include "ns3/ref-count-base.h"
6.28 +
6.29 +namespace ns3 {
6.30 +
6.31 +
6.32 +class FlowProbe : public RefCountBase
6.33 +{
6.34 +
6.35 +
6.36 +};
6.37 +
6.38 +
6.39 +} // namespace ns3
6.40 +
6.41 +#endif
6.42 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/contrib/flow-monitor/waf Tue Apr 21 19:04:32 2009 +0100
7.3 @@ -0,0 +1,2 @@
7.4 +#! /bin/sh
7.5 +exec "`dirname "$0"`"/../../../waf "$@"
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/contrib/flow-monitor/wscript Tue Apr 21 19:04:32 2009 +0100
8.3 @@ -0,0 +1,16 @@
8.4 +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
8.5 +
8.6 +def build(bld):
8.7 + obj = bld.create_ns3_module('flow-monitor', ['internet-stack'])
8.8 + obj.source = [
8.9 + 'flow-monitor.cc',
8.10 + 'flow-classifier.cc',
8.11 + ]
8.12 + headers = bld.create_obj('ns3header')
8.13 + headers.module = 'flow-monitor'
8.14 + headers.source = [
8.15 + 'flow-monitor.h',
8.16 + 'flow-probe.h',
8.17 + 'flow-classifier.h',
8.18 + ]
8.19 +
9.1 --- a/src/wscript Tue Apr 21 15:13:50 2009 +0100
9.2 +++ b/src/wscript Tue Apr 21 19:04:32 2009 +0100
9.3 @@ -29,6 +29,7 @@
9.4 'helper',
9.5 'devices/bridge',
9.6 'contrib/stats',
9.7 + 'contrib/flow-monitor',
9.8 )
9.9
9.10 def set_options(opt):