A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
flow-classifier.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
9#ifndef FLOW_CLASSIFIER_H
10#define FLOW_CLASSIFIER_H
11
12#include "ns3/simple-ref-count.h"
13
14#include <ostream>
15
16namespace ns3
17{
18
19/**
20 * \ingroup flow-monitor
21 * \brief Abstract identifier of a packet flow
22 */
24
25/**
26 * \ingroup flow-monitor
27 * \brief Abstract identifier of a packet within a flow
28 */
30
31/// \ingroup flow-monitor
32/// Provides a method to translate raw packet data into abstract
33/// `flow identifier` and `packet identifier` parameters. These
34/// identifiers are unsigned 32-bit integers that uniquely identify a
35/// flow and a packet within that flow, respectively, for the whole
36/// simulation, regardless of the point in which the packet was
37/// captured. These abstract identifiers are used in the
38/// communication between FlowProbe and FlowMonitor, and all collected
39/// statistics reference only those abstract identifiers in order to
40/// keep the core architecture generic and not tied down to any
41/// particular flow capture method or classification system.
42class FlowClassifier : public SimpleRefCount<FlowClassifier>
43{
44 private:
45 FlowId m_lastNewFlowId; //!< Last known Flow ID
46
47 public:
49 virtual ~FlowClassifier();
50
51 // Delete copy constructor and assignment operator to avoid misuse
54
55 /// Serializes the results to an std::ostream in XML format
56 /// \param os the output stream
57 /// \param indent number of spaces to use as base indentation level
58 virtual void SerializeToXmlStream(std::ostream& os, uint16_t indent) const = 0;
59
60 protected:
61 /// Returns a new, unique Flow Identifier
62 /// \returns a new FlowId
64
65 ///
66 /// \brief Add a number of spaces for indentation purposes.
67 /// \param os The stream to write to.
68 /// \param level The number of spaces to add.
69 void Indent(std::ostream& os, uint16_t level) const;
70};
71
72inline void
73FlowClassifier::Indent(std::ostream& os, uint16_t level) const
74{
75 for (uint16_t __xpto = 0; __xpto < level; __xpto++)
76 {
77 os << ' ';
78 }
79}
80
81} // namespace ns3
82
83#endif /* FLOW_CLASSIFIER_H */
Provides a method to translate raw packet data into abstract flow identifier and packet identifier pa...
void Indent(std::ostream &os, uint16_t level) const
Add a number of spaces for indentation purposes.
FlowClassifier & operator=(const FlowClassifier &)=delete
FlowId GetNewFlowId()
Returns a new, unique Flow Identifier.
FlowClassifier(const FlowClassifier &)=delete
FlowId m_lastNewFlowId
Last known Flow ID.
virtual void SerializeToXmlStream(std::ostream &os, uint16_t indent) const =0
Serializes the results to an std::ostream in XML format.
A template-based reference counting class.
uint32_t FlowId
Abstract identifier of a packet flow.
uint32_t FlowPacketId
Abstract identifier of a packet within a flow.
Every class exported by the ns3 library is enclosed in the ns3 namespace.