bug 200: Packet::PrintTags is not implemented.
1.1 --- a/samples/main-packet-tag.cc Mon Jun 02 10:51:55 2008 -0700
1.2 +++ b/samples/main-packet-tag.cc Tue Jun 03 16:20:17 2008 -0700
1.3 @@ -33,6 +33,7 @@
1.4 virtual uint32_t GetSerializedSize (void) const;
1.5 virtual void Serialize (TagBuffer i) const;
1.6 virtual void Deserialize (TagBuffer i);
1.7 + virtual void Print (std::ostream &os) const;
1.8
1.9 // these are our accessors to our tag structure
1.10 void SetSimpleValue (uint8_t value);
1.11 @@ -76,6 +77,11 @@
1.12 m_simpleValue = i.ReadU8 ();
1.13 }
1.14 void
1.15 +MyTag::Print (std::ostream &os) const
1.16 +{
1.17 + os << "v=" << (uint32_t)m_simpleValue;
1.18 +}
1.19 +void
1.20 MyTag::SetSimpleValue (uint8_t value)
1.21 {
1.22 m_simpleValue = value;
1.23 @@ -94,7 +100,7 @@
1.24 tag.SetSimpleValue (0x56);
1.25
1.26 // store the tag in a packet.
1.27 - Ptr<Packet> p = Create<Packet> ();
1.28 + Ptr<Packet> p = Create<Packet> (100);
1.29 p->AddTag (tag);
1.30
1.31 // create a copy of the packet
2.1 --- a/src/common/packet.cc Mon Jun 02 10:51:55 2008 -0700
2.2 +++ b/src/common/packet.cc Tue Jun 03 16:20:17 2008 -0700
2.3 @@ -291,8 +291,30 @@
2.4 void
2.5 Packet::PrintTags (std::ostream &os) const
2.6 {
2.7 - // XXX:
2.8 - //m_tagList.Print (os, " ");
2.9 + TagIterator i = GetTagIterator ();
2.10 + while (i.HasNext ())
2.11 + {
2.12 + TagIterator::Item item = i.Next ();
2.13 + os << item.GetTypeId ().GetName () << " [" << item.GetStart () << "-" << item.GetEnd () << "]";
2.14 + Callback<ObjectBase *> constructor = item.GetTypeId ().GetConstructor ();
2.15 + if (constructor.IsNull ())
2.16 + {
2.17 + if (i.HasNext ())
2.18 + {
2.19 + os << " ";
2.20 + }
2.21 + continue;
2.22 + }
2.23 + Tag *tag = dynamic_cast<Tag *> (constructor ());
2.24 + NS_ASSERT (tag != 0);
2.25 + os << " ";
2.26 + tag->Print (os);
2.27 + if (i.HasNext ())
2.28 + {
2.29 + os << " ";
2.30 + }
2.31 + delete tag;
2.32 + }
2.33 }
2.34
2.35 void
2.36 @@ -576,6 +598,9 @@
2.37 }
2.38 }
2.39 }
2.40 + virtual void Print (std::ostream &os) const {
2.41 + os << N;
2.42 + }
2.43 ATestTag ()
2.44 : ATestTagBase () {}
2.45 };
3.1 --- a/src/common/tag.h Mon Jun 02 10:51:55 2008 -0700
3.2 +++ b/src/common/tag.h Tue Jun 03 16:20:17 2008 -0700
3.3 @@ -61,6 +61,13 @@
3.4 * Tag::Serialize.
3.5 */
3.6 virtual void Deserialize (TagBuffer i) = 0;
3.7 +
3.8 + /**
3.9 + * \param os the stream to print to
3.10 + *
3.11 + * This method is typically invoked from the Packet::PrintTags method
3.12 + */
3.13 + virtual void Print (std::ostream &os) const = 0;
3.14 };
3.15
3.16 } // namespace ns3
4.1 --- a/src/contrib/delay-jitter-estimation.cc Mon Jun 02 10:51:55 2008 -0700
4.2 +++ b/src/contrib/delay-jitter-estimation.cc Tue Jun 03 16:20:17 2008 -0700
4.3 @@ -16,7 +16,7 @@
4.4 virtual uint32_t GetSerializedSize (void) const;
4.5 virtual void Serialize (TagBuffer i) const;
4.6 virtual void Deserialize (TagBuffer i);
4.7 -
4.8 + virtual void Print (std::ostream &os) const;
4.9
4.10 Time GetTxTime (void) const;
4.11 private:
4.12 @@ -62,6 +62,11 @@
4.13 {
4.14 m_creationTime = i.ReadU64 ();
4.15 }
4.16 +void
4.17 +DelayJitterEstimationTimestampTag::Print (std::ostream &os) const
4.18 +{
4.19 + os << "CreationTime=" << m_creationTime;
4.20 +}
4.21 Time
4.22 DelayJitterEstimationTimestampTag::GetTxTime (void) const
4.23 {
5.1 --- a/src/devices/wifi/mac-low.cc Mon Jun 02 10:51:55 2008 -0700
5.2 +++ b/src/devices/wifi/mac-low.cc Tue Jun 03 16:20:17 2008 -0700
5.3 @@ -47,6 +47,7 @@
5.4 virtual uint32_t GetSerializedSize (void) const;
5.5 virtual void Serialize (TagBuffer i) const;
5.6 virtual void Deserialize (TagBuffer i);
5.7 + virtual void Print (std::ostream &os) const;
5.8
5.9 void Set (double snr);
5.10 double Get (void) const;
5.11 @@ -89,6 +90,11 @@
5.12 m_snr = i.ReadDouble ();
5.13 }
5.14 void
5.15 +SnrTag::Print (std::ostream &os) const
5.16 +{
5.17 + os << "Snr=" << m_snr;
5.18 +}
5.19 +void
5.20 SnrTag::Set (double snr)
5.21 {
5.22 m_snr = snr;
6.1 --- a/src/devices/wifi/wifi-remote-station-manager.cc Mon Jun 02 10:51:55 2008 -0700
6.2 +++ b/src/devices/wifi/wifi-remote-station-manager.cc Tue Jun 03 16:20:17 2008 -0700
6.3 @@ -319,6 +319,7 @@
6.4 virtual uint32_t GetSerializedSize (void) const;
6.5 virtual void Serialize (TagBuffer i) const;
6.6 virtual void Deserialize (TagBuffer i);
6.7 + virtual void Print (std::ostream &os) const;
6.8 private:
6.9 WifiMode m_rtsMode;
6.10 WifiMode m_dataMode;
6.11 @@ -381,6 +382,11 @@
6.12 i.Read ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
6.13 i.Read ((uint8_t *)&m_dataMode, sizeof (WifiMode));
6.14 }
6.15 +void
6.16 +TxModeTag::Print (std::ostream &os) const
6.17 +{
6.18 + os << "Rts=" << m_rtsMode << ", Data=" << m_dataMode;
6.19 +}
6.20
6.21 } // namespace ns3
6.22
7.1 --- a/src/node/socket.cc Mon Jun 02 10:51:55 2008 -0700
7.2 +++ b/src/node/socket.cc Tue Jun 03 16:20:17 2008 -0700
7.3 @@ -311,6 +311,11 @@
7.4 {
7.5 m_address.Deserialize (i);
7.6 }
7.7 +void
7.8 +SocketRxAddressTag::Print (std::ostream &os) const
7.9 +{
7.10 + os << "address=" << m_address;
7.11 +}
7.12
7.13 SocketIpTtlTag::SocketIpTtlTag ()
7.14 {
7.15 @@ -359,5 +364,10 @@
7.16 {
7.17 m_ttl = i.ReadU8 ();
7.18 }
7.19 +void
7.20 +SocketIpTtlTag::Print (std::ostream &os) const
7.21 +{
7.22 + os << "Ttl=" << (uint32_t) m_ttl;
7.23 +}
7.24
7.25 }//namespace ns3
8.1 --- a/src/node/socket.h Mon Jun 02 10:51:55 2008 -0700
8.2 +++ b/src/node/socket.h Tue Jun 03 16:20:17 2008 -0700
8.3 @@ -398,6 +398,7 @@
8.4 virtual uint32_t GetSerializedSize (void) const;
8.5 virtual void Serialize (TagBuffer i) const;
8.6 virtual void Deserialize (TagBuffer i);
8.7 + virtual void Print (std::ostream &os) const;
8.8
8.9 private:
8.10 Address m_address;
8.11 @@ -419,6 +420,7 @@
8.12 virtual uint32_t GetSerializedSize (void) const;
8.13 virtual void Serialize (TagBuffer i) const;
8.14 virtual void Deserialize (TagBuffer i);
8.15 + virtual void Print (std::ostream &os) const;
8.16
8.17 private:
8.18 uint8_t m_ttl;
9.1 --- a/utils/bench-packets.cc Mon Jun 02 10:51:55 2008 -0700
9.2 +++ b/utils/bench-packets.cc Tue Jun 03 16:20:17 2008 -0700
9.3 @@ -149,6 +149,9 @@
9.4 buf.ReadU8 ();
9.5 }
9.6 }
9.7 + virtual void Print (std::ostream &os) const {
9.8 + os << "N=" << N;
9.9 + }
9.10 BenchTag ()
9.11 : Tag () {}
9.12 };