Thu Jan 21 11:06:25 2016 +0100 c8c43ce (HEAD -> tcp-sack, mirror/tcp-sack) Added IsTcpOptionEnabled  [Natale Patriciello] diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index 5ac7066..204f694 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -1373,6 +1373,23 @@ TcpSocketBase::ProcessEstablished (Ptr packet, const TcpHeader& tcpHeade } } +bool +TcpSocketBase::IsTcpOptionEnabled (uint8_t kind) const +{ + NS_LOG_FUNCTION(this << (int)kind); + + switch(kind) + { + case TcpOption::TS: + return m_timestampEnabled; + case TcpOption::WINSCALE: + return m_winScalingEnabled; + default: + break; + }; + return false; +} + void TcpSocketBase::ReadOptions (const TcpHeader &tcpHeader) { diff --git a/src/internet/model/tcp-socket-base.h b/src/internet/model/tcp-socket-base.h index 77196ba..5a5ae2c 100644 --- a/src/internet/model/tcp-socket-base.h +++ b/src/internet/model/tcp-socket-base.h @@ -843,6 +843,14 @@ protected: void ReadOptions (const TcpHeader &tcpHeader); /** + * \brief Return true if the specified option is enabled + * + * \param kind kind of TCP option + * \return true if the option is enabled + */ + bool IsTcpOptionEnabled (uint8_t kind) const; + + /** * \brief Read and parse the Window scale option * * Read the window scale option (encoded logarithmically) and save it.