A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tap-bridge-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#include "tap-bridge-helper.h"
8
9#include "ns3/enum.h"
10#include "ns3/log.h"
11#include "ns3/names.h"
12#include "ns3/node.h"
13#include "ns3/tap-bridge.h"
14
15namespace ns3
16{
17
18NS_LOG_COMPONENT_DEFINE("TapBridgeHelper");
19
25
33
34void
36{
37 NS_LOG_FUNCTION(n1 << &v1);
38 m_deviceFactory.Set(n1, v1);
39}
40
43{
44 NS_LOG_FUNCTION(node << nd << &v1);
45 m_deviceFactory.Set("DeviceName", v1);
46 return Install(node, nd);
47}
48
51{
52 NS_LOG_FUNCTION(node << nd);
53 NS_LOG_LOGIC("Install TapBridge on node " << node->GetId() << " bridging net device " << nd);
54
56 node->AddDevice(bridge);
57 bridge->SetBridgedNetDevice(nd);
58
59 return bridge;
60}
61
64{
65 Ptr<Node> node = Names::Find<Node>(nodeName);
66 return Install(node, nd);
67}
68
70TapBridgeHelper::Install(Ptr<Node> node, std::string ndName)
71{
73 return Install(node, nd);
74}
75
77TapBridgeHelper::Install(std::string nodeName, std::string ndName)
78{
79 Ptr<Node> node = Names::Find<Node>(nodeName);
81 return Install(node, nd);
82}
83
84} // namespace ns3
Hold a value for an Attribute.
Definition attribute.h:59
Hold variables of type enum.
Definition enum.h:52
Ipv4 addresses are stored in host order in this class.
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
Definition names.h:443
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
Ptr< NetDevice > Install(Ptr< Node > node, Ptr< NetDevice > nd)
This method installs a TapBridge on the specified Node and forms the bridge with the NetDevice specif...
TapBridgeHelper()
Construct a TapBridgeHelper to make life easier for people wanting to have their simulations interact...
void SetAttribute(std::string n1, const AttributeValue &v1)
Set an attribute in the underlying TapBridge net device when these devices are automatically created.
ObjectFactory m_deviceFactory
Object factory.
A bridge to make it appear that a real host process is connected to an ns-3 net device.
Definition tap-bridge.h:98
@ CONFIGURE_LOCAL
ns-3 creates and configures tap device
Definition tap-bridge.h:113
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.