/usr/include/ns3.26/ns3/udp-echo-client.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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright 2007 University of Washington
*
* 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 UDP_ECHO_CLIENT_H
#define UDP_ECHO_CLIENT_H
#include "ns3/application.h"
#include "ns3/event-id.h"
#include "ns3/ptr.h"
#include "ns3/ipv4-address.h"
#include "ns3/traced-callback.h"
namespace ns3 {
class Socket;
class Packet;
/**
* \ingroup udpecho
* \brief A Udp Echo client
*
* Every packet sent should be returned by the server and received here.
*/
class UdpEchoClient : public Application
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
UdpEchoClient ();
virtual ~UdpEchoClient ();
/**
* \brief set the remote address and port
* \param ip remote IP address
* \param port remote port
*/
void SetRemote (Address ip, uint16_t port);
/**
* \brief set the remote address
* \param addr remote address
*/
void SetRemote (Address addr);
/**
* Set the data size of the packet (the number of bytes that are sent as data
* to the server). The contents of the data are set to unspecified (don't
* care) by this call.
*
* \warning If you have set the fill data for the echo client using one of the
* SetFill calls, this will undo those effects.
*
* \param dataSize The size of the echo data you want to sent.
*/
void SetDataSize (uint32_t dataSize);
/**
* Get the number of data bytes that will be sent to the server.
*
* \warning The number of bytes may be modified by calling any one of the
* SetFill methods. If you have called SetFill, then the number of
* data bytes will correspond to the size of an initialized data buffer.
* If you have not called a SetFill method, the number of data bytes will
* correspond to the number of don't care bytes that will be sent.
*
* \returns The number of data bytes.
*/
uint32_t GetDataSize (void) const;
/**
* Set the data fill of the packet (what is sent as data to the server) to
* the zero-terminated contents of the fill string string.
*
* \warning The size of resulting echo packets will be automatically adjusted
* to reflect the size of the fill string -- this means that the PacketSize
* attribute may be changed as a result of this call.
*
* \param fill The string to use as the actual echo data bytes.
*/
void SetFill (std::string fill);
/**
* Set the data fill of the packet (what is sent as data to the server) to
* the repeated contents of the fill byte. i.e., the fill byte will be
* used to initialize the contents of the data packet.
*
* \warning The size of resulting echo packets will be automatically adjusted
* to reflect the dataSize parameter -- this means that the PacketSize
* attribute may be changed as a result of this call.
*
* \param fill The byte to be repeated in constructing the packet data..
* \param dataSize The desired size of the resulting echo packet data.
*/
void SetFill (uint8_t fill, uint32_t dataSize);
/**
* Set the data fill of the packet (what is sent as data to the server) to
* the contents of the fill buffer, repeated as many times as is required.
*
* Initializing the packet to the contents of a provided single buffer is
* accomplished by setting the fillSize set to your desired dataSize
* (and providing an appropriate buffer).
*
* \warning The size of resulting echo packets will be automatically adjusted
* to reflect the dataSize parameter -- this means that the PacketSize
* attribute of the Application may be changed as a result of this call.
*
* \param fill The fill pattern to use when constructing packets.
* \param fillSize The number of bytes in the provided fill pattern.
* \param dataSize The desired size of the final echo data.
*/
void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize);
protected:
virtual void DoDispose (void);
private:
virtual void StartApplication (void);
virtual void StopApplication (void);
/**
* \brief Schedule the next packet transmission
* \param dt time interval between packets.
*/
void ScheduleTransmit (Time dt);
/**
* \brief Send a packet
*/
void Send (void);
/**
* \brief Handle a packet reception.
*
* This function is called by lower layers.
*
* \param socket the socket the packet was received to.
*/
void HandleRead (Ptr<Socket> socket);
uint32_t m_count; //!< Maximum number of packets the application will send
Time m_interval; //!< Packet inter-send time
uint32_t m_size; //!< Size of the sent packet
uint32_t m_dataSize; //!< packet payload size (must be equal to m_size)
uint8_t *m_data; //!< packet payload data
uint32_t m_sent; //!< Counter for sent packets
Ptr<Socket> m_socket; //!< Socket
Address m_peerAddress; //!< Remote peer address
uint16_t m_peerPort; //!< Remote peer port
EventId m_sendEvent; //!< Event to send the next packet
/// Callbacks for tracing the packet Tx events
TracedCallback<Ptr<const Packet> > m_txTrace;
};
} // namespace ns3
#endif /* UDP_ECHO_CLIENT_H */
|