src/tap-bridge/helper/tap-bridge-helper.h
author Tommaso Pecorella <tommaso.pecorella@unifi.it>
Fri, 03 Oct 2014 23:51:58 +0200
changeset 10989 71d2c67a51aa
parent 6852 8f1a53d3f6ca
permissions -rw-r--r--
[Doxygen] minor fixes
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_HELPER_H
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
#define TAP_BRIDGE_HELPER_H
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
6823
a27f86fb4e55 Merge node and common modules into new network module
Tom Henderson <tomh@tomh.org>
parents: 6273
diff changeset
    22
#include "ns3/net-device-container.h"
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
#include "ns3/object-factory.h"
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4194
diff changeset
    24
#include "ns3/tap-bridge.h"
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
#include <string>
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
namespace ns3 {
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
class Node;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
class AttributeValue;
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    32
/**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    33
 * \brief build TapBridge to allow ns-3 simulations to interact with Linux 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    34
 * tap devices and processes on the Linux host.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    35
 */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
class TapBridgeHelper
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
public:
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    39
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    40
   * Construct a TapBridgeHelper to make life easier for people wanting to 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    41
   * have their simulations interact with Linux tap devices and processes
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    42
   * on the Linux host.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    43
   */
4289
2f5b0ec50102 initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents: 4194
diff changeset
    44
  TapBridgeHelper ();
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    45
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    46
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    47
   * Construct a TapBridgeHelper to make life easier for people wanting to 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    48
   * have their simulations interact with Linux tap devices and processes
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    49
   * on the Linux host.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    50
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    51
   * \param gateway An Ipv4Address to be used as the default gateway for 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    52
   * the created bridges,
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    53
   */
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: 4163
diff changeset
    54
  TapBridgeHelper (Ipv4Address gateway);
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    55
10989
71d2c67a51aa [Doxygen] minor fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 6852
diff changeset
    56
  /**
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5363
diff changeset
    57
   * Set an attribute in the underlying TapBridge net device when these
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    58
   * devices are automatically created.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    59
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    60
   * \param n1 the name of the attribute to set
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    61
   * \param v1 the value of the attribute to set
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    62
   */
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: 4163
diff changeset
    63
  void SetAttribute (std::string n1, const AttributeValue &v1);
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    64
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    65
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    66
   * This method installs a TapBridge on the specified Node and forms the 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    67
   * bridge with the NetDevice specified.  The Node is specified using
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    68
   * a Ptr<Node> and the NetDevice is specified using a Ptr<NetDevice>
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    69
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    70
   * \param node The Ptr<Node> to install the TapBridge in
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    71
   * \param nd The Ptr<NetDevice> to attach to the bridge.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    72
   * \returns A pointer to the new TapBridge NetDevice.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    73
   */
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    74
  Ptr<NetDevice> Install (Ptr<Node> node, Ptr<NetDevice> nd);
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    75
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    76
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    77
   * This method installs a TapBridge on the specified Node and forms the 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    78
   * bridge with the NetDevice specified.  The node is specified by a 
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5363
diff changeset
    79
   * name string that has previously been associated with the Node using
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    80
   * the Object Name Service.  The NetDevice is specified by a Ptr<NetDevice>.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    81
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    82
   * \param nodeName The name of the Node to install the TapBridge in
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    83
   * \param nd The Ptr<NetDevice> to attach to the bridge.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    84
   * \returns A pointer to the new TapBridge NetDevice.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    85
   */
4194
819e09dac21a add names support to tap bridge helper
Craig Dowell <craigdo@ee.washington.edu>
parents: 4167
diff changeset
    86
  Ptr<NetDevice> Install (std::string nodeName, Ptr<NetDevice> nd);
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    87
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    88
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    89
   * This method installs a TapBridge on the specified Node and forms the 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    90
   * bridge with the NetDevice specified.  The NetDevice is specified by a 
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5363
diff changeset
    91
   * name string that has previously been associated with the NetDevice
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    92
   * using the Object Name Service.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    93
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    94
   * \param node The Ptr<Node> to install the TapBridge in
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    95
   * \param ndName The name of the NetDevice to attach to the bridge.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    96
   * \returns A pointer to the new TapBridge NetDevice.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    97
   */
4194
819e09dac21a add names support to tap bridge helper
Craig Dowell <craigdo@ee.washington.edu>
parents: 4167
diff changeset
    98
  Ptr<NetDevice> Install (Ptr<Node> node, std::string ndName);
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
    99
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   100
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   101
   * This method installs a TapBridge on the specified Node and forms the 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   102
   * bridge with the NetDevice specified.  The node is specified by a 
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5363
diff changeset
   103
   * name string that has previously been associated with the Node using
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   104
   * the Object Name Service.  The NetDevice is specified by a name 
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5363
diff changeset
   105
   * string that has previously been associated with the Object Name 
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   106
   * Service.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   107
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   108
   * \param nodeName The name of the Node to install the TapBridge in
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   109
   * \param ndName The name of the NetDevice to attach to the bridge.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   110
   * \returns A pointer to the new TapBridge NetDevice.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   111
   */
4194
819e09dac21a add names support to tap bridge helper
Craig Dowell <craigdo@ee.washington.edu>
parents: 4167
diff changeset
   112
  Ptr<NetDevice> Install (std::string nodeName, std::string ndName);
5363
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   113
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   114
  /**
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   115
   * This method installs a TapBridge on the specified Node and forms the 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   116
   * bridge with the NetDevice specified.  The Node is specified using
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   117
   * a Ptr<Node> and the NetDevice is specified using a Ptr<NetDevice>.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   118
   * The type of the actual Bridge device is specified with the
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   119
   * provided AttributeValue (typically "ns3::TapBridge").
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   120
   *
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   121
   * \param node The Ptr<Node> to install the TapBridge in
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   122
   * \param nd The Ptr<NetDevice> to attach to the bridge.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   123
   * \param bridgeType The TypeId of the bridge that will be automatically 
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   124
   *                   created.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   125
   * \returns A pointer to the new TapBridge NetDevice.
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   126
   */
7134a7d9337a Doxygen-o-matic
Craig Dowell <craigdo@ee.washington.edu>
parents: 4289
diff changeset
   127
  Ptr<NetDevice> Install (Ptr<Node> node, Ptr<NetDevice> nd, const AttributeValue &bridgeType);
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   128
private:
10989
71d2c67a51aa [Doxygen] minor fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents: 6852
diff changeset
   129
  ObjectFactory m_deviceFactory; //!< Object factory
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   130
};
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   131
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   132
} // namespace ns3
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   133
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   134
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   135
#endif /* TAP_BRIDGE_HELPER_H */