A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
flow-probe.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2009 INESC Porto
4 //
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;
8 //
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.
13 //
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
17 //
18 // Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
19 //
20 
21 #ifndef FLOW_PROBE_H
22 #define FLOW_PROBE_H
23 
24 #include <map>
25 #include <vector>
26 
27 #include "ns3/simple-ref-count.h"
28 #include "ns3/flow-classifier.h"
29 #include "ns3/nstime.h"
30 
31 namespace ns3 {
32 
33 class FlowMonitor;
34 
39 class FlowProbe : public SimpleRefCount<FlowProbe>
40 {
41 private:
42  FlowProbe (FlowProbe const &);
43  FlowProbe& operator= (FlowProbe const &);
44 
45 protected:
46 
47  FlowProbe (Ptr<FlowMonitor> flowMonitor);
48 
49 public:
50  virtual ~FlowProbe ();
51 
52  struct FlowStats
53  {
55 
57  std::vector<uint32_t> packetsDropped;
59  std::vector<uint64_t> bytesDropped;
64  uint64_t bytes;
66  uint32_t packets;
67  };
68 
69  typedef std::map<FlowId, FlowStats> Stats;
70 
71  void AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
72  void AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
73 
77  Stats GetStats () const;
78 
79  void SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const;
80 
81 protected:
84 
85 };
86 
87 
88 } // namespace ns3
89 
90 #endif /* FLOW_PROBE_H */