28 #include <boost/filesystem.hpp>
38 static std::string id(
"unix");
55 if (!context.
isDryRun && !m_channels.empty()) {
56 NFD_LOG_WARN(
"Cannot disable Unix channel after initialization");
62 std::string path =
"/run/nfd.sock";
64 std::string path =
"/var/run/nfd.sock";
67 for (
const auto& pair : *configSection) {
68 const std::string& key = pair.first;
72 path = value.get_value<std::string>();
75 NDN_THROW(ConfigFile::Error(
"Unrecognized option face_system.unix." + key));
84 if (!channel->isListening()) {
85 channel->listen(this->
addFace,
nullptr);
89 shared_ptr<UnixStreamChannel>
92 boost::filesystem::path p(unixSocketPath);
93 p = boost::filesystem::canonical(p.parent_path()) / p.filename();
96 auto it = m_channels.find(endpoint);
97 if (it != m_channels.end())
100 auto channel = make_shared<UnixStreamChannel>(endpoint, m_wantCongestionMarking);
101 m_channels[endpoint] = channel;
105 std::vector<shared_ptr<const Channel>>
106 UnixStreamFactory::doGetChannels()
const
Context for processing a config section in ProtocolFactory.
GeneralConfig generalConfig
static std::vector< shared_ptr< const Channel > > getChannelsFromMap(const ChannelMap &channelMap)
FaceCreatedCallback addFace
callback when a new face is created
Protocol factory for stream-oriented Unix sockets.
shared_ptr< UnixStreamChannel > createChannel(const std::string &unixSocketPath)
Create stream-oriented Unix channel using specified socket path.
static const std::string & getId() noexcept
#define NFD_LOG_INIT(name)
boost::asio::local::stream_protocol::endpoint Endpoint
boost::optional< const ConfigSection & > OptionalConfigSection
An optional configuration file section.
boost::property_tree::ptree ConfigSection
A configuration file section.
#define NFD_REGISTER_PROTOCOL_FACTORY(PF)
Registers a protocol factory.
bool wantCongestionMarking