Index: src/internet/model/tcp-socket-base.h |
=================================================================== |
--- a/src/internet/model/tcp-socket-base.h |
+++ b/src/internet/model/tcp-socket-base.h |
@@ -37,6 +37,7 @@ |
#include "tcp-rx-buffer.h" |
#include "rtt-estimator.h" |
#include "tcp-congestion-ops.h" |
+#include "tcp-scoreboard.h" |
namespace ns3 { |
@@ -47,12 +48,16 @@ |
class TcpL4Protocol; |
class TcpHeader; |
+typedef std::pair<SequenceNumber32, SequenceNumber32> SackBlock; |
+typedef std::list<SackBlock> SackList; |
+ |
/** |
* \ingroup tcp |
* |
* \brief Helper class to store RTT measurements |
*/ |
-class RttHistory { |
+class RttHistory |
+{ |
public: |
/** |
* \brief Constructor - builds an RttHistory with the given parameters |
@@ -136,8 +141,8 @@ |
* \param [in] oldValue original value of the traced variable |
* \param [in] newValue new value of the traced variable |
*/ |
- typedef void (* TcpCongStatesTracedValueCallback)(const TcpCongState_t oldValue, |
- const TcpCongState_t newValue); |
+ typedef void (*TcpCongStatesTracedValueCallback)(const TcpCongState_t oldValue, |
+ const TcpCongState_t newValue); |
/** |
* \brief Literal names of TCP states for use in log messages |
@@ -160,7 +165,10 @@ |
* |
* \return Congestion window in segments |
*/ |
- uint32_t GetCwndInSegments () const { return m_cWnd / m_segmentSize; } |
+ uint32_t GetCwndInSegments () const |
+ { |
+ return m_cWnd / m_segmentSize; |
+ } |
}; |
/** |
@@ -351,7 +359,7 @@ |
* \param newValue new congestion state value |
*/ |
void UpdateCongState (TcpSocketState::TcpCongState_t oldValue, |
- TcpSocketState::TcpCongState_t newValue); |
+ TcpSocketState::TcpCongState_t newValue); |
/** |
* \brief Install a congestion control algorithm on this socket |
@@ -388,9 +396,9 @@ |
* \param [in] ipv4 |
* \param [in] interface |
*/ |
- typedef void (* TcpTxRxTracedCallback) |
+ typedef void (*TcpTxRxTracedCallback) |
(const Ptr<const Packet> packet, const TcpHeader& header, |
- const Ptr<const TcpSocketBase> socket); |
+ const Ptr<const TcpSocketBase> socket); |
protected: |
// Implementing ns3::TcpSocket -- Attribute get/set |
@@ -736,10 +744,10 @@ |
virtual uint16_t AdvertisedWindowSize (void) const; |
/** |
- * \brief Update the receiver window (RWND) based on the value of the |
+ * \brief Update the receiver window (RWND) based on the value of the |
* window field in the header. |
* |
- * This method suppresses updates unless one of the following three |
+ * This method suppresses updates unless one of the following three |
* conditions holds: 1) segment contains new data (advancing the right |
* edge of the receive buffer), 2) segment does not contain new data |
* but the segment acks new data (highest sequence number acked advances), |
@@ -817,7 +825,7 @@ |
/** |
* \brief Read TCP options from incoming packets |
- * |
+ * |
* This method sequentially checks each kind of option, and if it |
* is present in the header, starts its processing. |
* |
@@ -897,6 +905,42 @@ |
virtual void ScaleSsThresh (uint8_t scaleFactor); |
/** |
+ * \brief Process the Sack-Permitted option from other side |
+ * |
+ * \param option Sack-Permitted option from the packet |
+ */ |
+ void ProcessOptionSackPermitted (const Ptr<const TcpOption> option); |
+ /** |
+ * \brief Add the Sack-Permitted option to the header |
+ * |
+ * \param header TcpHeader to which the option is appended |
+ */ |
+ void AddOptionSackPermitted (TcpHeader& header); |
+ |
+ /** |
+ * \brief Re-arrange SACK blocks |
+ * |
+ * Make sure the block containing the triggering segment is the first |
+ * block to be sent, and the remaining blocks repeat the most recently |
+ * reported ones. |
+ * |
+ * \param seq Sequence number of the recently received packet |
+ */ |
+ void ArrangeSackBlocks (SequenceNumber32 seq); |
+ /** |
+ * \brief Process the SACK option from other side |
+ * |
+ * \param option SACK option from the packet |
+ */ |
+ void ProcessOptionSack (const Ptr<const TcpOption> option); |
+ /** |
+ * \brief Add the SACK option to the header |
+ * |
+ * \param header TcpHeader to which the SACK option is added |
+ */ |
+ void AddOptionSack (TcpHeader& header); |
+ |
+ /** |
* \brief Initialize congestion window |
* |
* Default cWnd to 1 MSS (RFC2001, sec.1) and must |
@@ -928,6 +972,7 @@ |
Time m_persistTimeout; //!< Time between sending 1-byte probes |
Time m_cnTimeout; //!< Timeout for connection retry |
RttHistory_t m_history; //!< List of sent packet |
+ bool m_afterRTO; //!< True if an RTO has just happened |
// Connections to other layers of TCP/IP |
Ipv4EndPoint* m_endPoint; //!< the IPv4 endpoint |
@@ -970,6 +1015,13 @@ |
bool m_timestampEnabled; //!< Timestamp option enabled |
uint32_t m_timestampToEcho; //!< Timestamp to echo |
+ bool m_sackEnabled; //!< SACK option enabled |
+ bool m_sackAllowed; //!< Receiver is allowed to send SACK after receiving Sack-Permitted |
+ SackList m_txSackList; //!< List of SACK blocks to be transmitted |
+ bool m_sackOptionAdded; //!< Header needs to append SACK option |
+ SackList m_rxSackList; //!< List of SACK blocks received from other side |
+ TcpScoreboard m_scoreBoard; //!< The sender's SACK information buffer |
+ |
EventId m_sendPendingDataEvent; //!< micro-delay event to send pending data |
// Fast Retransmit and Recovery |
@@ -978,11 +1030,11 @@ |
bool m_limitedTx; //!< perform limited transmit |
// Transmission Control Block |
- Ptr<TcpSocketState> m_tcb ; //!< Congestion control informations |
+ Ptr<TcpSocketState> m_tcb; //!< Congestion control informations |
Ptr<TcpCongestionOps> m_congestionControl; //!< Congestion control |
// Guesses over the other connection end |
- bool m_isFirstPartialAck;//!< First partial ACK during RECOVERY |
+ bool m_isFirstPartialAck; //!< First partial ACK during RECOVERY |
// The following two traces pass a packet with a TCP header |
TracedCallback<Ptr<const Packet>, const TcpHeader&, |
@@ -999,8 +1051,8 @@ |
* \param [in] oldValue original value of the traced variable |
* \param [in] newValue new value of the traced variable |
*/ |
-typedef void (* TcpCongStatesTracedValueCallback)(const TcpSocketState::TcpCongState_t oldValue, |
- const TcpSocketState::TcpCongState_t newValue); |
+typedef void (*TcpCongStatesTracedValueCallback)(const TcpSocketState::TcpCongState_t oldValue, |
+ const TcpSocketState::TcpCongState_t newValue); |
} // namespace ns3 |