A Discrete-Event Network Simulator
API
three-gpp-http-client-server-test.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2015 Magister Solutions
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: Budiarto Herman <budiarto.herman@magister.fi>
19 *
20 */
21
22#include <ns3/test.h>
23#include <ns3/log.h>
24#include <ns3/config.h>
25#include <ns3/ptr.h>
26#include <ns3/nstime.h>
27#include <ns3/integer.h>
28
29#include <ns3/simple-channel.h>
30#include <ns3/node.h>
31#include <ns3/packet.h>
32#include <ns3/mac48-address.h>
33#include <ns3/simple-net-device.h>
34#include <ns3/error-model.h>
35#include <ns3/ipv4-address-helper.h>
36#include <ns3/ipv6-address-helper.h>
37#include <ns3/internet-stack-helper.h>
38#include <ns3/tcp-l4-protocol.h>
39
40#include <ns3/tcp-congestion-ops.h>
41
42#include <ns3/three-gpp-http-client.h>
43#include <ns3/three-gpp-http-server.h>
44#include <ns3/three-gpp-http-helper.h>
45#include <ns3/three-gpp-http-header.h>
46
47#include <ns3/basic-data-calculators.h>
48#include <list>
49#include <sstream>
50
51
52NS_LOG_COMPONENT_DEFINE ("ThreeGppHttpClientServerTest");
53
54using namespace ns3;
55
56// HTTP OBJECT TEST CASE //////////////////////////////////////////////////////
57
73{
74public:
92 ThreeGppHttpObjectTestCase (const std::string &name,
93 uint32_t rngRun,
94 const TypeId &tcpType,
95 const Time &channelDelay,
96 double bitErrorRate,
97 uint32_t mtuSize,
98 bool useIpv6);
99
100private:
112 Address &assignedAddress);
113
114 // Inherited from TestCase base class.
115 virtual void DoRun ();
116 virtual void DoTeardown ();
117
125 {
126public:
133 void ObjectSent (uint32_t size);
139 void PartReceived (uint32_t size);
151 bool ObjectReceived (uint32_t &txSize, uint32_t &rxSize);
153 bool IsEmpty () const;
155 uint16_t GetNumOfObjectsReceived () const;
156private:
163 std::list<uint32_t> m_objectsSize;
168 };
169
170 // The following defines one tracker for each HTTP object type.
174
175 // CALLBACK TO TRACE SOURCES.
176
196 void ServerRxCallback (Ptr<const Packet> packet, const Address &from);
241 void ClientStateTransitionCallback (const std::string &oldState,
242 const std::string &newState);
249 void ClientRxDelayCallback (const Time &delay, const Address &from);
256 void ClientRxRttCallback (const Time &rtt, const Address &from);
266 void ProgressCallback ();
267
268 // THE PARAMETERS OF THE TEST CASE.
269
275
276 // OTHER MEMBER VARIABLES.
277
294
295}; // end of `class HttpClientServerTestCase`
296
298 uint32_t rngRun,
299 const TypeId &tcpType,
300 const Time &channelDelay,
301 double bitErrorRate,
302 uint32_t mtuSize,
303 bool useIpv6)
304 : TestCase (name),
305 m_rngRun (rngRun),
306 m_tcpType (tcpType),
307 m_channelDelay (channelDelay),
308 m_mtuSize (mtuSize),
309 m_useIpv6 (useIpv6),
310 m_numOfPagesReceived (0),
311 m_numOfPacketDrops (0)
312{
313 NS_LOG_FUNCTION (this << GetName ());
314
315 //NS_ASSERT (tcpType.IsChildOf (TypeId::LookupByName ("ns3::TcpSocketBase")));
316 NS_ASSERT (channelDelay.IsPositive ());
317
318 m_errorModel = CreateObject<RateErrorModel> ();
319 m_errorModel->SetRate (bitErrorRate);
320 m_errorModel->SetUnit (RateErrorModel::ERROR_UNIT_BIT);
321
323 Ipv4Mask ("255.0.0.0"),
324 Ipv4Address ("0.0.0.1"));
326 Ipv6Prefix (64),
327 Ipv6Address ("::1"));
328
329 m_delayCalculator = CreateObject<MinMaxAvgTotalCalculator<double> > ();
330 m_rttCalculator = CreateObject<MinMaxAvgTotalCalculator<double> > ();
331}
332
335 Address &assignedAddress)
336{
337 NS_LOG_FUNCTION (this << channel);
338
339 Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
340 dev->SetAddress (Mac48Address::Allocate ());
341 dev->SetChannel (channel);
342 dev->SetReceiveErrorModel (m_errorModel);
343
344 Ptr<Node> node = CreateObject<Node> ();
345 node->AddDevice (dev);
347
348 // Assign IP address according to the selected Ip version.
349 if (m_useIpv6)
350 {
353 NS_ASSERT (ipv6Ifs.GetN () == 1);
354 assignedAddress = ipv6Ifs.GetAddress (0, 0);
355 }
356 else
357 {
360 NS_ASSERT (ipv4Ifs.GetN () == 1);
361 assignedAddress = ipv4Ifs.GetAddress (0, 0);
362 }
363
364 NS_LOG_DEBUG (this << " node is assigned to " << assignedAddress << ".");
365
366 // Set the TCP algorithm.
368 tcp->SetAttribute ("SocketType", TypeIdValue (m_tcpType));
369
370 // Connect with the trace source that informs about packet drop due to error.
371 dev->TraceConnectWithoutContext (
372 "PhyRxDrop",
374
375 return node;
376}
377
378void
380{
381 NS_LOG_FUNCTION (this << GetName ());
383 NS_LOG_INFO (this << " Running test case " << GetName ());
384
385 /*
386 * Create topology:
387 *
388 * Server Node Client Node
389 * +-----------------+ +-----------------+
390 * | HTTP Server | | HTTP Client |
391 * | Application | | Application |
392 * +-----------------+ +-----------------+
393 * | TCP | | TCP |
394 * +-----------------+ +-----------------+
395 * | IPv4/v6 | | IPv4/v6 |
396 * +-----------------+ +-----------------+
397 * | Simple NetDev | | Simple NetDev |
398 * +-----------------+ +-----------------+
399 * | |
400 * | |
401 * +----------------------------+
402 * Simple Channel
403 */
404
405 // Channel.
406 Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
407 channel->SetAttribute ("Delay", TimeValue (m_channelDelay));
408
409 // Server node.
410 Address serverAddress;
411 Ptr<Node> serverNode = CreateSimpleInternetNode (channel, serverAddress);
412 ThreeGppHttpServerHelper serverHelper (serverAddress);
413 ApplicationContainer serverApplications = serverHelper.Install (serverNode);
414 NS_TEST_ASSERT_MSG_EQ (serverApplications.GetN (), 1,
415 "Invalid number of HTTP servers has been installed");
416 Ptr<ThreeGppHttpServer> httpServer = serverApplications.Get (0)->GetObject<ThreeGppHttpServer> ();
417 NS_TEST_ASSERT_MSG_NE (httpServer, 0,
418 "HTTP server installation fails to produce a proper type");
419 httpServer->SetMtuSize (m_mtuSize);
420
421 // Client node.
422 Address clientAddress;
423 Ptr<Node> clientNode = CreateSimpleInternetNode (channel, clientAddress);
424 ThreeGppHttpClientHelper clientHelper (serverAddress);
425 ApplicationContainer clientApplications = clientHelper.Install (clientNode);
426 NS_TEST_ASSERT_MSG_EQ (clientApplications.GetN (), 1,
427 "Invalid number of HTTP clients has been installed");
428 Ptr<ThreeGppHttpClient> httpClient = clientApplications.Get (0)->GetObject<ThreeGppHttpClient> ();
429 NS_TEST_ASSERT_MSG_NE (httpClient, 0,
430 "HTTP client installation fails to produce a proper type");
431
432 // Uplink (requests) trace sources.
433 bool traceSourceConnected = httpClient->TraceConnectWithoutContext (
434 "TxMainObjectRequest",
436 this));
437 NS_ASSERT (traceSourceConnected);
438 traceSourceConnected = httpClient->TraceConnectWithoutContext (
439 "TxEmbeddedObjectRequest",
441 this));
442 NS_ASSERT (traceSourceConnected);
443 traceSourceConnected = httpServer->TraceConnectWithoutContext (
444 "Rx",
446 this));
447 NS_ASSERT (traceSourceConnected);
448
449 // Downlink (main objects) trace sources.
450 traceSourceConnected = httpServer->TraceConnectWithoutContext (
451 "MainObject",
453 this));
454 NS_ASSERT (traceSourceConnected);
455 traceSourceConnected = httpClient->TraceConnectWithoutContext (
456 "RxMainObjectPacket",
458 this));
459 NS_ASSERT (traceSourceConnected);
460 traceSourceConnected = httpClient->TraceConnectWithoutContext (
461 "RxMainObject",
463 this));
464 NS_ASSERT (traceSourceConnected);
465
466 // Downlink (embedded objects) trace sources.
467 traceSourceConnected = httpServer->TraceConnectWithoutContext (
468 "EmbeddedObject",
470 this));
471 NS_ASSERT (traceSourceConnected);
472
473 traceSourceConnected = httpClient->TraceConnectWithoutContext (
474 "RxEmbeddedObjectPacket",
476 this));
477 NS_ASSERT (traceSourceConnected);
478
479 traceSourceConnected = httpClient->TraceConnectWithoutContext (
480 "RxEmbeddedObject",
482 this));
483 NS_ASSERT (traceSourceConnected);
484
485 // Other trace sources.
486 traceSourceConnected = httpClient->TraceConnectWithoutContext (
487 "StateTransition",
489 this));
490 NS_ASSERT (traceSourceConnected);
491 traceSourceConnected = httpClient->TraceConnectWithoutContext (
492 "RxDelay",
494 this));
495 NS_ASSERT (traceSourceConnected);
496 traceSourceConnected = httpClient->TraceConnectWithoutContext (
497 "RxRtt",
499 this));
500 NS_ASSERT (traceSourceConnected);
501
502 Simulator::Schedule (Seconds (1.0), &ThreeGppHttpObjectTestCase::ProgressCallback, this);
503
504 /*
505 * Here we don't set the simulation stop time. During the run, the simulation
506 * will stop immediately after the client has completely received the third
507 * web page.
508 */
509 Simulator::Run ();
510
511 // Dump some statistical information about the simulation.
512 NS_LOG_INFO (this << " Total request objects received: "
514 << " object(s).");
515 NS_LOG_INFO (this << " Total main objects received: "
517 << " object(s).");
518 NS_LOG_INFO (this << " Total embedded objects received: "
520 << " object(s).");
521 NS_LOG_INFO (this << " One-trip delays:"
522 << " average=" << m_delayCalculator->getMean ()
523 << " min=" << m_delayCalculator->getMin ()
524 << " max=" << m_delayCalculator->getMax ());
525 NS_LOG_INFO (this << " Round-trip delays:"
526 << " average=" << m_rttCalculator->getMean ()
527 << " min=" << m_rttCalculator->getMin ()
528 << " max=" << m_rttCalculator->getMax ());
529 NS_LOG_INFO (this << " Number of packets dropped by the devices: "
530 << m_numOfPacketDrops << " packet(s).");
531
532 // Some post-simulation tests.
534 "Unexpected number of web pages processed.");
536 "Tracker of request objects detected irrelevant packet(s).");
538 "Tracker of main objects detected irrelevant packet(s).");
540 "Tracker of embedded objects detected irrelevant packet(s).");
541
542 Simulator::Destroy ();
543
544} // end of `void HttpClientServerTestCase::DoRun ()`
545
546void
548{
549 NS_LOG_FUNCTION (this << GetName ());
550}
551
553 : m_rxBuffer (0),
554 m_numOfObjectsReceived (0)
555{
556 NS_LOG_FUNCTION (this);
557}
558
559void
561{
562 NS_LOG_FUNCTION (this << size);
563 m_objectsSize.push_back (size);
564}
565
566void
568{
569 NS_LOG_FUNCTION (this << size);
570 m_rxBuffer += size;
571}
572
573bool
575 uint32_t &rxSize)
576{
577 NS_LOG_FUNCTION (this);
578
579 if (m_objectsSize.empty ())
580 {
581 return false;
582 }
583
584 // Set output values.
585 txSize = m_objectsSize.front ();
586 rxSize = m_rxBuffer;
587
588 // Reset counters.
589 m_objectsSize.pop_front ();
590 m_rxBuffer = 0;
591 m_numOfObjectsReceived++;
592
593 return true;
594}
595
596bool
598{
599 return (m_objectsSize.empty () && (m_rxBuffer == 0));
600}
601
602uint16_t
604{
605 return m_numOfObjectsReceived;
606}
607
608void
610{
611 NS_LOG_FUNCTION (this << packet << packet->GetSize ());
613}
614
615void
617{
618 NS_LOG_FUNCTION (this << packet << packet->GetSize ());
620}
621
622void
624 const Address &from)
625{
626 NS_LOG_FUNCTION (this << packet << packet->GetSize () << from);
627
628 // Check the header in packet
629 Ptr<Packet> copy = packet->Copy ();
630 ThreeGppHttpHeader httpHeader;
631 NS_TEST_ASSERT_MSG_EQ (copy->RemoveHeader (httpHeader), 22,
632 "Error finding ThreeGppHttpHeader in a packet received by the server");
633 NS_TEST_ASSERT_MSG_GT (httpHeader.GetClientTs (), Seconds (0.0),
634 "Request object's client TS is unexpectedly non-positive");
635
637
638 /*
639 * Request objects are assumed to be small and to not typically split. So we
640 * immediately follow by concluding the receive of a whole request object.
641 */
642 uint32_t txSize;
643 uint32_t rxSize;
644 bool isSent = m_requestObjectTracker.ObjectReceived (txSize, rxSize);
645 NS_TEST_ASSERT_MSG_EQ (isSent, true,
646 "Server receives one too many request object");
647 NS_TEST_ASSERT_MSG_EQ (txSize, rxSize,
648 "Transmitted size and received size of request object differ");
649}
650
651void
653{
654 NS_LOG_FUNCTION (this << size);
656}
657
658void
660{
661 NS_LOG_FUNCTION (this << packet << packet->GetSize ());
663}
664
665void
667 Ptr<const Packet> packet)
668{
669 NS_LOG_FUNCTION (this << httpClient << httpClient->GetNode ()->GetId ());
670
671 // Verify the header in the packet.
672 Ptr<Packet> copy = packet->Copy ();
673 ThreeGppHttpHeader httpHeader;
674 NS_TEST_ASSERT_MSG_EQ (copy->RemoveHeader (httpHeader), 22,
675 "Error finding ThreeGppHttpHeader in a packet received by the server");
676 NS_TEST_ASSERT_MSG_EQ (httpHeader.GetContentType (), ThreeGppHttpHeader::MAIN_OBJECT,
677 "Invalid content type in the received packet");
678 NS_TEST_ASSERT_MSG_GT (httpHeader.GetClientTs (), Seconds (0.0),
679 "Main object's client TS is unexpectedly non-positive");
680 NS_TEST_ASSERT_MSG_GT (httpHeader.GetServerTs (), Seconds (0.0),
681 "Main object's server TS is unexpectedly non-positive");
682 uint32_t txSize;
683 uint32_t rxSize;
684 bool isSent = m_mainObjectTracker.ObjectReceived (txSize, rxSize);
685 NS_TEST_ASSERT_MSG_EQ (isSent, true,
686 "Client receives one too many main object");
687 NS_TEST_ASSERT_MSG_EQ (txSize, rxSize,
688 "Transmitted size and received size of main object differ");
689 NS_TEST_ASSERT_MSG_EQ (httpHeader.GetContentLength (), rxSize,
690 "Actual main object packet size and received size of main object differ");
691}
692
693void
695{
696 NS_LOG_FUNCTION (this << size);
698}
699
700void
702{
703 NS_LOG_FUNCTION (this << packet << packet->GetSize ());
705}
706
707void
709 Ptr<const Packet> packet)
710{
711 NS_LOG_FUNCTION (this << httpClient << httpClient->GetNode ()->GetId ());
712
713 // Verify the header in the packet.
714 Ptr<Packet> copy = packet->Copy ();
715 ThreeGppHttpHeader httpHeader;
716 NS_TEST_ASSERT_MSG_EQ (copy->RemoveHeader (httpHeader), 22,
717 "Error finding ThreeGppHttpHeader in a packet received by the server");
718 NS_TEST_ASSERT_MSG_EQ (httpHeader.GetContentType (), ThreeGppHttpHeader::EMBEDDED_OBJECT,
719 "Invalid content type in the received packet");
720 NS_TEST_ASSERT_MSG_GT (httpHeader.GetClientTs (), Seconds (0.0),
721 "Embedded object's client TS is unexpectedly non-positive");
722 NS_TEST_ASSERT_MSG_GT (httpHeader.GetServerTs (), Seconds (0.0),
723 "Embedded object's server TS is unexpectedly non-positive");
724
725 uint32_t txSize;
726 uint32_t rxSize;
727 bool isSent = m_embeddedObjectTracker.ObjectReceived (txSize, rxSize);
728 NS_TEST_ASSERT_MSG_EQ (isSent, true,
729 "Client receives one too many embedded object");
730 NS_TEST_ASSERT_MSG_EQ (txSize, rxSize,
731 "Transmitted size and received size of embedded object differ");
732 NS_TEST_ASSERT_MSG_EQ (httpHeader.GetContentLength (), rxSize,
733 "Actual embedded object packet size and received size of embedded object differ");
734}
735
736void
738 const std::string &newState)
739{
740 NS_LOG_FUNCTION (this << oldState << newState);
741
742 if (newState == "READING")
743 {
745
746 if (m_numOfPagesReceived >= 3)
747 {
748 // We have processed 3 web pages and that should be enough for this test.
749 NS_LOG_LOGIC (this << " Test is stopping now.");
750 Simulator::Stop ();
751 }
752 }
753}
754
755void
757{
758 NS_LOG_INFO ("Simulator time now: " << Simulator::Now ().As (Time::S) << ".");
759 Simulator::Schedule (Seconds (1.0), &ThreeGppHttpObjectTestCase::ProgressCallback, this);
760}
761
762void
764 const Address &from)
765{
766 NS_LOG_FUNCTION (this << delay.As (Time::S) << from);
768}
769
770void
772 const Address &from)
773{
774 NS_LOG_FUNCTION (this << rtt.As (Time::S) << from);
776}
777
778void
780{
781 NS_LOG_FUNCTION (this << packet << packet->GetSize ());
783}
784
785
786// TEST SUITE /////////////////////////////////////////////////////////////////
787
807{
808public:
810 ThreeGppHttpClientServerTestSuite () : TestSuite ("three-gpp-http-client-server-test", SYSTEM)
811 {
812 // LogComponentEnable ("ThreeGppHttpClientServerTest", LOG_INFO);
813 // LogComponentEnable ("ThreeGppHttpClient", LOG_INFO);
814 // LogComponentEnable ("ThreeGppHttpServer", LOG_INFO);
815 // LogComponentEnableAll (LOG_PREFIX_ALL);
816
817 Time channelDelay[] = {
818 MilliSeconds (3),
819 MilliSeconds (30),
820 MilliSeconds (300)
821 };
822 double bitErrorRate[] = {0.0, 5.0e-6};
823 uint32_t mtuSize[] = {536, 1460};
824
825 uint32_t run = 1;
826 while (run <= 100)
827 {
828 for (uint32_t i1 = 0; i1 < 3; i1++)
829 {
830 for (uint32_t i2 = 0; i2 < 2; i2++)
831 {
832 for (uint32_t i3 = 0; i3 < 2; i3++)
833 {
834 AddHttpObjectTestCase (run++,
835 channelDelay[i1],
836 bitErrorRate[i2],
837 mtuSize[i3],
838 false);
839 AddHttpObjectTestCase (run++,
840 channelDelay[i1],
841 bitErrorRate[i2],
842 mtuSize[i3],
843 true);
844 }
845 }
846 }
847 }
848 }
849
850private:
867 const Time &channelDelay,
868 double bitErrorRate,
869 uint32_t mtuSize,
870 bool useIpv6)
871 {
872 std::ostringstream name;
873 name << "Run #" << rngRun;
874 name << " delay=" << channelDelay.As (Time::MS);
875 name << " ber=" << bitErrorRate;
876 name << " mtu=" << mtuSize;
877
878 if (useIpv6)
879 {
880 name << " IPv6";
881 }
882 else
883 {
884 name << " IPv4";
885 }
886
887 // Assign higher fullness for tests with higher RngRun.
888 TestCase::TestDuration testDuration = TestCase::QUICK;
889 if (rngRun > 20)
890 {
891 testDuration = TestCase::EXTENSIVE;
892 }
893 if (rngRun > 50)
894 {
895 testDuration = TestCase::TAKES_FOREVER;
896 }
897
898 AddTestCase (new ThreeGppHttpObjectTestCase (name.str (),
899 rngRun,
900 TcpNewReno::GetTypeId (),
901 channelDelay,
902 bitErrorRate,
903 mtuSize,
904 useIpv6),
905 testDuration);
906 }
907
908}; // end of class `ThreeGppHttpClientServerTestSuite`
909
912
A test class for running several system tests which validate the web browsing traffic model.
void AddHttpObjectTestCase(uint32_t rngRun, const Time &channelDelay, double bitErrorRate, uint32_t mtuSize, bool useIpv6)
Creates a test case with the given parameters.
ThreeGppHttpClientServerTestSuite()
Instantiate the test suite.
ThreeGppHttpObjectTracker()
Creates a new instance with all counters begin at zero.
void PartReceived(uint32_t size)
Shall be invoked when an object part has been received.
void ObjectSent(uint32_t size)
Shall be invoked when a whole object has been transmitted.
bool ObjectReceived(uint32_t &txSize, uint32_t &rxSize)
Shall be invoked after all parts of a complete object have been received.
uint32_t m_rxBuffer
The accumulated size (in bytes) of parts of a whole object.
uint16_t m_numOfObjectsReceived
Number of whole objects that have been received so far.
std::list< uint32_t > m_objectsSize
Each entry is the size (in bytes) of object transmitted.
A test class which verifies that each HTTP object sent is also received the same size.
ThreeGppHttpObjectTracker m_embeddedObjectTracker
Tracker of embedded objects.
void DeviceDropCallback(Ptr< const Packet > packet)
Connected with PhyRxDrop trace source of both the client's and server's devices.
InternetStackHelper m_internetStackHelper
Installs TCP/IP stack on the nodes.
virtual void DoTeardown()
Implementation to do any local setup required for this TestCase.
void ClientRxDelayCallback(const Time &delay, const Address &from)
Connected with RxDelay trace source of the client.
ThreeGppHttpObjectTestCase(const std::string &name, uint32_t rngRun, const TypeId &tcpType, const Time &channelDelay, double bitErrorRate, uint32_t mtuSize, bool useIpv6)
void ClientTxEmbeddedObjectRequestCallback(Ptr< const Packet > packet)
Connected with TxEmbeddedObjectRequest trace source of the client.
virtual void DoRun()
Implementation to actually run this TestCase.
void ClientTxMainObjectRequestCallback(Ptr< const Packet > packet)
Connected with TxMainObjectRequest trace source of the client.
void ClientRxEmbeddedObjectCallback(Ptr< const ThreeGppHttpClient > httpClient, Ptr< const Packet > packet)
Connected with RxEmbeddedObject trace source of the client.
uint16_t m_numOfPagesReceived
Begins with 0. Simulation stops if this reaches 3.
Ipv4AddressHelper m_ipv4AddressHelper
Assigns IPv4 addresses to the nodes.
uint32_t m_mtuSize
Maximum transmission unit (in bytes).
void ServerRxCallback(Ptr< const Packet > packet, const Address &from)
Connected with Rx trace source of the server.
void ClientRxMainObjectPacketCallback(Ptr< const Packet > packet)
Connected with RxMainObjectPacket trace source of the client.
void ClientRxMainObjectCallback(Ptr< const ThreeGppHttpClient > httpClient, Ptr< const Packet > packet)
Connected with RxMainObject trace source of the client.
void ClientRxEmbeddedObjectPacketCallback(Ptr< const Packet > packet)
Connected with RxEmbeddedObjectPacket trace source of the client.
Ptr< Node > CreateSimpleInternetNode(Ptr< SimpleChannel > channel, Address &assignedAddress)
Creates a Node, complete with a TCP/IP stack and address assignment.
Ptr< MinMaxAvgTotalCalculator< double > > m_rttCalculator
Keeps statistical information of round-trip delays (in seconds).
void ClientStateTransitionCallback(const std::string &oldState, const std::string &newState)
Connected with StateTransition trace source of the client.
ThreeGppHttpObjectTracker m_requestObjectTracker
Tracker of request objects.
Time m_channelDelay
Time needed by a packet to propagate.
uint32_t m_rngRun
Determines the set of random values generated.
void ServerEmbeddedObjectCallback(uint32_t size)
Connected with EmbeddedObject trace source of the server.
uint16_t m_numOfPacketDrops
Number of packets dropped because of m_errorModel.
Ipv6AddressHelper m_ipv6AddressHelper
Assigns IPv6 addresses to the nodes.
Ptr< MinMaxAvgTotalCalculator< double > > m_delayCalculator
Keeps statistical information of one-trip delays (in seconds).
void ClientRxRttCallback(const Time &rtt, const Address &from)
Connected with RxRtt trace source of the client.
bool m_useIpv6
Whether to use IPv6 or IPv4.
Ptr< RateErrorModel > m_errorModel
Receive error model to be attached to the devices of both directions.
void ServerMainObjectCallback(uint32_t size)
Connected with MainObject trace source of the server.
ThreeGppHttpObjectTracker m_mainObjectTracker
Tracker of main objects.
a polymophic address class
Definition: address.h:91
holds a vector of ns3::Application pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
uint32_t GetN(void) const
Get the number of Ptr<Application> stored in this container.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
Definition: ipv6-address.h:50
Keep track of a set of IPv6 interfaces.
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
double getMean() const
Returns the mean value.
double getMax() const
Returns the maximum value.
double getMin() const
Returns the minimum value.
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
holds a vector of ns3::NetDevice pointers
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
void SetRate(double rate)
Definition: error-model.cc:208
void SetUnit(enum ErrorUnit error_unit)
Definition: error-model.cc:194
TCP socket creation and multiplexing/demultiplexing.
encapsulates test code
Definition: test.h:994
TestDuration
How long the test takes to execute.
Definition: test.h:998
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
std::string GetName(void) const
Definition: test.cc:370
A suite of tests to run.
Definition: test.h:1188
Helper to make it easier to instantiate an ThreeGppHttpClient on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install a ThreeGppHttpClient on each node of the input container configured with all the attributes s...
Model application which simulates the traffic of a web browser.
Header used by web browsing applications to transmit information about content type,...
ContentType_t GetContentType() const
Helper to make it easier to instantiate an ThreeGppHttpServer on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ThreeGppHttpServer on each node of the input container configured with all the attributes ...
Model application which simulates the traffic of a web server.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
bool IsPositive(void) const
Exactly equivalent to t >= 0.
Definition: nstime.h:316
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:418
AttributeValue implementation for Time.
Definition: nstime.h:1308
a unique identifier for an interface.
Definition: type-id.h:59
AttributeValue implementation for TypeId.
Definition: type-id.h:595
Hold an unsigned integer type.
Definition: uinteger.h:44
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
void SetGlobal(std::string name, const AttributeValue &value)
Definition: config.cc:891
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
#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.
Definition: test.h:141
#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:240
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Definition: test.h:542
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Definition: test.h:825
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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:1648
channel
Definition: third.py:92
static ThreeGppHttpClientServerTestSuite g_httpClientServerTestSuiteInstance
The global instance of the three-gpp-http-client-server system test.