Index: src/internet/model/tcp-socket-base.h |
=================================================================== |
--- a/src/internet/model/tcp-socket-base.h |
+++ b/src/internet/model/tcp-socket-base.h |
@@ -135,6 +135,33 @@ |
CA_LAST_STATE /**< Used only in debug messages */ |
} TcpCongState_t; |
+ typedef enum |
+ { |
+ CA_EVENT_TX_START, /* first transmit when no packets in flight */ |
+ CA_EVENT_CWND_RESTART, /* congestion window restart */ |
+ CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ |
+ CA_EVENT_LOSS, /* loss timeout */ |
+ CA_EVENT_ECN_NO_CE, /* ECT set, but not CE marked */ |
+ CA_EVENT_ECN_IS_CE, /* received CE marked IP packet */ |
+ CA_EVENT_DELAYED_ACK, /* Delayed ack is sent */ |
+ CA_EVENT_NON_DELAYED_ACK, |
+ } TcpCaEvent_t; |
+ |
+ /** |
+ * \brief Definition of the Ecn state machine |
+ * |
+ */ |
+ typedef enum |
+ { |
+ ECN_DISABLED = 0, /**< ECN disabled traffic */ |
+ ECN_IDLE, /**< ECN is enabled but currently there is no action pertaining to ECE or CWR to be taken */ |
+ ECN_CE_RCVD, /**< This state indicates that the receiver has received a packet with CE bit set in IP header */ |
+ ECN_ECE_SENT, /**< This state indicates that the receiver has sent an ACK with ECE bit set in TCP header */ |
+ ECN_ECE_RCVD, /**< This state indicates that the sender has received an ACK with ECE bit set in TCP header */ |
+ ECN_CWR_SENT /**< This state indicates that the sender has reduced the congestion window, and sent a packet |
+ * with CWR bit set in TCP header */ |
+ } EcnState_t; |
+ |
/** |
* \ingroup tcp |
* TracedValue Callback signature for TcpCongState_t |
@@ -146,10 +173,26 @@ |
const TcpCongState_t newValue); |
/** |
+ * \ingroup tcp |
+ * TracedValue Callback signature for EcnState_t |
+ * |
+ * \param [in] oldValue original value of the traced variable |
+ * \param [in] newValue new value of the traced variable |
+ */ |
+ typedef void (* EcnStatesTracedValueCallback)(const EcnState_t oldValue, |
+ const EcnState_t newValue); |
+ |
+ /** |
* \brief Literal names of TCP states for use in log messages |
*/ |
static const char* const TcpCongStateName[TcpSocketState::CA_LAST_STATE]; |
+ /** |
+ * \brief Literal names of ECN states for use in log messages |
+ */ |
+ static const char* const EcnStateName[TcpSocketState::ECN_CWR_SENT+1]; |
+ |
+ |
// Congestion control |
TracedValue<uint32_t> m_cWnd; //!< Congestion window |
TracedValue<uint32_t> m_ssThresh; //!< Slow start threshold |
@@ -161,6 +204,7 @@ |
SequenceNumber32 m_lastAckedSeq; //!< Last sequence ACKed |
TracedValue<TcpCongState_t> m_congState; //!< State in the Congestion state machine |
+ TracedValue<EcnState_t> m_ecnState; //!< Current ECN State, represented as combination of EcnState values |
TracedValue<SequenceNumber32> m_highTxMark; //!< Highest seqno ever sent, regardless of ReTx |
TracedValue<SequenceNumber32> m_nextTxSequence; //!< Next seqnum to be sent (SND.NXT), ReTx pushes it back |
@@ -404,6 +448,11 @@ |
* \brief Callback pointer for congestion state trace chaining |
*/ |
TracedCallback<TcpSocketState::TcpCongState_t, TcpSocketState::TcpCongState_t> m_congStateTrace; |
+ |
+ /** |
+ * \brief Callback pointer for congestion state trace chaining |
+ */ |
+ TracedCallback<TcpSocketState::EcnState_t, TcpSocketState::EcnState_t> m_ecnStateTrace; |
/** |
* \brief Callback pointer for high tx mark chaining |
@@ -438,6 +487,14 @@ |
TcpSocketState::TcpCongState_t newValue); |
/** |
+ * \brief Callback function to hook to EcnState state |
+ * \param oldValue old ecn state value |
+ * \param newValue new ecn state value |
+ */ |
+ void UpdateEcnState (TcpSocketState::EcnState_t oldValue, |
+ TcpSocketState::EcnState_t newValue); |
+ |
+ /** |
* \brief Callback function to hook to TcpSocketState high tx mark |
* \param oldValue old high tx mark |
* \param newValue new high tx mark |
@@ -458,6 +515,11 @@ |
*/ |
void SetCongestionControlAlgorithm (Ptr<TcpCongestionOps> algo); |
+ /** |
+ * \brief Sets the variable m_ecn true to use ECN functionality |
+ */ |
+ void SetEcn(); |
+ |
// Necessary implementations of null functions from ns3::Socket |
virtual enum SocketErrno GetErrno (void) const; // returns m_errno |
virtual enum SocketType GetSocketType (void) const; // returns socket type |
@@ -484,8 +546,8 @@ |
* TracedCallback signature for tcp packet transmission or reception events. |
* |
* \param [in] packet The packet. |
- * \param [in] header The TcpHeader |
- * \param [in] socket This socket |
+ * \param [in] ipv4 |
+ * \param [in] interface |
*/ |
typedef void (* TcpTxRxTracedCallback)(const Ptr<const Packet> packet, const TcpHeader& header, |
const Ptr<const TcpSocketBase> socket); |
@@ -521,7 +583,11 @@ |
virtual bool SetAllowBroadcast (bool allowBroadcast); |
virtual bool GetAllowBroadcast (void) const; |
- |
+ /** |
+ * \brief TcpDctcp friend class (TcpDctcp can use protected members of this class) |
+ * \relates TcpDctcp |
+ */ |
+ friend class TcpDctcp; |
// Helper functions: Connection set up |
@@ -653,7 +719,7 @@ |
* \param withAck forces an ACK to be sent |
* \returns the number of bytes sent |
*/ |
- uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck); |
+ virtual uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck); |
/** |
* \brief Send a empty packet that carries a flag, e.g., ACK |
@@ -1158,6 +1224,12 @@ |
TracedCallback<Ptr<const Packet>, const TcpHeader&, |
Ptr<const TcpSocketBase> > m_rxTrace; //!< Trace of received packets |
+ |
+ // Parameters related to Explicit Congestion Notification |
+ bool m_ecn; //!< Socket ECN capability |
+ TracedValue<SequenceNumber32> m_ecnEchoSeq; //!< Sequence number of the last received ECN Echo |
+ TracedValue<SequenceNumber32> m_ecnCESeq; //!< Sequence number of the last received Congestion Experienced |
+ TracedValue<SequenceNumber32> m_ecnCWRSeq; //!< Sequence number of the last sent CWR |
}; |
/** |
@@ -1170,6 +1242,16 @@ |
typedef void (* TcpCongStatesTracedValueCallback)(const TcpSocketState::TcpCongState_t oldValue, |
const TcpSocketState::TcpCongState_t newValue); |
+/** |
+ * \ingroup tcp |
+ * TracedValue Callback signature for EcnsState_t |
+ * |
+ * \param [in] oldValue original value of the traced variable |
+ * \param [in] newValue new value of the traced variable |
+ */ |
+typedef void (* EcnStatesTracedValueCallback)(const TcpSocketState::EcnState_t oldValue, |
+ const TcpSocketState::EcnState_t newValue); |
+ |
} // namespace ns3 |
#endif /* TCP_SOCKET_BASE_H */ |