22 #ifndef NDN_THREADSAFE_FACE_HPP
23 #define NDN_THREADSAFE_FACE_HPP
26 #include "ndn-cpp-config.h"
27 #ifdef NDN_CPP_HAVE_BOOST_ASIO
29 #include <boost/asio.hpp>
40 class ThreadsafeFace :
public Face {
55 (boost::asio::io_service& ioService,
56 const ptr_lib::shared_ptr<Transport>& transport,
57 const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& connectionInfo);
69 (boost::asio::io_service& ioService,
const char *host,
70 unsigned short port = 6363);
81 ThreadsafeFace(boost::asio::io_service& ioService);
90 (
const Interest& interest,
const OnData& onData,
101 (
const Name& name,
const Interest *interestTemplate,
const OnData& onData,
123 removePendingInterest(uint64_t pendingInterestId);
135 const ForwardingFlags& flags = ForwardingFlags(),
142 const ForwardingFlags& flags,
149 (prefix, onInterest, onRegisterFailed, flags, wireFormat);
169 removeRegisteredPrefix(uint64_t registeredPrefixId);
194 unsetInterestFilter(uint64_t interestFilterId);
210 send(
const uint8_t *encoding,
size_t encodingLength);
227 callLater(
Milliseconds delayMilliseconds,
const Callback& callback);
230 static ptr_lib::shared_ptr<Transport>
231 getDefaultTransport(boost::asio::io_service& ioService);
233 static ptr_lib::shared_ptr<Transport::ConnectionInfo>
234 getDefaultConnectionInfo();
236 boost::asio::io_service& ioService_;
241 #endif // NDN_CPP_HAVE_BOOST_ASIO
double Milliseconds
A time interval represented as the number of milliseconds.
Definition: common.hpp:114
func_lib::function< void(const ptr_lib::shared_ptr< const Name > &prefix, const ptr_lib::shared_ptr< const Interest > &interest, Face &face, uint64_t interestFilterId, const ptr_lib::shared_ptr< const InterestFilter > &filter)> OnInterestCallback
An OnInterestCallback function object is used to pass a callback to setInterestFilter and optionally ...
Definition: face.hpp:65
func_lib::function< void(const ptr_lib::shared_ptr< const Name > &prefix, uint64_t registeredPrefixId)> OnRegisterSuccess
An OnRegisterSuccess function object is used to report when registerPrefix succeeds.
Definition: face.hpp:78
virtual uint64_t expressInterest(const Interest &interest, const OnData &onData, const OnTimeout &onTimeout, const OnNetworkNack &onNetworkNack, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Send the Interest through the transport, read the entire response and call onData, onTimeout or onNetworkNack as described below.
Definition: face.cpp:101
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest, const ptr_lib::shared_ptr< NetworkNack > &networkNack)> OnNetworkNack
An OnNetworkNack function object is used to pass a callback to expressInterest.
Definition: face.hpp:55
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest)> OnTimeout
An OnTimeout function object is used to pass a callback to expressInterest.
Definition: face.hpp:48
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest, const ptr_lib::shared_ptr< Data > &data)> OnData
An OnData function object is used to pass a callback to expressInterest.
Definition: face.hpp:35
func_lib::function< void(const ptr_lib::shared_ptr< const Name > &prefix)> OnRegisterFailed
An OnRegisterFailed function object is used to report when registerPrefix fails.
Definition: face.hpp:71
virtual uint64_t registerPrefix(const Name &prefix, const OnInterestCallback &onInterest, const OnRegisterFailed &onRegisterFailed, const OnRegisterSuccess &onRegisterSuccess, const ForwardingFlags &flags=ForwardingFlags(), WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Register prefix with the connected NDN hub and call onInterest when a matching interest is received...
Definition: face.cpp:145