replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 // Copyright (c) 2009 INESC Porto
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
7 // published by the Free Software Foundation;
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
21 #ifndef __FLOW_PROBE_H__
22 #define __FLOW_PROBE_H__
27 #include "ns3/simple-ref-count.h"
28 #include "ns3/flow-classifier.h"
29 #include "ns3/nstime.h"
35 /// The FlowProbe class is responsible for listening for packet events
36 /// in a specific point of the simulated space, report those events to
37 /// the global FlowMonitor, and collect its own flow statistics
38 /// regarding only the packets that pass through that probe.
39 class FlowProbe : public SimpleRefCount<FlowProbe>
43 FlowProbe (Ptr<FlowMonitor> flowMonitor);
46 virtual ~FlowProbe ();
50 FlowStats () : delayFromFirstProbeSum (Seconds (0)), bytes (0), packets (0) {}
52 /// packetsDropped[reasonCode] => number of dropped packets
53 std::vector<uint32_t> packetsDropped;
54 /// bytesDropped[reasonCode] => number of dropped bytes
55 std::vector<uint64_t> bytesDropped;
56 /// divide by 'Scalar (packets)' to get the average delay from the
57 /// first (entry) probe up to this one (partial delay)
58 Time delayFromFirstProbeSum;
59 /// Number of bytes seen of this flow
61 /// Number of packets seen of this flow
65 typedef std::map<FlowId, FlowStats> Stats;
67 void AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
68 void AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
70 /// Get the partial flow statistics stored in this probe. With this
71 /// information you can, for example, find out what is the delay
72 /// from the first probe to this one.
73 Stats GetStats () const;
75 void SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const;
78 Ptr<FlowMonitor> m_flowMonitor;