Check for ACK in Callback - WifiMacHeader

35 views
Skip to first unread message

Gabriel Casella

unread,
Sep 10, 2014, 8:47:08 AM9/10/14
to ns-3-...@googlegroups.com
Hello,

I'm using the 'wifi-adhoc.cc' example to get the 'WifiMacHeader' from the packet inside the callback function.
The problem when I extract the 'WifiMacHeader' from the packet inside the 'ReceivePacket' callback I get nothing relevant, except of 'MGT_ASSOCIATION_REQUEST'.

Here is the way I'm trying:

void
Experiment::ReceivePacket (Ptr<Socket> socket)
{
 
Ptr<Packet> packet;
 
while ((packet = socket->Recv ()))
   
{
      m_bytesTotal
+= packet->GetSize ();


     
Ptr<Packet> copy = packet->Copy ();
     
WifiMacHeader hdr;
      copy
->RemoveHeader (hdr);
     
//NS_LOG_UNCOND (hdr);
     
     
if (hdr.IsAck ())
       
{
          NS_LOG_UNCOND
("receive ack from=" << hdr.GetAddr1 ());
       
}
   
}
}


The 'if' is never 'true' and printing the 'hdr' always shows me this:

MGT_ASSOCIATION_REQUEST ToDS=0, FromDS=0, MoreFrag=0, Retry=0, MoreData=0 Duration/ID=0us, DA=00:00:00:00:00:00, SA=00:00:00:00:00:00, BSSID=00:00:00:00:00:00, FragNumber=0, SeqNumber=0


What am I doing wrong? This seems the way to do as I can tell by [1] and the 'PhyRx1kTrace (...)' from [2].
My script is attached if needed.

Sincerely,

wifi-adhoc-test.cc
Reply all
Reply to author
Forward
0 new messages