Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1545)

Unified Diff: src/internet/model/tcp-header.h

Issue 369810043: ns-3 mptcp
Patch Set: Removed debug/redundant code and update coding style Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/internet/model/mptcp-subflow.cc ('k') | src/internet/model/tcp-header.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 */
« no previous file with comments | « src/internet/model/mptcp-subflow.cc ('k') | src/internet/model/tcp-header.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b