[ndnSIM] Re: ndnsim-contentobject

Alex Afanasyev alexander.afanasyev at ucla.edu
Mon May 20 22:24:39 PDT 2013


Hi Alice,

I'm not sure what is the behavior you're trying to achieve.  Even if a node replaces content name (which is OK for the simulator, but would violate data packet signature in a real systems), the node to which you going to forward this packet would simply drop it, since there will be no corresponding PIT entry.

If you really want to do replacement, you can try to create a custom forwarding strategy (here is an example http://ndnsim.net/fw.html#example-of-using-custom-strategy), overriding OnData method something like this:

void
YourStrategy::OnData (Ptr<Face> inFace,
                      Ptr<const ContentObject> header,
                      Ptr<Packet> payload,
                      Ptr<const Packet> origPacket)
{
   if (header->GetName () == Name ("/aaaa"))
   {
       Ptr<ContentObject> newheader = Create<ContentObject> (*header);
       header->SetName ("/bbbb");
       Ptr<Packet> newPacket = Create<Packet> (*payload);
       newPacket->AddHeader (*newheader);

       return your_base_strategy::OnData (inFace, header, payload, newPacket);
   }
}

---
Alex

On May 20, 2013, at 8:22 PM, 1116 lypp <lypp1116 at gmail.com> wrote:

> Hi Alex,
>  
> There is a topology running in my ndnsim, I want to replace the content name when the node received the data packet.
>  
> For example, when the node received the data with the prefix "/aaaaa", I want to replace the name with "/bbbbb".
>  
> Could you tell me how to do this?
>  
> Thanks
>  
> Best regards,
> Alice

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130520/2dafa386/attachment.html>


More information about the ndnSIM mailing list