user_channel:Change fun ret&cmd cc as per New Std

Modified ipmi function return status code and
command completion codes as per new standard.

Tested:
verified using ipmitool commands.
1. create new user
Command : ipmitool user set name 5 user5
Response:                          //user created successfully
Command: ipmitool user set password 5 0penBmc\'  //set password
Response: Set User Password command successful (user 5)

2. Set password
Command :  ipmitool user set password 5 0penBmc\'
Response: Set User Password command successful (user 5)

3. set channel access
Command: ipmitool channel setaccess 1 5 callin=on ipmi=on link=on
            privilege=4
Response: Set User Access (channel 1 id 5) successful.

4. get channel access
Command:  ipmitool channel getaccess 1 5
Response:
Maximum User IDs     : 15
Enabled User IDs     : 5

User ID              : 5
User Name            : user5
Fixed Name           : No
Access Available     : call-in / callback
Link Authentication  : enabled
IPMI Messaging       : enabled
Privilege Level      : ADMINISTRATOR
Enable Status        : disabled

5. User list
Command: ipmitool user list 1
Response:
ID  Name             Callin  Link Auth  IPMI Msg   Channel Priv Limit
1   root             false   true       true       ADMINISTRATOR
2   putty_operator   true    true       true       OPERATOR
3   ipmi_admin       true    true       true       ADMINISTRATOR
4   user2            false   true       true       OPERATOR
5   user5            true    true       true       ADMINISTRATOR
6                    true    false      false      NO ACCESS
7                    true    false      false      NO ACCESS
8                    true    false      false      NO ACCESS
9                    true    false      false      NO ACCESS
10                   true    false      false      NO ACCESS
11                   true    false      false      NO ACCESS
12                   true    false      false      NO ACCESS
13                   true    false      false      NO ACCESS
14                   true    false      false      NO ACCESS
15                   true    false      false      NO ACCESS

Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Signed-off-by: NITIN SHARMA <nitin1x.sharma@intel.com>
Change-Id: I5f2c32f50edc2de204ac361364e21a61a4bcf237
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 3396d2d..34687d5 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -217,7 +217,7 @@
     uint8_t maxChUsers = 0, enabledUsers = 0, fixedUsers = 0;
     ipmi::Cc retStatus;
     retStatus = ipmiUserGetAllCounts(maxChUsers, enabledUsers, fixedUsers);
-    if (retStatus != IPMI_CC_OK)
+    if (retStatus != ccSuccess)
     {
         return ipmi::response(retStatus);
     }
@@ -225,7 +225,7 @@
     bool enabledState = false;
     retStatus =
         ipmiUserCheckEnabled(static_cast<uint8_t>(userId), enabledState);
-    if (retStatus != IPMI_CC_OK)
+    if (retStatus != ccSuccess)
     {
         return ipmi::response(retStatus);
     }
@@ -235,7 +235,7 @@
     PrivAccess privAccess{};
     retStatus = ipmiUserGetPrivilegeAccess(static_cast<uint8_t>(userId), chNum,
                                            privAccess);
-    if (retStatus != IPMI_CC_OK)
+    if (retStatus != ccSuccess)
     {
         return ipmi::response(retStatus);
     }
@@ -254,9 +254,9 @@
         static_cast<uint1_t>(privAccess.reserved));
 }
 
