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