main: now seeks out shared library handlers are load-time
phosphor-ipmi-blobs now detects blob handlers compiled into shared
libraries on the BMC and loads them at start-up when it's loaded by
phosphor-host-ipmid.
Change-Id: Ib1b6b8f75aa544a263d37f71e133a9a188704de3
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/example/example.cpp b/example/example.cpp
index 66c8227..9209798 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -1,13 +1,18 @@
#include "example/example.hpp"
#include <algorithm>
+#include <blobs-ipmid/manager.hpp>
#include <cstring>
+#include <memory>
+#include <phosphor-logging/log.hpp>
#include <string>
#include <vector>
namespace blobs
{
+using namespace phosphor::logging;
+
constexpr char ExampleBlobHandler::supportedPath[];
ExampleBlob* ExampleBlobHandler::getSession(uint16_t id)
@@ -165,4 +170,15 @@
return false;
}
+void setupExampleHandler() __attribute__((constructor));
+
+void setupExampleHandler()
+{
+ BlobManager* manager = getBlobManager();
+ if (!manager->registerHandler(std::make_unique<ExampleBlobHandler>()))
+ {
+ log<level::ERR>("Failed to register Example Handler");
+ }
+}
+
} // namespace blobs