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// 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 IPV4_FLOW_PROBE_H
10#define IPV4_FLOW_PROBE_H
11
12#include "flow-probe.h"
14
15#include "ns3/ipv4-l3-protocol.h"
16#include "ns3/queue-item.h"
17
18namespace ns3
19{
20
21class FlowMonitor;
22class Node;
23
24/// @ingroup flow-monitor
25/// @brief Class that monitors flows at the IPv4 layer of a Node
26///
27/// For each node in the simulation, one instance of the class
28/// Ipv4FlowProbe is created to monitor that node. Ipv4FlowProbe
29/// accomplishes this by connecting callbacks to trace sources in the
30/// Ipv4L3Protocol interface of the node.
32{
33 public:
34 /// @brief Constructor
35 /// @param monitor the FlowMonitor this probe is associated with
36 /// @param classifier the Ipv4FlowClassifier this probe is associated with
37 /// @param node the Node this probe is associated with
39 ~Ipv4FlowProbe() override;
40
41 /// Register this type.
42 /// @return The TypeId.
43 static TypeId GetTypeId();
44
45 /// @brief enumeration of possible reasons why a packet may be dropped
47 {
48 /// Packet dropped due to missing route to the destination
50
51 /// Packet dropped due to TTL decremented to zero during IPv4 forwarding
53
54 /// Packet dropped due to invalid checksum in the IPv4 header
56
57 /// Packet dropped due to queue overflow. Note: only works for
58 /// NetDevices that provide a TxQueue attribute of type Queue
59 /// with a Drop trace source. It currently works with Csma and
60 /// PointToPoint devices, but not with WiFi or WiMax.
62
63 /// Packet dropped by the queue disc
65
66 DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
67 DROP_ROUTE_ERROR, /**< Route error */
68 DROP_FRAGMENT_TIMEOUT, /**< Fragment timeout exceeded */
69
70 DROP_INVALID_REASON, /**< Fallback reason (no known reason) */
71 };
72
73 protected:
74 void DoDispose() override;
75
76 private:
77 /// Log a packet being sent
78 /// @param ipHeader IP header
79 /// @param ipPayload IP payload
80 /// @param interface outgoing interface
81 void SendOutgoingLogger(const Ipv4Header& ipHeader,
82 Ptr<const Packet> ipPayload,
83 uint32_t interface);
84 /// Log a packet being forwarded
85 /// @param ipHeader IP header
86 /// @param ipPayload IP payload
87 /// @param interface incoming interface
88 void ForwardLogger(const Ipv4Header& ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
89 /// Log a packet being received by the destination
90 /// @param ipHeader IP header
91 /// @param ipPayload IP payload
92 /// @param interface incoming interface
93 void ForwardUpLogger(const Ipv4Header& ipHeader,
94 Ptr<const Packet> ipPayload,
95 uint32_t interface);
96 /// Log a packet being dropped
97 /// @param ipHeader IP header
98 /// @param ipPayload IP payload
99 /// @param reason drop reason
100 /// @param ipv4 pointer to the IP object dropping the packet
101 /// @param ifIndex interface index
102 void DropLogger(const Ipv4Header& ipHeader,
103 Ptr<const Packet> ipPayload,
105 Ptr<Ipv4> ipv4,
106 uint32_t ifIndex);
107 /// Log a packet being dropped by a queue
108 /// @param ipPayload IP payload
109 void QueueDropLogger(Ptr<const Packet> ipPayload);
110 /// Log a packet being dropped by a queue disc
111 /// @param item queue disc item
113
114 Ptr<Ipv4FlowClassifier> m_classifier; //!< the Ipv4FlowClassifier this probe is associated with
115 Ptr<Ipv4L3Protocol> m_ipv4; //!< the Ipv4L3Protocol this probe is bound to
116};
117
118} // namespace ns3
119
120#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:30
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.
Ipv4FlowProbe(Ptr< FlowMonitor > monitor, Ptr< Ipv4FlowClassifier > classifier, Ptr< Node > node)
Constructor.
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:23
DropReason
Reason why a packet has been dropped.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.