22 #define private public
23 #define protected public
25 #include "ns3/socket-factory.h"
26 #include "ns3/tcp-socket-factory.h"
27 #include "ns3/simulator.h"
28 #include "ns3/simple-channel.h"
29 #include "ns3/simple-net-device.h"
30 #include "ns3/drop-tail-queue.h"
31 #include "ns3/config.h"
32 #include "ns3/ipv4-static-routing.h"
33 #include "ns3/ipv4-list-routing.h"
34 #include "ns3/ipv6-static-routing.h"
35 #include "ns3/ipv6-list-routing.h"
37 #include "ns3/inet-socket-address.h"
38 #include "ns3/inet6-socket-address.h"
39 #include "ns3/uinteger.h"
42 #include "ns3/arp-l3-protocol.h"
43 #include "ns3/ipv4-l3-protocol.h"
44 #include "ns3/ipv6-l3-protocol.h"
45 #include "ns3/icmpv4-l4-protocol.h"
46 #include "ns3/icmpv6-l4-protocol.h"
47 #include "ns3/udp-l4-protocol.h"
48 #include "ns3/tcp-l4-protocol.h"
50 #include "ns3/tcp-socket-base.h"
68 uint32_t maxServerBufferSize,
69 uint32_t maxSourceBufferSize, std::string name);
72 virtual void DoRun (
void);
111 uint32_t maxServerBufferSize,
112 uint32_t maxSourceBufferSize, std::string name)
148 "Source sent all bytes");
152 "Server received all bytes");
156 "Source received all bytes");
177 "Miscalculating source window");
180 b->m_maxWinSize,
"Violating maximum adv window");
183 "Violating RFC for max value of the scale factor");
220 "Miscalculating server window " << (
int)b->m_rcvScaleFactor);
223 b->m_maxWinSize,
"Violating maximum adv window");
226 "Violating RFC for max value of the scale factor");
247 int sent = sock->
Send (p);
251 m_currentServerTxBytes += sent;
271 int sent = sock->
Send (p);
273 m_currentSourceTxBytes += sent;
310 ipv4->SetRoutingProtocol (ipv4Routing);
312 ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
333 uint32_t ndid = ipv4->AddInterface (dev);
335 ipv4->AddAddress (ndid, ipv4Addr);
343 const char* netmask =
"255.255.255.0";
344 const char* ipaddr0 =
"192.168.1.1";
345 const char* ipaddr1 =
"192.168.1.2";
352 dev0->SetChannel (channel);
353 dev1->SetChannel (channel);
358 m_server = DynamicCast<TcpSocketBase> (sockFactory0->CreateSocket ());
359 m_source = DynamicCast<TcpSocketBase> (sockFactory1->CreateSocket ());
368 m_source->SetAttribute (
"WindowScaling",
BooleanValue (
false));
373 m_source->SetAttribute (
"WindowScaling",
BooleanValue (
true));
378 m_source->SetAttribute (
"WindowScaling",
BooleanValue (
false));
383 m_source->SetAttribute (
"WindowScaling",
BooleanValue (
true));
390 uint16_t
port = 50000;
394 m_server->Bind (serverlocaladdr);
404 m_source->Connect (serverremoteaddr);
Ptr< TcpSocketBase > m_server
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
uint32_t m_sourceWriteSize
void ServerHandleConnectionCreated(Ptr< Socket > s, const Address &addr)
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
API to create TCP socket instances.
void SourceHandleSend(Ptr< Socket > sock, uint32_t available)
a class to represent an Ipv4 address mask
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Ptr< SimpleNetDevice > AddSimpleNetDevice6(Ptr< Node > node, Ipv6Address ipaddr, Ipv6Prefix prefix)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
ns3::TcpWScalingTestSuite g_tcpWScalingTestSuite
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Callback< R > MakeNullCallback(void)
uint32_t m_currentServerTxBytes
This test suite implements a Unit Test.
uint32_t m_currentSourceTxBytes
virtual enum Socket::SocketErrno GetErrno(void) const =0
Get last error number.
a polymophic address class
Configuration m_configuration
uint32_t m_maxSourceBufferSize
uint32_t m_maxServerBufferSize
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Ptr< Node > CreateInternetNode6(void)
Ptr< Node > CreateInternetNode(void)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
void SourceHandleConnectionCreated(Ptr< Socket > sock)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
static Mac48Address ConvertFrom(const Address &address)
Access to the Ipv4 forwarding table, interfaces, and configuration.
Ptr< TcpSocketBase > m_source
uint32_t m_currentSourceRxBytes
Ptr< SimpleNetDevice > AddSimpleNetDevice(Ptr< Node > node, const char *ipaddr, const char *netmask)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void ServerHandleSend(Ptr< Socket > sock, uint32_t sendB)
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
void SetupDefaultSim(void)
uint32_t m_serverReadSize
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
uint32_t m_serverWriteSize
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
a class to store IPv4 address information on an interface
virtual void DoRun(void)
Implementation to actually run this TestCase.
WScalingTestCase(WScalingTestCase::Configuration conf, uint32_t maxServerBufferSize, uint32_t maxSourceBufferSize, std::string name)
uint32_t m_currentServerRxBytes
Describes an IPv6 prefix.
uint32_t m_sourceReadSize
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Close(void)=0
Close a socket.
virtual uint32_t GetTxAvailable(void) const =0
Returns the number of bytes which can be sent in a single call to Send.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void SourceHandleRecv(Ptr< Socket > sock)
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report if not.
void ServerHandleRecv(Ptr< Socket > sock)
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.