/usr/include/ns3.26/ns3/flow-probe.h is in libns3-dev 3.26+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef FLOW_PROBE_H
#define FLOW_PROBE_H
#include <map>
#include <vector>
#include "ns3/object.h"
#include "ns3/flow-classifier.h"
#include "ns3/nstime.h"
namespace ns3 {
class FlowMonitor;
/// The FlowProbe class is responsible for listening for packet events
/// in a specific point of the simulated space, report those events to
/// the global FlowMonitor, and collect its own flow statistics
/// regarding only the packets that pass through that probe.
class FlowProbe : public Object
{
private:
/// Defined and not implemented to avoid misuse
FlowProbe (FlowProbe const &);
/// Defined and not implemented to avoid misuse
/// \returns
FlowProbe& operator= (FlowProbe const &);
protected:
/// Constructor
/// \param flowMonitor the FlowMonitor this probe is associated with
FlowProbe (Ptr<FlowMonitor> flowMonitor);
virtual void DoDispose (void);
public:
virtual ~FlowProbe ();
/// Register this type.
/// \return The TypeId.
static TypeId GetTypeId (void);
/// Structure to hold the statistics of a flow
struct FlowStats
{
FlowStats () : delayFromFirstProbeSum (Seconds (0)), bytes (0), packets (0) {}
/// packetsDropped[reasonCode] => number of dropped packets
std::vector<uint32_t> packetsDropped;
/// bytesDropped[reasonCode] => number of dropped bytes
std::vector<uint64_t> bytesDropped;
/// divide by 'packets' to get the average delay from the
/// first (entry) probe up to this one (partial delay)
Time delayFromFirstProbeSum;
/// Number of bytes seen of this flow
uint64_t bytes;
/// Number of packets seen of this flow
uint32_t packets;
};
/// Container to map FlowId -> FlowStats
typedef std::map<FlowId, FlowStats> Stats;
/// Add a packet data to the flow stats
/// \param flowId the flow Identifier
/// \param packetSize the packet size
/// \param delayFromFirstProbe packet delay
void AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
/// Add a packet drop data to the flow stats
/// \param flowId the flow Identifier
/// \param packetSize the packet size
/// \param reasonCode reason code for the drop
void AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
/// Get the partial flow statistics stored in this probe. With this
/// information you can, for example, find out what is the delay
/// from the first probe to this one.
/// \returns the partial flow statistics
Stats GetStats () const;
/// Serializes the results to an std::ostream in XML format
/// \param os the output stream
/// \param indent number of spaces to use as base indentation level
/// \param index FlowProbe index
void SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const;
protected:
Ptr<FlowMonitor> m_flowMonitor; //!< the FlowMonitor instance
Stats m_stats; //!< The flow stats
};
} // namespace ns3
#endif /* FLOW_PROBE_H */
|