18 #ifndef TCPGENERALTEST_H
19 #define TCPGENERALTEST_H
21 #include "ns3/error-model.h"
22 #include "ns3/simple-net-device.h"
23 #include "ns3/tcp-congestion-ops.h"
24 #include "ns3/tcp-rate-ops.h"
25 #include "ns3/tcp-recovery-ops.h"
26 #include "ns3/tcp-socket-base.h"
139 const Address& toAddress)
override;
338 TypeId recoveryAlgorithm);
374 void DoRun()
override;
734 virtual void CWndTrace(uint32_t oldValue [[maybe_unused]], uint32_t newValue [[maybe_unused]])
745 uint32_t newValue [[maybe_unused]])
770 uint32_t newValue [[maybe_unused]])
783 uint32_t newValue [[maybe_unused]])
953 uint32_t sz [[maybe_unused]],
954 bool isRetransmission [[maybe_unused]],
1122 bool isRetransmission);
a polymophic address class
An identifier for simulation events.
Smart pointer class similar to boost::intrusive_ptr.
General infrastructure for TCP testing.
virtual void PhyDrop(SocketWho who[[maybe_unused]])
Link drop.
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 BeforeRTOExpired(const Ptr< const TcpSocketState > tcb[[maybe_unused]], SocketWho who[[maybe_unused]])
Rto has expired.
TypeId m_recoveryTypeId
Recovery.
virtual void RttTrace(Time oldTime[[maybe_unused]], Time newTime[[maybe_unused]])
Rtt changes.
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 ErrorClose(SocketWho who[[maybe_unused]])
Socket closed with an error.
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.
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.
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.
virtual void NormalClose(SocketWho who[[maybe_unused]])
Socket closed normally.
uint32_t m_mtu
MTU of the environment.
Time GetMinRto(SocketWho who)
Get the minimum RTO attribute.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate[[maybe_unused]])
Track the rate value of TcpRateLinux.
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.
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 Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb[[maybe_unused]], SocketWho who[[maybe_unused]])
Rto has expired.
uint32_t GetDupAckCount(SocketWho who)
Get the number of dupack received.
virtual void SsThreshTrace(uint32_t oldValue[[maybe_unused]], uint32_t newValue[[maybe_unused]])
Slow start threshold changes.
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.
~TcpGeneralTest() override
virtual void ConfigureProperties()
Change the configuration of the socket properties.
virtual Ptr< SimpleChannel > CreateChannel()
Create and return the channel installed between the two socket.
void DoRun() override
Execute the tcp test.
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.
virtual void BytesInFlightTrace(uint32_t oldValue[[maybe_unused]], uint32_t newValue[[maybe_unused]])
Bytes in flight changes.
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 UpdatedRttHistory(const SequenceNumber32 &seq[[maybe_unused]], uint32_t sz[[maybe_unused]], bool isRetransmission[[maybe_unused]], SocketWho who[[maybe_unused]])
Updated the Rtt history.
virtual void RtoTrace(Time oldValue[[maybe_unused]], Time newValue[[maybe_unused]])
RTO changes.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
void SendPacket(Ptr< Socket > socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
Send packets to other endpoint.
uint32_t GetMtu() const
Get the MTU of the environment.
void NormalCloseCb(Ptr< Socket > socket)
Normal Close Callback.
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample[[maybe_unused]])
Track the rate sample value of TcpRateLinux.
Time m_propagationDelay
Propagation delay of the channel.
void RcvAckCb(Ptr< const Packet > p, const TcpHeader &h, Ptr< const TcpSocketBase > tcp)
Receive ACK Callback.
virtual void RcvAck(const Ptr< const TcpSocketState > tcb[[maybe_unused]], const TcpHeader &h[[maybe_unused]], SocketWho who[[maybe_unused]])
Received ack.
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.
virtual void NextTxSeqTrace(SequenceNumber32 oldValue[[maybe_unused]], SequenceNumber32 newValue[[maybe_unused]])
Next tx seq changes.
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 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 DataSent(uint32_t size[[maybe_unused]], SocketWho who[[maybe_unused]])
Notifying application for sent data.
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.
void SetPacingStatus(SocketWho who, bool pacing)
Enable or disable pacing in the TCP socket.
Ptr< TcpSocketMsgBase > m_receiverSocket
Pointer to receiver socket.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
virtual Ptr< ErrorModel > CreateSenderErrorModel()
Create and return the error model to install in the sender node.
virtual void CWndInflTrace(uint32_t oldValue[[maybe_unused]], uint32_t newValue[[maybe_unused]])
Tracks the inflated congestion window changes.
uint32_t GetInitialCwnd(SocketWho who)
Get the initial congestion window.
TcpGeneralTest(const std::string &desc)
TcpGeneralTest constructor.
virtual void ProcessedAck(const Ptr< const TcpSocketState > tcb[[maybe_unused]], const TcpHeader &h[[maybe_unused]], SocketWho who[[maybe_unused]])
Processed ack.
virtual void CongStateTrace(const TcpSocketState::TcpCongState_t oldValue[[maybe_unused]], const TcpSocketState::TcpCongState_t newValue[[maybe_unused]])
State on Ack state machine changes.
void UpdateRttHistoryCb(Ptr< const TcpSocketBase > tcp, const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update RTT with new data.
virtual void CWndTrace(uint32_t oldValue[[maybe_unused]], uint32_t newValue[[maybe_unused]])
Tracks the congestion window changes.
uint32_t GetPktSize() const
Get the application packet size.
virtual void QueueDrop(SocketWho who[[maybe_unused]])
Drop on the queue.
void ProcessedAckCb(Ptr< const Packet > p, const TcpHeader &h, Ptr< const TcpSocketBase > tcp)
ACK processed Callback.
void DoTeardown() override
Teardown the TCP test.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
InetSocketAddress m_remoteAddr
Remote peer address.
void SetSegmentSize(SocketWho who, uint32_t segmentSize)
Forcefully set the segment size.
virtual void HighestTxSeqTrace(SequenceNumber32 oldValue[[maybe_unused]], SequenceNumber32 newValue[[maybe_unused]])
Highest tx seq changes.
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.
void SetForkCb(Callback< void, Ptr< TcpSocketMsgBase >> cb)
Set the callback invoked after the forking.
AckManagementCb m_processedAckCb
Processed ACK callback.
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.
Callback< void, Ptr< const TcpSocketState >, Ptr< const TcpSocketBase > > RetrCb
Callback for the packet retransmission management.
TcpSocketMsgBase(const TcpSocketMsgBase &other)
Constructor.
void UpdateRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission) override
Update the RTT history, when we send TCP segments.
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.
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.
void CompleteFork(Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress) override
Complete a connection by forking the socket.
Ptr< TcpSocketBase > Fork() override
Call CopyObject<> to clone me.
static TypeId GetTypeId()
Get the type ID.
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.
void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader) override
Received an ACK packet.
RetrCb m_afterRetrCallback
After retransmission callback.
void ReTxTimeout() override
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()
Get the type ID.
SequenceNumber32 m_lastAckedSeq
Last sequence number ACKed.
uint32_t m_bytesToAck
Number of bytes to be ACKed.
void SendEmptyPacket(uint8_t flags) override
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.
Ptr< TcpSocketBase > Fork() override
Call CopyObject<> to clone me.
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.
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)