Bug 938 - missing Doxygen in ns-3 (applications model + helper)
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup bulksend
|
||||
* \brief A helper to make it easier to instantiate an ns3::BulkSendApplication
|
||||
* on a set of nodes.
|
||||
*/
|
||||
@@ -92,7 +93,6 @@ public:
|
||||
|
||||
private:
|
||||
/**
|
||||
* \internal
|
||||
* Install an ns3::BulkSendApplication on the node configured with all the
|
||||
* attributes set with SetAttribute.
|
||||
*
|
||||
@@ -100,9 +100,8 @@ private:
|
||||
* \returns Ptr to the application installed.
|
||||
*/
|
||||
Ptr<Application> InstallPriv (Ptr<Node> node) const;
|
||||
std::string m_protocol;
|
||||
Address m_remote;
|
||||
ObjectFactory m_factory;
|
||||
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace ns3 {
|
||||
class DataRate;
|
||||
|
||||
/**
|
||||
* \ingroup onoff
|
||||
* \brief A helper to make it easier to instantiate an ns3::OnOffApplication
|
||||
* on a set of nodes.
|
||||
*/
|
||||
@@ -114,7 +115,6 @@ public:
|
||||
|
||||
private:
|
||||
/**
|
||||
* \internal
|
||||
* Install an ns3::OnOffApplication on the node configured with all the
|
||||
* attributes set with SetAttribute.
|
||||
*
|
||||
@@ -122,9 +122,8 @@ private:
|
||||
* \returns Ptr to the application installed.
|
||||
*/
|
||||
Ptr<Application> InstallPriv (Ptr<Node> node) const;
|
||||
std::string m_protocol;
|
||||
Address m_remote;
|
||||
ObjectFactory m_factory;
|
||||
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup packetsink
|
||||
* \brief A helper to make it easier to instantiate an ns3::PacketSinkApplication
|
||||
* on a set of nodes.
|
||||
*/
|
||||
@@ -60,6 +61,7 @@ public:
|
||||
*
|
||||
* \param c NodeContainer of the set of nodes on which a PacketSinkApplication
|
||||
* will be installed.
|
||||
* \returns Container of Ptr to the applications installed.
|
||||
*/
|
||||
ApplicationContainer Install (NodeContainer c) const;
|
||||
|
||||
@@ -68,6 +70,7 @@ public:
|
||||
* configured with all the attributes set with SetAttribute.
|
||||
*
|
||||
* \param node The node on which a PacketSinkApplication will be installed.
|
||||
* \returns Container of Ptr to the applications installed.
|
||||
*/
|
||||
ApplicationContainer Install (Ptr<Node> node) const;
|
||||
|
||||
@@ -76,15 +79,20 @@ public:
|
||||
* configured with all the attributes set with SetAttribute.
|
||||
*
|
||||
* \param nodeName The name of the node on which a PacketSinkApplication will be installed.
|
||||
* \returns Container of Ptr to the applications installed.
|
||||
*/
|
||||
ApplicationContainer Install (std::string nodeName) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \internal
|
||||
* Install an ns3::PacketSink on the node configured with all the
|
||||
* attributes set with SetAttribute.
|
||||
*
|
||||
* \param node The node on which an PacketSink will be installed.
|
||||
* \returns Ptr to the application installed.
|
||||
*/
|
||||
Ptr<Application> InstallPriv (Ptr<Node> node) const;
|
||||
ObjectFactory m_factory;
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup ping6
|
||||
* \class Ping6Helper
|
||||
* \brief Ping6 application helper.
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \ingroup radvd
|
||||
* \class RadvdHelper
|
||||
* \brief Radvd application helper.
|
||||
*/
|
||||
@@ -69,9 +70,10 @@ public:
|
||||
void DisableDefaultRouterForInterface (uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Get the low-level radvdInterface specification for an interface.
|
||||
* \brief Get the low-level RadvdInterface specification for an interface.
|
||||
* This method is provided to enable fine-grain parameter setup.
|
||||
* \param interface outgoing interface
|
||||
* \returns the RadvdInterface
|
||||
*/
|
||||
Ptr<RadvdInterface> GetRadvdInterface (uint32_t interface);
|
||||
|
||||
@@ -100,10 +102,12 @@ private:
|
||||
*/
|
||||
ObjectFactory m_factory;
|
||||
|
||||
/// Container: interface index, RadvdInterface
|
||||
typedef std::map<uint32_t, Ptr<RadvdInterface> > RadvdInterfaceMap;
|
||||
/// Container Iterator: interface index, RadvdInterface
|
||||
typedef std::map<uint32_t, Ptr<RadvdInterface> >::iterator RadvdInterfaceMapI;
|
||||
|
||||
RadvdInterfaceMap m_radvdInterfaces;
|
||||
RadvdInterfaceMap m_radvdInterfaces; //!< RadvdInterface(s)
|
||||
};
|
||||
|
||||
} /* namespace ns3 */
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
#include "ns3/udp-client.h"
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \brief Create a server application which waits for input udp packets
|
||||
* \ingroup udpclientserver
|
||||
* \brief Create a server application which waits for input UDP packets
|
||||
* and uses the information carried into their payload to compute
|
||||
* delay and to determine if some packets are lost.
|
||||
*/
|
||||
@@ -60,7 +61,7 @@ public:
|
||||
void SetAttribute (std::string name, const AttributeValue &value);
|
||||
|
||||
/**
|
||||
* Create one udp server application on each of the Nodes in the
|
||||
* Create one UDP server application on each of the Nodes in the
|
||||
* NodeContainer.
|
||||
*
|
||||
* \param c The nodes on which to create the Applications. The nodes
|
||||
@@ -69,14 +70,23 @@ public:
|
||||
* NodeContainer.
|
||||
*/
|
||||
ApplicationContainer Install (NodeContainer c);
|
||||
|
||||
/**
|
||||
* \brief Return the last created server.
|
||||
*
|
||||
* This function is mainly used for testing.
|
||||
*
|
||||
* \returns a Ptr to the last created server application
|
||||
*/
|
||||
Ptr<UdpServer> GetServer (void);
|
||||
private:
|
||||
ObjectFactory m_factory;
|
||||
Ptr<UdpServer> m_server;
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
Ptr<UdpServer> m_server; //!< The last created server application
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Create a client application which sends udp packets carrying
|
||||
* \ingroup udpclientserver
|
||||
* \brief Create a client application which sends UDP packets carrying
|
||||
* a 32bit sequence number and a 64 bit time stamp.
|
||||
*
|
||||
*/
|
||||
@@ -95,12 +105,28 @@ public:
|
||||
* Create UdpClientHelper which will make life easier for people trying
|
||||
* to set up simulations with udp-client-server.
|
||||
*
|
||||
* \param ip The IP address of the remote udp server
|
||||
* \param port The port number of the remote udp server
|
||||
* \param ip The IPv4 address of the remote UDP server
|
||||
* \param port The port number of the remote UDP server
|
||||
*/
|
||||
|
||||
UdpClientHelper (Ipv4Address ip, uint16_t port);
|
||||
/**
|
||||
* Create UdpClientHelper which will make life easier for people trying
|
||||
* to set up simulations with udp-client-server.
|
||||
*
|
||||
* \param ip The IPv6 address of the remote UDP server
|
||||
* \param port The port number of the remote UDP server
|
||||
*/
|
||||
|
||||
UdpClientHelper (Ipv6Address ip, uint16_t port);
|
||||
/**
|
||||
* Create UdpClientHelper which will make life easier for people trying
|
||||
* to set up simulations with udp-client-server.
|
||||
*
|
||||
* \param ip The IP address of the remote UDP server
|
||||
* \param port The port number of the remote UDP server
|
||||
*/
|
||||
|
||||
UdpClientHelper (Address ip, uint16_t port);
|
||||
|
||||
/**
|
||||
@@ -114,25 +140,26 @@ public:
|
||||
/**
|
||||
* \param c the nodes
|
||||
*
|
||||
* Create one udp client application on each of the input nodes
|
||||
* Create one UDP client application on each of the input nodes
|
||||
*
|
||||
* \returns the applications created, one application per input node.
|
||||
*/
|
||||
ApplicationContainer Install (NodeContainer c);
|
||||
|
||||
private:
|
||||
ObjectFactory m_factory;
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
/**
|
||||
* Create udpTraceClient application which sends udp packets based on a trace
|
||||
* \ingroup udpclientserver
|
||||
* Create UdpTraceClient application which sends UDP packets based on a trace
|
||||
* file of an MPEG4 stream. Trace files could be downloaded form :
|
||||
* http://www.tkn.tu-berlin.de/research/trace/ltvt.html (the 2 first lines of
|
||||
* the file should be removed)
|
||||
* A valid trace file is a file with 4 columns:
|
||||
* -1- the first one represents the frame index
|
||||
* -2- the second one indicates the type of the frame: I, P or B
|
||||
* -3- the third one indicates the time on which the frame was generated by the encoder
|
||||
* -4- the fourth one indicates the frame size in byte
|
||||
* \li -1- the first one represents the frame index
|
||||
* \li -2- the second one indicates the type of the frame: I, P or B
|
||||
* \li -3- the third one indicates the time on which the frame was generated by the encoder
|
||||
* \li -4- the fourth one indicates the frame size in byte
|
||||
*/
|
||||
class UdpTraceClientHelper
|
||||
{
|
||||
@@ -148,12 +175,28 @@ public:
|
||||
* Create UdpTraceClientHelper which will make life easier for people trying
|
||||
* to set up simulations with udp-client-server.
|
||||
*
|
||||
* \param ip The IP address of the remote udp server
|
||||
* \param port The port number of the remote udp server
|
||||
* \param ip The IP address of the remote UDP server
|
||||
* \param port The port number of the remote UDP server
|
||||
* \param filename the file from which packet traces will be loaded
|
||||
*/
|
||||
UdpTraceClientHelper (Address ip, uint16_t port, std::string filename);
|
||||
/**
|
||||
* Create UdpTraceClientHelper which will make life easier for people trying
|
||||
* to set up simulations with udp-client-server.
|
||||
*
|
||||
* \param ip The IPv4 address of the remote UDP server
|
||||
* \param port The port number of the remote UDP server
|
||||
* \param filename the file from which packet traces will be loaded
|
||||
*/
|
||||
UdpTraceClientHelper (Ipv4Address ip, uint16_t port, std::string filename);
|
||||
/**
|
||||
* Create UdpTraceClientHelper which will make life easier for people trying
|
||||
* to set up simulations with udp-client-server.
|
||||
*
|
||||
* \param ip The IPv6 address of the remote UDP server
|
||||
* \param port The port number of the remote UDP server
|
||||
* \param filename the file from which packet traces will be loaded
|
||||
*/
|
||||
UdpTraceClientHelper (Ipv6Address ip, uint16_t port, std::string filename);
|
||||
|
||||
/**
|
||||
@@ -167,14 +210,14 @@ public:
|
||||
/**
|
||||
* \param c the nodes
|
||||
*
|
||||
* Create one udp trace client application on each of the input nodes
|
||||
* Create one UDP trace client application on each of the input nodes
|
||||
*
|
||||
* \returns the applications created, one application per input node.
|
||||
*/
|
||||
ApplicationContainer Install (NodeContainer c);
|
||||
|
||||
private:
|
||||
ObjectFactory m_factory;
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief Create a server application which waits for input udp packets
|
||||
* \ingroup udpecho
|
||||
* \brief Create a server application which waits for input UDP packets
|
||||
* and sends them back to the original sender.
|
||||
*/
|
||||
class UdpEchoServerHelper
|
||||
@@ -87,15 +88,20 @@ public:
|
||||
|
||||
private:
|
||||
/**
|
||||
* \internal
|
||||
* Install an ns3::UdpEchoServer on the node configured with all the
|
||||
* attributes set with SetAttribute.
|
||||
*
|
||||
* \param node The node on which an UdpEchoServer will be installed.
|
||||
* \returns Ptr to the application installed.
|
||||
*/
|
||||
Ptr<Application> InstallPriv (Ptr<Node> node) const;
|
||||
|
||||
ObjectFactory m_factory;
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief create an application which sends a udp packet and waits for an echo of this packet
|
||||
* \ingroup udpecho
|
||||
* \brief Create an application which sends a UDP packet and waits for an echo of this packet
|
||||
*/
|
||||
class UdpEchoClientHelper
|
||||
{
|
||||
@@ -108,7 +114,21 @@ public:
|
||||
* \param port The port number of the remote udp echo server
|
||||
*/
|
||||
UdpEchoClientHelper (Address ip, uint16_t port);
|
||||
/**
|
||||
* Create UdpEchoClientHelper which will make life easier for people trying
|
||||
* to set up simulations with echos.
|
||||
*
|
||||
* \param ip The IPv4 address of the remote udp echo server
|
||||
* \param port The port number of the remote udp echo server
|
||||
*/
|
||||
UdpEchoClientHelper (Ipv4Address ip, uint16_t port);
|
||||
/**
|
||||
* Create UdpEchoClientHelper which will make life easier for people trying
|
||||
* to set up simulations with echos.
|
||||
*
|
||||
* \param ip The IPv6 address of the remote udp echo server
|
||||
* \param port The port number of the remote udp echo server
|
||||
*/
|
||||
UdpEchoClientHelper (Ipv6Address ip, uint16_t port);
|
||||
|
||||
/**
|
||||
@@ -203,8 +223,15 @@ public:
|
||||
ApplicationContainer Install (NodeContainer c) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Install an ns3::UdpEchoClient on the node configured with all the
|
||||
* attributes set with SetAttribute.
|
||||
*
|
||||
* \param node The node on which an UdpEchoClient will be installed.
|
||||
* \returns Ptr to the application installed.
|
||||
*/
|
||||
Ptr<Application> InstallPriv (Ptr<Node> node) const;
|
||||
ObjectFactory m_factory;
|
||||
ObjectFactory m_factory; //!< Object factory.
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2008 INRIA
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#ifndef V4PING_HELPER_H
|
||||
#define V4PING_HELPER_H
|
||||
|
||||
@@ -8,7 +28,8 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief create a pinger application and associate it to a node
|
||||
* \ingroup v4ping
|
||||
* \brief Create a IPv5 ping application and associate it to a node
|
||||
*
|
||||
* This class creates one or multiple instances of ns3::V4Ping and associates
|
||||
* it/them to one/multiple node(s).
|
||||
@@ -25,33 +46,33 @@ public:
|
||||
V4PingHelper (Ipv4Address remote);
|
||||
|
||||
/**
|
||||
* Install a pinger application on each Node in the provided NodeContainer.
|
||||
* Install a Ping application on each Node in the provided NodeContainer.
|
||||
*
|
||||
* \param nodes The NodeContainer containing all of the nodes to get a V4Ping
|
||||
* application.
|
||||
*
|
||||
* \returns A list of pinger applications, one for each input node
|
||||
* \returns A list of Ping applications, one for each input node
|
||||
*/
|
||||
ApplicationContainer Install (NodeContainer nodes) const;
|
||||
|
||||
/**
|
||||
* Install a pinger application on the provided Node. The Node is specified
|
||||
* Install a Ping application on the provided Node. The Node is specified
|
||||
* directly by a Ptr<Node>
|
||||
*
|
||||
* \param node The node to install the V4PingApplication on.
|
||||
*
|
||||
* \returns An ApplicationContainer holding the pinger application created.
|
||||
* \returns An ApplicationContainer holding the Ping application created.
|
||||
*/
|
||||
ApplicationContainer Install (Ptr<Node> node) const;
|
||||
|
||||
/**
|
||||
* Install a pinger application on the provided Node. The Node is specified
|
||||
* Install a Ping application on the provided Node. The Node is specified
|
||||
* by a string that must have previously been associated with a Node using the
|
||||
* Object Name Service.
|
||||
*
|
||||
* \param nodeName The node to install the V4PingApplication on.
|
||||
*
|
||||
* \returns An ApplicationContainer holding the pinger application created.
|
||||
* \returns An ApplicationContainer holding the Ping application created.
|
||||
*/
|
||||
ApplicationContainer Install (std::string nodeName) const;
|
||||
|
||||
@@ -63,9 +84,12 @@ public:
|
||||
void SetAttribute (std::string name, const AttributeValue &value);
|
||||
private:
|
||||
/**
|
||||
* \internal
|
||||
* \brief Do the actual application installation in the node
|
||||
* \param node the node
|
||||
* \returns a Smart pointer to the installed application
|
||||
*/
|
||||
Ptr<Application> InstallPriv (Ptr<Node> node) const;
|
||||
/// Object factory
|
||||
ObjectFactory m_factory;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief Probe to translate from a TraceSource to two more easily parsed TraceSources.
|
||||
*
|
||||
* This class is designed to probe an underlying ns3 TraceSource
|
||||
* exporting a packet and a socket address. This probe exports a
|
||||
* trace source "Output" with arguments of type Ptr<const Packet> and
|
||||
@@ -49,6 +51,10 @@ namespace ns3 {
|
||||
class ApplicationPacketProbe : public Probe
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId ();
|
||||
ApplicationPacketProbe ();
|
||||
virtual ~ApplicationPacketProbe ();
|
||||
@@ -97,11 +103,12 @@ private:
|
||||
* \param packet the traced packet
|
||||
* \param address the socket address for the traced packet
|
||||
*
|
||||
* \internal
|
||||
*/
|
||||
void TraceSink (Ptr<const Packet> packet, const Address& address);
|
||||
|
||||
/// Output trace, packet and source address
|
||||
TracedCallback<Ptr<const Packet>, const Address&> m_output;
|
||||
/// Output trace, previous packet size and current packet size
|
||||
TracedCallback<uint32_t, uint32_t> m_outputBytes;
|
||||
|
||||
/// The traced packet.
|
||||
|
||||
@@ -38,8 +38,8 @@ class Socket;
|
||||
*
|
||||
* This traffic generator simply sends data
|
||||
* as fast as possible up to MaxBytes or until
|
||||
* the appplication is stopped if MaxBytes is
|
||||
* zero. Once the lower layer send buffer is
|
||||
* the application is stopped (if MaxBytes is
|
||||
* zero). Once the lower layer send buffer is
|
||||
* filled, it waits until space is free to
|
||||
* send more data, essentially keeping a
|
||||
* constant flow of data. Only SOCK_STREAM
|
||||
@@ -47,9 +47,31 @@ class Socket;
|
||||
* For example, TCP sockets can be used, but
|
||||
* UDP sockets can not be used.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \ingroup bulksend
|
||||
*
|
||||
* \brief Send as much traffic as possible, trying to fill the bandwidth.
|
||||
*
|
||||
* This traffic generator simply sends data
|
||||
* as fast as possible up to MaxBytes or until
|
||||
* the application is stopped (if MaxBytes is
|
||||
* zero). Once the lower layer send buffer is
|
||||
* filled, it waits until space is free to
|
||||
* send more data, essentially keeping a
|
||||
* constant flow of data. Only SOCK_STREAM
|
||||
* and SOCK_SEQPACKET sockets are supported.
|
||||
* For example, TCP sockets can be used, but
|
||||
* UDP sockets can not be used.
|
||||
*
|
||||
*/
|
||||
class BulkSendApplication : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
BulkSendApplication ();
|
||||
@@ -57,20 +79,22 @@ public:
|
||||
virtual ~BulkSendApplication ();
|
||||
|
||||
/**
|
||||
* \param maxBytes the upper bound of bytes to send
|
||||
* \brief Set the upper bound for the total number of bytes to send.
|
||||
*
|
||||
* Set the upper bound for the total number of bytes to send. Once
|
||||
* this bound is reached, no more application bytes are sent. If the
|
||||
* Once this bound is reached, no more application bytes are sent. If the
|
||||
* application is stopped during the simulation and restarted, the
|
||||
* total number of bytes sent is not reset; however, the maxBytes
|
||||
* bound is still effective and the application will continue sending
|
||||
* up to maxBytes. The value zero for maxBytes means that
|
||||
* there is no upper bound; i.e. data is sent until the application
|
||||
* or simulation is stopped.
|
||||
*
|
||||
* \param maxBytes the upper bound of bytes to send
|
||||
*/
|
||||
void SetMaxBytes (uint32_t maxBytes);
|
||||
|
||||
/**
|
||||
* \brief Get the socket this application is attached to.
|
||||
* \return pointer to associated socket
|
||||
*/
|
||||
Ptr<Socket> GetSocket (void) const;
|
||||
@@ -82,22 +106,37 @@ private:
|
||||
virtual void StartApplication (void); // Called at time specified by Start
|
||||
virtual void StopApplication (void); // Called at time specified by Stop
|
||||
|
||||
/**
|
||||
* \brief Send data until the L4 transmission buffer is full.
|
||||
*/
|
||||
void SendData ();
|
||||
|
||||
Ptr<Socket> m_socket; // Associated socket
|
||||
Address m_peer; // Peer address
|
||||
bool m_connected; // True if connected
|
||||
uint32_t m_sendSize; // Size of data to send each time
|
||||
uint32_t m_maxBytes; // Limit total number of bytes sent
|
||||
uint32_t m_totBytes; // Total bytes sent so far
|
||||
TypeId m_tid;
|
||||
Ptr<Socket> m_socket; //!< Associated socket
|
||||
Address m_peer; //!< Peer address
|
||||
bool m_connected; //!< True if connected
|
||||
uint32_t m_sendSize; //!< Size of data to send each time
|
||||
uint32_t m_maxBytes; //!< Limit total number of bytes sent
|
||||
uint32_t m_totBytes; //!< Total bytes sent so far
|
||||
TypeId m_tid; //!< The type of protocol to use.
|
||||
|
||||
/// Traced Callback: sent packets
|
||||
TracedCallback<Ptr<const Packet> > m_txTrace;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Connection Succeeded (called by Socket through a callback)
|
||||
* \param socket the connected socket
|
||||
*/
|
||||
void ConnectionSucceeded (Ptr<Socket> socket);
|
||||
/**
|
||||
* \brief Connection Failed (called by Socket through a callback)
|
||||
* \param socket the connected socket
|
||||
*/
|
||||
void ConnectionFailed (Ptr<Socket> socket);
|
||||
/**
|
||||
* \brief Send more data as soon as some has been transmitted.
|
||||
*/
|
||||
void DataSend (Ptr<Socket>, uint32_t); // for socket's SetSendCallback
|
||||
void Ignore (Ptr<Socket> socket);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -86,6 +86,10 @@ class Socket;
|
||||
class OnOffApplication : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
OnOffApplication ();
|
||||
@@ -93,23 +97,24 @@ public:
|
||||
virtual ~OnOffApplication();
|
||||
|
||||
/**
|
||||
* \param maxBytes the total number of bytes to send
|
||||
* \brief Set the total number of bytes to send.
|
||||
*
|
||||
* Set the total number of bytes to send. Once these bytes are sent, no packet
|
||||
* is sent again, even in on state. The value zero means that there is no
|
||||
* limit.
|
||||
* Once these bytes are sent, no packet is sent again, even in on state.
|
||||
* The value zero means that there is no limit.
|
||||
*
|
||||
* \param maxBytes the total number of bytes to send
|
||||
*/
|
||||
void SetMaxBytes (uint32_t maxBytes);
|
||||
|
||||
/**
|
||||
* \brief Return a pointer to associated socket.
|
||||
* \return pointer to associated socket
|
||||
*/
|
||||
Ptr<Socket> GetSocket (void) const;
|
||||
|
||||
/**
|
||||
* Assign a fixed random variable stream number to the random variables
|
||||
* used by this model. Return the number of streams (possibly zero) that
|
||||
* have been assigned.
|
||||
* \brief Assign a fixed random variable stream number to the random variables
|
||||
* used by this model.
|
||||
*
|
||||
* \param stream first stream index to use
|
||||
* \return the number of stream indices assigned by this model
|
||||
@@ -124,44 +129,67 @@ private:
|
||||
virtual void StopApplication (void); // Called at time specified by Stop
|
||||
|
||||
//helpers
|
||||
/**
|
||||
* \brief Cancel all pending events.
|
||||
*/
|
||||
void CancelEvents ();
|
||||
|
||||
void Construct (Ptr<Node> n,
|
||||
const Address &remote,
|
||||
std::string tid,
|
||||
const RandomVariable& ontime,
|
||||
const RandomVariable& offtime,
|
||||
uint32_t size);
|
||||
|
||||
|
||||
// Event handlers
|
||||
/**
|
||||
* \brief Start an On period
|
||||
*/
|
||||
void StartSending ();
|
||||
/**
|
||||
* \brief Start an Off period
|
||||
*/
|
||||
void StopSending ();
|
||||
/**
|
||||
* \brief Send a packet
|
||||
*/
|
||||
void SendPacket ();
|
||||
|
||||
Ptr<Socket> m_socket; // Associated socket
|
||||
Address m_peer; // Peer address
|
||||
bool m_connected; // True if connected
|
||||
Ptr<RandomVariableStream> m_onTime; // rng for On Time
|
||||
Ptr<RandomVariableStream> m_offTime; // rng for Off Time
|
||||
DataRate m_cbrRate; // Rate that data is generated
|
||||
DataRate m_cbrRateFailSafe; // Rate that data is generated (check copy)
|
||||
uint32_t m_pktSize; // Size of packets
|
||||
uint32_t m_residualBits; // Number of generated, but not sent, bits
|
||||
Time m_lastStartTime; // Time last packet sent
|
||||
uint32_t m_maxBytes; // Limit total number of bytes sent
|
||||
uint32_t m_totBytes; // Total bytes sent so far
|
||||
EventId m_startStopEvent; // Event id for next start or stop event
|
||||
EventId m_sendEvent; // Eventid of pending "send packet" event
|
||||
bool m_sending; // True if currently in sending state
|
||||
TypeId m_tid;
|
||||
Ptr<Socket> m_socket; //!< Associated socket
|
||||
Address m_peer; //!< Peer address
|
||||
bool m_connected; //!< True if connected
|
||||
Ptr<RandomVariableStream> m_onTime; //!< rng for On Time
|
||||
Ptr<RandomVariableStream> m_offTime; //!< rng for Off Time
|
||||
DataRate m_cbrRate; //!< Rate that data is generated
|
||||
DataRate m_cbrRateFailSafe; //!< Rate that data is generated (check copy)
|
||||
uint32_t m_pktSize; //!< Size of packets
|
||||
uint32_t m_residualBits; //!< Number of generated, but not sent, bits
|
||||
Time m_lastStartTime; //!< Time last packet sent
|
||||
uint32_t m_maxBytes; //!< Limit total number of bytes sent
|
||||
uint32_t m_totBytes; //!< Total bytes sent so far
|
||||
EventId m_startStopEvent; //!< Event id for next start or stop event
|
||||
EventId m_sendEvent; //!< Event id of pending "send packet" event
|
||||
bool m_sending; //!< True if currently in sending (On) state
|
||||
TypeId m_tid; //!< Type of the socket used
|
||||
|
||||
/// Traced Callback: transmitted packets.
|
||||
TracedCallback<Ptr<const Packet> > m_txTrace;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Schedule the next packet transmission
|
||||
*/
|
||||
void ScheduleNextTx ();
|
||||
/**
|
||||
* \brief Schedule the next On period start
|
||||
*/
|
||||
void ScheduleStartEvent ();
|
||||
/**
|
||||
* \brief Schedule the next Off period start
|
||||
*/
|
||||
void ScheduleStopEvent ();
|
||||
/**
|
||||
* \brief Handle a Connection Succeed event
|
||||
* \param socket the connected socket
|
||||
*/
|
||||
void ConnectionSucceeded (Ptr<Socket> socket);
|
||||
/**
|
||||
* \brief Handle a Connection Failed event
|
||||
* \param socket the not connected socket
|
||||
*/
|
||||
void ConnectionFailed (Ptr<Socket> socket);
|
||||
};
|
||||
|
||||
|
||||
@@ -33,23 +33,63 @@ namespace ns3 {
|
||||
class Socket;
|
||||
class Packet;
|
||||
|
||||
/**
|
||||
* \ingroup udpclientserver
|
||||
* \class PacketLossCounter
|
||||
* \brief A class to count the number of lost packets.
|
||||
*
|
||||
* This class records the packet lost in a client/server transmission
|
||||
* leveraging a sequence number. All the packets outside a given window
|
||||
* (i.e., too old wit respect to the last sequence number seen) are considered lost,
|
||||
*/
|
||||
class PacketLossCounter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor
|
||||
* \param bitmapSize The window size. Must be a multiple of 8.
|
||||
*/
|
||||
PacketLossCounter (uint8_t bitmapSize);
|
||||
~PacketLossCounter ();
|
||||
/**
|
||||
* \brief Record a successfully received packet
|
||||
* \param seq the packet sequence number
|
||||
*/
|
||||
void NotifyReceived (uint32_t seq);
|
||||
/**
|
||||
* \brief Get the number of lost packets.
|
||||
* \returns the number of lost packets.
|
||||
*/
|
||||
uint32_t GetLost (void) const;
|
||||
/**
|
||||
* \brief Return the size of the window used to compute the packet loss.
|
||||
* \return the window size.
|
||||
*/
|
||||
uint16_t GetBitMapSize (void) const;
|
||||
/**
|
||||
* \brief Set the size of the window used to compute the packet loss.
|
||||
*
|
||||
* \param size The window size. Must be a multiple of 8.
|
||||
*/
|
||||
void SetBitMapSize (uint16_t size);
|
||||
private:
|
||||
/**
|
||||
* \brief Check if a sequence number in the window has been received.
|
||||
* \param seqNum the sequence number.
|
||||
* \returns false if the packet has not been received.
|
||||
*/
|
||||
bool GetBit (uint32_t seqNum);
|
||||
/**
|
||||
* \brief Set a sequence number to a given state.
|
||||
* \param seqNum the sequence number.
|
||||
* \param val false if the packet has not been received.
|
||||
*/
|
||||
void SetBit (uint32_t seqNum, bool val);
|
||||
|
||||
uint32_t m_lost;
|
||||
uint16_t m_bitMapSize;
|
||||
uint32_t m_lastMaxSeqNum;
|
||||
uint8_t * m_receiveBitMap;
|
||||
uint32_t m_lost; //!< Lost packets counter.
|
||||
uint16_t m_bitMapSize; //!< Window size.
|
||||
uint32_t m_lastMaxSeqNum; //!< Last sequence number seen.
|
||||
uint8_t * m_receiveBitMap; //!< Received packets in the window size.
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -62,12 +62,16 @@ class Packet;
|
||||
* The constructor specifies the Address (IP address and port) and the
|
||||
* transport protocol to use. A virtual Receive () method is installed
|
||||
* as a callback on the receiving socket. By default, when logging is
|
||||
* enabled, it prints out the size of packets and their address, but
|
||||
* we intend to also add a tracing source to Receive() at a later date.
|
||||
* enabled, it prints out the size of packets and their address.
|
||||
* A tracing source to Receive() is also available.
|
||||
*/
|
||||
class PacketSink : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
PacketSink ();
|
||||
|
||||
@@ -95,19 +99,38 @@ private:
|
||||
virtual void StartApplication (void); // Called at time specified by Start
|
||||
virtual void StopApplication (void); // Called at time specified by Stop
|
||||
|
||||
void HandleRead (Ptr<Socket>);
|
||||
void HandleAccept (Ptr<Socket>, const Address& from);
|
||||
void HandlePeerClose (Ptr<Socket>);
|
||||
void HandlePeerError (Ptr<Socket>);
|
||||
/**
|
||||
* \brief Handle a packet received by the application
|
||||
* \param socket the receiving socket
|
||||
*/
|
||||
void HandleRead (Ptr<Socket> socket);
|
||||
/**
|
||||
* \brief Handle an incoming connection
|
||||
* \param socket the incoming connection socket
|
||||
* \param from the address the connection is from
|
||||
*/
|
||||
void HandleAccept (Ptr<Socket> socket, const Address& from);
|
||||
/**
|
||||
* \brief Handle an connection close
|
||||
* \param socket the connected socket
|
||||
*/
|
||||
void HandlePeerClose (Ptr<Socket> socket);
|
||||
/**
|
||||
* \brief Handle an connection error
|
||||
* \param socket the connected socket
|
||||
*/
|
||||
void HandlePeerError (Ptr<Socket> socket);
|
||||
|
||||
// In the case of TCP, each socket accept returns a new socket, so the
|
||||
// listening socket is stored seperately from the accepted sockets
|
||||
Ptr<Socket> m_socket; // Listening socket
|
||||
std::list<Ptr<Socket> > m_socketList; //the accepted sockets
|
||||
// listening socket is stored separately from the accepted sockets
|
||||
Ptr<Socket> m_socket; //!< Listening socket
|
||||
std::list<Ptr<Socket> > m_socketList; //!< the accepted sockets
|
||||
|
||||
Address m_local; // Local address to bind to
|
||||
uint32_t m_totalRx; // Total bytes received
|
||||
TypeId m_tid; // Protocol TypeId
|
||||
Address m_local; //!< Local address to bind to
|
||||
uint32_t m_totalRx; //!< Total bytes received
|
||||
TypeId m_tid; //!< Protocol TypeId
|
||||
|
||||
/// Traced Callback: received packets, source address.
|
||||
TracedCallback<Ptr<const Packet>, const Address &> m_rxTrace;
|
||||
|
||||
};
|
||||
|
||||
@@ -36,8 +36,11 @@ namespace ns3
|
||||
class RadvdInterface : public SimpleRefCount<RadvdInterface>
|
||||
{
|
||||
public:
|
||||
/// Container: Ptr to RadvdPrefix
|
||||
typedef std::list<Ptr<RadvdPrefix> > RadvdPrefixList;
|
||||
/// Container Iterator: Ptr to RadvdPrefix
|
||||
typedef std::list<Ptr<RadvdPrefix> >::iterator RadvdPrefixListI;
|
||||
/// Container Const Iterator: Ptr to RadvdPrefix
|
||||
typedef std::list<Ptr<RadvdPrefix> >::const_iterator RadvdPrefixListCI;
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,12 +91,18 @@ protected:
|
||||
virtual void DoDispose ();
|
||||
|
||||
private:
|
||||
/// Container: Ptr to RadvdInterface
|
||||
typedef std::list<Ptr<RadvdInterface> > RadvdInterfaceList;
|
||||
/// Container Iterator: Ptr to RadvdInterface
|
||||
typedef std::list<Ptr<RadvdInterface> >::iterator RadvdInterfaceListI;
|
||||
/// Container Const Iterator: Ptr to RadvdInterface
|
||||
typedef std::list<Ptr<RadvdInterface> >::const_iterator RadvdInterfaceListCI;
|
||||
|
||||
/// Container: interface number, EventId
|
||||
typedef std::map<uint32_t, EventId> EventIdMap;
|
||||
/// Container Iterator: interface number, EventId
|
||||
typedef std::map<uint32_t, EventId>::iterator EventIdMapI;
|
||||
/// Container Const Iterator: interface number, EventId
|
||||
typedef std::map<uint32_t, EventId>::const_iterator EventIdMapCI;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace ns3 {
|
||||
/**
|
||||
* \ingroup udpclientserver
|
||||
* \class SeqTsHeader
|
||||
* \brief Packet header for Udp client/server application
|
||||
* \brief Packet header for UDP client/server application.
|
||||
*
|
||||
* The header is made of a 32bits sequence number followed by
|
||||
* a 64bits time stamp.
|
||||
*/
|
||||
@@ -50,16 +51,21 @@ public:
|
||||
*/
|
||||
Time GetTs (void) const;
|
||||
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
private:
|
||||
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
uint32_t m_seq;
|
||||
uint64_t m_ts;
|
||||
private:
|
||||
uint32_t m_seq; //!< Sequence number
|
||||
uint64_t m_ts; //!< Timestamp
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -55,12 +55,11 @@ UdpClient::GetTypeId (void)
|
||||
"The time to wait between packets", TimeValue (Seconds (1.0)),
|
||||
MakeTimeAccessor (&UdpClient::m_interval),
|
||||
MakeTimeChecker ())
|
||||
.AddAttribute (
|
||||
"RemoteAddress",
|
||||
"The destination Address of the outbound packets",
|
||||
AddressValue (),
|
||||
MakeAddressAccessor (&UdpClient::m_peerAddress),
|
||||
MakeAddressChecker ())
|
||||
.AddAttribute ("RemoteAddress",
|
||||
"The destination Address of the outbound packets",
|
||||
AddressValue (),
|
||||
MakeAddressAccessor (&UdpClient::m_peerAddress),
|
||||
MakeAddressChecker ())
|
||||
.AddAttribute ("RemotePort", "The destination port of the outbound packets",
|
||||
UintegerValue (100),
|
||||
MakeUintegerAccessor (&UdpClient::m_peerPort),
|
||||
|
||||
@@ -43,8 +43,11 @@ class Packet;
|
||||
class UdpClient : public Application
|
||||
{
|
||||
public:
|
||||
static TypeId
|
||||
GetTypeId (void);
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
UdpClient ();
|
||||
|
||||
@@ -52,11 +55,21 @@ public:
|
||||
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IP address
|
||||
* \param ip remote IPv4 address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Ipv4Address ip, uint16_t port);
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IPv6 address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Ipv6Address ip, uint16_t port);
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IP address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Address ip, uint16_t port);
|
||||
|
||||
protected:
|
||||
@@ -67,18 +80,20 @@ private:
|
||||
virtual void StartApplication (void);
|
||||
virtual void StopApplication (void);
|
||||
|
||||
void ScheduleTransmit (Time dt);
|
||||
/**
|
||||
* \brief Send a packet
|
||||
*/
|
||||
void Send (void);
|
||||
|
||||
uint32_t m_count;
|
||||
Time m_interval;
|
||||
uint32_t m_size;
|
||||
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 (including the SeqTsHeader)
|
||||
|
||||
uint32_t m_sent;
|
||||
Ptr<Socket> m_socket;
|
||||
Address m_peerAddress;
|
||||
uint16_t m_peerPort;
|
||||
EventId m_sendEvent;
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -298,9 +298,9 @@ UdpEchoClient::Send (void)
|
||||
else
|
||||
{
|
||||
//
|
||||
// If m_dataSize is zero, the client has indicated that she doesn't care
|
||||
// If m_dataSize is zero, the client has indicated that it doesn't care
|
||||
// about the data itself either by specifying the data size by setting
|
||||
// the corresponding atribute or by not calling a SetFill function. In
|
||||
// the corresponding attribute or by not calling a SetFill function. In
|
||||
// this case, we don't worry about it either. But we do allow m_size
|
||||
// to have a value different from the (zero) m_dataSize.
|
||||
//
|
||||
|
||||
@@ -39,6 +39,10 @@ class Packet;
|
||||
class UdpEchoClient : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
UdpEchoClient ();
|
||||
@@ -46,12 +50,23 @@ public:
|
||||
virtual ~UdpEchoClient ();
|
||||
|
||||
/**
|
||||
* \param ip destination ipv4 address
|
||||
* \param port destination port
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IPv4 address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Ipv4Address ip, uint16_t port);
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IPv6 address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Ipv6Address ip, uint16_t port);
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IP address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Address ip, uint16_t port);
|
||||
void SetRemote (Ipv4Address ip, uint16_t port);
|
||||
void SetRemote (Ipv6Address ip, uint16_t port);
|
||||
|
||||
/**
|
||||
* Set the data size of the packet (the number of bytes that are sent as data
|
||||
@@ -130,23 +145,38 @@ 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;
|
||||
Time m_interval;
|
||||
uint32_t m_size;
|
||||
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;
|
||||
uint8_t *m_data;
|
||||
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
|
||||
|
||||
uint32_t m_sent;
|
||||
Ptr<Socket> m_socket;
|
||||
Address m_peerAddress;
|
||||
uint16_t m_peerPort;
|
||||
EventId m_sendEvent;
|
||||
/// Callbacks for tracing the packet Tx events
|
||||
TracedCallback<Ptr<const Packet> > m_txTrace;
|
||||
};
|
||||
|
||||
@@ -43,6 +43,10 @@ class Packet;
|
||||
class UdpEchoServer : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
UdpEchoServer ();
|
||||
virtual ~UdpEchoServer ();
|
||||
@@ -55,12 +59,19 @@ private:
|
||||
virtual void StartApplication (void);
|
||||
virtual void StopApplication (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);
|
||||
|
||||
uint16_t m_port;
|
||||
Ptr<Socket> m_socket;
|
||||
Ptr<Socket> m_socket6;
|
||||
Address m_local;
|
||||
uint16_t m_port; //!< Port on which we listen for incoming packets.
|
||||
Ptr<Socket> m_socket; //!< IPv4 Socket
|
||||
Ptr<Socket> m_socket6; //!< IPv6 Socket
|
||||
Address m_local; //!< local multicast address
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -37,30 +37,36 @@ namespace ns3 {
|
||||
/**
|
||||
* \ingroup udpclientserver
|
||||
* \class UdpServer
|
||||
* \brief A Udp server. Receives UDP packets from a remote host. UDP packets
|
||||
* carry a 32bits sequence number followed by a 64bits time stamp in their
|
||||
* payloads. The application uses, the sequence number to determine if a packet
|
||||
* is lost, and the time stamp to compute the delay
|
||||
* \brief A UDP server, receives UDP packets from a remote host.
|
||||
*
|
||||
* UDP packets carry a 32bits sequence number followed by a 64bits time
|
||||
* stamp in their payloads. The application uses the sequence number
|
||||
* to determine if a packet is lost, and the time stamp to compute the delay.
|
||||
*/
|
||||
class UdpServer : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
UdpServer ();
|
||||
virtual ~UdpServer ();
|
||||
/**
|
||||
* returns the number of lost packets
|
||||
* \brief Returns the number of lost packets
|
||||
* \return the number of lost packets
|
||||
*/
|
||||
uint32_t GetLost (void) const;
|
||||
|
||||
/**
|
||||
* \brief returns the number of received packets
|
||||
* \brief Returns the number of received packets
|
||||
* \return the number of received packets
|
||||
*/
|
||||
uint32_t GetReceived (void) const;
|
||||
|
||||
/**
|
||||
* \brief Returns the size of the window used for checking loss.
|
||||
* \return the size of the window used for checking loss.
|
||||
*/
|
||||
uint16_t GetPacketWindowSize () const;
|
||||
@@ -80,14 +86,20 @@ private:
|
||||
virtual void StartApplication (void);
|
||||
virtual void StopApplication (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);
|
||||
|
||||
uint16_t m_port;
|
||||
Ptr<Socket> m_socket;
|
||||
Ptr<Socket> m_socket6;
|
||||
Address m_local;
|
||||
uint32_t m_received;
|
||||
PacketLossCounter m_lossCounter;
|
||||
uint16_t m_port; //!< Port on which we listen for incoming packets.
|
||||
Ptr<Socket> m_socket; //!< IPv4 Socket
|
||||
Ptr<Socket> m_socket6; //!< IPv6 Socket
|
||||
uint32_t m_received; //!< Number of received packets
|
||||
PacketLossCounter m_lossCounter; //!< Lost packet counter
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -42,6 +42,9 @@ NS_LOG_COMPONENT_DEFINE ("UdpTraceClient")
|
||||
NS_OBJECT_ENSURE_REGISTERED (UdpTraceClient)
|
||||
;
|
||||
|
||||
/**
|
||||
* \brief Default trace to send
|
||||
*/
|
||||
struct UdpTraceClient::TraceEntry UdpTraceClient::g_defaultEntries[] = {
|
||||
{ 0, 534, 'I'},
|
||||
{ 40, 1542, 'P'},
|
||||
@@ -72,7 +75,7 @@ UdpTraceClient::GetTypeId (void)
|
||||
MakeUintegerAccessor (&UdpTraceClient::m_peerPort),
|
||||
MakeUintegerChecker<uint16_t> ())
|
||||
.AddAttribute ("MaxPacketSize",
|
||||
"The maximum size of a packet.",
|
||||
"The maximum size of a packet (including the SeqTsHeader, 12 bytes).",
|
||||
UintegerValue (1024),
|
||||
MakeUintegerAccessor (&UdpTraceClient::m_maxPacketSize),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
|
||||
@@ -38,30 +38,32 @@ class Packet;
|
||||
* \class UdpTraceClient
|
||||
* \brief A trace based streamer
|
||||
*
|
||||
* sends udp packets based on a trace file of an MPEG4 stream
|
||||
* trace files could be downloaded form :
|
||||
* Sends UDP packets based on a trace file of an MPEG4 stream
|
||||
* trace files could be downloaded form:
|
||||
* http://www.tkn.tu-berlin.de/research/trace/ltvt.html (the 2 first lines of
|
||||
* the file should be removed)
|
||||
* A valid trace file is a file with 4 columns:
|
||||
* -1- the first one represents the frame index
|
||||
* -2- the second one indicates the type of the frame: I, P or B
|
||||
* -3- the third one indicates the time on which the frame was generated by the encoder
|
||||
* -4- the fourth one indicates the frame size in byte
|
||||
* if no valid MPEG4 trace file is provided to the application the trace from
|
||||
* \li -1- the first one represents the frame index
|
||||
* \li -2- the second one indicates the type of the frame: I, P or B
|
||||
* \li -3- the third one indicates the time on which the frame was generated by the encoder
|
||||
* \li -4- the fourth one indicates the frame size in byte
|
||||
*
|
||||
* If no valid MPEG4 trace file is provided to the application the trace from
|
||||
* g_defaultEntries array will be loaded.
|
||||
*/
|
||||
class UdpTraceClient : public Application
|
||||
{
|
||||
public:
|
||||
static TypeId
|
||||
GetTypeId (void);
|
||||
/**
|
||||
* \brief creates a traceBasedStreamer application
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
UdpTraceClient ();
|
||||
|
||||
/**
|
||||
* \brief creates a traceBasedStreamer application
|
||||
* \brief Creates a traceBasedStreamer application
|
||||
* \param ip the destination ip address to which the stream will be sent
|
||||
* \param port the destination udp port to which the stream will be sent
|
||||
* \param traceFile a path to an MPEG4 trace file formatted as follows:
|
||||
@@ -71,21 +73,30 @@ public:
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
UdpTraceClient (Ipv4Address ip, uint16_t port, char *traceFile);
|
||||
~UdpTraceClient ();
|
||||
|
||||
/**
|
||||
* \brief set the destination IP address and port
|
||||
* \param ip the destination ip address to which the stream will be sent
|
||||
* \param port the destination udp port to which the stream will be sent
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IPv4 address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Ipv4Address ip, uint16_t port);
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IPv6 address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Ipv6Address ip, uint16_t port);
|
||||
/**
|
||||
* \brief set the remote address and port
|
||||
* \param ip remote IP address
|
||||
* \param port remote port
|
||||
*/
|
||||
void SetRemote (Address ip, uint16_t port);
|
||||
void SetRemote (Ipv4Address ip, uint16_t port);
|
||||
void SetRemote (Ipv6Address ip, uint16_t port);
|
||||
|
||||
/**
|
||||
* \brief set the trace file to be used by the application
|
||||
* \brief Set the trace file to be used by the application
|
||||
* \param filename a path to an MPEG4 trace file formatted as follows:
|
||||
* Frame No Frametype Time[ms] Length [byte]
|
||||
* Frame No Frametype Time[ms] Length [byte]
|
||||
@@ -94,11 +105,13 @@ public:
|
||||
void SetTraceFile (std::string filename);
|
||||
|
||||
/**
|
||||
* \brief Return the maximum packet size
|
||||
* \return the maximum packet size
|
||||
*/
|
||||
uint16_t GetMaxPacketSize (void);
|
||||
|
||||
/**
|
||||
* \brief Set the maximum packet size
|
||||
* \param maxPacketSize The maximum packet size
|
||||
*/
|
||||
void SetMaxPacketSize (uint16_t maxPacketSize);
|
||||
@@ -107,30 +120,50 @@ protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Load a trace file
|
||||
* \param filename the trace file path
|
||||
*/
|
||||
void LoadTrace (std::string filename);
|
||||
/**
|
||||
* \brief Load the default trace
|
||||
*/
|
||||
void LoadDefaultTrace (void);
|
||||
virtual void StartApplication (void);
|
||||
virtual void StopApplication (void);
|
||||
void ScheduleTransmit (Time dt);
|
||||
|
||||
/**
|
||||
* \brief Send a packet
|
||||
*/
|
||||
void Send (void);
|
||||
/**
|
||||
* \brief Send a packet of a given size
|
||||
* \param size the packet size
|
||||
*/
|
||||
void SendPacket (uint32_t size);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Entry to send.
|
||||
*
|
||||
* Each entry represents an MPEG frame
|
||||
*/
|
||||
struct TraceEntry
|
||||
{
|
||||
uint32_t timeToSend;
|
||||
uint16_t packetSize;
|
||||
char frameType;
|
||||
uint32_t timeToSend; //!< Time to send the frame
|
||||
uint16_t packetSize; //!< Size of the frame
|
||||
char frameType; //!< Frame type (I, P or B)
|
||||
};
|
||||
uint32_t m_sent;
|
||||
Ptr<Socket> m_socket;
|
||||
Address m_peerAddress;
|
||||
uint16_t m_peerPort;
|
||||
EventId m_sendEvent;
|
||||
std::vector<struct TraceEntry> m_entries;
|
||||
uint32_t m_currentEntry;
|
||||
static struct TraceEntry g_defaultEntries[];
|
||||
uint16_t m_maxPacketSize;
|
||||
|
||||
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
|
||||
|
||||
std::vector<struct TraceEntry> m_entries; //!< Entries in the trace to send
|
||||
uint32_t m_currentEntry; //!< Current entry index
|
||||
static struct TraceEntry g_defaultEntries[]; //!< Default trace to send
|
||||
uint16_t m_maxPacketSize; //!< Maximum packet size to send (including the SeqTsHeader)
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "v4ping.h"
|
||||
#include "ns3/icmpv4.h"
|
||||
#include "ns3/assert.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* 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
|
||||
|
||||
@@ -28,6 +29,12 @@ namespace ns3 {
|
||||
class Socket;
|
||||
|
||||
/**
|
||||
* \ingroup applications
|
||||
* \defgroup v4ping V4Ping
|
||||
*/
|
||||
|
||||
/**
|
||||
* \ingroup v4ping
|
||||
* \brief an application which sends one ICMP ECHO request, waits for a REPLYs
|
||||
* and reports the calculated RTT.
|
||||
*
|
||||
@@ -36,6 +43,10 @@ class Socket;
|
||||
class V4Ping : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
/**
|
||||
@@ -45,15 +56,42 @@ public:
|
||||
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
|
||||
@@ -65,8 +103,11 @@ private:
|
||||
* 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;
|
||||
|
||||
Reference in New Issue
Block a user