A client-side face for unit testing. More...
#include <dummy-client-face.hpp>
Classes | |
class | AlreadyLinkedError |
struct | BroadcastLink |
class | Options |
options for DummyClientFace More... | |
class | Transport |
Public Member Functions | |
DummyClientFace (const Options &options=Options()) | |
Create a dummy face with internal IO service. More... | |
DummyClientFace (KeyChain &keyChain, const Options &options=Options()) | |
Create a dummy face with internal IO service and the specified KeyChain. More... | |
DummyClientFace (boost::asio::io_service &ioService, const Options &options=Options()) | |
Create a dummy face with the provided IO service. More... | |
DummyClientFace (boost::asio::io_service &ioService, KeyChain &keyChain, const Options &options=Options()) | |
Create a dummy face with the provided IO service and the specified KeyChain. More... | |
~DummyClientFace () override | |
void | receive (const Interest &interest) |
cause the Face to receive an interest More... | |
void | receive (const Data &data) |
cause the Face to receive a data More... | |
void | receive (const lp::Nack &nack) |
cause the Face to receive a nack More... | |
void | linkTo (DummyClientFace &other) |
link another DummyClientFace through a broadcast media More... | |
void | unlink () |
unlink the broadcast media if previously linked More... | |
Public Member Functions inherited from ndn::Face | |
Face (shared_ptr< Transport > transport=nullptr) | |
Create Face using given transport (or default transport if omitted) More... | |
Face (DummyIoService &ioService) | |
Create Face using default transport and given io_service. More... | |
Face (shared_ptr< Transport > transport, KeyChain &keyChain) | |
Create Face using given transport and KeyChain. More... | |
virtual | ~Face () |
PendingInterestHandle | expressInterest (const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout) |
Express Interest. More... | |
void | removeAllPendingInterests () |
Cancel all previously expressed Interests. More... | |
size_t | getNPendingInterests () const |
Get number of pending Interests. More... | |
RegisteredPrefixHandle | setInterestFilter (const InterestFilter &filter, const InterestCallback &onInterest, const RegisterPrefixFailureCallback &onFailure, const security::SigningInfo &signingInfo=security::SigningInfo(), uint64_t flags=nfd::ROUTE_FLAG_CHILD_INHERIT) |
Set InterestFilter to dispatch incoming matching interest to onInterest callback and register the filtered prefix with the connected NDN forwarder. More... | |
RegisteredPrefixHandle | setInterestFilter (const InterestFilter &filter, const InterestCallback &onInterest, const RegisterPrefixSuccessCallback &onSuccess, const RegisterPrefixFailureCallback &onFailure, const security::SigningInfo &signingInfo=security::SigningInfo(), uint64_t flags=nfd::ROUTE_FLAG_CHILD_INHERIT) |
Set InterestFilter to dispatch incoming matching interest to onInterest callback and register the filtered prefix with the connected NDN forwarder. More... | |
InterestFilterHandle | setInterestFilter (const InterestFilter &filter, const InterestCallback &onInterest) |
Set an InterestFilter to dispatch matching incoming Interests to onInterest callback. More... | |
RegisteredPrefixHandle | registerPrefix (const Name &prefix, const RegisterPrefixSuccessCallback &onSuccess, const RegisterPrefixFailureCallback &onFailure, const security::SigningInfo &signingInfo=security::SigningInfo(), uint64_t flags=nfd::ROUTE_FLAG_CHILD_INHERIT) |
Register prefix with the connected NDN forwarder. More... | |
void | put (Data data) |
Publish data packet. More... | |
void | put (lp::Nack nack) |
Send a network NACK. More... | |
void | processEvents (time::milliseconds timeout=time::milliseconds::zero(), bool keepThread=false) |
Process any data to receive or call timeout callbacks. More... | |
void | shutdown () |
Shutdown face operations. More... | |
DummyIoService & | getIoService () |
Public Attributes | |
std::vector< Interest > | sentInterests |
Interests sent out of this DummyClientFace. More... | |
std::vector< Data > | sentData |
Data sent out of this DummyClientFace. More... | |
std::vector< lp::Nack > | sentNacks |
Nacks sent out of this DummyClientFace. More... | |
Signal< DummyClientFace, Interest > | onSendInterest |
emits whenever an Interest is sent More... | |
Signal< DummyClientFace, Data > | onSendData |
emits whenever a Data packet is sent More... | |
Signal< DummyClientFace, lp::Nack > | onSendNack |
emits whenever a Nack is sent More... | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: struct BroadcastLink |
shared_ptr< BroadcastLink > | m_bcastLink |
std::unique_ptr< KeyChain > | m_internalKeyChain |
KeyChain & | m_keyChain |
std::function< void(time::milliseconds)> | m_processEventsOverride |
Public Attributes inherited from ndn::Face | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED | __pad0__: shared_ptr<Transport> getTransport() const { return m_transport |
Additional Inherited Members |
A client-side face for unit testing.
Definition at line 34 of file dummy-client-face.hpp.
Create a dummy face with internal IO service.
Definition at line 82 of file dummy-client-face.cpp.
|
explicit |
Create a dummy face with internal IO service and the specified KeyChain.
Definition at line 90 of file dummy-client-face.cpp.
|
explicit |
Create a dummy face with the provided IO service.
Definition at line 97 of file dummy-client-face.cpp.
ndn::util::DummyClientFace::DummyClientFace | ( | boost::asio::io_service & | ioService, |
KeyChain & | keyChain, | ||
const Options & | options = Options() |
||
) |
Create a dummy face with the provided IO service and the specified KeyChain.
Definition at line 105 of file dummy-client-face.cpp.
|
override |
Definition at line 112 of file dummy-client-face.cpp.
References ndn::Transport::connect(), ndn::tlv::Data, ndn::util::DummyClientFace::Options::enablePacketLogging, ndn::util::DummyClientFace::Options::enableRegistrationReply, ndn::Face::getIoService(), ndn::Interest::getName(), ndn::nfd::ControlParameters::hasCost(), ndn::nfd::ControlParameters::hasFaceId(), ndn::nfd::ControlParameters::hasOrigin(), ndn::tlv::Interest, ndn::Name::isPrefixOf(), m_bcastLink, m_keyChain, m_processEventsOverride, nonstd::optional_lite::std11::move(), onSendData, onSendInterest, onSendNack, ndn::util::DummyClientFace::Options::processEventsOverride, receive(), ndn::util::DummyClientFace::Options::registrationReplyFaceId, ndn::nfd::ROUTE_ORIGIN_APP, sentData, sentInterests, sentNacks, ndn::mgmt::ControlResponse::setBody(), ndn::mgmt::ControlResponse::setCode(), ndn::nfd::ControlParameters::setCost(), ndn::nfd::ControlParameters::setFaceId(), ndn::nfd::ControlParameters::setOrigin(), ndn::security::SigningInfo::SIGNER_TYPE_SHA256, unlink(), ndn::mgmt::ControlResponse::wireEncode(), and ndn::nfd::ControlParameters::wireEncode().
void ndn::util::DummyClientFace::receive | ( | const Interest & | interest | ) |
cause the Face to receive an interest
Definition at line 238 of file dummy-client-face.cpp.
References ndn::Interest::wireEncode().
Referenced by receive(), and ~DummyClientFace().
void ndn::util::DummyClientFace::receive | ( | const Data & | data | ) |
cause the Face to receive a data
Definition at line 250 of file dummy-client-face.cpp.
References receive(), and ndn::Data::wireEncode().
void ndn::util::DummyClientFace::receive | ( | const lp::Nack & | nack | ) |
cause the Face to receive a nack
Definition at line 261 of file dummy-client-face.cpp.
References ndn::lp::Packet::add(), ndn::lp::Nack::getHeader(), ndn::lp::Nack::getInterest(), receive(), and ndn::Interest::wireEncode().
void ndn::util::DummyClientFace::linkTo | ( | DummyClientFace & | other | ) |
link another DummyClientFace through a broadcast media
Definition at line 275 of file dummy-client-face.cpp.
References m_bcastLink, and NDN_THROW.
void ndn::util::DummyClientFace::unlink | ( | ) |
unlink the broadcast media if previously linked
Definition at line 299 of file dummy-client-face.cpp.
References ndn::Face::doProcessEvents(), m_bcastLink, m_processEventsOverride, and websocketpp::transport::error::timeout.
Referenced by ~DummyClientFace().
std::vector<Interest> ndn::util::DummyClientFace::sentInterests |
Interests sent out of this DummyClientFace.
Sent Interests are appended to this container if options.enablePacketLogger is true. User of this class is responsible for cleaning up the container, if necessary. After .expressInterest, .processEvents must be called before the Interest would show up here.
Definition at line 157 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
std::vector<Data> ndn::util::DummyClientFace::sentData |
Data sent out of this DummyClientFace.
Sent Data are appended to this container if options.enablePacketLogger is true. User of this class is responsible for cleaning up the container, if necessary. After .put, .processEvents must be called before the Data would show up here.
Definition at line 165 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
std::vector<lp::Nack> ndn::util::DummyClientFace::sentNacks |
Nacks sent out of this DummyClientFace.
Sent Nacks are appended to this container if options.enablePacketLogger is true. User of this class is responsible for cleaning up the container, if necessary. After .put, .processEvents must be called before the NACK would show up here.
Definition at line 173 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
Signal<DummyClientFace, Interest> ndn::util::DummyClientFace::onSendInterest |
emits whenever an Interest is sent
After .expressInterest, .processEvents must be called before this signal would be emitted.
Definition at line 179 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
Signal<DummyClientFace, Data> ndn::util::DummyClientFace::onSendData |
emits whenever a Data packet is sent
After .put, .processEvents must be called before this signal would be emitted.
Definition at line 185 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
Signal<DummyClientFace, lp::Nack> ndn::util::DummyClientFace::onSendNack |
emits whenever a Nack is sent
After .put, .processEvents must be called before this signal would be emitted.
Definition at line 191 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::util::DummyClientFace::__pad0__ |
Definition at line 194 of file dummy-client-face.hpp.
shared_ptr<BroadcastLink> ndn::util::DummyClientFace::m_bcastLink |
Definition at line 195 of file dummy-client-face.hpp.
Referenced by linkTo(), unlink(), and ~DummyClientFace().
std::unique_ptr<KeyChain> ndn::util::DummyClientFace::m_internalKeyChain |
Definition at line 196 of file dummy-client-face.hpp.
KeyChain& ndn::util::DummyClientFace::m_keyChain |
Definition at line 197 of file dummy-client-face.hpp.
Referenced by ~DummyClientFace().
std::function<void(time::milliseconds)> ndn::util::DummyClientFace::m_processEventsOverride |
Definition at line 198 of file dummy-client-face.hpp.
Referenced by unlink(), and ~DummyClientFace().