summaryrefslogtreecommitdiffstats
path: root/example/example.cpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-09-27 10:40:50 -0700
committerPatrick Venture <venture@google.com>2018-10-01 14:57:41 -0700
commit5100a386404edfa517186c66aa90abbb6658bda7 (patch)
tree85e370aceda71f9d69e5fe953ba3a886bf5233fa /example/example.cpp
parent4dc584db905b3fe4d2f5aa6bdf647b21512b4dee (diff)
downloadphosphor-ipmi-blobs-5100a386404edfa517186c66aa90abbb6658bda7.tar.gz
phosphor-ipmi-blobs-5100a386404edfa517186c66aa90abbb6658bda7.zip
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>
Diffstat (limited to 'example/example.cpp')
-rw-r--r--example/example.cpp16
1 files changed, 16 insertions, 0 deletions
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 @@ bool ExampleBlobHandler::expire(uint16_t session)
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
OpenPOWER on IntegriCloud