user_channel: Optimize ipmi complete code
Since the custom return status code is only used in commands.cpp,
optimize the ipmi status code and declare the return status code in
commands.cpp.
Change-Id: I198537e32e38edb9f5a9f8ff347323906bdc6703
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 520501d..78c2647 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -32,6 +32,17 @@
static constexpr uint8_t enableOperation = 0x00;
static constexpr uint8_t disableOperation = 0x01;
+static constexpr uint8_t userIdEnabledViaSetPassword = 0x01;
+static constexpr uint8_t userIdDisabledViaSetPassword = 0x02;
+
+/** IPMI set password return codes (refer spec sec 22.30) */
+constexpr Cc ccPasswdFailMismatch = 0x80;
+
+static inline auto responsePasswdFailMismatch()
+{
+ return response(ccPasswdFailMismatch);
+}
+
/** @brief implements the set user access command
* @param ctx - IPMI context pointer (for channel)
* @param channel - channel number
@@ -353,7 +364,7 @@
{
lg2::debug("Test password failed, user Id: {USER_ID}", "USER_ID",
userId);
- return ipmi::response(ipmiCCPasswdFailMismatch);
+ return ipmi::responsePasswdFailMismatch();
}
return ipmi::responseSuccess();
}