Change the signature of the command handler functions.

Resolves openbmc/openbmc#857

Change-Id: I0b7ca6665dd89629838a238d77aff67fec1818c7
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index e9a91e6..c6e68be 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -7,8 +7,8 @@
 namespace command
 {
 
-std::vector<uint8_t> GetChannelCapabilities(std::vector<uint8_t>& inPayload,
-                                            const message::Handler& handler)
+std::vector<uint8_t> GetChannelCapabilities(
+        const std::vector<uint8_t>& inPayload, const message::Handler& handler)
 {
     std::cout << ">> GetChannelCapabilities\n";
 
diff --git a/command/channel_auth.hpp b/command/channel_auth.hpp
index 1d1d5c4..7b922c2 100644
--- a/command/channel_auth.hpp
+++ b/command/channel_auth.hpp
@@ -118,7 +118,7 @@
  *
  * @return Response data for the command
  */
-std::vector<uint8_t> GetChannelCapabilities(std::vector<uint8_t>& inPayload,
-                                            const message::Handler& handler);
+std::vector<uint8_t> GetChannelCapabilities(
+        const std::vector<uint8_t>& inPayload, const message::Handler& handler);
 
 } // namespace command
diff --git a/command/open_session.cpp b/command/open_session.cpp
index 96507f6..d29cbf1 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -9,13 +9,13 @@
 namespace command
 {
 
-std::vector<uint8_t> openSession(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
                                  const message::Handler& handler)
 {
     std::cout << ">> openSession\n";
 
     std::vector<uint8_t> outPayload(sizeof(OpenSessionResponse));
-    auto request = reinterpret_cast<OpenSessionRequest*>(inPayload.data());
+    auto request = reinterpret_cast<const OpenSessionRequest*>(inPayload.data());
     auto response = reinterpret_cast<OpenSessionResponse*>(outPayload.data());
 
     // Check for valid Authentication Algorithms
diff --git a/command/open_session.hpp b/command/open_session.hpp
index f5111d2..717b99b 100644
--- a/command/open_session.hpp
+++ b/command/open_session.hpp
@@ -174,7 +174,7 @@
  *
  * @return Response data for the command
  */
-std::vector<uint8_t> openSession(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
                                  const message::Handler& handler);
 
 } // namespace command
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index 9602c54..1b69a33 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -13,11 +13,12 @@
 
 using namespace phosphor::logging;
 
-std::vector<uint8_t> activatePayload(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
                                      const message::Handler& handler)
 {
     std::vector<uint8_t> outPayload(sizeof(ActivatePayloadResponse));
-    auto request = reinterpret_cast<ActivatePayloadRequest*>(inPayload.data());
+    auto request = reinterpret_cast<const ActivatePayloadRequest*>
+                   (inPayload.data());
     auto response = reinterpret_cast<ActivatePayloadResponse*>
                     (outPayload.data());
 
@@ -81,11 +82,11 @@
     return outPayload;
 }
 
-std::vector<uint8_t> deactivatePayload(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> deactivatePayload(const std::vector<uint8_t>& inPayload,
                                        const message::Handler& handler)
 {
     std::vector<uint8_t> outPayload(sizeof(DeactivatePayloadResponse));
-    auto request = reinterpret_cast<DeactivatePayloadRequest*>
+    auto request = reinterpret_cast<const DeactivatePayloadRequest*>
             (inPayload.data());
     auto response = reinterpret_cast<DeactivatePayloadResponse*>
             (outPayload.data());
@@ -141,11 +142,12 @@
     return outPayload;
 }
 
-std::vector<uint8_t> getPayloadStatus(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> getPayloadStatus(const std::vector<uint8_t>& inPayload,
                                       const message::Handler& handler)
 {
     std::vector<uint8_t> outPayload(sizeof(GetPayloadStatusResponse));
-    auto request = reinterpret_cast<GetPayloadStatusRequest*>(inPayload.data());
+    auto request = reinterpret_cast<const GetPayloadStatusRequest*>
+                   (inPayload.data());
     auto response = reinterpret_cast<GetPayloadStatusResponse*>
                     (outPayload.data());
 
diff --git a/command/payload_cmds.hpp b/command/payload_cmds.hpp
index 54b3f10..6901256 100644
--- a/command/payload_cmds.hpp
+++ b/command/payload_cmds.hpp
@@ -108,7 +108,7 @@
  *
  *  @return Response data for the command
  */
-std::vector<uint8_t> activatePayload(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
                                      const message::Handler& handler);
 
 constexpr uint8_t IPMI_CC_PAYLOAD_DEACTIVATED = 0x80;
@@ -170,7 +170,7 @@
  *
  * @return Response data for the command.
  */
-std::vector<uint8_t> deactivatePayload(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> deactivatePayload(const std::vector<uint8_t>& inPayload,
                                        const message::Handler& handler);
 
 /** @struct GetPayloadStatusRequest
@@ -248,7 +248,7 @@
  *
  *  @return Response data for the command
  */
-std::vector<uint8_t> getPayloadStatus(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> getPayloadStatus(const std::vector<uint8_t>& inPayload,
                                       const message::Handler& handler);
 
 } // namespace command
diff --git a/command/rakp12.cpp b/command/rakp12.cpp
index 1249d80..19dc160 100644
--- a/command/rakp12.cpp
+++ b/command/rakp12.cpp
@@ -14,13 +14,13 @@
 namespace command
 {
 
-std::vector<uint8_t> RAKP12(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
                             const message::Handler& handler)
 {
     std::cout << ">> RAKP12\n";
 
     std::vector<uint8_t> outPayload(sizeof(RAKP2response));
-    auto request = reinterpret_cast<RAKP1request*>(inPayload.data());
+    auto request = reinterpret_cast<const RAKP1request*>(inPayload.data());
     auto response = reinterpret_cast<RAKP2response*>(outPayload.data());
 
     // Session ID zero is reserved for Session Setup
@@ -88,7 +88,7 @@
 
     // Copy the Remote Console Random Number from the RAKP1 request to the
     // Authentication Algorithm
-    std::copy_n(reinterpret_cast<uint8_t*>
+    std::copy_n(reinterpret_cast<const uint8_t*>
                 (request->remote_console_random_number),
                 cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN,
                 authAlgo->rcRandomNum.begin());
diff --git a/command/rakp12.hpp b/command/rakp12.hpp
index f68ec47..2d86bdb 100644
--- a/command/rakp12.hpp
+++ b/command/rakp12.hpp
@@ -65,7 +65,7 @@
  *
  * @return Response data for the command
  */
-std::vector<uint8_t> RAKP12(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
                             const message::Handler& handler);
 
 } // namespace command
diff --git a/command/rakp34.cpp b/command/rakp34.cpp
index cd455cd..95b8af7 100644
--- a/command/rakp34.cpp
+++ b/command/rakp34.cpp
@@ -53,13 +53,13 @@
     }
 }
 
-std::vector<uint8_t> RAKP34(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> RAKP34(const std::vector<uint8_t>& inPayload,
                             const message::Handler& handler)
 {
     std::cout << ">> RAKP34\n";
 
     std::vector<uint8_t> outPayload(sizeof(RAKP4response));
-    auto request = reinterpret_cast<RAKP3request*>(inPayload.data());
+    auto request = reinterpret_cast<const RAKP3request*>(inPayload.data());
     auto response = reinterpret_cast<RAKP4response*>(outPayload.data());
 
     // Check if the RAKP3 Payload Length is as expected
diff --git a/command/rakp34.hpp b/command/rakp34.hpp
index e3d82ff..a110a24 100644
--- a/command/rakp34.hpp
+++ b/command/rakp34.hpp
@@ -50,7 +50,7 @@
  *
  * @return Response data for the command
  */
-std::vector<uint8_t> RAKP34(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> RAKP34(const std::vector<uint8_t>& inPayload,
                             const message::Handler& handler);
 
 } // namespace command
diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
index f30ef78..706cfcd 100644
--- a/command/session_cmds.cpp
+++ b/command/session_cmds.cpp
@@ -9,13 +9,14 @@
 namespace command
 {
 
-std::vector<uint8_t> setSessionPrivilegeLevel(std::vector<uint8_t>& inPayload,
-                                              const message::Handler& handler)
+std::vector<uint8_t> setSessionPrivilegeLevel(
+        const std::vector<uint8_t>& inPayload, const message::Handler& handler)
 {
     std::cout << ">> setSessionPrivilegeLevel\n";
 
     std::vector<uint8_t> outPayload(sizeof(SetSessionPrivLevelResp));
-    auto request = reinterpret_cast<SetSessionPrivLevelReq*>(inPayload.data());
+    auto request = reinterpret_cast<const SetSessionPrivLevelReq*>
+                   (inPayload.data());
     auto response = reinterpret_cast<SetSessionPrivLevelResp*>
                     (outPayload.data());
     response->completionCode = IPMI_CC_OK;
@@ -44,13 +45,14 @@
     return outPayload;
 }
 
-std::vector<uint8_t> closeSession(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
                                   const message::Handler& handler)
 {
     std::cout << ">> closeSession\n";
 
     std::vector<uint8_t> outPayload(sizeof(CloseSessionResponse));
-    auto request = reinterpret_cast<CloseSessionRequest*>(inPayload.data());
+    auto request = reinterpret_cast<const CloseSessionRequest*>
+                   (inPayload.data());
     auto response = reinterpret_cast<CloseSessionResponse*>(outPayload.data());
     response->completionCode = IPMI_CC_OK ;
 
diff --git a/command/session_cmds.hpp b/command/session_cmds.hpp
index 00dbfc4..95e3464 100644
--- a/command/session_cmds.hpp
+++ b/command/session_cmds.hpp
@@ -71,8 +71,8 @@
  *
  * @return Response data for the command
  */
-std::vector<uint8_t> setSessionPrivilegeLevel(std::vector<uint8_t>& inPayload,
-                                              const message::Handler& handler);
+std::vector<uint8_t> setSessionPrivilegeLevel(
+        const std::vector<uint8_t>& inPayload, const message::Handler& handler);
 
 constexpr uint8_t IPMI_CC_INVALID_SESSIONID = 0x87;
 
@@ -112,7 +112,7 @@
  *
  * @return Response data for the command
  */
-std::vector<uint8_t> closeSession(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
                                   const message::Handler& handler);
 
 } // namespace command
diff --git a/command/sol_cmds.cpp b/command/sol_cmds.cpp
index 3096d2e..344b6d8 100644
--- a/command/sol_cmds.cpp
+++ b/command/sol_cmds.cpp
@@ -12,11 +12,10 @@
 
 using namespace phosphor::logging;
 
-std::vector<uint8_t> payloadHandler(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> payloadHandler(const std::vector<uint8_t>& inPayload,
                                     const message::Handler& handler)
 {
-    auto request = reinterpret_cast<Payload*>(inPayload.data());
-
+    auto request = reinterpret_cast<const Payload*>(inPayload.data());
     auto solDataSize = inPayload.size() - sizeof(Payload);
 
     Buffer charData(solDataSize);
diff --git a/command/sol_cmds.hpp b/command/sol_cmds.hpp
index 010a245..2b0a55a 100644
--- a/command/sol_cmds.hpp
+++ b/command/sol_cmds.hpp
@@ -20,7 +20,7 @@
  *
  *  @return Response data for the command.
  */
-std::vector<uint8_t> payloadHandler(std::vector<uint8_t>& inPayload,
+std::vector<uint8_t> payloadHandler(const std::vector<uint8_t>& inPayload,
                                     const message::Handler& handler);
 
 constexpr uint8_t netfnTransport = 0x0C;