Hi,
I find the STDMA MAC implementation from following link,
This implementation only support for packet broadcast.I am trying to add the unicast packet traffic also.I added this code in stdma-mac.cc file but not only this addition enable packet unicast.Please can you tell me what other change have to made for unicast packet traffic.I attached the stdma-mac.cc file which i have modified.Please help me.
void
StdmaMac::Enqueue(ns3::Ptr<const ns3::Packet> packet, ns3::Mac48Address to, ns3::Mac48Address from)
{
// NS_FATAL_ERROR("This MAC entity (" << this << ", " << GetAddress () << ") does not support Enqueue() with from address");
std::cout<<" to address:"<<to<<"\n";
NS_LOG_FUNCTION(this << packet << to);
ns3::WifiMacHeader hdr;
hdr.SetTypeData();
hdr.SetAddr1(to);
hdr.SetAddr2(from);
hdr.SetAddr3(GetBssid());
hdr.SetDsNotFrom();
hdr.SetDsNotTo();
StdmaHeader stdmaHdr;
ns3::WifiMacTrailer fcs;
uint32_t numBytes = packet->GetSize() + stdmaHdr.GetSerializedSize() + hdr.GetSize() + fcs.GetSerializedSize();
if (numBytes <= m_maxPacketSize)
{
NS_LOG_DEBUG(ns3::Simulator::Now() << " " << ns3::Simulator::GetContext() << " StdmaMac:Enqueue() packet with no. " << packet->GetUid() << " has been enqueued at node "
<< ns3::Simulator::GetContext() << " (size = " << numBytes << " bytes)");
m_queue->Enqueue(packet, hdr);
}
else
{
NS_LOG_DEBUG(ns3::Simulator::Now() << " " << ns3::Simulator::GetContext() << " StdmaMac:Enqueue() packet with no. " << packet->GetUid() << " has been dropped ("
<< numBytes << " > MAX_PACKET_SIZE = " << m_maxPacketSize);
}
}
Thanks ,
K S