/usr/include/ns3.26/ns3/v4ping.h is in libns3-dev 3.26+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef V4PING_H
#define V4PING_H
#include "ns3/application.h"
#include "ns3/traced-callback.h"
#include "ns3/nstime.h"
#include "ns3/average.h"
#include "ns3/simulator.h"
#include <map>
namespace ns3 {
class Socket;
/**
* \ingroup internet-apps
* \defgroup v4ping V4Ping
*/
/**
* \ingroup v4ping
* \brief an application which sends one ICMP ECHO request, waits for a REPLYs
* and reports the calculated RTT.
*
* Note: The RTT calculated is reported through a trace source.
*/
class V4Ping : public Application
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
/**
* create a pinger applications
*/
V4Ping ();
virtual ~V4Ping ();
private:
/**
* \brief Writes data to buffer in little-endian format.
*
* Least significant byte of data is at lowest buffer address
*
* \param buffer the buffer to write to
* \param data the data to write
*/
void Write32 (uint8_t *buffer, const uint32_t data);
/**
* \brief Writes data from a little-endian formatted buffer to data.
*
* \param buffer the buffer to read from
* \param data the read data
*/
void Read32 (const uint8_t *buffer, uint32_t &data);
// inherited from Application base class.
virtual void StartApplication (void);
virtual void StopApplication (void);
virtual void DoDispose (void);
/**
* \brief Return the application ID in the node.
* \returns the application id
*/
uint32_t GetApplicationId (void) const;
/**
* \brief Receive an ICMP Echo
* \param socket the receiving socket
*
* This function is called by lower layers through a callback.
*/
void Receive (Ptr<Socket> socket);
/**
* \brief Send one Ping (ICMP ECHO) to the destination
*/
void Send ();
/// Remote address
Ipv4Address m_remote;
/// Wait interval seconds between sending each packet
Time m_interval;
/**
* Specifies the number of data bytes to be sent.
* The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
*/
uint32_t m_size;
/// The socket we send packets from
Ptr<Socket> m_socket;
/// ICMP ECHO sequence number
uint16_t m_seq;
/// TracedCallback for RTT measured by ICMP ECHOs
TracedCallback<Time> m_traceRtt;
/// produce ping-style output if true
bool m_verbose;
/// received packets counter
uint32_t m_recv;
/// Start time to report total ping time
Time m_started;
/// Average rtt is ms
Average<double> m_avgRtt;
/// Next packet will be sent
EventId m_next;
/// All sent but not answered packets. Map icmp seqno -> when sent
std::map<uint16_t, Time> m_sent;
};
} // namespace ns3
#endif /* V4PING_H */
|