make internal command functor match external
The internal command functor was getting passed a
const message::Handler& instead of a std::shared_ptr<message::Handler>
which will not work with an upcoming patch that needs the functor to be
able to modify the Handler object. Also, it is convenient to have the
same signature for both types of handlers.
Tested: run ipmitool to see that behavior does not change.
Change-Id: Ie8660e4d16bd66eccc282aef2594b88c25b847db
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index f719452..ee19a3b 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -10,7 +10,7 @@
std::vector<uint8_t>
GetChannelCapabilities(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const GetChannelCapabilitiesReq*>(inPayload.data());
diff --git a/command/channel_auth.hpp b/command/channel_auth.hpp
index 9f2abe1..b78fdb2 100644
--- a/command/channel_auth.hpp
+++ b/command/channel_auth.hpp
@@ -120,6 +120,6 @@
*/
std::vector<uint8_t>
GetChannelCapabilities(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/open_session.cpp b/command/open_session.cpp
index 2887d37..a7b75bf 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -12,7 +12,7 @@
{
std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const OpenSessionRequest*>(inPayload.data());
diff --git a/command/open_session.hpp b/command/open_session.hpp
index 700c784..e119dbc 100644
--- a/command/open_session.hpp
+++ b/command/open_session.hpp
@@ -175,6 +175,6 @@
* @return Response data for the command
*/
std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index ecb86e7..1413e6c 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -18,7 +18,7 @@
using namespace phosphor::logging;
std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const ActivatePayloadRequest*>(inPayload.data());
@@ -56,7 +56,7 @@
return outPayload;
}
- auto session = session::Manager::get().getSession(handler.sessionID);
+ auto session = session::Manager::get().getSession(handler->sessionID);
if (!request->encryption && session->isCryptAlgoEnabled())
{
@@ -84,13 +84,13 @@
}
// Set the current command's socket channel to the session
- handler.setChannelInSession();
+ handler->setChannelInSession();
// Start the SOL payload
try
{
sol::Manager::get().startPayloadInstance(request->payloadInstance,
- handler.sessionID);
+ handler->sessionID);
}
catch (std::exception& e)
{
@@ -109,8 +109,9 @@
return outPayload;
}
-std::vector<uint8_t> deactivatePayload(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+std::vector<uint8_t>
+ deactivatePayload(const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const DeactivatePayloadRequest*>(inPayload.data());
@@ -180,8 +181,9 @@
return outPayload;
}
-std::vector<uint8_t> getPayloadStatus(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+std::vector<uint8_t>
+ getPayloadStatus(const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const GetPayloadStatusRequest*>(inPayload.data());
@@ -214,7 +216,7 @@
}
std::vector<uint8_t> getPayloadInfo(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const GetPayloadInfoRequest*>(inPayload.data());
diff --git a/command/payload_cmds.hpp b/command/payload_cmds.hpp
index b28392b..8778786 100644
--- a/command/payload_cmds.hpp
+++ b/command/payload_cmds.hpp
@@ -109,8 +109,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+std::vector<uint8_t>
+ activatePayload(const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
constexpr uint8_t IPMI_CC_PAYLOAD_DEACTIVATED = 0x80;
@@ -172,8 +173,9 @@
*
* @return Response data for the command.
*/
-std::vector<uint8_t> deactivatePayload(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+std::vector<uint8_t>
+ deactivatePayload(const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
/** @struct GetPayloadStatusRequest
*
@@ -250,8 +252,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t> getPayloadStatus(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+std::vector<uint8_t>
+ getPayloadStatus(const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
/** @struct GetPayloadInfoRequest
*
@@ -286,7 +289,7 @@
* @return Response data for the command
*/
std::vector<uint8_t> getPayloadInfo(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/rakp12.cpp b/command/rakp12.cpp
index 7d349c6..912a1d0 100644
--- a/command/rakp12.cpp
+++ b/command/rakp12.cpp
@@ -24,7 +24,7 @@
}
std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
auto request = reinterpret_cast<const RAKP1request*>(inPayload.data());
// verify inPayload minimum size
diff --git a/command/rakp12.hpp b/command/rakp12.hpp
index c19853f..bf6d4c5 100644
--- a/command/rakp12.hpp
+++ b/command/rakp12.hpp
@@ -73,6 +73,6 @@
* @return Response data for the command
*/
std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/rakp34.cpp b/command/rakp34.cpp
index a8ad86a..59707d0 100644
--- a/command/rakp34.cpp
+++ b/command/rakp34.cpp
@@ -65,7 +65,7 @@
}
std::vector<uint8_t> RAKP34(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
std::vector<uint8_t> outPayload(sizeof(RAKP4response));
diff --git a/command/rakp34.hpp b/command/rakp34.hpp
index e582256..7b29d70 100644
--- a/command/rakp34.hpp
+++ b/command/rakp34.hpp
@@ -50,6 +50,6 @@
* @return Response data for the command
*/
std::vector<uint8_t> RAKP34(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
index 84c6e85..1b51612 100644
--- a/command/session_cmds.cpp
+++ b/command/session_cmds.cpp
@@ -18,7 +18,7 @@
std::vector<uint8_t>
setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const SetSessionPrivLevelReq*>(inPayload.data());
@@ -34,7 +34,7 @@
response->completionCode = IPMI_CC_OK;
uint8_t reqPrivilegeLevel = request->reqPrivLevel;
- auto session = session::Manager::get().getSession(handler.sessionID);
+ auto session = session::Manager::get().getSession(handler->sessionID);
if (reqPrivilegeLevel == 0) // Just return present privilege level
{
@@ -209,7 +209,7 @@
}
std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
// minimum inPayload size is reqSessionId (uint32_t)
// maximum inPayload size is struct CloseSessionRequest
@@ -260,7 +260,7 @@
{
ipmiNetworkInstance = session::Manager::get().getNetworkInstance();
auto currentSession =
- session::Manager::get().getSession(handler.sessionID);
+ session::Manager::get().getSession(handler->sessionID);
currentSessionPriv = currentSession->currentPrivilege();
}
catch (sdbusplus::exception::SdBusError& e)
diff --git a/command/session_cmds.hpp b/command/session_cmds.hpp
index d5d394b..026b9d8 100644
--- a/command/session_cmds.hpp
+++ b/command/session_cmds.hpp
@@ -77,7 +77,7 @@
*/
std::vector<uint8_t>
setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
/**
* @struct CloseSessionRequest
*
@@ -115,6 +115,6 @@
* @return Response data for the command
*/
std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/sol_cmds.cpp b/command/sol_cmds.cpp
index 1253ac5..81dfc99 100644
--- a/command/sol_cmds.cpp
+++ b/command/sol_cmds.cpp
@@ -15,7 +15,7 @@
using namespace phosphor::logging;
std::vector<uint8_t> payloadHandler(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
// Check inPayload size is at least Payload
if (inPayload.size() < sizeof(Payload))
@@ -35,7 +35,7 @@
try
{
- auto& context = sol::Manager::get().getContext(handler.sessionID);
+ auto& context = sol::Manager::get().getContext(handler->sessionID);
context.processInboundPayload(
request->packetSeqNum, request->packetAckSeqNum,
@@ -70,7 +70,7 @@
}
std::vector<uint8_t> getConfParams(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
+ std::shared_ptr<message::Handler>& handler)
{
std::vector<uint8_t> outPayload(sizeof(GetConfParamsResponse));
auto request =
diff --git a/command/sol_cmds.hpp b/command/sol_cmds.hpp
index 182b73e..3e05e0f 100644
--- a/command/sol_cmds.hpp
+++ b/command/sol_cmds.hpp
@@ -22,7 +22,7 @@
* @return Response data for the command.
*/
std::vector<uint8_t> payloadHandler(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
constexpr uint8_t netfnTransport = 0x0C;
constexpr uint8_t solActivatingCmd = 0x20;
@@ -185,7 +185,7 @@
* @return Response data for the command.
*/
std::vector<uint8_t> setConfParams(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
/** @struct GetConfParamsRequest
*
@@ -228,7 +228,7 @@
* @return Response data for the command.
*/
std::vector<uint8_t> getConfParams(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
+ std::shared_ptr<message::Handler>& handler);
} // namespace command