Index: src/internet/model/tcp-header.h |
=================================================================== |
--- a/src/internet/model/tcp-header.h |
+++ b/src/internet/model/tcp-header.h |
@@ -188,6 +188,13 @@ |
Ptr<const TcpOption> GetOption (uint8_t kind) const; |
/** |
+ * \brief Copy all options in a list |
+ * \note The list should be empty |
+ * \param options Return a copy of the options |
+ */ |
+ void GetOptions (TcpHeader::TcpOptionList& options) const; |
+ |
+ /** |
* \brief Get the list of option in this header |
* \return a const reference to the option list |
*/ |
@@ -353,6 +360,28 @@ |
uint8_t m_optionsLen; //!< Tcp options length. |
}; |
+ /** |
+ * \brief Helper function to find an MPTCP option |
+ * \param ret save found option in ret, otherwise |
+ * \return true if matching option type found. If false, ret should be considered invalid |
+ */ |
+template<class T> |
+bool |
+GetTcpOption (const TcpHeader& header, Ptr<const T>& ret) |
+{ |
+ TcpHeader::TcpOptionList l; |
+ header.GetOptions (l); |
+ for (auto it = l.begin(); it != l.end(); it++ ) |
+ { ; |
+ if ((*it)->GetInstanceTypeId () == T::GetTypeId()) |
+ { |
+ ret = DynamicCast<const T> (*it ); |
+ return (ret != 0); |
+ } |
+ } |
+ return false; |
+} |
+ |
} // namespace ns3 |
#endif /* TCP_HEADER */ |