A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ping6-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2009 Strasbourg University
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
18
*/
19
20
#include "
ping6-helper.h
"
21
22
#include "ns3/ping6.h"
23
#include "ns3/uinteger.h"
24
25
namespace
ns3
26
{
27
28
Ping6Helper::Ping6Helper
()
29
: m_ifIndex(0)
30
{
31
m_factory
.
SetTypeId
(
Ping6::GetTypeId
());
32
}
33
34
void
35
Ping6Helper::SetLocal
(
Ipv6Address
ip)
36
{
37
m_localIp
= ip;
38
}
39
40
void
41
Ping6Helper::SetRemote
(
Ipv6Address
ip)
42
{
43
m_remoteIp
= ip;
44
}
45
46
void
47
Ping6Helper::SetAttribute
(std::string name,
const
AttributeValue
&
value
)
48
{
49
m_factory
.
Set
(name,
value
);
50
}
51
52
ApplicationContainer
53
Ping6Helper::Install
(
NodeContainer
c)
54
{
55
ApplicationContainer
apps;
56
for
(
NodeContainer::Iterator
i = c.
Begin
(); i != c.
End
(); ++i)
57
{
58
Ptr<Node>
node = *i;
59
Ptr<Ping6>
client =
m_factory
.
Create
<
Ping6
>();
60
client->SetLocal(
m_localIp
);
61
client->SetRemote(
m_remoteIp
);
62
client->SetIfIndex(
m_ifIndex
);
63
client->SetRouters(
m_routers
);
64
node->
AddApplication
(client);
65
apps.
Add
(client);
66
}
67
return
apps;
68
}
69
70
void
71
Ping6Helper::SetIfIndex
(
uint32_t
ifIndex)
72
{
73
m_ifIndex
= ifIndex;
74
}
75
76
void
77
Ping6Helper::SetRoutersAddress
(std::vector<Ipv6Address> routers)
78
{
79
m_routers
= routers;
80
}
81
82
}
/* namespace ns3 */
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition:
application-container.h:44
ns3::ApplicationContainer::Add
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Definition:
application-container.cc:70
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:70
ns3::Ipv6Address
Describes an IPv6 address.
Definition:
ipv6-address.h:50
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition:
node-container.h:43
ns3::NodeContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Definition:
node-container.cc:66
ns3::NodeContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Definition:
node-container.cc:60
ns3::Node::AddApplication
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition:
node.cc:169
ns3::ObjectFactory::Create
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
Definition:
object-factory.cc:97
ns3::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition:
object-factory.h:220
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition:
object-factory.cc:42
ns3::Ping6Helper::SetRemote
void SetRemote(Ipv6Address ip)
Set the remote IPv6 address.
Definition:
ping6-helper.cc:41
ns3::Ping6Helper::m_factory
ObjectFactory m_factory
An object factory.
Definition:
ping6-helper.h:89
ns3::Ping6Helper::Install
ApplicationContainer Install(NodeContainer c)
Install the application in Nodes.
Definition:
ping6-helper.cc:53
ns3::Ping6Helper::m_ifIndex
uint32_t m_ifIndex
Out interface index.
Definition:
ping6-helper.h:104
ns3::Ping6Helper::m_routers
std::vector< Ipv6Address > m_routers
Routers addresses.
Definition:
ping6-helper.h:109
ns3::Ping6Helper::SetRoutersAddress
void SetRoutersAddress(std::vector< Ipv6Address > routers)
Set routers addresses for routing type 0.
Definition:
ping6-helper.cc:77
ns3::Ping6Helper::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set some attributes.
Definition:
ping6-helper.cc:47
ns3::Ping6Helper::SetLocal
void SetLocal(Ipv6Address ip)
Set the local IPv6 address.
Definition:
ping6-helper.cc:35
ns3::Ping6Helper::Ping6Helper
Ping6Helper()
Constructor.
Definition:
ping6-helper.cc:28
ns3::Ping6Helper::m_remoteIp
Ipv6Address m_remoteIp
The remote IPv6 address.
Definition:
ping6-helper.h:99
ns3::Ping6Helper::SetIfIndex
void SetIfIndex(uint32_t ifIndex)
Set the out interface index.
Definition:
ping6-helper.cc:71
ns3::Ping6Helper::m_localIp
Ipv6Address m_localIp
The local IPv6 address.
Definition:
ping6-helper.h:94
ns3::Ping6
A ping6 application.
Definition:
ping6.h:43
ns3::Ping6::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
ping6.cc:43
ns3::Ptr< Node >
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.value
value
Definition:
second.py:41
ping6-helper.h
src
internet-apps
helper
ping6-helper.cc
Generated on Tue Nov 1 2022 22:59:53 for ns-3 by
1.9.3