Dear All.
I have a question related to my shim layer implementation between TCP and IP.
In my current implementation, I set the tcp DownTarget to my own function for the shim layer sender side.
m_senderTcp->SetDownTarget(MakeCallback(&MpTransmissionProtocol::ScheduleSendTcpPacketDown, this));
Then. In the ShceduleSendTcpPacketDown
I want to have a situation when tcp need to wait from sending next packet until the situation is allowed, without dropping the packet.
void
MpTransmissionProtocol::ScheduleSendTcpPacketDown(Ptr<Packet> packet, Ipv4Address source,
Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route)
{
//bool sendSuccess = false;
if (!m_mpPktGen->IsFull())
{
//Add packet to packet buffer, then do scheduling event
m_senderIpv4->Send(refPacket, source, mpDestination, protocol, route);
}
else
{
//Tell Tcp to stop sending
m_senderSocket->ShutdownSend();
m_stopSending = true;
NS_LOG_ERROR("Buffer Full");
}
}
Here what I already try is using
socket->ShutDownSend() but I am not sure it is a proper implementation.
The next one, I need to Inform the TCP to start sending again, I tried to call the socket->Listen() at some part of my code after the event triggered, but it looks like the socket still shutdown after I call that function.
If I am not wrong, my supervisor said there must be a way to inform the tcp to stop sending because the TCP will hold for a while if buffer in lower layer is full. So I need to reflect to that method on ns3. May I get informed how can I implement the functionality like given situation in my case?
Thank you.