Packet Tags

293 views
Skip to first unread message

Lina

unread,
Apr 13, 2014, 2:31:08 PM4/13/14
to ns-3-...@googlegroups.com
Hi all,
I'm wondering if it is possible to add two different tags (SNR tags) to a packet??

Thanks in advance.
Lina

Tommaso Pecorella

unread,
Apr 13, 2014, 2:49:03 PM4/13/14
to ns-3-...@googlegroups.com
Hi,

you can add two DIFFERENT tags to a packet. You can not add the same tag twice.

Cheers,

T.

Lina

unread,
Apr 13, 2014, 3:26:46 PM4/13/14
to ns-3-...@googlegroups.com
Hi Tommaso,
That's exactly what I need to do, adding two different tags to a packet.
So far I only have the SNR tag as follow:
/ **********  SNR TAG  *********** //
      SnrTag tag;
      tag.Set(signalDbm - noiseDbm);
      if (! packet->PeekPacketTag (tag))
        {
          packet->AddPacketTag (tag);
          NS_LOG_DEBUG("Add SNR Tag with value :" << tag.Get());
        }
 // *********  SNR TAG  *********** //

and I need to add another tag for the received signal. how can I do that? 

Thanks.
Lina

Konstantinos

unread,
Apr 13, 2014, 3:34:19 PM4/13/14
to ns-3-...@googlegroups.com
You could simply update the SnrTag code to hold two values (snr and received signal).
That would be easier to implement than a new tag. 

Regards,
K.

Tommaso Pecorella

unread,
Apr 13, 2014, 3:45:53 PM4/13/14
to ns-3-...@googlegroups.com
That's called RSSI.

About extending the actual tag vs making a new one, I have different opinions. Extending the actual SnrTag is easier. However it is also a bit more painful when you try to upgrade ns-3. Moreover it can lead to hard to find bugs (e.g., you forgot to set the RSSI value). A missing tag is easy to spot, a default value isn't.

Anyway, defining a new tag is a matter of copy-paste end renaming. So the two options are not that different.

Cheers,

T.

Lina

unread,
Apr 14, 2014, 9:16:57 AM4/14/14
to ns-3-...@googlegroups.com
Thanks all for your help.
I've created a new tag and its working.
Reply all
Reply to author
Forward
0 new messages