src/visualizer/model/pyviz.h
author Mitch Watrous <watrous@u.washington.edu>
Wed, 18 May 2011 17:24:04 -0700
changeset 7241 0a7a16b599e8
parent 7194 d57648faced2
permissions -rw-r--r--
Make some more modules show up on doxygen modules page
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     2
/*
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     3
 * Copyright (c) 2008 INESC Porto
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     4
 *
8a57344a8d09 Codereview Issue 2692041: Add pyviz 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
8a57344a8d09 Codereview Issue 2692041: Add pyviz 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
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     8
 *
8a57344a8d09 Codereview Issue 2692041: Add pyviz 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,
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    12
 * GNU General Public License for more details.
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    13
 *
8a57344a8d09 Codereview Issue 2692041: Add pyviz 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
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
8a57344a8d09 Codereview Issue 2692041: Add pyviz 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
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    17
 *
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    18
 * C++ helper functions for use by the python visualizer (for things
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    19
 * Python is too slow at).
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    20
 *
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    21
 * Author: Gustavo Carneiro  <gjc@inescporto.pt>
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    22
 */
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    23
#ifndef NS3_PYVIZ_H
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    24
#define NS3_PYVIZ_H
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    25
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    26
#include "ns3/nstime.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    27
#include "ns3/event-id.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    28
#include "ns3/node.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    29
#include "ns3/channel.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    30
#include "ns3/packet.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    31
#include "ns3/mac48-address.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    32
#include "ns3/ipv4-header.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    33
#include "ns3/ipv4-l3-protocol.h"
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    34
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    35
#include <map>
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    36
#include <set>
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    37
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    38
namespace ns3 {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    39
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    40
/**
7241
0a7a16b599e8 Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 7194
diff changeset
    41
 * \ingroup visualizer
0a7a16b599e8 Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 7194
diff changeset
    42
 *
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    43
 * \brief helper class to be used by the visualizer
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    44
 * \internal
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    45
 *
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    46
 * This class is not meant to be used by simulations.  It is only
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    47
 * meant to be used by the visualizer tool (PyViz).  The only reason
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    48
 * it is public is because Python bindings for it are needed,
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    49
 * otherwise it should be considered private.
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    50
 **/
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    51
class PyViz
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    52
{
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    53
public:
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    54
  PyViz ();
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    55
  ~PyViz ();
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    56
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    57
  void RegisterDropTracePath (std::string const &tracePath);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    58
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    59
  void RegisterCsmaLikeDevice (std::string const &deviceTypeName);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    60
  void RegisterWifiLikeDevice (std::string const &deviceTypeName);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    61
  void RegisterPointToPointLikeDevice (std::string const &deviceTypeName);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    62
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    63
  // Run simulation until a given (simulated, absolute) time is reached
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    64
  void SimulatorRunUntil (Time time);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    65
7194
d57648faced2 visualizer coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6946
diff changeset
    66
  static void Pause (std::string const &message);
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    67
  std::vector<std::string> GetPauseMessages () const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    68
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    69
  struct TransmissionSample
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    70
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    71
    Ptr<Node> transmitter;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    72
    Ptr<Node> receiver; // NULL if broadcast
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    73
    Ptr<Channel> channel;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    74
    uint32_t bytes;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    75
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    76
  typedef std::vector<TransmissionSample> TransmissionSampleList;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    77
  TransmissionSampleList GetTransmissionSamples () const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    78
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    79
  struct PacketDropSample
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    80
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    81
    Ptr<Node> transmitter;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    82
    uint32_t bytes;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    83
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    84
  typedef std::vector<PacketDropSample> PacketDropSampleList;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    85
  PacketDropSampleList GetPacketDropSamples () const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    86
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    87
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    88
  struct PacketSample
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    89
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    90
    Time time;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    91
    Ptr<Packet> packet;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    92
    Ptr<NetDevice> device;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    93
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    94
  struct TxPacketSample : PacketSample
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    95
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    96
    Mac48Address to;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    97
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    98
  struct RxPacketSample : PacketSample
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    99
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   100
    Mac48Address from;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   101
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   102
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   103
  struct LastPacketsSample
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   104
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   105
    std::vector<RxPacketSample> lastReceivedPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   106
    std::vector<TxPacketSample> lastTransmittedPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   107
    std::vector<PacketSample> lastDroppedPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   108
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   109
  LastPacketsSample GetLastPackets (uint32_t nodeId) const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   110
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   111
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   112
  void SetNodesOfInterest (std::set<uint32_t> nodes);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   113
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   114
  struct NetDeviceStatistics
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   115
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   116
    NetDeviceStatistics () : transmittedBytes (0), receivedBytes (0),
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   117
                             transmittedPackets (0), receivedPackets (0) {}
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   118
    uint64_t transmittedBytes;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   119
    uint64_t receivedBytes;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   120
    uint32_t transmittedPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   121
    uint32_t receivedPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   122
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   123
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   124
  struct NodeStatistics
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   125
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   126
    uint32_t nodeId;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   127
    std::vector<NetDeviceStatistics> statistics;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   128
  };
7194
d57648faced2 visualizer coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6946
diff changeset
   129
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   130
  std::vector<NodeStatistics> GetNodesStatistics () const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   131
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   132
  enum PacketCaptureMode {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   133
    PACKET_CAPTURE_DISABLED=1, // packet capture is disabled
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   134
    PACKET_CAPTURE_FILTER_HEADERS_OR, // packet capture if any of the indicated headers is present
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   135
    PACKET_CAPTURE_FILTER_HEADERS_AND, // packet capture if all of the indicated headers are present
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   136
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   137
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   138
  struct PacketCaptureOptions
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   139
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   140
    std::set<TypeId> headers;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   141
    uint32_t numLastPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   142
    PacketCaptureMode mode;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   143
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   144
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   145
  void SetPacketCaptureOptions (uint32_t nodeId, PacketCaptureOptions options);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   146
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   147
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   148
  // Yes, I know, this is just a utility function, not really related to the class in any way.
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   149
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   150
  // -#- @lineX1(direction=inout); @lineY1(direction=inout); @lineX2(direction=inout); @lineY2(direction=inout) -#-
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   151
  static void LineClipping (double boundsX1, double boundsY1, double boundsX2, double boundsY2, double &lineX1, double &lineY1, double &lineX2, double &lineY2); // don't break this line or pybindgen will not be able to pick up the above annotation :(
7194
d57648faced2 visualizer coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6946
diff changeset
   152
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   153
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   154
private:
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   155
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   156
  bool GetPacketCaptureOptions (uint32_t nodeId, const PacketCaptureOptions **outOptions) const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   157
  static bool FilterPacket (Ptr<const Packet> packet, const PacketCaptureOptions &options);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   158
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   159
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   160
  typedef std::pair<Ptr<Channel>, uint32_t> TxRecordKey;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   161
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   162
  struct TxRecordValue
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   163
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   164
    Time time;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   165
    Ptr<Node> srcNode;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   166
    bool isBroadcast;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   167
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   168
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   169
  struct TransmissionSampleKey
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   170
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   171
    bool operator < (TransmissionSampleKey const &other) const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   172
    bool operator == (TransmissionSampleKey const &other) const;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   173
    Ptr<Node> transmitter;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   174
    Ptr<Node> receiver; // NULL if broadcast
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   175
    Ptr<Channel> channel;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   176
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   177
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   178
  struct TransmissionSampleValue
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   179
  {
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   180
    uint32_t bytes;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   181
  };
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   182
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   183
  // data
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   184
  std::map<uint32_t, PacketCaptureOptions> m_packetCaptureOptions;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   185
  std::vector<std::string> m_pauseMessages;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   186
  std::map<TxRecordKey, TxRecordValue> m_txRecords;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   187
  std::map<TransmissionSampleKey, TransmissionSampleValue> m_transmissionSamples;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   188
  std::map<Ptr<Node>, uint32_t> m_packetDrops;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   189
  std::set<uint32_t> m_nodesOfInterest; // list of node IDs whose transmissions will be monitored
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   190
  std::map<uint32_t, Time> m_packetsOfInterest; // list of packet UIDs that will be monitored
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   191
  std::map<uint32_t, LastPacketsSample> m_lastPackets;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   192
  std::map<uint32_t, std::vector<NetDeviceStatistics> > m_nodesStatistics;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   193
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   194
  // Trace callbacks
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   195
  void TraceNetDevTxCommon (std::string const &context, Ptr<const Packet> packet, Mac48Address const &destination);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   196
  void TraceNetDevRxCommon (std::string const &context, Ptr<const Packet> packet, Mac48Address const &source);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   197
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   198
  void TraceNetDevTxWifi (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   199
  void TraceNetDevRxWifi (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   200
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   201
  void TraceDevQueueDrop (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   202
  void TraceIpv4Drop (std::string context, ns3::Ipv4Header const &hdr, Ptr<const Packet> packet,
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   203
                      ns3::Ipv4L3Protocol::DropReason reason, Ptr<Ipv4> dummy_ipv4, uint32_t interface);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   204
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   205
  void TraceNetDevTxCsma (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   206
  void TraceNetDevRxCsma (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   207
  void TraceNetDevPromiscRxCsma (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   208
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   209
  void TraceNetDevTxPointToPoint (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   210
  void TraceNetDevRxPointToPoint (std::string context, Ptr<const Packet> packet);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   211
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   212
  void TraceNetDevTxWimax (std::string context, Ptr<const Packet> packet, Mac48Address const &destination);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   213
  void TraceNetDevRxWimax (std::string context, Ptr<const Packet> packet, Mac48Address const &source);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   214
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   215
  inline NetDeviceStatistics & FindNetDeviceStatistics (int node, int interface);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   216
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   217
  void DoPause (std::string const &message);
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   218
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   219
  bool m_stop;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   220
  EventId m_stopCallbackEvent;
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   221
  void CallbackStopSimulation ();
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   222
};
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   223
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   224
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   225
}
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   226
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   227
#endif /* NS3_PYVIZ_H */