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 bool wantCongestionMarking
#define NFD_LOG_INIT(name)
GeneralConfig generalConfig
NFD_REGISTER_PROTOCOL_FACTORY(EthernetFactory)
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
Protocol factory for stream-oriented Unix sockets.
FaceCreatedCallback addFace
callback when a new face is created
Copyright (c) 2011-2015 Regents of the University of California.
shared_ptr< UnixStreamChannel > createChannel(const std::string &unixSocketPath)
Create stream-oriented Unix channel using specified socket path.
boost::property_tree::ptree ConfigSection
a config file section
context for processing a config section in ProtocolFactory
boost::asio::local::stream_protocol::endpoint Endpoint
static std::vector< shared_ptr< const Channel > > getChannelsFromMap(const ChannelMap &channelMap)
static const std::string & getId() noexcept