21 #include "ns3/simulator.h"    22 #include "ns3/pfifo-fast-queue-disc.h"    23 #include "ns3/drop-tail-queue.h"    24 #include "ns3/ipv4-queue-disc-item.h"    25 #include "ns3/ipv6-queue-disc-item.h"    27 #include "ns3/string.h"    28 #include "ns3/pointer.h"    29 #include "ns3/object-factory.h"    30 #include "ns3/socket.h"    44   virtual void DoRun (
void);
    49   : 
TestCase (
"Test TOS-based prioritization")
    63   ipHeader.SetTos (tos);
    64   ipHeader.SetProtocol (6);
    66   priorityTag.
SetPriority (Socket::IpTos2Priority (tos));
    80   for (uint16_t i = 0; i < 3; i++)
    83       bool ok = queue->SetAttributeFailSafe (
"MaxSize", 
StringValue (
"1000p"));
   108   Simulator::Destroy ();
   121   virtual void DoRun (
void);
   126   : 
TestCase (
"Test DSCP-based prioritization")
   140   ipHeader.SetProtocol (6);
   141   ipHeader.SetDscp (dscp);
   143   priorityTag.
SetPriority (Socket::IpTos2Priority (ipHeader.GetTos ()));
   157   for (uint16_t i = 0; i < 3; i++)
   160       bool ok = queue->SetAttributeFailSafe (
"MaxSize", 
StringValue (
"1000p"));
   190   Simulator::Destroy ();
   203   virtual void DoRun (
void);
   222   ipHeader.SetProtocol (6);
   223   ipHeader.SetDscp (dscp);
   225   priorityTag.
SetPriority (Socket::IpTos2Priority (ipHeader.GetTos ()));
   244   AddPacket (queueDisc, Ipv4Header::DSCP_AF42); 
   245   AddPacket (queueDisc, Ipv4Header::DSCP_AF42); 
   246   AddPacket (queueDisc, Ipv4Header::DSCP_AF13); 
   247   AddPacket (queueDisc, Ipv4Header::DSCP_AF13); 
   248   AddPacket (queueDisc, Ipv4Header::DSCP_AF11); 
   249   AddPacket (queueDisc, Ipv4Header::DSCP_AF11); 
   255   AddPacket (queueDisc, Ipv4Header::DSCP_AF42); 
   256   AddPacket (queueDisc, Ipv4Header::DSCP_AF13); 
   257   AddPacket (queueDisc, Ipv4Header::DSCP_AF11); 
   263   Simulator::Destroy ();
   277   virtual void DoRun (
void);
   281   : 
TestCase (
"Test queue with no priority tag")
   294   for (uint16_t i = 0; i < 3; i++)
   297       bool ok = queue->SetAttributeFailSafe (
"MaxSize", 
StringValue (
"1000p"));
   303   p = Create<Packet> ();
   307   item = Create<Ipv6QueueDiscItem> (p, dest, 0, ipv6Header);
   310   p = Create<Packet> (
reinterpret_cast<const uint8_t*
> (
"hello, world"), 12);
   311   item = Create<Ipv6QueueDiscItem> (p, dest, 0, ipv6Header);
   314   p = Create<Packet> (100);
   315   uint8_t *buf = 
new uint8_t[100];
   317   for (uint32_t i = 0; i < 100; i++)
   321   p->CopyData (buf, 100);
   322   item = Create<Ipv6QueueDiscItem> (p, dest, 0, ipv6Header);
   326   Simulator::Destroy ();
   336   : 
TestSuite (
"pfifo-fast-queue-disc", UNIT)
 
Smart pointer class similar to boost::intrusive_ptr. 
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline. 
Hold variables of type string. 
This class tests that each possible TOS is enqueued in the right band. 
void TestTosValue(Ptr< PfifoFastQueueDisc > queue, uint8_t tos, uint32_t band)
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual ~PfifoFastQueueDiscTosPrioritization()
a polymophic address class 
This class tests that each band is txqueuelen deep. 
PfifoFastQueueDiscTosPrioritization()
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues. 
PfifoFastQueueDiscOverflow()
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
Ptr< InternalQueue > GetInternalQueue(std::size_t i) const
Get the i-th internal queue. 
void TestDscpValue(Ptr< PfifoFastQueueDisc > queue, Ipv4Header::DscpType dscp, uint32_t band)
void AddPacket(Ptr< PfifoFastQueueDisc > queue, Ipv4Header::DscpType dscp)
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual ~PfifoFastQueueDiscNoPriority()
indicates whether the socket has a priority set. 
virtual ~PfifoFastQueueDiscDscpPrioritization()
Ptr< QueueDiscItem > Dequeue(void)
Extract from the queue disc the packet that has been dequeued by calling Peek, if any...
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
This class tests that packets without a priority tag are handled by placing them into band 1...
static PfifoFastQueueDiscTestSuite pfifoFastQueueTestSuite
virtual ~PfifoFastQueueDiscOverflow()
void AddPacketTag(const Tag &tag) const
Add a packet tag. 
PfifoFastQueueDiscDscpPrioritization()
This class tests that each possible DSCP is enqueued in the right band. 
PfifoFastQueueDiscTestSuite()
PfifoFastQueueDiscNoPriority()
void SetPriority(uint8_t priority)
Set the tag's priority. 
virtual void DoRun(void)
Implementation to actually run this TestCase.