[ndnSIM] check content store entries periodically ?

John Baugh jpbaugh at umich.edu
Fri Dec 22 21:29:57 PST 2017


Chengb,

Perhaps this would help a bit:

You basically create a callback function with the behavior you want  - you
pass the function pointer (similar to a delegate method, or closure in some
other languages) to the static Schedule method of the Simulator.

So, you'd create a method like this:

*void*
*handler(ofstream* outfile, int iteration) *
*{*
*   (*outfile)<<"Testing iteration "<<iteration<<std::endl;     *
*}//end handler*


Then, in your scenario, you schedule it to occur at a particular interval:

*Simulator::Schedule(Seconds(1), &handler, &outfile, i);*

This example is quite trivial, but you can make them arbitrarily complex.
I.e., you can, after the initial &handler, pass any of the necessary
parameters that your handler takes, to the Schedule method.

Also, this page might be useful (just search for Schedule) :
http://ndnsim.net/2.4/applications.html


Thanks,

John


On Thu, Dec 21, 2017 at 11:46 AM, Spyridon (Spyros) Mastorakis <
mastorakis at cs.ucla.edu> wrote:

> Hi,
>
> this is some custom functionality that you will have to implement on your
> own. You can schedule periodic events with the Simulator::Schedule method
> of NS-3 and iterate over the CS entries with the CS iterators. Take a look
> here for more details:
>
> https://www.nsnam.org/doxygen/classns3_1_1_simulator.html#
> a81c1ade622b5266d81908b2a99a330d2
> https://github.com/named-data/NFD/blob/master/daemon/table/
> cs.hpp#L147-L153
>
> Thanks,
>
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/
> Internet Research Laboratory
> Computer Science Department
> UCLA
>
> On Dec 20, 2017, at 4:35 PM, Chengb Cao <chengbcao at gmail.com> wrote:
>
> Hi,all
>
> Is there any way to get the CS entries periodically during my simulation,
> and  what methods should i use?
>
> using ndnSIM 2.4 here.
>
>
> Thanks.
>
>
>
> _______________________________________________
> 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/20171223/f7fd2cce/attachment.html>


More information about the ndnSIM mailing list