A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
packet-socket-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#include "
packet-socket-helper.h
"
10
11
#include "ns3/names.h"
12
#include "ns3/packet-socket-factory.h"
13
14
namespace
ns3
15
{
16
17
void
18
PacketSocketHelper::Install
(
NodeContainer
c)
const
19
{
20
for
(
auto
i = c.
Begin
(); i != c.
End
(); ++i)
21
{
22
Install
(*i);
23
}
24
}
25
26
void
27
PacketSocketHelper::Install
(
Ptr<Node>
node)
const
28
{
29
Ptr<PacketSocketFactory>
factory =
CreateObject<PacketSocketFactory>
();
30
node->AggregateObject(factory);
31
}
32
33
void
34
PacketSocketHelper::Install
(std::string nodeName)
const
35
{
36
Ptr<Node>
node =
Names::Find<Node>
(nodeName);
37
Install
(node);
38
}
39
40
}
// namespace ns3
ns3::Names::Find
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
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::NodeContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Definition
node-container.cc:55
ns3::NodeContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Definition
node-container.cc:49
ns3::PacketSocketHelper::Install
void Install(std::string nodeName) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Definition
packet-socket-helper.cc:34
ns3::PacketSocketHelper::Install
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Definition
packet-socket-helper.cc:27
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
packet-socket-helper.h
src
network
helper
packet-socket-helper.cc
Generated on Fri Dec 13 2024 09:20:46 for ns-3 by
1.11.0