|
gjc@5205
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
gjc@5205
|
2 |
//
|
|
gjc@5205
|
3 |
// Copyright (c) 2009 INESC Porto
|
|
gjc@5205
|
4 |
//
|
|
gjc@5205
|
5 |
// This program is free software; you can redistribute it and/or modify
|
|
gjc@5205
|
6 |
// it under the terms of the GNU General Public License version 2 as
|
|
gjc@5205
|
7 |
// published by the Free Software Foundation;
|
|
gjc@5205
|
8 |
//
|
|
gjc@5205
|
9 |
// This program is distributed in the hope that it will be useful,
|
|
gjc@5205
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
gjc@5205
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
gjc@5205
|
12 |
// GNU General Public License for more details.
|
|
gjc@5205
|
13 |
//
|
|
gjc@5205
|
14 |
// You should have received a copy of the GNU General Public License
|
|
gjc@5205
|
15 |
// along with this program; if not, write to the Free Software
|
|
gjc@5205
|
16 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
gjc@5205
|
17 |
//
|
|
gjc@5205
|
18 |
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
|
|
gjc@5205
|
19 |
//
|
|
gjc@5205
|
20 |
|
|
gjc@5205
|
21 |
#ifndef __IPV4_FLOW_PROBE_H__
|
|
gjc@5205
|
22 |
#define __IPV4_FLOW_PROBE_H__
|
|
gjc@5205
|
23 |
|
|
gjc@5205
|
24 |
#include "ns3/flow-probe.h"
|
|
gjc@5205
|
25 |
#include "ns3/ipv4-flow-classifier.h"
|
|
gjc@5205
|
26 |
#include "ns3/ipv4-l3-protocol.h"
|
|
gjc@5205
|
27 |
|
|
gjc@5205
|
28 |
namespace ns3 {
|
|
gjc@5205
|
29 |
|
|
gjc@5205
|
30 |
class FlowMonitor;
|
|
gjc@5205
|
31 |
class Node;
|
|
gjc@5205
|
32 |
|
|
gjc@5210
|
33 |
/// \brief Class that monitors flows at the IPv4 layer of a Node
|
|
gjc@5210
|
34 |
///
|
|
gjc@5210
|
35 |
/// For each node in the simulation, one instance of the class
|
|
gjc@5210
|
36 |
/// Ipv4FlowProbe is created to monitor that node. Ipv4FlowProbe
|
|
gjc@5210
|
37 |
/// accomplishes this by connecting callbacks to trace sources in the
|
|
gjc@5210
|
38 |
/// Ipv4L3Protocol interface of the node.
|
|
gjc@5205
|
39 |
class Ipv4FlowProbe : public FlowProbe
|
|
gjc@5205
|
40 |
{
|
|
gjc@5205
|
41 |
|
|
gjc@5205
|
42 |
public:
|
|
gjc@5205
|
43 |
Ipv4FlowProbe (Ptr<FlowMonitor> monitor, Ptr<Ipv4FlowClassifier> classifier, Ptr<Node> node);
|
|
mathieu@5505
|
44 |
virtual ~Ipv4FlowProbe ();
|
|
gjc@5205
|
45 |
|
|
gjc@5210
|
46 |
/// \brief enumeration of possible reasons why a packet may be dropped
|
|
gjc@5205
|
47 |
enum DropReason
|
|
gjc@5205
|
48 |
{
|
|
gjc@5210
|
49 |
/// Packet dropped due to missing route to the destination
|
|
gjc@5205
|
50 |
DROP_NO_ROUTE = 0,
|
|
gjc@5210
|
51 |
/// Packet dropped due to TTL decremented to zero during IPv4 forwarding
|
|
gjc@5210
|
52 |
DROP_TTL_EXPIRE,
|
|
gjc@5210
|
53 |
/// Packet dropped due to invalid checksum in the IPv4 header
|
|
gjc@5205
|
54 |
DROP_BAD_CHECKSUM,
|
|
gjc@5210
|
55 |
|
|
gjc@5205
|
56 |
// DROP_QUEUE, // TODO: this is not easy to do
|
|
gjc@5205
|
57 |
DROP_INVALID_REASON,
|
|
gjc@5205
|
58 |
};
|
|
gjc@5205
|
59 |
|
|
gjc@5205
|
60 |
private:
|
|
gjc@5205
|
61 |
|
|
gjc@5205
|
62 |
void SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
|
|
gjc@5205
|
63 |
void ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
|
|
gjc@5205
|
64 |
void ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
|
|
gjc@5205
|
65 |
void DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
|
|
gjc@5205
|
66 |
Ipv4L3Protocol::DropReason reason, uint32_t ifIndex);
|
|
gjc@5205
|
67 |
|
|
gjc@5205
|
68 |
Ptr<Ipv4FlowClassifier> m_classifier;
|
|
gjc@5205
|
69 |
};
|
|
gjc@5205
|
70 |
|
|
gjc@5205
|
71 |
|
|
gjc@5205
|
72 |
} // namespace ns3
|
|
gjc@5205
|
73 |
|
|
gjc@5205
|
74 |
#endif
|
|
gjc@5205
|
75 |
|