A Discrete-Event Network Simulator
API
ipv6-fragmentation-test.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Universita' di Firenze, Italy
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: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19  */
26 #include "ns3/test.h"
27 #include "ns3/config.h"
28 #include "ns3/uinteger.h"
29 #include "ns3/socket-factory.h"
30 #include "ns3/ipv4-raw-socket-factory.h"
31 #include "ns3/ipv6-raw-socket-factory.h"
32 #include "ns3/udp-socket-factory.h"
33 #include "ns3/simulator.h"
34 #include "ns3/simple-net-device.h"
35 #include "ns3/socket.h"
36 #include "ns3/udp-socket.h"
37 
38 #include "ns3/log.h"
39 #include "ns3/node.h"
40 #include "ns3/inet-socket-address.h"
41 #include "ns3/boolean.h"
42 
43 #include "ns3/ipv6-static-routing.h"
44 #include "ns3/ipv6-list-routing.h"
45 #include "ns3/inet6-socket-address.h"
46 #
47 #include "ns3/arp-l3-protocol.h"
48 #include "ns3/ipv4-l3-protocol.h"
49 #include "ns3/icmpv4-l4-protocol.h"
50 #include "ns3/ipv4-list-routing.h"
51 #include "ns3/ipv4-static-routing.h"
52 #include "ns3/udp-l4-protocol.h"
53 
54 #include "ns3/ipv6-l3-protocol.h"
55 #include "ns3/icmpv6-l4-protocol.h"
56 #include "ns3/traffic-control-layer.h"
57 #include "ns3/internet-stack-helper.h"
58 #include "ns3/error-channel.h"
59 
60 #include <string>
61 #include <limits>
62 #include <netinet/in.h>
63 
64 using namespace ns3;
65 
66 class UdpSocketImpl;
67 
74 class IPv6TestTag : public Tag {
75 private:
76  uint64_t token;
77 public:
82  static TypeId GetTypeId () {
83  static TypeId tid = TypeId ("ns3::IPv6TestTag").SetParent<Tag> ().AddConstructor<IPv6TestTag> ();
84  return tid;
85  }
86  virtual TypeId GetInstanceTypeId () const { return GetTypeId (); }
87  virtual uint32_t GetSerializedSize () const { return sizeof (token); }
88  virtual void Serialize (TagBuffer buffer) const { buffer.WriteU64 (token); }
89  virtual void Deserialize (TagBuffer buffer) { token = buffer.ReadU64 (); }
90  virtual void Print (std::ostream &os) const { os << "token=" << token; }
95  void SetToken (uint64_t token) { this->token = token; }
100  uint64_t GetToken () { return token; }
101 };
102 
103 
111 {
115 
116 
119  uint32_t m_dataSize;
120  uint8_t *m_data;
121  uint32_t m_size;
122  uint8_t m_icmpType;
123  uint8_t m_icmpCode;
124 
125 public:
126  virtual void DoRun (void);
129 
130  // server part
131 
136  void StartServer (Ptr<Node> ServerNode);
141  void HandleReadServer (Ptr<Socket> socket);
142 
143  // client part
144 
149  void StartClient (Ptr<Node> ClientNode);
154  void HandleReadClient (Ptr<Socket> socket);
163  void HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType,
164  uint8_t icmpCode, uint32_t icmpInfo);
165 
172  void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize);
173 
178  Ptr<Packet> SendClient (void);
179 };
180 
181 
183  : TestCase ("Verify the IPv6 layer 3 protocol fragmentation and reassembly")
184 {
185  m_socketServer = 0;
186  m_data = 0;
187  m_dataSize = 0;
188  m_size = 0;
189  m_icmpType = 0;
190  m_icmpCode = 0;
191 }
192 
194 {
195  if ( m_data )
196  {
197  delete[] m_data;
198  }
199  m_data = 0;
200  m_dataSize = 0;
201 }
202 
203 
204 void
206 {
207 
208  if (m_socketServer == 0)
209  {
210  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
211  m_socketServer = Socket::CreateSocket (ServerNode, tid);
212  Inet6SocketAddress local = Inet6SocketAddress (Ipv6Address ("2001::1"), 9);
213  m_socketServer->Bind (local);
214  Ptr<UdpSocket> udpSocket = DynamicCast<UdpSocket> (m_socketServer);
215  }
216 
218 }
219 
220 void
222 {
223  Ptr<Packet> packet;
224  Address from;
225  while ((packet = socket->RecvFrom (from)))
226  {
227  if (Inet6SocketAddress::IsMatchingType (from))
228  {
229  m_receivedPacketServer = packet->Copy ();
230  }
231  }
232 }
233 
234 void
236 {
237 
238  if (m_socketClient == 0)
239  {
240  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
241  m_socketClient = Socket::CreateSocket (ClientNode, tid);
242  m_socketClient->Bind (Inet6SocketAddress (Ipv6Address::GetAny (), 9));
245  m_socketClient->SetAttribute ("IcmpCallback6", cbValue);
246  }
247 
249 }
250 
251 void
253 {
254  Ptr<Packet> packet;
255  Address from;
256  while ((packet = socket->RecvFrom (from)))
257  {
258  if (Inet6SocketAddress::IsMatchingType (from))
259  {
260  m_receivedPacketClient = packet->Copy ();
261  }
262  }
263 }
264 
265 void
267  uint8_t icmpTtl, uint8_t icmpType,
268  uint8_t icmpCode, uint32_t icmpInfo)
269 {
270  m_icmpType = icmpType;
271  m_icmpCode = icmpCode;
272 }
273 
274 void
275 Ipv6FragmentationTest::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
276 {
277  if (dataSize != m_dataSize)
278  {
279  delete [] m_data;
280  m_data = new uint8_t [dataSize];
281  m_dataSize = dataSize;
282  }
283 
284  if (fillSize >= dataSize)
285  {
286  memcpy (m_data, fill, dataSize);
287  return;
288  }
289 
290  uint32_t filled = 0;
291  while (filled + fillSize < dataSize)
292  {
293  memcpy (&m_data[filled], fill, fillSize);
294  filled += fillSize;
295  }
296 
297  memcpy (&m_data[filled], fill, dataSize - filled);
298 
299  m_size = dataSize;
300 }
301 
303 {
304  Ptr<Packet> p;
305  if (m_dataSize)
306  {
307  p = Create<Packet> (m_data, m_dataSize);
308  }
309  else
310  {
311  p = Create<Packet> (m_size);
312  }
313  IPv6TestTag tag;
314  tag.SetToken (42);
315  p->AddPacketTag (tag);
316  p->AddByteTag (tag);
317 
318  m_socketClient->Send (p);
319 
320  return p;
321 }
322 
323 void
325 {
326  // Create topology
327 
328  InternetStackHelper internet;
329  internet.SetIpv4StackInstall (false);
330 
331  // Receiver Node
332  Ptr<Node> serverNode = CreateObject<Node> ();
333  internet.Install (serverNode);
334  Ptr<SimpleNetDevice> serverDev;
335  Ptr<BinaryErrorModel> serverDevErrorModel = CreateObject<BinaryErrorModel> ();
336  {
337  serverDev = CreateObject<SimpleNetDevice> ();
338  serverDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
339  serverDev->SetMtu (1500);
340  serverDev->SetReceiveErrorModel (serverDevErrorModel);
341  serverDevErrorModel->Disable ();
342  serverNode->AddDevice (serverDev);
343  Ptr<Ipv6> ipv6 = serverNode->GetObject<Ipv6> ();
344  uint32_t netdev_idx = ipv6->AddInterface (serverDev);
345  Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001::1"), Ipv6Prefix (32));
346  ipv6->AddAddress (netdev_idx, ipv6Addr);
347  ipv6->SetUp (netdev_idx);
348  }
349  StartServer (serverNode);
350 
351  // Sender Node
352  Ptr<Node> clientNode = CreateObject<Node> ();
353  internet.Install (clientNode);
354  Ptr<SimpleNetDevice> clientDev;
355  Ptr<BinaryErrorModel> clientDevErrorModel = CreateObject<BinaryErrorModel> ();
356  {
357  clientDev = CreateObject<SimpleNetDevice> ();
358  clientDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
359  clientDev->SetMtu (1500);
360  clientDev->SetReceiveErrorModel (clientDevErrorModel);
361  clientDevErrorModel->Disable ();
362  clientNode->AddDevice (clientDev);
363  Ptr<Ipv6> ipv6 = clientNode->GetObject<Ipv6> ();
364  uint32_t netdev_idx = ipv6->AddInterface (clientDev);
365  Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001::2"), Ipv6Prefix (32));
366  ipv6->AddAddress (netdev_idx, ipv6Addr);
367  ipv6->SetUp (netdev_idx);
368  }
369  StartClient (clientNode);
370 
371  // link the two nodes
372  Ptr<ErrorChannel> channel = CreateObject<ErrorChannel> ();
373  serverDev->SetChannel (channel);
374  clientDev->SetChannel (channel);
375  channel->SetJumpingTime (Seconds (0.5));
376 
377 
378  // some small packets, some rather big ones
379  uint32_t packetSizes[5] = {2000, 2500, 5000, 10000, 65000};
380 
381  // using the alphabet
382  uint8_t fillData[78];
383  for ( uint32_t k = 48; k <= 125; k++ )
384  {
385  fillData[k - 48] = k;
386  }
387 
388  // First test: normal channel, no errors, no delays
389  for ( int i = 0; i < 5; i++)
390  {
391  uint32_t packetSize = packetSizes[i];
392 
393  SetFill (fillData, 78, packetSize);
394 
395  m_receivedPacketServer = Create<Packet> ();
396  Simulator::ScheduleWithContext (m_socketClient->GetNode ()->GetId (), Seconds (0),
398  Simulator::Run ();
399 
400  uint8_t recvBuffer[65000];
401 
402  uint16_t recvSize = m_receivedPacketServer->GetSize ();
403 
404  NS_TEST_EXPECT_MSG_EQ (recvSize, packetSizes[i],
405  "Packet size not correct: recvSize: " << recvSize << " packetSizes[" << i << "]: " << packetSizes[i] );
406 
407  m_receivedPacketServer->CopyData (recvBuffer, 65000);
408  NS_TEST_EXPECT_MSG_EQ (memcmp (m_data, recvBuffer, m_receivedPacketServer->GetSize ()),
409  0, "Packet content differs");
410  }
411 
412  // Second test: normal channel, no errors, delays each 2 packets.
413  // Each other fragment will arrive out-of-order.
414  // The packets should be received correctly since reassembly will reorder the fragments.
415  channel->SetJumpingMode (true);
416  for ( int i = 0; i < 5; i++)
417  {
418  uint32_t packetSize = packetSizes[i];
419 
420  SetFill (fillData, 78, packetSize);
421 
422  m_receivedPacketServer = Create<Packet> ();
423  Simulator::ScheduleWithContext (m_socketClient->GetNode ()->GetId (), Seconds (0),
425  Simulator::Run ();
426 
427  uint8_t recvBuffer[65000];
428 
429  uint16_t recvSize = m_receivedPacketServer->GetSize ();
430 
431  NS_TEST_EXPECT_MSG_EQ (recvSize, packetSizes[i],
432  "Packet size not correct: recvSize: " << recvSize << " packetSizes[" << i << "]: " << packetSizes[i] );
433 
434  m_receivedPacketServer->CopyData (recvBuffer, 65000);
435  NS_TEST_EXPECT_MSG_EQ (memcmp (m_data, recvBuffer, m_receivedPacketServer->GetSize ()),
436  0, "Packet content differs");
437  }
438  channel->SetJumpingMode (false);
439 
440  // Third test: normal channel, some errors, no delays.
441  // The reassembly procedure should fire a timeout after 30 seconds (as specified in the RFCs).
442  // Upon the timeout, the fragments received so far are discarded and an ICMP should be sent back
443  // to the sender (if the first fragment has been received).
444  // In this test case the first fragment is received, so we do expect an ICMP.
445  // Client -> Server : errors enabled
446  // Server -> Client : errors disabled (we want to have back the ICMP)
447  clientDevErrorModel->Disable ();
448  serverDevErrorModel->Enable ();
449  for ( int i = 1; i < 5; i++)
450  {
451  uint32_t packetSize = packetSizes[i];
452 
453  SetFill (fillData, 78, packetSize);
454 
455  // reset the model, we want to receive the very first fragment.
456  serverDevErrorModel->Reset ();
457 
458  m_receivedPacketServer = Create<Packet> ();
459  m_icmpType = 0;
460  m_icmpCode = 0;
461  Simulator::ScheduleWithContext (m_socketClient->GetNode ()->GetId (), Seconds (0),
463  Simulator::Run ();
464 
465  uint16_t recvSize = m_receivedPacketServer->GetSize ();
466 
467  NS_TEST_EXPECT_MSG_EQ ((recvSize == 0), true, "Server got a packet, something wrong");
468  NS_TEST_EXPECT_MSG_EQ ((m_icmpType == Icmpv6Header::ICMPV6_ERROR_TIME_EXCEEDED)
469  && (m_icmpCode == Icmpv6Header::ICMPV6_FRAGTIME),
470  true, "Client did not receive ICMPv6::TIME_EXCEEDED " << int(m_icmpType) << int(m_icmpCode) );
471  }
472 
473  // Fourth test: normal channel, no errors, no delays.
474  // We check tags
475  clientDevErrorModel->Disable ();
476  serverDevErrorModel->Disable ();
477  for (int i= 0; i<5; i++)
478  {
479  uint32_t packetSize = packetSizes[i];
480 
481  SetFill (fillData, 78, packetSize);
482 
483  m_receivedPacketServer = Create<Packet> ();
484  Simulator::ScheduleWithContext (m_socketClient->GetNode ()->GetId (), Seconds (0),
486  Simulator::Run ();
487 
488  IPv6TestTag packetTag;
489  bool found = m_receivedPacketServer->PeekPacketTag (packetTag);
490 
491  NS_TEST_EXPECT_MSG_EQ (found, true, "PacketTag not found");
492  NS_TEST_EXPECT_MSG_EQ (packetTag.GetToken (), 42, "PacketTag value not correct");
493 
495 
496  uint32_t end = 0;
497  uint32_t tagStart = 0;
498  uint32_t tagEnd = 0;
499  while (iter.HasNext ())
500  {
501  ByteTagIterator::Item item = iter.Next ();
502  NS_TEST_EXPECT_MSG_EQ (item.GetTypeId ().GetName (), "ns3::IPv6TestTag", "ByteTag name not correct");
503  tagStart = item.GetStart ();
504  tagEnd = item.GetEnd ();
505  if (end == 0)
506  {
507  NS_TEST_EXPECT_MSG_EQ (tagStart, 0, "First ByteTag Start not correct");
508  }
509  if (end != 0)
510  {
511  NS_TEST_EXPECT_MSG_EQ (tagStart, end, "ByteTag End not correct");
512  }
513  end = tagEnd;
514  IPv6TestTag *byteTag = dynamic_cast<IPv6TestTag *> (item.GetTypeId ().GetConstructor () ());
515  NS_TEST_EXPECT_MSG_NE (byteTag, 0, "ByteTag not found");
516  item.GetTag (*byteTag);
517  NS_TEST_EXPECT_MSG_EQ (byteTag->GetToken (), 42, "ByteTag value not correct");
518  delete byteTag;
519  }
521  }
522 
523  Simulator::Destroy ();
524 }
525 
526 
534 {
535 public:
536  Ipv6FragmentationTestSuite () : TestSuite ("ipv6-fragmentation", UNIT)
537  {
538  AddTestCase (new Ipv6FragmentationTest, TestCase::QUICK);
539  }
540 };
541 
543 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::Ipv6InterfaceAddress
IPv6 address associated with an interface.
Definition: ipv6-interface-address.h:38
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
Ipv6FragmentationTest::m_size
uint32_t m_size
packet size.
Definition: ipv6-fragmentation-test.cc:121
Ipv6FragmentationTest::StartClient
void StartClient(Ptr< Node > ClientNode)
Start the client.
Definition: ipv6-fragmentation-test.cc:235
ns3::ByteTagIterator::Item::GetTypeId
TypeId GetTypeId(void) const
Definition: packet.cc:34
ns3::Socket::Bind
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Ipv6FragmentationTest::StartServer
void StartServer(Ptr< Node > ServerNode)
Start the server.
Definition: ipv6-fragmentation-test.cc:205
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Node::GetId
uint32_t GetId(void) const
Definition: node.cc:109
ns3::ByteTagIterator::Item::GetTag
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Definition: packet.cc:49
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv6::AddInterface
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
ns3::ByteTagIterator::Next
Item Next(void)
Definition: packet.cc:70
ns3::Socket::GetNode
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
IPv6TestTag::Print
virtual void Print(std::ostream &os) const
Definition: ipv6-fragmentation-test.cc:90
Ipv6FragmentationTest::m_sentPacketClient
Ptr< Packet > m_sentPacketClient
Packet sent by client.
Definition: ipv6-fragmentation-test.cc:112
third.channel
channel
Definition: third.py:92
ns3::Packet::CopyData
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:378
ns3::ErrorModel::Enable
void Enable(void)
Enable the error model.
Definition: error-model.cc:125
IPv6TestTag
Tag used in IPv6 Fragmentation Test.
Definition: ipv6-fragmentation-test.cc:74
ns3::ErrorModel::Reset
void Reset(void)
Reset any state associated with the error model.
Definition: error-model.cc:118
Ipv6FragmentationTest::SetFill
void SetFill(uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
Set the packet fill.
Definition: ipv6-fragmentation-test.cc:275
ns3::Ipv6Address
Describes an IPv6 address.
Definition: ipv6-address.h:50
ns3::SimpleNetDevice::SetChannel
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
Definition: simple-net-device.cc:274
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
ns3::SimpleNetDevice::SetMtu
virtual bool SetMtu(const uint16_t mtu)
Definition: simple-net-device.cc:338
Ipv6FragmentationTest::m_icmpCode
uint8_t m_icmpCode
ICMP code.
Definition: ipv6-fragmentation-test.cc:123
ns3::Packet::PeekPacketTag
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:978
ns3::Packet::GetByteTagIterator
ByteTagIterator GetByteTagIterator(void) const
Returns an iterator over the set of byte tags included in this packet.
Definition: packet.cc:933
ns3::ByteTagIterator::Item
Identifies a byte tag and a set of bytes within a packet to which the tag applies.
Definition: packet.h:62
ns3::Ipv6::AddAddress
virtual bool AddAddress(uint32_t interface, Ipv6InterfaceAddress address, bool addOnLinkRoute=true)=0
Add an address on the specified IPv6 interface.
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::SimpleNetDevice::SetAddress
virtual void SetAddress(Address address)
Set the address of this interface.
Definition: simple-net-device.cc:323
Ipv6FragmentationTest::m_socketClient
Ptr< Socket > m_socketClient
Client socket.
Definition: ipv6-fragmentation-test.cc:118
ns3::TestCase
encapsulates test code
Definition: test.h:1154
IPv6TestTag::token
uint64_t token
Token carried by the tag.
Definition: ipv6-fragmentation-test.cc:76
ns3::Ptr< Packet >
Ipv6FragmentationTest::~Ipv6FragmentationTest
~Ipv6FragmentationTest()
Definition: ipv6-fragmentation-test.cc:193
ns3::Socket::Send
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
NS_TEST_EXPECT_MSG_NE
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
Definition: test.h:737
ns3::Socket::SetRecvCallback
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
Definition: socket.cc:128
ns3::TypeId::GetConstructor
Callback< ObjectBase * > GetConstructor(void) const
Get the constructor callback.
Definition: type-id.cc:1061
bianchi11ax.k
int k
Definition: bianchi11ax.py:129
ns3::Tag
tag a set of bytes in a packet
Definition: tag.h:37
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::ByteTagIterator::Item::GetStart
uint32_t GetStart(void) const
The index is an offset from the start of the packet.
Definition: packet.cc:39
ns3::ErrorModel::Disable
void Disable(void)
Disable the error model.
Definition: error-model.cc:132
Ipv6FragmentationTestSuite
IPv6 Fragmentation TestSuite.
Definition: ipv6-fragmentation-test.cc:534
ns3::InternetStackHelper::Install
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Definition: internet-stack-helper.cc:366
ns3::Socket::RecvFrom
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
Ipv6FragmentationTest::m_data
uint8_t * m_data
Data.
Definition: ipv6-fragmentation-test.cc:120
Ipv6FragmentationTest::HandleReadServer
void HandleReadServer(Ptr< Socket > socket)
Handle incoming packets.
Definition: ipv6-fragmentation-test.cc:221
Ipv6FragmentationTest::m_icmpType
uint8_t m_icmpType
ICMP type.
Definition: ipv6-fragmentation-test.cc:122
ns3::CallbackValue
AttributeValue implementation for Callback.
Definition: callback.h:1938
ns3::Ipv6::SetUp
virtual void SetUp(uint32_t interface)=0
Set the interface into the "up" state.
ns3::ByteTagIterator::Item::GetEnd
uint32_t GetEnd(void) const
The index is an offset from the start of the packet.
Definition: packet.cc:44
NS_TEST_EXPECT_MSG_EQ
#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:283
IPv6TestTag::Deserialize
virtual void Deserialize(TagBuffer buffer)
Definition: ipv6-fragmentation-test.cc:89
Ipv6FragmentationTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: ipv6-fragmentation-test.cc:324
ns3::Node::AddDevice
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
Ipv6FragmentationTest
IPv6 Fragmentation Test.
Definition: ipv6-fragmentation-test.cc:111
Ipv6FragmentationTest::m_dataSize
uint32_t m_dataSize
Data size.
Definition: ipv6-fragmentation-test.cc:119
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
Ipv6FragmentationTest::m_receivedPacketServer
Ptr< Packet > m_receivedPacketServer
Packet received by server.
Definition: ipv6-fragmentation-test.cc:114
ns3::UdpSocketImpl
A sockets interface to UDP.
Definition: udp-socket-impl.h:70
ns3::Packet::AddPacketTag
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
Ipv6FragmentationTest::m_socketServer
Ptr< Socket > m_socketServer
Server socket.
Definition: ipv6-fragmentation-test.cc:117
IPv6TestTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: ipv6-fragmentation-test.cc:86
Ipv6FragmentationTest::m_receivedPacketClient
Ptr< Packet > m_receivedPacketClient
Packet received by client.
Definition: ipv6-fragmentation-test.cc:113
ns3::TypeId::GetName
std::string GetName(void) const
Get the name.
Definition: type-id.cc:977
packetSize
static const uint32_t packetSize
Definition: wifi-power-adaptation-distance.cc:113
ns3::Socket::Connect
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
ns3::TestSuite::UNIT
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1353
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::Inet6SocketAddress
An Inet6 address class.
Definition: inet6-socket-address.h:37
ns3::Packet::Copy
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
Ipv6FragmentationTest::HandleReadClient
void HandleReadClient(Ptr< Socket > socket)
Handle incoming packets.
Definition: ipv6-fragmentation-test.cc:252
IPv6TestTag::GetToken
uint64_t GetToken()
Get the token.
Definition: ipv6-fragmentation-test.cc:100
Ipv6FragmentationTest::Ipv6FragmentationTest
Ipv6FragmentationTest()
Definition: ipv6-fragmentation-test.cc:182
Ipv6FragmentationTestSuite::Ipv6FragmentationTestSuite
Ipv6FragmentationTestSuite()
Definition: ipv6-fragmentation-test.cc:536
ns3::ByteTagIterator::HasNext
bool HasNext(void) const
Definition: packet.cc:65
ns3::Ipv6
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:82
IPv6TestTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: ipv6-fragmentation-test.cc:82
ns3::InternetStackHelper::SetIpv4StackInstall
void SetIpv4StackInstall(bool enable)
Enable/disable IPv4 stack install.
Definition: internet-stack-helper.cc:189
IPv6TestTag::SetToken
void SetToken(uint64_t token)
Set the token.
Definition: ipv6-fragmentation-test.cc:95
g_ipv6fragmentationTestSuite
static Ipv6FragmentationTestSuite g_ipv6fragmentationTestSuite
Static variable for test initialization.
Definition: ipv6-fragmentation-test.cc:542
ns3::ByteTagIterator
Iterator over the set of byte tags in a packet.
Definition: packet.h:55
ns3::TagBuffer
read and write tag data
Definition: tag-buffer.h:52
Ipv6FragmentationTest::HandleReadIcmpClient
void HandleReadIcmpClient(Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
Handle incoming ICMP packets.
Definition: ipv6-fragmentation-test.cc:266
ns3::Ipv6Prefix
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
ns3::InternetStackHelper
aggregate IP/TCP/UDP functionality to existing Nodes.
Definition: internet-stack-helper.h:88
ns3::Packet::AddByteTag
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
Definition: packet.cc:912
ns3::TagBuffer::ReadU64
uint64_t ReadU64(void)
Definition: tag-buffer.cc:134
Ipv6FragmentationTest::SendClient
Ptr< Packet > SendClient(void)
Send a packet.
Definition: ipv6-fragmentation-test.cc:302
ns3::SimpleNetDevice::SetReceiveErrorModel
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the SimpleNetDevice.
Definition: simple-net-device.cc:298
ns3::TagBuffer::WriteU64
void WriteU64(uint64_t v)
Definition: tag-buffer.cc:102
IPv6TestTag::Serialize
virtual void Serialize(TagBuffer buffer) const
Definition: ipv6-fragmentation-test.cc:88
IPv6TestTag::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Definition: ipv6-fragmentation-test.cc:87