[ndnSIM] [ChronoSync] How to publishData and get it
Davide Aguiari
gorghino at gmail.com
Thu Mar 2 07:41:08 PST 2017
Hi everyone,
I'm using this ChronoSync scenario: https://github.com/named-data/ChronoSync
I build a tree where the leaves produce data and Chronosync sync them with
all the tree node. (7 nodes in my case).
The non-leaves nodes get the data and they get the average from the values.
I would like to publish them in the same ChronoSync application, e.g. with
name /ndn/peer[id]/average
So any node, randomly, may send an Interest to the average Producers
sending an Interest.
I edited Socket::publishData and Socket::fetchData to avoid sync flow in
case of "my Interests".
Socket.cpp: http://pastebin.com/y48veyEd
publishData check the prefix, if it's DEFAULT_PREFIX, it syncs, else it
only insert into m_ims.
fetchData doesn't append seqNo if I'm exchanging average (seqNo is NULL).
The problem now is how to set the correct face for the Application.
If I try with
*ns3::ndn::FibHelper::AddRoute(thisNode, "/ndn/peer8/average", m_face, 1);*
[[ Note that thisNode is get from:
*ChronoSync::ChronoSync(const int minNumberMessages, const int
maxNumberMessages, ns3::Ptr<ns3::Node> thisNode, bool _producer)*
and in chronosync-app.hpp I do:
*m_instance.reset(new ::ndn::ChronoSync(m_minNumberMessages,
m_maxNumberMessages, GetNode(), m_periodicPublishing)); ]]*
I get:
---------------------------------------------------------------------------------------------------------------------------
../extensions/chronosync.cpp: In constructor
‘ndn::ChronoSync::ChronoSync(int, int, ns3::Ptr<ns3::Node>, bool)’:
../extensions/chronosync.cpp:41:74: error: no matching function for call to
‘ns3::ndn::FibHelper::AddRoute(ns3::Ptr<ns3::Node>&, const char [19],
ndn::Face&, int)’
ns3::ndn::FibHelper::AddRoute(thisNode, "/ndn/peer8/average", m_face, 1);
^
In file included from
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-stack-helper.hpp:31:0,
from /usr/local/include/ns3-dev/ns3/ndn-all.hpp:23,
from /usr/local/include/ns3-dev/ns3/ndnSIM-module.h:10,
from
/home/gorgo/ndnSIM/scenario-ChronoSync/ChronoSync/src/logic.hpp:40,
from
/home/gorgo/ndnSIM/scenario-ChronoSync/ChronoSync/src/socket.hpp:32,
from ../extensions/chronosync.hpp:22,
from ../extensions/chronosync.cpp:22:
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:56:3: note:
candidate: static void ns3::ndn::FibHelper::AddRoute(ns3::Ptr<ns3::Node>,
const ndn::Name&, std::shared_ptr<nfd::Face>, int32_t)
AddRoute(Ptr<Node> node, const Name& prefix, shared_ptr<Face> face,
int32_t metric);
^
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:56:3: note:
no known conversion for argument 3 from ‘ndn::Face’ to
‘std::shared_ptr<nfd::Face>’
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:67:3: note:
candidate: static void ns3::ndn::FibHelper::AddRoute(const string&, const
ndn::Name&, uint32_t, int32_t)
AddRoute(const std::string& nodeName, const Name& prefix, uint32_t
faceId, int32_t metric);
^
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:67:3: note:
no known conversion for argument 1 from ‘ns3::Ptr<ns3::Node>’ to ‘const
string& {aka const std::__cxx11::basic_string<char>&}’
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:78:3: note:
candidate: static void ns3::ndn::FibHelper::AddRoute(ns3::Ptr<ns3::Node>,
const ndn::Name&, uint32_t, int32_t)
AddRoute(Ptr<Node> node, const Name& prefix, uint32_t faceId, int32_t
metric);
^
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:78:3: note:
no known conversion for argument 3 from ‘ndn::Face’ to ‘uint32_t {aka
unsigned int}’
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:89:3: note:
candidate: static void ns3::ndn::FibHelper::AddRoute(ns3::Ptr<ns3::Node>,
const ndn::Name&, ns3::Ptr<ns3::Node>, int32_t)
AddRoute(Ptr<Node> node, const Name& prefix, Ptr<Node> otherNode,
int32_t metric);
^
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:89:3: note:
no known conversion for argument 3 from ‘ndn::Face’ to
‘ns3::Ptr<ns3::Node>’
/usr/local/include/ns3-dev/ns3/ndnSIM/helper/ndn-fib-helper.hpp:101:3:
note: candidate: static void ns3::ndn::FibHelper::AddRoute(const string&,
const ndn::Name&, const string&, int32_t)
AddRoute(const std::string& nodeName, const Name& prefix, const
std::string& otherNodeName,
---------------------------------------------------------------------------------------------------------------------------
To store the average I do in chronosync.cpp:
*m_socket->publishData(reinterpret_cast<const
uint8_t*>(std::to_string(avg).c_str()),*
* std::to_string(avg).size(),
ndn::time::milliseconds(1000*60),
m_routableUserPrefix.append("average"));*
and I try to get it with:
*m_socket->fetchData("/ndn/peer8/average", NULL,*
* bind(&ChronoSync::printData, this, _1),*
* 2);*
Is it possible? All this application seems very "ad-hoc solution" to me.
Yes sync works but I'm not able (and I'm skilled) to do anything else here
:(
Thank you,
Davide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170302/eae8f05f/attachment.html>
More information about the ndnSIM
mailing list