27 #include "../face.hpp" 33 : m_unixSocket(unixSocket)
42 UnixTransport::getDefaultSocketName(
const ConfigFile& config)
48 const util::FaceUri uri(parsed.get<std::string>(
"transport"));
52 BOOST_THROW_EXCEPTION(
Transport::Error(
"Cannot create UnixTransport from \"" +
61 catch (
const boost::property_tree::ptree_bad_path& error)
65 catch (
const boost::property_tree::ptree_bad_data& error)
75 return "/var/run/nfd.sock";
78 shared_ptr<UnixTransport>
81 return make_shared<UnixTransport>(getDefaultSocketName(config));
88 if (!static_cast<bool>(m_impl)) {
91 m_impl = make_shared<Impl>(ref(*
this), ref(ioService));
94 m_impl->connect(boost::asio::local::stream_protocol::endpoint(m_unixSocket));
100 BOOST_ASSERT(static_cast<bool>(m_impl));
107 BOOST_ASSERT(static_cast<bool>(m_impl));
108 m_impl->send(header, payload);
114 BOOST_ASSERT(static_cast<bool>(m_impl));
122 if (static_cast<bool>(m_impl)) {
130 BOOST_ASSERT(static_cast<bool>(m_impl));
virtual void connect(boost::asio::io_service &io_service, const ReceiveCallback &receiveCallback)
Connect transport.
Copyright (c) 2011-2015 Regents of the University of California.
virtual void close()
Close the connection.
represents the underlying protocol and address used by a Face
Class representing a wire element of NDN-TLV packet format.
const std::string & getScheme() const
get scheme (protocol)
function< void(const Block &wire)> ReceiveCallback
boost::property_tree::ptree Parsed
virtual void send(const Block &wire)
Send block of data from wire through the transport.
static shared_ptr< UnixTransport > create(const ConfigFile &config)
UnixTransport(const std::string &unixSocket)
Create Unix transport based on the socket specified in a well-known configuration file or fallback to...
virtual void connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
Connect transport.
const std::string & getPath() const
get path
const Parsed & getParsedConfiguration() const