|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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)
void SendTx(Ptr< const Packet > p)
Record a packet successfully sent.
holds a vector of ns3::NetDevice pointers
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
This test checks that the sequence number is sent and received in sequence despite the sending applic...
AttributeValue implementation for Boolean.
uint64_t m_received
number of bytes received
#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.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void SendTx(Ptr< const Packet > p, const Address &from, const Address &to, const SeqTsSizeHeader &header)
Record a packet successfully sent.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
Time m_lastRxTs
Last recored timestamp on Rx.
void ReceiveRx(Ptr< const Packet > p, const Address &from, const Address &to, const SeqTsSizeHeader &header)
Record a packet successfully received.
Time m_lastTxTs
Last recored timestamp on Tx.
uint64_t m_sent
number of bytes sent
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
virtual ~BulkSendBasicTestCase()
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Basic test, checks that the right quantity of packets are sent and received.
a polymophic address class
virtual ~BulkSendSeqTsSizeTestCase()
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
uint64_t m_seqTxCounter
Counter for Sequences on Tx.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint64_t m_received
number of bytes received
build a set of SimpleNetDevice objects
Simulation virtual time values and global simulation resolution.
static BulkSendTestSuite g_bulkSendTestSuite
Static variable for test initialization.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
uint64_t m_seqRxCounter
Counter for Sequences on Rx.
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...
Hold variables of type string.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
#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.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
Time Seconds(double value)
Construct a Time in the indicated unit.
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 ns3::Application pointers.
keep track of a set of node pointers.
virtual void DoRun(void)
Implementation to actually run this TestCase.
BulkSendSeqTsSizeTestCase()
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
uint64_t m_sent
number of bytes sent
void ReceiveRx(Ptr< const Packet > p, const Address &addr)
Record a packet successfully received.
aggregate IP/TCP/UDP functionality to existing Nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...