blob: ef09c4608520a2cad6b9658c7ebfdb19106eedc0 [file] [log] [blame]
Sui Chen03eba282021-02-11 11:35:56 -08001#include "handler.hpp"
2
3#include <blobs-ipmid/blobs.hpp>
4
5#include <memory>
6
7// Extern "C" is used due to the usage of dlopen() for loading IPMI handlers
8// and IPMI blob handlers. This happens in two steps:
9//
10// 1) ipmid loads all libraries in /usr/lib/ipmid-providers from its
11// loadLibraries() function using dlopen().
12// 2) The blobs library, libblobcmds.so, loads all libraries in
13// /usr/lib/blobs-ipmid from its loadLibraries() function. It uses dlsym()
14// to locate the createHandler function by its un-mangled name
15// "createHandler". Using extern "C" prevents its name from being mangled
16// into, for example, "_Z13createHandlerv".
17
18extern "C" std::unique_ptr<blobs::GenericBlobInterface> createHandler()
19{
20 return std::make_unique<blobs::MetricBlobHandler>();
21}