[ndnSIM] declaring a variable in ndn-forwarding-strategy

i.liyanage at surrey.ac.uk i.liyanage at surrey.ac.uk
Tue Dec 17 05:02:14 PST 2013


Hi Alex,


I tried writing the code in ndnSIM/apps folder and it worked fine.


But when I use the same code in scenario folder (used scenario template of yours) it fails as i mentioned.


It must be something regarded to the scenario template.....

As if I include the file "ns3/ndn-forwarding-strategy.h" it says my variable(set container) is not defined,

../extensions/testsimple.cc:109:19: error: ‘class ns3::ndn::ForwardingStrategy’ has no member named ‘m_allowCS’

so I have to include the complete path to the above header file. Then it compiles fine. but end abruptly.



In the terminal I just want to confirm whether the program works by looking at the log messages.


I attached the following files which I modified.

../scenario/extensions/testsimple.h         -       modified from ndn-producer

../scenario/extensions/testsimple.cc

../scenario/scenarios/simple.cc               -       modified from ndn-simple


ndnSIM/model/fw/ndn-forwarding-strategy.h

ndnSIM/model/fw/ndn-forwarding-strategy.cc


Many Thanks,

Isuru

________________________________
From: Alexander Afanasyev <cawka1 at gmail.com> on behalf of Alex Afanasyev <alexander.afanasyev at ucla.edu>
Sent: 16 December 2013 21:30
To: Liyanage IU Mr (PG/R - Electronic Eng)
Cc: ndnsim
Subject: Re: [ndnSIM] declaring a variable in ndn-forwarding-strategy

Hi Isuru,

I have tried to follow your implementation (added set container in the forwarding strategy and the added a prefix in StartApplication).  Everything worked as expected.

If you can share your code, I can try to run it and see what is wrong.

Btw. What are you expecting to see on the terminal?

---s
Alex

On Dec 16, 2013, at 12:37 PM, <i.liyanage at surrey.ac.uk<mailto:i.liyanage at surrey.ac.uk>> <i.liyanage at surrey.ac.uk<mailto:i.liyanage at surrey.ac.uk>> wrote:

Hi Alex,

I compiled without the -d optimized and ran without the visualizer.
Then it just compile and nothing is displayed in the terminal.

I entered the code in StartApplication() function.

I was trying to build a collaborative caching application.

Ptr<ForwardingStrategy> forwardingstat = GetNode()->GetObject<ForwardingStrategy>();
Ptr<Name> inName = Create<ndn::Name> ("/prefix/thisfix/");
forwardingstat->addAllowCS(inName);

If I comment out the third line(line in red) it works fine.

Many Thanks,
Isuru
________________________________
From: Alexander Afanasyev <cawka1 at gmail.com<mailto:cawka1 at gmail.com>> on behalf of Alex Afanasyev <alexander.afanasyev at ucla.edu<mailto:alexander.afanasyev at ucla.edu>>
Sent: 16 December 2013 19:47
To: Liyanage IU Mr (PG/R - Electronic Eng)
Cc: ndnsim
Subject: Re: [ndnSIM] declaring a variable in ndn-forwarding-strategy

Hi Isuru,

Are you running simulation in the visualizer?  Try to run without it and in debug mode (in case you have compiled with ./waf configure -d optimized, re-compile with ./waf configure -d debug or just ./waf configure).

The variable declaration seems right.  The problem that I could think of is that you're trying to use it in application's constructor, when neither Node() nor strategy objects are not yet set.

Btw. What the effect you're trying to achieve?  Normally (in "real world") applications cannot directly communicate with the forwarding daemon.  Or is it something that is simulation-specific?

---
Alex

On Dec 16, 2013, at 11:43 AM, <i.liyanage at surrey.ac.uk<mailto:i.liyanage at surrey.ac.uk>> <i.liyanage at surrey.ac.uk<mailto:i.liyanage at surrey.ac.uk>> wrote:

Hi Alex,

It terminates without anything once I click the simulate button.
I will try with the debugger as well.

Could you suggest me a way to declare this kind of variable which could be accessed in both forwadingStrategy class and in an application.

Many Thanks,
Isuru
________________________________
From: Alexander Afanasyev <cawka1 at gmail.com<mailto:cawka1 at gmail.com>> on behalf of Alex Afanasyev <alexander.afanasyev at ucla.edu<mailto:alexander.afanasyev at ucla.edu>>
Sent: 16 December 2013 19:26
To: Liyanage IU Mr (PG/R - Electronic Eng)
Cc: ndnsim
Subject: Re: [ndnSIM] declaring a variable in ndn-forwarding-strategy

Is it just terminates without any output or terminates with an error?

If it is an error, then try to run in a debugger, so you can see what exactly is causing the error.  For example,

./waf --run <scenario> --command-template 'gdb --args %s'

---
Alex

On Dec 15, 2013, at 10:17 AM, <i.liyanage at surrey.ac.uk<mailto:i.liyanage at surrey.ac.uk>> <i.liyanage at surrey.ac.uk<mailto:i.liyanage at surrey.ac.uk>> wrote:

Hi,

In ndn-forwading-strategy.h, I declared variable.
std::set<Name>  m_allowCS;

and tried to access in one of the applications by following code
Ptr<ForwardingStrategy> forwardingstat = GetNode()->GetObject<ForwardingStrategy>();
Ptr<Name> inName = Create<ndn::Name> ("/prefix");
forwardingstat->m_allowCS.insert(*inName);

This compiles fine.
but once I run this, simulator exit without any output. Could you point out what's wrong.

Many Thanks,
Isuru
_______________________________________________
ndnSIM mailing list
ndnSIM at lists.cs.ucla.edu<mailto:ndnSIM at lists.cs.ucla.edu>
http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

_______________________________________________
ndnSIM mailing list
ndnSIM at lists.cs.ucla.edu<mailto: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/20131217/76002bfe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndn-forwarding-strategy.cc
Type: text/x-c++src
Size: 19070 bytes
Desc: ndn-forwarding-strategy.cc
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131217/76002bfe/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndn-forwarding-strategy.h
Type: text/x-chdr
Size: 17571 bytes
Desc: ndn-forwarding-strategy.h
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131217/76002bfe/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsimple.cc
Type: text/x-c++src
Size: 5359 bytes
Desc: testsimple.cc
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131217/76002bfe/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsimple.h
Type: text/x-chdr
Size: 2074 bytes
Desc: testsimple.h
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131217/76002bfe/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple.cc
Type: text/x-c++src
Size: 3315 bytes
Desc: simple.cc
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131217/76002bfe/attachment-0004.bin>


More information about the ndnSIM mailing list