17#include "ns3/application.h"
18#include "ns3/average.h"
19#include "ns3/traced-callback.h"
106 void SetRouters(
const std::vector<Ipv6Address>& routers);
154 void Write64(uint8_t* buffer,
const uint64_t
data);
162 uint64_t
Read64(
const uint8_t* buffer);
a polymophic address class
The base class for all ns3 applications.
Simple average, min, max and std.
An identifier for simulation events.
EchoRequestData(Time txTimePar, bool ackedPar)
Constructor.
bool acked
True if packet has been acknowledged.
This application behaves similarly to the Unix ping application, although with fewer options supporte...
uint32_t m_size
Specifies the number of data bytes to be sent.
uint32_t m_recv
Received packets counter.
Time m_started
Start time to report total ping time.
bool m_reportPrinted
True if the report has been printed already.
std::vector< EchoRequestData > m_sent
All sent but not answered packets. Map icmp seqno -> when sent, acked at least once.
uint64_t Read64(const uint8_t *buffer)
Writes data from a little-endian formatted buffer to data.
void(* RttTrace)(uint16_t seq, Time rtt)
TracedCallback signature for Rtt trace.
void(* TxTrace)(uint16_t seq, Ptr< const Packet > p)
TracedCallback signature for Rtt trace.
bool m_useIpv6
Use IPv4 (false) or IPv6 (true)
VerboseMode
Encode three possible levels of verbose output.
@ SILENT
Silent output (no terminal output at all)
@ VERBOSE
Verbose output (similar to real ping output)
@ QUIET
Quiet output (similar to real 'ping -q' output)
void SetRouters(const std::vector< Ipv6Address > &routers)
Set routers for IPv6 routing type 0 (loose routing).
std::vector< Ipv6Address > m_routers
Routers addresses for IPv6 routing type 0.
~Ping() override
Destructor.
TracedCallback< uint16_t, Ptr< Packet > > m_txTrace
Callbacks for tracing the packet Tx events.
uint64_t m_appSignature
App signature: ID of the node where the app is installed || ID of the Application.
uint32_t m_count
Number of packets to be sent.
uint64_t GetApplicationSignature() const
Return the application signatiure.
void Send()
Send one Ping (ICMPv4 ECHO or ICMPv6 ECHO) to the destination.
void DoDispose() override
Destructor implementation.
void(* DropTrace)(uint16_t seq, DropReason reason)
TracedCallback signature for Drop trace.
void StartApplication() override
Application specific startup code.
TracedCallback< const PingReport & > m_reportTrace
TracedCallback for final ping report.
void StopApplication() override
Application specific shutdown code.
DropReason
Reason why a ping was dropped.
@ DROP_TIMEOUT
Response timed out.
@ DROP_NET_UNREACHABLE
Received ICMP Destination Network Unreachable.
@ DROP_HOST_UNREACHABLE
Received ICMP Destination Host Unreachable.
Average< double > m_avgRtt
Average rtt is ms.
void PrintReport()
Print the report.
Time m_interval
Wait interval between ECHO requests.
static TypeId GetTypeId()
Get the type ID.
bool m_multipleDestinations
Destination is Broadcast or Multicast.
uint16_t m_seq
ICMP ECHO sequence number.
uint32_t m_duplicate
Duplicate packets counter.
Address m_interfaceAddress
Sender Local Address.
void Receive(Ptr< Socket > socket)
Receive an ICMPv4 or an ICMPv6 Echo reply.
uint8_t m_tos
The Type of Service carried by ICMP ECHOs.
void Write64(uint8_t *buffer, const uint64_t data)
Writes data to buffer in little-endian format.
Address m_destination
Remote address.
EventId m_next
Next packet will be sent.
Ptr< Socket > m_socket
The socket we send packets from.
VerboseMode m_verbose
Variable to stor verbose mode.
TracedCallback< uint16_t, DropReason > m_dropTrace
TracedCallback for drop events.
Time m_timeout
Time to wait for a response, in seconds.
void(* ReportTrace)(const PingReport &report)
TracedCallback signature for Report trace.
TracedCallback< uint16_t, Time > m_rttTrace
TracedCallback for RTT samples.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A ping report provides all of the data that is typically output to the terminal when the application ...
Time m_duration
Duration of the application.
uint16_t m_loss
Percentage of lost packets (decimal value 0-100)
double m_rttAvg
rtt avg value
double m_rttMdev
rtt mdev value
uint32_t m_received
Number of echo replies received.
double m_rttMin
rtt min value
uint32_t m_transmitted
Number of echo requests sent.
double m_rttMax
rtt max value