A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
flow-monitor-helper.h
Go to the documentation of this file.
1//
2// Copyright (c) 2009 INESC Porto
3//
4// SPDX-License-Identifier: GPL-2.0-only
5//
6// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
7//
8#ifndef FLOW_MONITOR_HELPER_H
9#define FLOW_MONITOR_HELPER_H
10
11#include "ns3/flow-classifier.h"
12#include "ns3/flow-monitor.h"
13#include "ns3/node-container.h"
14#include "ns3/object-factory.h"
15
16#include <string>
17
18namespace ns3
19{
20
21class AttributeValue;
22class Ipv4FlowClassifier;
23class Ipv6FlowClassifier;
24
25/**
26 * @ingroup flow-monitor
27 * @brief Helper to enable IP flow monitoring on a set of Nodes
28 */
30{
31 public:
34
35 // Delete copy constructor and assignment operator to avoid misuse
38
39 /**
40 * @brief Set an attribute for the to-be-created FlowMonitor object
41 * @param n1 attribute name
42 * @param v1 attribute value
43 */
44 void SetMonitorAttribute(std::string n1, const AttributeValue& v1);
45
46 /**
47 * @brief Enable flow monitoring on a set of nodes
48 * @param nodes A NodeContainer holding the set of nodes to work with.
49 * @returns a pointer to the FlowMonitor object
50 */
52 /**
53 * @brief Enable flow monitoring on a single node
54 * @param node A Ptr<Node> to the node on which to enable flow monitoring.
55 * @returns a pointer to the FlowMonitor object
56 */
58 /**
59 * @brief Enable flow monitoring on all nodes
60 * @returns a pointer to the FlowMonitor object
61 */
63
64 /**
65 * @brief Retrieve the FlowMonitor object created by the Install* methods
66 * @returns a pointer to the FlowMonitor object
67 */
69
70 /**
71 * @brief Retrieve the FlowClassifier object for IPv4 created by the Install* methods
72 * @returns a pointer to the FlowClassifier object
73 */
75
76 /**
77 * @brief Retrieve the FlowClassifier object for IPv6 created by the Install* methods
78 * @returns a pointer to the FlowClassifier object
79 */
81
82 /**
83 * Serializes the results to an std::ostream in XML format
84 * @param os the output stream
85 * @param indent number of spaces to use as base indentation level
86 * @param enableHistograms if true, include also the histograms in the output
87 * @param enableProbes if true, include also the per-probe/flow pair statistics in the output
88 */
89 void SerializeToXmlStream(std::ostream& os,
90 uint16_t indent,
91 bool enableHistograms,
92 bool enableProbes);
93
94 /**
95 * Same as SerializeToXmlStream, but returns the output as a std::string
96 * @param indent number of spaces to use as base indentation level
97 * @param enableHistograms if true, include also the histograms in the output
98 * @param enableProbes if true, include also the per-probe/flow pair statistics in the output
99 * @return the XML output as string
100 */
101 std::string SerializeToXmlString(uint16_t indent, bool enableHistograms, bool enableProbes);
102
103 /**
104 * Same as SerializeToXmlStream, but writes to a file instead
105 * @param fileName name or path of the output file that will be created
106 * @param enableHistograms if true, include also the histograms in the output
107 * @param enableProbes if true, include also the per-probe/flow pair statistics in the output
108 */
109 void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes);
110
111 private:
112 ObjectFactory m_monitorFactory; //!< Object factory
113 Ptr<FlowMonitor> m_flowMonitor; //!< the FlowMonitor object
114 Ptr<FlowClassifier> m_flowClassifier4; //!< the FlowClassifier object for IPv4
115 Ptr<FlowClassifier> m_flowClassifier6; //!< the FlowClassifier object for IPv6
116};
117
118} // namespace ns3
119
120#endif /* FLOW_MONITOR_HELPER_H */
Hold a value for an Attribute.
Definition attribute.h:59
Helper to enable IP flow monitoring on a set of Nodes.
Ptr< FlowClassifier > m_flowClassifier6
the FlowClassifier object for IPv6
FlowMonitorHelper & operator=(const FlowMonitorHelper &)=delete
FlowMonitorHelper(const FlowMonitorHelper &)=delete
std::string SerializeToXmlString(uint16_t indent, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but returns the output as a std::string.
Ptr< FlowClassifier > GetClassifier6()
Retrieve the FlowClassifier object for IPv6 created by the Install* methods.
Ptr< FlowClassifier > GetClassifier()
Retrieve the FlowClassifier object for IPv4 created by the Install* methods.
void SetMonitorAttribute(std::string n1, const AttributeValue &v1)
Set an attribute for the to-be-created FlowMonitor object.
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void SerializeToXmlStream(std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
Serializes the results to an std::ostream in XML format.
Ptr< FlowMonitor > GetMonitor()
Retrieve the FlowMonitor object created by the Install* methods.
Ptr< FlowClassifier > m_flowClassifier4
the FlowClassifier object for IPv4
Ptr< FlowMonitor > Install(NodeContainer nodes)
Enable flow monitoring on a set of nodes.
ObjectFactory m_monitorFactory
Object factory.
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Ptr< FlowMonitor > m_flowMonitor
the FlowMonitor object
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.