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/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index 759de43..116521d 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -404,40 +404,38 @@
     return channelData[chNum].maxTransferSize;
 }
 
-ipmi_ret_t ChannelConfig::getChannelInfo(const uint8_t chNum,
-                                         ChannelInfo& chInfo)
+Cc ChannelConfig::getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     std::copy_n(reinterpret_cast<uint8_t*>(&channelData[chNum].chInfo),
                 sizeof(channelData[chNum].chInfo),
                 reinterpret_cast<uint8_t*>(&chInfo));
-
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
-ipmi_ret_t ChannelConfig::getChannelAccessData(const uint8_t chNum,
-                                               ChannelAccess& chAccessData)
+Cc ChannelConfig::getChannelAccessData(const uint8_t chNum,
+                                       ChannelAccess& chAccessData)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
     {
         log<level::DEBUG>("Session-less channel doesn't have access data.");
-        return IPMI_CC_ACTION_NOT_SUPPORTED_FOR_CHANNEL;
+        return ccActionNotSupportedForChannel;
     }
 
     if (checkAndReloadVolatileData() != 0)
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ccUnspecifiedError;
     }
 
     std::copy_n(
@@ -445,24 +443,23 @@
         sizeof(channelData[chNum].chAccess.chVolatileData),
         reinterpret_cast<uint8_t*>(&chAccessData));
 
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
-ipmi_ret_t
-    ChannelConfig::setChannelAccessData(const uint8_t chNum,
-                                        const ChannelAccess& chAccessData,
-                                        const uint8_t setFlag)
+Cc ChannelConfig::setChannelAccessData(const uint8_t chNum,
+                                       const ChannelAccess& chAccessData,
+                                       const uint8_t setFlag)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
     {
         log<level::DEBUG>("Session-less channel doesn't have access data.");
-        return IPMI_CC_ACTION_NOT_SUPPORTED_FOR_CHANNEL;
+        return ccActionNotSupportedForChannel;
     }
 
     if (((setFlag & setAccessMode) &&
@@ -471,7 +468,7 @@
          (!isValidPrivLimit(chAccessData.privLimit))))
     {
         log<level::DEBUG>("Invalid access mode / privilege limit specified");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     boost::interprocess::scoped_lock<boost::interprocess::named_recursive_mutex>
@@ -479,7 +476,7 @@
 
     if (checkAndReloadVolatileData() != 0)
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ccUnspecifiedError;
     }
 
     if (setFlag & setAccessMode)
@@ -512,30 +509,29 @@
     if (writeChannelVolatileData() != 0)
     {
         log<level::DEBUG>("Failed to update the channel volatile data");
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ccUnspecifiedError;
     }
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
-ipmi_ret_t
-    ChannelConfig::getChannelAccessPersistData(const uint8_t chNum,
-                                               ChannelAccess& chAccessData)
+Cc ChannelConfig::getChannelAccessPersistData(const uint8_t chNum,
+                                              ChannelAccess& chAccessData)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
     {
         log<level::DEBUG>("Session-less channel doesn't have access data.");
-        return IPMI_CC_ACTION_NOT_SUPPORTED_FOR_CHANNEL;
+        return ccActionNotSupportedForChannel;
     }
 
     if (checkAndReloadNVData() != 0)
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ccUnspecifiedError;
     }
 
     std::copy_n(reinterpret_cast<uint8_t*>(
@@ -543,23 +539,23 @@
                 sizeof(channelData[chNum].chAccess.chNonVolatileData),
                 reinterpret_cast<uint8_t*>(&chAccessData));
 
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
-ipmi_ret_t ChannelConfig::setChannelAccessPersistData(
-    const uint8_t chNum, const ChannelAccess& chAccessData,
-    const uint8_t setFlag)
+Cc ChannelConfig::setChannelAccessPersistData(const uint8_t chNum,
+                                              const ChannelAccess& chAccessData,
+                                              const uint8_t setFlag)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
     {
         log<level::DEBUG>("Session-less channel doesn't have access data.");
-        return IPMI_CC_ACTION_NOT_SUPPORTED_FOR_CHANNEL;
+        return ccActionNotSupportedForChannel;
     }
 
     if (((setFlag & setAccessMode) &&
@@ -568,7 +564,7 @@
          (!isValidPrivLimit(chAccessData.privLimit))))
     {
         log<level::DEBUG>("Invalid access mode / privilege limit specified");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     boost::interprocess::scoped_lock<boost::interprocess::named_recursive_mutex>
@@ -576,7 +572,7 @@
 
     if (checkAndReloadNVData() != 0)
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ccUnspecifiedError;
     }
 
     if (setFlag & setAccessMode)
@@ -614,13 +610,13 @@
                 log<level::DEBUG>(
                     "Network interface does not exist",
                     entry("INTERFACE=%s", channelData[chNum].chName.c_str()));
-                return IPMI_CC_UNSPECIFIED_ERROR;
+                return ccUnspecifiedError;
             }
         }
         catch (const sdbusplus::exception::SdBusError& e)
         {
             log<level::ERR>("Exception: Network interface does not exist");
-            return IPMI_CC_INVALID_FIELD_REQUEST;
+            return ccInvalidFieldRequest;
         }
         signalFlag |= (1 << chNum);
         channelData[chNum].chAccess.chNonVolatileData.privLimit =
@@ -631,51 +627,50 @@
     if (writeChannelPersistData() != 0)
     {
         log<level::DEBUG>("Failed to update the presist data file");
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ccUnspecifiedError;
     }
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
-ipmi_ret_t
-    ChannelConfig::getChannelAuthTypeSupported(const uint8_t chNum,
-                                               uint8_t& authTypeSupported)
+Cc ChannelConfig::getChannelAuthTypeSupported(const uint8_t chNum,
+                                              uint8_t& authTypeSupported)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     authTypeSupported = channelData[chNum].chInfo.authTypeSupported;
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
-ipmi_ret_t ChannelConfig::getChannelEnabledAuthType(const uint8_t chNum,
-                                                    const uint8_t priv,
-                                                    EAuthType& authType)
+Cc ChannelConfig::getChannelEnabledAuthType(const uint8_t chNum,
+                                            const uint8_t priv,
+                                            EAuthType& authType)
 {
     if (!isValidChannel(chNum))
     {
         log<level::DEBUG>("Invalid channel");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
     {
         log<level::DEBUG>("Sessionless channel doesn't have access data.");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     if (!isValidPrivLimit(priv))
     {
         log<level::DEBUG>("Invalid privilege specified.");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ccInvalidFieldRequest;
     }
 
     // TODO: Hardcoded for now. Need to implement.
     authType = EAuthType::none;
 
-    return IPMI_CC_OK;
+    return ccSuccess;
 }
 
 std::time_t ChannelConfig::getUpdatedFileTime(const std::string& fileName)