face: consistently use the template method pattern in ProtocolFactory
Change-Id: Ied0bf02cfcdffc7e9b2c28c5452441c01f98ccbc
diff --git a/daemon/face/protocol-factory.cpp b/daemon/face/protocol-factory.cpp
index fb1440d..cdb6cb1 100644
--- a/daemon/face/protocol-factory.cpp
+++ b/daemon/face/protocol-factory.cpp
@@ -24,6 +24,7 @@
*/
#include "protocol-factory.hpp"
+
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
@@ -66,20 +67,66 @@
BOOST_ASSERT(netmon != nullptr);
}
+ProtocolFactory::~ProtocolFactory() = default;
+
+void
+ProtocolFactory::processConfig(OptionalConfigSection configSection,
+ FaceSystem::ConfigContext& context)
+{
+ doProcessConfig(configSection, context);
+}
+
+void
+ProtocolFactory::doProcessConfig(OptionalConfigSection,
+ FaceSystem::ConfigContext&)
+{
+}
+
+void
+ProtocolFactory::createFace(const CreateFaceRequest& req,
+ const FaceCreatedCallback& onCreated,
+ const FaceCreationFailedCallback& onFailure)
+{
+ BOOST_ASSERT(!FaceUri::canCanonize(req.remoteUri.getScheme()) ||
+ req.remoteUri.isCanonical());
+ BOOST_ASSERT(!req.localUri || !FaceUri::canCanonize(req.localUri->getScheme()) ||
+ req.localUri->isCanonical());
+ doCreateFace(req, onCreated, onFailure);
+}
+
+void
+ProtocolFactory::doCreateFace(const CreateFaceRequest&,
+ const FaceCreatedCallback&,
+ const FaceCreationFailedCallback& onFailure)
+{
+ onFailure(406, "Unsupported protocol");
+}
+
shared_ptr<Face>
ProtocolFactory::createNetdevBoundFace(const FaceUri& remote,
const shared_ptr<const ndn::net::NetworkInterface>& netif)
{
BOOST_ASSERT(remote.isCanonical());
- return this->doCreateNetdevBoundFace(remote, netif);
+ return doCreateNetdevBoundFace(remote, netif);
}
shared_ptr<Face>
-ProtocolFactory::doCreateNetdevBoundFace(const FaceUri& remote,
- const shared_ptr<const ndn::net::NetworkInterface>& netif)
+ProtocolFactory::doCreateNetdevBoundFace(const FaceUri&,
+ const shared_ptr<const ndn::net::NetworkInterface>&)
{
- BOOST_THROW_EXCEPTION(Error(
- "this protocol factory does not support netdev-bound faces"));
+ BOOST_THROW_EXCEPTION(Error("This protocol factory does not support netdev-bound faces"));
+}
+
+std::vector<shared_ptr<const Channel>>
+ProtocolFactory::getChannels() const
+{
+ return doGetChannels();
+}
+
+std::vector<shared_ptr<const Channel>>
+ProtocolFactory::doGetChannels() const
+{
+ return {};
}
} // namespace face