[ndnSIM] multiple names

Hafsteinn Hjartarson hafsteinn.hjartarson at gmail.com
Wed Oct 28 02:30:58 PDT 2020


Thanks for the reply Spyridon!

Yes that is correct, I can retrieve different parts of the prefix as you
suggested but I see that I was a bit unclear.

I was really asking if this is how it should be done. That is, when an
application has to deal with multiple actions, it should break down the Uri
and use multiple "if" statements (like in my example).
Or is there a more "correct" way of handling this?

Another thing ... when an application receives an Interest, is it possible
to extract some kind of ID from the interest that identifies who sent it?

Best regards,
Hafsteinn


On Wed, Oct 28, 2020 at 2:11 AM Spyridon Mastorakis <smastorakis at unomaha.edu>
wrote:

> Hi,
>
> Name.get(2).toUri() should return a string of the 3rd name component. I
> suppose the index of the get() method of the Name class starts from 0.
>
> Thanks,
>
> Spyridon (Spyros) Mastorakis
> Assistant Professor
> Computer Science Department
> University of Nebraska, Omaha
> Peter Kiewit Institute Room 175A
> https://sites.google.com/site/spyridonmastorakis
>
> On Oct 25, 2020, at 6:31 AM, Hafsteinn Hjartarson via ndnSIM <
> ndnsim at lists.cs.ucla.edu> wrote:
>
> Hi everyone!
>
> I have a question regarding how applications can deal with different
> interest names.
>
> Take for example the custom application ndn-custom-app-producer.cpp
>
> Let's say that I want the producer application to handle different
> operations such as adding a hash to a list, deleting a has from a list and
> returning some data regarding a certain hash:
>
> "/prefix/sub/*add*/{some hash}"
> "/prefix/sub/*delete*/{some hash}"
> "/prefix/sub/*get*/{some hash}"
>
> So another application (a consumer) can send the above interests but how
> should my producer application handle this?
>
> Currently I am doing this:
>
> I add "/prefix/sub" to the FIB so that my producer listens to everything
> coming in on that prefix.
>
> Then I have this logic:
>
> onInterest(){
>   if(interest -> getName().get(3).value() == "add")
>   {
>      //add the data
>   }
>   else if (interest -> getName().get(3).value() == "delete")
>   {
>       //delete the data
>    }
>    else if (interest -> getName().get(3).value() == "get")
>    {
>       //create a data packet and send the data to the consumer
>    }
> }
>
> Is this the correct way ?
>
> Best regards,
> Hafsteinn
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.lists.cs.ucla.edu_mailman_listinfo_ndnsim&d=DwICAg&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=eI5Bh74ovG-uIXQ5ksQETSPgRFzmJXjIZXneCqw580E&m=ZJcrRLs3ctYEDgUU0ei0VorwcyfIQt4pWR7EG9NmK_o&s=JbkqAPn8-5Iqv29lB8xy6qQZNw5ExV5-SunKN12zUhA&e=
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20201028/c5f36167/attachment.html>


More information about the ndnSIM mailing list