mgmt: Reinitialize multicast faces and partially reload config file on HUP signal
The following elements from the config file are reloaded:
- effective user/group
- log levels
- multicast faces (enable/disable)
- security
Change-Id: I6ddf124702b30610dd0404d8fbaa9a9d800f02bf
Refs: #1584
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index 0408f03..a399a64 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.cpp
@@ -69,7 +69,8 @@
EthernetFactory::findMulticastFace(const std::string& interfaceName,
const ethernet::Address& address) const
{
- MulticastFacesMap::const_iterator i = m_multicastFaces.find(std::make_pair(interfaceName, address));
+ MulticastFaceMap::const_iterator i =
+ m_multicastFaces.find(std::make_pair(interfaceName, address));
if (i != m_multicastFaces.end())
return i->second;
else
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index 738164a..5630141 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -38,11 +38,19 @@
/**
* \brief Exception of EthernetFactory
*/
- struct Error : public ProtocolFactory::Error
+ class Error : public ProtocolFactory::Error
{
- Error(const std::string& what) : ProtocolFactory::Error(what) {}
+ public:
+ explicit
+ Error(const std::string& what)
+ : ProtocolFactory::Error(what)
+ {
+ }
};
+ typedef std::map< std::pair<std::string, ethernet::Address>,
+ shared_ptr<EthernetFace> > MulticastFaceMap;
+
// from ProtocolFactory
virtual void
createFace(const FaceUri& uri,
@@ -68,6 +76,12 @@
createMulticastFace(const shared_ptr<NetworkInterfaceInfo>& interface,
const ethernet::Address& address);
+ /**
+ * \brief Get map of configured multicast faces
+ */
+ const MulticastFaceMap&
+ getMulticastFaces() const;
+
private:
void
afterFaceFailed(const std::string& interfaceName,
@@ -86,11 +100,17 @@
const ethernet::Address& address) const;
private:
- typedef std::map< std::pair<std::string, ethernet::Address>,
- shared_ptr<EthernetFace> > MulticastFacesMap;
- MulticastFacesMap m_multicastFaces;
+ MulticastFaceMap m_multicastFaces;
};
+
+inline const EthernetFactory::MulticastFaceMap&
+EthernetFactory::getMulticastFaces() const
+{
+ return m_multicastFaces;
+}
+
+
} // namespace nfd
#endif // NFD_DAEMON_FACE_ETHERNET_FACTORY_HPP
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index 73403aa..4db6e43 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -74,6 +74,10 @@
* \param onFaceCreated Callback to notify successful creation of the face
* \param onAcceptFailed Callback to notify when channel fails
*
+ * Once a face is created, if it doesn't send/receive anything for
+ * a period of time equal to timeout, it will be destroyed
+ * \todo this functionality has to be implemented
+ *
* \throws UdpChannel::Error if called multiple times
*/
void
diff --git a/daemon/face/udp-factory.hpp b/daemon/face/udp-factory.hpp
index fa146ad..89cf37c 100644
--- a/daemon/face/udp-factory.hpp
+++ b/daemon/face/udp-factory.hpp
@@ -40,11 +40,18 @@
/**
* \brief Exception of UdpFactory
*/
- struct Error : public ProtocolFactory::Error
+ class Error : public ProtocolFactory::Error
{
- Error(const std::string& what) : ProtocolFactory::Error(what) {}
+ public:
+ explicit
+ Error(const std::string& what)
+ : ProtocolFactory::Error(what)
+ {
+ }
};
+ typedef std::map< udp::Endpoint, shared_ptr<MulticastUdpFace> > MulticastFaceMap;
+
explicit
UdpFactory(const std::string& defaultPort = "6363");
@@ -74,7 +81,7 @@
*/
shared_ptr<UdpChannel>
createChannel(const udp::Endpoint& localEndpoint,
- const time::seconds& timeout = time::seconds(600));
+ const time::seconds& timeout = time::seconds(600));
/**
* \brief Create UDP-based channel using specified host and port number
@@ -89,17 +96,13 @@
* Example: fe80::5e96:9dff:fe7d:9c8d%en1
* Otherwise, you can use ::
*
- * Once a face is created, if it doesn't send/receive anything for
- * a period of time equal to timeout, it will be destroyed
- * @todo this funcionality has to be implemented
- *
* \throws UdpChannel::Error if the bind on the socket fails
* \throws UdpFactory::Error
*/
shared_ptr<UdpChannel>
createChannel(const std::string& localHost,
- const std::string& localPort,
- const time::seconds& timeout = time::seconds(600));
+ const std::string& localPort,
+ const time::seconds& timeout = time::seconds(600));
/**
* \brief Create MulticastUdpFace using udp::Endpoint
@@ -147,13 +150,12 @@
const FaceCreatedCallback& onCreated,
const FaceConnectFailedCallback& onConnectFailed);
-protected:
- typedef std::map< udp::Endpoint, shared_ptr<MulticastUdpFace> > MulticastFaceMap;
/**
- * \brief Keeps tracking of the MulticastUdpFace created
+ * \brief Get map of configured multicast faces
*/
- MulticastFaceMap m_multicastFaces;
+ const MulticastFaceMap&
+ getMulticastFaces() const;
private:
@@ -197,14 +199,24 @@
const FaceCreatedCallback& onCreated,
const FaceConnectFailedCallback& onConnectFailed);
+private:
typedef std::map< udp::Endpoint, shared_ptr<UdpChannel> > ChannelMap;
+
ChannelMap m_channels;
+ MulticastFaceMap m_multicastFaces;
std::string m_defaultPort;
-
std::set<udp::Endpoint> m_prohibitedEndpoints;
};
+
+inline const UdpFactory::MulticastFaceMap&
+UdpFactory::getMulticastFaces() const
+{
+ return m_multicastFaces;
+}
+
+
} // namespace nfd
#endif // NFD_DAEMON_FACE_UDP_FACTORY_HPP