remove IPMI_CC

Since IPMI_CC declared in api.h has been gradually deprecated,
this submission will use ipmi::cc in api.hpp instead.

Change-Id: If605247d9e2453b9b13d307f53da3b6143af0259
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index a4f797b..eeca7de 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -103,7 +103,7 @@
     LedProperty* ledProp = mtm.findLedProperty(signal);
     if (ledProp == nullptr)
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::ccInvalidFieldRequest;
     }
 
     std::string ledName = ledProp->getName();
@@ -115,7 +115,7 @@
         if (mtm.getProperty(ledService, ledPath.c_str(), ledIntf, "State",
                             &presentState) != 0)
         {
-            return IPMI_CC_UNSPECIFIED_ERROR;
+            return ipmi::ccUnspecifiedError;
         }
         ledProp->setPrevState(std::get<std::string>(presentState));
         ledProp->setLock(true);
@@ -128,9 +128,9 @@
     if (mtm.setProperty(ledService, ledPath, ledIntf, "State",
                         ledStateStr + setState) != 0)
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::ccUnspecifiedError;
     }
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 ipmi_ret_t ledRevert(SmSignalSet signal)
@@ -138,7 +138,7 @@
     LedProperty* ledProp = mtm.findLedProperty(signal);
     if (ledProp == nullptr)
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::ccInvalidFieldRequest;
     }
     if (true == ledProp->getLock())
     {
@@ -154,7 +154,7 @@
             }
             catch (const sdbusplus::exception_t& e)
             {
-                return IPMI_CC_UNSPECIFIED_ERROR;
+                return ipmi::ccUnspecifiedError;
             }
             mtm.revertLedCallback = false;
         }
@@ -165,11 +165,11 @@
             if (mtm.setProperty(ledService, ledPath, ledIntf, "State",
                                 ledProp->getPrevState()) != 0)
             {
-                return IPMI_CC_UNSPECIFIED_ERROR;
+                return ipmi::ccUnspecifiedError;
             }
         }
     }
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 void Manufacturing::initData()
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 8ae0680..2e81bd4 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -325,7 +325,7 @@
     if (*dataLen != 0) // invalid request if there are extra parameters
     {
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
     if (getChassisSerialNumber(*dbus, serial) == 0)
@@ -334,10 +334,10 @@
                                   // as it is checked in getChassisSerialNumber
         char* resp = static_cast<char*>(response);
         serial.copy(resp, *dataLen);
-        return IPMI_CC_OK;
+        return ipmi::ccSuccess;
     }
     *dataLen = 0;
-    return IPMI_CC_RESPONSE_ERROR;
+    return ipmi::ccResponseError;
 }
 
 ipmi_ret_t ipmiOEMSetSystemGUID(ipmi_netfn_t, ipmi_cmd_t,
@@ -351,7 +351,7 @@
     if (*dataLen != sizeof(GUIDData)) // 16bytes
     {
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     *dataLen = 0;
@@ -371,7 +371,7 @@
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
     std::string service = getService(*dbus, intf, objpath);
     setDbusProperty(*dbus, service, objpath, intf, "UUID", guid);
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 ipmi::RspType<> ipmiOEMDisableBMCSystemReset(bool disableResetOnSMI,
@@ -440,7 +440,7 @@
     if ((*dataLen < 2ul) || (*dataLen != (1ul + data->biosIDLength)))
     {
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
     std::string idString((char*)data->biosId, data->biosIDLength);
     for (auto idChar : idString)
@@ -449,7 +449,7 @@
         {
             phosphor::logging::log<phosphor::logging::level::ERR>(
                 "BIOS ID contains non printable character");
-            return IPMI_CC_INVALID_FIELD_REQUEST;
+            return ipmi::ccInvalidFieldRequest;
         }
     }
 
@@ -461,7 +461,7 @@
     *bytesWritten =
         data->biosIDLength; // how many bytes are written into storage
     *dataLen = 1;
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 bool getActiveHSCSoftwareVersionInfo(std::string& hscVersion, size_t hscNumber)
@@ -691,7 +691,7 @@
     if (*dataLen != 0)
     {
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     *dataLen = 1;
@@ -700,7 +700,7 @@
     // AIC is available so that BIOS will not timeout repeatly which leads to
     // slow booting.
     *res = 0; // Byte1=Count of SlotPosition/FruID records.
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 ipmi_ret_t ipmiOEMGetPowerRestoreDelay(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
@@ -713,7 +713,7 @@
     if (*dataLen != 0)
     {
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
@@ -731,7 +731,7 @@
 
     *dataLen = sizeof(GetPowerRestoreDelayRes);
 
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 static uint8_t bcdToDec(uint8_t val)
@@ -894,7 +894,7 @@
     if (*dataLen != sizeof(SetPowerRestoreDelayReq))
     {
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
     delay = data->byteMSB;
     delay = (delay << 8) | data->byteLSB;
@@ -906,7 +906,7 @@
                     powerRestoreDelayIntf, powerRestoreDelayProp, val);
     *dataLen = 0;
 
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 static bool cpuPresent(const std::string& cpuName)
@@ -1078,7 +1078,7 @@
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "oem_get_shutdown_policy: invalid input len!");
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     *dataLen = 0;
@@ -1112,7 +1112,7 @@
                 "oem_set_shutdown_policy: invalid property!",
                 phosphor::logging::entry(
                     "PROP=%s", std::get<std::string>(variant).c_str()));
-            return IPMI_CC_UNSPECIFIED_ERROR;
+            return ipmi::ccUnspecifiedError;
         }
         // TODO needs to check if it is multi-node products,
         // policy is only supported on node 3/4
@@ -1121,11 +1121,11 @@
     catch (const sdbusplus::exception_t& e)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(e.description());
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::ccUnspecifiedError;
     }
 
     *dataLen = sizeof(GetOEMShutdownPolicyRes);
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 ipmi_ret_t ipmiOEMSetShutdownPolicy(ipmi_netfn_t, ipmi_cmd_t,
@@ -1144,7 +1144,7 @@
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "oem_set_shutdown_policy: invalid input len!");
         *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     *dataLen = 0;
@@ -1152,7 +1152,7 @@
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "oem_set_shutdown_policy: invalid input!");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::ccInvalidFieldRequest;
     }
 
     if (*req == noShutdownOnOCOT)
