src/flow-monitor/model/ipv4-flow-probe.cc
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Fri, 26 Sep 2014 15:51:00 -0700
changeset 10968 2d29fee2b7b8
parent 10967 597a9ec89e60
child 11260 8e8ec7d7b52e
permissions -rw-r--r--
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
#include "ns3/ipv4-flow-probe.h"
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    22
#include "ns3/ipv4-flow-classifier.h"
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    23
#include "ns3/node.h"
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    24
#include "ns3/packet.h"
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    25
#include "ns3/flow-monitor.h"
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    26
#include "ns3/log.h"
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    27
#include "ns3/pointer.h"
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    28
#include "ns3/config.h"
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    29
#include "ns3/flow-id-tag.h"
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    30
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10967
diff changeset
    31
namespace ns3 {
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    32
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10967
diff changeset
    33
NS_LOG_COMPONENT_DEFINE ("Ipv4FlowProbe");
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    34
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
    35
//////////////////////////////////////
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
    36
// Ipv4FlowProbeTag class implementation //
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
    37
//////////////////////////////////////
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    38
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    39
/**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    40
 * \ingroup flow-monitor
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    41
 *
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    42
 * \brief Tag used to allow a fast identification of the packet
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    43
 *
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    44
 * This tag is added by FlowMonitor when a packet is seen for
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    45
 * the first time, and it is then used to classify the packet in
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    46
 * the following hops.
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    47
 */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    48
class Ipv4FlowProbeTag : public Tag
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    49
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    50
public:
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    51
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    52
   * \brief Get the type ID.
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    53
   * \return the object TypeId
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    54
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    55
  static TypeId GetTypeId (void);
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    56
  virtual TypeId GetInstanceTypeId (void) const;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    57
  virtual uint32_t GetSerializedSize (void) const;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    58
  virtual void Serialize (TagBuffer buf) const;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    59
  virtual void Deserialize (TagBuffer buf);
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    60
  virtual void Print (std::ostream &os) const;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    61
  Ipv4FlowProbeTag ();
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    62
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    63
   * \brief Consructor
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    64
   * \param flowId the flow identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    65
   * \param packetId the packet identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    66
   * \param packetSize the packet size
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    67
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    68
  Ipv4FlowProbeTag (uint32_t flowId, uint32_t packetId, uint32_t packetSize);
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    69
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    70
   * \brief Set the flow identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    71
   * \param flowId the flow identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    72
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    73
  void SetFlowId (uint32_t flowId);
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    74
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    75
   * \brief Set the packet identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    76
   * \param packetId the packet identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    77
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    78
  void SetPacketId (uint32_t packetId);
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    79
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    80
   * \brief Set the packet size
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    81
   * \param packetSize the packet size
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    82
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    83
  void SetPacketSize (uint32_t packetSize);
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    84
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    85
   * \brief Set the flow identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    86
   * \returns the flow identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    87
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    88
  uint32_t GetFlowId (void) const;
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    89
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    90
   * \brief Set the packet identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    91
   * \returns the packet identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    92
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    93
  uint32_t GetPacketId (void) const;
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    94
  /**
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    95
   * \brief Get the packet size
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    96
   * \returns the packet size
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
    97
   */
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    98
  uint32_t GetPacketSize (void) const;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
    99
private:
10441
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
   100
  uint32_t m_flowId;      //!< flow identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
   101
  uint32_t m_packetId;    //!< packet identifier
7f54ed05f8be Bug 983 - missing Doxygen in ns-3 (flow-monitor model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10411
diff changeset
   102
  uint32_t m_packetSize;  //!< packet size
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   103
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   104
};
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   105
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   106
TypeId 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   107
Ipv4FlowProbeTag::GetTypeId (void)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   108
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   109
  static TypeId tid = TypeId ("ns3::Ipv4FlowProbeTag")
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   110
    .SetParent<Tag> ()
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   111
    .AddConstructor<Ipv4FlowProbeTag> ()
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   112
  ;
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   113
  return tid;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   114
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   115
TypeId 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   116
Ipv4FlowProbeTag::GetInstanceTypeId (void) const
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   117
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   118
  return GetTypeId ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   119
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   120
uint32_t 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   121
Ipv4FlowProbeTag::GetSerializedSize (void) const
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   122
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   123
  return 4 + 4 + 4;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   124
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   125
void 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   126
Ipv4FlowProbeTag::Serialize (TagBuffer buf) const
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   127
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   128
  buf.WriteU32 (m_flowId);
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   129
  buf.WriteU32 (m_packetId);
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   130
  buf.WriteU32 (m_packetSize);
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   131
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   132
void 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   133
Ipv4FlowProbeTag::Deserialize (TagBuffer buf)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   134
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   135
  m_flowId = buf.ReadU32 ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   136
  m_packetId = buf.ReadU32 ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   137
  m_packetSize = buf.ReadU32 ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   138
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   139
void 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   140
Ipv4FlowProbeTag::Print (std::ostream &os) const
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   141
{
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   142
  os << "FlowId=" << m_flowId;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   143
  os << "PacketId=" << m_packetId;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   144
  os << "PacketSize=" << m_packetSize;
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   145
}
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   146
Ipv4FlowProbeTag::Ipv4FlowProbeTag ()
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   147
  : Tag () 
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   148
{
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   149
}
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   150
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   151
Ipv4FlowProbeTag::Ipv4FlowProbeTag (uint32_t flowId, uint32_t packetId, uint32_t packetSize)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   152
  : Tag (), m_flowId (flowId), m_packetId (packetId), m_packetSize (packetSize)
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   153
{
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   154
}
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   155
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   156
void
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   157
Ipv4FlowProbeTag::SetFlowId (uint32_t id)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   158
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   159
  m_flowId = id;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   160
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   161
void
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   162
Ipv4FlowProbeTag::SetPacketId (uint32_t id)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   163
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   164
  m_packetId = id;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   165
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   166
void
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   167
Ipv4FlowProbeTag::SetPacketSize (uint32_t size)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   168
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   169
  m_packetSize = size;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   170
}
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   171
uint32_t
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   172
Ipv4FlowProbeTag::GetFlowId (void) const
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   173
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   174
  return m_flowId;
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   175
}
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   176
uint32_t
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   177
Ipv4FlowProbeTag::GetPacketId (void) const
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   178
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   179
  return m_packetId;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   180
} 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   181
uint32_t
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   182
Ipv4FlowProbeTag::GetPacketSize (void) const
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   183
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   184
  return m_packetSize;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   185
} 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   186
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   187
////////////////////////////////////////
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   188
// Ipv4FlowProbe class implementation //
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   189
////////////////////////////////////////
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   190
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   191
Ipv4FlowProbe::Ipv4FlowProbe (Ptr<FlowMonitor> monitor,
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   192
                              Ptr<Ipv4FlowClassifier> classifier,
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   193
                              Ptr<Node> node)
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   194
  : FlowProbe (monitor),
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   195
    m_classifier (classifier)
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   196
{
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   197
  NS_LOG_FUNCTION (this << node->GetId ());
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   198
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   199
  m_ipv4 = node->GetObject<Ipv4L3Protocol> ();
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   200
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   201
  if (!m_ipv4->TraceConnectWithoutContext ("SendOutgoing",
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   202
                                           MakeCallback (&Ipv4FlowProbe::SendOutgoingLogger, Ptr<Ipv4FlowProbe> (this))))
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   203
    {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   204
      NS_FATAL_ERROR ("trace fail");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   205
    }
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   206
  if (!m_ipv4->TraceConnectWithoutContext ("UnicastForward",
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   207
                                           MakeCallback (&Ipv4FlowProbe::ForwardLogger, Ptr<Ipv4FlowProbe> (this))))
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   208
    {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   209
      NS_FATAL_ERROR ("trace fail");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   210
    }
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   211
  if (!m_ipv4->TraceConnectWithoutContext ("LocalDeliver",
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   212
                                           MakeCallback (&Ipv4FlowProbe::ForwardUpLogger, Ptr<Ipv4FlowProbe> (this))))
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   213
    {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   214
      NS_FATAL_ERROR ("trace fail");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   215
    }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   216
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   217
  if (!m_ipv4->TraceConnectWithoutContext ("Drop",
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   218
                                           MakeCallback (&Ipv4FlowProbe::DropLogger, Ptr<Ipv4FlowProbe> (this))))
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   219
    {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   220
      NS_FATAL_ERROR ("trace fail");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   221
    }
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   222
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   223
  // code copied from point-to-point-helper.cc
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   224
  std::ostringstream oss;
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   225
  oss << "/NodeList/" << node->GetId () << "/DeviceList/*/TxQueue/Drop";
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   226
  Config::ConnectWithoutContext (oss.str (), MakeCallback (&Ipv4FlowProbe::QueueDropLogger, Ptr<Ipv4FlowProbe> (this)));
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   227
}
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   228
6325
3a794ee1238f restore missing destructor
Tom Henderson <tomh@tomh.org>
parents: 6323
diff changeset
   229
Ipv4FlowProbe::~Ipv4FlowProbe ()
3a794ee1238f restore missing destructor
Tom Henderson <tomh@tomh.org>
parents: 6323
diff changeset
   230
{
3a794ee1238f restore missing destructor
Tom Henderson <tomh@tomh.org>
parents: 6323
diff changeset
   231
}
3a794ee1238f restore missing destructor
Tom Henderson <tomh@tomh.org>
parents: 6323
diff changeset
   232
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   233
void
9727
cb763839fc18 bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents: 9063
diff changeset
   234
Ipv4FlowProbe::DoDispose ()
cb763839fc18 bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents: 9063
diff changeset
   235
{
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   236
  m_ipv4 = 0;
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   237
  m_classifier = 0;
9727
cb763839fc18 bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents: 9063
diff changeset
   238
  FlowProbe::DoDispose ();
cb763839fc18 bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents: 9063
diff changeset
   239
}
cb763839fc18 bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents: 9063
diff changeset
   240
cb763839fc18 bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents: 9063
diff changeset
   241
void
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   242
Ipv4FlowProbe::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
   243
{
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   244
  FlowId flowId;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   245
  FlowPacketId packetId;
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   246
10670
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   247
  if (!m_ipv4->IsUnicast(ipHeader.GetDestination ()))
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   248
    {
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   249
      // we are not prepared to handle broadcast yet
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   250
      return;
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   251
    }
d04c750525d7 Bug 1845 - FlowMonitor should discard any broadcast/multicast packet
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10652
diff changeset
   252
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   253
  if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   254
    {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   255
      uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   256
      NS_LOG_DEBUG ("ReportFirstTx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<"); "
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   257
                                     << ipHeader << *ipPayload);
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   258
      m_flowMonitor->ReportFirstTx (this, flowId, packetId, size);
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   259
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   260
      // tag the packet with the flow id and packet id, so that the packet can be identified even
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   261
      // when Ipv4Header is not accessible at some non-IPv4 protocol layer
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   262
      Ipv4FlowProbeTag fTag (flowId, packetId, size);
10823
311e95076ad1 Bug 1937 - FlowMonitor fails to track multiplexed packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10670
diff changeset
   263
      ipPayload->AddByteTag (fTag);
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   264
    }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   265
}
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   266
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   267
void
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   268
Ipv4FlowProbe::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
   269
{
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   270
  Ipv4FlowProbeTag fTag;
10823
311e95076ad1 Bug 1937 - FlowMonitor fails to track multiplexed packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10670
diff changeset
   271
  bool found = ipPayload->FindFirstMatchingByteTag (fTag);
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   272
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   273
  if (found)
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   274
    {
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   275
      FlowId flowId = fTag.GetFlowId ();
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   276
      FlowPacketId packetId = fTag.GetPacketId ();
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   277
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   278
      uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   279
      NS_LOG_DEBUG ("ReportForwarding ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   280
      m_flowMonitor->ReportForwarding (this, flowId, packetId, size);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   281
    }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   282
}
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   283
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   284
void
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   285
Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   286
{
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   287
  Ipv4FlowProbeTag fTag;
10823
311e95076ad1 Bug 1937 - FlowMonitor fails to track multiplexed packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10670
diff changeset
   288
  bool found = ipPayload->FindFirstMatchingByteTag (fTag);
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   289
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   290
  if (found)
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   291
    {
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   292
      FlowId flowId = fTag.GetFlowId ();
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   293
      FlowPacketId packetId = fTag.GetPacketId ();
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   294
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   295
      uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   296
      NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   297
      m_flowMonitor->ReportLastRx (this, flowId, packetId, size);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   298
    }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   299
}
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   300
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   301
void
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   302
Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
6104
d28cdc552c2e bug 834
Pavel Boyko <boyko@iitp.ru>
parents: 5205
diff changeset
   303
                           Ipv4L3Protocol::DropReason reason, Ptr<Ipv4> ipv4, uint32_t ifIndex)
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   304
{
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   305
#if 0
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   306
  switch (reason)
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   307
    {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   308
    case Ipv4L3Protocol::DROP_NO_ROUTE:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   309
      break;
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   310
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   311
    case Ipv4L3Protocol::DROP_TTL_EXPIRED:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   312
    case Ipv4L3Protocol::DROP_BAD_CHECKSUM:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   313
      Ipv4Address addri = m_ipv4->GetAddress (ifIndex);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   314
      Ipv4Mask maski = m_ipv4->GetNetworkMask (ifIndex);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   315
      Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   316
      if (ipHeader.GetDestination () == bcast) // we don't want broadcast packets
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   317
        {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   318
          return;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   319
        }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   320
    }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   321
#endif
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   322
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   323
  Ipv4FlowProbeTag fTag;
10823
311e95076ad1 Bug 1937 - FlowMonitor fails to track multiplexed packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10670
diff changeset
   324
  bool found = ipPayload->FindFirstMatchingByteTag (fTag);
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   325
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   326
  if (found)
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   327
    {
10586
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   328
      FlowId flowId = fTag.GetFlowId ();
25727ac2504f Bug 1808: FlowMon relies on IPv4's Identification field to trace packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10496
diff changeset
   329
      FlowPacketId packetId = fTag.GetPacketId ();
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   330
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   331
      uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   332
      NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << reason 
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   333
                            << ", destIp=" << ipHeader.GetDestination () << "); "
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   334
                            << "HDR: " << ipHeader << " PKT: " << *ipPayload);
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   335
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   336
      DropReason myReason;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   337
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   338
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   339
      switch (reason)
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   340
        {
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   341
        case Ipv4L3Protocol::DROP_TTL_EXPIRED:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   342
          myReason = DROP_TTL_EXPIRE;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   343
          NS_LOG_DEBUG ("DROP_TTL_EXPIRE");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   344
          break;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   345
        case Ipv4L3Protocol::DROP_NO_ROUTE:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   346
          myReason = DROP_NO_ROUTE;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   347
          NS_LOG_DEBUG ("DROP_NO_ROUTE");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   348
          break;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   349
        case Ipv4L3Protocol::DROP_BAD_CHECKSUM:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   350
          myReason = DROP_BAD_CHECKSUM;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   351
          NS_LOG_DEBUG ("DROP_BAD_CHECKSUM");
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   352
          break;
6476
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   353
        case Ipv4L3Protocol::DROP_INTERFACE_DOWN:
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   354
          myReason = DROP_INTERFACE_DOWN;
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   355
          NS_LOG_DEBUG ("DROP_INTERFACE_DOWN");
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   356
          break;
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   357
        case Ipv4L3Protocol::DROP_ROUTE_ERROR:
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   358
          myReason = DROP_ROUTE_ERROR;
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   359
          NS_LOG_DEBUG ("DROP_ROUTE_ERROR");
d95255206be2 Bug 972 - [flow monitor] assertion fails in pv4-flow-probe.cc
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6326
diff changeset
   360
          break;
7366
838079534ff9 Support to IPv4 fragmentation
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7229
diff changeset
   361
        case Ipv4L3Protocol::DROP_FRAGMENT_TIMEOUT:
838079534ff9 Support to IPv4 fragmentation
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7229
diff changeset
   362
          myReason = DROP_FRAGMENT_TIMEOUT;
838079534ff9 Support to IPv4 fragmentation
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7229
diff changeset
   363
          NS_LOG_DEBUG ("DROP_FRAGMENT_TIMEOUT");
838079534ff9 Support to IPv4 fragmentation
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 7229
diff changeset
   364
          break;
10496
4218ca3fc829 Backed out of changeset 10495:e877c029ed3e
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10495
diff changeset
   365
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   366
        default:
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   367
          myReason = DROP_INVALID_REASON;
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   368
          NS_FATAL_ERROR ("Unexpected drop reason code " << reason);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   369
        }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   370
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   371
      m_flowMonitor->ReportDrop (this, flowId, packetId, size, myReason);
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   372
    }
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   373
}
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   374
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   375
void 
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   376
Ipv4FlowProbe::QueueDropLogger (Ptr<const Packet> ipPayload)
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   377
{
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   378
  Ipv4FlowProbeTag fTag;
10823
311e95076ad1 Bug 1937 - FlowMonitor fails to track multiplexed packets
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 10670
diff changeset
   379
  bool tagFound = ipPayload->FindFirstMatchingByteTag (fTag);
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   380
7703
a982d8c7aa32 Bug 1302 - Flow monitor bug
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7366
diff changeset
   381
  if (!tagFound)
a982d8c7aa32 Bug 1302 - Flow monitor bug
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7366
diff changeset
   382
    {
a982d8c7aa32 Bug 1302 - Flow monitor bug
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7366
diff changeset
   383
      return;
a982d8c7aa32 Bug 1302 - Flow monitor bug
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7366
diff changeset
   384
    }
a982d8c7aa32 Bug 1302 - Flow monitor bug
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7366
diff changeset
   385
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   386
  FlowId flowId = fTag.GetFlowId ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   387
  FlowPacketId packetId = fTag.GetPacketId ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   388
  uint32_t size = fTag.GetPacketSize ();
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   389
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   390
  NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << DROP_QUEUE 
7175
8fffa1497fba flow-monitor coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6939
diff changeset
   391
                        << "); ");
6323
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   392
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   393
  m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE);
2a8ec4aee3b5 Bug 854 - Support DROP_QUEUE reason-code in Ipv4FlowProbe
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents: 6104
diff changeset
   394
}
5205
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   395
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   396
} // namespace ns3
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   397
673aae891b2b Add a new 'flow-monitor' module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   398