View | Details | Raw Unified | Return to bug 454
Collapse All | Expand All

(-)ns-3-dev/examples/tcp/tcp-echo-example.cc (+127 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * This program is free software; you can redistribute it and/or modify
4
 * it under the terms of the GNU General Public License version 2 as
5
 * published by the Free Software Foundation;
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
 */
16
17
#include <iostream>
18
#include <fstream>
19
20
#include "ns3/core-module.h"
21
#include "ns3/network-module.h"
22
#include "ns3/internet-module.h"
23
#include "ns3/point-to-point-module.h"
24
#include "ns3/applications-module.h"
25
26
using namespace ns3;
27
28
NS_LOG_COMPONENT_DEFINE ("TcpEchoExample");
29
30
// ===========================================================================
31
//
32
//         node 0                 node 1
33
//   +----------------+    +----------------+
34
//   |    ns-3 TCP    |    |    ns-3 TCP    |
35
//   +----------------+    +----------------+
36
//   |    10.1.1.1    |    |    10.1.1.2    |
37
//   +----------------+    +----------------+
38
//   | point-to-point |    | point-to-point |
39
//   +----------------+    +----------------+
40
//           |                     |
41
//           +---------------------+
42
//                100 Mbps, 1 ms
43
//
44
// This is a simple test of TCP connection. We create two nodes,
45
// one will be a TCP client echo and other the TCP server echo, 
46
// the nodes transmit data in the simple point-to-point channel. 
47
// In this scenario the node 0 (client) send one packet TCP to 
48
// the node 1 (server), then server receive this packet, return 
49
// this back to the node 0 (client) and finish TCP connection.
50
//
51
// ===========================================================================
52
//
53
54
int
55
main (int argc, char *argv[])
56
{
57
  
58
  //
59
  // The three lines below enable debugging mode. Comment these three lines for disable.
60
  //
61
  LogComponentEnable ("TcpEchoExample", LOG_LEVEL_INFO);
62
  LogComponentEnable ("TcpEchoClientApplication", LOG_LEVEL_INFO);
63
  LogComponentEnable ("TcpEchoServerApplication", LOG_LEVEL_INFO);
64
65
  
66
  //
67
  // Create two nodes required by the topology (point-to-point).
68
  //
69
  NS_LOG_INFO ("Create nodes.");
70
  NodeContainer nodes;
71
  nodes.Create (2);
72
73
  //
74
  // Create and configure channel for the communication.
75
  //
76
  NS_LOG_INFO("Create and configuring channels.");
77
  PointToPointHelper pointToPoint;
78
  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
79
  pointToPoint.SetChannelAttribute ("Delay", StringValue ("1ms"));
80
81
  NetDeviceContainer devices;
82
  devices = pointToPoint.Install (nodes);
83
84
  InternetStackHelper stack;
85
  stack.Install (nodes);
86
  
87
  //
88
  // Now, add IP address in the nodes.
89
  //
90
  NS_LOG_INFO("Assign IP Address.");
91
  Ipv4AddressHelper address;
92
  address.SetBase ("10.1.1.0", "255.255.255.252");
93
  Ipv4InterfaceContainer interfaces = address.Assign (devices);
94
  
95
  //
96
  // Create a TcpEchoServer on node 1.
97
  //
98
  NS_LOG_INFO("Create Server Application.");
99
  uint16_t port = 7; // well-known echo port number.
100
  TcpEchoServerHelper echoServer (port);
101
  ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
102
  serverApps.Start (Seconds (1.0));
103
  serverApps.Stop (Seconds (10.0));
104
  
105
  // Create a TcpEchoClient application to send TCP packet to server.
106
  NS_LOG_INFO("Create Client Application.");
107
  TcpEchoClientHelper echoClient (interfaces.GetAddress (1), 7);
108
  echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
109
  echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
110
  echoClient.SetAttribute ("PacketSize", UintegerValue (183));
111
  ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
112
  clientApps.Start (Seconds (2.0));
113
  clientApps.Stop (Seconds (10.0));
114
115
  //
116
  // Enable packet trace in pcap format and save on file tcp_echo_example.pcap.
117
  // Comment the two lines below to disable this.
118
  AsciiTraceHelper ascii;
119
  pointToPoint.EnablePcapAll("tcp_echo_example");
120
121
  // Start the simulation.
122
  NS_LOG_INFO("Start Simulation.");
123
  Simulator::Run ();
124
  Simulator::Destroy ();
125
  NS_LOG_INFO("Simulation finished.");
126
  return 0;
127
}
(-)ns-3-dev/examples/tcp/wscript (+4 lines)
 Lines 24-26   def build(bld): Link Here 
24
    obj = bld.create_ns3_program('tcp-bulk-send',
24
    obj = bld.create_ns3_program('tcp-bulk-send',
25
                                 ['point-to-point', 'applications', 'internet'])
25
                                 ['point-to-point', 'applications', 'internet'])
26
    obj.source = 'tcp-bulk-send.cc'
26
    obj.source = 'tcp-bulk-send.cc'
27
    
28
    obj = bld.create_ns3_program('tcp-echo-example', 
29
                                 ['point-to-point','applications'])
30
    obj.source = 'tcp-echo-example.cc'
(-)ns-3-dev/src/applications/helper/tcp-echo-helper.cc (+159 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License version 2 as
6
 * published by the Free Software Foundation;
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program; if not, write to the Free Software
15
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 *
17
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
 * Modified by Frank Helbert <frank@ime.usp.br>,
19
 * Luiz Arthur Feitosa dos Santos <luizsan@ime.usp.br> and
20
 * Rodrigo Campiolo <campiolo@ime.usp.br>
21
 */
22
23
#include "tcp-echo-helper.h"
24
#include "ns3/tcp-echo-server.h"
25
#include "ns3/tcp-echo-client.h"
26
#include "ns3/uinteger.h"
27
#include "ns3/names.h"
28
29
namespace ns3 {
30
31
  
32
TcpEchoServerHelper::TcpEchoServerHelper (uint16_t port)
33
{
34
  m_factory.SetTypeId (TcpEchoServer::GetTypeId ());
35
  SetAttribute ("Port", UintegerValue (port));
36
}
37
38
void
39
TcpEchoServerHelper::SetAttribute (
40
  std::string name,
41
  const AttributeValue &value)
42
{
43
  m_factory.Set (name, value);
44
}
45
46
ApplicationContainer
47
TcpEchoServerHelper::Install (Ptr<Node> node) const
48
{
49
  return ApplicationContainer (InstallPriv (node));
50
}
51
52
ApplicationContainer
53
TcpEchoServerHelper::Install (std::string nodeName) const
54
{
55
  Ptr<Node> node = Names::Find<Node> (nodeName);
56
  return ApplicationContainer (InstallPriv (node));
57
}
58
59
ApplicationContainer
60
TcpEchoServerHelper::Install (NodeContainer c) const
61
{
62
  ApplicationContainer apps;
63
  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
64
    {
65
      apps.Add (InstallPriv (*i));
66
    }
67
68
  return apps;
69
}
70
71
Ptr<Application>
72
TcpEchoServerHelper::InstallPriv (Ptr<Node> node) const
73
{
74
  Ptr<Application> app = m_factory.Create<TcpEchoServer> ();
75
  node->AddApplication (app);
76
77
  return app;
78
}
79
80
81
TcpEchoClientHelper::TcpEchoClientHelper (Ipv4Address address, uint16_t port)
82
{
83
  m_factory.SetTypeId (TcpEchoClient::GetTypeId ());
84
  SetAttribute ("RemoteAddress", Ipv4AddressValue (address));
85
  SetAttribute ("RemotePort", UintegerValue (port));
86
}
87
88
void
89
TcpEchoClientHelper::SetAttribute (
90
  std::string name,
91
  const AttributeValue &value)
92
{
93
  m_factory.Set (name, value);
94
}
95
96
void
97
TcpEchoClientHelper::SetFill (Ptr<Application> app, std::string fill)
98
{
99
  app->GetObject<TcpEchoClient>()->SetFill (fill);
100
}
101
102
void
103
TcpEchoClientHelper::SetFill (Ptr<Application> app, uint8_t fill, uint32_t dataLength)
104
{
105
  app->GetObject<TcpEchoClient>()->SetFill (fill, dataLength);
106
}
107
108
void
109
TcpEchoClientHelper::SetFill (Ptr<Application> app, uint8_t *fill, uint32_t fillLength, uint32_t dataLength)
110
{
111
  app->GetObject<TcpEchoClient>()->SetFill (fill, fillLength, dataLength);
112
}
113
114
ApplicationContainer
115
TcpEchoClientHelper::Install (Ptr<Node> node)
116
{
117
  return ApplicationContainer (InstallPriv (node));
118
}
119
120
ApplicationContainer
121
TcpEchoClientHelper::Install (std::string nodeName)
122
{
123
  Ptr<Node> node = Names::Find<Node> (nodeName);
124
  return ApplicationContainer (InstallPriv (node));
125
}
126
127
ApplicationContainer
128
TcpEchoClientHelper::Install (NodeContainer c)
129
{
130
  ApplicationContainer apps;
131
  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
132
    {
133
      Ptr<Node> node = *i;
134
135
      m_client = m_factory.Create<TcpEchoClient> ();
136
      node->AddApplication (m_client);
137
      apps.Add (m_client);
138
139
    }
140
141
  return apps;
142
}
143
144
Ptr<Application>
145
TcpEchoClientHelper::InstallPriv (Ptr<Node> node)
146
{
147
  m_client = m_factory.Create<TcpEchoClient> ();
148
  node->AddApplication (m_client);
149
150
  return m_client;
151
}
152
153
Ptr<TcpEchoClient>
154
TcpEchoClientHelper::GetClient (void)
155
{
156
  return m_client;
157
}
158
159
} // namespace ns3
(-)ns-3-dev/src/applications/helper/tcp-echo-helper.h (+217 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright (c) 2008 INRIA
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
 * Modified by Frank Helbert <frank@ime.usp.br>,
20
 * Luiz Arthur Feitosa dos Santos <luizsan@ime.usp.br> and
21
 * Rodrigo Campiolo <campiolo@ime.usp.br>
22
 */
23
#ifndef TCP_ECHO_HELPER
24
#define TCP_ECHO_HELPER
25
26
#include <stdint.h>
27
#include "ns3/application-container.h"
28
#include "ns3/node-container.h"
29
#include "ns3/object-factory.h"
30
#include "ns3/ipv4-address.h"
31
32
namespace ns3 {
33
34
class TcpEchoClient;
35
36
/**
37
 * \brief Create a server application which waits for TCP connections. 
38
 * This server receive TCP packets and send back to the client.
39
 * 
40
 */
41
42
class TcpEchoServerHelper
43
{
44
public:
45
  /**
46
   * Create TcpEchoServerHelper which will make life easier for people trying
47
   * to set up simulations with TCP echos.
48
   *
49
   * \param port The port the server will wait on for incoming packets
50
   */
51
  TcpEchoServerHelper (uint16_t port);
52
53
  /**
54
   * Record an attribute to be set in each Application after it is is created.
55
   *
56
   * \param name the name of the attribute to set
57
   * \param value the value of the attribute to set
58
   */
59
  void SetAttribute (std::string name, const AttributeValue &value);
60
61
  /**
62
   * Create a TcpEchoServerApplication on the specified Node.
63
   *
64
   * \param node The node on which to create the Application.  The node is
65
   *             specified by a Ptr<Node>.
66
   *
67
   * \returns An ApplicationContainer holding the Application created,
68
   */
69
  ApplicationContainer Install (Ptr<Node> node) const;
70
71
  /**
72
   * Create a TcpEchoServerApplication on specified node
73
   *
74
   * \param nodeName The node on which to create the application.  The node
75
   *                 is specified by a node name previously registered with
76
   *                 the Object Name Service.
77
   *
78
   * \returns An ApplicationContainer holding the Application created.
79
   */
80
  ApplicationContainer Install (std::string nodeName) const;
81
82
  /**
83
   * \param c The nodes on which to create the Applications.  The nodes
84
   *          are specified by a NodeContainer.
85
   *
86
   * Create one TCP echo server application on each of the Nodes in the
87
   * NodeContainer.
88
   *
89
   * \returns The applications created, one Application per Node in the
90
   *          NodeContainer.
91
   */
92
  ApplicationContainer Install (NodeContainer c) const;
93
94
private:
95
  /**
96
   * \internal
97
   */
98
  Ptr<Application> InstallPriv (Ptr<Node> node) const;
99
100
  ObjectFactory m_factory;
101
};
102
103
/**
104
 * \brief create an application which sends a TCP packet and waits for an echo of this packet
105
 */
106
class TcpEchoClientHelper
107
{
108
public:
109
  /**
110
   * Create TcpEchoClientHelper which will make life easier for people trying
111
   * to set up simulations with TCP echos.
112
   *
113
   * \param ip The IP address of the remote TCP echo server
114
   * \param port The port number of the remote TCP echo server
115
   */
116
  TcpEchoClientHelper (Ipv4Address ip, uint16_t port);
117
118
  /**
119
   * Record an attribute to be set in each Application after it is created.
120
   *
121
   * \param name the name of the attribute to set
122
   * \param value the value of the attribute to set
123
   */
124
  void SetAttribute (std::string name, const AttributeValue &value);
125
126
  /**
127
   * Given a pointer to a TcpEchoClient application, set the data fill of the TCP
128
   * packet (what is sent as data to the server) to the contents of the fill
129
   * string (including the trailing zero terminator).
130
   *
131
   * \warning The size of resulting echo packets will be automatically adjusted
132
   * to reflect the size of the fill string -- this means that the PacketSize
133
   * attribute may be changed as a result of this call.
134
   *
135
   * \param app Smart pointer to the application (real type must be TcpEchoClient).
136
   * \param fill The string to use as the actual echo data bytes.
137
   */
138
  void SetFill (Ptr<Application> app, std::string fill);
139
140
  /**
141
   * Given a pointer to a TcpEchoClient application, set the data fill of the
142
   * packet (what is sent as data to the server) to the contents of the fill
143
   * byte.
144
   *
145
   * The fill byte will be used to initialize the contents of the data packet.
146
   *
147
   * \warning The size of resulting echo packets will be automatically adjusted
148
   * to reflect the dataLength parameter -- this means that the PacketSize
149
   * attribute may be changed as a result of this call.
150
   *
151
   * \param app Smart pointer to the application (real type must be TcpEchoClient).
152
   * \param fill The byte to be repeated in constructing the packet data.
153
   * \param dataLength The desired length of the resulting echo packet data.
154
   */
155
  void SetFill (Ptr<Application> app, uint8_t fill, uint32_t dataLength);
156
157
  /**
158
   * Given a pointer to a TcpEchoClient application, set the data fill of the
159
   * packet (what is sent as data to the server) to the contents of the fill
160
   * buffer, repeated as many times as is required.
161
   *
162
   * Initializing the fill to the contents of a single buffer is accomplished
163
   * by providing a complete buffer with fillLength set to your desired
164
   * dataLength
165
   *
166
   * \warning The size of resulting echo packets will be automatically adjusted
167
   * to reflect the dataLength parameter -- this means that the PacketSize
168
   * attribute of the Application may be changed as a result of this call.
169
   *
170
   * \param app Smart pointer to the application (real type must be TcpEchoClient).
171
   * \param fill The fill pattern to use when constructing packets.
172
   * \param fillLength The number of bytes in the provided fill pattern.
173
   * \param dataLength The desired length of the final echo data.
174
   */
175
  void SetFill (Ptr<Application> app, uint8_t *fill, uint32_t fillLength, uint32_t dataLength);
176
177
  /**
178
   * Create a TCP echo client application on the specified node.  The Node
179
   * is provided as a Ptr<Node>.
180
   *
181
   * \param node The Ptr<Node> on which to create the TcpEchoClientApplication.
182
   *
183
   * \returns An ApplicationContainer that holds a Ptr<Application> to the
184
   *          application created
185
   */
186
  ApplicationContainer Install (Ptr<Node> node) ;
187
188
  /**
189
   * Create a TCP echo client application on the specified node.  The Node
190
   * is provided as a string name of a Node that has been previously
191
   * associated using the Object Name Service.
192
   *
193
   * \param nodeName The name of the node on which to create the TcpEchoClientApplication
194
   *
195
   * \returns An ApplicationContainer that holds a Ptr<Application> to the
196
   *          application created
197
   */
198
  ApplicationContainer Install (std::string nodeName) ;
199
200
  /**
201
   * \param c the nodes
202
   *
203
   * Create one TCP echo client application on each of the input nodes
204
   *
205
   * \returns the applications created, one application per input node.
206
   */
207
  ApplicationContainer Install (NodeContainer c);
208
  Ptr<TcpEchoClient> GetClient (void);
209
private:
210
  Ptr<Application> InstallPriv (Ptr<Node> node);
211
  ObjectFactory m_factory;
212
  Ptr<TcpEchoClient> m_client;
213
};
214
215
} // namespace ns3
216
217
#endif /* TCP_ECHO_HELPER */
(-)ns-3-dev/src/applications/model/tcp-echo-client.cc (+321 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright 2007 University of Washington
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 */
18
#include "ns3/log.h"
19
#include "ns3/ipv4-address.h"
20
#include "ns3/nstime.h"
21
#include "ns3/inet-socket-address.h"
22
#include "ns3/socket.h"
23
#include "ns3/simulator.h"
24
#include "ns3/socket-factory.h"
25
#include "ns3/packet.h"
26
#include "ns3/uinteger.h"
27
#include "ns3/trace-source-accessor.h"
28
#include "tcp-echo-client.h"
29
30
namespace ns3 {
31
32
NS_LOG_COMPONENT_DEFINE ("TcpEchoClientApplication");
33
NS_OBJECT_ENSURE_REGISTERED (TcpEchoClient);
34
35
TypeId
36
TcpEchoClient::GetTypeId (void)
37
{
38
  static TypeId tid = TypeId ("ns3::TcpEchoClient")
39
    .SetParent<Application> ()
40
    .AddConstructor<TcpEchoClient> ()
41
    .AddAttribute ("MaxPackets",
42
                   "The maximum number of packets the application will send",
43
                   UintegerValue (100),
44
                   MakeUintegerAccessor (&TcpEchoClient::m_count),
45
                   MakeUintegerChecker<uint32_t> ())
46
    .AddAttribute ("Interval",
47
                   "The time to wait between packets",
48
                   TimeValue (Seconds (1.0)),
49
                   MakeTimeAccessor (&TcpEchoClient::m_interval),
50
                   MakeTimeChecker ())
51
    .AddAttribute ("RemoteAddress",
52
                   "The destination Ipv4Address of the outbound packets",
53
                   Ipv4AddressValue (),
54
                   MakeIpv4AddressAccessor (&TcpEchoClient::m_peerAddress),
55
                   MakeIpv4AddressChecker ())
56
    .AddAttribute ("RemotePort",
57
                   "The destination port of the outbound packets",
58
                   UintegerValue (0),
59
                   MakeUintegerAccessor (&TcpEchoClient::m_peerPort),
60
                   MakeUintegerChecker<uint16_t> ())
61
    .AddAttribute ("PacketSize", "Size of echo data in outbound packets",
62
                   UintegerValue (100),
63
                   MakeUintegerAccessor (&TcpEchoClient::SetDataSize,
64
                                         &TcpEchoClient::GetDataSize),
65
                   MakeUintegerChecker<uint32_t> ())
66
    .AddTraceSource ("Tx", "A new packet is created and is sent",
67
                     MakeTraceSourceAccessor (&TcpEchoClient::m_txTrace))
68
  ;
69
  return tid;
70
}
71
72
TcpEchoClient::TcpEchoClient ()
73
{
74
  NS_LOG_FUNCTION_NOARGS ();
75
  m_sent = 0;
76
  m_bytesSent = 0;
77
  m_recvBack = 0;
78
  m_bytesRecvBack = 0;
79
  m_socket = 0;
80
  m_sendEvent = EventId ();
81
  m_data = 0;
82
  m_dataSize = 0;
83
}
84
85
TcpEchoClient::~TcpEchoClient()
86
{
87
  NS_LOG_FUNCTION_NOARGS ();
88
  m_socket = 0;
89
90
  delete [] m_data;
91
  m_data = 0;
92
  m_dataSize = 0;
93
}
94
95
void
96
TcpEchoClient::SetRemote (Ipv4Address ip, uint16_t port)
97
{
98
  m_peerAddress = ip;
99
  m_peerPort = port;
100
}
101
102
void
103
TcpEchoClient::DoDispose (void)
104
{
105
  NS_LOG_FUNCTION_NOARGS ();
106
  Application::DoDispose ();
107
}
108
109
void
110
TcpEchoClient::StartApplication (void)
111
{
112
  NS_LOG_FUNCTION_NOARGS ();
113
114
  if (m_socket == 0)
115
    {
116
      TypeId tid = TypeId::LookupByName ("ns3::TcpSocketFactory");
117
      m_socket = Socket::CreateSocket (GetNode (), tid);
118
      m_socket->Bind ();
119
      m_socket->Connect (InetSocketAddress (m_peerAddress, m_peerPort));
120
    }
121
122
  m_socket->SetRecvCallback (MakeCallback (&TcpEchoClient::ReceivePacket, this));
123
124
  ScheduleTransmit (Seconds (0.));
125
}
126
127
void
128
TcpEchoClient::StopApplication ()
129
{
130
  NS_LOG_FUNCTION_NOARGS ();
131
132
  if (m_socket != 0)
133
    {
134
      m_socket->Close ();
135
      m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ());
136
      m_socket = 0;
137
    }
138
139
  Simulator::Cancel (m_sendEvent);
140
}
141
142
void
143
TcpEchoClient::SetDataSize (uint32_t dataSize)
144
{
145
  NS_LOG_FUNCTION (dataSize);
146
147
  //
148
  // If the client is setting the echo packet data size this way, we infer
149
  // that she doesn't care about the contents of the packet at all, so
150
  // neither will we.
151
  //
152
  delete [] m_data;
153
  m_data = 0;
154
  m_dataSize = 0;
155
  m_size = dataSize;
156
}
157
158
uint32_t
159
TcpEchoClient::GetDataSize (void) const
160
{
161
  NS_LOG_FUNCTION_NOARGS ();
162
  return m_size;
163
}
164
165
void
166
TcpEchoClient::SetFill (std::string fill)
167
{
168
  NS_LOG_FUNCTION (fill);
169
170
  uint32_t dataSize = fill.size () + 1;
171
172
  if (dataSize != m_dataSize)
173
    {
174
      delete [] m_data;
175
      m_data = new uint8_t [dataSize];
176
      m_dataSize = dataSize;
177
    }
178
179
  memcpy (m_data, fill.c_str (), dataSize);
180
181
  //
182
  // Overwrite packet size attribute.
183
  //
184
  m_size = dataSize;
185
}
186
187
void
188
TcpEchoClient::SetFill (uint8_t fill, uint32_t dataSize)
189
{
190
  if (dataSize != m_dataSize)
191
    {
192
      delete [] m_data;
193
      m_data = new uint8_t [dataSize];
194
      m_dataSize = dataSize;
195
    }
196
197
  memset (m_data, fill, dataSize);
198
199
  //
200
  // Overwrite packet size attribute.
201
  //
202
  m_size = dataSize;
203
}
204
205
void
206
TcpEchoClient::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
207
{
208
  if (dataSize != m_dataSize)
209
    {
210
      delete [] m_data;
211
      m_data = new uint8_t [dataSize];
212
      m_dataSize = dataSize;
213
    }
214
215
  if (fillSize >= dataSize)
216
    {
217
      memcpy (m_data, fill, dataSize);
218
      return;
219
    }
220
221
  //
222
  // Do all but the final fill.
223
  //
224
  uint32_t filled = 0;
225
  while (filled + fillSize < dataSize)
226
    {
227
      memcpy (&m_data[filled], fill, fillSize);
228
      filled += fillSize;
229
    }
230
231
  //
232
  // Last fill may be partial
233
  //
234
  memcpy (&m_data[filled], fill, dataSize - filled);
235
236
  //
237
  // Overwrite packet size attribute.
238
  //
239
  m_size = dataSize;
240
}
241
242
void
243
TcpEchoClient::ScheduleTransmit (Time dt)
244
{
245
  NS_LOG_FUNCTION_NOARGS ();
246
  m_sendEvent = Simulator::Schedule (dt, &TcpEchoClient::Send, this);
247
}
248
249
void
250
TcpEchoClient::Send (void)
251
{
252
  NS_LOG_FUNCTION_NOARGS ();
253
254
  NS_ASSERT (m_sendEvent.IsExpired ());
255
256
  Ptr<Packet> p;
257
  if (m_dataSize)
258
    {
259
      //
260
      // If m_dataSize is non-zero, we have a data buffer of the same size that we
261
      // are expected to copy and send.  This state of affairs is created if one of
262
      // the Fill functions is called.  In this case, m_size must have been set
263
      // to agree with m_dataSize
264
      //
265
      NS_ASSERT_MSG (m_dataSize == m_size, "TcpEchoClient::Send(): m_size and m_dataSize inconsistent");
266
      NS_ASSERT_MSG (m_data, "TcpEchoClient::Send(): m_dataSize but no m_data");
267
      p = Create<Packet> (m_data, m_dataSize);
268
      m_bytesSent += m_dataSize;
269
    }
270
  else
271
    {
272
      //
273
      // If m_dataSize is zero, the client has indicated that she doesn't care
274
      // about the data itself either by specifying the data size by setting
275
      // the corresponding atribute or by not calling a SetFill function.  In
276
      // this case, we don't worry about it either.  But we do allow m_size
277
      // to have a value different from the (zero) m_dataSize.
278
      //
279
      p = Create<Packet> (m_size);
280
      m_bytesSent += m_size;
281
    }
282
  // call to the trace sinks before the packet is actually sent,
283
  // so that tags added to the packet can be sent as well
284
  m_txTrace (p);
285
  m_socket->Send (p);
286
287
  ++m_sent;
288
289
  NS_LOG_INFO ("Sent " << m_size << " bytes to " << m_peerAddress);
290
291
  if (m_sent < m_count)
292
    {
293
      ScheduleTransmit (m_interval);
294
    }
295
}
296
297
void
298
TcpEchoClient::ReceivePacket (Ptr<Socket> socket)
299
{
300
  NS_LOG_FUNCTION (this << socket);
301
  Ptr<Packet> packet;
302
  Address from;
303
  while (packet = socket->RecvFrom (from))
304
    {
305
      NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
306
             InetSocketAddress::ConvertFrom (from).GetIpv4 ());
307
308
      // dont check if data returned is the same data sent earlier
309
      m_recvBack++;
310
      m_bytesRecvBack += packet->GetSize ();
311
    }
312
313
  if (m_count == m_recvBack)
314
    {
315
	  socket->Close();
316
	  m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ());
317
	  socket = 0;
318
    }
319
}
320
321
} // Namespace ns3
(-)ns-3-dev/src/applications/model/tcp-echo-client.h (+165 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright 2012
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 */
18
19
#ifndef TCP_ECHO_CLIENT
20
#define TCP_ECHO_CLIENT
21
22
23
#include "ns3/application.h"
24
#include "ns3/event-id.h"
25
#include "ns3/ptr.h"
26
#include "ns3/ipv4-address.h"
27
#include "ns3/traced-callback.h"
28
29
namespace ns3 {
30
31
class Socket;
32
class Packet;
33
34
/**
35
 * \ingroup tcpecho
36
 * \brief A Tcp Echo client
37
 *
38
 * Every packet sent should be returned by the server and received here.
39
 */
40
class TcpEchoClient : public Application
41
{
42
public:
43
  static TypeId GetTypeId (void);
44
45
  TcpEchoClient ();
46
47
  virtual ~TcpEchoClient ();
48
49
  /**
50
   * \param ip destination ipv4 address
51
   * \param port destination port
52
   */
53
  void SetRemote (Ipv4Address ip, uint16_t port);
54
55
  /**
56
   * Set the data size of the packet (the number of bytes that are sent as data
57
   * to the server).  The contents of the data are set to unspecified (don't
58
   * care) by this call.
59
   *
60
   * \warning If you have set the fill data for the echo client using one of the
61
   * SetFill calls, this will undo those effects.
62
   *
63
   * \param dataSize The size of the echo data you want to sent.
64
   */
65
  void SetDataSize (uint32_t dataSize);
66
67
  /**
68
   * Get the number of data bytes that will be sent to the server.
69
   *
70
   * \warning The number of bytes may be modified by calling any one of the
71
   * SetFill methods.  If you have called SetFill, then the number of
72
   * data bytes will correspond to the size of an initialized data buffer.
73
   * If you have not called a SetFill method, the number of data bytes will
74
   * correspond to the number of don't care bytes that will be sent.
75
   *
76
   * \returns The number of data bytes.
77
   */
78
  uint32_t GetDataSize (void) const;
79
80
  /**
81
   * Set the data fill of the packet (what is sent as data to the server) to
82
   * the zero-terminated contents of the fill string string.
83
   *
84
   * \warning The size of resulting echo packets will be automatically adjusted
85
   * to reflect the size of the fill string -- this means that the PacketSize
86
   * attribute may be changed as a result of this call.
87
   *
88
   * \param fill The string to use as the actual echo data bytes.
89
   */
90
  void SetFill (std::string fill);
91
92
  /**
93
   * Set the data fill of the packet (what is sent as data to the server) to
94
   * the repeated contents of the fill byte.  i.e., the fill byte will be
95
   * used to initialize the contents of the data packet.
96
   *
97
   * \warning The size of resulting echo packets will be automatically adjusted
98
   * to reflect the dataSize parameter -- this means that the PacketSize
99
   * attribute may be changed as a result of this call.
100
   *
101
   * \param fill The byte to be repeated in constructing the packet data..
102
   * \param dataSize The desired size of the resulting echo packet data.
103
   */
104
  void SetFill (uint8_t fill, uint32_t dataSize);
105
106
  /**
107
   * Set the data fill of the packet (what is sent as data to the server) to
108
   * the contents of the fill buffer, repeated as many times as is required.
109
   *
110
   * Initializing the packet to the contents of a provided single buffer is
111
   * accomplished by setting the fillSize set to your desired dataSize
112
   * (and providing an appropriate buffer).
113
   *
114
   * \warning The size of resulting echo packets will be automatically adjusted
115
   * to reflect the dataSize parameter -- this means that the PacketSize
116
   * attribute of the Application may be changed as a result of this call.
117
   *
118
   * \param fill The fill pattern to use when constructing packets.
119
   * \param fillSize The number of bytes in the provided fill pattern.
120
   * \param dataSize The desired size of the final echo data.
121
   */
122
  void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize);
123
124
  // mainly to the automated test
125
  uint32_t GetPacketsSent (void) { return m_sent; };
126
  uint64_t GetBytesSent (void) { return m_bytesSent; };
127
  uint32_t GetPacketsReceivedBack (void) { return m_recvBack; };
128
  uint64_t GetBytesReceivedBack (void) { return m_bytesRecvBack; };
129
130
protected:
131
  virtual void DoDispose (void);
132
133
private:
134
135
  virtual void StartApplication (void);
136
  virtual void StopApplication (void);
137
138
  void ScheduleTransmit (Time dt);
139
  void Send (void);
140
141
  void ReceivePacket (Ptr<Socket> socket);
142
143
  uint32_t m_count;
144
  Time m_interval;
145
  uint32_t m_size;
146
147
  uint32_t m_dataSize;
148
  uint8_t *m_data;
149
150
  uint32_t m_sent;
151
  uint64_t m_bytesSent;
152
  uint32_t m_recvBack;
153
  uint64_t m_bytesRecvBack;
154
  Ptr<Socket> m_socket;
155
  Ipv4Address m_peerAddress;
156
  uint16_t m_peerPort;
157
  EventId m_sendEvent;
158
  /// Callbacks for tracing the packet Tx events
159
  TracedCallback<Ptr<const Packet> > m_txTrace;
160
};
161
162
} // namespace ns3
163
164
165
#endif /* TCP_ECHO_CLIENT */
(-)ns-3-dev/src/applications/model/tcp-echo-server.cc (+149 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright 2012
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 */
18
19
#include "ns3/log.h"
20
#include "ns3/ipv4-address.h"
21
#include "ns3/address-utils.h"
22
#include "ns3/nstime.h"
23
#include "ns3/inet-socket-address.h"
24
#include "ns3/socket.h"
25
#include "ns3/simulator.h"
26
#include "ns3/socket-factory.h"
27
#include "ns3/packet.h"
28
#include "ns3/uinteger.h"
29
30
#include "tcp-echo-server.h"
31
32
namespace ns3 {
33
34
NS_LOG_COMPONENT_DEFINE ("TcpEchoServerApplication");
35
NS_OBJECT_ENSURE_REGISTERED (TcpEchoServer);
36
37
TypeId
38
TcpEchoServer::GetTypeId (void)
39
{
40
  static TypeId tid = TypeId ("ns3::TcpEchoServer")
41
    .SetParent<Application> ()
42
    .AddConstructor<TcpEchoServer> ()
43
    .AddAttribute ("Port", "Port on which we listen for incoming connections.",
44
                   UintegerValue (7),
45
                   MakeUintegerAccessor (&TcpEchoServer::m_port),
46
                   MakeUintegerChecker<uint16_t> ())
47
  ;
48
  return tid;
49
}
50
51
TcpEchoServer::TcpEchoServer ()
52
{
53
  NS_LOG_FUNCTION_NOARGS ();
54
  m_socket = 0;
55
  m_running = false;
56
}
57
58
TcpEchoServer::~TcpEchoServer()
59
{
60
  NS_LOG_FUNCTION_NOARGS ();
61
  m_socket = 0;
62
}
63
64
void
65
TcpEchoServer::DoDispose (void)
66
{
67
  NS_LOG_FUNCTION_NOARGS ();
68
  Application::DoDispose ();
69
}
70
71
void
72
TcpEchoServer::StartApplication (void)
73
{
74
  NS_LOG_FUNCTION_NOARGS ();
75
76
  m_running = true;
77
78
  if (m_socket == 0)
79
    {
80
      TypeId tid = TypeId::LookupByName ("ns3::TcpSocketFactory");
81
      m_socket = Socket::CreateSocket (GetNode (), tid);
82
      InetSocketAddress listenAddress = InetSocketAddress (Ipv4Address::GetAny (), m_port);
83
      m_socket->Bind (listenAddress);
84
      m_socket->Listen();
85
    }
86
87
  m_socket->SetAcceptCallback (
88
      MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
89
      MakeCallback (&TcpEchoServer::HandleAccept, this));
90
}
91
92
void
93
TcpEchoServer::StopApplication ()
94
{
95
  NS_LOG_FUNCTION_NOARGS ();
96
97
  m_running = false;
98
99
  if (m_socket != 0)
100
    {
101
      m_socket->Close ();
102
      m_socket->SetAcceptCallback (
103
            MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
104
            MakeNullCallback<void, Ptr<Socket>, const Address &> () );
105
    }
106
}
107
108
void
109
TcpEchoServer::ReceivePacket (Ptr<Socket> s)
110
{
111
  NS_LOG_FUNCTION (this << s);
112
113
  Ptr<Packet> packet;
114
  Address from;
115
  while (packet = s->RecvFrom (from))
116
    {
117
      if (packet->GetSize () > 0)
118
        {
119
    	  NS_LOG_INFO ("Server Received " << packet->GetSize () << " bytes from " <<
120
    	                         InetSocketAddress::ConvertFrom (from).GetIpv4 ());
121
122
    	  packet->RemoveAllPacketTags ();
123
    	  packet->RemoveAllByteTags ();
124
125
    	  NS_LOG_LOGIC ("Echoing packet");
126
    	  s->Send (packet);
127
        }
128
    }
129
}
130
131
void TcpEchoServer::HandleAccept (Ptr<Socket> s, const Address& from)
132
{
133
  NS_LOG_FUNCTION (this << s << from);
134
  s->SetRecvCallback (MakeCallback (&TcpEchoServer::ReceivePacket, this));
135
  s->SetCloseCallbacks(MakeCallback (&TcpEchoServer::HandleSuccessClose, this),
136
    MakeNullCallback<void, Ptr<Socket> > () );
137
}
138
139
void TcpEchoServer::HandleSuccessClose(Ptr<Socket> s)
140
{
141
  NS_LOG_FUNCTION (this << s);
142
  NS_LOG_LOGIC ("Client close received");
143
  s->Close();
144
  s->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > () );
145
  s->SetCloseCallbacks(MakeNullCallback<void, Ptr<Socket> > (),
146
      MakeNullCallback<void, Ptr<Socket> > () );
147
}
148
149
} // Namespace ns3
(-)ns-3-dev/src/applications/model/tcp-echo-server.h (+96 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright 2012
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 */
18
19
#ifndef TCP_ECHO_SERVER
20
#define TCP_ECHO_SERVER
21
22
#include "ns3/application.h"
23
#include "ns3/event-id.h"
24
#include "ns3/ptr.h"
25
#include "ns3/address.h"
26
27
namespace ns3 {
28
29
class Socket;
30
class Packet;
31
32
/**
33
 * \ingroup applications
34
 * \defgroup TcpEcho 
35
 */
36
37
/**
38
 * \ingroup tcpecho
39
 * \brief A Tcp Echo server
40
 *
41
 * Every packet received is sent back to the client.
42
 */
43
class TcpEchoServer : public Application
44
{
45
public:
46
  static TypeId GetTypeId (void);
47
  TcpEchoServer ();
48
  virtual ~TcpEchoServer ();
49
50
  /**
51
   *
52
   * Receive the packet from client echo on socket level (layer 4), 
53
   * handle the packet and return to the client.
54
   *
55
   * \param socket TCP socket.
56
   *
57
   */
58
  void ReceivePacket(Ptr<Socket> socket);
59
  
60
  /**
61
  *
62
  * Handle packet from accept connections.
63
  *
64
  * \parm s TCP socket.
65
  * \parm from Address from client echo.
66
  */
67
  void HandleAccept (Ptr<Socket> s, const Address& from);
68
  
69
  /**
70
  *
71
  * Handle successful closing connections.
72
  *
73
  * \parm s TCP socket.
74
  *
75
  */
76
  void HandleSuccessClose(Ptr<Socket> s);
77
78
protected:
79
  virtual void DoDispose (void);
80
81
private:
82
83
  virtual void StartApplication (void);
84
  virtual void StopApplication (void);
85
86
  void HandleRead (Ptr<Socket> socket);
87
88
  Ptr<Socket> m_socket;
89
  uint16_t m_port;
90
  bool m_running;
91
};
92
93
} // namespace ns3
94
95
#endif /* TCP_ECHO_SERVER */
96
(-)ns-3-dev/src/applications/test/tcp-echo-test-suite.cc (+108 lines)
Line 0    Link Here 
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
3
#include <fstream>
4
#include "ns3/log.h"
5
#include "ns3/abort.h"
6
#include "ns3/config.h"
7
#include "ns3/string.h"
8
#include "ns3/uinteger.h"
9
#include "ns3/inet-socket-address.h"
10
#include "ns3/internet-stack-helper.h"
11
#include "ns3/ipv4-address-helper.h"
12
#include "ns3/tcp-echo-server.h"
13
#include "ns3/tcp-echo-client.h"
14
#include "ns3/tcp-echo-helper.h"
15
#include "ns3/simple-net-device.h"
16
#include "ns3/simple-channel.h"
17
#include "ns3/test.h"
18
#include "ns3/simulator.h"
19
20
using namespace ns3;
21
22
/**
23
 * Test if all tcp packets generated by a tcpEchoClient application are
24
 * correctly received by an tcpEchoServer apllication.
25
 * 
26
 */
27
class TcpEchoTestCase : public TestCase
28
{
29
public:
30
  TcpEchoTestCase ();
31
  virtual ~TcpEchoTestCase ();
32
33
private:
34
  virtual void DoRun (void);
35
};
36
37
TcpEchoTestCase::TcpEchoTestCase ()
38
  : TestCase ("Tcp-echo test if data sent by an client returns back to server")
39
{
40
}
41
42
TcpEchoTestCase::~TcpEchoTestCase ()
43
{
44
}
45
46
void
47
TcpEchoTestCase::DoRun (void)
48
{
49
  NodeContainer n;
50
  n.Create (2);
51
52
  InternetStackHelper internet;
53
  internet.Install (n);
54
55
  // link the two nodes
56
  Ptr<SimpleNetDevice> txDev = CreateObject<SimpleNetDevice> ();
57
  Ptr<SimpleNetDevice> rxDev = CreateObject<SimpleNetDevice> ();
58
  n.Get (0)->AddDevice (txDev);
59
  n.Get (1)->AddDevice (rxDev);
60
  Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel> ();
61
  rxDev->SetChannel (channel1);
62
  txDev->SetChannel (channel1);
63
  NetDeviceContainer d;
64
  d.Add (txDev);
65
  d.Add (rxDev);
66
67
  Ipv4AddressHelper ipv4;
68
69
  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
70
  Ipv4InterfaceContainer i = ipv4.Assign (d);
71
72
  uint16_t port = 4000;
73
  TcpEchoServerHelper server (port);
74
  ApplicationContainer apps = server.Install (n.Get (1));
75
  apps.Start (Seconds (1.0));
76
  apps.Stop (Seconds (10.0));
77
78
  uint32_t MaxPacketSize = 183;
79
  Time interPacketInterval = Seconds (1.);
80
  uint32_t maxPacketCount = 5;
81
  TcpEchoClientHelper client (i.GetAddress (1), port);
82
  client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
83
  client.SetAttribute ("Interval", TimeValue (interPacketInterval));
84
  client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
85
  apps = client.Install (n.Get (0));
86
  apps.Start (Seconds (2.0));
87
  apps.Stop (Seconds (10.0));
88
89
  Simulator::Run ();
90
  Simulator::Destroy ();
91
92
  NS_TEST_ASSERT_MSG_EQ (client.GetClient ()->GetBytesSent (), client.GetClient ()->GetBytesReceivedBack (), "Bytes received differ from bytes sent !");
93
}
94
95
class TcpEchoTestSuite : public TestSuite
96
{
97
public:
98
  TcpEchoTestSuite ();
99
};
100
101
TcpEchoTestSuite::TcpEchoTestSuite ()
102
  : TestSuite ("tcp-echo", UNIT)
103
{
104
  AddTestCase (new TcpEchoTestCase);
105
}
106
107
static TcpEchoTestSuite tcpEchoTestSuite;
108
(-)ns-3-dev/src/applications/wscript (+7 lines)
 Lines 18-23   def build(bld): Link Here 
18
        'model/udp-echo-client.cc',
18
        'model/udp-echo-client.cc',
19
        'model/udp-echo-server.cc',
19
        'model/udp-echo-server.cc',
20
        'model/v4ping.cc',
20
        'model/v4ping.cc',
21
        'model/tcp-echo-client.cc',
22
        'model/tcp-echo-server.cc',
21
        'helper/bulk-send-helper.cc',
23
        'helper/bulk-send-helper.cc',
22
        'helper/on-off-helper.cc',
24
        'helper/on-off-helper.cc',
23
        'helper/packet-sink-helper.cc',
25
        'helper/packet-sink-helper.cc',
 Lines 25-35   def build(bld): Link Here 
25
        'helper/udp-client-server-helper.cc',
27
        'helper/udp-client-server-helper.cc',
26
        'helper/udp-echo-helper.cc',
28
        'helper/udp-echo-helper.cc',
27
        'helper/v4ping-helper.cc',
29
        'helper/v4ping-helper.cc',
30
        'helper/tcp-echo-helper.cc',
28
        ]
31
        ]
