Change the protocol stack processing to pass packets by non-const
reference, rather than const reference and value as was previously done. Also change the queue semantics to return the packet on a deque, rather than requiring a packet as a parameter. The problem with the original approach was that packet UID's were getting skipped. The fix handles the uid properly, and we get sequential packet uid's on the trace file.
This commit is contained in:
1 parent
825bdfba4e
commit
feb08acc56
31 files changed
+152
-179
No files matched your search
@@ -186,7 +186,7 @@ PacketSocket::Connect(const Address &ad)
|
||||
}
|
||||
|
||||
int
|
||||
PacketSocket::Send (const Packet &p)
|
||||
PacketSocket::Send (Packet &p)
|
||||
{
|
||||
if (m_state == STATE_OPEN ||
|
||||
m_state == STATE_BOUND)
|
||||
@@ -198,7 +198,7 @@ PacketSocket::Send (const Packet &p)
|
||||
}
|
||||
|
||||
int
|
||||
PacketSocket::SendTo(const Address &address, const Packet &p)
|
||||
PacketSocket::SendTo(const Address &address, Packet &p)
|
||||
{
|
||||
PacketSocketAddress ad;
|
||||
if (m_state == STATE_CLOSED)
|
||||
@@ -262,7 +262,7 @@ PacketSocket::SendTo(const Address &address, const Packet &p)
|
||||
}
|
||||
|
||||
void
|
||||
PacketSocket::ForwardUp (Ptr<NetDevice> device, const Packet &packet,
|
||||
PacketSocket::ForwardUp (Ptr<NetDevice> device, Packet &packet,
|
||||
uint16_t protocol, const Address &from)
|
||||
{
|
||||
if (m_shutdownRecv)
|
||||
@@ -270,7 +270,7 @@ PacketSocket::ForwardUp (Ptr<NetDevice> device, const Packet &packet,
|
||||
return;
|
||||
}
|
||||
|
||||
Packet p = packet;
|
||||
//Packet p = packet; ?
|
||||
|
||||
PacketSocketAddress address;
|
||||
address.SetPhysicalAddress (from);
|
||||
@@ -279,7 +279,7 @@ PacketSocket::ForwardUp (Ptr<NetDevice> device, const Packet &packet,
|
||||
|
||||
NS_DEBUG ("PacketSocket::ForwardUp: UID is " << packet.GetUid()
|
||||
<< " PacketSocket " << this);
|
||||
NotifyDataReceived (p, address);
|
||||
NotifyDataReceived (packet, address);
|
||||
}
|
||||
|
||||
}//namespace ns3
|
||||
Reference in new issue
Block a user