<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Pan,</div><div><br></div><div>No, absolutely nothing wrong with the idea, I just wanted to get more input on what is the intended use of the functionality and get a better sense on what would be more appropriate solution.</div><div><br></div><div>I have compiled an example of what you approximately need.  To use it, you need first to get, compile, and install an updated version of ndnSIM (I had to implement a small extension there).  After that you can get this repo: <a href="https://github.com/cawka/ndnSIM-examples">https://github.com/cawka/ndnSIM-examples</a></div><div><br></div><div>You would be specifically interested in these three files:</div><div><br></div><div>Custom CS policy with example of how to get access to Node upon CS operations:</div><div>- <a href="https://github.com/cawka/ndnSIM-examples/blob/master/extensions/custom-cs/node-access-policy.h">https://github.com/cawka/ndnSIM-examples/blob/master/extensions/custom-cs/node-access-policy.h</a></div><div><br></div><div>Instantiation of customized CS versions:</div><div>- <a href="https://github.com/cawka/ndnSIM-examples/blob/master/extensions/custom-cs/content-store-with-node-access.cc">https://github.com/cawka/ndnSIM-examples/blob/master/extensions/custom-cs/content-store-with-node-access.cc</a></div><div><br></div><div>Scenario that used customized version of CS:</div><div>- <a href="https://github.com/cawka/ndnSIM-examples/blob/master/scenarios/ndn-simple-with-cs-node-access.cc">https://github.com/cawka/ndnSIM-examples/blob/master/scenarios/ndn-simple-with-cs-node-access.cc</a></div><div><br></div><div>---</div><div><br></div><div>Btw, you should be careful implementing your idea.  You should take care of two things.  First, you should probably somehow cache node neighbors, otherwise your simulation will have huge processing overhead, as enumerating neighbors is pretty heavy operations.</div><div><br></div><div>Second, and more important, is you should be careful with deleting of the content.  For example, let's say you have a simple 3 node topology:</div><div><br></div><div>A -- B -- C</div><div><br></div><div>Let's say all of them cached some data.  Now, if each node (at the same time) decides to check neighbors and delete if data is present there, they may end up removing this data from everywhere.  In any case,  you may already have considered this problem (or I could be wrong in this regard), I just want to warn you of a potential issue.</div><div><br></div><div>Sincerely,</div><div>Alex</div><div><br></div><br><div><div>On Mar 11, 2013, at 4:21 PM, <a href="mailto:panhgshine@163.com">panhgshine@163.com</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">Hi Alex,<div><br></div><div>Thanks for your patient to reply my question.</div><div>First, I want to get a node's all neighbour;</div><div>Second, if every neighbour has been request the same data to the node(marked as A node), A node's cache can delete the request data, because every neighbour has cache the data and  A node's cache is needless.</div><div>Because of above idea, I want to know which node request the data to A node and obtain the A node's all neighbour.  <br>Is there something wrong with my idea?</div><div><br></div><div>Thanks</div><div><br></div><div>Pan<br><br><br><br><br><pre>At 2013-03-12 04:22:03,"Alex Afanasyev" <<a href="mailto:alexander.afanasyev@ucla.edu">alexander.afanasyev@ucla.edu</a>> wrote:
>Hi Pan,
>
>Let me ask you one clarification question.  What is the intended use of getting the node for the requested item? If it is to collect content store performance, then I would recommend to use content store trace helper (<a href="http://ndnsim.net/metric.html#example-of-content-store-trace-helper">http://ndnsim.net/metric.html#example-of-content-store-trace-helper</a>) or a modified version of this trace helper.
>
>Normally, Node is not directly accessible from lru_policy_traits, as these traits define a general replacement policy.  If you really need it, you can write a specialized policy that has access to node, similar but not exactly as freshness-policy.h and lifetime-stats-policy.h.  If needed, I can try to give you some more examples.  Would you mind giving a high-level idea what you want to implement, so I can give a better suggestion?
>
>---
>Alex
>
>On Mar 11, 2013, at 8:24 AM, <a href="mailto:panhgshine@163.com">panhgshine@163.com</a> wrote:
>
>> Hi Alex,
>> 
>> Thank you very much! 
>> You let me understand much better to the problem.
>> By the way, how can I get the request node.
>> In cache replacement policy, such as: lru_policy_traits, freshness_policy_traits, I don't know how to get which node request the *item data. Can you help me? And my thoughts is wrong or not?
>> 
>> Thank you!
>> 
>> Pan 
>> 
>> 
>> 
>> 
>> At 2013-03-11 02:33:22,"Alex Afanasyev" <<a href="mailto:alexander.afanasyev@ucla.edu">alexander.afanasyev@ucla.edu</a>> wrote:
>> >Hi Pan,
>> >
>> >In general, as in real system, you would need to implement some kind of a resource discovery protocol to discover all node's neighbors.  At the same time, in NS-3, since it is a simulation, it is technically possible to "discover" neighbors directly:
>> >
>> >In NS-3 in general, you would enumerate all NetDevice's on a particular Node object (<a href="http://www.nsnam.org/doxygen/classns3_1_1_node.html">http://www.nsnam.org/doxygen/classns3_1_1_node.html</a>):
>> >
>> >for (uint32_t deviceId = 0; deviceId < node->GetNDevices (); deviceId ++)
>> >{
>> >    Ptr<NetDevice> device = node->GetDevice (deviceId);
>> >
>> >    # get channel, to which device is connected (a "wire")
>> >    Ptr<Channel> channel = device->GetChannel ();
>> >
>> >    for (uint32_t channelDeviceId = 0; channelDeviceId < channel->GetNDevices (); channelDeviceId ++)
>> >    {
>> >        Ptr<NetDevice> channelDevice = channel->GetDevice (channelDeviceId);
>> >        if (channelDevice == device)
>> >            continue;
>> >
>> >        # channelDevice is a "neighbor"
>> >    }
>> >}
>> >
>> >---
>> >Alex
>> >
>> >On Mar 10, 2013, at 5:53 AM, <a href="mailto:panhgshine@163.com">panhgshine@163.com</a> wrote:
>> >
>> >> Hi All,
>> >> 
>> >> I'm a beginner of NS3 and ndnSIM. Recently, I have read the cache replacement policy code.
>> >> Now, I want to get a node's all neighbour. 
>> >> Is there anyone can give me some advice or hint?
>> >> 
>> >> Thank you in advance.
>> >> 
>> >> Pan
>
>
>_______________________________________________
>ndnSIM mailing list
><a href="mailto:ndnSIM@lists.cs.ucla.edu">ndnSIM@lists.cs.ucla.edu</a>
><a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a>
</pre></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div><br></body></html>