diff options
-rw-r--r-- | user_channel/channel_layer.hpp | 50 | ||||
-rw-r--r-- | user_channel/channel_mgmt.hpp | 10 | ||||
-rw-r--r-- | user_channel/channelcommands.cpp | 20 | ||||
-rw-r--r-- | user_channel/channelcommands.hpp | 4 | ||||
-rw-r--r-- | user_channel/user_layer.hpp | 8 | ||||
-rw-r--r-- | user_channel/user_mgmt.hpp | 15 | ||||
-rw-r--r-- | user_channel/usercommands.cpp | 28 | ||||
-rw-r--r-- | user_channel/usercommands.hpp | 8 |
8 files changed, 132 insertions, 11 deletions
diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp index 3a9b5f5..60badbc 100644 --- a/user_channel/channel_layer.hpp +++ b/user_channel/channel_layer.hpp @@ -24,14 +24,19 @@ namespace ipmi static constexpr uint8_t maxIpmiChannels = 16; static constexpr uint8_t selfChNum = 0xE; -// IPMI return codes specific to channel +/** + * @enum IPMI return codes specific to channel (refer spec se 22.22 response + * data) + */ enum ipmi_channel_return_codes { IPMI_CC_ACTION_NOT_SUPPORTED_FOR_CHANNEL = 0x82, IPMI_CC_ACCESS_MODE_NOT_SUPPORTED_FOR_CHANEL = 0x83 }; -// IPMI Spec: Channel Protocol Type +/** + * @enum Channel Protocol Type (refer spec sec 6.4) + */ enum class EChannelProtocolType : uint8_t { na = 0x00, @@ -47,7 +52,9 @@ enum class EChannelProtocolType : uint8_t oem = 0x1C, }; -// IPMI Spec: Channel Medium Type +/** + * @enum Channel Medium Type (refer spec sec 6.5) + */ enum class EChannelMediumType : uint8_t { reserved = 0x00, @@ -67,7 +74,10 @@ enum class EChannelMediumType : uint8_t unknown = 0x82, }; -// IPMI Spec: Channel Session Type +/** + * @enum Channel Session Type (refer spec sec 22.24 - + * response data byte 5) + */ enum class EChannelSessSupported : uint8_t { none = 0, @@ -76,7 +86,9 @@ enum class EChannelSessSupported : uint8_t any = 3, }; -// IPMI Spec: Channel Access Mode +/** + * @enum Channel Access Mode (refer spec sec 6.6) + */ enum class EChannelAccessMode : uint8_t { disabled = 0, @@ -85,7 +97,10 @@ enum class EChannelAccessMode : uint8_t shared = 3, }; -// IPMI Spec 2.0 : Authentication Types +/** + * @enum Authentication Types (refer spec sec 13.6 - IPMI + * Session Header) + */ enum class EAuthType : uint8_t { none = (1 << 0x0), @@ -96,7 +111,10 @@ enum class EAuthType : uint8_t oem = (1 << 0x5), }; -// IPMI Spec: Access mode for channel access set/get +/** + * @enum Access mode for channel access set/get (refer spec + * sec 22.22 - request byte 2[7:6]) + */ typedef enum { doNotSet = 0x00, @@ -105,6 +123,10 @@ typedef enum reserved = 0x03, } EChannelActionType; +/** + * @enum Access set flag to determine changes that has to be updated + * in channel access data configuration. + */ enum AccessSetFlag { setAccessMode = (1 << 0), @@ -114,7 +136,12 @@ enum AccessSetFlag setPrivLimit = (1 << 4), }; -// Struct to store channel access data +/** @struct ChannelAccess + * + * Structure to store channel access related information, defined in IPMI + * specification and used in Get / Set channel access (refer spec sec 22.22 + * & 22.23) + */ struct ChannelAccess { uint8_t accessMode; @@ -124,7 +151,12 @@ struct ChannelAccess uint8_t privLimit; }; -// Struct store channel info data +/** @struct ChannelInfo + * + * Structure to store data about channel information, which identifies each + * channel type and information as defined in IPMI specification. (refer spec + * sec 22.22 & 22.23) + */ struct ChannelInfo { uint8_t mediumType; diff --git a/user_channel/channel_mgmt.hpp b/user_channel/channel_mgmt.hpp index 09d2a71..8cdb9c7 100644 --- a/user_channel/channel_mgmt.hpp +++ b/user_channel/channel_mgmt.hpp @@ -38,12 +38,22 @@ static constexpr const char* ipmiChannelMutex = "ipmi_channel_mutex"; static constexpr const char* ipmiChMutexCleanupLockFile = "/var/lib/ipmi/ipmi_channel_mutex_cleanup"; +/** @struct ChannelAccessData + * + * Structure to store both non-volatile and volatile channel access information + * as used by IPMI specification (refer spec sec 22.22 to 22.24) + */ struct ChannelAccessData { ChannelAccess chNonVolatileData; ChannelAccess chVolatileData; }; +/** @struct ChannelData + * + * Structure for channel information - base structure to get all information + * about the channel.(refer spec sec 22.22 to 22.24) + */ struct ChannelData { std::string chName; diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp index c5ef8b7..865d764 100644 --- a/user_channel/channelcommands.cpp +++ b/user_channel/channelcommands.cpp @@ -27,6 +27,10 @@ using namespace phosphor::logging; namespace ipmi { +/** @struct setChannelAccessReq + * + * Structure for set channel access request command (refer spec sec 22.22) + */ struct setChannelAccessReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -56,6 +60,10 @@ struct setChannelAccessReq } __attribute__((packed)); +/** @struct getChannelAccessReq + * + * Structure for get channel access request command (refer spec sec 22.23) + */ struct getChannelAccessReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -72,6 +80,10 @@ struct getChannelAccessReq #endif } __attribute__((packed)); +/** @struct getChannelAccessResp + * + * Structure for get channel access response command (refer spec sec 22.23) + */ struct getChannelAccessResp { #if BYTE_ORDER == LITTLE_ENDIAN @@ -94,6 +106,10 @@ struct getChannelAccessResp #endif } __attribute__((packed)); +/** @struct getChannelInfoReq + * + * Structure for get channel info request command (refer spec sec 22.24) + */ struct getChannelInfoReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -106,6 +122,10 @@ struct getChannelInfoReq #endif } __attribute__((packed)); +/** @struct getChannelInfoResp + * + * Structure for get channel info response command (refer spec sec 22.24) + */ struct getChannelInfoResp { #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/user_channel/channelcommands.hpp b/user_channel/channelcommands.hpp index 84d2dcb..c612d3f 100644 --- a/user_channel/channelcommands.hpp +++ b/user_channel/channelcommands.hpp @@ -20,7 +20,9 @@ namespace ipmi { -// IPMI commands for channel command NETFN:APP. +/** + * @enum IPMI commands for channel command NETFN:APP + */ enum ipmi_netfn_channel_cmds { IPMI_CMD_SET_CHANNEL_ACCESS = 0x40, diff --git a/user_channel/user_layer.hpp b/user_channel/user_layer.hpp index 956c925..ce985df 100644 --- a/user_channel/user_layer.hpp +++ b/user_channel/user_layer.hpp @@ -22,6 +22,9 @@ namespace ipmi { // TODO: Has to be replaced with proper channel number assignment logic +/** + * @enum Channel Id + */ enum class EChannelID : uint8_t { chanLan1 = 0x01 @@ -33,6 +36,11 @@ static constexpr uint8_t ipmiMaxUserName = 16; static constexpr uint8_t ipmiMaxUsers = 15; static constexpr uint8_t ipmiMaxChannels = 16; +/** @struct PrivAccess + * + * User privilege related access data as per IPMI specification.(refer spec + * sec 22.26) + */ struct PrivAccess { #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/user_channel/user_mgmt.hpp b/user_channel/user_mgmt.hpp index a54486f..0326dca 100644 --- a/user_channel/user_mgmt.hpp +++ b/user_channel/user_mgmt.hpp @@ -37,6 +37,9 @@ using DbusUserObjProperties = using DbusUserObjValue = std::map<std::string, DbusUserObjProperties>; +/** + * @enum User update events. + */ enum class UserUpdateEvent { reservedEvent, @@ -48,6 +51,10 @@ enum class UserUpdateEvent userStateUpdated }; +/** @struct UserPrivAccess + * + * Structure for user privilege access (refer spec sec 22.22) + */ struct UserPrivAccess { uint8_t privilege; @@ -56,6 +63,10 @@ struct UserPrivAccess bool accessCallback; }; +/** @struct UserInfo + * + * Structure for user related information + */ struct UserInfo { uint8_t userName[ipmiMaxUserName]; @@ -65,6 +76,10 @@ struct UserInfo bool fixedUserName; }; +/** @struct UsersTbl + * + * Structure for array of user related information + */ struct UsersTbl { //+1 to map with UserId directly. UserId 0 is reserved. diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp index f81c093..b0997d5 100644 --- a/user_channel/usercommands.cpp +++ b/user_channel/usercommands.cpp @@ -37,6 +37,10 @@ static constexpr uint8_t enableUser = 0x01; static constexpr uint8_t setPassword = 0x02; static constexpr uint8_t testPassword = 0x03; +/** @struct SetUserAccessReq + * + * Structure for set user access request command (refer spec sec 22.26) + */ struct SetUserAccessReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -68,6 +72,10 @@ struct SetUserAccessReq } __attribute__((packed)); +/** @struct GetUserAccessReq + * + * Structure for get user access request command (refer spec sec 22.27) + */ struct GetUserAccessReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -84,6 +92,10 @@ struct GetUserAccessReq #endif } __attribute__((packed)); +/** @struct GetUserAccessResp + * + * Structure for get user access response command (refer spec sec 22.27) + */ struct GetUserAccessResp { #if BYTE_ORDER == LITTLE_ENDIAN @@ -105,6 +117,10 @@ struct GetUserAccessResp PrivAccess privAccess; } __attribute__((packed)); +/** @struct SetUserNameReq + * + * Structure for set user name request command (refer spec sec 22.28) + */ struct SetUserNameReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -118,6 +134,10 @@ struct SetUserNameReq uint8_t userName[16]; } __attribute__((packed)); +/** @struct GetUserNameReq + * + * Structure for get user name request command (refer spec sec 22.29) + */ struct GetUserNameReq { #if BYTE_ORDER == LITTLE_ENDIAN @@ -130,11 +150,19 @@ struct GetUserNameReq #endif } __attribute__((packed)); +/** @struct GetUserNameResp + * + * Structure for get user name response command (refer spec sec 22.29) + */ struct GetUserNameResp { uint8_t userName[16]; } __attribute__((packed)); +/** @struct SetUserPasswordReq + * + * Structure for set user password request command (refer spec sec 22.30) + */ struct SetUserPasswordReq { #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/user_channel/usercommands.hpp b/user_channel/usercommands.hpp index afbe67a..ea04a26 100644 --- a/user_channel/usercommands.hpp +++ b/user_channel/usercommands.hpp @@ -19,7 +19,10 @@ namespace ipmi { -// IPMI commands for user command NETFN:APP. + +/** + * @enum IPMI commands for user command NETFN:APP. + */ enum ipmi_netfn_user_cmds { IPMI_CMD_SET_USER_ACCESS = 0x43, @@ -29,6 +32,9 @@ enum ipmi_netfn_user_cmds IPMI_CMD_SET_USER_PASSWORD = 0x47, }; +/** + * @enum IPMI set password return codes (refer spec sec 22.30) + */ enum class IPMISetPasswordReturnCodes { ipmiCCPasswdFailMismatch = 0x80, |