-ipmi_ret_t ipmiSetUserName(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                           ipmi_request_t request, ipmi_response_t response,
-                           ipmi_data_len_t dataLen, ipmi_context_t context)
+Cc ipmiSetUserName(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t request,
+                   ipmi_response_t response, ipmi_data_len_t dataLen,
+                   ipmi_context_t context)
 {
     const SetUserNameReq* req = static_cast<SetUserNameReq*>(request);
     size_t reqLength = *dataLen;
@@ -265,16 +265,16 @@
     if (reqLength != sizeof(*req))
     {
         log<level::DEBUG>("Set user name - Invalid Length");
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ccReqDataLenInvalid;
     }
     if (req->reserved1)
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
     if (!ipmiUserIsValidUserId(req->userId))
     {
         log<level::DEBUG>("Set user name - Invalid user id");
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ccParmOutOfRange;
     }
 
     return ipmiUserSetUserName(req->userId,
@@ -290,9 +290,9 @@
  *  @param[in] context - ipmi context.
  *  @returns ipmi completion code.
  */
-ipmi_ret_t ipmiGetUserName(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                           ipmi_request_t request, ipmi_response_t response,
-                           ipmi_data_len_t dataLen, ipmi_context_t context)
+Cc ipmiGetUserName(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t request,
+                   ipmi_response_t response, ipmi_data_len_t dataLen,
+                   ipmi_context_t context)
 {
     const GetUserNameReq* req = static_cast<GetUserNameReq*>(request);
     size_t reqLength = *dataLen;
@@ -302,15 +302,15 @@
     if (reqLength != sizeof(*req))
     {
         log<level::DEBUG>("Get user name - Invalid Length");
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ccReqDataLenInvalid;
     }
 
     std::string userName;
-    if (ipmiUserGetUserName(req->userId, userName) != IPMI_CC_OK)
+    if (ipmiUserGetUserName(req->userId, userName) != ccSuccess)
     { // Invalid User ID
         log<level::DEBUG>("User Name not found",
                           entry("USER-ID=%d", (uint8_t)req->userId));
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ccParmOutOfRange;
     }
     GetUserNameResp* resp = static_cast<GetUserNameResp*>(response);
     std::fill(reinterpret_cast<uint8_t*>(resp),
@@ -319,7 +319,7 @@
                   sizeof(resp->userName), 0);
     *dataLen = sizeof(*resp);
 
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
 /** @brief implementes the set user password command
@@ -331,9 +331,9 @@
  *  @param[in] context - ipmi context.
  *  @returns ipmi completion code.
  */
-ipmi_ret_t ipmiSetUserPassword(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                               ipmi_request_t request, ipmi_response_t response,
-                               ipmi_data_len_t dataLen, ipmi_context_t context)
+Cc ipmiSetUserPassword(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+                       ipmi_request_t request, ipmi_response_t response,
+                       ipmi_data_len_t dataLen, ipmi_context_t context)
 {
     const SetUserPasswordReq* req = static_cast<SetUserPasswordReq*>(request);
     size_t reqLength = *dataLen;
@@ -350,7 +350,7 @@
          ((reqLength < 2) || (reqLength > sizeof(SetUserPasswordReq)))))
     {
         log<level::DEBUG>("Invalid Length");
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ccReqDataLenInvalid;
     }
     // If set / test password then password length has to be 16 or 20 bytes
     // based on the password size bit.
@@ -361,15 +361,15 @@
           (passwordLength != maxIpmi15PasswordSize))))
     {
         log<level::DEBUG>("Invalid Length");
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ccReqDataLenInvalid;
     }
 
     std::string userName;
-    if (ipmiUserGetUserName(req->userId, userName) != IPMI_CC_OK)
+    if (ipmiUserGetUserName(req->userId, userName) != ccSuccess)
     {
         log<level::DEBUG>("User Name not found",
                           entry("USER-ID=%d", (uint8_t)req->userId));
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ccParmOutOfRange;
     }
     if (req->operation == setPassword)
     {
@@ -394,12 +394,12 @@
         {
             log<level::DEBUG>("Test password failed",
                               entry("USER-ID=%d", (uint8_t)req->userId));
-            return static_cast<ipmi_ret_t>(
+            return static_cast<Cc>(
                 IPMISetPasswordReturnCodes::ipmiCCPasswdFailMismatch);
         }
-        return IPMI_CC_OK;
+        return ccSuccess;
     }
-    return IPMI_CC_INVALID_FIELD_REQUEST;
+    return ccInvalidFieldRequest;
 }
 
 /** @brief implements the get channel authentication command
@@ -641,7 +641,7 @@
     PayloadAccess payloadAccess = {};
     retStatus = ipmiUserGetUserPayloadAccess(
         chNum, static_cast<uint8_t>(userId), payloadAccess);
-    if (retStatus != IPMI_CC_OK)
+    if (retStatus != ccSuccess)
     {
         return ipmi::response(retStatus);
     }