Remove old channel commands

New channel commands have been implemented in user_channel/channelcommands.cpp

This removes the old, unused command implementation

Change-Id: I054ea053d25865e0d4203f2ae294778d31817637
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/app/channel.cpp b/app/channel.cpp
index 085464b..6ea25c4 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -18,119 +18,6 @@
 using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
 
-/** @struct GetChannelAccessRequest
- *
- *  IPMI payload for Get Channel access command request.
- */
-struct GetChannelAccessRequest
-{
-    uint8_t channelNumber;   //!< Channel number.
-    uint8_t volatileSetting; //!< Get non-volatile or the volatile setting.
-} __attribute__((packed));
-
-/** @struct GetChannelAccessResponse
- *
- *  IPMI payload for Get Channel access command response.
- */
-struct GetChannelAccessResponse
-{
-    uint8_t settings;       //!< Channel settings.
-    uint8_t privilegeLimit; //!< Channel privilege level limit.
-} __attribute__((packed));
-
-ipmi_ret_t ipmi_get_channel_access(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                   ipmi_request_t request,
-                                   ipmi_response_t response,
-                                   ipmi_data_len_t data_len,
-                                   ipmi_context_t context)
-{
-    auto requestData =
-        reinterpret_cast<const GetChannelAccessRequest*>(request);
-    std::vector<uint8_t> outPayload(sizeof(GetChannelAccessResponse));
-    auto responseData =
-        reinterpret_cast<GetChannelAccessResponse*>(outPayload.data());
-
-    /*
-     * The value Eh is used as a way to identify the current channel that
-     * the command is being received from.
-     */
-    constexpr auto channelE = 0x0E;
-    int channel = requestData->channelNumber;
-    auto ethdevice = ipmi::getChannelName(channel);
-
-    if (channel != channelE && ethdevice.empty())
-    {
-        *data_len = 0;
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-
-    /*
-     * [7:6] - reserved
-     * [5]   - 1b = Alerting disabled
-     * [4]   - 1b = per message authentication disabled
-     * [3]   - 0b = User level authentication enabled
-     * [2:0] - 2h = always available
-     */
-    constexpr auto channelSetting = 0x32;
-
-    responseData->settings = channelSetting;
-    // Defaulting the channel privilege to administrator level.
-    responseData->privilegeLimit = PRIVILEGE_ADMIN;
-
-    *data_len = outPayload.size();
-    memcpy(response, outPayload.data(), *data_len);
-
-    return IPMI_CC_OK;
-}
-
-// ATTENTION: This ipmi function is very hardcoded on purpose
-// OpenBMC does not fully support IPMI.  This command is useful
-// to have around because it enables testing of interfaces with
-// the IPMI tool.
-#define GET_CHANNEL_INFO_CHANNEL_OFFSET 0
-// IPMI Table 6-2
-#define IPMI_CHANNEL_TYPE_IPMB 1
-// IPMI Table 6-3
-#define IPMI_CHANNEL_MEDIUM_TYPE_OTHER 6
-
-ipmi_ret_t ipmi_app_channel_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                 ipmi_request_t request,
-                                 ipmi_response_t response,
-                                 ipmi_data_len_t data_len,
-                                 ipmi_context_t context)
-{
-    ipmi_ret_t rc = IPMI_CC_OK;
-    auto* p = static_cast<uint8_t*>(request);
-    int channel = (*p) & CHANNEL_MASK;
-    std::string ethdevice = ipmi::getChannelName(channel);
-
-    // The supported channels numbers are those which are configured.
-    // Channel Number E is used as way to identify the current channel
-    // that the command is being is received from.
-    if (channel != 0xe && ethdevice.empty())
-    {
-        rc = IPMI_CC_PARM_OUT_OF_RANGE;
-        *data_len = 0;
-    }
-    else
-    {
-        uint8_t resp[] = {1,
-                          IPMI_CHANNEL_MEDIUM_TYPE_OTHER,
-                          IPMI_CHANNEL_TYPE_IPMB,
-                          1,
-                          0x41,
-                          0xA7,
-                          0x00,
-                          0,
-                          0};
-
-        *data_len = sizeof(resp);
-        memcpy(response, resp, *data_len);
-    }
-
-    return rc;
-}
-
 namespace cipher
 {
 
@@ -342,61 +229,3 @@
         }
     }
 }
-
-/** @struct SetChannelAccessRequest
- *
- *  IPMI payload for Set Channel access command request.
- */
-struct SetChannelAccessRequest
-{
-    uint8_t channelNumber; //!< Channel number
-    uint8_t accessMode;    //!< Access mode for IPMI messaging
-    uint8_t privLevel;     //!< Channel Privilege Level
-} __attribute__((packed));
-
-ipmi_ret_t ipmi_set_channel_access(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                                   ipmi_request_t request,
-                                   ipmi_response_t response,
-                                   ipmi_data_len_t data_len,
-                                   ipmi_context_t context)
-{
-    auto requestData =
-        reinterpret_cast<const SetChannelAccessRequest*>(request);
-
-    int channel = requestData->channelNumber;
-    // Validate the channel number corresponds to any of the network channel.
-    auto ethdevice = ipmi::getChannelName(channel);
-    if (ethdevice.empty())
-    {
-        *data_len = 0;
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-    // Bits[2:0] indicates the Access Mode, this mask field will extract the
-    // access mode from the command data.
-    static constexpr auto accessModeMask = 0x07;
-    auto accessMode = requestData->accessMode & accessModeMask;
-    static constexpr auto disabled = 0;
-    static constexpr auto enabled = 2;
-
-    try
-    {
-        if (accessMode == enabled)
-        {
-            enableNetworkIPMI(ethdevice);
-        }
-        else if (accessMode == disabled)
-        {
-            disableNetworkIPMI(ethdevice);
-        }
-    }
-    catch (const sdbusplus::exception::SdBusError& e)
-    {
-        log<level::ERR>(e.what());
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
-    }
-
-    return IPMI_CC_OK;
-}
diff --git a/apphandler.cpp b/apphandler.cpp
index 8875cd8..20104fe 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -1108,20 +1108,6 @@
     ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_ACPI, NULL,
                            ipmi_app_get_acpi_power_state, PRIVILEGE_ADMIN);
 
-// TODO: Below code and associated api's need to be removed later.
-// Its commented for now to avoid merge conflicts with upstream
-// changes and smooth upstream upgrades.
-#if 0
->>>>>>> IPMI Channel commands implementation
-    // <Get Channel Access>
-    ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHANNEL_ACCESS, NULL,
-                           ipmi_get_channel_access, PRIVILEGE_USER);
-
-    // <Get Channel Info Command>
-    ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHAN_INFO, NULL,
-                           ipmi_app_channel_info, PRIVILEGE_USER);
-#endif
-
     // <Get System GUID Command>
     ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_SYS_GUID, NULL,
                            ipmi_app_get_sys_guid, PRIVILEGE_USER);
@@ -1129,11 +1115,7 @@
     // <Get Channel Cipher Suites Command>
     ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHAN_CIPHER_SUITES, NULL,
                            getChannelCipherSuites, PRIVILEGE_CALLBACK);
-#if 0
-    // <Set Channel Access Command>
-    ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_CHAN_ACCESS, NULL,
-                           ipmi_set_channel_access, PRIVILEGE_ADMIN);
-#endif
+
     // <Get System Info Command>
     ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_SYSTEM_INFO, NULL,
                            ipmi_app_get_system_info, PRIVILEGE_USER);