diff options
-rw-r--r-- | user_channel/channel_layer.cpp | 5 | ||||
-rw-r--r-- | user_channel/channel_layer.hpp | 11 | ||||
-rw-r--r-- | user_channel/channel_mgmt.cpp | 2 | ||||
-rw-r--r-- | user_channel/channel_mgmt.hpp | 16 |
4 files changed, 24 insertions, 10 deletions
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp index ae23f3f..d173208 100644 --- a/user_channel/channel_layer.cpp +++ b/user_channel/channel_layer.cpp @@ -59,6 +59,11 @@ bool isValidChannel(const uint8_t chNum) return getChannelConfigObject().isValidChannel(chNum); } +uint8_t convertCurrentChannelNum(const uint8_t chNum) +{ + return getChannelConfigObject().convertToChannelIndexNumber(chNum); +} + bool isValidAuthType(const uint8_t chNum, const EAuthType& authType) { return getChannelConfigObject().isValidAuthType(chNum, authType); diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp index 60badbc..abaa0bf 100644 --- a/user_channel/channel_layer.hpp +++ b/user_channel/channel_layer.hpp @@ -22,7 +22,7 @@ namespace ipmi { static constexpr uint8_t maxIpmiChannels = 16; -static constexpr uint8_t selfChNum = 0xE; +static constexpr uint8_t currentChNum = 0xE; /** * @enum IPMI return codes specific to channel (refer spec se 22.22 response @@ -250,6 +250,15 @@ ipmi_ret_t getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo); ipmi_ret_t getChannelAccessData(const uint8_t chNum, ChannelAccess& chAccessData); +/** @brief provides function to convert current channel number (0xE) + * + * @param[in] chNum - channel number as requested in commands. + * + * @return same channel number or proper channel number for current channel + * number (0xE). + */ +uint8_t convertCurrentChannelNum(const uint8_t chNum); + /** @brief to set channel access data * * @param[in] chNum - channel number diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp index 3a9e2cf..0ece27e 100644 --- a/user_channel/channel_mgmt.cpp +++ b/user_channel/channel_mgmt.cpp @@ -827,7 +827,7 @@ uint8_t ChannelConfig::convertToChannelIndexNumber(const uint8_t chNum) } } } - return ((chNum == selfChNum) ? curChannel : chNum); + return ((chNum == currentChNum) ? curChannel : chNum); } std::string ChannelConfig::convertToNetInterface(const std::string& value) diff --git a/user_channel/channel_mgmt.hpp b/user_channel/channel_mgmt.hpp index 8cdb9c7..d696075 100644 --- a/user_channel/channel_mgmt.hpp +++ b/user_channel/channel_mgmt.hpp @@ -195,6 +195,14 @@ class ChannelConfig */ CommandPrivilege convertToPrivLimitIndex(const std::string& value); + /** @brief function to convert channel number to channel index + * + * @param[in] chNum - channel number + * + * @return channel index + */ + uint8_t convertToChannelIndexNumber(const uint8_t chNum); + /** @brief function to write persistent channel configuration to config file * * @return 0 for success, -errno for failure. @@ -380,14 +388,6 @@ class ChannelConfig */ EChannelProtocolType convertToProtocolTypeIndex(const std::string& value); - /** @brief function to convert channel number to channel index - * - * @param[in] chNum - channel number - * - * @return channel index - */ - uint8_t convertToChannelIndexNumber(const uint8_t chNum); - /** @brief function to convert channel name to network interface name * * @param[in] value - channel interface name - ipmi centric |