src/internet-node/tcp-header.cc
changeset 2769 05982d1a9286
parent 2650 3de4cacb8981
child 3131 d82336dfd269
--- a/src/internet-node/tcp-header.cc	Thu Mar 27 11:36:23 2008 -0400
+++ b/src/internet-node/tcp-header.cc	Thu Mar 27 12:27:41 2008 -0400
@@ -150,11 +150,41 @@
 }
 void TcpHeader::Print (std::ostream &os)  const
 {
-  //XXX
+  os << m_sourcePort << " > " << m_destinationPort;
+  if(m_flags!=0)
+  {
+    os<<" [";
+    if((m_flags & FIN) != 0)
+    {
+      os<<" FIN ";
+    }
+    if((m_flags & SYN) != 0)
+    {
+      os<<" SYN ";
+    }
+    if((m_flags & RST) != 0)
+    {
+      os<<" RST ";
+    }
+    if((m_flags & PSH) != 0)
+    {
+      os<<" PSH ";
+    }
+    if((m_flags & ACK) != 0)
+    {
+      os<<" ACK ";
+    }
+    if((m_flags & URG) != 0)
+    {
+      os<<" URG ";
+    }
+    os<<"]";
+  }
+  os<<" Seq="<<m_sequenceNumber<<" Ack="<<m_ackNumber<<" Win="<<m_windowSize;
 }
 uint32_t TcpHeader::GetSerializedSize (void)  const
 {
-  return 20;  //tcp headers are 20 bytes
+  return 4*m_length;
 }
 void TcpHeader::Serialize (Buffer::Iterator start)  const
 {