A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv4-flow-probe.h
Go to the documentation of this file.
1//
2// Copyright (c) 2009 INESC Porto
3//
4// This program is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License version 2 as
6// published by the Free Software Foundation;
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
18//
19
20#ifndef IPV4_FLOW_PROBE_H
21#define IPV4_FLOW_PROBE_H
22
23#include "flow-probe.h"
25
26#include "ns3/ipv4-l3-protocol.h"
27#include "ns3/queue-item.h"
28
29namespace ns3
30{
31
32class FlowMonitor;
33class Node;
34
35/// \ingroup flow-monitor
36/// \brief Class that monitors flows at the IPv4 layer of a Node
37///
38/// For each node in the simulation, one instance of the class
39/// Ipv4FlowProbe is created to monitor that node. Ipv4FlowProbe
40/// accomplishes this by connecting callbacks to trace sources in the
41/// Ipv4L3Protocol interface of the node.
43{
44 public:
45 /// \brief Constructor
46 /// \param monitor the FlowMonitor this probe is associated with
47 /// \param classifier the Ipv4FlowClassifier this probe is associated with
48 /// \param node the Node this probe is associated with
50 ~Ipv4FlowProbe() override;
51
52 /// Register this type.
53 /// \return The TypeId.
54 static TypeId GetTypeId();
55
56 /// \brief enumeration of possible reasons why a packet may be dropped
58 {
59 /// Packet dropped due to missing route to the destination
61
62 /// Packet dropped due to TTL decremented to zero during IPv4 forwarding
64
65 /// Packet dropped due to invalid checksum in the IPv4 header
67
68 /// Packet dropped due to queue overflow. Note: only works for
69 /// NetDevices that provide a TxQueue attribute of type Queue
70 /// with a Drop trace source. It currently works with Csma and
71 /// PointToPoint devices, but not with WiFi or WiMax.
73
74 /// Packet dropped by the queue disc
76
77 DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
78 DROP_ROUTE_ERROR, /**< Route error */
79 DROP_FRAGMENT_TIMEOUT, /**< Fragment timeout exceeded */
80
81 DROP_INVALID_REASON, /**< Fallback reason (no known reason) */
82 };
83
84 protected:
85 void DoDispose() override;
86
87 private:
88 /// Log a packet being sent
89 /// \param ipHeader IP header
90 /// \param ipPayload IP payload
91 /// \param interface outgoing interface
92 void SendOutgoingLogger(const Ipv4Header& ipHeader,
93 Ptr<const Packet> ipPayload,
94 uint32_t interface);
95 /// Log a packet being forwarded
96 /// \param ipHeader IP header
97 /// \param ipPayload IP payload
98 /// \param interface incoming interface
99 void ForwardLogger(const Ipv4Header& ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
100 /// Log a packet being received by the destination
101 /// \param ipHeader IP header
102 /// \param ipPayload IP payload
103 /// \param interface incoming interface
104 void ForwardUpLogger(const Ipv4Header& ipHeader,
105 Ptr<const Packet> ipPayload,
106 uint32_t interface);
107 /// Log a packet being dropped
108 /// \param ipHeader IP header
109 /// \param ipPayload IP payload
110 /// \param reason drop reason
111 /// \param ipv4 pointer to the IP object dropping the packet
112 /// \param ifIndex interface index
113 void DropLogger(const Ipv4Header& ipHeader,
114 Ptr<const Packet> ipPayload,
116 Ptr<Ipv4> ipv4,
117 uint32_t ifIndex);
118 /// Log a packet being dropped by a queue
119 /// \param ipPayload IP payload
120 void QueueDropLogger(Ptr<const Packet> ipPayload);
121 /// Log a packet being dropped by a queue disc
122 /// \param item queue disc item
124
125 Ptr<Ipv4FlowClassifier> m_classifier; //!< the Ipv4FlowClassifier this probe is associated with
126 Ptr<Ipv4L3Protocol> m_ipv4; //!< the Ipv4L3Protocol this probe is bound to
127};
128
129} // namespace ns3
130
131#endif /* IPV4_FLOW_PROBE_H */
The FlowProbe class is responsible for listening for packet events in a specific point of the simulat...
Definition: flow-probe.h:41
Class that monitors flows at the IPv4 layer of a Node.
DropReason
enumeration of possible reasons why a packet may be dropped
@ DROP_ROUTE_ERROR
Route error.
@ DROP_BAD_CHECKSUM
Packet dropped due to invalid checksum in the IPv4 header.
@ DROP_TTL_EXPIRE
Packet dropped due to TTL decremented to zero during IPv4 forwarding.
@ DROP_INTERFACE_DOWN
Interface is down so can not send packet.
@ DROP_NO_ROUTE
Packet dropped due to missing route to the destination.
@ DROP_INVALID_REASON
Fallback reason (no known reason)
@ DROP_QUEUE_DISC
Packet dropped by the queue disc.
@ DROP_FRAGMENT_TIMEOUT
Fragment timeout exceeded.
@ DROP_QUEUE
Packet dropped due to queue overflow.
void SendOutgoingLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being sent.
void DropLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > ipv4, uint32_t ifIndex)
Log a packet being dropped.
void QueueDropLogger(Ptr< const Packet > ipPayload)
Log a packet being dropped by a queue.
void ForwardUpLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being received by the destination.
Ptr< Ipv4L3Protocol > m_ipv4
the Ipv4L3Protocol this probe is bound to
static TypeId GetTypeId()
Register this type.
void DoDispose() override
Destructor implementation.
void QueueDiscDropLogger(Ptr< const QueueDiscItem > item)
Log a packet being dropped by a queue disc.
void ForwardLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being forwarded.
Ptr< Ipv4FlowClassifier > m_classifier
the Ipv4FlowClassifier this probe is associated with
Packet header for IPv4.
Definition: ipv4-header.h:34
DropReason
Reason why a packet has been dropped.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.