28 #include <boost/filesystem.hpp> 39 static std::string id(
"unix");
55 if (!context.
isDryRun && !m_channels.empty()) {
56 NFD_LOG_WARN(
"Cannot disable Unix channel after initialization");
61 std::string path =
"/var/run/nfd.sock";
63 for (
const auto& pair : *configSection) {
64 const std::string& key = pair.first;
68 path = value.get_value<std::string>();
71 BOOST_THROW_EXCEPTION(ConfigFile::Error(
"Unrecognized option face_system.unix." + key));
80 if (!channel->isListening()) {
81 channel->listen(this->
addFace,
nullptr);
85 shared_ptr<UnixStreamChannel>
88 boost::filesystem::path p(unixSocketPath);
89 p = boost::filesystem::canonical(p.parent_path()) / p.filename();
92 auto it = m_channels.find(endpoint);
93 if (it != m_channels.end())
96 auto channel = make_shared<UnixStreamChannel>(endpoint, m_wantCongestionMarking);
97 m_channels[endpoint] = channel;
101 std::vector<shared_ptr<const Channel>>
102 UnixStreamFactory::doGetChannels()
const bool wantCongestionMarking
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)
#define NFD_LOG_INIT(name)
static const std::string & getId() noexcept