[ndnSIM] Reading and Removing Tag in Data Packet

Tun Tun Oo htunhtunu at gmail.com
Tue May 6 00:35:15 PDT 2014


Dear Alex,

Let me explain about my problem with packet tagging.
In my simple scenario, R3 has q=30 and R3 tagged to Data packet.
When tagged-Data is received by R2,it read tag and have to remove before
adding its (q=20) to Data packet. If I correctly understand, it supposed to
be received q=30 at R2 and q=20 at R1.
Now I can receive q=30 at R2 but unfortunately I also receive q=30 at
R1. As my understanding I think, I cannot remove that tag after reading.
Could you help me to solve and please advice me what I am misunderstanding.
       +---------+                      +--------+
+---------+
       |R1(q=10) | <---Data----- |R2(q=20)| <----Data  ---|R3(q=30)|
      +---------+
+--------+                     +----------+

For reading and removing tag at OnData
*********************************
 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;
         }

For adding tag to Data (SatisfyPendingInterest)
********************************************
if (data!=0)
{
MyTag tag;
NS_LOG_INFO ("Infomation "<< q << " : send to data > "<< data->GetName());
tag.SetTag (q);
data->GetPayload()->AddPacketTag (tag);
}

Thanks for your help.
Regards
TUN



On Thu, May 1, 2014 at 3:47 PM, Tun Tun Oo <htunhtunu at gmail.com> wrote:

> 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/20140506/21ffe282/attachment.html>


More information about the ndnSIM mailing list