19 #include "ns3/application-container.h"
20 #include "ns3/boolean.h"
21 #include "ns3/bulk-send-application.h"
22 #include "ns3/bulk-send-helper.h"
23 #include "ns3/inet-socket-address.h"
24 #include "ns3/internet-stack-helper.h"
25 #include "ns3/ipv4-address-helper.h"
26 #include "ns3/ipv4-address.h"
27 #include "ns3/ipv4-interface-container.h"
28 #include "ns3/node-container.h"
30 #include "ns3/nstime.h"
31 #include "ns3/packet-sink-helper.h"
32 #include "ns3/packet-sink.h"
33 #include "ns3/simple-net-device-helper.h"
34 #include "ns3/string.h"
36 #include "ns3/traced-callback.h"
37 #include "ns3/uinteger.h"
54 void DoRun()
override;
67 uint64_t m_received{0};
71 :
TestCase(
"Check a basic 300KB transfer")
95 Ptr<Node> receiver = CreateObject<Node>();
107 ipv4.SetBase(
"10.1.1.0",
"255.255.255.0");
128 Simulator::Destroy();
149 void DoRun()
override;
181 :
TestCase(
"Check a 300KB transfer with SeqTsSize header enabled")
221 Ptr<Node> receiver = CreateObject<Node>();
233 ipv4.SetBase(
"10.1.1.0",
"255.255.255.0");
252 source->TraceConnectWithoutContext(
"TxWithSeqTsSize",
258 Simulator::Destroy();
277 :
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.
void DoRun() override
Implementation to actually run this TestCase.
uint64_t m_sent
number of bytes sent
void ReceiveRx(Ptr< const Packet > p, const Address &addr)
Record a packet successfully received.
uint64_t m_received
number of bytes received
void SendTx(Ptr< const Packet > p)
Record a packet successfully sent.
~BulkSendBasicTestCase() override
This test checks that the sequence number is sent and received in sequence despite the sending applic...
Time m_lastTxTs
Last recorded 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 recorded timestamp on Rx.
uint64_t m_seqRxCounter
Counter for Sequences on Rx.
BulkSendSeqTsSizeTestCase()
uint64_t m_seqTxCounter
Counter for Sequences on Tx.
~BulkSendSeqTsSizeTestCase() override
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.
void DoRun() override
Implementation to actually run this TestCase.
uint64_t m_received
number of bytes received
a polymophic address class
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
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.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
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.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
uint32_t GetSize() 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, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< PacketSink > sink
Pointer to the packet sink application.