A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tcp-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 Georgia Tech Research Corporation
4  * Copyright (c) 2009 INRIA
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Raj Bhattacharjea <raj.b@gatech.edu>
21  */
22 
23 #include "ns3/test.h"
24 #include "ns3/socket-factory.h"
25 #include "ns3/tcp-socket-factory.h"
26 #include "ns3/simulator.h"
27 #include "ns3/simple-channel.h"
28 #include "ns3/simple-net-device.h"
29 #include "ns3/drop-tail-queue.h"
30 #include "ns3/config.h"
31 #include "ns3/ipv4-static-routing.h"
32 #include "ns3/ipv4-list-routing.h"
33 #include "ns3/ipv6-static-routing.h"
34 #include "ns3/ipv6-list-routing.h"
35 #include "ns3/node.h"
36 #include "ns3/inet-socket-address.h"
37 #include "ns3/inet6-socket-address.h"
38 #include "ns3/uinteger.h"
39 #include "ns3/log.h"
40 
41 #include "ns3/ipv4-end-point.h"
42 #include "ns3/arp-l3-protocol.h"
43 #include "ns3/ipv4-l3-protocol.h"
44 #include "ns3/ipv6-l3-protocol.h"
45 #include "ns3/icmpv4-l4-protocol.h"
46 #include "ns3/icmpv6-l4-protocol.h"
47 #include "ns3/udp-l4-protocol.h"
48 #include "ns3/tcp-l4-protocol.h"
49 
50 #include <string>
51 
52 NS_LOG_COMPONENT_DEFINE ("TcpTestSuite");
53 
54 using namespace ns3;
55 
56 class TcpTestCase : public TestCase
57 {
58 public:
59  TcpTestCase (uint32_t totalStreamSize,
60  uint32_t sourceWriteSize,
61  uint32_t sourceReadSize,
62  uint32_t serverWriteSize,
63  uint32_t serverReadSize,
64  bool useIpv6);
65 private:
66  virtual void DoRun (void);
67  virtual void DoTeardown (void);
68  void SetupDefaultSim (void);
69  void SetupDefaultSim6 (void);
70 
71  Ptr<Node> CreateInternetNode (void);
72  Ptr<Node> CreateInternetNode6 (void);
73  Ptr<SimpleNetDevice> AddSimpleNetDevice (Ptr<Node> node, const char* ipaddr, const char* netmask);
74  Ptr<SimpleNetDevice> AddSimpleNetDevice6 (Ptr<Node> node, Ipv6Address ipaddr, Ipv6Prefix prefix);
75  void ServerHandleConnectionCreated (Ptr<Socket> s, const Address & addr);
76  void ServerHandleRecv (Ptr<Socket> sock);
77  void ServerHandleSend (Ptr<Socket> sock, uint32_t available);
78  void SourceHandleSend (Ptr<Socket> sock, uint32_t available);
79  void SourceHandleRecv (Ptr<Socket> sock);
80 
81  uint32_t m_totalBytes;
83  uint32_t m_sourceReadSize;
85  uint32_t m_serverReadSize;
93 
94  bool m_useIpv6;
95 };
96 
97 static std::string Name (std::string str, uint32_t totalStreamSize,
98  uint32_t sourceWriteSize,
99  uint32_t serverReadSize,
100  uint32_t serverWriteSize,
101  uint32_t sourceReadSize,
102  bool useIpv6)
103 {
104  std::ostringstream oss;
105  oss << str << " total=" << totalStreamSize << " sourceWrite=" << sourceWriteSize
106  << " sourceRead=" << sourceReadSize << " serverRead=" << serverReadSize
107  << " serverWrite=" << serverWriteSize << " useIpv6=" << useIpv6;
108  return oss.str ();
109 }
110 
111 static inline std::string GetString (Ptr<Packet> p)
112 {
113  std::ostringstream oss;
114  p->CopyData (&oss, p->GetSize ());
115  return oss.str ();
116 }
117 
118 TcpTestCase::TcpTestCase (uint32_t totalStreamSize,
119  uint32_t sourceWriteSize,
120  uint32_t sourceReadSize,
121  uint32_t serverWriteSize,
122  uint32_t serverReadSize,
123  bool useIpv6)
124  : TestCase (Name ("Send string data from client to server and back",
125  totalStreamSize,
126  sourceWriteSize,
127  serverReadSize,
128  serverWriteSize,
129  sourceReadSize,
130  useIpv6)),
131  m_totalBytes (totalStreamSize),
132  m_sourceWriteSize (sourceWriteSize),
133  m_sourceReadSize (sourceReadSize),
134  m_serverWriteSize (serverWriteSize),
135  m_serverReadSize (serverReadSize),
136  m_useIpv6 (useIpv6)
137 {
138 }
139 
140 void
142 {
147  m_sourceTxPayload = new uint8_t [m_totalBytes];
148  m_sourceRxPayload = new uint8_t [m_totalBytes];
149  m_serverRxPayload = new uint8_t [m_totalBytes];
150  for(uint32_t i = 0; i < m_totalBytes; ++i)
151  {
152  uint8_t m = (uint8_t)(97 + (i % 26));
153  m_sourceTxPayload[i] = m;
154  }
155  memset (m_sourceRxPayload, 0, m_totalBytes);
156  memset (m_serverRxPayload, 0, m_totalBytes);
157 
158  if (m_useIpv6 == true)
159  {
160  SetupDefaultSim6 ();
161  }
162  else
163  {
164  SetupDefaultSim ();
165  }
166 
167  Simulator::Run ();
168 
169  NS_TEST_EXPECT_MSG_EQ (m_currentSourceTxBytes, m_totalBytes, "Source sent all bytes");
170  NS_TEST_EXPECT_MSG_EQ (m_currentServerRxBytes, m_totalBytes, "Server received all bytes");
171  NS_TEST_EXPECT_MSG_EQ (m_currentSourceRxBytes, m_totalBytes, "Source received all bytes");
172  NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_serverRxPayload, m_totalBytes), 0,
173  "Server received expected data buffers");
174  NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_sourceRxPayload, m_totalBytes), 0,
175  "Source received back expected data buffers");
176 }
177 void
179 {
180  delete [] m_sourceTxPayload;
181  delete [] m_sourceRxPayload;
182  delete [] m_serverRxPayload;
183  Simulator::Destroy ();
184 }
185 
186 void
188 {
191 }
192 
193 void
195 {
196  while (sock->GetRxAvailable () > 0)
197  {
198  uint32_t toRead = std::min (m_serverReadSize, sock->GetRxAvailable ());
199  Ptr<Packet> p = sock->Recv (toRead, 0);
200  if (p == 0 && sock->GetErrno () != Socket::ERROR_NOTERROR)
201  {
202  NS_FATAL_ERROR ("Server could not read stream at byte " << m_currentServerRxBytes);
203  }
204  NS_TEST_EXPECT_MSG_EQ ((m_currentServerRxBytes + p->GetSize () <= m_totalBytes), true,
205  "Server received too many bytes");
206  NS_LOG_DEBUG ("Server recv data=\"" << GetString (p) << "\"");
207  p->CopyData (&m_serverRxPayload[m_currentServerRxBytes], p->GetSize ());
208  m_currentServerRxBytes += p->GetSize ();
209  ServerHandleSend (sock, sock->GetTxAvailable ());
210  }
211 }
212 
213 void
214 TcpTestCase::ServerHandleSend (Ptr<Socket> sock, uint32_t available)
215 {
217  {
219  uint32_t toSend = std::min (left, sock->GetTxAvailable ());
220  toSend = std::min (toSend, m_serverWriteSize);
221  Ptr<Packet> p = Create<Packet> (&m_serverRxPayload[m_currentServerTxBytes], toSend);
222  NS_LOG_DEBUG ("Server send data=\"" << GetString (p) << "\"");
223  int sent = sock->Send (p);
224  NS_TEST_EXPECT_MSG_EQ ((sent != -1), true, "Server error during send ?");
225  m_currentServerTxBytes += sent;
226  }
228  {
229  sock->Close ();
230  }
231 }
232 
233 void
234 TcpTestCase::SourceHandleSend (Ptr<Socket> sock, uint32_t available)
235 {
236  while (sock->GetTxAvailable () > 0 && m_currentSourceTxBytes < m_totalBytes)
237  {
238  uint32_t left = m_totalBytes - m_currentSourceTxBytes;
239  uint32_t toSend = std::min (left, sock->GetTxAvailable ());
240  toSend = std::min (toSend, m_sourceWriteSize);
241  Ptr<Packet> p = Create<Packet> (&m_sourceTxPayload[m_currentSourceTxBytes], toSend);
242  NS_LOG_DEBUG ("Source send data=\"" << GetString (p) << "\"");
243  int sent = sock->Send (p);
244  NS_TEST_EXPECT_MSG_EQ ((sent != -1), true, "Error during send ?");
245  m_currentSourceTxBytes += sent;
246  }
247 }
248 
249 void
251 {
252  while (sock->GetRxAvailable () > 0 && m_currentSourceRxBytes < m_totalBytes)
253  {
254  uint32_t toRead = std::min (m_sourceReadSize, sock->GetRxAvailable ());
255  Ptr<Packet> p = sock->Recv (toRead, 0);
256  if (p == 0 && sock->GetErrno () != Socket::ERROR_NOTERROR)
257  {
258  NS_FATAL_ERROR ("Source could not read stream at byte " << m_currentSourceRxBytes);
259  }
260  NS_TEST_EXPECT_MSG_EQ ((m_currentSourceRxBytes + p->GetSize () <= m_totalBytes), true,
261  "Source received too many bytes");
262  NS_LOG_DEBUG ("Source recv data=\"" << GetString (p) << "\"");
263  p->CopyData (&m_sourceRxPayload[m_currentSourceRxBytes], p->GetSize ());
264  m_currentSourceRxBytes += p->GetSize ();
265  }
267  {
268  sock->Close ();
269  }
270 }
271 
272 Ptr<Node>
274 {
275  Ptr<Node> node = CreateObject<Node> ();
276  //ARP
277  Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
278  node->AggregateObject (arp);
279  //IPV4
280  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
281  //Routing for Ipv4
282  Ptr<Ipv4ListRouting> ipv4Routing = CreateObject<Ipv4ListRouting> ();
283  ipv4->SetRoutingProtocol (ipv4Routing);
284  Ptr<Ipv4StaticRouting> ipv4staticRouting = CreateObject<Ipv4StaticRouting> ();
285  ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
286  node->AggregateObject (ipv4);
287  //ICMP
288  Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
289  node->AggregateObject (icmp);
290  //UDP
291  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
292  node->AggregateObject (udp);
293  //TCP
294  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
295  node->AggregateObject (tcp);
296  return node;
297 }
298 
300 TcpTestCase::AddSimpleNetDevice (Ptr<Node> node, const char* ipaddr, const char* netmask)
301 {
302  Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
303  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
304  node->AddDevice (dev);
305  Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
306  uint32_t ndid = ipv4->AddInterface (dev);
307  Ipv4InterfaceAddress ipv4Addr = Ipv4InterfaceAddress (Ipv4Address (ipaddr), Ipv4Mask (netmask));
308  ipv4->AddAddress (ndid, ipv4Addr);
309  ipv4->SetUp (ndid);
310  return dev;
311 }
312 
313 void
315 {
316  const char* netmask = "255.255.255.0";
317  const char* ipaddr0 = "192.168.1.1";
318  const char* ipaddr1 = "192.168.1.2";
319  Ptr<Node> node0 = CreateInternetNode ();
320  Ptr<Node> node1 = CreateInternetNode ();
321  Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice (node0, ipaddr0, netmask);
322  Ptr<SimpleNetDevice> dev1 = AddSimpleNetDevice (node1, ipaddr1, netmask);
323 
324  Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
325  dev0->SetChannel (channel);
326  dev1->SetChannel (channel);
327 
328  Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> ();
329  Ptr<SocketFactory> sockFactory1 = node1->GetObject<TcpSocketFactory> ();
330 
331  Ptr<Socket> server = sockFactory0->CreateSocket ();
332  Ptr<Socket> source = sockFactory1->CreateSocket ();
333 
334  uint16_t port = 50000;
335  InetSocketAddress serverlocaladdr (Ipv4Address::GetAny (), port);
336  InetSocketAddress serverremoteaddr (Ipv4Address (ipaddr0), port);
337 
338  server->Bind (serverlocaladdr);
339  server->Listen ();
340  server->SetAcceptCallback (MakeNullCallback<bool, Ptr< Socket >, const Address &> (),
342 
345 
346  source->Connect (serverremoteaddr);
347 }
348 
349 void
351 {
352  Ipv6Prefix prefix = Ipv6Prefix(64);
353  Ipv6Address ipaddr0 = Ipv6Address("2001:0100:f00d:cafe::1");
354  Ipv6Address ipaddr1 = Ipv6Address("2001:0100:f00d:cafe::2");
355  Ptr<Node> node0 = CreateInternetNode6 ();
356  Ptr<Node> node1 = CreateInternetNode6 ();
357  Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice6 (node0, ipaddr0, prefix);
358  Ptr<SimpleNetDevice> dev1 = AddSimpleNetDevice6 (node1, ipaddr1, prefix);
359 
360  Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
361  dev0->SetChannel (channel);
362  dev1->SetChannel (channel);
363 
364  Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> ();
365  Ptr<SocketFactory> sockFactory1 = node1->GetObject<TcpSocketFactory> ();
366 
367  Ptr<Socket> server = sockFactory0->CreateSocket ();
368  Ptr<Socket> source = sockFactory1->CreateSocket ();
369 
370  uint16_t port = 50000;
371  Inet6SocketAddress serverlocaladdr (Ipv6Address::GetAny (), port);
372  Inet6SocketAddress serverremoteaddr (ipaddr0, port);
373 
374  server->Bind (serverlocaladdr);
375  server->Listen ();
376  server->SetAcceptCallback (MakeNullCallback<bool, Ptr< Socket >, const Address &> (),
378 
381 
382  source->Connect (serverremoteaddr);
383 }
384 
385 Ptr<Node>
387 {
388  Ptr<Node> node = CreateObject<Node> ();
389  //IPV6
390  Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
391  //Routing for Ipv6
392  Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
393  ipv6->SetRoutingProtocol (ipv6Routing);
394  Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
395  ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
396  node->AggregateObject (ipv6);
397  //ICMP
398  Ptr<Icmpv6L4Protocol> icmp = CreateObject<Icmpv6L4Protocol> ();
399  node->AggregateObject (icmp);
400  //Ipv6 Extensions
401  ipv6->RegisterExtensions ();
402  ipv6->RegisterOptions ();
403  //UDP
404  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
405  node->AggregateObject (udp);
406  //TCP
407  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
408  node->AggregateObject (tcp);
409  return node;
410 }
411 
414 {
415  Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
416  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
417  node->AddDevice (dev);
418  Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
419  uint32_t ndid = ipv6->AddInterface (dev);
420  Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (ipaddr, prefix);
421  ipv6->AddAddress (ndid, ipv6Addr);
422  ipv6->SetUp (ndid);
423  return dev;
424 }
425 
426 static class TcpTestSuite : public TestSuite
427 {
428 public:
430  : TestSuite ("tcp", UNIT)
431  {
432  // Arguments to these test cases are 1) totalStreamSize,
433  // 2) source write size, 3) source read size
434  // 4) server write size, and 5) server read size
435  // with units of bytes
436  AddTestCase (new TcpTestCase (13, 200, 200, 200, 200, false), TestCase::QUICK);
437  AddTestCase (new TcpTestCase (13, 1, 1, 1, 1, false), TestCase::QUICK);
438  AddTestCase (new TcpTestCase (100000, 100, 50, 100, 20, false), TestCase::QUICK);
439 
440  AddTestCase (new TcpTestCase (13, 200, 200, 200, 200, true), TestCase::QUICK);
441  AddTestCase (new TcpTestCase (13, 1, 1, 1, 1, true), TestCase::QUICK);
442  AddTestCase (new TcpTestCase (100000, 100, 50, 100, 20, true), TestCase::QUICK);
443  }
444 
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
an Inet address class
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:80
uint32_t m_currentServerTxBytes
Definition: tcp-test.cc:89
Ptr< SimpleNetDevice > AddSimpleNetDevice(Ptr< Node > node, Ipv4Address v4Addr, Ipv4Mask v4Mask, Ipv6Address v6Addr, Ipv6Prefix v6Prefix)
API to create TCP socket instances.
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:222
A suite of tests to run.
Definition: test.h:1105
uint32_t m_sourceReadSize
Definition: tcp-test.cc:83
uint32_t m_currentServerRxBytes
Definition: tcp-test.cc:88
uint8_t * m_serverRxPayload
Definition: tcp-test.cc:92
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Definition: tcp-test.cc:178
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tcp-test.cc:141
bool m_useIpv6
Definition: tcp-test.cc:94
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
IPv6 address associated with an interface.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:265
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:744
TcpTestSuite g_tcpTestSuite
virtual Ptr< Socket > CreateSocket(void)=0
void SourceHandleRecv(Ptr< Socket > sock)
Definition: tcp-test.cc:250
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:95
Callback< R > MakeNullCallback(void)
Definition: callback.h:1399
encapsulates test code
Definition: test.h:929
uint32_t m_serverWriteSize
Definition: tcp-test.cc:84
uint32_t m_serverReadSize
Definition: tcp-test.cc:85
void SetupDefaultSim(void)
Definition: tcp-test.cc:314
virtual enum Socket::SocketErrno GetErrno(void) const =0
Get last error number.
uint16_t port
Definition: dsdv-manet.cc:44
a polymophic address class
Definition: address.h:86
TcpTestCase(uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t sourceReadSize, uint32_t serverWriteSize, uint32_t serverReadSize, bool useIpv6)
Definition: tcp-test.cc:118
uint8_t * m_sourceTxPayload
Definition: tcp-test.cc:90
void SourceHandleSend(Ptr< Socket > sock, uint32_t available)
Definition: tcp-test.cc:234
static std::string Name(std::string str, uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t serverReadSize, uint32_t serverWriteSize, uint32_t sourceReadSize, bool useIpv6)
Definition: tcp-test.cc:97
virtual void SetUp(uint32_t interface)=0
Ptr< SampleEmitter > s
An Inet6 address class.
uint32_t m_currentSourceTxBytes
Definition: tcp-test.cc:86
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1242
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
Definition: socket.cc:127
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition: socket.cc:70
void AggregateObject(Ptr< Object > other)
Definition: object.cc:242
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Access to the Ipv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
uint32_t m_sourceWriteSize
Definition: tcp-test.cc:82
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
uint8_t * m_sourceRxPayload
Definition: tcp-test.cc:91
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition: test.cc:184
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
Definition: socket.cc:120
Ptr< Node > CreateInternetNode6(void)
Definition: tcp-test.cc:386
Ptr< SimpleNetDevice > AddSimpleNetDevice(Ptr< Node > node, const char *ipaddr, const char *netmask)
Definition: tcp-test.cc:300
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
void ServerHandleRecv(Ptr< Socket > sock)
Definition: tcp-test.cc:194
static std::string GetString(Ptr< Packet > p)
Definition: tcp-test.cc:111
Describes an IPv6 address.
Definition: ipv6-address.h:46
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
Ptr< SimpleNetDevice > AddSimpleNetDevice6(Ptr< Node > node, Ipv6Address ipaddr, Ipv6Prefix prefix)
Definition: tcp-test.cc:413
uint32_t AddDevice(Ptr< NetDevice > device)
Definition: node.cc:120
a class to store IPv4 address information on an interface
void SetupDefaultSim6(void)
Definition: tcp-test.cc:350
virtual void SetAddress(Address address)
Set the address of this interface.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:213
Describes an IPv6 prefix.
Definition: ipv6-address.h:387
virtual bool AddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
void ServerHandleConnectionCreated(Ptr< Socket > s, const Address &addr)
Definition: tcp-test.cc:187
virtual bool AddAddress(uint32_t interface, Ipv6InterfaceAddress address)=0
Add an address on the specified IPv6 interface.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:381
This test suite implements a Unit Test.
Definition: test.h:1115
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Close(void)=0
Close a socket.
virtual uint32_t GetTxAvailable(void) const =0
Returns the number of bytes which can be sent in a single call to Send.
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
Ptr< T > GetObject(void) const
Definition: object.h:362
uint32_t m_totalBytes
Definition: tcp-test.cc:81
virtual void SetUp(uint32_t interface)=0
Set the interface into the "up" state.
void ServerHandleSend(Ptr< Socket > sock, uint32_t available)
Definition: tcp-test.cc:214
uint32_t m_currentSourceRxBytes
Definition: tcp-test.cc:87
Ptr< Node > CreateInternetNode(void)
Definition: tcp-test.cc:273
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
void SetRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol)
Register a new routing protocol to be used by this Ipv4 stack.