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-- |
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 | 32 |
/** |
33 |
* \brief build TapBridge to allow ns-3 simulations to interact with Linux |
|
34 |
* tap devices and processes on the Linux host. |
|
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 | 39 |
/** |
40 |
* Construct a TapBridgeHelper to make life easier for people wanting to |
|
41 |
* have their simulations interact with Linux tap devices and processes |
|
42 |
* on the Linux host. |
|
43 |
*/ |
|
4289
2f5b0ec50102
initial modifications to tap-bridge
core@samcore1.nettech.boeing.com
parents:
4194
diff
changeset
|
44 |
TapBridgeHelper (); |
5363 | 45 |
|
46 |
/** |
|
47 |
* Construct a TapBridgeHelper to make life easier for people wanting to |
|
48 |
* have their simulations interact with Linux tap devices and processes |
|
49 |
* on the Linux host. |
|
50 |
* |
|
51 |
* \param gateway An Ipv4Address to be used as the default gateway for |
|
52 |
* the created bridges, |
|
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 | 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 | 58 |
* devices are automatically created. |
59 |
* |
|
60 |
* \param n1 the name of the attribute to set |
|
61 |
* \param v1 the value of the attribute to set |
|
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 | 64 |
|
65 |
/** |
|
66 |
* This method installs a TapBridge on the specified Node and forms the |
|
67 |
* bridge with the NetDevice specified. The Node is specified using |
|
68 |
* a Ptr<Node> and the NetDevice is specified using a Ptr<NetDevice> |
|
69 |
* |
|
70 |
* \param node The Ptr<Node> to install the TapBridge in |
|
71 |
* \param nd The Ptr<NetDevice> to attach to the bridge. |
|
72 |
* \returns A pointer to the new TapBridge NetDevice. |
|
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 | 75 |
|
76 |
/** |
|
77 |
* This method installs a TapBridge on the specified Node and forms the |
|
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 | 80 |
* the Object Name Service. The NetDevice is specified by a Ptr<NetDevice>. |
81 |
* |
|
82 |
* \param nodeName The name of the Node to install the TapBridge in |
|
83 |
* \param nd The Ptr<NetDevice> to attach to the bridge. |
|
84 |
* \returns A pointer to the new TapBridge NetDevice. |
|
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 | 87 |
|
88 |
/** |
|
89 |
* This method installs a TapBridge on the specified Node and forms the |
|
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 | 92 |
* using the Object Name Service. |
93 |
* |
|
94 |
* \param node The Ptr<Node> to install the TapBridge in |
|
95 |
* \param ndName The name of the NetDevice to attach to the bridge. |
|
96 |
* \returns A pointer to the new TapBridge NetDevice. |
|
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 | 99 |
|
100 |
/** |
|
101 |
* This method installs a TapBridge on the specified Node and forms the |
|
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 | 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 | 106 |
* Service. |
107 |
* |
|
108 |
* \param nodeName The name of the Node to install the TapBridge in |
|
109 |
* \param ndName The name of the NetDevice to attach to the bridge. |
|
110 |
* \returns A pointer to the new TapBridge NetDevice. |
|
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 | 113 |
|
114 |
/** |
|
115 |
* This method installs a TapBridge on the specified Node and forms the |
|
116 |
* bridge with the NetDevice specified. The Node is specified using |
|
117 |
* a Ptr<Node> and the NetDevice is specified using a Ptr<NetDevice>. |
|
118 |
* The type of the actual Bridge device is specified with the |
|
119 |
* provided AttributeValue (typically "ns3::TapBridge"). |
|
120 |
* |
|
121 |
* \param node The Ptr<Node> to install the TapBridge in |
|
122 |
* \param nd The Ptr<NetDevice> to attach to the bridge. |
|
123 |
* \param bridgeType The TypeId of the bridge that will be automatically |
|
124 |
* created. |
|
125 |
* \returns A pointer to the new TapBridge NetDevice. |
|
126 |
*/ |
|
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 */ |