From e08fbffcd9bd1976f7d26d48bf7a4c3e5843d4a8 Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Wed, 3 Apr 2019 09:19:34 -0700 Subject: Only include ipmid/api.hpp for the new API After some feedback from users of the new IPMI API, they wanted to see two things: 1) don't require ipmid/api.hpp and ipmid/registration.hpp to be able to write new handlers 2) only require including ipmid/api.hpp (instead of ipmid/api.h) So now, by simply including ipmid/api.hpp instead of ipmid/api.h (deprecated), handlers incorporating the new IPMI API can be written. Change-Id: I446dcce70cff03d4ecc28c658292d052485f77fc Signed-off-by: Vernon Mauery --- app/watchdog.cpp | 2 +- app/watchdog.hpp | 2 +- app/watchdog_service.cpp | 3 +- apphandler.cpp | 2 - chassishandler.cpp | 2 +- dcmihandler.cpp | 3 +- globalhandler.cpp | 3 +- groupext.cpp | 3 +- include/Makefile.am | 2 +- include/ipmid/api-types.hpp | 456 +++++++++++++++++++++++++++++++++++++++++ include/ipmid/api.hpp | 208 +------------------ include/ipmid/filter.hpp | 43 +++- include/ipmid/handler.hpp | 134 +++++++++++- include/ipmid/message.hpp | 1 + include/ipmid/registration.hpp | 442 --------------------------------------- ipmid-new.cpp | 1 - read_fru_data.cpp | 3 +- selutility.cpp | 3 +- sensordatahandler.hpp | 3 +- sensorhandler.cpp | 2 +- sensorhandler.hpp | 2 +- storageaddsel.cpp | 2 +- storagehandler.cpp | 2 +- systemintfcmds.cpp | 1 - transporthandler.cpp | 2 +- user_channel/channel_layer.hpp | 1 - user_channel/usercommands.cpp | 2 +- whitelist-filter.cpp | 1 - 28 files changed, 657 insertions(+), 674 deletions(-) create mode 100644 include/ipmid/api-types.hpp delete mode 100644 include/ipmid/registration.hpp diff --git a/app/watchdog.cpp b/app/watchdog.cpp index 68af65c..51ba395 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp @@ -3,9 +3,9 @@ #include "watchdog_service.hpp" #include -#include #include +#include #include #include #include diff --git a/app/watchdog.hpp b/app/watchdog.hpp index 767a776..32d6f16 100644 --- a/app/watchdog.hpp +++ b/app/watchdog.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include /** @brief The RESET watchdog IPMI command. * diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp index e65ea63..284964d 100644 --- a/app/watchdog_service.cpp +++ b/app/watchdog_service.cpp @@ -1,8 +1,7 @@ #include "watchdog_service.hpp" -#include - #include +#include #include #include #include diff --git a/apphandler.cpp b/apphandler.cpp index 1169e07..e1779bb 100644 --- a/apphandler.cpp +++ b/apphandler.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -15,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/chassishandler.cpp b/chassishandler.cpp index 7ac7b7d..ef760d5 100644 --- a/chassishandler.cpp +++ b/chassishandler.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/dcmihandler.cpp b/dcmihandler.cpp index cb14005..3188585 100644 --- a/dcmihandler.cpp +++ b/dcmihandler.cpp @@ -4,11 +4,10 @@ #include "user_channel/channel_layer.hpp" -#include - #include #include #include +#include #include #include #include diff --git a/globalhandler.cpp b/globalhandler.cpp index e268fd1..27409c2 100644 --- a/globalhandler.cpp +++ b/globalhandler.cpp @@ -1,7 +1,6 @@ #include "globalhandler.hpp" -#include - +#include #include #include #include diff --git a/groupext.cpp b/groupext.cpp index dbfade4..5b71dde 100644 --- a/groupext.cpp +++ b/groupext.cpp @@ -1,6 +1,5 @@ -#include - #include +#include #define GRPEXT_GET_GROUP_CMD 0 void register_netfn_groupext_functions() __attribute__((constructor)); diff --git a/include/Makefile.am b/include/Makefile.am index a3051dd..b7c303a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,12 +1,12 @@ nobase_include_HEADERS = \ ipmid/api.hpp \ + ipmid/api-types.hpp \ ipmid/filter.hpp \ ipmid/handler.hpp \ ipmid/message.hpp \ ipmid/message/pack.hpp \ ipmid/message/types.hpp \ ipmid/message/unpack.hpp \ - ipmid/registration.hpp \ ipmid/api.h \ ipmid/iana.hpp \ ipmid/oemopenbmc.hpp \ diff --git a/include/ipmid/api-types.hpp b/include/ipmid/api-types.hpp new file mode 100644 index 0000000..c718ff4 --- /dev/null +++ b/include/ipmid/api-types.hpp @@ -0,0 +1,456 @@ +/* + * Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#pragma once +#include +#include +#include +#include + +namespace ipmi +{ + +using Iana = oem::Number; + +using Group = uint8_t; +constexpr Group groupPICMG = 0x00; +constexpr Group groupDMTG = 0x01; +constexpr Group groupSSI = 0x02; +constexpr Group groupVSO = 0x03; +constexpr Group groupDCMI = 0xDC; + +/* + * Set the priority as the lowest number that is necessary so + * it is possible that others can override it if desired. + * This may be linked to what level of integration the handler + * is being created at. + */ +constexpr int prioOpenBmcBase = 10; +constexpr int prioOemBase = 20; +constexpr int prioOdmBase = 30; +constexpr int prioCustomBase = 40; +constexpr int prioMax = 50; + +/* + * Channel IDs pulled from the IPMI 2.0 specification + */ +constexpr int channelPrimaryIpmb = 0x00; +// 0x01-0x0B Implementation specific +// Implementation specific channel numbers are specified +// by a configuration file external to ipmid +// 0x0C-0x0D reserved +constexpr int channelCurrentIface = 0x0E; // 'Present I/F' +constexpr int channelSystemIface = 0x0F; + +/* + * Specifies the minimum privilege level required to execute the command + * This means the command can be executed at a given privilege level or higher + * privilege level. Those commands which can be executed via system interface + * only should use SYSTEM_INTERFACE + */ +enum class Privilege : uint8_t +{ + None = 0x00, + Callback, + User, + Operator, + Admin, + Oem, +}; + +// IPMI Net Function number as specified by IPMI V2.0 spec. +using NetFn = uint8_t; + +// IPMI Command for a Net Function number as specified by IPMI V2.0 spec. +using Cmd = uint8_t; + +// ipmi function return the status code +using Cc = uint8_t; + +// IPMI 2.0 and DCMI 1.5 standard commands, namespaced by NetFn +// OEM and non-standard commands should be defined where they are used +namespace app +{ +// 0x00 reserved +constexpr Cmd cmdGetDeviceId = 0x01; +constexpr Cmd cmdColdReset = 0x02; +constexpr Cmd cmdWarmReset = 0x03; +constexpr Cmd cmdGetSelfTestResults = 0x04; +constexpr Cmd cmdManufacturingTestOn = 0x05; +constexpr Cmd cmdSetAcpiPowerState = 0x06; +constexpr Cmd cmdGetAcpiPowerState = 0x07; +constexpr Cmd cmdGetDeviceGuid = 0x08; +constexpr Cmd cmdGetNetFnSupport = 0x09; +constexpr Cmd cmdGetCmdSupport = 0x0A; +constexpr Cmd cmdGetCmdSubFnSupport = 0x0B; +constexpr Cmd cmdGetConfigurableCmds = 0x0C; +constexpr Cmd cmdGetConfigurableCmdSubFns = 0x0D; +// 0x0E-0x21 unassigned +constexpr Cmd cmdResetWatchdogTimer = 0x22; +// 0x23 unassigned +constexpr Cmd cmdSetWatchdogTimer = 0x24; +constexpr Cmd cmdGetWatchdogTimer = 0x25; +// 0x26-0x2D unassigned +constexpr Cmd cmdSetBmcGlobalEnables = 0x2E; +constexpr Cmd cmdGetBmcGlobalEnables = 0x2F; +constexpr Cmd cmdClearMessageFlags = 0x30; +constexpr Cmd cmdGetMessageFlags = 0x31; +constexpr Cmd cmdEnableMessageChannelRcv = 0x32; +constexpr Cmd cmdGetMessage = 0x33; +constexpr Cmd cmdSendMessage = 0x34; +constexpr Cmd cmdReadEventMessageBuffer = 0x35; +constexpr Cmd cmdGetBtIfaceCapabilities = 0x36; +constexpr Cmd cmdGetSystemGuid = 0x37; +constexpr Cmd cmdGetChannelAuthCapabilities = 0x38; +constexpr Cmd cmdGetSessionChallenge = 0x39; +constexpr Cmd cmdActivateSession = 0x3A; +constexpr Cmd cmdSetSessionPrivilegeLevel = 0x3B; +constexpr Cmd cmdCloseSession = 0x3C; +constexpr Cmd cmdGetSessionInfo = 0x3D; +// 0x3E unassigned +constexpr Cmd cmdGetAuthCode = 0x3F; +constexpr Cmd cmdSetChannelAccess = 0x40; +constexpr Cmd cmdGetChannelAccess = 0x41; +constexpr Cmd cmdGetChannelInfoCommand = 0x42; +constexpr Cmd cmdSetUserAccessCommand = 0x43; +constexpr Cmd cmdGetUserAccessCommand = 0x44; +constexpr Cmd cmdSetUserName = 0x45; +constexpr Cmd cmdGetUserNameCommand = 0x46; +constexpr Cmd cmdSetUserPasswordCommand = 0x47; +constexpr Cmd cmdActivatePayload = 0x48; +constexpr Cmd cmdDeactivatePayload = 0x49; +constexpr Cmd cmdGetPayloadActivationStatus = 0x4A; +constexpr Cmd cmdGetPayloadInstanceInfo = 0x4B; +constexpr Cmd cmdSetUserPayloadAccess = 0x4C; +constexpr Cmd cmdGetUserPayloadAccess = 0x4D; +constexpr Cmd cmdGetChannelPayloadSupport = 0x4E; +constexpr Cmd cmdGetChannelPayloadVersion = 0x4F; +constexpr Cmd cmdGetChannelOemPayloadInfo = 0x50; +// 0x51 unassigned +constexpr Cmd cmdMasterWriteRead = 0x52; +// 0x53 unassigned +constexpr Cmd cmdGetChannelCipherSuites = 0x54; +constexpr Cmd cmdSuspendResumePayloadEnc = 0x55; +constexpr Cmd cmdSetChannelSecurityKeys = 0x56; +constexpr Cmd cmdGetSystemIfCapabilities = 0x57; +constexpr Cmd cmdSetSystemInfoParameters = 0x58; +constexpr Cmd cmdGetSystemInfoParameters = 0x59; +// 0x5A-0x5F unassigned +constexpr Cmd cmdSetCommandEnables = 0x60; +constexpr Cmd cmdGetCommandEnables = 0x61; +constexpr Cmd cmdSetCommandSubFnEnables = 0x62; +constexpr Cmd cmdGetCommandSubFnEnables = 0x63; +constexpr Cmd cmdGetOemNetFnIanaSupport = 0x64; +// 0x65-0xff unassigned +} // namespace app + +namespace chassis +{ +constexpr Cmd cmdGetChassisCapabilities = 0x00; +constexpr Cmd cmdGetChassisStatus = 0x01; +constexpr Cmd cmdChassisControl = 0x02; +constexpr Cmd cmdChassisReset = 0x03; +constexpr Cmd cmdChassisIdentify = 0x04; +constexpr Cmd cmdSetChassisCapabilities = 0x05; +constexpr Cmd cmdSetPowerRestorePolicy = 0x06; +constexpr Cmd cmdGetSystemRestartCause = 0x07; +constexpr Cmd cmdSetSystemBootOptions = 0x08; +constexpr Cmd cmdGetSystemBootOptions = 0x09; +constexpr Cmd cmdSetFrontPanelButtonEnables = 0x0A; +constexpr Cmd cmdSetPowerCycleInterval = 0x0B; +// 0x0C-0x0E unassigned +constexpr Cmd cmdGetPohCounter = 0x0F; +// 0x10-0xFF unassigned +} // namespace chassis + +namespace sensor_event +{ +constexpr Cmd cmdSetEventReceiver = 0x00; +constexpr Cmd cmdGetEventReceiver = 0x01; +constexpr Cmd cmdPlatformEvent = 0x02; +// 0x03-0x0F unassigned +constexpr Cmd cmdGetPefCapabilities = 0x10; +constexpr Cmd cmdArmPefPostponeTimer = 0x11; +constexpr Cmd cmdSetPefConfigurationParams = 0x12; +constexpr Cmd cmdGetPefConfigurationParams = 0x13; +constexpr Cmd cmdSetLastProcessedEventId = 0x14; +constexpr Cmd cmdGetLastProcessedEventId = 0x15; +constexpr Cmd cmdAlertImmediate = 0x16; +constexpr Cmd cmdPetAcknowledge = 0x17; +constexpr Cmd cmdGetDeviceSdrInfo = 0x20; +constexpr Cmd cmdGetDeviceSdr = 0x21; +constexpr Cmd cmdReserveDeviceSdrRepository = 0x22; +constexpr Cmd cmdGetSensorReadingFactors = 0x23; +constexpr Cmd cmdSetSensorHysteresis = 0x24; +constexpr Cmd cmdGetSensorHysteresis = 0x25; +constexpr Cmd cmdSetSensorThreshold = 0x26; +constexpr Cmd cmdGetSensorThreshold = 0x27; +constexpr Cmd cmdSetSensorEventEnable = 0x28; +constexpr Cmd cmdGetSensorEventEnable = 0x29; +constexpr Cmd cmdRearmSensorEvents = 0x2A; +constexpr Cmd cmdGetSensorEventStatus = 0x2B; +constexpr Cmd cmdGetSensorReading = 0x2D; +constexpr Cmd cmdSetSensorType = 0x2E; +constexpr Cmd cmdGetSensorType = 0x2F; +constexpr Cmd cmdSetSensorReadingAndEvtSts = 0x30; +// 0x31-0xFF unassigned +} // namespace sensor_event + +namespace storage +{ +// 0x00-0x0F unassigned +constexpr Cmd cmdGetFruInventoryAreaInfo = 0x10; +constexpr Cmd cmdReadFruData = 0x11; +constexpr Cmd cmdWriteFruData = 0x12; +// 0x13-0x1F unassigned +constexpr Cmd cmdGetSdrRepositoryInfo = 0x20; +constexpr Cmd cmdGetSdrRepositoryAllocInfo = 0x21; +constexpr Cmd cmdReserveSdrRepository = 0x22; +constexpr Cmd cmdGetSdr = 0x23; +constexpr Cmd cmdAddSdr = 0x24; +constexpr Cmd cmdPartialAddSdr = 0x25; +constexpr Cmd cmdDeleteSdr = 0x26; +constexpr Cmd cmdClearSdrRepository = 0x27; +constexpr Cmd cmdGetSdrRepositoryTime = 0x28; +constexpr Cmd cmdSetSdrRepositoryTime = 0x29; +constexpr Cmd cmdEnterSdrRepoUpdateMode = 0x2A; +constexpr Cmd cmdExitSdrReposUpdateMode = 0x2B; +constexpr Cmd cmdRunInitializationAgent = 0x2C; +// 0x2D-0x3F unassigned +constexpr Cmd cmdGetSelInfo = 0x40; +constexpr Cmd cmdGetSelAllocationInfo = 0x41; +constexpr Cmd cmdReserveSel = 0x42; +constexpr Cmd cmdGetSelEntry = 0x43; +constexpr Cmd cmdAddSelEntry = 0x44; +constexpr Cmd cmdPartialAddSelEntry = 0x45; +constexpr Cmd cmdDeleteSelEntry = 0x46; +constexpr Cmd cmdClearSel = 0x47; +constexpr Cmd cmdGetSelTime = 0x48; +constexpr Cmd cmdSetSelTime = 0x49; +constexpr Cmd cmdGetAuxiliaryLogStatus = 0x5A; +constexpr Cmd cmdSetAuxiliaryLogStatus = 0x5B; +constexpr Cmd cmdGetSelTimeUtcOffset = 0x5C; +constexpr Cmd cmdSetSelTimeUtcOffset = 0x5D; +// 0x5E-0xFF unassigned +} // namespace storage + +namespace transport +{ +constexpr Cmd cmdSetLanConfigParameters = 0x01; +constexpr Cmd cmdGetLanConfigParameters = 0x02; +constexpr Cmd cmdSuspendBmcArps = 0x03; +constexpr Cmd cmdGetIpUdpRmcpStatistics = 0x04; +constexpr Cmd cmdSetSerialModemConfig = 0x10; +constexpr Cmd cmdGetSerialModemConfig = 0x11; +constexpr Cmd cmdSetSerialModemMux = 0x12; +constexpr Cmd cmdGetTapResponseCodes = 0x13; +constexpr Cmd cmdSetPppUdpProxyTransmitData = 0x14; +constexpr Cmd cmdGetPppUdpProxyTransmitData = 0x15; +constexpr Cmd cmdSendPppUdpProxyPacket = 0x16; +constexpr Cmd cmdGetPppUdpProxyReceiveData = 0x17; +constexpr Cmd cmdSerialModemConnActive = 0x18; +constexpr Cmd cmdCallback = 0x19; +constexpr Cmd cmdSetUserCallbackOptions = 0x1A; +constexpr Cmd cmdGetUserCallbackOptions = 0x1B; +constexpr Cmd cmdSetSerialRoutingMux = 0x1C; +constexpr Cmd cmdSolActivating = 0x20; +constexpr Cmd cmdSetSolConfigParameters = 0x21; +constexpr Cmd cmdGetSolConfigParameters = 0x22; +constexpr Cmd cmdForwardedCommand = 0x30; +constexpr Cmd cmdSetForwardedCommands = 0x31; +constexpr Cmd cmdGetForwardedCommands = 0x32; +constexpr Cmd cmdEnableForwardedCommands = 0x33; +} // namespace transport + +namespace bridge +{ +constexpr Cmd cmdGetBridgeState = 0x00; +constexpr Cmd cmdSetBridgeState = 0x01; +constexpr Cmd cmdGetIcmbAddress = 0x02; +constexpr Cmd cmdSetIcmbAddress = 0x03; +constexpr Cmd cmdSetBridgeProxyAddress = 0x04; +constexpr Cmd cmdGetBridgeStatistics = 0x05; +constexpr Cmd cmdGetIcmbCapabilities = 0x06; +constexpr Cmd cmdClearBridgeStatistics = 0x08; +constexpr Cmd cmdGetBridgeProxyAddress = 0x09; +constexpr Cmd cmdGetIcmbConnectorInfo = 0x0A; +constexpr Cmd cmdGetIcmbConnectionId = 0x0B; +constexpr Cmd cmdSendIcmbConnectionId = 0x0C; +constexpr Cmd cmdPrepareForDiscovery = 0x10; +constexpr Cmd cmdGetAddresses = 0x11; +constexpr Cmd cmdSetDiscovered = 0x12; +constexpr Cmd cmdGetChassisDeviceId = 0x13; +constexpr Cmd cmdSetChassisDeviceId = 0x14; +constexpr Cmd cmdBridgeRequest = 0x20; +constexpr Cmd cmdBridgeMessage = 0x21; +// 0x22-0x2F unassigned +constexpr Cmd cmdGetEventCount = 0x30; +constexpr Cmd cmdSetEventDestination = 0x31; +constexpr Cmd cmdSetEventReceptionState = 0x32; +constexpr Cmd cmdSendIcmbEventMessage = 0x33; +constexpr Cmd cmdGetEventDestination = 0x34; +constexpr Cmd cmdGetEventReceptionState = 0x35; +// 0xC0-0xFE OEM Commands +constexpr Cmd cmdErrorReport = 0xFF; +} // namespace bridge + +namespace dcmi +{ +constexpr Cmd cmdGetDcmiCapabilitiesInfo = 0x01; +constexpr Cmd cmdGetPowerReading = 0x02; +constexpr Cmd cmdGetPowerLimit = 0x03; +constexpr Cmd cmdSetPowerLimit = 0x04; +constexpr Cmd cmdActDeactivatePwrLimit = 0x05; +constexpr Cmd cmdGetAssetTag = 0x06; +constexpr Cmd cmdGetDcmiSensorInfo = 0x07; +constexpr Cmd cmdSetAssetTag = 0x08; +constexpr Cmd cmdGetMgmtCntlrIdString = 0x09; +constexpr Cmd cmdSetMgmtCntlrIdString = 0x0A; +constexpr Cmd cmdSetThermalLimit = 0x0B; +constexpr Cmd cmdGetThermalLimit = 0x0C; +constexpr Cmd cmdGetTemperatureReadings = 0x10; +constexpr Cmd cmdSetDcmiConfigParameters = 0x12; +constexpr Cmd cmdGetDcmiConfigParameters = 0x13; +} // namespace dcmi + +// These are the command network functions, the response +// network functions are the function + 1. So to determine +// the proper network function which issued the command +// associated with a response, subtract 1. +// Note: these will be left shifted when combined with the LUN +constexpr NetFn netFnChassis = 0x00; +constexpr NetFn netFnBridge = 0x02; +constexpr NetFn netFnSensor = 0x04; +constexpr NetFn netFnApp = 0x06; +constexpr NetFn netFnFirmware = 0x08; +constexpr NetFn netFnStorage = 0x0A; +constexpr NetFn netFnTransport = 0x0C; +// reserved 0Eh..28h +constexpr NetFn netFnGroup = 0x2C; +constexpr NetFn netFnOem = 0x2E; +constexpr NetFn netFnOemOne = 0x30; +constexpr NetFn netFnOemTwo = 0x32; +constexpr NetFn netFnOemThree = 0x34; +constexpr NetFn netFnOemFour = 0x36; +constexpr NetFn netFnOemFive = 0x38; +constexpr NetFn netFnOemSix = 0x3A; +constexpr NetFn netFnOemSeven = 0x3C; +constexpr NetFn netFnOemEight = 0x3E; + +// IPMI commands for net functions. Callbacks using this should be careful to +// parse arguments to the sub-functions and can take advantage of the built-in +// message handling mechanism to create custom routing +constexpr Cmd cmdWildcard = 0xFF; + +// IPMI standard completion codes specified by the IPMI V2.0 spec. +// +// This might have been an enum class, but that would make it hard for +// OEM- and command-specific completion codes to be added elsewhere. +// +// Custom completion codes can be defined in individual modules for +// command specific errors in the 0x80-0xBE range +// +// Alternately, OEM completion codes are in the 0x01-0x7E range +constexpr Cc ccSuccess = 0x00; +constexpr Cc ccBusy = 0xC0; +constexpr Cc ccInvalidCommand = 0xC1; +constexpr Cc ccInvalidCommandOnLun = 0xC2; +constexpr Cc ccTimeout = 0xC2; +constexpr Cc ccOutOfSpace = 0xC2; +constexpr Cc ccInvalidReservationId = 0xC5; +constexpr Cc ccReqDataTruncated = 0xC6; +constexpr Cc ccReqDataLenInvalid = 0xC7; +constexpr Cc ccReqDataLenExceeded = 0xC8; +constexpr Cc ccParmOutOfRange = 0xC9; +constexpr Cc ccRetBytesUnavailable = 0xCA; +constexpr Cc ccSensorInvalid = 0xCB; +constexpr Cc ccInvalidFieldRequest = 0xCC; +constexpr Cc ccIllegalCommand = 0xCD; +constexpr Cc ccResponseError = 0xCE; +constexpr Cc ccDuplicateRequest = 0xCF; +constexpr Cc ccCmdFailSdrMode = 0xD0; +constexpr Cc ccCmdFailFwUpdMode = 0xD1; +constexpr Cc ccCmdFailInitAgent = 0xD2; +constexpr Cc ccDestinationUnavailable = 0xD3; +constexpr Cc ccInsufficientPrivilege = 0xD4; +constexpr Cc ccCommandNotAvailable = 0xD5; +constexpr Cc ccCommandDisabled = 0xD6; +constexpr Cc ccUnspecifiedError = 0xFF; + +/* ipmi often has two return types: + * 1. Failure: CC is non-zero; no trailing data + * 2. Success: CC is zero; trailing data (usually a fixed type) + * + * using ipmi::response(cc, ...), it will automatically always pack + * the correct type for the response without having to explicitly type out all + * the parameters that the function would return. + * + * To enable this feature, you just define the ipmi function as returning an + * ipmi::RspType which has the optional trailing data built in, with your types + * defined as parameters. + */ + +template +using RspType = std::tuple>>; + +/** + * @brief helper function to create an IPMI response tuple + * + * IPMI handlers all return a tuple with two parts: a completion code and an + * optional tuple containing the rest of the data to return. This helper + * function makes it easier by constructing that out of an arbitrary number of + * arguments. + * + * @param cc - the completion code for the response + * @param args... - the optional list of values to return + * + * @return a standard IPMI return type (as described above) + */ +template +static inline auto response(ipmi::Cc cc, Args&&... args) +{ + return std::make_tuple(cc, std::make_optional(std::make_tuple(args...))); +} +static inline auto response(ipmi::Cc cc) +{ + return std::make_tuple(cc, std::nullopt); +} + +/** + * @brief helper function to create an IPMI success response tuple + * + * IPMI handlers all return a tuple with two parts: a completion code and an + * optional tuple containing the rest of the data to return. This helper + * function makes it easier by constructing that out of an arbitrary number of + * arguments. Because it is a success response, this automatically packs + * the completion code, without needing to explicitly pass it in. + * + * @param args... - the optional list of values to return + * + * @return a standard IPMI return type (as described above) + */ +template +static inline auto responseSuccess(Args&&... args) +{ + return std::make_tuple(ipmi::ccSuccess, + std::make_optional(std::make_tuple(args...))); +} +static inline auto responseSuccess() +{ + return std::make_tuple(ipmi::ccSuccess, std::nullopt); +} + +} // namespace ipmi diff --git a/include/ipmid/api.hpp b/include/ipmid/api.hpp index b825796..f4cbf13 100644 --- a/include/ipmid/api.hpp +++ b/include/ipmid/api.hpp @@ -17,210 +17,18 @@ #pragma once #define ALLOW_DEPRECATED_API 1 - -#include +// make it possible to ONLY include api.hpp during the transition +#ifdef ALLOW_DEPRECATED_API +#include +#endif + +#include +#include +#include #include -#include #include #include -/* NOTE: - * - * This is intended for native C++ use. For the legacy C api, include - * ipmid-api.h for a reduced functionality. Note that the C api is now marked - * as deprecated and will be removed once all the internal users of it have - * been updated to use the new C++ api. - */ - -namespace ipmi -{ - -using Iana = oem::Number; - -using Group = uint8_t; -constexpr Group groupPICMG = 0x00; -constexpr Group groupDMTG = 0x01; -constexpr Group groupSSI = 0x02; -constexpr Group groupVSO = 0x03; -constexpr Group groupDCMI = 0xDC; - -/* - * Set the priority as the lowest number that is necessary so - * it is possible that others can override it if desired. - * This may be linked to what level of integration the handler - * is being created at. - */ -constexpr int prioOpenBmcBase = 10; -constexpr int prioOemBase = 20; -constexpr int prioOdmBase = 30; -constexpr int prioCustomBase = 40; -constexpr int prioMax = 50; - -/* - * Channel IDs pulled from the IPMI 2.0 specification - */ -constexpr int channelPrimaryIpmb = 0x00; -// 0x01-0x0B Implementation specific -// Implementation specific channel numbers are specified -// by a configuration file external to ipmid -// 0x0C-0x0D reserved -constexpr int channelCurrentIface = 0x0E; // 'Present I/F' -constexpr int channelSystemIface = 0x0F; - -/* - * Specifies the minimum privilege level required to execute the command - * This means the command can be executed at a given privilege level or higher - * privilege level. Those commands which can be executed via system interface - * only should use SYSTEM_INTERFACE - */ -enum class Privilege : uint8_t -{ - None = 0x00, - Callback, - User, - Operator, - Admin, - Oem, -}; - -// IPMI Net Function number as specified by IPMI V2.0 spec. -using NetFn = uint8_t; - -// IPMI Command for a Net Function number as specified by IPMI V2.0 spec. -using Cmd = uint8_t; - -// ipmi function return the status code -using Cc = uint8_t; - -// These are the command network functions, the response -// network functions are the function + 1. So to determine -// the proper network function which issued the command -// associated with a response, subtract 1. -// Note: these will be left shifted when combined with the LUN -constexpr NetFn netFnChassis = 0x00; -constexpr NetFn netFnBridge = 0x02; -constexpr NetFn netFnSensor = 0x04; -constexpr NetFn netFnApp = 0x06; -constexpr NetFn netFnFirmware = 0x08; -constexpr NetFn netFnStorage = 0x0A; -constexpr NetFn netFnTransport = 0x0C; -// reserved 0Eh..28h -constexpr NetFn netFnGroup = 0x2C; -constexpr NetFn netFnOem = 0x2E; -constexpr NetFn netFnOemOne = 0x30; -constexpr NetFn netFnOemTwo = 0x32; -constexpr NetFn netFnOemThree = 0x34; -constexpr NetFn netFnOemFour = 0x36; -constexpr NetFn netFnOemFive = 0x38; -constexpr NetFn netFnOemSix = 0x3A; -constexpr NetFn netFnOemSeven = 0x3C; -constexpr NetFn netFnOemEight = 0x3E; - -// IPMI commands for net functions. Callbacks using this should be careful to -// parse arguments to the sub-functions and can take advantage of the built-in -// message handling mechanism to create custom routing -constexpr Cmd cmdWildcard = 0xFF; - -// IPMI standard completion codes specified by the IPMI V2.0 spec. -// -// This might have been an enum class, but that would make it hard for -// OEM- and command-specific completion codes to be added elsewhere. -// -// Custom completion codes can be defined in individual modules for -// command specific errors in the 0x80-0xBE range -// -// Alternately, OEM completion codes are in the 0x01-0x7E range -constexpr Cc ccSuccess = 0x00; -constexpr Cc ccBusy = 0xC0; -constexpr Cc ccInvalidCommand = 0xC1; -constexpr Cc ccInvalidCommandOnLun = 0xC2; -constexpr Cc ccTimeout = 0xC2; -constexpr Cc ccOutOfSpace = 0xC2; -constexpr Cc ccInvalidReservationId = 0xC5; -constexpr Cc ccReqDataTruncated = 0xC6; -constexpr Cc ccReqDataLenInvalid = 0xC7; -constexpr Cc ccReqDataLenExceeded = 0xC8; -constexpr Cc ccParmOutOfRange = 0xC9; -constexpr Cc ccRetBytesUnavailable = 0xCA; -constexpr Cc ccSensorInvalid = 0xCB; -constexpr Cc ccInvalidFieldRequest = 0xCC; -constexpr Cc ccIllegalCommand = 0xCD; -constexpr Cc ccResponseError = 0xCE; -constexpr Cc ccDuplicateRequest = 0xCF; -constexpr Cc ccCmdFailSdrMode = 0xD0; -constexpr Cc ccCmdFailFwUpdMode = 0xD1; -constexpr Cc ccCmdFailInitAgent = 0xD2; -constexpr Cc ccDestinationUnavailable = 0xD3; -constexpr Cc ccInsufficientPrivilege = 0xD4; -constexpr Cc ccCommandNotAvailable = 0xD5; -constexpr Cc ccCommandDisabled = 0xD6; -constexpr Cc ccUnspecifiedError = 0xFF; - -/* ipmi often has two return types: - * 1. Failure: CC is non-zero; no trailing data - * 2. Success: CC is zero; trailing data (usually a fixed type) - * - * using ipmi::response(cc, ...), it will automatically always pack - * the correct type for the response without having to explicitly type out all - * the parameters that the function would return. - * - * To enable this feature, you just define the ipmi function as returning an - * ipmi::RspType which has the optional trailing data built in, with your types - * defined as parameters. - */ - -template -using RspType = std::tuple>>; - -/** - * @brief helper function to create an IPMI response tuple - * - * IPMI handlers all return a tuple with two parts: a completion code and an - * optional tuple containing the rest of the data to return. This helper - * function makes it easier by constructing that out of an arbitrary number of - * arguments. - * - * @param cc - the completion code for the response - * @param args... - the optional list of values to return - * - * @return a standard IPMI return type (as described above) - */ -template -static inline auto response(ipmi::Cc cc, Args&&... args) -{ - return std::make_tuple(cc, std::make_optional(std::make_tuple(args...))); -} -static inline auto response(ipmi::Cc cc) -{ - return std::make_tuple(cc, std::nullopt); -} - -/** - * @brief helper function to create an IPMI success response tuple - * - * IPMI handlers all return a tuple with two parts: a completion code and an - * optional tuple containing the rest of the data to return. This helper - * function makes it easier by constructing that out of an arbitrary number of - * arguments. Because it is a success response, this automatically packs - * the completion code, without needing to explicitly pass it in. - * - * @param args... - the optional list of values to return - * - * @return a standard IPMI return type (as described above) - */ -template -static inline auto responseSuccess(Args&&... args) -{ - return std::make_tuple(ipmi::ccSuccess, - std::make_optional(std::make_tuple(args...))); -} -static inline auto responseSuccess() -{ - return std::make_tuple(ipmi::ccSuccess, std::nullopt); -} - -} // namespace ipmi - // any client can interact with the main asio context std::shared_ptr getIoContext(); diff --git a/include/ipmid/filter.hpp b/include/ipmid/filter.hpp index 3cd5d21..950e3c3 100644 --- a/include/ipmid/filter.hpp +++ b/include/ipmid/filter.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -91,4 +91,45 @@ static inline auto makeFilter(const Filter& filter) return makeFilter(std::forward(lFilter)); } +namespace impl +{ + +// IPMI command filter registration implementation +void registerFilter(int prio, ::ipmi::FilterBase::ptr filter); + +} // namespace impl + +/** + * @brief IPMI command filter registration function + * + * This function should be used to register IPMI command filter functions. + * This function just passes the callback to makeFilter, which creates a + * wrapper functor object that ultimately calls the callback. + * + * Filters are called with a ipmi::message::Request shared_ptr on all IPMI + * commands in priority order and each filter has the opportunity to reject the + * command (by returning an IPMI error competion code.) If all the filters + * return success, the actual IPMI command will be executed. Filters can reject + * the command for any reason, based on system state, the context, the command + * payload, etc. + * + * @param prio - priority at which to register; see api.hpp + * @param filter - the callback function that will handle this request + * + * @return bool - success of registering the handler + */ +template +void registerFilter(int prio, Filter&& filter) +{ + auto f = ipmi::makeFilter(std::forward(filter)); + impl::registerFilter(prio, f); +} + +template +void registerFilter(int prio, const Filter& filter) +{ + auto f = ipmi::makeFilter(filter); + impl::registerFilter(prio, f); +} + } // namespace ipmi diff --git a/include/ipmid/handler.hpp b/include/ipmid/handler.hpp index 17beb42..1421c3d 100644 --- a/include/ipmid/handler.hpp +++ b/include/ipmid/handler.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -502,4 +502,136 @@ inline auto makeHandler(Handler&& handler) return ptr; } +namespace impl +{ + +// IPMI command handler registration implementation +bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, + ::ipmi::HandlerBase::ptr handler); +bool registerGroupHandler(int prio, Group group, Cmd cmd, Privilege priv, + ::ipmi::HandlerBase::ptr handler); +bool registerOemHandler(int prio, Iana iana, Cmd cmd, Privilege priv, + ::ipmi::HandlerBase::ptr handler); + +} // namespace impl + +/** + * @brief main IPMI handler registration function + * + * This function should be used to register all new-style IPMI handler + * functions. This function just passes the callback to makeHandler, which + * creates a new wrapper object that will automatically extract the appropriate + * parameters for the callback function as well as pack up the response. + * + * @param prio - priority at which to register; see api.hpp + * @param netFn - the IPMI net function number to register + * @param cmd - the IPMI command number to register + * @param priv - the IPMI user privilige required for this command + * @param handler - the callback function that will handle this request + * + * @return bool - success of registering the handler + */ +template +bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, + Handler&& handler) +{ + auto h = ipmi::makeHandler(std::forward(handler)); + return impl::registerHandler(prio, netFn, cmd, priv, h); +} + +/** + * @brief register a IPMI OEM group handler + * + * From IPMI 2.0 spec Network Function Codes Table (Row 2Ch): + * The first data byte position in requests and responses under this network + * function identifies the defining body that specifies command functionality. + * Software assumes that the command and completion code field positions will + * hold command and completion code values. + * + * The following values are used to identify the defining body: + * 00h PICMG - PCI Industrial Computer Manufacturer’s Group. (www.picmg.com) + * 01h DMTF Pre-OS Working Group ASF Specification (www.dmtf.org) + * 02h Server System Infrastructure (SSI) Forum (www.ssiforum.org) + * 03h VITA Standards Organization (VSO) (www.vita.com) + * DCh DCMI Specifications (www.intel.com/go/dcmi) + * all other Reserved + * + * When this network function is used, the ID for the defining body occupies + * the first data byte in a request, and the second data byte (following the + * completion code) in a response. + * + * @tparam Handler - implicitly specified callback function type + * @param prio - priority at which to register; see api.hpp + * @param netFn - the IPMI net function number to register + * @param cmd - the IPMI command number to register + * @param priv - the IPMI user privilige required for this command + * @param handler - the callback function that will handle this request + * + * @return bool - success of registering the handler + * + */ +template +void registerGroupHandler(int prio, Group group, Cmd cmd, Privilege priv, + Handler&& handler) +{ + auto h = ipmi::makeHandler(handler); + impl::registerGroupHandler(prio, group, cmd, priv, h); +} + +/** + * @brief register a IPMI OEM IANA handler + * + * From IPMI spec Network Function Codes Table (Row 2Eh): + * The first three data bytes of requests and responses under this network + * function explicitly identify the OEM or non-IPMI group that specifies the + * command functionality. While the OEM or non-IPMI group defines the + * functional semantics for the cmd and remaining data fields, the cmd field + * is required to hold the same value in requests and responses for a given + * operation in order to be supported under the IPMI message handling and + * transport mechanisms. + * + * When this network function is used, the IANA Enterprise Number for the + * defining body occupies the first three data bytes in a request, and the + * first three data bytes following the completion code position in a + * response. + * + * @tparam Handler - implicitly specified callback function type + * @param prio - priority at which to register; see api.hpp + * @param netFn - the IPMI net function number to register + * @param cmd - the IPMI command number to register + * @param priv - the IPMI user privilige required for this command + * @param handler - the callback function that will handle this request + * + * @return bool - success of registering the handler + * + */ +template +void registerOemHandler(int prio, Iana iana, Cmd cmd, Privilege priv, + Handler&& handler) +{ + auto h = ipmi::makeHandler(handler); + impl::registerOemHandler(prio, iana, cmd, priv, h); +} + } // namespace ipmi + +#ifdef ALLOW_DEPRECATED_API +/** + * @brief legacy IPMI handler registration function + * + * This function should be used to register all legacy IPMI handler + * functions. This function just behaves just as the legacy registration + * mechanism did, silently replacing any existing handler with a new one. + * + * @param netFn - the IPMI net function number to register + * @param cmd - the IPMI command number to register + * @param context - ignored + * @param handler - the callback function that will handle this request + * @param priv - the IPMI user privilige required for this command + */ +// [[deprecated("Use ipmi::registerHandler() instead")]] +void ipmi_register_callback(ipmi_netfn_t netFn, ipmi_cmd_t cmd, + ipmi_context_t context, ipmid_callback_t handler, + ipmi_cmd_privilege_t priv); + +#endif /* ALLOW_DEPRECATED_API */ diff --git a/include/ipmid/message.hpp b/include/ipmid/message.hpp index e628ff0..4079eab 100644 --- a/include/ipmid/message.hpp +++ b/include/ipmid/message.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/include/ipmid/registration.hpp b/include/ipmid/registration.hpp deleted file mode 100644 index 45391ec..0000000 --- a/include/ipmid/registration.hpp +++ /dev/null @@ -1,442 +0,0 @@ -/** - * Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include -#include -#include - -namespace ipmi -{ - -namespace impl -{ - -// IPMI command handler registration implementation -bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, - ::ipmi::HandlerBase::ptr handler); -bool registerGroupHandler(int prio, Group group, Cmd cmd, Privilege priv, - ::ipmi::HandlerBase::ptr handler); -bool registerOemHandler(int prio, Iana iana, Cmd cmd, Privilege priv, - ::ipmi::HandlerBase::ptr handler); - -// IPMI command filter registration implementation -void registerFilter(int prio, ::ipmi::FilterBase::ptr filter); - -} // namespace impl - -/** - * @brief main IPMI handler registration function - * - * This function should be used to register all new-style IPMI handler - * functions. This function just passes the callback to makeHandler, which - * creates a new wrapper object that will automatically extract the appropriate - * parameters for the callback function as well as pack up the response. - * - * @param prio - priority at which to register; see api.hpp - * @param netFn - the IPMI net function number to register - * @param cmd - the IPMI command number to register - * @param priv - the IPMI user privilige required for this command - * @param handler - the callback function that will handle this request - * - * @return bool - success of registering the handler - */ -template -bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, - Handler&& handler) -{ - auto h = ipmi::makeHandler(std::forward(handler)); - return impl::registerHandler(prio, netFn, cmd, priv, h); -} - -/** - * @brief register a IPMI OEM group handler - * - * From IPMI 2.0 spec Network Function Codes Table (Row 2Ch): - * The first data byte position in requests and responses under this network - * function identifies the defining body that specifies command functionality. - * Software assumes that the command and completion code field positions will - * hold command and completion code values. - * - * The following values are used to identify the defining body: - * 00h PICMG - PCI Industrial Computer Manufacturer’s Group. (www.picmg.com) - * 01h DMTF Pre-OS Working Group ASF Specification (www.dmtf.org) - * 02h Server System Infrastructure (SSI) Forum (www.ssiforum.org) - * 03h VITA Standards Organization (VSO) (www.vita.com) - * DCh DCMI Specifications (www.intel.com/go/dcmi) - * all other Reserved - * - * When this network function is used, the ID for the defining body occupies - * the first data byte in a request, and the second data byte (following the - * completion code) in a response. - * - * @tparam Handler - implicitly specified callback function type - * @param prio - priority at which to register; see api.hpp - * @param netFn - the IPMI net function number to register - * @param cmd - the IPMI command number to register - * @param priv - the IPMI user privilige required for this command - * @param handler - the callback function that will handle this request - * - * @return bool - success of registering the handler - * - */ -template -void registerGroupHandler(int prio, Group group, Cmd cmd, Privilege priv, - Handler&& handler) -{ - auto h = ipmi::makeHandler(handler); - impl::registerGroupHandler(prio, group, cmd, priv, h); -} - -/** - * @brief register a IPMI OEM IANA handler - * - * From IPMI spec Network Function Codes Table (Row 2Eh): - * The first three data bytes of requests and responses under this network - * function explicitly identify the OEM or non-IPMI group that specifies the - * command functionality. While the OEM or non-IPMI group defines the - * functional semantics for the cmd and remaining data fields, the cmd field - * is required to hold the same value in requests and responses for a given - * operation in order to be supported under the IPMI message handling and - * transport mechanisms. - * - * When this network function is used, the IANA Enterprise Number for the - * defining body occupies the first three data bytes in a request, and the - * first three data bytes following the completion code position in a - * response. - * - * @tparam Handler - implicitly specified callback function type - * @param prio - priority at which to register; see api.hpp - * @param netFn - the IPMI net function number to register - * @param cmd - the IPMI command number to register - * @param priv - the IPMI user privilige required for this command - * @param handler - the callback function that will handle this request - * - * @return bool - success of registering the handler - * - */ -template -void registerOemHandler(int prio, Iana iana, Cmd cmd, Privilege priv, - Handler&& handler) -{ - auto h = ipmi::makeHandler(handler); - impl::registerOemHandler(prio, iana, cmd, priv, h); -} - -/** - * @brief IPMI command filter registration function - * - * This function should be used to register IPMI command filter functions. - * This function just passes the callback to makeFilter, which creates a - * wrapper functor object that ultimately calls the callback. - * - * Filters are called with a ipmi::message::Request shared_ptr on all IPMI - * commands in priority order and each filter has the opportunity to reject the - * command (by returning an IPMI error competion code.) If all the filters - * return success, the actual IPMI command will be executed. Filters can reject - * the command for any reason, based on system state, the context, the command - * payload, etc. - * - * @param prio - priority at which to register; see api.hpp - * @param filter - the callback function that will handle this request - * - * @return bool - success of registering the handler - */ -template -void registerFilter(int prio, Filter&& filter) -{ - auto f = ipmi::makeFilter(std::forward(filter)); - impl::registerFilter(prio, f); -} - -template -void registerFilter(int prio, const Filter& filter) -{ - auto f = ipmi::makeFilter(filter); - impl::registerFilter(prio, f); -} -} // namespace ipmi - -#ifdef ALLOW_DEPRECATED_API -/** - * @brief legacy IPMI handler registration function - * - * This function should be used to register all legacy IPMI handler - * functions. This function just behaves just as the legacy registration - * mechanism did, silently replacing any existing handler with a new one. - * - * @param netFn - the IPMI net function number to register - * @param cmd - the IPMI command number to register - * @param context - ignored - * @param handler - the callback function that will handle this request - * @param priv - the IPMI user privilige required for this command - */ -// [[deprecated("Use ipmi::registerHandler() instead")]] -void ipmi_register_callback(ipmi_netfn_t netFn, ipmi_cmd_t cmd, - ipmi_context_t context, ipmid_callback_t handler, - ipmi_cmd_privilege_t priv); - -#endif /* ALLOW_DEPRECATED_API */ - -// IPMI 2.0 and DCMI 1.5 standard commands, namespaced by NetFn -// OEM and non-standard commands should be defined where they are used -namespace ipmi -{ -namespace app -{ -// 0x00 reserved -constexpr Cmd cmdGetDeviceId = 0x01; -constexpr Cmd cmdColdReset = 0x02; -constexpr Cmd cmdWarmReset = 0x03; -constexpr Cmd cmdGetSelfTestResults = 0x04; -constexpr Cmd cmdManufacturingTestOn = 0x05; -constexpr Cmd cmdSetAcpiPowerState = 0x06; -constexpr Cmd cmdGetAcpiPowerState = 0x07; -constexpr Cmd cmdGetDeviceGuid = 0x08; -constexpr Cmd cmdGetNetFnSupport = 0x09; -constexpr Cmd cmdGetCmdSupport = 0x0A; -constexpr Cmd cmdGetCmdSubFnSupport = 0x0B; -constexpr Cmd cmdGetConfigurableCmds = 0x0C; -constexpr Cmd cmdGetConfigurableCmdSubFns = 0x0D; -// 0x0E-0x21 unassigned -constexpr Cmd cmdResetWatchdogTimer = 0x22; -// 0x23 unassigned -constexpr Cmd cmdSetWatchdogTimer = 0x24; -constexpr Cmd cmdGetWatchdogTimer = 0x25; -// 0x26-0x2D unassigned -constexpr Cmd cmdSetBmcGlobalEnables = 0x2E; -constexpr Cmd cmdGetBmcGlobalEnables = 0x2F; -constexpr Cmd cmdClearMessageFlags = 0x30; -constexpr Cmd cmdGetMessageFlags = 0x31; -constexpr Cmd cmdEnableMessageChannelRcv = 0x32; -constexpr Cmd cmdGetMessage = 0x33; -constexpr Cmd cmdSendMessage = 0x34; -constexpr Cmd cmdReadEventMessageBuffer = 0x35; -constexpr Cmd cmdGetBtIfaceCapabilities = 0x36; -constexpr Cmd cmdGetSystemGuid = 0x37; -constexpr Cmd cmdGetChannelAuthCapabilities = 0x38; -constexpr Cmd cmdGetSessionChallenge = 0x39; -constexpr Cmd cmdActivateSession = 0x3A; -constexpr Cmd cmdSetSessionPrivilegeLevel = 0x3B; -constexpr Cmd cmdCloseSession = 0x3C; -constexpr Cmd cmdGetSessionInfo = 0x3D; -// 0x3E unassigned -constexpr Cmd cmdGetAuthCode = 0x3F; -constexpr Cmd cmdSetChannelAccess = 0x40; -constexpr Cmd cmdGetChannelAccess = 0x41; -constexpr Cmd cmdGetChannelInfoCommand = 0x42; -constexpr Cmd cmdSetUserAccessCommand = 0x43; -constexpr Cmd cmdGetUserAccessCommand = 0x44; -constexpr Cmd cmdSetUserName = 0x45; -constexpr Cmd cmdGetUserNameCommand = 0x46; -constexpr Cmd cmdSetUserPasswordCommand = 0x47; -constexpr Cmd cmdActivatePayload = 0x48; -constexpr Cmd cmdDeactivatePayload = 0x49; -constexpr Cmd cmdGetPayloadActivationStatus = 0x4A; -constexpr Cmd cmdGetPayloadInstanceInfo = 0x4B; -constexpr Cmd cmdSetUserPayloadAccess = 0x4C; -constexpr Cmd cmdGetUserPayloadAccess = 0x4D; -constexpr Cmd cmdGetChannelPayloadSupport = 0x4E; -constexpr Cmd cmdGetChannelPayloadVersion = 0x4F; -constexpr Cmd cmdGetChannelOemPayloadInfo = 0x50; -// 0x51 unassigned -constexpr Cmd cmdMasterWriteRead = 0x52; -// 0x53 unassigned -constexpr Cmd cmdGetChannelCipherSuites = 0x54; -constexpr Cmd cmdSuspendResumePayloadEnc = 0x55; -constexpr Cmd cmdSetChannelSecurityKeys = 0x56; -constexpr Cmd cmdGetSystemIfCapabilities = 0x57; -constexpr Cmd cmdSetSystemInfoParameters = 0x58; -constexpr Cmd cmdGetSystemInfoParameters = 0x59; -// 0x5A-0x5F unassigned -constexpr Cmd cmdSetCommandEnables = 0x60; -constexpr Cmd cmdGetCommandEnables = 0x61; -constexpr Cmd cmdSetCommandSubFnEnables = 0x62; -constexpr Cmd cmdGetCommandSubFnEnables = 0x63; -constexpr Cmd cmdGetOemNetFnIanaSupport = 0x64; -// 0x65-0xff unassigned -} // namespace app - -namespace chassis -{ -constexpr Cmd cmdGetChassisCapabilities = 0x00; -constexpr Cmd cmdGetChassisStatus = 0x01; -constexpr Cmd cmdChassisControl = 0x02; -constexpr Cmd cmdChassisReset = 0x03; -constexpr Cmd cmdChassisIdentify = 0x04; -constexpr Cmd cmdSetChassisCapabilities = 0x05; -constexpr Cmd cmdSetPowerRestorePolicy = 0x06; -constexpr Cmd cmdGetSystemRestartCause = 0x07; -constexpr Cmd cmdSetSystemBootOptions = 0x08; -constexpr Cmd cmdGetSystemBootOptions = 0x09; -constexpr Cmd cmdSetFrontPanelButtonEnables = 0x0A; -constexpr Cmd cmdSetPowerCycleInterval = 0x0B; -// 0x0C-0x0E unassigned -constexpr Cmd cmdGetPohCounter = 0x0F; -// 0x10-0xFF unassigned -} // namespace chassis - -namespace sensor_event -{ -constexpr Cmd cmdSetEventReceiver = 0x00; -constexpr Cmd cmdGetEventReceiver = 0x01; -constexpr Cmd cmdPlatformEvent = 0x02; -// 0x03-0x0F unassigned -constexpr Cmd cmdGetPefCapabilities = 0x10; -constexpr Cmd cmdArmPefPostponeTimer = 0x11; -constexpr Cmd cmdSetPefConfigurationParams = 0x12; -constexpr Cmd cmdGetPefConfigurationParams = 0x13; -constexpr Cmd cmdSetLastProcessedEventId = 0x14; -constexpr Cmd cmdGetLastProcessedEventId = 0x15; -constexpr Cmd cmdAlertImmediate = 0x16; -constexpr Cmd cmdPetAcknowledge = 0x17; -constexpr Cmd cmdGetDeviceSdrInfo = 0x20; -constexpr Cmd cmdGetDeviceSdr = 0x21; -constexpr Cmd cmdReserveDeviceSdrRepository = 0x22; -constexpr Cmd cmdGetSensorReadingFactors = 0x23; -constexpr Cmd cmdSetSensorHysteresis = 0x24; -constexpr Cmd cmdGetSensorHysteresis = 0x25; -constexpr Cmd cmdSetSensorThreshold = 0x26; -constexpr Cmd cmdGetSensorThreshold = 0x27; -constexpr Cmd cmdSetSensorEventEnable = 0x28; -constexpr Cmd cmdGetSensorEventEnable = 0x29; -constexpr Cmd cmdRearmSensorEvents = 0x2A; -constexpr Cmd cmdGetSensorEventStatus = 0x2B; -constexpr Cmd cmdGetSensorReading = 0x2D; -constexpr Cmd cmdSetSensorType = 0x2E; -constexpr Cmd cmdGetSensorType = 0x2F; -constexpr Cmd cmdSetSensorReadingAndEvtSts = 0x30; -// 0x31-0xFF unassigned -} // namespace sensor_event - -namespace storage -{ -// 0x00-0x0F unassigned -constexpr Cmd cmdGetFruInventoryAreaInfo = 0x10; -constexpr Cmd cmdReadFruData = 0x11; -constexpr Cmd cmdWriteFruData = 0x12; -// 0x13-0x1F unassigned -constexpr Cmd cmdGetSdrRepositoryInfo = 0x20; -constexpr Cmd cmdGetSdrRepositoryAllocInfo = 0x21; -constexpr Cmd cmdReserveSdrRepository = 0x22; -constexpr Cmd cmdGetSdr = 0x23; -constexpr Cmd cmdAddSdr = 0x24; -constexpr Cmd cmdPartialAddSdr = 0x25; -constexpr Cmd cmdDeleteSdr = 0x26; -constexpr Cmd cmdClearSdrRepository = 0x27; -constexpr Cmd cmdGetSdrRepositoryTime = 0x28; -constexpr Cmd cmdSetSdrRepositoryTime = 0x29; -constexpr Cmd cmdEnterSdrRepoUpdateMode = 0x2A; -constexpr Cmd cmdExitSdrReposUpdateMode = 0x2B; -constexpr Cmd cmdRunInitializationAgent = 0x2C; -// 0x2D-0x3F unassigned -constexpr Cmd cmdGetSelInfo = 0x40; -constexpr Cmd cmdGetSelAllocationInfo = 0x41; -constexpr Cmd cmdReserveSel = 0x42; -constexpr Cmd cmdGetSelEntry = 0x43; -constexpr Cmd cmdAddSelEntry = 0x44; -constexpr Cmd cmdPartialAddSelEntry = 0x45; -constexpr Cmd cmdDeleteSelEntry = 0x46; -constexpr Cmd cmdClearSel = 0x47; -constexpr Cmd cmdGetSelTime = 0x48; -constexpr Cmd cmdSetSelTime = 0x49; -constexpr Cmd cmdGetAuxiliaryLogStatus = 0x5A; -constexpr Cmd cmdSetAuxiliaryLogStatus = 0x5B; -constexpr Cmd cmdGetSelTimeUtcOffset = 0x5C; -constexpr Cmd cmdSetSelTimeUtcOffset = 0x5D; -// 0x5E-0xFF unassigned -} // namespace storage - -namespace transport -{ -constexpr Cmd cmdSetLanConfigParameters = 0x01; -constexpr Cmd cmdGetLanConfigParameters = 0x02; -constexpr Cmd cmdSuspendBmcArps = 0x03; -constexpr Cmd cmdGetIpUdpRmcpStatistics = 0x04; -constexpr Cmd cmdSetSerialModemConfig = 0x10; -constexpr Cmd cmdGetSerialModemConfig = 0x11; -constexpr Cmd cmdSetSerialModemMux = 0x12; -constexpr Cmd cmdGetTapResponseCodes = 0x13; -constexpr Cmd cmdSetPppUdpProxyTransmitData = 0x14; -constexpr Cmd cmdGetPppUdpProxyTransmitData = 0x15; -constexpr Cmd cmdSendPppUdpProxyPacket = 0x16; -constexpr Cmd cmdGetPppUdpProxyReceiveData = 0x17; -constexpr Cmd cmdSerialModemConnActive = 0x18; -constexpr Cmd cmdCallback = 0x19; -constexpr Cmd cmdSetUserCallbackOptions = 0x1A; -constexpr Cmd cmdGetUserCallbackOptions = 0x1B; -constexpr Cmd cmdSetSerialRoutingMux = 0x1C; -constexpr Cmd cmdSolActivating = 0x20; -constexpr Cmd cmdSetSolConfigParameters = 0x21; -constexpr Cmd cmdGetSolConfigParameters = 0x22; -constexpr Cmd cmdForwardedCommand = 0x30; -constexpr Cmd cmdSetForwardedCommands = 0x31; -constexpr Cmd cmdGetForwardedCommands = 0x32; -constexpr Cmd cmdEnableForwardedCommands = 0x33; -} // namespace transport - -namespace bridge -{ -constexpr Cmd cmdGetBridgeState = 0x00; -constexpr Cmd cmdSetBridgeState = 0x01; -constexpr Cmd cmdGetIcmbAddress = 0x02; -constexpr Cmd cmdSetIcmbAddress = 0x03; -constexpr Cmd cmdSetBridgeProxyAddress = 0x04; -constexpr Cmd cmdGetBridgeStatistics = 0x05; -constexpr Cmd cmdGetIcmbCapabilities = 0x06; -constexpr Cmd cmdClearBridgeStatistics = 0x08; -constexpr Cmd cmdGetBridgeProxyAddress = 0x09; -constexpr Cmd cmdGetIcmbConnectorInfo = 0x0A; -constexpr Cmd cmdGetIcmbConnectionId = 0x0B; -constexpr Cmd cmdSendIcmbConnectionId = 0x0C; -constexpr Cmd cmdPrepareForDiscovery = 0x10; -constexpr Cmd cmdGetAddresses = 0x11; -constexpr Cmd cmdSetDiscovered = 0x12; -constexpr Cmd cmdGetChassisDeviceId = 0x13; -constexpr Cmd cmdSetChassisDeviceId = 0x14; -constexpr Cmd cmdBridgeRequest = 0x20; -constexpr Cmd cmdBridgeMessage = 0x21; -// 0x22-0x2F unassigned -constexpr Cmd cmdGetEventCount = 0x30; -constexpr Cmd cmdSetEventDestination = 0x31; -constexpr Cmd cmdSetEventReceptionState = 0x32; -constexpr Cmd cmdSendIcmbEventMessage = 0x33; -constexpr Cmd cmdGetEventDestination = 0x34; -constexpr Cmd cmdGetEventReceptionState = 0x35; -// 0xC0-0xFE OEM Commands -constexpr Cmd cmdErrorReport = 0xFF; -} // namespace bridge - -namespace dcmi -{ -constexpr Cmd cmdGetDcmiCapabilitiesInfo = 0x01; -constexpr Cmd cmdGetPowerReading = 0x02; -constexpr Cmd cmdGetPowerLimit = 0x03; -constexpr Cmd cmdSetPowerLimit = 0x04; -constexpr Cmd cmdActDeactivatePwrLimit = 0x05; -constexpr Cmd cmdGetAssetTag = 0x06; -constexpr Cmd cmdGetDcmiSensorInfo = 0x07; -constexpr Cmd cmdSetAssetTag = 0x08; -constexpr Cmd cmdGetMgmtCntlrIdString = 0x09; -constexpr Cmd cmdSetMgmtCntlrIdString = 0x0A; -constexpr Cmd cmdSetThermalLimit = 0x0B; -constexpr Cmd cmdGetThermalLimit = 0x0C; -constexpr Cmd cmdGetTemperatureReadings = 0x10; -constexpr Cmd cmdSetDcmiConfigParameters = 0x12; -constexpr Cmd cmdGetDcmiConfigParameters = 0x13; -} // namespace dcmi - -} // namespace ipmi diff --git a/ipmid-new.cpp b/ipmid-new.cpp index 2668157..2a2d4a6 100644 --- a/ipmid-new.cpp +++ b/ipmid-new.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/read_fru_data.cpp b/read_fru_data.cpp index 17bcfe4..1f99e20 100644 --- a/read_fru_data.cpp +++ b/read_fru_data.cpp @@ -2,9 +2,8 @@ #include "fruread.hpp" -#include - #include +#include #include #include #include diff --git a/selutility.cpp b/selutility.cpp index 3aecb1c..97c2b2b 100644 --- a/selutility.cpp +++ b/selutility.cpp @@ -2,10 +2,9 @@ #include "selutility.hpp" -#include - #include #include +#include #include #include #include diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp index 8403a8d..6d80f9a 100644 --- a/sensordatahandler.hpp +++ b/sensordatahandler.hpp @@ -2,9 +2,8 @@ #include "sensorhandler.hpp" -#include - #include +#include #include #include #include diff --git a/sensorhandler.cpp b/sensorhandler.cpp index cf8feaa..48546af 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -2,13 +2,13 @@ #include "fruread.hpp" -#include #include #include #include #include #include +#include #include #include #include diff --git a/sensorhandler.hpp b/sensorhandler.hpp index 21d2317..954a3ed 100644 --- a/sensorhandler.hpp +++ b/sensorhandler.hpp @@ -1,8 +1,8 @@ #pragma once -#include #include +#include #include // IPMI commands for net functions. diff --git a/storageaddsel.cpp b/storageaddsel.cpp index 5adb673..6b53f87 100644 --- a/storageaddsel.cpp +++ b/storageaddsel.cpp @@ -3,7 +3,6 @@ #include "sensorhandler.hpp" #include "storagehandler.hpp" -#include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/storagehandler.cpp b/storagehandler.cpp index 55e17f2..18f1357 100644 --- a/storagehandler.cpp +++ b/storagehandler.cpp @@ -7,7 +7,6 @@ #include "storageaddsel.hpp" #include -#include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp index aeded06..d298abd 100644 --- a/systemintfcmds.cpp +++ b/systemintfcmds.cpp @@ -8,7 +8,6 @@ #include #include #include -#include void register_netfn_app_functions() __attribute__((constructor)); diff --git a/transporthandler.cpp b/transporthandler.cpp index ba0772b..59d933a 100644 --- a/transporthandler.cpp +++ b/transporthandler.cpp @@ -4,11 +4,11 @@ #include "user_channel/channel_layer.hpp" #include -#include #include #include #include +#include #include #include #include diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp index b86d6bf..94570fb 100644 --- a/user_channel/channel_layer.hpp +++ b/user_channel/channel_layer.hpp @@ -16,7 +16,6 @@ #pragma once #include -#include #include #include diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp index d0ea29f..76def4b 100644 --- a/user_channel/usercommands.cpp +++ b/user_channel/usercommands.cpp @@ -20,9 +20,9 @@ #include "channel_layer.hpp" #include "user_layer.hpp" -#include #include +#include #include #include diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp index 1d486ca..a24ccad 100644 --- a/whitelist-filter.cpp +++ b/whitelist-filter.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.1