[ndnSIM] ndnSIM Help modifying an Interest packet's tag

Alex Afanasyev alexander.afanasyev at ucla.edu
Fri Feb 14 15:08:09 PST 2014


Hi Aadil,

It would be easier to figure out the problem, if you had included the actual error.  From what I can guess, you're getting compilation error, complaining that cannot call RemovePacketTag because it is not marked const.

Basically, you're trying to remove tag from the const packet.  Since you're not doing anything wrong here, you can trick the compiler in the following way:

FwCBTag cbtag;
Ptr<Packet> payload = ConstCast<Packet>(interest->GetPayload());
payload->RemovePacketTag(cbtag);
cbtag.Set(inFace->m_fs);
payload->AddPacketTag(cbtag);

---
Alex

On Feb 13, 2014, at 5:45 AM, Aadil Zia Khan <aadilziakhan at gmail.com> wrote:

> Hi,
> 
> Could you please guide me as to how I can modify an Interest packet's tag.
> 
> I am trying to modify the OnInterest function of ndn-forwarding-strategy.cc. I want to read the interest packet's tag and modify it. I checked the mailing list and found out that I need to call the RemovePacketTag function first.
> 
> RemovePacketTag works on Ptr<Packet> type, however if I do something like the following:
> 
> interest->GetPayload ()->RemovePacketTag (cbtag);
> 
> It gives an error.
> 
> How can I get around this. Your help would be really appreciated. Thanks.
> 
> Best Regards
> Aadil
> 
> My Code:
> 
>   FwCBTag cbtag;
>   interest->GetPayload ()->RemovePacketTag (cbtag);
>   cbtag.Set(inFace->m_fs);
>   interest->GetPayload ()->AddPacketTag (cbtag);





More information about the ndnSIM mailing list