A Discrete-Event Network Simulator
API
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/arp-l3-protocol.h"
42 #include "ns3/ipv4-l3-protocol.h"
43 #include "ns3/ipv6-l3-protocol.h"
44 #include "ns3/icmpv4-l4-protocol.h"
45 #include "ns3/icmpv6-l4-protocol.h"
46 #include "ns3/udp-l4-protocol.h"
47 #include "ns3/tcp-l4-protocol.h"
48 
49 #include <string>
50 
51 using namespace ns3;
52 
53 NS_LOG_COMPONENT_DEFINE ("TcpTestSuite");
54 
55 class TcpTestCase : public TestCase
56 {
57 public:
58  TcpTestCase (uint32_t totalStreamSize,
59  uint32_t sourceWriteSize,
60  uint32_t sourceReadSize,
61  uint32_t serverWriteSize,
62  uint32_t serverReadSize,
63  bool useIpv6);
64 private:
65  virtual void DoRun (void);
66  virtual void DoTeardown (void);
67  void SetupDefaultSim (void);
68  void SetupDefaultSim6 (void);
69 
70  Ptr<Node> CreateInternetNode (void);
71  Ptr<Node> CreateInternetNode6 (void);
72  Ptr<SimpleNetDevice> AddSimpleNetDevice (Ptr<Node> node, const char* ipaddr, const char* netmask);
73  Ptr<SimpleNetDevice> AddSimpleNetDevice6 (Ptr<Node> node, Ipv6Address ipaddr, Ipv6Prefix prefix);
74  void ServerHandleConnectionCreated (Ptr<Socket> s, const Address & addr);
75  void ServerHandleRecv (Ptr<Socket> sock);
76  void ServerHandleSend (Ptr<Socket> sock, uint32_t available);
77  void SourceHandleSend (Ptr<Socket> sock, uint32_t available);
78  void SourceHandleRecv (Ptr<Socket> sock);
79 
80  uint32_t m_totalBytes;
82  uint32_t m_sourceReadSize;
84  uint32_t m_serverReadSize;
92 
93  bool m_useIpv6;
94 };
95 
96 static std::string Name (std::string str, uint32_t totalStreamSize,
97  uint32_t sourceWriteSize,
98  uint32_t serverReadSize,
99  uint32_t serverWriteSize,
100  uint32_t sourceReadSize,
101  bool useIpv6)
102 {
103  std::ostringstream oss;
104  oss << str << " total=" << totalStreamSize << " sourceWrite=" << sourceWriteSize
105  << " sourceRead=" << sourceReadSize << " serverRead=" << serverReadSize
106  << " serverWrite=" << serverWriteSize << " useIpv6=" << useIpv6;
107  return oss.str ();
108 }
109 
110 static inline std::string GetString (Ptr<Packet> p)
111 {
112  std::ostringstream oss;
113  p->CopyData (&oss, p->GetSize ());
114  return oss.str ();
115 }
116 
117 TcpTestCase::TcpTestCase (uint32_t totalStreamSize,
118  uint32_t sourceWriteSize,
119  uint32_t sourceReadSize,
120  uint32_t serverWriteSize,
121  uint32_t serverReadSize,
122  bool useIpv6)
123  : TestCase (Name ("Send string data from client to server and back",
124  totalStreamSize,
125  sourceWriteSize,
126  serverReadSize,
127  serverWriteSize,
128  sourceReadSize,
129  useIpv6)),
130  m_totalBytes (totalStreamSize),
131  m_sourceWriteSize (sourceWriteSize),
132  m_sourceReadSize (sourceReadSize),
133  m_serverWriteSize (serverWriteSize),
134  m_serverReadSize (serverReadSize),
135  m_useIpv6 (useIpv6)
136 {
137 }
138 
139 void
141 {
146  m_sourceTxPayload = new uint8_t [m_totalBytes];
147  m_sourceRxPayload = new uint8_t [m_totalBytes];
148  m_serverRxPayload = new uint8_t [m_totalBytes];
149  for(uint32_t i = 0; i < m_totalBytes; ++i)
150  {
151  uint8_t m = (uint8_t)(97 + (i % 26));
152  m_sourceTxPayload[i] = m;
153  }
154  memset (m_sourceRxPayload, 0, m_totalBytes);
155  memset (m_serverRxPayload, 0, m_totalBytes);
156 
157  if (m_useIpv6 == true)
158  {
159  SetupDefaultSim6 ();
160  }
161  else
162  {
163  SetupDefaultSim ();
164  }
165 
166  Simulator::Run ();
167 
168  NS_TEST_EXPECT_MSG_EQ (m_currentSourceTxBytes, m_totalBytes, "Source sent all bytes");
169  NS_TEST_EXPECT_MSG_EQ (m_currentServerRxBytes, m_totalBytes, "Server received all bytes");
170  NS_TEST_EXPECT_MSG_EQ (m_currentSourceRxBytes, m_totalBytes, "Source received all bytes");
171  NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_serverRxPayload, m_totalBytes), 0,
172  "Server received expected data buffers");
173  NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_sourceRxPayload, m_totalBytes), 0,
174  "Source received back expected data buffers");
175 }
176 void
178 {
179  delete [] m_sourceTxPayload;
180  delete [] m_sourceRxPayload;
181  delete [] m_serverRxPayload;
182  Simulator::Destroy ();
183 }
184 
185 void
187 {
190 }
191 
192 void
194 {
195  while (sock->GetRxAvailable () > 0)
196  {
197  uint32_t toRead = std::min (m_serverReadSize, sock->GetRxAvailable ());
198  Ptr<Packet> p = sock->Recv (toRead, 0);
199  if (p == 0 && sock->GetErrno () != Socket::ERROR_NOTERROR)
200  {
201  NS_FATAL_ERROR ("Server could not read stream at byte " << m_currentServerRxBytes);
202  }
203  NS_TEST_EXPECT_MSG_EQ ((m_currentServerRxBytes + p->GetSize () <= m_totalBytes), true,
204  "Server received too many bytes");
205  NS_LOG_DEBUG ("Server recv data=\"" << GetString (p) << "\"");
206  p->CopyData (&m_serverRxPayload[m_currentServerRxBytes], p->GetSize ());
207  m_currentServerRxBytes += p->GetSize ();
208  ServerHandleSend (sock, sock->GetTxAvailable ());
209  }
210 }
211 
212 void
213 TcpTestCase::ServerHandleSend (Ptr<Socket> sock, uint32_t available)
214 {
216  {
218  uint32_t toSend = std::min (left, sock->GetTxAvailable ());
219  toSend = std::min (toSend, m_serverWriteSize);
220  Ptr<Packet> p = Create<Packet> (&m_serverRxPayload[m_currentServerTxBytes], toSend);
221  NS_LOG_DEBUG ("Server send data=\"" << GetString (p) << "\"");
222  int sent = sock->Send (p);
223  NS_TEST_EXPECT_MSG_EQ ((sent != -1), true, "Server error during send ?");
224  m_currentServerTxBytes += sent;
225  }
227  {
228  sock->Close ();
229  }
230 }
231 
232 void
233 TcpTestCase::SourceHandleSend (Ptr<Socket> sock, uint32_t available)
234 {
235  while (sock->GetTxAvailable () > 0 && m_currentSourceTxBytes < m_totalBytes)
236  {
237  uint32_t left = m_totalBytes - m_currentSourceTxBytes;
238  uint32_t toSend = std::min (left, sock->GetTxAvailable ());
239  toSend = std::min (toSend, m_sourceWriteSize);
240  Ptr<Packet> p = Create<Packet> (&m_sourceTxPayload[m_currentSourceTxBytes], toSend);
241  NS_LOG_DEBUG ("Source send data=\"" << GetString (p) << "\"");
242  int sent = sock->Send (p);
243  NS_TEST_EXPECT_MSG_EQ ((sent != -1), true, "Error during send ?");
244  m_currentSourceTxBytes += sent;
245  }
246 }
247 
248 void
250 {
251  while (sock->GetRxAvailable () > 0 && m_currentSourceRxBytes < m_totalBytes)
252  {
253  uint32_t toRead = std::min (m_sourceReadSize, sock->GetRxAvailable ());
254  Ptr<Packet> p = sock->Recv (toRead, 0);
255  if (p == 0 && sock->GetErrno () != Socket::ERROR_NOTERROR)
256  {
257  NS_FATAL_ERROR ("Source could not read stream at byte " << m_currentSourceRxBytes);
258  }
259  NS_TEST_EXPECT_MSG_EQ ((m_currentSourceRxBytes + p->GetSize () <= m_totalBytes), true,
260  "Source received too many bytes");
261  NS_LOG_DEBUG ("Source recv data=\"" << GetString (p) << "\"");
262  p->CopyData (&m_sourceRxPayload[m_currentSourceRxBytes], p->GetSize ());
263  m_currentSourceRxBytes += p->GetSize ();
264  }
266  {
267  sock->Close ();
268  }
269 }
270 
271 Ptr<Node>
273 {
274  Ptr<Node> node = CreateObject<Node> ();
275  //ARP
276  Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
277  node->AggregateObject (arp);
278  //IPV4
279  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
280  //Routing for Ipv4
281  Ptr<Ipv4ListRouting> ipv4Routing = CreateObject<Ipv4ListRouting> ();
282  ipv4->SetRoutingProtocol (ipv4Routing);
283  Ptr<Ipv4StaticRouting> ipv4staticRouting = CreateObject<Ipv4StaticRouting> ();
284  ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
285  node->AggregateObject (ipv4);
286  //ICMP
287  Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
288  node->AggregateObject (icmp);
289  //UDP
290  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
291  node->AggregateObject (udp);
292  //TCP
293  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
294  node->AggregateObject (tcp);
295  return node;
296 }
297 
299 TcpTestCase::AddSimpleNetDevice (Ptr<Node> node, const char* ipaddr, const char* netmask)
300 {
301  Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
302  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
303  node->AddDevice (dev);
304  Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
305  uint32_t ndid = ipv4->AddInterface (dev);
306  Ipv4InterfaceAddress ipv4Addr = Ipv4InterfaceAddress (Ipv4Address (ipaddr), Ipv4Mask (netmask));
307  ipv4->AddAddress (ndid, ipv4Addr);
308  ipv4->SetUp (ndid);
309  return dev;
310 }
311 
312 void
314 {
315  const char* netmask = "255.255.255.0";
316  const char* ipaddr0 = "192.168.1.1";
317  const char* ipaddr1 = "192.168.1.2";
318  Ptr<Node> node0 = CreateInternetNode ();
319  Ptr<Node> node1 = CreateInternetNode ();
320  Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice (node0, ipaddr0, netmask);
321  Ptr<SimpleNetDevice> dev1 = AddSimpleNetDevice (node1, ipaddr1, netmask);
322 
323  Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
324  dev0->SetChannel (channel);
325  dev1->SetChannel (channel);
326 
327  Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> ();
328  Ptr<SocketFactory> sockFactory1 = node1->GetObject<TcpSocketFactory> ();
329 
330  Ptr<Socket> server = sockFactory0->CreateSocket ();
331  Ptr<Socket> source = sockFactory1->CreateSocket ();
332 
333  uint16_t port = 50000;
334  InetSocketAddress serverlocaladdr (Ipv4Address::GetAny (), port);
335  InetSocketAddress serverremoteaddr (Ipv4Address (ipaddr0), port);
336 
337  server->Bind (serverlocaladdr);
338  server->Listen ();
339  server->SetAcceptCallback (MakeNullCallback<bool, Ptr< Socket >, const Address &> (),
341 
344 
345  source->Connect (serverremoteaddr);
346 }
347 
348 void
350 {
351  Ipv6Prefix prefix = Ipv6Prefix(64);
352  Ipv6Address ipaddr0 = Ipv6Address("2001:0100:f00d:cafe::1");
353  Ipv6Address ipaddr1 = Ipv6Address("2001:0100:f00d:cafe::2");
354  Ptr<Node> node0 = CreateInternetNode6 ();
355  Ptr<Node> node1 = CreateInternetNode6 ();
356  Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice6 (node0, ipaddr0, prefix);
357  Ptr<SimpleNetDevice> dev1 = AddSimpleNetDevice6 (node1, ipaddr1, prefix);
358 
359  Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
360  dev0->SetChannel (channel);
361  dev1->SetChannel (channel);
362 
363  Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> ();
364  Ptr<SocketFactory> sockFactory1 = node1->GetObject<TcpSocketFactory> ();
365 
366  Ptr<Socket> server = sockFactory0->CreateSocket ();
367  Ptr<Socket> source = sockFactory1->CreateSocket ();
368 
369  uint16_t port = 50000;
370  Inet6SocketAddress serverlocaladdr (Ipv6Address::GetAny (), port);
371  Inet6SocketAddress serverremoteaddr (ipaddr0, port);
372 
373  server->Bind (serverlocaladdr);
374  server->Listen ();
375  server->SetAcceptCallback (MakeNullCallback<bool, Ptr< Socket >, const Address &> (),
377 
380 
381  source->Connect (serverremoteaddr);
382 }
383 
384 Ptr<Node>
386 {
387  Ptr<Node> node = CreateObject<Node> ();
388  //IPV6
389  Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
390  //Routing for Ipv6
391  Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
392  ipv6->SetRoutingProtocol (ipv6Routing);
393  Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
394  ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
395  node->AggregateObject (ipv6);
396  //ICMP
397  Ptr<Icmpv6L4Protocol> icmp = CreateObject<Icmpv6L4Protocol> ();
398  node->AggregateObject (icmp);
399  //Ipv6 Extensions
400  ipv6->RegisterExtensions ();
401  ipv6->RegisterOptions ();
402  //UDP
403  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
404  node->AggregateObject (udp);
405  //TCP
406  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
407  node->AggregateObject (tcp);
408  return node;
409 }
410 
413 {
414  Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
415  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
416  node->AddDevice (dev);
417  Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
418  uint32_t ndid = ipv6->AddInterface (dev);
419  Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (ipaddr, prefix);
420  ipv6->AddAddress (ndid, ipv6Addr);
421  ipv6->SetUp (ndid);
422  return dev;
423 }
424 
425 static class TcpTestSuite : public TestSuite
426 {
427 public:
429  : TestSuite ("tcp", UNIT)
430  {
431  // Arguments to these test cases are 1) totalStreamSize,
432  // 2) source write size, 3) source read size
433  // 4) server write size, and 5) server read size
434  // with units of bytes
435  AddTestCase (new TcpTestCase (13, 200, 200, 200, 200, false), TestCase::QUICK);
436  AddTestCase (new TcpTestCase (13, 1, 1, 1, 1, false), TestCase::QUICK);
437  AddTestCase (new TcpTestCase (100000, 100, 50, 100, 20, false), TestCase::QUICK);
438 
439  AddTestCase (new TcpTestCase (13, 200, 200, 200, 200, true), TestCase::QUICK);
440  AddTestCase (new TcpTestCase (13, 1, 1, 1, 1, true), TestCase::QUICK);
441  AddTestCase (new TcpTestCase (100000, 100, 50, 100, 20, true), TestCase::QUICK);
442  }
443 
tuple channel
Definition: third.py:85
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
an Inet address class
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:455
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:80
uint32_t m_currentServerTxBytes
Definition: tcp-test.cc:88
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:226
A suite of tests to run.
Definition: test.h:1333
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:246
uint32_t m_sourceReadSize
Definition: tcp-test.cc:82
uint32_t m_currentServerRxBytes
Definition: tcp-test.cc:87
uint8_t * m_serverRxPayload
Definition: tcp-test.cc:91
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Definition: tcp-test.cc:177
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tcp-test.cc:140
bool m_useIpv6
Definition: tcp-test.cc:93
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
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:278
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:786
TcpTestSuite g_tcpTestSuite
virtual Ptr< Socket > CreateSocket(void)=0
void SourceHandleRecv(Ptr< Socket > sock)
Definition: tcp-test.cc:249
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:145
Callback< R > MakeNullCallback(void)
Definition: callback.h:1626
encapsulates test code
Definition: test.h:1147
This test suite implements a Unit Test.
Definition: test.h:1343
uint32_t m_serverWriteSize
Definition: tcp-test.cc:83
uint32_t m_serverReadSize
Definition: tcp-test.cc:84
void SetupDefaultSim(void)
Definition: tcp-test.cc:313
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:90
TcpTestCase(uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t sourceReadSize, uint32_t serverWriteSize, uint32_t serverReadSize, bool useIpv6)
Definition: tcp-test.cc:117
uint8_t * m_sourceTxPayload
Definition: tcp-test.cc:89
void SourceHandleSend(Ptr< Socket > sock, uint32_t available)
Definition: tcp-test.cc:233
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:96
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Definition: test.cc:297
virtual void SetUp(uint32_t interface)=0
An Inet6 address class.
uint32_t m_currentSourceTxBytes
Definition: tcp-test.cc:85
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1480
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
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_sourceWriteSize
Definition: tcp-test.cc:81
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
uint8_t * m_sourceRxPayload
Definition: tcp-test.cc:90
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:385
Ptr< SimpleNetDevice > AddSimpleNetDevice(Ptr< Node > node, const char *ipaddr, const char *netmask)
Definition: tcp-test.cc:299
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
void ServerHandleRecv(Ptr< Socket > sock)
Definition: tcp-test.cc:193
static std::string GetString(Ptr< Packet > p)
Definition: tcp-test.cc:110
Describes an IPv6 address.
Definition: ipv6-address.h:47
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
Ptr< SimpleNetDevice > AddSimpleNetDevice6(Ptr< Node > node, Ipv6Address ipaddr, Ipv6Prefix prefix)
Definition: tcp-test.cc:412
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:121
a class to store IPv4 address information on an interface
void SetupDefaultSim6(void)
Definition: tcp-test.cc:349
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:236
Describes an IPv6 prefix.
Definition: ipv6-address.h:389
virtual bool AddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
void ServerHandleConnectionCreated(Ptr< Socket > s, const Address &addr)
Definition: tcp-test.cc:186
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:354
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.
uint32_t m_totalBytes
Definition: tcp-test.cc:80
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:213
uint32_t m_currentSourceRxBytes
Definition: tcp-test.cc:86
Ptr< Node > CreateInternetNode(void)
Definition: tcp-test.cc:272
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.