29
32
30
    applications_test = bld.create_ns3_module_test_library('applications')
33
    applications_test = bld.create_ns3_module_test_library('applications')
31
    applications_test.source = [
34
    applications_test.source = [
32
        'test/udp-client-server-test.cc',
35
        'test/udp-client-server-test.cc',
36
        'test/tcp-echo-test-suite.cc',
33
        ]
37
        ]
34
38
35
    headers = bld.new_task_gen(features=['ns3header'])
39
    headers = bld.new_task_gen(features=['ns3header'])
 Lines 50-55   def build(bld): Link Here 
50
        'model/udp-echo-client.h',
54
        'model/udp-echo-client.h',
51
        'model/udp-echo-server.h',
55
        'model/udp-echo-server.h',
52
        'model/v4ping.h',
56
        'model/v4ping.h',
57
        'model/tcp-echo-client.h',
58
        'model/tcp-echo-server.h',
53
        'helper/bulk-send-helper.h',
59
        'helper/bulk-send-helper.h',
54
        'helper/on-off-helper.h',
60
        'helper/on-off-helper.h',
55
        'helper/packet-sink-helper.h',
61
        'helper/packet-sink-helper.h',
 Lines 57-62   def build(bld): Link Here 
57
        'helper/udp-client-server-helper.h',
63
        'helper/udp-client-server-helper.h',
58
        'helper/udp-echo-helper.h',
64
        'helper/udp-echo-helper.h',
59
        'helper/v4ping-helper.h',
65
        'helper/v4ping-helper.h',
66
        'helper/tcp-echo-helper.h',
60
        ]
67
        ]
61
68
62
    bld.ns3_python_bindings()
69
    bld.ns3_python_bindings()

Return to bug 454