merge with ns-3-dev
This commit is contained in:
@@ -106,10 +106,10 @@ void PacketSink::HandleRead (Ptr<Socket> socket)
|
||||
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);
|
||||
|
||||
@@ -153,10 +153,10 @@ UdpEchoClient::HandleRead (Ptr<Socket> socket)
|
||||
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);
|
||||
|
||||
@@ -98,10 +98,10 @@ UdpEchoServer::HandleRead (Ptr<Socket> socket)
|
||||
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);
|
||||
|
||||
@@ -490,9 +490,7 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
|
||||
// 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 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
|
||||
}
|
||||
else if (found)
|
||||
{
|
||||
ipHeader.SetTtl (socketTtl);
|
||||
ipHeader.SetTtl (tag.GetTtl ());
|
||||
// XXX remove tag here?
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,19 +30,6 @@ NS_LOG_COMPONENT_DEFINE ("Socket");
|
||||
|
||||
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::NotifyDataRecv (void)
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* 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,42 +273,41 @@ SocketRxAddressTag::GetAddress (void) const
|
||||
return m_address;
|
||||
}
|
||||
|
||||
|
||||
TypeId
|
||||
SocketRxAddressTag::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::SocketRxAddressTag")
|
||||
.SetParent<Tag> ()
|
||||
.AddConstructor<SocketRxAddressTag> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
SocketRxAddressTag::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
SocketRxAddressTag::GetSerializedSize (void) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void
|
||||
SocketRxAddressTag::Serialize (TagBuffer i) const
|
||||
{
|
||||
// for local use in stack only
|
||||
}
|
||||
void
|
||||
SocketRxAddressTag::Deserialize (TagBuffer i)
|
||||
{
|
||||
// for local use in stack only
|
||||
}
|
||||
|
||||
SocketIpTtlTag::SocketIpTtlTag ()
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SocketIpTtlTag::GetUid (void)
|
||||
{
|
||||
static uint32_t uid = ns3::Tag::AllocateUid<SocketIpTtlTag> ("SocketIpTtlTag.ns3");
|
||||
return uid;
|
||||
}
|
||||
|
||||
void
|
||||
SocketIpTtlTag::Print (std::ostream &os) const
|
||||
{
|
||||
os << "ttl="<< m_ttl;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SocketIpTtlTag::GetSerializedSize (void) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SocketIpTtlTag::Serialize (Buffer::Iterator i) const
|
||||
{
|
||||
// for local use in stack only
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SocketIpTtlTag::Deserialize (Buffer::Iterator i)
|
||||
{
|
||||
// for local use in stack only
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SocketIpTtlTag::SetTtl (uint8_t ttl)
|
||||
{
|
||||
@@ -362,4 +320,35 @@ SocketIpTtlTag::GetTtl (void) const
|
||||
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
|
||||
|
||||
@@ -368,14 +368,15 @@ class SocketRxAddressTag : public Tag
|
||||
{
|
||||
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 @@ class SocketIpTtlTag : public Tag
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -312,7 +312,7 @@ AgentImpl::RecvOlsr (Ptr<Socket> socket)
|
||||
receivedPacket = socket->Recv ();
|
||||
|
||||
SocketRxAddressTag tag;
|
||||
bool found = receivedPacket->PeekTag (tag);
|
||||
bool found = receivedPacket->FindFirstMatchingTag (tag);
|
||||
NS_ASSERT (found);
|
||||
Address sourceAddress = tag.GetAddress ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user