A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ping-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' di Firenze, Italy
3 * Copyright (c) 2008-2009 Strasbourg University (original Ping6 helper)
4 * Copyright (c) 2008 INRIA (original v4Ping helper)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
20 *
21 * Derived from original v4Ping helper (author: Mathieu Lacage)
22 * Derived from original ping6 helper (author: Sebastien Vincent)
23 */
24
25#include "ping-helper.h"
26
27#include "ns3/names.h"
28#include "ns3/ping.h"
29
30namespace ns3
31{
32
34{
35 m_factory.SetTypeId("ns3::Ping");
36}
37
39{
40 m_factory.SetTypeId("ns3::Ping");
41 m_factory.Set("Destination", AddressValue(remote));
42 m_factory.Set("InterfaceAddress", AddressValue(local));
43}
44
45void
46PingHelper::SetAttribute(std::string name, const AttributeValue& value)
47{
48 m_factory.Set(name, value);
49}
50
53{
55}
56
58PingHelper::Install(std::string nodeName) const
59{
60 Ptr<Node> node = Names::Find<Node>(nodeName);
62}
63
66{
68 for (auto i = c.Begin(); i != c.End(); ++i)
69 {
70 apps.Add(InstallPriv(*i));
71 }
72
73 return apps;
74}
75
78{
80 node->AddApplication(app);
81
82 return app;
83}
84
85} // namespace ns3
a polymophic address class
Definition: address.h:101
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Hold a value for an Attribute.
Definition: attribute.h:70
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
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.
void SetAttribute(std::string name, const AttributeValue &value)
Configure ping applications attribute.
Definition: ping-helper.cc:46
ObjectFactory m_factory
Object factory.
Definition: ping-helper.h:111
ApplicationContainer Install(NodeContainer nodes) const
Install a Ping application on each Node in the provided NodeContainer.
Definition: ping-helper.cc:65
Ptr< Application > InstallPriv(Ptr< Node > node) const
Do the actual application installation in the node.
Definition: ping-helper.cc:77
PingHelper()
Create a PingHelper which is used to make life easier for people wanting to use ping Applications.
Definition: ping-helper.cc:33
This application behaves similarly to the Unix ping application, although with fewer options supporte...
Definition: ping.h:56
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.