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 #ifdef NS3_LOG_ENABLE
112 static std::string GetString (Ptr<Packet> p)
113 {
114  std::ostringstream oss;
115  p->CopyData (&oss, p->GetSize ());
116  return oss.str ();
117 }
118 #endif /* NS3_LOG_ENABLE */
119 
120 TcpTestCase::TcpTestCase (uint32_t totalStreamSize,
121  uint32_t sourceWriteSize,
122  uint32_t sourceReadSize,
123  uint32_t serverWriteSize,
124  uint32_t serverReadSize,
125  bool useIpv6)
126  : TestCase (Name ("Send string data from client to server and back",
127  totalStreamSize,
128  sourceWriteSize,
129  serverReadSize,
130  serverWriteSize,
131  sourceReadSize,
132  useIpv6)),
133  m_totalBytes (totalStreamSize),
134  m_sourceWriteSize (sourceWriteSize),
135  m_sourceReadSize (sourceReadSize),
136  m_serverWriteSize (serverWriteSize),
137  m_serverReadSize (serverReadSize),
138  m_useIpv6 (useIpv6)
139 {
140 }
141 
142 void
144 {
149  m_sourceTxPayload = new uint8_t [m_totalBytes];
150  m_sourceRxPayload = new uint8_t [m_totalBytes];
151  m_serverRxPayload = new uint8_t [m_totalBytes];
152  for(uint32_t i = 0; i < m_totalBytes; ++i)
153  {
154  uint8_t m = (uint8_t)(97 + (i % 26));
155  m_sourceTxPayload[i] = m;
156  }
157  memset (m_sourceRxPayload, 0, m_totalBytes);
158  memset (m_serverRxPayload, 0, m_totalBytes);
159 
160  if (m_useIpv6 == true)
161  {
162  SetupDefaultSim6 ();
163  }
164  else
165  {
166  SetupDefaultSim ();
167  }
168 
169  Simulator::Run ();
170 
171  NS_TEST_EXPECT_MSG_EQ (m_currentSourceTxBytes, m_totalBytes, "Source sent all bytes");
172  NS_TEST_EXPECT_MSG_EQ (m_currentServerRxBytes, m_totalBytes, "Server received all bytes");
173  NS_TEST_EXPECT_MSG_EQ (m_currentSourceRxBytes, m_totalBytes, "Source received all bytes");
174  NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_serverRxPayload, m_totalBytes), 0,
175  "Server received expected data buffers");
176  NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_sourceRxPayload, m_totalBytes), 0,
177  "Source received back expected data buffers");
178 }
179 void
181 {
182  delete [] m_sourceTxPayload;
183  delete [] m_sourceRxPayload;
184  delete [] m_serverRxPayload;
185  Simulator::Destroy ();
186 }
187 
188 void
190 {
193 }
194 
195 void
197 {
198  while (sock->GetRxAvailable () > 0)
199  {
200  uint32_t toRead = std::min (m_serverReadSize, sock->GetRxAvailable ());
201  Ptr<Packet> p = sock->Recv (toRead, 0);
202  if (p == 0 && sock->GetErrno () != Socket::ERROR_NOTERROR)
203  {
204  NS_FATAL_ERROR ("Server could not read stream at byte " << m_currentServerRxBytes);
205  }
206  NS_TEST_EXPECT_MSG_EQ ((m_currentServerRxBytes + p->GetSize () <= m_totalBytes), true,
207  "Server received too many bytes");
208  NS_LOG_DEBUG ("Server recv data=\"" << GetString (p) << "\"");
209  p->CopyData (&m_serverRxPayload[m_currentServerRxBytes], p->GetSize ());
210  m_currentServerRxBytes += p->GetSize ();
211  ServerHandleSend (sock, sock->GetTxAvailable ());
212  }
213 }
214 
215 void
216 TcpTestCase::ServerHandleSend (Ptr<Socket> sock, uint32_t available)
217 {
219  {
221  uint32_t toSend = std::min (left, sock->GetTxAvailable ());
222  toSend = std::min (toSend, m_serverWriteSize);
223  Ptr<Packet> p = Create<Packet> (&m_serverRxPayload[m_currentServerTxBytes], toSend);
224  NS_LOG_DEBUG ("Server send data=\"" << GetString (p) << "\"");
225  int sent = sock->Send (p);
226  NS_TEST_EXPECT_MSG_EQ ((sent != -1), true, "Server error during send ?");
227  m_currentServerTxBytes += sent;
228  }
230  {
231  sock->Close ();
232  }
233 }
234 
235 void
236 TcpTestCase::SourceHandleSend (Ptr<Socket> sock, uint32_t available)
237 {
238  while (sock->GetTxAvailable () > 0 && m_currentSourceTxBytes < m_totalBytes)
239  {
240  uint32_t left = m_totalBytes - m_currentSourceTxBytes;
241  uint32_t toSend = std::min (left, sock->GetTxAvailable ());
242  toSend = std::min (toSend, m_sourceWriteSize);
243  Ptr<Packet> p = Create<Packet> (&m_sourceTxPayload[m_currentSourceTxBytes], toSend);
244  NS_LOG_DEBUG ("Source send data=\"" << GetString (p) << "\"");
245  int sent = sock->Send (p);
246  NS_TEST_EXPECT_MSG_EQ ((sent != -1), true, "Error during send ?");
247  m_currentSourceTxBytes += sent;
248  }
249 }
250 
251 void
253 {
254  while (sock->GetRxAvailable () > 0 && m_currentSourceRxBytes < m_totalBytes)
255  {
256  uint32_t toRead = std::min (m_sourceReadSize, sock->GetRxAvailable ());
257  Ptr<Packet> p = sock->Recv (toRead, 0);
258  if (p == 0 && sock->GetErrno () != Socket::ERROR_NOTERROR)
259  {
260  NS_FATAL_ERROR ("Source could not read stream at byte " << m_currentSourceRxBytes);
261  }
262  NS_TEST_EXPECT_MSG_EQ ((m_currentSourceRxBytes + p->GetSize () <= m_totalBytes), true,
263  "Source received too many bytes");
264  NS_LOG_DEBUG ("Source recv data=\"" << GetString (p) << "\"");
265  p->CopyData (&m_sourceRxPayload[m_currentSourceRxBytes], p->GetSize ());
266  m_currentSourceRxBytes += p->GetSize ();
267  }
269  {
270  sock->Close ();
271  }
272 }
273 
274 Ptr<Node>
276 {
277  Ptr<Node> node = CreateObject<Node> ();
278  //ARP
279  Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
280  node->AggregateObject (arp);
281  //IPV4
282  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
283  //Routing for Ipv4
284  Ptr<Ipv4ListRouting> ipv4Routing = CreateObject<Ipv4ListRouting> ();
285  ipv4->SetRoutingProtocol (ipv4Routing);
286  Ptr<Ipv4StaticRouting> ipv4staticRouting = CreateObject<Ipv4StaticRouting> ();
287  ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
288  node->AggregateObject (ipv4);
289  //ICMP
290  Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
291  node->AggregateObject (icmp);
292  //UDP
293  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
294  node->AggregateObject (udp);
295  //TCP
296  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
297  node->AggregateObject (tcp);
298  return node;
299 }
300 
302 TcpTestCase::AddSimpleNetDevice (Ptr<Node> node, const char* ipaddr, const char* netmask)
303 {
304  Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
305  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
306  node->AddDevice (dev);
307  Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
308  uint32_t ndid = ipv4->AddInterface (dev);
309  Ipv4InterfaceAddress ipv4Addr = Ipv4InterfaceAddress (Ipv4Address (ipaddr), Ipv4Mask (netmask));
310  ipv4->AddAddress (ndid, ipv4Addr);
311  ipv4->SetUp (ndid);
312  return dev;
313 }
314 
315 void
317 {
318  const char* netmask = "255.255.255.0";
319  const char* ipaddr0 = "192.168.1.1";
320  const char* ipaddr1 = "192.168.1.2";
321  Ptr<Node> node0 = CreateInternetNode ();
322  Ptr<Node> node1 = CreateInternetNode ();
323  Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice (node0, ipaddr0, netmask);
324  Ptr<SimpleNetDevice> dev1 = AddSimpleNetDevice (node1, ipaddr1, netmask);
325 
326  Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
327  dev0->SetChannel (channel);
328  dev1->SetChannel (channel);
329 
330  Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> ();
331  Ptr<SocketFactory> sockFactory1 = node1->GetObject<TcpSocketFactory> ();
332 
333  Ptr<Socket> server = sockFactory0->CreateSocket ();
334  Ptr<Socket> source = sockFactory1->CreateSocket ();
335 
336  uint16_t port = 50000;
337  InetSocketAddress serverlocaladdr (Ipv4Address::GetAny (), port);
338  InetSocketAddress serverremoteaddr (Ipv4Address (ipaddr0), port);
339 
340  server->Bind (serverlocaladdr);
341  server->Listen ();
342  server->SetAcceptCallback (MakeNullCallback<bool, Ptr< Socket >, const Address &> (),
344 
347 
348  source->Connect (serverremoteaddr);
349 }
350 
351 void
353 {
354  Ipv6Prefix prefix = Ipv6Prefix(64);
355  Ipv6Address ipaddr0 = Ipv6Address("2001:0100:f00d:cafe::1");
356  Ipv6Address ipaddr1 = Ipv6Address("2001:0100:f00d:cafe::2");
357  Ptr<Node> node0 = CreateInternetNode6 ();
358  Ptr<Node> node1 = CreateInternetNode6 ();
359  Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice6 (node0, ipaddr0, prefix);
360  Ptr<SimpleNetDevice> dev1 = AddSimpleNetDevice6 (node1, ipaddr1, prefix);
361 
362  Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
363  dev0->SetChannel (channel);
364  dev1->SetChannel (channel);
365 
366  Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> ();
367  Ptr<SocketFactory> sockFactory1 = node1->GetObject<TcpSocketFactory> ();
368 
369  Ptr<Socket> server = sockFactory0->CreateSocket ();
370  Ptr<Socket> source = sockFactory1->CreateSocket ();
371 
372  uint16_t port = 50000;
373  Inet6SocketAddress serverlocaladdr (Ipv6Address::GetAny (), port);
374  Inet6SocketAddress serverremoteaddr (ipaddr0, port);
375 
376  server->Bind (serverlocaladdr);
377  server->Listen ();
378  server->SetAcceptCallback (MakeNullCallback<bool, Ptr< Socket >, const Address &> (),
380 
383 
384  source->Connect (serverremoteaddr);
385 }
386 
387 Ptr<Node>
389 {
390  Ptr<Node> node = CreateObject<Node> ();
391  //IPV6
392  Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
393  //Routing for Ipv6
394  Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
395  ipv6->SetRoutingProtocol (ipv6Routing);
396  Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
397  ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
398  node->AggregateObject (ipv6);
399  //ICMP
400  Ptr<Icmpv6L4Protocol> icmp = CreateObject<Icmpv6L4Protocol> ();
401  node->AggregateObject (icmp);
402  //Ipv6 Extensions
403  ipv6->RegisterExtensions ();
404  ipv6->RegisterOptions ();
405  //UDP
406  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
407  node->AggregateObject (udp);
408  //TCP
409  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
410  node->AggregateObject (tcp);
411  return node;
412 }
413 
416 {
417  Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
418  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
419  node->AddDevice (dev);
420  Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
421  uint32_t ndid = ipv6->AddInterface (dev);
422  Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (ipaddr, prefix);
423  ipv6->AddAddress (ndid, ipv6Addr);
424  ipv6->SetUp (ndid);
425  return dev;
426 }
427 
428 static class TcpTestSuite : public TestSuite
429 {
430 public:
432  : TestSuite ("tcp", UNIT)
433  {
434  // Arguments to these test cases are 1) totalStreamSize,
435  // 2) source write size, 3) source read size
436  // 4) server write size, and 5) server read size
437  // with units of bytes
438  AddTestCase (new TcpTestCase (13, 200, 200, 200, 200, false), TestCase::QUICK);
439  AddTestCase (new TcpTestCase (13, 1, 1, 1, 1, false), TestCase::QUICK);
440  AddTestCase (new TcpTestCase (100000, 100, 50, 100, 20, false), TestCase::QUICK);
441 
442  AddTestCase (new TcpTestCase (13, 200, 200, 200, 200, true), TestCase::QUICK);
443  AddTestCase (new TcpTestCase (13, 1, 1, 1, 1, true), TestCase::QUICK);
444  AddTestCase (new TcpTestCase (100000, 100, 50, 100, 20, true), TestCase::QUICK);
445  }
446 
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
an Inet address class
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:79
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:210
A suite of tests to run.
Definition: test.h:1025
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:180
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tcp-test.cc:143
bool m_useIpv6
Definition: tcp-test.cc:94
IPv6 address associated with an interface.
uint32_t GetSize(void) const
Definition: packet.h:650
TcpTestSuite g_tcpTestSuite
virtual Ptr< Socket > CreateSocket(void)=0
void SourceHandleRecv(Ptr< Socket > sock)
Definition: tcp-test.cc:252
Callback< R > MakeNullCallback(void)
Definition: callback.h:1395
encapsulates test code
Definition: test.h:849
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:316
virtual enum Socket::SocketErrno GetErrno(void) const =0
Get last error number.
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
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:120
NS_LOG_COMPONENT_DEFINE("TcpTestSuite")
uint8_t * m_sourceTxPayload
Definition: tcp-test.cc:90
void SourceHandleSend(Ptr< Socket > sock, uint32_t available)
Definition: tcp-test.cc:236
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
#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:244
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:1238
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
Definition: socket.cc:128
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:71
void AggregateObject(Ptr< Object > other)
Definition: object.cc:243
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:75
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:173
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
Definition: socket.cc:121
Ptr< Node > CreateInternetNode6(void)
Definition: tcp-test.cc:388
Ptr< SimpleNetDevice > AddSimpleNetDevice(Ptr< Node > node, const char *ipaddr, const char *netmask)
Definition: tcp-test.cc:302
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
void ServerHandleRecv(Ptr< Socket > sock)
Definition: tcp-test.cc:196
static std::string GetString(Ptr< Packet > p)
Definition: tcp-test.cc:112
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:415
uint32_t AddDevice(Ptr< NetDevice > device)
Definition: node.cc:118
a class to store IPv4 address information on an interface
void SetupDefaultSim6(void)
Definition: tcp-test.cc:352
virtual void SetAddress(Address address)
Set the address of this interface.
#define NS_LOG_DEBUG(msg)
Definition: log.h:289
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:189
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:1035
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:361
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:216
uint32_t m_currentSourceRxBytes
Definition: tcp-test.cc:87
Ptr< Node > CreateInternetNode(void)
Definition: tcp-test.cc:275
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.