19 #ifndef TCPGENERALTEST_H
20 #define TCPGENERALTEST_H
22 #include "ns3/simple-net-device.h"
23 #include "ns3/error-model.h"
24 #include "ns3/tcp-socket-base.h"
25 #include "ns3/tcp-congestion-ops.h"
26 #include "ns3/tcp-recovery-ops.h"
27 #include "ns3/tcp-rate-ops.h"
139 bool isRetransmission);
373 virtual void DoRun (
void);
412 uint32_t pktCount,
Time pktInterval);
710 virtual void CWndTrace ([[maybe_unused]] uint32_t oldValue,
711 [[maybe_unused]] uint32_t newValue)
722 [[maybe_unused]] uint32_t newValue)
735 [[maybe_unused]]
Time newTime)
748 [[maybe_unused]] uint32_t newValue)
761 [[maybe_unused]] uint32_t newValue)
774 [[maybe_unused]]
Time newValue)
932 [[maybe_unused]] uint32_t sz,
933 [[maybe_unused]]
bool isRetransmission,
944 virtual void DataSent ([[maybe_unused]] uint32_t size,
1101 uint32_t sz,
bool isRetransmission);
1152 return tcb->m_congState.Get ();
a polymophic address class
An identifier for simulation events.
Smart pointer class similar to boost::intrusive_ptr.
General infrastructure for TCP testing.
Ptr< RttEstimator > GetRttEstimator(SocketWho who)
Get the Rtt estimator of the socket.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
Ptr< TcpSocketMsgBase > GetReceiverSocket()
Get the pointer to a previously created receiver socket.
uint32_t GetPktCount() const
Get the number of application packets.
void ErrorCloseCb(Ptr< Socket > socket)
Error Close Callback.
virtual void ErrorClose([[maybe_unused]] SocketWho who)
Socket closed with an error.
virtual void RcvAck([[maybe_unused]] const Ptr< const TcpSocketState > tcb, [[maybe_unused]] const TcpHeader &h, [[maybe_unused]] SocketWho who)
Received ack.
virtual void QueueDrop([[maybe_unused]] SocketWho who)
Drop on the queue.
virtual void CWndTrace([[maybe_unused]] uint32_t oldValue, [[maybe_unused]] uint32_t newValue)
Tracks the congestion window changes.
TypeId m_recoveryTypeId
Recovery.
uint32_t GetDelAckCount(SocketWho who)
Get the number of delayed ack (if present)
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
virtual void ProcessedAck([[maybe_unused]] const Ptr< const TcpSocketState > tcb, [[maybe_unused]] const TcpHeader &h, [[maybe_unused]] SocketWho who)
Processed ack.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
void SetDelAckMaxCount(SocketWho who, uint32_t count)
Forcefully set the delayed acknowledgement count.
virtual void RateSampleUpdatedTrace([[maybe_unused]] const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
void BeforeRetransmitCb(const Ptr< const TcpSocketState > tcb, const Ptr< const TcpSocketBase > tcp)
Invoked before a retransmit event.
Ptr< TcpTxBuffer > GetTxBuffer(SocketWho who)
Get the Tx buffer from selected socket.
virtual void HighestTxSeqTrace([[maybe_unused]] SequenceNumber32 oldValue, [[maybe_unused]] SequenceNumber32 newValue)
Highest tx seq changes.
virtual void UpdatedRttHistory([[maybe_unused]] const SequenceNumber32 &seq, [[maybe_unused]] uint32_t sz, [[maybe_unused]] bool isRetransmission, [[maybe_unused]] SocketWho who)
Updated the Rtt history.
void TxPacketCb(const Ptr< const Packet > p, const TcpHeader &h, const Ptr< const TcpSocketBase > tcp)
Tx packet Callback.
void SetAppPktSize(uint32_t pktSize)
Set app packet size.
void SetCongestionControl(TypeId congControl)
Congestion control of the sender socket.
uint32_t m_mtu
MTU of the environment.
virtual void RttTrace([[maybe_unused]] Time oldTime, [[maybe_unused]] Time newTime)
Rtt changes.
Time GetMinRto(SocketWho who)
Get the minimum RTO attribute.
Ptr< TcpSocketState > GetTcb(SocketWho who)
Get the TCB from selected socket.
void SetRcvBufSize(SocketWho who, uint32_t size)
Forcefully set a defined size for rx buffer.
virtual void ConfigureProperties(void)
Change the configuration of the socket properties.
Time m_interPacketInterval
Time between sending application packet down to tcp socket.
uint32_t m_pktSize
Size of the application packet.
EventId GetPersistentEvent(SocketWho who)
Get the persistent event of the selected socket.
uint32_t m_pktCount
Count of the application packet.
void HandleAccept(Ptr< Socket > socket, const Address &from)
Handle an accept connection.
void QueueDropCb(std::string context, Ptr< const Packet > p)
Queue Drop Callback.
void ForkCb(Ptr< TcpSocketMsgBase > tcp)
Fork Callback.
uint32_t GetReTxThreshold(SocketWho who)
Get the retransmission threshold.
void SetInitialCwnd(SocketWho who, uint32_t initialCwnd)
Forcefully set the initial cwnd.
void RxPacketCb(const Ptr< const Packet > p, const TcpHeader &h, const Ptr< const TcpSocketBase > tcp)
Rx packet Callback.
virtual void BytesInFlightTrace([[maybe_unused]] uint32_t oldValue, [[maybe_unused]] uint32_t newValue)
Bytes in flight changes.
virtual Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
uint32_t GetDupAckCount(SocketWho who)
Get the number of dupack received.
Time GetPktInterval() const
Get the interval to wait for each packet sent down from application to TCP.
void SetPaceInitialWindow(SocketWho who, bool paceWindow)
Enable or disable pacing of the initial window.
uint32_t GetInitialSsThresh(SocketWho who)
Get the initial slow start threshold.
virtual Ptr< TcpSocketMsgBase > CreateSocket(Ptr< Node > node, TypeId socketType, TypeId congControl)
Create a socket.
virtual void NextTxSeqTrace([[maybe_unused]] SequenceNumber32 oldValue, [[maybe_unused]] SequenceNumber32 newValue)
Next tx seq changes.
virtual void DoRun(void)
Execute the tcp test.
virtual Ptr< SimpleChannel > CreateChannel()
Create and return the channel installed between the two socket.
virtual void DataSent([[maybe_unused]] uint32_t size, [[maybe_unused]] SocketWho who)
Notifying application for sent data.
Time GetDelAckTimeout(SocketWho who)
Get the timeout of delayed ack (if present)
void SetMTU(uint32_t mtu)
MTU of the bottleneck link.
Time GetPropagationDelay() const
Get the channel Propagation Delay.
Time GetClockGranularity(SocketWho who)
Get the clock granularity attribute.
void SetUseEcn(SocketWho who, TcpSocketState::UseEcn_t useEcn)
Forcefully set the ECN mode of use.
Time m_startTime
Data transmission time.
Ptr< TcpSocketMsgBase > m_senderSocket
Pointer to sender socket.
void DoConnect()
Scheduled at 0.0, SENDER starts the connection to RECEIVER.
Time GetRto(SocketWho who)
Get the retransmission time.
Ptr< TcpRxBuffer > GetRxBuffer(SocketWho who)
Get the Rx buffer from selected socket.
Time GetConnTimeout(SocketWho who)
Get the retransmission time for the SYN segments.
void AfterRetransmitCb(const Ptr< const TcpSocketState > tcb, const Ptr< const TcpSocketBase > tcp)
Invoked after a retransmit event.
void SetAppPktInterval(Time pktInterval)
Interval between app-generated packet.
uint32_t GetRWnd(SocketWho who)
Get the rWnd of the selected socket.
void PhyDropCb(std::string context, Ptr< const Packet > p)
Drop at Phy layer Callback.
uint32_t GetSegSize(SocketWho who)
Get the segment size of the node specified.
TypeId m_congControlTypeId
Congestion control.
virtual void ReceivePacket(Ptr< Socket > socket)
Packet received.
void DataSentCb(Ptr< Socket > socket, uint32_t size)
Data sent Callback.
Time GetStartTime() const
Get the data start time.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
virtual void PhyDrop([[maybe_unused]] SocketWho who)
Link drop.
void SendPacket(Ptr< Socket > socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
Send packets to other endpoint.
virtual void NormalClose([[maybe_unused]] SocketWho who)
Socket closed normally.
virtual void SsThreshTrace([[maybe_unused]] uint32_t oldValue, [[maybe_unused]] uint32_t newValue)
Slow start threshold changes.
uint32_t GetMtu() const
Get the MTU of the environment.
void NormalCloseCb(Ptr< Socket > socket)
Normal Close Callback.
virtual void ConfigureEnvironment(void)
Change the configuration of the environment.
Time m_propagationDelay
Propagation delay of the channel.
void RcvAckCb(Ptr< const Packet > p, const TcpHeader &h, Ptr< const TcpSocketBase > tcp)
Receive ACK Callback.
TcpSocket::TcpStates_t GetTcpState(SocketWho who)
Get the state of the TCP state machine.
void RtoExpiredCb(const Ptr< const TcpSocketState > tcb, const Ptr< const TcpSocketBase > tcp)
RTO expired Callback.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssthresh.
SequenceNumber32 GetHighestTxMark(SocketWho who)
Get the highest tx mark of the node specified.
virtual void CongStateTrace([[maybe_unused]] const TcpSocketState::TcpCongState_t oldValue, [[maybe_unused]] const TcpSocketState::TcpCongState_t newValue)
State on Ack state machine changes.
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
Time GetPersistentTimeout(SocketWho who)
Get the persistent timeout of the selected socket.
void SetRecoveryAlgorithm(TypeId recovery)
recovery algorithm of the sender socket
virtual void BeforeRTOExpired([[maybe_unused]] const Ptr< const TcpSocketState > tcb, [[maybe_unused]] SocketWho who)
Rto has expired.
virtual void DoTeardown(void)
Teardown the TCP test.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
Ptr< TcpSocketMsgBase > GetSenderSocket()
Get the pointer to a previously created sender socket.
virtual void RateUpdatedTrace([[maybe_unused]] const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
void SetPacingStatus(SocketWho who, bool pacing)
Enable or disable pacing in the TCP socket.
Ptr< TcpSocketMsgBase > m_receiverSocket
Pointer to receiver socket.
virtual Ptr< ErrorModel > CreateSenderErrorModel()
Create and return the error model to install in the sender node.
uint32_t GetInitialCwnd(SocketWho who)
Get the initial congestion window.
TcpGeneralTest(const std::string &desc)
TcpGeneralTest constructor.
void UpdateRttHistoryCb(Ptr< const TcpSocketBase > tcp, const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update RTT with new data.
uint32_t GetPktSize() const
Get the application packet size.
virtual void RtoTrace([[maybe_unused]] Time oldValue, [[maybe_unused]] Time newValue)
RTO changes.
void ProcessedAckCb(Ptr< const Packet > p, const TcpHeader &h, Ptr< const TcpSocketBase > tcp)
ACK processed Callback.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
virtual void CWndInflTrace([[maybe_unused]] uint32_t oldValue, [[maybe_unused]] uint32_t newValue)
Tracks the inflated congestion window changes.
InetSocketAddress m_remoteAddr
Remote peer address.
void SetSegmentSize(SocketWho who, uint32_t segmentSize)
Forcefully set the segment size.
virtual void AfterRTOExpired([[maybe_unused]] const Ptr< const TcpSocketState > tcb, [[maybe_unused]] SocketWho who)
Rto has expired.
A base class for implementation of a stream socket using TCP.
Class for inserting callbacks special points of the flow of TCP sockets.
UpdateRttCallback m_updateRttCb
Update RTT callback.
virtual void UpdateRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update the RTT history, when we send TCP segments.
AckManagementCb m_processedAckCb
Processed ACK callback.
virtual void CompleteFork(Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
Complete a connection by forking the socket.
void SetAfterRetransmitCb(RetrCb cb)
Set the callback invoked after the processing of a retransmit timeout.
Callback< void, Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > AckManagementCb
Callback for the ACK management.
void SetForkCb(Callback< void, Ptr< TcpSocketMsgBase > > cb)
Set the callback invoked after the forking.
Callback< void, Ptr< const TcpSocketState >, Ptr< const TcpSocketBase > > RetrCb
Callback for the packet retransmission management.
TcpSocketMsgBase(const TcpSocketMsgBase &other)
Constructor.
void SetRcvAckCb(AckManagementCb cb)
Set the callback invoked when an ACK is received (at the beginning of the processing)
AckManagementCb m_rcvAckCb
Receive ACK callback.
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
void SetProcessedAckCb(AckManagementCb cb)
Set the callback invoked when an ACK is received and processed (at the end of the processing)
void SetBeforeRetransmitCb(RetrCb cb)
Set the callback invoked before the processing of a retransmit timeout.
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received an ACK packet.
Callback< void, Ptr< const TcpSocketBase >, const SequenceNumber32 &, uint32_t, bool > UpdateRttCallback
Callback for the RTT update management.
RetrCb m_beforeRetrCallback
Before retransmission callback.
Callback< void, Ptr< TcpSocketMsgBase > > m_forkCb
Fork callback.
RetrCb m_afterRetrCallback
After retransmission callback.
static TypeId GetTypeId(void)
Get the type ID.
virtual void ReTxTimeout(void)
An RTO event happened.
void SetUpdateRttHistoryCb(UpdateRttCallback cb)
Set the callback invoked when we update rtt history.
A TCP socket which sends ACKs smaller than the segment received.
static TypeId GetTypeId(void)
Get the type ID.
SequenceNumber32 m_lastAckedSeq
Last sequence number ACKed.
uint32_t m_bytesToAck
Number of bytes to be ACKed.
Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
virtual void SendEmptyPacket(uint8_t flags)
Send a empty packet that carries a flag, e.g., ACK.
TcpSocketSmallAcks(const TcpSocketSmallAcks &other)
Constructor.
uint32_t m_bytesLeftToBeAcked
Number of bytes to be ACKed left.
void SetBytesToAck(uint32_t bytes)
Set the bytes to be ACKed.
UseEcn_t
Parameter value related to ECN enable/disable functionality similar to sysctl for tcp_ecn.
TcpCongState_t
Definition of the Congestion state machine.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TcpStates_t
Names of the 11 TCP states.
static TcpSocketState::TcpCongState_t GetCongStateFrom(Ptr< const TcpSocketState > tcb)
Convenience function to retrieve the ACK state from a TCB.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Information about the connection rate.
uint32_t pktSize
packet size used for the simulation (in bytes)