|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/abort.h"
24 #include "ns3/pcap-file.h"
25 #include "ns3/config.h"
26 #include "ns3/string.h"
27 #include "ns3/uinteger.h"
28 #include "ns3/inet-socket-address.h"
29 #include "ns3/point-to-point-helper.h"
30 #include "ns3/internet-stack-helper.h"
31 #include "ns3/ipv4-address-helper.h"
32 #include "ns3/ipv4-header.h"
33 #include "ns3/packet-sink-helper.h"
34 #include "ns3/on-off-helper.h"
35 #include "ns3/simulator.h"
98 virtual void DoSetup (
void);
99 virtual void DoRun (
void);
100 virtual void DoTeardown (
void);
171 uint32_t (tMicroSeconds % 1000000),
182 uint32_t tsSec, tsUsec, inclLen, origLen, readLen;
183 m_pcapFile.
Read (expected,
sizeof(expected), tsSec, tsUsec, inclLen, origLen, readLen);
185 uint8_t *actual =
new uint8_t[readLen];
188 uint32_t result = memcmp (actual, expected, readLen);
240 std::string nscStack =
"liblinux2.6.26.so";
241 stack.SetTcp (
"ns3::NscTcpL4Protocol",
"Library",
StringValue (
"liblinux2.6.26.so"));
249 address.SetBase (
"10.1.1.0",
"255.255.255.252");
256 uint16_t sinkPort = 8080;
268 OnOffHelper onOffHelper (
"ns3::TcpSocketFactory", sinkAddress);
305 Simulator::Stop (
Seconds (20));
307 Simulator::Destroy ();
317 :
TestSuite (
"ns3-tcp-interoperability", SYSTEM)
320 SetDataDir (
"src/test/ns3tcp/response-vectors");
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ns3TcpInteroperabilityTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Read(uint8_t *const data, uint32_t maxBytes, uint32_t &tsSec, uint32_t &tsUsec, uint32_t &inclLen, uint32_t &origLen, uint32_t &readLen)
Read next packet from file.
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.
Ns3TcpInteroperabilityTestSuite()
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
static Ns3TcpInteroperabilityTestSuite ns3TcpInteroperabilityTestSuite
uint32_t GetDataLinkType(void)
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
std::string m_pcapFilename
virtual ~Ns3TcpInteroperabilityTestCase()
A class representing a pcap file.
void Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const *const data, uint32_t totalLen)
Write next packet to file.
bool IsStatusSuccess(void) const
Check if all tests passed.
void Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
a polymophic address class
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
const uint32_t PCAP_LINK_TYPE
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Simulation virtual time values and global simulation resolution.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
const uint32_t PCAP_SNAPLEN
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.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void Connect(std::string path, const CallbackBase &cb)
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
std::string CreateDataDirFilename(std::string filename)
Construct the full path to a file in the data directory.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
holds a vector of ns3::Application pointers.
Build a set of PointToPointNetDevice objects.
keep track of a set of node pointers.
Hold an unsigned integer type.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
void Ipv4L3Tx(std::string context, Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
void Init(uint32_t dataLinkType, uint32_t snapLen=SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ZONE_DEFAULT, bool swapMode=false, bool nanosecMode=false)
Initialize the pcap file associated with this object.
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...
void Close(void)
Close the underlying file.