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/nfd.sock";
64 std::string path =
"/var/run/nfd/nfd.sock";
67 for (
const auto& [key, value] : *configSection) {
69 path = value.get_value<std::string>();
72 NDN_THROW(ConfigFile::Error(
"Unrecognized option face_system.unix." + key));
81 if (!channel->isListening()) {
82 channel->listen(this->
addFace,
nullptr);
86 shared_ptr<UnixStreamChannel>
89 auto normalizedPath = std::filesystem::weakly_canonical(std::filesystem::absolute(socketPath));
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
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.
static const std::string & getId() noexcept
shared_ptr< UnixStreamChannel > createChannel(const std::string &socketPath)
Create stream-oriented Unix channel using specified socket path.
#define NFD_LOG_INIT(name)
boost::asio::local::stream_protocol::endpoint Endpoint
boost::optional< const ConfigSection & > OptionalConfigSection
An optional configuration file section.
#define NFD_REGISTER_PROTOCOL_FACTORY(PF)
Registers a protocol factory.
bool wantCongestionMarking