24 #include "ns3/tcp-tx-item.h" 26 #include "ns3/tcp-rate-ops.h" 28 #include "ns3/config.h" 30 #include "ns3/tcp-tx-buffer.h" 57 uint32_t testCase, std::string testName);
60 virtual void DoRun (
void);
87 uint32_t testCase, std::string testName)
103 for (uint8_t i = 0; i < 100; ++i)
109 for (uint8_t i = 0; i < 100; ++i)
115 Simulator::Destroy ();
117 for (uint8_t i = 0; i < 100; ++i)
133 if (isStartOfTransmission)
194 .AddConstructor<MimicCongControl> ()
195 .SetGroupName (
"Internet")
221 std::vector<uint32_t> &toDrop);
274 virtual void RateUpdatedTrace (
const TcpRateLinux::TcpRateConnection &rate);
294 std::vector<uint32_t> &toDrop)
296 m_sackEnabled (sackEnabled),
305 m_congCtl = CreateObject<MimicCongControl> ();
313 TcpGeneralTest::ConfigureEnvironment ();
325 for (std::vector<uint32_t>::iterator it =
m_toDrop.begin (); it !=
m_toDrop.end (); ++it)
349 && (h.
GetFlags () & TcpHeader::FIN) == 0)
393 if (sample.m_ackedSacked == 0)
425 virtual void DoRun (
void);
432 virtual void RateUpdatedTrace (
const TcpRateLinux::TcpRateConnection &rate);
454 std::string testString)
458 m_rateOps = CreateObject <TcpRateLinux> ();
470 Simulator::Destroy ();
500 for (uint8_t i = 0; i < 10; ++i)
509 for (uint8_t i = 1; i <= 2; ++i)
540 for (uint8_t i = 6; i <= 10; ++i)
570 std::vector<uint32_t> toDrop;
571 toDrop.push_back (4001);
577 toDrop.push_back (4001);
void SetCongestionControlAlgorithm(Ptr< TcpCongestionOps > algo)
Install a congestion control algorithm on this socket.
Simulation virtual time values and global simulation resolution.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Receive a packet.
Smart pointer class similar to boost::intrusive_ptr.
std::vector< TcpTxItem * > m_skbs
Application packets.
Ptr< TcpRateOps > m_rateOps
Rate operations.
SequenceNumber32 m_nextTx
Tx next sequence number.
TcpRateLinuxWithBufferTest(uint32_t segmentSize, std::string desc)
Constructor.
AttributeValue implementation for Boolean.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
uint32_t m_segmentSize
Segment size.
uint32_t m_bytesInFlight
Bytes inflight.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet is dropped.
uint32_t m_expectedAckedSacked
Amount of expected acked sacked data.
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
uint32_t m_expectedDelivered
Amount of expected delivered data.
void TestWithStraightAcks()
Test with acks without drop.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Linux management and generation of Rate information for TCP.
#define NS_UNUSED(x)
Mark a local variable as unused.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
uint32_t GetSeqSize(void) const
Get the size in the sequence number space.
Time m_deliveredTime
Last time of a delivery.
The NewReno implementation.
void AddSackBlock(SackBlock s)
Add a SACK block.
uint32_t m_testCase
Test case type.
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Item that encloses the application packet and some flags for it.
SequenceNumber32 m_tailSeq
Tail sequence number.
static TypeId GetTypeId(void)
Get the type ID.
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Track the bytes in flight.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void FinalChecks()
Do the final checks.
uint32_t m_segmentSize
Segment size.
virtual bool HasCongControl() const
Returns true when Congestion Control Algorithm implements CongControl.
#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 DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem *> &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
RateInformation & GetRateInformation(void)
Get (to modify) the Rate Information of this item.
uint32_t m_inFlight
Number of packets in-flight.
void ConfigureEnvironment()
Configure the test.
static TcpRateOpsTestSuite g_TcpRateOpsTestSuite
Static variable for test initialization.
TcpTxItem * CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.
Ptr< MimicCongControl > m_congCtl
Dummy congestion control.
void TestWithSackBlocks()
Test with arbitary SACK scenario.
bool m_sackEnabled
Sack Variable.
Behaves as NewReno except HasCongControl returns true.
TcpRateLinuxBasicTest(uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx, uint32_t testCase, std::string testName)
Constructor.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void SendSkb(TcpTxItem *skb)
Send an application packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
uint32_t m_delivered
Number of segments delivered.
uint32_t m_cWnd
Congestion window size.
TcpTxBuffer m_txBuf
Tcp Tx buffer.
void SetDupAckThresh(uint32_t dupAckThresh)
Set the DupAckThresh.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
the TestSuite for the TcpRateLinux test case
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
TcpRateLinux::TcpRateSample m_prevRateSample
Previous rate sample.
SequenceNumber32 m_lastAckRecv
Last ACK received.
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
General infrastructure for TCP testing.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
virtual void CalculateAppLimited(uint32_t cWnd, uint32_t in_flight, uint32_t segmentSize, const SequenceNumber32 &tailSeq, const SequenceNumber32 &nextTx, const uint32_t lostOut, const uint32_t retransOut) override
If a gap is detected between sends, it means we are app-limited.
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission) override
Put the rate information inside the sent skb.
uint32_t Update(const TcpOptionSack::SackList &list, const Callback< void, TcpTxItem *> &sackedCb=m_nullCb)
Update the scoreboard.
The TcpRateLinux Test uses sender-receiver model to test its functionality.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
The TcpRateLinux Basic Test.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual const TcpRateSample & GenerateSample(uint32_t delivered, uint32_t lost, bool is_sack_reneg, uint32_t priorInFlight, const Time &minRtt)=0
Generate a TcpRateSample to feed a congestion avoidance algorithm.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void SkbDelivered(TcpTxItem *skb) override
Update the Rate information after an item is received.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
TcpRateLinux::TcpRateConnection m_prevRate
Previous rate.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create a receiver error model.
This test suite implements a Unit Test.
#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...
TcpRateLinux m_rateOps
Rate information for TCP.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool m_isDupAck
Whether ACK is DupAck.
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...
The TcpRateLinuxWithBufferTest tests rate sample functionality with arbitary SACK scenario...
TcpRateLinuxWithSocketsTest(const std::string &desc, bool sackEnabled, std::vector< uint32_t > &toDrop)
Constructor.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
uint32_t BytesInFlight() const
Return total bytes in flight.
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission)=0
Put the rate information inside the sent skb.
void SkbDelivered(TcpTxItem *skb)
Deliver an application packet.
SackList GetSackList(void) const
Get the SACK list.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
std::vector< uint32_t > m_toDrop
List of SequenceNumber to drop.