16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 */ |
17 */ |
18 |
18 |
19 #include "ns3/log.h" |
19 #include "ns3/log.h" |
20 #include "ns3/node.h" |
20 #include "ns3/node.h" |
|
21 #include "ns3/enum.h" |
21 #include "ns3/tap-bridge.h" |
22 #include "ns3/tap-bridge.h" |
22 #include "ns3/names.h" |
23 #include "ns3/names.h" |
23 #include "tap-bridge-helper.h" |
24 #include "tap-bridge-helper.h" |
24 |
25 |
25 NS_LOG_COMPONENT_DEFINE ("TapBridgeHelper"); |
26 NS_LOG_COMPONENT_DEFINE ("TapBridgeHelper"); |
26 |
27 |
27 namespace ns3 { |
28 namespace ns3 { |
28 |
29 |
|
30 TapBridgeHelper::TapBridgeHelper () |
|
31 { |
|
32 NS_LOG_FUNCTION_NOARGS (); |
|
33 m_deviceFactory.SetTypeId ("ns3::TapBridge"); |
|
34 } |
|
35 |
29 TapBridgeHelper::TapBridgeHelper (Ipv4Address gateway) |
36 TapBridgeHelper::TapBridgeHelper (Ipv4Address gateway) |
30 { |
37 { |
31 NS_LOG_FUNCTION_NOARGS (); |
38 NS_LOG_FUNCTION_NOARGS (); |
32 m_deviceFactory.SetTypeId ("ns3::TapBridge"); |
39 m_deviceFactory.SetTypeId ("ns3::TapBridge"); |
33 SetAttribute ("Gateway", Ipv4AddressValue (gateway)); |
40 SetAttribute ("Gateway", Ipv4AddressValue (gateway)); |
|
41 SetAttribute ("Mode", EnumValue(TapBridge::CONFIGURE_LOCAL)); |
34 } |
42 } |
35 |
43 |
36 void |
44 void |
37 TapBridgeHelper::SetAttribute (std::string n1, const AttributeValue &v1) |
45 TapBridgeHelper::SetAttribute (std::string n1, const AttributeValue &v1) |
38 { |
46 { |
39 NS_LOG_FUNCTION (n1 << &v1); |
47 NS_LOG_FUNCTION (n1 << &v1); |
40 m_deviceFactory.Set (n1, v1); |
48 m_deviceFactory.Set (n1, v1); |
41 } |
49 } |
42 |
50 |
|
51 |
|
52 Ptr<NetDevice> |
|
53 TapBridgeHelper::Install (Ptr<Node> node, Ptr<NetDevice> nd, const AttributeValue &v1) |
|
54 { |
|
55 NS_LOG_FUNCTION (node << nd << &v1); |
|
56 m_deviceFactory.Set ("DeviceName", v1); |
|
57 return Install (node, nd); |
|
58 } |
43 |
59 |
44 Ptr<NetDevice> |
60 Ptr<NetDevice> |
45 TapBridgeHelper::Install (Ptr<Node> node, Ptr<NetDevice> nd) |
61 TapBridgeHelper::Install (Ptr<Node> node, Ptr<NetDevice> nd) |
46 { |
62 { |
47 NS_LOG_FUNCTION (node << nd); |
63 NS_LOG_FUNCTION (node << nd); |