[ndnSIM] What is the correct namespace

任沛 renpei.bupt at qq.com
Tue May 23 02:15:31 PDT 2017

Hi John,

Thank you for you reply, your suggestion really works! While after i compile the code, i got the error:

no matching function for call to ‘ns3::ndn::GlobalRoutingHelper::AddOrigins(std::string&, ns3::Ptr<ns3::Node>&)’
         ndnGlobalRoutingHelper.AddOrigins(prefix, testNode);

I don't know why the error will happen, cause the code

ns3::Ptr<ns3::Node> testNode = ns3::Names::Find<ns3::Node>(tNode);

now works well, the form of "testNode" is apparently ns3::Ptr<ns3::Node>?

Thank you!

Pei Ren

------------------ Original ------------------
From:  "John Baugh";<jpbaugh at umich.edu>;
Date:  Tue, May 23, 2017 04:48 PM
To:  "任沛"<renpei.bupt at qq.com>; 
Cc:  "ndnsim"<ndnsim at lists.cs.ucla.edu>; 
Subject:  Re: [ndnSIM] What is the correct namespace

Perhaps you are missing #include directives?  For example, names.h is where Names lives.

Names is a class declared in ns3, and inside ns3 namespace.

So ns3::Names::Find might work?

And GlobalRoutingHelper is in ndn-global-routing-helper.h

Does this help?


On May 23, 2017 4:37 AM, "任沛" <renpei.bupt at qq.com> wrote:
Hi ndnSIM friends,

In NFD/daemon/fw/forwarder.cpp, i add below codes to the onIncomingData():

ns3::Ptr<ns3::Node> testNode = Names::Find<ns3::Node>(tNode);
ns3::ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
ndnGlobalRoutingHelper.AddOrigins(prefix, testNode);

where "tNode" and "prefix" above is in the form of std::string. What i tried to do is to tell all the another nodes that the current node can provide the content with specific prefix. While when i compile the source code, i got below message:

'Names' has not been declared
expected primary-expression before '>' token
'GlobalRoutingHelper' is not a member of 'ns3::ndn'
expected ';' before 'ndnGlobalRoutingHelper'
'ndnGlobalRoutingHelper' was not declareded in this scope
'ns3::ndn::GlobalRoutingHelper' has not been declared

What is the correct namespace? 

Look forward to your reply.

Pei Ren

 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/20170523/a0eee012/attachment-0001.html>

More information about the ndnSIM mailing list