src/devices/tap-bridge/tap-bridge.h
author core@samcore1.nettech.boeing.com
Sat, 21 Mar 2009 15:40:49 -0700
changeset 4289 2f5b0ec50102
parent 4285 2b197a6b4460
child 4290 af8a40d5c2cb
permissions -rw-r--r--
initial modifications to tap-bridge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * Copyright (c) 2009 University of Washington
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 *
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 *
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 *
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
 */
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
#ifndef TAP_BRIDGE_H
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
#define TAP_BRIDGE_H
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    22
#include <string.h>
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    23
#include "ns3/address.h"
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
#include "ns3/net-device.h"
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    25
#include "ns3/node.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    26
#include "ns3/callback.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    27
#include "ns3/packet.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    28
#include "ns3/traced-callback.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    29
#include "ns3/event-id.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    30
#include "ns3/nstime.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    31
#include "ns3/data-rate.h"
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    32
#include "ns3/ptr.h"
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
#include "ns3/mac48-address.h"
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    34
#include "ns3/system-thread.h"
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
namespace ns3 {
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
class Node;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
/**
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    41
 * \ingroup tap-bridge
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
 * 
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    43
 * \brief A bridge to make it appear that a real host process is connected to 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    44
 * an ns-3 net device.
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
 *
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    46
 * The Tap Bridge lives in a kind of a gray world somewhere between a
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    47
 * Linux host and an ns-3 bridge device.  From the Linux perspective,
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    48
 * this code appears as the user mode handler for a Tap net device.  That
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    49
 * is, when the Linux host writes to a /dev/tap device (that is either
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    50
 * manually or automatically created depending on basic operating mode 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    51
 * -- more on this later), the write is redirected into the TapBridge that
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    52
 * lives in the ns-3 world; and from this perspective, becomes a read.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    53
 * In other words, a Linux process writes a packet to a tap device and
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    54
 * this packet is redirected to an ns-3 process where it is received by
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    55
 * the TapBridge as a result of a read operation there.  The TapBridge
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    56
 * then sends the packet to the ns-3 net device to which it is bridged.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    57
 * In the other direction, a packet received by an ns-3 net device is
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    58
 * bridged to the TapBridge (it appears via a callback from that net
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    59
 * device.  The TapBridge then takes that packet and writes it back to
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    60
 * the host using the Linux TAP mechanism.  This write to the device will
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    61
 * then appear to the Linux host as if a packet has arrived on its
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    62
 * device.
4180
1ec09ce94019 clean up wrong and misleading comments
Craig Dowell <craigdo@ee.washington.edu>
parents: 4176
diff changeset
    63
 * 
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    64
 * The upshot is that the Tap Bridge appears to bridge a tap device on a
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    65
 * Linux host in the "real world" to an ns-3 net device in the simulation
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    66
 * and make is appear that a ns-3 net device is actually installed in the
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    67
 * Linux host.  In order to do this on the ns-3 side, we need a "ghost
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    68
 * node" in the simulation to hold the bridged ns-3 net device and the
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    69
 * TapBridge.  This node should not actually do anything else in the
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    70
 * simulation since its job is simply to make the net device appear in
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    71
 * Linux.  This is not just arbitrary policy, it is because:
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    72
 *
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    73
 * - Bits sent to the Tap Bridge from higher layers in the ghost node (using
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    74
 *   the TapBridge Send() method) are completely ignored.  The Tap Bridge is 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    75
 *   not, itself, connected to any network, neither in Linux nor in ns-3;
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    76
 * - The bridged ns-3 net device is has had its receive callback disconnected
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    77
 *   from the ns-3 node and reconnected to the Tap Bridge.  All data received 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    78
 *   by a bridged device will be sent to the Linux host and will not be 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    79
 *   received by the node.  From the perspective of the ghost node, you can 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    80
 *   send over this device but you cannot ever receive.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    81
 *
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    82
 * Of course, if you understand all of the issues you can take control of
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    83
 * your own destiny and do whatever you want -- we do not actively
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    84
 * prevent you from using the ghost node for anything you decide.  You
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    85
 * will be able to perform typical ns-3 operations on the ghost node if
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    86
 * you so desire.  The internet stack, for example, must be there and
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    87
 * functional on that node in order to participate in IP address
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    88
 * assignment and global routing.  However, as mentioned above,
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    89
 * interfaces talking any Tap Bridge or associated bridged net devices
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    90
 * will not work completely.  If you understand exactly what you are
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    91
 * doing, you can set up other interfaces and devices on the ghost node
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    92
 * and use them; or take advantage of the operational send side of the
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    93
 * bridged devices to create traffic generators.  We generally recommend
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    94
 * that you treat this node as a ghost of the Linux host and leave it to
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
    95
 * itself, though.
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    96
 */
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
class TapBridge : public NetDevice
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    98
{
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    99
public:
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   100
  static TypeId GetTypeId (void);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   101
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   102
  /**
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   103
   * Enumeration of the operating modes supported in the class.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   104
   *
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   105
   */
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   106
  enum Mode {
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   107
    ILLEGAL,         /**< mode not set */
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   108
    CONFIGURE_LOCAL, /**< ns-3 creates and configures tap device */
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   109
    USE_LOCAL,       /**< ns-3 uses a pre-created tap, without configuring it */
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   110
    USE_BRIDGE, /**< ns-3 uses a pre-created tap, and bridges to a bridging net device */
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   111
  };
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   112
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   113
  TapBridge ();
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   114
  virtual ~TapBridge ();
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   115
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   116
  /** \brief Get the bridged net device.
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   117
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   118
   * The bridged net device is the ns-3 device to which this bridge is connected,
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   119
   *
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   120
   * \returns the bridged net device.
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   121
   */
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   122
  Ptr<NetDevice> GetBridgedNetDevice (void);
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   123
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   124
  /** \brief Set the ns-3 net device to bridge.
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   125
   *
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   126
   * This method tells the bridge which ns-3 net device it should use to connect
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   127
   * the simulation side of the bridge.  
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   128
   *
4180
1ec09ce94019 clean up wrong and misleading comments
Craig Dowell <craigdo@ee.washington.edu>
parents: 4176
diff changeset
   129
   * \attention The ns-3 net device that is being set as the device must have an
1ec09ce94019 clean up wrong and misleading comments
Craig Dowell <craigdo@ee.washington.edu>
parents: 4176
diff changeset
   130
   * an IP address assigned to it before the simulation is run.  This address 
1ec09ce94019 clean up wrong and misleading comments
Craig Dowell <craigdo@ee.washington.edu>
parents: 4176
diff changeset
   131
   * will be used to set the hardware address of the host Linux device.
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   132
   */
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   133
  void SetBridgedNetDevice (Ptr<NetDevice> bridgedDevice);
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   134
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   135
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   136
   * \brief Set a start time for the device.
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   137
   *
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   138
   * The tap bridge consumes a non-trivial amount of time to start.  It starts
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   139
   * up in the context of a scheduled event to ensure that all configuration
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   140
   * has been completed before extracting the configuration (IP addresses, etc.)
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   141
   * In order to allow a more reasonable start-up sequence than a thundering 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   142
   * herd of devices, the time at which each device starts is also configurable
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   143
   * bot via the Attribute system and via this call.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   144
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   145
   * \param tStart the start time
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   146
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   147
  void Start (Time tStart);
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   148
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   149
  /**
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   150
   * Set a stop time for the device.
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   151
   *
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   152
   * @param tStop the stop time
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   153
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   154
   * \see TapBridge::Start
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   155
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   156
  void Stop (Time tStop);
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   157
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   158
  /**
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   159
   * Set the operating mode of this device.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   160
   *
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   161
   * \param mode The operating mode of this device.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   162
   */
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   163
  void SetMode (TapBridge::Mode mode);
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   164
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   165
  /**
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   166
   * Get the operating mode of this device.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   167
   *
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   168
   * \returns The operating mode of this device.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   169
   */
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   170
  TapBridge::Mode  GetMode (void);
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   171
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   172
  //
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   173
  // The following methods are inherited from NetDevice base class and are
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   174
  // documented there.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   175
  //
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   176
  virtual void SetName(const std::string name);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   177
  virtual std::string GetName(void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   178
  virtual void SetIfIndex(const uint32_t index);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   179
  virtual uint32_t GetIfIndex(void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   180
  virtual Ptr<Channel> GetChannel (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   181
  virtual Address GetAddress (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   182
  virtual bool SetMtu (const uint16_t mtu);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   183
  virtual uint16_t GetMtu (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   184
  virtual bool IsLinkUp (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   185
  virtual void SetLinkChangeCallback (Callback<void> callback);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   186
  virtual bool IsBroadcast (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   187
  virtual Address GetBroadcast (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   188
  virtual bool IsMulticast (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   189
  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   190
  virtual bool IsPointToPoint (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   191
  virtual bool IsBridge (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   192
  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   193
  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   194
  virtual Ptr<Node> GetNode (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   195
  virtual void SetNode (Ptr<Node> node);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   196
  virtual bool NeedsArp (void) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   197
  virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   198
  virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   199
  virtual bool SupportsSendFrom () const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   200
  virtual Address GetMulticast (Ipv6Address addr) const;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   201
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   202
protected:
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   203
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   204
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   205
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   206
   * Call out to a separate process running as suid root in order to get our
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   207
   * tap device created.  We do this to avoid having the entire simulation 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   208
   * running as root.  If this method returns, we'll have a socket waiting 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   209
   * for us in m_sock that we can use to talk to the tap device.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   210
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   211
  virtual void DoDispose (void);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   212
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   213
  void ReceiveFromSimDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   214
                                 Address const &src, Address const &dst, PacketType packetType);
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   215
private:
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   216
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   217
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   218
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   219
   *
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   220
   * Call out to a separate process running as suid root in order to get our
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   221
   * tap device created.  We do this to avoid having the entire simulation 
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   222
   * running as root.  If this method returns, we'll have a socket waiting 
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   223
   * for us in m_sock that we can use to talk to the tap device.
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   224
   */
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   225
  void CreateTap (void);
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   226
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   227
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   228
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   229
   *
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   230
   * Figure out where the tap creation program lives on the system.
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   231
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   232
   * \param creatorName The name of the program used to create the Tap.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   233
   * \returns A path name to use when you want to create a Tap.
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   234
   */
4168
3d8f0d101f79 last connections on tap-bridge, start flowing packets
Craig Dowell <craigdo@ee.washington.edu>
parents: 4167
diff changeset
   235
  std::string FindCreator (std::string creatorName);
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   236
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   237
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   238
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   239
   *
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   240
   * Spin up the device
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   241
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   242
  void StartTapDevice (void);
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   243
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   244
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   245
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   246
   *
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   247
   * Tear down the device
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   248
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   249
  void StopTapDevice (void);
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   250
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   251
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   252
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   253
   *
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   254
   * Loop to read and process packets
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   255
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   256
  void ReadThread (void);
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   257
4169
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   258
  /*
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   259
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   260
   *
4169
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   261
   * Forward a packet received from the tap device to the bridged ns-3 
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   262
   * device
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   263
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   264
   * \param buf A character buffer containing the actaul packet bits that were
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   265
   *            received from the host.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   266
   * \param buf The length of the buffer.
4169
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   267
   */
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   268
  void ForwardToSimDevice (uint8_t *buf, uint32_t len);
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   269
4169
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   270
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   271
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   272
   *
4169
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   273
   * The host we are bridged to is in the evil real world.  Do some sanity
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   274
   * checking on a received packet to make sure it isn't too evil for our
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   275
   * poor naive virginal simulator to handle.
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   276
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   277
   * \param packet The packet we received from the host, and which we need 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   278
   *               to check.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   279
   * \param src    A pointer to the data structure that will get the source
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   280
   *               MAC address of the packet (extracted from the packet Ethernet
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   281
   *               header).
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   282
   * \param dst    A pointer to the data structure that will get the destination
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   283
   *               MAC address of the packet (extracted from the packet Ethernet 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   284
   *               header).
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   285
   * \param type   A pointer to the variable that will get the packet type from 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   286
   *               either the Ethernet header in the case of type interpretation
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   287
   *               (DIX framing) or from the 802.2 LLC header in the case of 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   288
   *               length interpretation (802.3 framing).
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   289
   */   
4169
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   290
  Ptr<Packet> Filter (Ptr<Packet> packet, Address *src, Address *dst, uint16_t *type);
d966e2ded46d checkpoint tap progress
Craig Dowell <craigdo@ee.washington.edu>
parents: 4168
diff changeset
   291
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   292
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   293
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   294
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   295
   * Callback used to hook the standard packet receive callback of the TapBridge
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   296
   * ns-3 net device.  This is never called, and therefore no packets will ever
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   297
   * be received forwarded up the IP stack on the ghost node through this device.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   298
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   299
  NetDevice::ReceiveCallback m_rxCallback;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   300
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   301
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   302
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   303
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   304
   * Callback used to hook the promiscuous packet receive callback of the TapBridge
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   305
   * ns-3 net device.  This is never called, and therefore no packets will ever
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   306
   * be received forwarded up the IP stack on the ghost node through this device.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   307
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   308
   * Note that we intercept the similar callback in the bridged device in order to
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   309
   * do the actual bridging between the bridged ns-3 net device and the Tap device
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   310
   * on the host.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   311
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   312
  NetDevice::PromiscReceiveCallback m_promiscRxCallback;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   313
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   314
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   315
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   316
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   317
   * Pointer to the (ghost) Node to which we are connected.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   318
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   319
  Ptr<Node> m_node;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   320
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   321
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   322
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   323
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   324
   * A possible name for the (ghost) Node to which we are connected.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   325
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   326
  std::string m_name;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   327
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   328
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   329
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   330
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   331
   * The ns-3 interface index of this TapBridge net device.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   332
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   333
  uint32_t m_ifIndex;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   334
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   335
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   336
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   337
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   338
   * The common mtu to use for the net devices
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   339
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   340
  uint16_t m_mtu;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   341
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   342
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   343
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   344
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   345
   * The socket (actually interpreted as fd) to use to talk to the Tap device on
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   346
   * the real internet host.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   347
   */
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   348
  int32_t m_sock;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   349
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   350
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   351
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   352
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   353
   * The ID of the ns-3 event used to schedule the start up of the underlying
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   354
   * host Tap device and ns-3 read thread.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   355
   */
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   356
  EventId m_startEvent;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   357
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   358
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   359
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   360
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   361
   * The ID of the ns-3 event used to schedule the tear down of the underlying
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   362
   * host Tap device and ns-3 read thread.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   363
   */
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   364
  EventId m_stopEvent;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   365
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   366
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   367
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   368
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   369
   * Used to identify the ns-3 read thread used to do blocking reads on the 
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   370
   * socket (fd) corresponding to the host device.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   371
   */
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   372
  Ptr<SystemThread> m_readThread;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   373
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   374
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   375
   * \internal
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   376
   *     
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   377
   * The operating mode of the bridge.  Tells basically who creates and
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   378
   * configures the underlying network tap.
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   379
   */
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   380
  Mode m_mode;
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   381
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   382
  /**
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   383
   * \internal
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   384
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   385
   * The (unused) MAC address of the TapBridge net device.  Since the TapBridge
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   386
   * is implemented as a ns-3 net device, it is required to implement certain
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   387
   * functionality.  In this case, the TapBridge is automatically assigned a
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   388
   * MAC address, but it is not used.
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   389
   */
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   390
  Mac48Address m_address;
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   391
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   392
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   393
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   394
   *
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   395
   * Time to start spinning up the device
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   396
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   397
  Time m_tStart;
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   398
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   399
  /**
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   400
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   401
   *
4165
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   402
   * Time to start tearing down the device
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   403
   */
40789460dd8c checkpoint tap
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
   404
  Time m_tStop;
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   405
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   406
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   407
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   408
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   409
   * The name of the device to create on the host.  If the device name is the
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   410
   * empty string, we allow the host kernel to choose a name.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   411
   */
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   412
  std::string m_tapDeviceName;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   413
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   414
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   415
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   416
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   417
   * The IP address to use as the device default gateway on the host.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   418
   */
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   419
  Ipv4Address m_tapGateway;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   420
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   421
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   422
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   423
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   424
   * The IP address to use as the device IP on the host.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   425
   */
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   426
  Ipv4Address m_tapIp;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   427
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   428
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   429
   *
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   430
   * The MAC address to use as the hardware address on the host; only used
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   431
   * in UseLocal mode.  This value comes from the MAC  
4285
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   432
   * address assigned to the bridged ns-3 net device and matches the MAC 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   433
   * address of the underlying network TAP which we configured to have the 
2b197a6b4460 first cut at enabling OpenVZ scenario
Craig Dowell <craigdo@ee.washington.edu>
parents: 4180
diff changeset
   434
   * same value.
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   435
   */
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   436
  Mac48Address m_tapMac;
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   437
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   438
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   439
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   440
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   441
   * The network mask to assign to the device created on the host.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   442
   */
4167
7e444dc749ee wire needed values into tap-bridge Attribute system, but figure out as many as possible in the default case
Craig Dowell <craigdo@ee.washington.edu>
parents: 4165
diff changeset
   443
  Ipv4Mask m_tapNetmask;
4164
1f6ae48061a9 checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4163
diff changeset
   444
4176
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   445
  /**
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   446
   * \internal
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   447
   *
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   448
   * The ns-3 net device to which we are bridging.
0246ffdff112 cleanup, doxygen, prepare for review
Craig Dowell <craigdo@ee.washington.edu>
parents: 4169
diff changeset
   449
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   450
  Ptr<NetDevice> m_bridgedDevice;
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   451
  /**
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   452
   * \internal
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   453
   *
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   454
   * The MAC address of the local tap device is stored in this variable.
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   455
   * When in UseLocal mode, this address is added back to the destination 
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   456
   * Mac address for frames destined to the tap device.  It is learned from
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   457
   * the first frame sent from the host to the TapBridge device.  In the
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   458
   * other modes of this device, this value is unused.  
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   459
   */
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   460
  Mac48Address m_learnedMac;
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4285
diff changeset
   461
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   462
};
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   463
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   464
} // namespace ns3
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   465
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   466
#endif /* TAP_BRIDGE_H */