[ndnSIM] Reading and Removing Tag in Data Packet

Tun Tun Oo htunhtunu at gmail.com
Wed Apr 30 23:47:19 PDT 2014


Dear Alex,
Sorry,it is my typing error.
The correct code is:
MyTag tag;
    bool isTag = data->GetPayload()->PeekPacketTag(tag);
    if (isTag)
        {
            read = tag.GetTag();
            NS_LOG_INFO ("Infomation "<< read << " : received from data >
"<< data->GetName());
            //to remove tag
            ConstCast<Packet>(data->GetPayload())->RemovePacketTag (tag);
           if (tag.GetTag () != 0)
                std::cout << "Cannot Remove the tag in data > "<<
data->GetName()<<std::endl;
         }
When I received the data, firstly I read it using PeekPacketTag(tag).
After reading it, I want to remove the tag using RemovePacketTag (tag).
In the last line, I check it remove or not, but I received "Cannot Remove
the tag in the data".
If I am correctly understand, whenever I get this line of "Cannot Remove
Tag...", I cannot remove the tag.
My problem is I always received this message (except actual tagged data
zero) and therefore I cannot add new data to tag.
Why I cannot remove this tag?
Thanks a lot for your help.

Regards
TUN
On Thu, May 1, 2014 at 1:09 PM, Alex Afanasyev <alexander.afanasyev at ucla.edu
> wrote:

> Hi Tun,
>
> You didn't mention what exactly is the problem / error message?
>
> From the code you gave, I see that you assigned result of PeekPacketTag
> check to `isTag` variable, but used `isQueueTag` variable in the condition.
>
> ---
> Alex
>
> On Apr 30, 2014, at 1:14 AM, Tun Tun Oo <htunhtunu at gmail.com> wrote:
>
> Dear Alex,
>
> In my customize forwarding, I want to send local information of every hop
> by tagging data packet.
> When router received data, it read tag and then remove it and add it again
> router information.
> But I found a problem when I remove the tag. Actually I think I cannot
> remove the tag.
>
>
>  MyTag tag;
>     bool isTag = data->GetPayload()->PeekPacketTag(tag);
>     if (isQueueTag)
>         {
>             read = tag.GetTag();
>             NS_LOG_INFO ("Infomation "<< read << " : received from data >
> "<< data->GetName());
>
>             //to remove tag
>             ConstCast<Packet>(data->GetPayload())->RemovePacketTag (tag);
>
>            if (tag.GetTag != 0)
>                 std::cout << "Cannot Remove the tag in data > "<<
> data->GetName()<<std::endl;
>          }
>
> Could you give me an advice how should I do it?
>
> regards
> TUN
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20140501/16a89ac6/attachment.html>


More information about the ndnSIM mailing list