A Discrete-Event Network Simulator
API
ping6.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  */
20 
21 #ifndef PING6_H
22 #define PING6_H
23 
24 #include "ns3/application.h"
25 #include "ns3/ipv6-address.h"
26 
27 namespace ns3
28 {
29 
30 class Packet;
31 class Socket;
32 
42 class Ping6 : public Application
43 {
44 public:
49  static TypeId GetTypeId ();
50 
54  Ping6 ();
55 
59  virtual ~Ping6 ();
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  virtual void DoDispose ();
92 
93 private:
97  virtual void StartApplication ();
98 
102  virtual void StopApplication ();
103 
108  void ScheduleTransmit (Time dt);
109 
113  void Send ();
114 
119  void HandleRead (Ptr<Socket> socket);
120 
125 
129  uint32_t m_count;
130 
134  uint32_t m_sent;
135 
139  uint32_t m_size;
140 
145 
150 
155 
160 
164  uint16_t m_seq;
165 
170 
174  uint32_t m_ifIndex;
175 
179  std::vector<Ipv6Address> m_routers;
180 };
181 
182 } /* namespace ns3 */
183 
184 #endif /* PING6_H */
185 
virtual ~Ping6()
Destructor.
Definition: ping6.cc:88
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
virtual void StopApplication()
Stop the application.
Definition: ping6.cc:131
void SetRouters(std::vector< Ipv6Address > routers)
Set routers for routing type 0 (loose routing).
Definition: ping6.cc:154
Time m_interval
Intervall between packets sent.
Definition: ping6.h:144
void Send()
Send a packet.
Definition: ping6.cc:159
void SetIfIndex(uint32_t ifIndex)
Set the out interface index.
Definition: ping6.cc:143
The base class for all ns3 applications.
Definition: application.h:60
uint32_t m_sent
Number of packets sent.
Definition: ping6.h:134
virtual void StartApplication()
Start the application.
Definition: ping6.cc:100
std::vector< Ipv6Address > m_routers
Routers addresses for routing type 0.
Definition: ping6.h:179
A ping6 application.
Definition: ping6.h:42
void SetLocal(Ipv6Address ipv6)
Set the local address.
Definition: ping6.cc:119
uint32_t m_size
Size of the packet.
Definition: ping6.h:139
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< Socket > m_socket
Local socket.
Definition: ping6.h:159
Ping6()
Constructor.
Definition: ping6.cc:79
Describes an IPv6 address.
Definition: ipv6-address.h:49
void SetRemote(Ipv6Address ipv6)
Set the remote peer.
Definition: ping6.cc:125
An identifier for simulation events.
Definition: event-id.h:53
uint16_t m_seq
Sequence number.
Definition: ping6.h:164
uint32_t m_ifIndex
Out interface (i.e.
Definition: ping6.h:174
Ipv6Address m_localAddress
Local address.
Definition: ping6.h:149
void ScheduleTransmit(Time dt)
Schedule sending a packet.
Definition: ping6.cc:148
virtual void DoDispose()
Dispose this object;.
Definition: ping6.cc:94
Ipv6Address m_address
Peer IPv6 address.
Definition: ping6.h:124
EventId m_sendEvent
Event ID.
Definition: ping6.h:169
static TypeId GetTypeId()
Get the type ID.
Definition: ping6.cc:44
a unique identifier for an interface.
Definition: type-id.h:58
Ipv6Address m_peerAddress
Peer address.
Definition: ping6.h:154
void HandleRead(Ptr< Socket > socket)
Receive method.
Definition: ping6.cc:242
uint32_t m_count
Number of "Echo request" packets that will be sent.
Definition: ping6.h:129