21 #include "ns3/nstime.h"
23 #include "ns3/traced-callback.h"
24 #include "ns3/node-container.h"
25 #include "ns3/application-container.h"
26 #include "ns3/simple-net-device-helper.h"
27 #include "ns3/string.h"
28 #include "ns3/uinteger.h"
29 #include "ns3/boolean.h"
30 #include "ns3/internet-stack-helper.h"
31 #include "ns3/ipv4-address.h"
32 #include "ns3/inet-socket-address.h"
33 #include "ns3/ipv4-address-helper.h"
34 #include "ns3/ipv4-interface-container.h"
35 #include "ns3/bulk-send-application.h"
36 #include "ns3/bulk-send-helper.h"
37 #include "ns3/packet-sink.h"
38 #include "ns3/packet-sink-helper.h"
55 virtual void DoRun (
void);
68 uint64_t m_received {0};
72 :
TestCase (
"Check a basic 300KB transfer")
96 Ptr<Node> receiver = CreateObject<Node> ();
108 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
130 Simulator::Destroy ();
151 virtual void DoRun (
void);
177 :
TestCase (
"Check a 300KB transfer with SeqTsSize header enabled")
210 Ptr<Node> sender = CreateObject<Node> ();
211 Ptr<Node> receiver = CreateObject<Node> ();
214 nodes.Add (receiver);
223 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
247 Simulator::Destroy ();
266 :
TestSuite (
"bulk-send-application", UNIT)
static BulkSendTestSuite g_bulkSendTestSuite
Static variable for test initialization.
Basic test, checks that the right quantity of packets are sent and received.
uint64_t m_sent
number of bytes sent
virtual void DoRun(void)
Implementation to actually run this TestCase.
void ReceiveRx(Ptr< const Packet > p, const Address &addr)
Record a packet successfully received.
virtual ~BulkSendBasicTestCase()
uint64_t m_received
number of bytes received
void SendTx(Ptr< const Packet > p)
Record a packet successfully sent.
This test checks that the sequence number is sent and received in sequence despite the sending applic...
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~BulkSendSeqTsSizeTestCase()
Time m_lastTxTs
Last recored timestamp on Tx.
void ReceiveRx(Ptr< const Packet > p, const Address &from, const Address &to, const SeqTsSizeHeader &header)
Record a packet successfully received.
Time m_lastRxTs
Last recored timestamp on Rx.
uint64_t m_seqRxCounter
Counter for Sequences on Rx.
BulkSendSeqTsSizeTestCase()
uint64_t m_seqTxCounter
Counter for Sequences on Tx.
uint64_t m_sent
number of bytes sent
void SendTx(Ptr< const Packet > p, const Address &from, const Address &to, const SeqTsSizeHeader &header)
Record a packet successfully sent.
uint64_t m_received
number of bytes received
a polymophic address class
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.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
AttributeValue implementation for Boolean.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
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...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
build a set of SimpleNetDevice objects
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Hold an unsigned integer type.
#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.
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
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...