34 : m_unixSocket(unixSocket)
41 UnixTransport::getSocketNameFromUri(
const std::string& uriString)
44 if (!uriString.empty()) {
47 if (uri.getScheme() !=
"unix") {
48 NDN_THROW(Error(
"Cannot create UnixTransport from \"" + uri.getScheme() +
"\" URI"));
50 if (!uri.getPath().empty()) {
54 catch (
const FaceUri::Error& error) {
64 "/var/run/nfd/nfd.sock";
68 shared_ptr<UnixTransport>
71 return make_shared<UnixTransport>(getSocketNameFromUri(uri));
79 if (m_impl ==
nullptr) {
81 m_impl = make_shared<Impl>(*
this, ioCtx);
84 m_impl->connect(boost::asio::local::stream_protocol::endpoint(m_unixSocket));
90 BOOST_ASSERT(m_impl !=
nullptr);
97 BOOST_ASSERT(m_impl !=
nullptr);
106 if (m_impl !=
nullptr) {
115 BOOST_ASSERT(m_impl !=
nullptr);
Represents a TLV element of the NDN packet format.
The underlying protocol and address used by a Face.
std::function< void(const Block &)> ReceiveCallback
virtual void connect(boost::asio::io_context &ioCtx, ReceiveCallback receiveCallback)
Asynchronously open the connection.
A transport that uses a Unix stream socket for communication.
void resume() override
Resume the transport.
static shared_ptr< UnixTransport > create(const std::string &uri)
Create transport with parameters defined in URI.
void pause() override
Pause the transport, canceling all pending operations.
void send(const Block &wire) override
Send a TLV block through the transport.
~UnixTransport() override
UnixTransport(const std::string &unixSocket)
void connect(boost::asio::io_context &ioCtx, ReceiveCallback receiveCallback) override
Asynchronously open the connection.
void close() override
Close the connection.
#define NDN_THROW_NESTED(e)
#define NDN_LOG_DEBUG(expression)
Log at DEBUG level.
#define NDN_LOG_INIT(name)
Define a non-member log module.