[ndnSIM] How to get a node's neighbour

panhgshine at 163.com panhgshine at 163.com
Mon Mar 11 08:24:18 PDT 2013

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!


At 2013-03-11 02:33:22,"Alex Afanasyev" <alexander.afanasyev at ucla.edu> 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 (http://www.nsnam.org/doxygen/classns3_1_1_node.html):
>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"
>    }
>On Mar 10, 2013, at 5:53 AM, panhgshine at 163.com 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
>ndnSIM at lists.cs.ucla.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130311/c7958060/attachment.html>

More information about the ndnSIM mailing list