A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
bridge-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#include "bridge-helper.h"
8
9#include "ns3/bridge-net-device.h"
10#include "ns3/log.h"
11#include "ns3/names.h"
12#include "ns3/node.h"
13
14/**
15 * @file
16 * @ingroup bridge
17 * ns3::BridgeHelper implementation.
18 */
19
20namespace ns3
21{
22
23NS_LOG_COMPONENT_DEFINE("BridgeHelper");
24
30
31void
37
40{
42 NS_LOG_LOGIC("**** Install bridge device on node " << node->GetId());
43
46 devs.Add(dev);
47 node->AddDevice(dev);
48
49 for (auto i = c.Begin(); i != c.End(); ++i)
50 {
51 NS_LOG_LOGIC("**** Add BridgePort " << *i);
52 dev->AddBridgePort(*i);
53 }
54 return devs;
55}
56
59{
61 Ptr<Node> node = Names::Find<Node>(nodeName);
62 return Install(node, c);
63}
64
65} // namespace ns3
ns3::BridgeHelper declaration.
Hold a value for an Attribute.
Definition attribute.h:59
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Set an attribute on each ns3::BridgeNetDevice created by BridgeHelper::Install.
ObjectFactory m_deviceFactory
Object factory.
NetDeviceContainer Install(Ptr< Node > node, NetDeviceContainer c)
This method creates an ns3::BridgeNetDevice with the attributes configured by BridgeHelper::SetDevice...
a virtual net device that bridges multiple LAN segments
holds a vector of ns3::NetDevice pointers
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.
Definition ptr.h:66
#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.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.