A Discrete-Event Network Simulator
API
ping6.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-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#ifndef PING6_H
21#define PING6_H
22
23#include "ns3/application.h"
24#include "ns3/ipv6-address.h"
25#include "ns3/ipv6-l3-protocol.h"
26
27namespace ns3
28{
29
30class Packet;
31class Socket;
32
42class Ping6 : public Application
43{
44 public:
49 static TypeId GetTypeId();
50
54 Ping6();
55
59 ~Ping6() override;
60
65 void SetLocal(Ipv6Address ipv6);
66
71 void SetRemote(Ipv6Address ipv6);
72
79 void SetIfIndex(uint32_t ifIndex);
80
85 void SetRouters(std::vector<Ipv6Address> routers);
86
87 protected:
91 void DoDispose() override;
92
93 private:
97 void StartApplication() override;
98
102 void StopApplication() override;
103
108 void ScheduleTransmit(Time dt);
109
113 void Send();
114
119 void HandleRead(Ptr<Socket> socket);
120
125
130
135
140
145
150
155
160
165
170
174 uint16_t m_seq;
175
180
185
189 std::vector<Ipv6Address> m_routers;
190};
191
192} /* namespace ns3 */
193
194#endif /* PING6_H */
The base class for all ns3 applications.
Definition: application.h:61
An identifier for simulation events.
Definition: event-id.h:55
Describes an IPv6 address.
Definition: ipv6-address.h:50
A ping6 application.
Definition: ping6.h:43
void DoDispose() override
Dispose this object;.
Definition: ping6.cc:95
uint32_t m_ifIndex
Out interface (i.e.
Definition: ping6.h:184
void SetRemote(Ipv6Address ipv6)
Set the remote peer.
Definition: ping6.cc:135
void SetLocal(Ipv6Address ipv6)
Set the local address.
Definition: ping6.cc:128
Ipv6Address m_localAddress
Local address.
Definition: ping6.h:149
EventId m_sendEvent
Event ID.
Definition: ping6.h:179
void HandleRead(Ptr< Socket > socket)
Receive method.
Definition: ping6.cc:258
std::vector< Ipv6Address > m_routers
Routers addresses for routing type 0.
Definition: ping6.h:189
void StopApplication() override
Stop the application.
Definition: ping6.cc:142
uint32_t m_count
Number of "Echo request" packets that will be sent.
Definition: ping6.h:129
void SetIfIndex(uint32_t ifIndex)
Set the out interface index.
Definition: ping6.cc:155
Ptr< Socket > m_socket
Local socket.
Definition: ping6.h:169
Ipv6Address m_address
Peer IPv6 address.
Definition: ping6.h:124
void Send()
Send a packet.
Definition: ping6.cc:174
void SetRouters(std::vector< Ipv6Address > routers)
Set routers for routing type 0 (loose routing).
Definition: ping6.cc:168
uint16_t m_seq
Sequence number.
Definition: ping6.h:174
Time m_interval
Interval between packets sent.
Definition: ping6.h:144
uint32_t m_ipInterfaceIndex
IP interface index relative to the local address.
Definition: ping6.h:154
Ptr< Ipv6L3Protocol > m_ipv6Protocol
IP interface index relative to the local address.
Definition: ping6.h:159
uint32_t m_sent
Number of packets sent.
Definition: ping6.h:134
void StartApplication() override
Start the application.
Definition: ping6.cc:102
Ipv6Address m_peerAddress
Peer address.
Definition: ping6.h:164
uint32_t m_size
Size of the packet.
Definition: ping6.h:139
~Ping6() override
Destructor.
Definition: ping6.cc:88
Ping6()
Constructor.
Definition: ping6.cc:77
static TypeId GetTypeId()
Get the type ID.
Definition: ping6.cc:43
void ScheduleTransmit(Time dt)
Schedule sending a packet.
Definition: ping6.cc:161
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.