This commit is contained in:
Pavel Boyko
2009-10-01 13:59:43 +04:00
4 changed files with 104 additions and 8 deletions

View File

@@ -9,11 +9,20 @@ namespace ns3 {
class Socket;
/**
* \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:
static TypeId GetTypeId (void);
/**
* create a pinger applications
*/
V4Ping ();
virtual ~V4Ping ();

View File

@@ -28,15 +28,49 @@
namespace ns3 {
/**
* \brief create a server application which waits for input udp packets
* and sends them back to the original sender.
*/
class UdpEchoServerHelper
{
public:
/**
* \param port the port the server will wait on for incoming packets
*/
UdpEchoServerHelper (uint16_t port);
/**
* \param name the name of the attribute to set
* \param value the value of the attribute to set
*
* Record an attribute to be set after the server application is created.
*/
void SetAttribute (std::string name, const AttributeValue &value);
/**
* \param node the node
*
* Create a udp echo server application on the input node
*
* \returns the application created
*/
ApplicationContainer Install (Ptr<Node> node) const;
/**
* \param nodeName the node
*
* Create a udp echo server application on the input node
*
* \returns the application created
*/
ApplicationContainer Install (std::string nodeName) const;
/**
* \param c the nodes
*
* Create one udp echo server application on each of the input nodes
*
* \returns the applications created, one application per input node.
*/
ApplicationContainer Install (NodeContainer c) const;
private:
@@ -45,11 +79,24 @@ private:
ObjectFactory m_factory;
};
/**
* \brief create an application which sends a udp packet and waits for an echo of this packet
*/
class UdpEchoClientHelper
{
public:
/**
* \param ip ip address of the remote udp echo server
* \param port port number of the remote udp echo server
*/
UdpEchoClientHelper (Ipv4Address ip, uint16_t port);
/**
* \param name the name of the attribute to set
* \param value the value of the attribute to set
*
* Record an attribute to be set after the client application is created.
*/
void SetAttribute (std::string name, const AttributeValue &value);
/**
@@ -103,8 +150,29 @@ public:
*/
void SetFill (Ptr<Application> app, uint8_t *fill, uint32_t fillLength, uint32_t dataLength);
/**
* \param node the node
*
* Create a udp echo client application on the input node
*
* \returns the application created
*/
ApplicationContainer Install (Ptr<Node> node) const;
/**
* \param nodeName the node
*
* Create a udp echo client application on the input node
*
* \returns the application created
*/
ApplicationContainer Install (std::string nodeName) const;
/**
* \param c the nodes
*
* Create one udp echo client application on each of the input nodes
*
* \returns the applications created, one application per input node.
*/
ApplicationContainer Install (NodeContainer c) const;
private:

View File

@@ -30,12 +30,6 @@ V4PingHelper::V4PingHelper (Ipv4Address remote)
m_factory.Set ("Remote", Ipv4AddressValue (remote));
}
void
V4PingHelper::SetAttribute (std::string name, const AttributeValue &value)
{
m_factory.Set (name, value);
}
ApplicationContainer
V4PingHelper::Install (Ptr<Node> node) const
{

View File

@@ -7,15 +7,40 @@
namespace ns3 {
/**
* \brief create a pinger 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).
*/
class V4PingHelper
{
public:
/**
* \param remote the address which should be pinged
*/
V4PingHelper (Ipv4Address remote);
void SetAttribute (std::string name, const AttributeValue &value);
/**
* \param nodes the list of nodes.
*
* Install a pinger application on each node in the input list of nodes.
* \returns a list of pinger applications, one for each input node
*/
ApplicationContainer Install (NodeContainer nodes) const;
/**
* \param node the node
*
* Install a pinger application on the input node
* \returns the pinger application created.
*/
ApplicationContainer Install (Ptr<Node> node) const;
/**
* \param nodeName the node
*
* Install a pinger application on the input node
* \returns the pinger application created.
*/
ApplicationContainer Install (std::string nodeName) const;
private: