<div dir="ltr"><div>Dear Alex, </div><div>Thank you so much for nice points and your great helps. However, may I know how I can access data signature in lifetime-stats-policy.hpp. I mean for increasing defined variable with adding fake packet I need to access signature in insert function which is defined as below:</div><div>inline bool<br>      insert (typename parent_trie::iterator item)<br>      {<br>        get_time (item) = Simulator::Now ();</div><div>        policy_container::push_back (*item);<br><br>        return true;<br>      }</div><div><br></div><div>how i can extract signature from item in the above function. i am looking forward to hearing you</div><div>thanks</div><div>best regards</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 8, 2016 at 10:37 AM, Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="-ms-word-wrap: break-word;"><br><div><span><blockquote type="cite"><div>On Jul 7, 2016, at 6:26 PM, Zeinab Rezaiefar <<a href="mailto:zeinab.rezaiefar@gmail.com" target="_blank">zeinab.rezaiefar@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div>Hello Alex,</div><div>Thank you so much for replying. First I would like to explain what I want to do with using invalid_content . I would like to define how many fake contents( the content with specific signature) are ine each node. therefore I defined this variable in  content-store-impl.h and call it in ContentStoreImpl<Policy>::Add (Ptr<const Data> data) function to add this value when the router receive fake contents. however , I would like to decrease this value when the router removes fake content from their cache. therefore I would like to call invalid_content in the main function (for example <a href="http://ndn-simple.cc" target="_blank">ndn-simple.cc</a> in scratch folder) where I defined " Config::Connect("/NodeList/*/$ns3::ndn::cs::Stats::Lru/WillRemoveEntry", MakeCallback(CacheEntryRemoved)); " to call CacheEntryRemoved . inside this function I try to decrease the value of the invalid_content when the fake contents will be removed.</div><div>I defined as below:</div><div>void<br>CacheEntryRemoved(std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime)<br>{<br><br>if (entry->GetData()->GetSignature()!=0){<br>Ptr<ndn::cs::ContentStoreImpl<ns3::ndn::ndnSIM::lru_policy_traits > > content;<br><br>content->invalid_content;<br>}<br>}</div><div> with  defining,the program will be run but I received SIGSEGV for (content->invalid_content;) which is I think because of content pointer is null. moreover , since I have used "cnxHelper.SetContentStore("ns3::ndn::cs::Stats::Lru", "MaxSize", "1000");" , I am worry that policy is not lru_policy_traits but it can be lifetime_stats_policy_traits . however, I do not know how to use it.</div><div>finally I want to call invalid_content in trace file and show the output in output text file. I will become happy and thankful , if I hear your opinion .</div><div>thanks </div><div>regards</div></div></div></blockquote><div><br></div></span><div>Of course this segfaults, as content points to nothing.</div><div><br></div><div>What you want to achieve is much easier to accomplish by just writing a new specialized policy, just for that part.  There is a little bit of a hassle to instantiate it, but it would be the most straightforward way.  Though agree that it can be convoluted with c++ templates.</div><div><br></div><div>The easiest way would be to update content-store-with-stats.hpp and lifetime-stats-policy.hpp.  </div><div><br></div><div>- In the policy, you add your variable and simply increase it by one whenever things are added and remove by one when bad packet evicted (this should be easy).</div><div><br></div><div>- in the content-store-with-stats.hpp  you would want to add a read-only attribute in GetTypeId method to expose the variable in the policy.  You would need check NS-3 docs what is the proper syntax for the read-only attribute.  After that you should be able to access the value in main.cpp by</div><div><br></div><div>node->GetObject<ndn::ContentStore>()->GetAttribute("name-you-defined")...</div><div><br></div><div>--</div><div>Alex</div><span><div><br></div><div><br></div><div><br></div><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 8, 2016 at 12:36 AM, Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div><div><br>
> On Jul 7, 2016, at 6:26 AM, Zeinab Rezaiefar <<a href="mailto:zeinab.rezaiefar@gmail.com" target="_blank">zeinab.rezaiefar@gmail.com</a>> wrote:<br>
><br>
> hello everyone,<br>
> I have defined public variable in class ContentStoreImpl (double invalid_content)  in content-store-impl.hpp. furthermore I have change these value in ContentStoreImpl<Policy>::Add (invalid_content++;) I want to access this value through files in scratch folder .<br>
> therefore I include this path (#include "ns3/ndnSIM/model/cs/content-store-impl.h").  I want to access it before main function as below:<br>
><br>
> using namespace ns3;<br>
> void<br>
> CacheEntryRemoved(std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime)<br>
> {<br>
><br>
> if (entry->GetData()->GetSignature()!=0){<br>
> //ContentStoreImpl a;<br>
> Ptr<ndn::cs::ContentStoreImpl> content;<br>
> content.invalid_content--;<br>
><br>
> }<br>
> }<br>
><br>
> however, I have received error  (mismatch at argument 1 in template parameter list for ‘template<class T> class ns3::Ptr’)<br>
> is there anybody knows how I can access this value through this function.<br>
> I will become thankful, if I know your opinion<br>
> thanks in advance<br>
> best regards<br>
<br>
</div></div>I'm not exactly sure what you're trying to do in the main function...  Even if you going to make it compile, "Ptr<ndn::cs::ContentStoreImpl> content;" be a null pointer.<br>
<br>
What is the exact error you're having?<br>
</blockquote></div><br></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div>