[ndnSIM] [EXT]Re: multiple names

Junxiao Shi shijunxiao at email.arizona.edu
Wed Oct 28 03:20:39 PDT 2020


Hi Hafsteinn

ndnSIM's App type provides what I call a "layer 3 face", where you have to
process each message yourself. Thus, what Spyros suggested is the only way.
A small improvement is that you can compare the result of name.get(3) with
a pre-constructed name::Component, instead of using toUri.

Yours, Junxiao

On Wed, Oct 28, 2020 at 05:31 Hafsteinn Hjartarson via ndnSIM <
ndnsim at lists.cs.ucla.edu> wrote:

> *External Email*
> 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=
>>
>>
>> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20201028/bc2a3f55/attachment.html>


More information about the ndnSIM mailing list