A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ping6.h
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/event-id.h"
26 #include "ns3/ptr.h"
27 #include "ns3/ipv6-address.h"
28 
29 namespace ns3
30 {
31 
32 class Packet;
33 class Socket;
34 
45 class Ping6 : public Application
46 {
47 public:
52  static TypeId GetTypeId ();
53 
57  Ping6 ();
58 
62  virtual ~Ping6 ();
63 
68  void SetLocal (Ipv6Address ipv6);
69 
74  void SetRemote (Ipv6Address ipv6);
75 
82  void SetIfIndex (uint32_t ifIndex);
83 
88  void SetRouters (std::vector<Ipv6Address> routers);
89 
90 protected:
94  virtual void DoDispose ();
95 
96 private:
100  virtual void StartApplication ();
101 
105  virtual void StopApplication ();
106 
111  void ScheduleTransmit (Time dt);
112 
116  void Send ();
117 
122  void HandleRead (Ptr<Socket> socket);
123 
128 
132  uint32_t m_count;
133 
137  uint32_t m_sent;
138 
142  uint32_t m_size;
143 
148 
153 
158 
163 
167  uint16_t m_seq;
168 
173 
177  uint32_t m_ifIndex;
178 
182  std::vector<Ipv6Address> m_routers;
183 };
184 
185 } /* namespace ns3 */
186 
187 #endif /* PING6_H */
188 
virtual ~Ping6()
Destructor.
Definition: ping6.cc:88
keep track of time unit.
Definition: nstime.h:149
virtual void StopApplication()
Stop the application.
Definition: ping6.cc:132
void SetRouters(std::vector< Ipv6Address > routers)
Set routers for routing type 0 (loose routing).
Definition: ping6.cc:155
Time m_interval
Intervall between packets sent.
Definition: ping6.h:147
void Send()
Send a packet.
Definition: ping6.cc:160
void SetIfIndex(uint32_t ifIndex)
Set the out interface index. This is to send to link-local (unicast or multicast) address when a node...
Definition: ping6.cc:144
The base class for all ns3 applications.
Definition: application.h:61
uint32_t m_sent
Number of packets sent.
Definition: ping6.h:137
virtual void StartApplication()
Start the application.
Definition: ping6.cc:100
std::vector< Ipv6Address > m_routers
Routers addresses for routing type 0.
Definition: ping6.h:182
A ping6 application.
Definition: ping6.h:45
void SetLocal(Ipv6Address ipv6)
Set the local address.
Definition: ping6.cc:120
uint32_t m_size
Size of the packet.
Definition: ping6.h:142
Ptr< Socket > m_socket
Local socket.
Definition: ping6.h:162
Ping6()
Constructor.
Definition: ping6.cc:79
Describes an IPv6 address.
Definition: ipv6-address.h:44
void SetRemote(Ipv6Address ipv6)
Set the remote peer.
Definition: ping6.cc:126
an identifier for simulation events.
Definition: event-id.h:46
uint16_t m_seq
Sequence number.
Definition: ping6.h:167
uint32_t m_ifIndex
Out interface (i.e. for link-local communication).
Definition: ping6.h:177
Ipv6Address m_localAddress
Local address.
Definition: ping6.h:152
void ScheduleTransmit(Time dt)
Schedule sending a packet.
Definition: ping6.cc:149
virtual void DoDispose()
Dispose this object;.
Definition: ping6.cc:94
Ipv6Address m_address
Peer IPv6 address.
Definition: ping6.h:127
EventId m_sendEvent
Event ID.
Definition: ping6.h:172
static TypeId GetTypeId()
Get the type ID.
Definition: ping6.cc:45
a unique identifier for an interface.
Definition: type-id.h:44
Ipv6Address m_peerAddress
Peer address.
Definition: ping6.h:157
void HandleRead(Ptr< Socket > socket)
Receive method.
Definition: ping6.cc:228
uint32_t m_count
Number of "Echo request" packets that will be sent.
Definition: ping6.h:132