[ndnSIM] ndnsim-contentobject
Alex Afanasyev
alexander.afanasyev at ucla.edu
Tue May 21 20:09:32 PDT 2013
Hi Alice,
I made a typo
...
newheader->SetName ("/bbbb");
...
---
Alex
On May 21, 2013, at 4:10 AM, 1116 lypp <lypp1116 at gmail.com> wrote:
> Hi Alex,
>
> I re-configured the code according to your advice, however, there is an error as following:
>
> ../src/ndnSIM/model/fw/ndn-forwarding-strategy.cc:231:29: error: passing ‘const ns3::ndn::ContentObject’ as ‘this’ argument of ‘void ns3::ndn::ContentObject::SetName(const ns3::ndn::Name&)’ discards qualifiers [-fpermissive]
> I try to modify but it doesn't work.
> How can I solve this problem?
>
> Thanks,
> My Regards,
> Alice
>
>
> 2013/5/21 Alex Afanasyev <alexander.afanasyev at ucla.edu>
> 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/20130521/31669826/attachment.html>
More information about the ndnSIM
mailing list