35 : m_unixSocket(unixSocket)
42 UnixTransport::getSocketNameFromUri(
const std::string& uriString)
46 std::string path =
"/run/nfd.sock";
48 std::string path =
"/var/run/nfd.sock";
51 if (uriString.empty()) {
73 shared_ptr<UnixTransport>
76 return make_shared<UnixTransport>(getSocketNameFromUri(uri));
84 if (m_impl ==
nullptr) {
86 m_impl = make_shared<Impl>(*
this, ioService);
89 m_impl->connect(boost::asio::local::stream_protocol::endpoint(m_unixSocket));
95 BOOST_ASSERT(m_impl !=
nullptr);
102 BOOST_ASSERT(m_impl !=
nullptr);
103 m_impl->send(header, payload);
109 BOOST_ASSERT(m_impl !=
nullptr);
118 if (m_impl !=
nullptr) {
127 BOOST_ASSERT(m_impl !=
nullptr);
#define NDN_THROW_NESTED(e)
a transport using Unix stream socket
virtual void connect(boost::asio::io_service &ioService, ReceiveCallback receiveCallback)
Asynchronously open the connection.
Represents a TLV element of the NDN packet format.
#define NDN_LOG_DEBUG(expression)
Log at DEBUG level.
#define NDN_LOG_INIT(name)
Define a non-member log module.
void send(const Block &wire) override
send a TLV block through the transport
void connect(boost::asio::io_service &ioService, ReceiveCallback receiveCallback) override
Asynchronously open the connection.
static shared_ptr< UnixTransport > create(const std::string &uri)
Create transport with parameters defined in URI.
void pause() override
pause the transport
void resume() override
resume the transport
~UnixTransport() override
void close() override
Close the connection.
represents the underlying protocol and address used by a Face
const std::string & getScheme() const
get scheme (protocol)
UnixTransport(const std::string &unixSocket)
const std::string & getPath() const
get path
std::function< void(const Block &wire)> ReceiveCallback