23 #include "ns3/config.h" 78 virtual void BytesInFlightTrace (uint32_t oldValue, uint32_t newValue);
91 void ConfigureEnvironment ();
105 void RTOExpired (
Time oldVal,
Time newVal);
121 std::vector<uint32_t> &toDrop)
123 m_guessedBytesInFlight (0),
126 m_greatestSeqSent (0),
134 TcpGeneralTest::ConfigureEnvironment ();
146 for (std::vector<uint32_t>::iterator it =
m_toDrop.begin (); it !=
m_toDrop.end (); ++it)
208 if ((h.
GetFlags () & TcpHeader::FIN) != 0
220 && (h.
GetFlags () & TcpHeader::FIN) == 0)
232 NS_LOG_DEBUG (
"Dupack received, Update m_guessedBytesInFlight to " <<
245 static uint32_t times = 0;
276 "At time " <<
Simulator::Now ().GetSeconds () <<
"; guessed and measured bytes in flight differs");
283 "Still present bytes in flight at the end of the transmission");
298 std::vector<uint32_t> toDrop;
301 toDrop.push_back (4001);
304 toDrop.push_back (4001);
308 toDrop.push_back (4501);
Check the value of BytesInFlight against a home-made guess.
void FinalChecks()
Do the final checks.
Simulation virtual time values and global simulation resolution.
void ConfigureEnvironment()
Configure the test.
Smart pointer class similar to boost::intrusive_ptr.
AttributeValue implementation for Boolean.
void RTOExpired(Time oldVal, Time newVal)
Update when RTO expires.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< TcpSocketMsgBase > GetSenderSocket()
Get the pointer to a previously created sender socket.
uint32_t m_guessedBytesInFlight
Guessed bytes in flight.
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t m_dupAckRecv
Number of DupACKs received.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
SequenceNumber32 m_lastAckRecv
Last ACK received.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Receive a packet.
static TcpBytesInFlightTestSuite g_tcpBytesInFlightTestSuite
Static variable for test initialization.
std::vector< uint32_t > m_toDrop
List of SequenceNumber to drop.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#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.
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Track the bytes in flight.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet is dropped.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create a receiver error model.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Generic "sequence number" class.
uint32_t GetSegSize(SocketWho who)
Get the segment size of the node specified.
TcpBytesInFlightTest(const std::string &desc, std::vector< uint32_t > &toDrop)
Constructor.
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.
TcpBytesInFlightTestSuite()
TestSuite: Check the value of BytesInFlight against a home-made guess.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
void BeforeRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Do the checks before the RTO expires.
General infrastructure for TCP testing.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Transmit a packet.
#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)
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
This test suite implements a Unit Test.
SequenceNumber32 m_greatestSeqSent
greatest sequence number sent.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.