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