summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-03-21 13:02:05 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-03-21 13:03:54 -0700
commitbe376306918e84f411c1e4bdba15ec5b6a2219dc (patch)
tree79f0a817791a0e426962fc46dbfa3c2b575d9426 /include
parent1b7f6f2d01b955cecb79eea8cc21f6fe387ce1f1 (diff)
downloadphosphor-host-ipmid-be376306918e84f411c1e4bdba15ec5b6a2219dc.tar.gz
phosphor-host-ipmid-be376306918e84f411c1e4bdba15ec5b6a2219dc.zip
Add user context parameter to legacy ipmi handler registration
This part was originally omitted, but needed by some external provider libraries. This will more closely mimic the behavior of ipmid prior to the architecture update. Change-Id: I5db35222e268a117480285c700d88206d6505d92 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/ipmid/handler.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/ipmid/handler.hpp b/include/ipmid/handler.hpp
index 1643e58..17beb42 100644
--- a/include/ipmid/handler.hpp
+++ b/include/ipmid/handler.hpp
@@ -278,12 +278,14 @@ template <>
class IpmiHandler<ipmid_callback_t> final : public HandlerBase
{
public:
- explicit IpmiHandler(const ipmid_callback_t& handler) : handler_(handler)
+ explicit IpmiHandler(const ipmid_callback_t& handler, void* ctx = nullptr) :
+ handler_(handler), handlerCtx(ctx)
{
}
private:
ipmid_callback_t handler_;
+ void* handlerCtx;
/** @brief call the registered handler with the request
*
@@ -315,7 +317,7 @@ class IpmiHandler<ipmid_callback_t> final : public HandlerBase
{
ccRet = handler_(request->ctx->netFn, request->ctx->cmd,
request->payload.data(), response->payload.data(),
- &len, nullptr);
+ &len, handlerCtx);
}
catch (const std::exception& e)
{
@@ -453,9 +455,10 @@ class IpmiHandler<oem::Handler> final : public HandlerBase
*
* @return A shared_ptr to the created handler object
*/
-inline auto makeLegacyHandler(const ipmid_callback_t& handler)
+inline auto makeLegacyHandler(const ipmid_callback_t& handler,
+ void* ctx = nullptr)
{
- HandlerBase::ptr ptr(new IpmiHandler<ipmid_callback_t>(handler));
+ HandlerBase::ptr ptr(new IpmiHandler<ipmid_callback_t>(handler, ctx));
return ptr;
}
OpenPOWER on IntegriCloud