@@ -1179,10 +1179,10 @@
     catch (const sdbusplus::exception_t& e)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(e.description());
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::ccUnspecifiedError;
     }
 
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 /** @brief implementation for check the DHCP or not in IPv4
@@ -1565,7 +1565,7 @@
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "CfgHostSerial: invalid input len!",
             phosphor::logging::entry("LEN=%d", *dataLen));
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     switch (req->command)
@@ -1577,7 +1577,7 @@
                 phosphor::logging::log<phosphor::logging::level::ERR>(
                     "CfgHostSerial: invalid input len!");
                 *dataLen = 0;
-                return IPMI_CC_REQ_DATA_LEN_INVALID;
+                return ipmi::ccReqDataLenInvalid;
             }
 
             *dataLen = 0;
@@ -1608,7 +1608,7 @@
                 {
                     phosphor::logging::log<phosphor::logging::level::ERR>(
                         "CfgHostSerial:: error on read env");
-                    return IPMI_CC_UNSPECIFIED_ERROR;
+                    return ipmi::ccUnspecifiedError;
                 }
                 try
                 {
@@ -1624,14 +1624,14 @@
                     phosphor::logging::log<phosphor::logging::level::ERR>(
                         "invalid config ",
                         phosphor::logging::entry("ERR=%s", e.what()));
-                    return IPMI_CC_UNSPECIFIED_ERROR;
+                    return ipmi::ccUnspecifiedError;
                 }
                 catch (const std::out_of_range& e)
                 {
                     phosphor::logging::log<phosphor::logging::level::ERR>(
                         "out_of_range config ",
                         phosphor::logging::entry("ERR=%s", e.what()));
-                    return IPMI_CC_UNSPECIFIED_ERROR;
+                    return ipmi::ccUnspecifiedError;
                 }
             }
 
@@ -1645,7 +1645,7 @@
                 phosphor::logging::log<phosphor::logging::level::ERR>(
                     "CfgHostSerial: invalid input len!");
                 *dataLen = 0;
-                return IPMI_CC_REQ_DATA_LEN_INVALID;
+                return ipmi::ccReqDataLenInvalid;
             }
 
             *dataLen = 0;
@@ -1654,7 +1654,7 @@
             {
                 phosphor::logging::log<phosphor::logging::level::ERR>(
                     "CfgHostSerial: invalid input!");
-                return IPMI_CC_INVALID_FIELD_REQUEST;
+                return ipmi::ccInvalidFieldRequest;
             }
 
             boost::process::child c1(fwSetEnvCmd, fwHostSerailCfgEnvName,
@@ -1666,7 +1666,7 @@
                 phosphor::logging::log<phosphor::logging::level::ERR>(
                     "CfgHostSerial:: error on execute",
                     phosphor::logging::entry("EXECUTE=%s", fwGetEnvCmd));
-                return IPMI_CC_UNSPECIFIED_ERROR;
+                return ipmi::ccUnspecifiedError;
             }
             break;
         }
@@ -1674,10 +1674,10 @@
             phosphor::logging::log<phosphor::logging::level::ERR>(
                 "CfgHostSerial: invalid input!");
             *dataLen = 0;
-            return IPMI_CC_INVALID_FIELD_REQUEST;
+            return ipmi::ccInvalidFieldRequest;
     }
 
-    return IPMI_CC_OK;
+    return ipmi::ccSuccess;
 }
 
 constexpr const char* thermalModeInterface =
@@ -2249,7 +2249,7 @@
         {
             phosphor::logging::log<phosphor::logging::level::ERR>(
                 "ipmiOEMGetFscParameter: invalid input len!");
-            return IPMI_CC_REQ_DATA_LEN_INVALID;
+            return ipmi::ccReqDataLenInvalid;
         }
         */
         Value cfmLimit;
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 8ca7fd5..a72ffe8 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -253,7 +253,7 @@
     auto deviceFind = deviceHashes.find(devId);
     if (deviceFind == deviceHashes.end())
     {
-        return IPMI_CC_SENSOR_INVALID;
+        return ipmi::ccSensorInvalid;
     }
 
     if (writeTimer->isRunning())