28 #include <boost/filesystem.hpp> 39 static std::string id(
"unix");
56 if (!context.
isDryRun && !m_channels.empty()) {
57 NFD_LOG_WARN(
"Cannot disable Unix channel after initialization");
63 std::string path =
"/run/nfd.sock";
65 std::string path =
"/var/run/nfd.sock";
68 for (
const auto& pair : *configSection) {
69 const std::string& key = pair.first;
73 path = value.get_value<std::string>();
85 if (!channel->isListening()) {
86 channel->listen(this->
addFace,
nullptr);
90 shared_ptr<UnixStreamChannel>
93 boost::filesystem::path p(unixSocketPath);
94 p = boost::filesystem::canonical(p.parent_path()) / p.filename();
97 auto it = m_channels.find(endpoint);
98 if (it != m_channels.end())
101 auto channel = make_shared<UnixStreamChannel>(endpoint, m_wantCongestionMarking);
102 m_channels[endpoint] = channel;
106 std::vector<shared_ptr<const Channel>>
107 UnixStreamFactory::doGetChannels()
const FaceCreatedCallback addFace
callback when a new face is created
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
#define NFD_REGISTER_PROTOCOL_FACTORY(PF)
Registers a protocol factory.
context for processing a config section in ProtocolFactory
static std::vector< shared_ptr< const Channel > > getChannelsFromMap(const ChannelMap &channelMap)
boost::property_tree::ptree ConfigSection
a config file section
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
GeneralConfig generalConfig
static const std::string & getId() noexcept
#define NFD_LOG_INIT(name)
shared_ptr< UnixStreamChannel > createChannel(const std::string &unixSocketPath)
Create stream-oriented Unix channel using specified socket path.
bool wantCongestionMarking
boost::asio::local::stream_protocol::endpoint Endpoint