TcpHeader can be printed in NS_LOG messages
Implemented the operator << to an output stream.
--- a/src/internet/model/tcp-header.cc Mon Jul 13 08:06:38 2015 -0700
+++ b/src/internet/model/tcp-header.cc Mon Jul 13 08:23:40 2015 -0700
@@ -516,4 +516,11 @@
);
}
+std::ostream&
+operator<< (std::ostream& os, TcpHeader const & tc)
+{
+ tc.Print (os);
+ return os;
+}
+
} // namespace ns3
--- a/src/internet/model/tcp-header.h Mon Jul 13 08:06:38 2015 -0700
+++ b/src/internet/model/tcp-header.h Mon Jul 13 08:23:40 2015 -0700
@@ -48,6 +48,15 @@
virtual ~TcpHeader ();
/**
+ * \brief Print a TCP header into an output stream
+ *
+ * \param os output stream
+ * \param tc TCP header to print
+ * \return The ostream passed as first argument
+ */
+ friend std::ostream& operator<<(std::ostream& os, TcpHeader const & tc);
+
+ /**
* \brief Converts an integer into a human readable list of Tcp flags
*
* \param flags Bitfield of TCP flags to convert to a readable string