convert to Packet tags
This commit is contained in:
@@ -324,17 +324,17 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipMulticastTtl);
|
||||
p->AddTag (tag);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
else if (m_ipTtl != 0 && !dest.IsMulticast () && !dest.IsBroadcast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipTtl);
|
||||
p->AddTag (tag);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
{
|
||||
SocketSetDontFragmentTag tag;
|
||||
bool found = p->FindFirstMatchingTag (tag);
|
||||
bool found = p->RemovePacketTag (tag);
|
||||
if (!found)
|
||||
{
|
||||
if (m_mtuDiscover)
|
||||
@@ -345,7 +345,7 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
{
|
||||
tag.Disable ();
|
||||
}
|
||||
p->AddTag (tag);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -462,7 +462,7 @@ UdpSocketImpl::Recv (uint32_t maxSize, uint32_t flags)
|
||||
|
||||
Ptr<Packet>
|
||||
UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
|
||||
Address &fromAddress)
|
||||
Address &fromAddress)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << maxSize << flags);
|
||||
Ptr<Packet> packet = Recv (maxSize, flags);
|
||||
@@ -470,7 +470,7 @@ UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
bool found;
|
||||
found = packet->FindFirstMatchingTag (tag);
|
||||
found = packet->PeekPacketTag (tag);
|
||||
NS_ASSERT (found);
|
||||
fromAddress = tag.GetAddress ();
|
||||
}
|
||||
@@ -506,7 +506,7 @@ UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address ipv4, uint16_t port)
|
||||
Address address = InetSocketAddress (ipv4, port);
|
||||
SocketAddressTag tag;
|
||||
tag.SetAddress (address);
|
||||
packet->AddTag (tag);
|
||||
packet->AddPacketTag (tag);
|
||||
m_deliveryQueue.push (packet);
|
||||
m_rxAvailable += packet->GetSize ();
|
||||
NotifyDataRecv ();
|
||||
@@ -742,8 +742,8 @@ UdpSocketImplTest::RunTests (void)
|
||||
NS_TEST_ASSERT_EQUAL (m_receivedPacket->GetSize (), 123);
|
||||
NS_TEST_ASSERT_EQUAL (m_receivedPacket2->GetSize (), 0); // second interface should receive it
|
||||
|
||||
m_receivedPacket->RemoveAllTags ();
|
||||
m_receivedPacket2->RemoveAllTags ();
|
||||
m_receivedPacket->RemoveAllPacketTags ();
|
||||
m_receivedPacket2->RemoveAllPacketTags ();
|
||||
|
||||
// Simple broadcast test
|
||||
|
||||
@@ -756,8 +756,8 @@ UdpSocketImplTest::RunTests (void)
|
||||
// second socket should not receive it (it is bound specifically to the second interface's address
|
||||
NS_TEST_ASSERT_EQUAL (m_receivedPacket2->GetSize (), 0);
|
||||
|
||||
m_receivedPacket->RemoveAllTags ();
|
||||
m_receivedPacket2->RemoveAllTags ();
|
||||
m_receivedPacket->RemoveAllPacketTags ();
|
||||
m_receivedPacket2->RemoveAllPacketTags ();
|
||||
|
||||
// Broadcast test with multiple receiving sockets
|
||||
|
||||
@@ -777,8 +777,8 @@ InetSocketAddress (Ipv4Address("255.255.255.255"), 1234)), 123);
|
||||
NS_TEST_ASSERT_EQUAL (m_receivedPacket->GetSize (), 123);
|
||||
NS_TEST_ASSERT_EQUAL (m_receivedPacket2->GetSize (), 123);
|
||||
|
||||
m_receivedPacket->RemoveAllTags ();
|
||||
m_receivedPacket2->RemoveAllTags ();
|
||||
m_receivedPacket->RemoveAllPacketTags ();
|
||||
m_receivedPacket2->RemoveAllPacketTags ();
|
||||
|
||||
Simulator::Destroy ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user