Packet tag field is not getting set

26 views
Skip to first unread message

Sab NT

unread,
Mar 12, 2016, 10:11:44 PM3/12/16
to ns-3-users
Hi,

I built a simple LTE-EPC network where UDP application is running end-to-end. I wanted to print the sequence number of the packets during send() and receive() events which I did successfully by adding headers to the packets before it is sent through socket. Now I wanted to replicate the same using a packet tag as I want to use it in cross-layer functions. 
For that, I  created a new tag class in the applications module and modified the wscript to include the modules. Then I called the functions to set and get sequence number in the tag inside the application send and receive event (same as I did with headers) with following functions:

// Add tag to the packet

  AppPacketTag atag;

  atag.SetSeq(m_packetsSent);

  packet->AddPacketTag(atag);


// Read tag to the packet

  AppPacketTag atag;

  p->RemovePacketTag (atag);

  uint32_t tag_pkt_num = atag.GetSeq();


The code compiles and runs fine. But the received tag field is not getting updated and remains as 0.  Could someone please help me to find where am I making mistake? 

I am attaching the files where I added the new tag. Please help.

Thanks in advance.

 





app-tag.h
app-tag.cc

Tommaso Pecorella

unread,
Mar 13, 2016, 6:18:42 AM3/13/16
to ns-3-users
Hi,

the tag code seems right. Check that the tag is there before removing it, and if it's not there try searching where it's removed.
Mind that PacketTags are at risk when packets are fragmented and reassembled. In that case a ByteTag is more "safe".

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages