add createHandler method per phosphor-ipmi-blobs change

createHandler is a new method that's required to be exported from the
handler that is used as the load-time factory called by the blob
manager.

Change-Id: Id97fab4719b9a654b6a3f2d0d6559f9b7cb07a24
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/main.cpp b/main.cpp
index 3cfc21f..8d94dca 100644
--- a/main.cpp
+++ b/main.cpp
@@ -14,8 +14,6 @@
 
 namespace blobs
 {
-using namespace phosphor::logging;
-
 namespace
 {
 HashFileHandler hashHandler;
@@ -42,25 +40,30 @@
 
 } // namespace
 
-void setupFirmwareHandler() __attribute__((constructor));
+} // namespace blobs
 
-void setupFirmwareHandler()
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+std::unique_ptr<blobs::GenericBlobInterface> createHandler();
+
+#ifdef __cplusplus
+}
+#endif
+
+std::unique_ptr<blobs::GenericBlobInterface> createHandler()
 {
-    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        supportedFirmware, supportedTransports);
+    using namespace phosphor::logging;
+
+    auto handler = blobs::FirmwareBlobHandler::CreateFirmwareBlobHandler(
+        blobs::supportedFirmware, blobs::supportedTransports);
 
     if (!handler)
     {
         log<level::ERR>("Firmware Handler has invalid configuration");
-        return;
+        return nullptr;
     }
 
-    auto* manager = getBlobManager();
-
-    if (!manager->registerHandler(std::move(handler)))
-    {
-        log<level::ERR>("Failed to register Firmware Handler");
-    }
+    return std::move(handler);
 }
-
-} // namespace blobs