[ndnSIM] Strategy specific info

Zhiyi Zhang Zhiyi.Zhang at ucla.edu
Tue Jan 7 12:33:17 PST 2020


Hi Muktadir,

Can you add a static variable, say in your cpp file, and let your strategy
class instance visit that global variable to change it?

Best,
Zhiyi

On Tue, Jan 7, 2020 at 11:00 AM Junxiao Shi <shijunxiao at email.arizona.edu>
wrote:

> Hi Muktadir
>
> Strategy is stateless. It can only attach measurements on namespaces under
> its control.
> See Section 3.3 of original NDN paper
> https://named-data.net/publications/networkingnamedcontent/ for rationale
> of this design decision.
> Thus, what you desire cannot be supported.
>
> Yours, Junxiao
>
> On Mon, Jan 6, 2020, 12:08 Muktadir R Chowdhury (mrchwdhr) <
> mrchwdhr at memphis.edu> wrote:
>
>> Hi,
>> I have written a strategy which needs to have states that are specific to
>> the strategy, not to the namespace.
>>
>> (1)  Lets say I have the following strategy:
>>
>> NFD_REGISTER_STRATEGY(CustomStrategy);
>>
>> class CustomStrategy : Strategy {
>>
>> void
>> afterReceiveInterest() {
>>  cout << "v=" <<v << endl;
>>  v ++;
>> }
>>
>> private:
>>  int v = 0;
>> }
>>
>> I want the variable "v" to be Strategy specific.
>>
>> (2) I set CustomStrategy for two prefixes, lets say "/a" and '/b".
>>
>> (3) I send two interests under "/a", lets say "/a/1" and "/a/2". The
>> value of "v" should be 2.
>>     v=0 and v=1 should be printed.
>>
>> (4) Now I send one interest under "/b" ("/b/1"). I was expecting it to
>> print v=2. But it printed v=0.
>>
>> I guess the reason is , for two different namespace ("/a" and "/b"), two
>> different instances of CustomStrategy is created. I have also tried adding
>> this Strategy specific info in the Measurement Table, like it is done in ASF
>> strategy
>> <https://github.com/named-data/NFD/blob/master/daemon/fw/asf-measurements.hpp> But
>> find out for different namespace, measurement entries are different. Can
>> anyone give me suggestions what can I do here?
>>
>> Muktadir Chowdhury
>> University of Memphis
>>
>>
>> _______________________________________________
> 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/20200107/013e812a/attachment.html>


More information about the ndnSIM mailing list