Unicast Traffic in STDMA

108 views
Skip to first unread message

Kanchan Sarkar

unread,
Sep 13, 2015, 11:47:30 AM9/13/15
to ns-3-users
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
stdma-mac.h
stdma-mac.cc

Tommaso Pecorella

unread,
Sep 13, 2015, 12:29:38 PM9/13/15
to ns-3-users
Hi,

I'm sorry to inform you that, from a quick check of the code, your affirmation is invalid. There's no trace of the fact that "This implementation only support for packet broadcast". The "Send" function send packets to any valid destination, and it's not limited to broadcast destination addresses.
Moreover, what you changed is not the broadcast/unicast, you added the code for sending a packet with a "from" address other than the NetDevice one (basically the ability to send forged packets). I.e., something that, while interesting, has nothing to do with broadcast and unicast packets.

Suggestion: analyze more in detail the code and, if your simulation only shows broadcast packets, find out why. As a side note, if your beliefs are based on the stdma example, then I have to inform you that it's just an example, not a script showing all the possible setups and all the model limitations.

T.

Kanchan Sarkar

unread,
Sep 13, 2015, 1:55:18 PM9/13/15
to ns-3-users
Hi Tommaso,
  Thanks for your quick reply. I am trying to understand this implementation in more details but in the mean time I have created a example in this model as follow

   node0     ----------------------------------         node1   
      ^                                                               ^
      |                                                                |                        
      |   ----> traffic flows from node0 to node1     |
      |                                                                |

and node 1 have a packet sink to consume all the packet.But there is no packet received at node1. Can you please look ones at this example.I know you have lots of other works but please this is my request.
Thanks,
K S 
stdma_packet.cc

Tommaso Pecorella

unread,
Sep 13, 2015, 4:34:03 PM9/13/15
to ns-3-users
Hi,

I'm deeply sorry but my computer can't run such an old code, and setting up a virtual machine takes too long (updating the code to work with the latest ns-3 is an effort that I'd happily leave to you).
I can suggest some things to check tho.
1) Wireshark: check that the packets are sent with the correct source and destination.
2) Code: check in the StdmaNetDevice if the packet is actually received - the function name is quite self-explanatory.
2b) Code: check if the packet is dropped somewhere.

There are big chances that the error is very simple, or that the packet is dropped in some obscure way.

Cheers,

T.

Kanchan Sarkar

unread,
Sep 15, 2015, 11:47:03 PM9/15/15
to ns-3-users
Hi Tommaso,
      Thanks for your reply. I find it there was problem in the stat time of the onoff application.

Thanks,
K S

Mr. T

unread,
Jan 14, 2016, 3:10:06 AM1/14/16
to ns-3-users
hi, Kanchan Sarkar
I'm also a stdma user, I meet the same question that unicast is not suppported in stdma, you said you'd make it support, could you please explain it in details, thanks

在 2015年9月13日星期日 UTC+8下午11:47:30,Kanchan Sarkar写道:
Reply all
Reply to author
Forward
0 new messages