--- a/src/applications/packet-sink/packet-sink.cc Wed May 21 19:00:38 2008 -0700
+++ b/src/applications/packet-sink/packet-sink.cc Wed May 21 22:40:18 2008 -0700
@@ -106,10 +106,10 @@
while (packet = socket->Recv ())
{
SocketRxAddressTag tag;
- bool found = packet->PeekTag (tag);
+ bool found = packet->FindFirstMatchingTag (tag);
NS_ASSERT (found);
Address from = tag.GetAddress ();
- packet->RemoveTag (tag);
+ // XXX packet->RemoveTag (tag);
if (InetSocketAddress::IsMatchingType (from))
{
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
--- a/src/applications/udp-echo/udp-echo-client.cc Wed May 21 19:00:38 2008 -0700
+++ b/src/applications/udp-echo/udp-echo-client.cc Wed May 21 22:40:18 2008 -0700
@@ -153,10 +153,10 @@
while (packet = socket->Recv ())
{
SocketRxAddressTag tag;
- bool found = packet->PeekTag (tag);
+ bool found = packet->FindFirstMatchingTag (tag);
NS_ASSERT (found);
Address from = tag.GetAddress ();
- packet->RemoveTag (tag);
+ // XXX packet->RemoveTag (tag);
if (InetSocketAddress::IsMatchingType (from))
{
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
--- a/src/applications/udp-echo/udp-echo-server.cc Wed May 21 19:00:38 2008 -0700
+++ b/src/applications/udp-echo/udp-echo-server.cc Wed May 21 22:40:18 2008 -0700
@@ -98,10 +98,10 @@
while (packet = socket->Recv ())
{
SocketRxAddressTag tag;
- bool found = packet->PeekTag (tag);
+ bool found = packet->FindFirstMatchingTag (tag);
NS_ASSERT (found);
Address from = tag.GetAddress ();
- packet->RemoveTag (tag);
+ // XXX packet->RemoveTag (tag);
if (InetSocketAddress::IsMatchingType (from))
{
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
--- a/src/internet-node/ipv4-l3-protocol.cc Wed May 21 19:00:38 2008 -0700
+++ b/src/internet-node/ipv4-l3-protocol.cc Wed May 21 22:40:18 2008 -0700
@@ -490,9 +490,7 @@
// Set TTL to 1 if it is a broadcast packet of any type. Otherwise,
// possibly override the default TTL if the packet is tagged
SocketIpTtlTag tag;
- bool found = packet->PeekTag (tag);
- uint8_t socketTtl = tag.GetTtl ();
- packet->RemoveTag (tag);
+ bool found = packet->FindFirstMatchingTag (tag);
if (destination.IsBroadcast ())
{
@@ -500,7 +498,8 @@
}
else if (found)
{
- ipHeader.SetTtl (socketTtl);
+ ipHeader.SetTtl (tag.GetTtl ());
+ // XXX remove tag here?
}
else
{
--- a/src/node/socket.cc Wed May 21 19:00:38 2008 -0700
+++ b/src/node/socket.cc Wed May 21 22:40:18 2008 -0700
@@ -30,19 +30,6 @@
namespace ns3 {
-#if 0
-TypeId
-Socket::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::Socket")
- .SetParent<Object> ()
- .AddConstructor<Socket> ()
- ;
- return tid;
-}
-
-#endif
-
Socket::Socket (void)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -266,42 +253,14 @@
}
}
+/***************************************************************
+ * Socket Tags
+ ***************************************************************/
+
SocketRxAddressTag::SocketRxAddressTag ()
{
}
-uint32_t
-SocketRxAddressTag::GetUid (void)
-{
- static uint32_t uid = ns3::Tag::AllocateUid<SocketRxAddressTag> ("SocketRxAddressTag.ns3");
- return uid;
-}
-
-void
-SocketRxAddressTag::Print (std::ostream &os) const
-{
- os << "address="<< m_address;
-}
-
-uint32_t
-SocketRxAddressTag::GetSerializedSize (void) const
-{
- return 0;
-}
-
-void
-SocketRxAddressTag::Serialize (Buffer::Iterator i) const
-{
- // for local use in stack only
-}
-
-uint32_t
-SocketRxAddressTag::Deserialize (Buffer::Iterator i)
-{
- // for local use in stack only
- return 0;
-}
-
void
SocketRxAddressTag::SetAddress (Address addr)
{
@@ -314,40 +273,39 @@
return m_address;
}
-SocketIpTtlTag::SocketIpTtlTag ()
+
+TypeId
+SocketRxAddressTag::GetTypeId (void)
{
-}
-
-uint32_t
-SocketIpTtlTag::GetUid (void)
-{
- static uint32_t uid = ns3::Tag::AllocateUid<SocketIpTtlTag> ("SocketIpTtlTag.ns3");
- return uid;
+ static TypeId tid = TypeId ("ns3::SocketRxAddressTag")
+ .SetParent<Tag> ()
+ .AddConstructor<SocketRxAddressTag> ()
+ ;
+ return tid;
}
-
-void
-SocketIpTtlTag::Print (std::ostream &os) const
+TypeId
+SocketRxAddressTag::GetInstanceTypeId (void) const
{
- os << "ttl="<< m_ttl;
+ return GetTypeId ();
}
-
uint32_t
-SocketIpTtlTag::GetSerializedSize (void) const
-{
+SocketRxAddressTag::GetSerializedSize (void) const
+{
return 0;
}
-
void
-SocketIpTtlTag::Serialize (Buffer::Iterator i) const
-{
+SocketRxAddressTag::Serialize (TagBuffer i) const
+{
+ // for local use in stack only
+}
+void
+SocketRxAddressTag::Deserialize (TagBuffer i)
+{
// for local use in stack only
}
-uint32_t
-SocketIpTtlTag::Deserialize (Buffer::Iterator i)
+SocketIpTtlTag::SocketIpTtlTag ()
{
- // for local use in stack only
- return 0;
}
void
@@ -362,4 +320,35 @@
return m_ttl;
}
+
+TypeId
+SocketIpTtlTag::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::SocketIpTtlTag")
+ .SetParent<Tag> ()
+ .AddConstructor<SocketIpTtlTag> ()
+ ;
+ return tid;
+}
+TypeId
+SocketIpTtlTag::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+uint32_t
+SocketIpTtlTag::GetSerializedSize (void) const
+{
+ return 0;
+}
+void
+SocketIpTtlTag::Serialize (TagBuffer i) const
+{
+ // for local use in stack only
+}
+void
+SocketIpTtlTag::Deserialize (TagBuffer i)
+{
+ // for local use in stack only
+}
+
}//namespace ns3
--- a/src/node/socket.h Wed May 21 19:00:38 2008 -0700
+++ b/src/node/socket.h Wed May 21 22:40:18 2008 -0700
@@ -368,14 +368,15 @@
{
public:
SocketRxAddressTag ();
- static uint32_t GetUid (void);
- void Print (std::ostream &os) const;
- uint32_t GetSerializedSize (void) const;
- void Serialize (Buffer::Iterator i) const;
- uint32_t Deserialize (Buffer::Iterator i);
-
void SetAddress (Address addr);
Address GetAddress (void) const;
+
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (TagBuffer i) const;
+ virtual void Deserialize (TagBuffer i);
+
private:
Address m_address;
};
@@ -388,14 +389,15 @@
{
public:
SocketIpTtlTag ();
- static uint32_t GetUid (void);
- void Print (std::ostream &os) const;
- uint32_t GetSerializedSize (void) const;
- void Serialize (Buffer::Iterator i) const;
- uint32_t Deserialize (Buffer::Iterator i);
-
void SetTtl (uint8_t ttl);
uint8_t GetTtl (void) const;
+
+ static TypeId GetTypeId (void);
+ virtual TypeId GetInstanceTypeId (void) const;
+ virtual uint32_t GetSerializedSize (void) const;
+ virtual void Serialize (TagBuffer i) const;
+ virtual void Deserialize (TagBuffer i);
+
private:
uint8_t m_ttl;
};
--- a/src/routing/olsr/olsr-agent-impl.cc Wed May 21 19:00:38 2008 -0700
+++ b/src/routing/olsr/olsr-agent-impl.cc Wed May 21 22:40:18 2008 -0700
@@ -312,7 +312,7 @@
receivedPacket = socket->Recv ();
SocketRxAddressTag tag;
- bool found = receivedPacket->PeekTag (tag);
+ bool found = receivedPacket->FindFirstMatchingTag (tag);
NS_ASSERT (found);
Address sourceAddress = tag.GetAddress ();