A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
v4ping.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  */
16 #ifndef V4PING_H
17 #define V4PING_H
18 
19 #include "ns3/application.h"
20 #include "ns3/traced-callback.h"
21 #include "ns3/nstime.h"
22 #include "ns3/average.h"
23 #include "ns3/simulator.h"
24 #include <map>
25 
26 namespace ns3 {
27 
28 class Socket;
29 
36 class V4Ping : public Application
37 {
38 public:
39  static TypeId GetTypeId (void);
40 
44  V4Ping ();
45  virtual ~V4Ping ();
46 
47 private:
48  void Write32 (uint8_t *buffer, const uint32_t data);
49  void Read32 (const uint8_t *buffer, uint32_t &data);
50 
51  // inherited from Application base class.
52  virtual void StartApplication (void);
53  virtual void StopApplication (void);
54  virtual void DoDispose (void);
55  uint32_t GetApplicationId (void) const;
56  void Receive (Ptr<Socket> socket);
57  void Send ();
58 
67  uint32_t m_size;
69  uint16_t m_seq;
72  bool m_verbose;
74  uint32_t m_recv;
82  std::map<uint16_t, Time> m_sent;
83 };
84 
85 } // namespace ns3
86 
87 #endif /* V4PING_H */