netipmid: apply clang-format rules
Lots of whitespace change. Let clang-format do its job and keep the code
looking nice.
Change-Id: Idfcad1a99cab8170d55a06163de8ad3f420b68b7
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index fbb7242..1ad1472 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -1,26 +1,27 @@
#include "channel_auth.hpp"
-#include <iostream>
-
#include <host-ipmid/ipmid-api.h>
+#include <iostream>
+
namespace command
{
-std::vector<uint8_t> GetChannelCapabilities(
- const std::vector<uint8_t>& inPayload, const message::Handler& handler)
+std::vector<uint8_t>
+ GetChannelCapabilities(const std::vector<uint8_t>& inPayload,
+ const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(GetChannelCapabilitiesResp));
- auto response = reinterpret_cast<GetChannelCapabilitiesResp*>
- (outPayload.data());
+ auto response =
+ reinterpret_cast<GetChannelCapabilitiesResp*>(outPayload.data());
// A canned response, since there is no user and channel management.
- response->completionCode = IPMI_CC_OK ;
+ response->completionCode = IPMI_CC_OK;
// Channel Number 1 is arbitrarily applied to primary LAN channel;
response->channelNumber = 1;
- response->ipmiVersion = 1 ; //IPMI v2.0 extended capabilities available.
+ response->ipmiVersion = 1; // IPMI v2.0 extended capabilities available.
response->reserved1 = 0;
response->oem = 0;
response->straightKey = 0;
@@ -28,17 +29,16 @@
response->md5 = 0;
response->md2 = 0;
-
response->reserved3 = 0;
- response->KGStatus = 0; //KG is set to default
- response->perMessageAuth = 0; //Per-message Authentication is enabled
- response->userAuth = 0; //User Level Authentication is enabled
- response->nonNullUsers = 1; //Non-null usernames enabled
- response->nullUsers = 1; //Null usernames enabled
- response->anonymousLogin = 0; //Anonymous Login disabled
+ response->KGStatus = 0; // KG is set to default
+ response->perMessageAuth = 0; // Per-message Authentication is enabled
+ response->userAuth = 0; // User Level Authentication is enabled
+ response->nonNullUsers = 1; // Non-null usernames enabled
+ response->nullUsers = 1; // Null usernames enabled
+ response->anonymousLogin = 0; // Anonymous Login disabled
response->reserved4 = 0;
- response->extCapabilities = 0x2; //Channel supports IPMI v2.0 connections
+ response->extCapabilities = 0x2; // Channel supports IPMI v2.0 connections
response->oemID[0] = 0;
response->oemID[1] = 0;
diff --git a/command/channel_auth.hpp b/command/channel_auth.hpp
index 9d96ac0..aea1dc8 100644
--- a/command/channel_auth.hpp
+++ b/command/channel_auth.hpp
@@ -1,9 +1,9 @@
#pragma once
-#include <vector>
-
#include "message_handler.hpp"
+#include <vector>
+
namespace command
{
@@ -25,9 +25,9 @@
*/
struct GetChannelCapabilitiesResp
{
- uint8_t completionCode; // Completion Code
+ uint8_t completionCode; // Completion Code
- uint8_t channelNumber; // Channel number that the request was
+ uint8_t channelNumber; // Channel number that the request was
// received on
#if BYTE_ORDER == LITTLE_ENDIAN
@@ -35,21 +35,21 @@
uint8_t md2 : 1;
uint8_t md5 : 1;
uint8_t reserved2 : 1;
- uint8_t straightKey : 1; // Straight password/key support
+ uint8_t straightKey : 1; // Straight password/key support
// Support OEM identified by the IANA OEM ID in RMCP+ ping response
uint8_t oem : 1;
uint8_t reserved1 : 1;
- uint8_t ipmiVersion : 1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0
+ uint8_t ipmiVersion : 1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0
// support
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t ipmiVersion : 1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0
+ uint8_t ipmiVersion : 1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0
// support
uint8_t reserved1 : 1;
// Support OEM identified by the IANA OEM ID in RMCP+ ping response
uint8_t oem : 1;
- uint8_t straightKey : 1; // Straight password/key support
+ uint8_t straightKey : 1; // Straight password/key support
uint8_t reserved2 : 1;
uint8_t md5 : 1;
uint8_t md2 : 1;
@@ -97,8 +97,8 @@
#endif
// Below 4 bytes will all the 0's if no OEM authentication type available.
- uint8_t oemID[3]; // IANA enterprise number for OEM/organization
- uint8_t oemAuxillary; // Addition OEM specific information..
+ uint8_t oemID[3]; // IANA enterprise number for OEM/organization
+ uint8_t oemAuxillary; // Addition OEM specific information..
} __attribute__((packed));
/**
@@ -118,7 +118,8 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t> GetChannelCapabilities(
- const std::vector<uint8_t>& inPayload, const message::Handler& handler);
+std::vector<uint8_t>
+ GetChannelCapabilities(const std::vector<uint8_t>& inPayload,
+ const message::Handler& handler);
} // namespace command
diff --git a/command/guid.cpp b/command/guid.cpp
index 0943846..67b71e2 100644
--- a/command/guid.cpp
+++ b/command/guid.cpp
@@ -1,12 +1,12 @@
#include "guid.hpp"
+#include <host-ipmid/ipmid-api.h>
+#include <mapper.h>
+
#include <iostream>
#include <sstream>
#include <string>
-#include <host-ipmid/ipmid-api.h>
-#include <mapper.h>
-
namespace cache
{
@@ -26,8 +26,8 @@
{
// Canned System GUID for QEMU where the Chassis DBUS object is not
// populated
- Guid guid = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10 };
+ Guid guid = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10};
constexpr auto chassisIntf = "org.openbmc.control.Chassis";
@@ -43,8 +43,8 @@
rc = mapper_get_service(bus, guidObjPath, &busname);
if (rc < 0)
{
- std::cerr << "Failed to get " << guidObjPath << " bus name: "
- << strerror(-rc) << "\n";
+ std::cerr << "Failed to get " << guidObjPath
+ << " bus name: " << strerror(-rc) << "\n";
break;
}
@@ -66,15 +66,14 @@
std::string readUUID(uuid);
auto len = readUUID.length();
- for (size_t iter = 0, inc = 0;
- iter < len && inc < BMC_GUID_LEN; iter += 2, inc++)
+ for (size_t iter = 0, inc = 0; iter < len && inc < BMC_GUID_LEN;
+ iter += 2, inc++)
{
- uint8_t hexVal = std::strtoul(readUUID.substr(iter, 2).c_str(),
- NULL, 16);
+ uint8_t hexVal =
+ std::strtoul(readUUID.substr(iter, 2).c_str(), NULL, 16);
guid[inc] = hexVal;
}
- }
- while (0);
+ } while (0);
sd_bus_error_free(&error);
reply = sd_bus_message_unref(reply);
@@ -85,18 +84,18 @@
void registerGUIDChangeCallback()
{
- if(matchPtr == nullptr)
+ if (matchPtr == nullptr)
{
using namespace sdbusplus::bus::match::rules;
sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
matchPtr = std::make_unique<sdbusplus::bus::match_t>(
bus,
- path_namespace(guidObjPath) +
- type::signal() +
- member("PropertiesChanged") +
- interface(propInterface),
- [](sdbusplus::message::message&){cache::guid = getSystemGUID();});
+ path_namespace(guidObjPath) + type::signal() +
+ member("PropertiesChanged") + interface(propInterface),
+ [](sdbusplus::message::message&) {
+ cache::guid = getSystemGUID();
+ });
}
}
diff --git a/command/guid.hpp b/command/guid.hpp
index 5941ef8..f73e449 100644
--- a/command/guid.hpp
+++ b/command/guid.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include <cstddef>
-#include <vector>
-#include <sdbusplus/bus/match.hpp>
#include "comm_module.hpp"
+#include <cstddef>
+#include <sdbusplus/bus/match.hpp>
+#include <vector>
+
namespace command
{
@@ -32,4 +33,4 @@
extern command::Guid guid;
-} //namespace cache
+} // namespace cache
diff --git a/command/open_session.cpp b/command/open_session.cpp
index 6e08d1a..b41eefa 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -1,11 +1,11 @@
#include "open_session.hpp"
-#include <iostream>
-
#include "comm_module.hpp"
#include "endian.hpp"
#include "main.hpp"
+#include <iostream>
+
namespace command
{
@@ -14,12 +14,13 @@
{
std::vector<uint8_t> outPayload(sizeof(OpenSessionResponse));
- auto request = reinterpret_cast<const OpenSessionRequest*>(inPayload.data());
+ auto request =
+ reinterpret_cast<const OpenSessionRequest*>(inPayload.data());
auto response = reinterpret_cast<OpenSessionResponse*>(outPayload.data());
// Check for valid Authentication Algorithms
if (!cipher::rakp_auth::Interface::isAlgorithmSupported(
- static_cast<cipher::rakp_auth::Algorithms>(request->authAlgo)))
+ static_cast<cipher::rakp_auth::Algorithms>(request->authAlgo)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_AUTH_ALGO);
@@ -28,7 +29,7 @@
// Check for valid Integrity Algorithms
if (!cipher::integrity::Interface::isAlgorithmSupported(
- static_cast<cipher::integrity::Algorithms>(request->intAlgo)))
+ static_cast<cipher::integrity::Algorithms>(request->intAlgo)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_INTEGRITY_ALGO);
@@ -36,8 +37,8 @@
}
// Check for valid Confidentiality Algorithms
- if(!cipher::crypt::Interface::isAlgorithmSupported(static_cast
- <cipher::crypt::Algorithms>(request->confAlgo)))
+ if (!cipher::crypt::Interface::isAlgorithmSupported(
+ static_cast<cipher::crypt::Algorithms>(request->confAlgo)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_CONF_ALGO);
@@ -48,19 +49,23 @@
try
{
// Start an IPMI session
- session = (std::get<session::Manager&>(singletonPool).startSession(
- endian::from_ipmi<>(request->remoteConsoleSessionID),
- static_cast<session::Privilege>(request->maxPrivLevel),
- static_cast<cipher::rakp_auth::Algorithms>(request->authAlgo),
- static_cast<cipher::integrity::Algorithms>(request->intAlgo),
- static_cast<cipher::crypt::Algorithms>(request->confAlgo)
- )).lock();
+ session =
+ (std::get<session::Manager&>(singletonPool)
+ .startSession(
+ endian::from_ipmi<>(request->remoteConsoleSessionID),
+ static_cast<session::Privilege>(request->maxPrivLevel),
+ static_cast<cipher::rakp_auth::Algorithms>(
+ request->authAlgo),
+ static_cast<cipher::integrity::Algorithms>(
+ request->intAlgo),
+ static_cast<cipher::crypt::Algorithms>(request->confAlgo)))
+ .lock();
}
catch (std::exception& e)
{
std::cerr << e.what() << "\n";
- response->status_code = static_cast<uint8_t>
- (RAKP_ReturnCode::INSUFFICIENT_RESOURCE);
+ response->status_code =
+ static_cast<uint8_t>(RAKP_ReturnCode::INSUFFICIENT_RESOURCE);
std::cerr << "openSession : Problem opening a session\n";
return outPayload;
}
@@ -69,19 +74,19 @@
response->status_code = static_cast<uint8_t>(RAKP_ReturnCode::NO_ERROR);
response->maxPrivLevel = static_cast<uint8_t>(session->curPrivLevel);
response->remoteConsoleSessionID = request->remoteConsoleSessionID;
- response->managedSystemSessionID = endian::to_ipmi<>
- (session->getBMCSessionID());
+ response->managedSystemSessionID =
+ endian::to_ipmi<>(session->getBMCSessionID());
- response->authPayload = request->authPayload ;
- response->authPayloadLen = request->authPayloadLen ;
+ response->authPayload = request->authPayload;
+ response->authPayloadLen = request->authPayloadLen;
response->authAlgo = request->authAlgo;
- response->intPayload = request->intPayload ;
- response->intPayloadLen = request->intPayloadLen ;
+ response->intPayload = request->intPayload;
+ response->intPayloadLen = request->intPayloadLen;
response->intAlgo = request->intAlgo;
- response->confPayload = request->confPayload ;
- response->confPayloadLen = request->confPayloadLen ;
+ response->confPayload = request->confPayload;
+ response->confPayloadLen = request->confPayloadLen;
response->confAlgo = request->confAlgo;
session->updateLastTransactionTime();
diff --git a/command/open_session.hpp b/command/open_session.hpp
index 677fe55..700c784 100644
--- a/command/open_session.hpp
+++ b/command/open_session.hpp
@@ -1,9 +1,9 @@
#pragma once
-#include <vector>
-
#include "message_handler.hpp"
+#include <vector>
+
namespace command
{
@@ -14,25 +14,25 @@
*/
struct OpenSessionRequest
{
- uint8_t messageTag; // Message tag from request buffer
+ uint8_t messageTag; // Message tag from request buffer
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t maxPrivLevel : 4 ;// Requested maximum privilege level
- uint8_t reserved1 : 4; // Reserved for future definition
+ uint8_t maxPrivLevel : 4; // Requested maximum privilege level
+ uint8_t reserved1 : 4; // Reserved for future definition
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved1 : 4; // Reserved for future definition
- uint8_t maxPrivLevel : 4 ;// Requested maximum privilege level
+ uint8_t reserved1 : 4; // Reserved for future definition
+ uint8_t maxPrivLevel : 4; // Requested maximum privilege level
#endif
uint16_t reserved2;
- uint32_t remoteConsoleSessionID ;
+ uint32_t remoteConsoleSessionID;
- uint8_t authPayload ;
- uint16_t reserved3;
- uint8_t authPayloadLen;
+ uint8_t authPayload;
+ uint16_t reserved3;
+ uint8_t authPayloadLen;
#if BYTE_ORDER == LITTLE_ENDIAN
uint8_t authAlgo : 6;
@@ -49,7 +49,7 @@
uint8_t intPayload;
uint16_t reserved7;
- uint8_t intPayloadLen;
+ uint8_t intPayloadLen;
#if BYTE_ORDER == LITTLE_ENDIAN
uint8_t intAlgo : 6;
@@ -66,7 +66,7 @@
uint8_t confPayload;
uint16_t reserved11;
- uint8_t confPayloadLen;
+ uint8_t confPayloadLen;
#if BYTE_ORDER == LITTLE_ENDIAN
uint8_t confAlgo : 6;
@@ -125,7 +125,7 @@
uint8_t intPayload;
uint16_t reserved7;
- uint8_t intPayloadLen;
+ uint8_t intPayloadLen;
#if BYTE_ORDER == LITTLE_ENDIAN
uint8_t intAlgo : 6;
@@ -143,7 +143,7 @@
uint8_t confPayload;
uint16_t reserved11;
- uint8_t confPayloadLen;
+ uint8_t confPayloadLen;
#if BYTE_ORDER == LITTLE_ENDIAN
uint8_t confAlgo : 6;
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index 2215046..8030b92 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -1,10 +1,13 @@
-#include <host-ipmid/ipmid-api.h>
-#include <phosphor-logging/log.hpp>
-#include "main.hpp"
#include "payload_cmds.hpp"
+
+#include "main.hpp"
#include "sol/sol_manager.hpp"
#include "sol_cmds.hpp"
+#include <host-ipmid/ipmid-api.h>
+
+#include <phosphor-logging/log.hpp>
+
namespace sol
{
@@ -17,10 +20,10 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(ActivatePayloadResponse));
- auto request = reinterpret_cast<const ActivatePayloadRequest*>
- (inPayload.data());
- auto response = reinterpret_cast<ActivatePayloadResponse*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const ActivatePayloadRequest*>(inPayload.data());
+ auto response =
+ reinterpret_cast<ActivatePayloadResponse*>(outPayload.data());
response->completionCode = IPMI_CC_OK;
@@ -44,8 +47,9 @@
return outPayload;
}
- auto session = (std::get<session::Manager&>(singletonPool).getSession(
- handler.sessionID)).lock();
+ auto session = (std::get<session::Manager&>(singletonPool)
+ .getSession(handler.sessionID))
+ .lock();
if (!request->encryption && session->isCryptAlgoEnabled())
{
@@ -53,8 +57,8 @@
return outPayload;
}
- auto status = std::get<sol::Manager&>(singletonPool).isPayloadActive(
- request->payloadInstance);
+ auto status = std::get<sol::Manager&>(singletonPool)
+ .isPayloadActive(request->payloadInstance);
if (status)
{
response->completionCode = IPMI_CC_PAYLOAD_ALREADY_ACTIVE;
@@ -67,9 +71,8 @@
// Start the SOL payload
try
{
- std::get<sol::Manager&>(singletonPool).startPayloadInstance(
- request->payloadInstance,
- handler.sessionID);
+ std::get<sol::Manager&>(singletonPool)
+ .startPayloadInstance(request->payloadInstance, handler.sessionID);
}
catch (std::exception& e)
{
@@ -92,10 +95,10 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(DeactivatePayloadResponse));
- auto request = reinterpret_cast<const DeactivatePayloadRequest*>
- (inPayload.data());
- auto response = reinterpret_cast<DeactivatePayloadResponse*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const DeactivatePayloadRequest*>(inPayload.data());
+ auto response =
+ reinterpret_cast<DeactivatePayloadResponse*>(outPayload.data());
response->completionCode = IPMI_CC_OK;
@@ -113,8 +116,8 @@
return outPayload;
}
- auto status = std::get<sol::Manager&>(singletonPool).isPayloadActive(
- request->payloadInstance);
+ auto status = std::get<sol::Manager&>(singletonPool)
+ .isPayloadActive(request->payloadInstance);
if (!status)
{
response->completionCode = IPMI_CC_PAYLOAD_DEACTIVATED;
@@ -123,12 +126,12 @@
try
{
- auto& context = std::get<sol::Manager&>(singletonPool).getContext
- (request->payloadInstance);
+ auto& context = std::get<sol::Manager&>(singletonPool)
+ .getContext(request->payloadInstance);
auto sessionID = context.sessionID;
- std::get<sol::Manager&>(singletonPool).stopPayloadInstance(
- request->payloadInstance);
+ std::get<sol::Manager&>(singletonPool)
+ .stopPayloadInstance(request->payloadInstance);
try
{
@@ -146,8 +149,8 @@
return outPayload;
}
- auto check = std::get<session::Manager&>(singletonPool).stopSession
- (sessionID);
+ auto check =
+ std::get<session::Manager&>(singletonPool).stopSession(sessionID);
if (!check)
{
response->completionCode = IPMI_CC_UNSPECIFIED_ERROR;
@@ -167,10 +170,10 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(GetPayloadStatusResponse));
- auto request = reinterpret_cast<const GetPayloadStatusRequest*>
- (inPayload.data());
- auto response = reinterpret_cast<GetPayloadStatusResponse*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const GetPayloadStatusRequest*>(inPayload.data());
+ auto response =
+ reinterpret_cast<GetPayloadStatusResponse*>(outPayload.data());
// SOL is the payload currently supported for payload status
if (static_cast<uint8_t>(message::PayloadType::SOL) != request->payloadType)
@@ -184,7 +187,7 @@
// Currently we support only one SOL session
response->instance1 =
- std::get<sol::Manager&>(singletonPool).isPayloadActive(1);
+ std::get<sol::Manager&>(singletonPool).isPayloadActive(1);
return outPayload;
}
@@ -193,22 +196,23 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(GetPayloadInfoResponse));
- auto request = reinterpret_cast<const GetPayloadInfoRequest*>
- (inPayload.data());
- auto response = reinterpret_cast<GetPayloadInfoResponse*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const GetPayloadInfoRequest*>(inPayload.data());
+ auto response =
+ reinterpret_cast<GetPayloadInfoResponse*>(outPayload.data());
// SOL is the payload currently supported for payload status & only one
// instance of SOL is supported.
- if (static_cast<uint8_t>(message::PayloadType::SOL) != request->payloadType
- || request->payloadInstance != 1)
+ if (static_cast<uint8_t>(message::PayloadType::SOL) !=
+ request->payloadType ||
+ request->payloadInstance != 1)
{
response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
return outPayload;
}
- auto status = std::get<sol::Manager&>(singletonPool).isPayloadActive(
- request->payloadInstance);
+ auto status = std::get<sol::Manager&>(singletonPool)
+ .isPayloadActive(request->payloadInstance);
if (!status)
{
@@ -216,8 +220,8 @@
return outPayload;
}
- auto& context = std::get<sol::Manager&>(singletonPool).getContext
- (request->payloadInstance);
+ auto& context = std::get<sol::Manager&>(singletonPool)
+ .getContext(request->payloadInstance);
response->sessionID = context.sessionID;
return outPayload;
diff --git a/command/payload_cmds.hpp b/command/payload_cmds.hpp
index d751a95..f916c11 100644
--- a/command/payload_cmds.hpp
+++ b/command/payload_cmds.hpp
@@ -1,8 +1,9 @@
#pragma once
-#include <vector>
#include "message_handler.hpp"
+#include <vector>
+
namespace sol
{
@@ -22,23 +23,23 @@
struct ActivatePayloadRequest
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t payloadType : 6; //!< Payload type.
- uint8_t reserved1 : 2; //!< Reserved.
+ uint8_t payloadType : 6; //!< Payload type.
+ uint8_t reserved1 : 2; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved1 : 2; //!< Payload type.
- uint8_t payloadType : 6; //!< Payload type.
+ uint8_t reserved1 : 2; //!< Payload type.
+ uint8_t payloadType : 6; //!< Payload type.
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t payloadInstance : 4; //!< Payload instance.
- uint8_t reserved2 : 4; //!< Reserved.
+ uint8_t payloadInstance : 4; //!< Payload instance.
+ uint8_t reserved2 : 4; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved2 : 4; //!< Reserved.
- uint8_t payloadInstance : 4; //!< Payload instance.
+ uint8_t reserved2 : 4; //!< Reserved.
+ uint8_t payloadInstance : 4; //!< Payload instance.
#endif
/** @brief The following Auxiliary Request Data applies only for payload
@@ -64,9 +65,9 @@
uint8_t reserved4 : 1; //!< Reserved.
#endif
- uint8_t reserved5; //!< Reserved.
- uint8_t reserved6; //!< Reserved.
- uint8_t reserved7; //!< Reserved.
+ uint8_t reserved5; //!< Reserved.
+ uint8_t reserved6; //!< Reserved.
+ uint8_t reserved7; //!< Reserved.
} __attribute__((packed));
/** @struct ActivatePayloadResponse
@@ -75,26 +76,26 @@
*/
struct ActivatePayloadResponse
{
- uint8_t completionCode; //!< Completion code.
- uint8_t reserved1; //!< Reserved.
- uint8_t reserved2; //!< Reserved.
- uint8_t reserved3; //!< Reserved.
+ uint8_t completionCode; //!< Completion code.
+ uint8_t reserved1; //!< Reserved.
+ uint8_t reserved2; //!< Reserved.
+ uint8_t reserved3; //!< Reserved.
// Test Mode
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t testMode : 1; //!< Test mode.
- uint8_t reserved4 : 7; //!< Reserved.
+ uint8_t testMode : 1; //!< Test mode.
+ uint8_t reserved4 : 7; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved4 : 7; //!< Reserved.
- uint8_t testMode : 1; //!< Test mode.
+ uint8_t reserved4 : 7; //!< Reserved.
+ uint8_t testMode : 1; //!< Test mode.
#endif
- uint16_t inPayloadSize; //!< Inbound payload size
- uint16_t outPayloadSize; //!< Outbound payload size.
- uint16_t portNum; //!< Payload UDP port number.
- uint16_t vlanNum; //!< Payload VLAN number.
+ uint16_t inPayloadSize; //!< Inbound payload size
+ uint16_t outPayloadSize; //!< Outbound payload size.
+ uint16_t portNum; //!< Payload UDP port number.
+ uint16_t vlanNum; //!< Payload VLAN number.
} __attribute__((packed));
/** @brief Activate Payload Command.
@@ -120,29 +121,29 @@
struct DeactivatePayloadRequest
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t payloadType : 6; //!< Payload type.
- uint8_t reserved1 : 2; //!< Reserved.
+ uint8_t payloadType : 6; //!< Payload type.
+ uint8_t reserved1 : 2; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved1 : 2; //!< Payload type.
- uint8_t payloadType : 6; //!< Reserved.
+ uint8_t reserved1 : 2; //!< Payload type.
+ uint8_t payloadType : 6; //!< Reserved.
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t payloadInstance : 4; //!< Payload instance.
- uint8_t reserved2 : 4; //!< Reserved.
+ uint8_t payloadInstance : 4; //!< Payload instance.
+ uint8_t reserved2 : 4; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved2 : 4; //!< Reserved.
- uint8_t payloadInstance : 4; //!< Payload instance.
+ uint8_t reserved2 : 4; //!< Reserved.
+ uint8_t payloadInstance : 4; //!< Payload instance.
#endif
/** @brief No auxiliary data for payload type SOL */
- uint8_t auxData1; //!< Auxiliary data 1
- uint8_t auxData2; //!< Auxiliary data 2
- uint8_t auxData3; //!< Auxiliary data 3
+ uint8_t auxData1; //!< Auxiliary data 1
+ uint8_t auxData2; //!< Auxiliary data 2
+ uint8_t auxData3; //!< Auxiliary data 3
} __attribute__((packed));
/** @struct DeactivatePayloadResponse
@@ -151,7 +152,7 @@
*/
struct DeactivatePayloadResponse
{
- uint8_t completionCode; //!< Completion code
+ uint8_t completionCode; //!< Completion code
} __attribute__((packed));
/** @brief Deactivate Payload Command.
@@ -179,7 +180,7 @@
*/
struct GetPayloadStatusRequest
{
- uint8_t payloadType; //!< Payload type
+ uint8_t payloadType; //!< Payload type
} __attribute__((packed));
/** @struct GetPayloadStatusResponse
@@ -190,33 +191,33 @@
{
uint8_t completionCode; //!< Completion code.
- uint8_t capacity; //!< Instance capacity.
+ uint8_t capacity; //!< Instance capacity.
/* @brief Activation Status. */
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
- uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
- uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
- uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
- uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
- uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
- uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
- uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
+ uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
+ uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
+ uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
+ uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
+ uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
+ uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
+ uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
+ uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
- uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
- uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
- uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
- uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
- uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
- uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
- uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
+ uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
+ uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
+ uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
+ uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
+ uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
+ uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
+ uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
+ uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
+ uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
uint8_t instance10 : 1; //!< If true, Instance 10 is activated.
uint8_t instance11 : 1; //!< If true, Instance 11 is activated.
uint8_t instance12 : 1; //!< If true, Instance 12 is activated.
@@ -234,7 +235,7 @@
uint8_t instance12 : 1; //!< If true, Instance 12 is activated.
uint8_t instance11 : 1; //!< If true, Instance 11 is activated.
uint8_t instance10 : 1; //!< If true, Instance 10 is activated.
- uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
+ uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
#endif
} __attribute__((packed));
@@ -257,8 +258,8 @@
*/
struct GetPayloadInfoRequest
{
- uint8_t payloadType; //!< Payload type
- uint8_t payloadInstance;//!< Payload instance
+ uint8_t payloadType; //!< Payload type
+ uint8_t payloadInstance; //!< Payload instance
} __attribute__((packed));
/** @struct GetPayloadInfoResponse
diff --git a/command/rakp12.cpp b/command/rakp12.cpp
index c52d188..b0aad87 100644
--- a/command/rakp12.cpp
+++ b/command/rakp12.cpp
@@ -1,5 +1,10 @@
#include "rakp12.hpp"
+#include "comm_module.hpp"
+#include "endian.hpp"
+#include "guid.hpp"
+#include "main.hpp"
+
#include <openssl/rand.h>
#include <algorithm>
@@ -7,11 +12,6 @@
#include <iomanip>
#include <iostream>
-#include "comm_module.hpp"
-#include "endian.hpp"
-#include "guid.hpp"
-#include "main.hpp"
-
namespace command
{
@@ -23,8 +23,8 @@
auto response = reinterpret_cast<RAKP2response*>(outPayload.data());
// Session ID zero is reserved for Session Setup
- if(endian::from_ipmi(request->managedSystemSessionID) ==
- session::SESSION_ZERO)
+ if (endian::from_ipmi(request->managedSystemSessionID) ==
+ session::SESSION_ZERO)
{
std::cerr << "RAKP12: BMC invalid Session ID\n";
response->rmcpStatusCode =
@@ -35,8 +35,10 @@
std::shared_ptr<session::Session> session;
try
{
- session = (std::get<session::Manager&>(singletonPool).getSession(
- endian::from_ipmi(request->managedSystemSessionID))).lock();
+ session = (std::get<session::Manager&>(singletonPool)
+ .getSession(
+ endian::from_ipmi(request->managedSystemSessionID)))
+ .lock();
}
catch (std::exception& e)
{
@@ -46,12 +48,12 @@
return outPayload;
}
- auto rakp1Size = sizeof(RAKP1request) -
- (userNameMaxLen - request->user_name_len);
+ auto rakp1Size =
+ sizeof(RAKP1request) - (userNameMaxLen - request->user_name_len);
// Validate user name length in the message
if (request->user_name_len > userNameMaxLen ||
- inPayload.size() != rakp1Size)
+ inPayload.size() != rakp1Size)
{
response->rmcpStatusCode =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_NAME_LENGTH);
@@ -92,16 +94,15 @@
std::vector<uint8_t> input;
input.resize(sizeof(rcSessionID) + sizeof(bmcSessionID) +
cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN +
- cipher::rakp_auth::BMC_RANDOM_NUMBER_LEN +
- BMC_GUID_LEN + sizeof(request->req_max_privilege_level) +
- sizeof(request->user_name_len) +
- session->userName.size());
+ cipher::rakp_auth::BMC_RANDOM_NUMBER_LEN + BMC_GUID_LEN +
+ sizeof(request->req_max_privilege_level) +
+ sizeof(request->user_name_len) + session->userName.size());
auto iter = input.begin();
// Remote Console Session ID
- std::copy_n(reinterpret_cast<uint8_t*>(&rcSessionID),
- sizeof(rcSessionID), iter);
+ std::copy_n(reinterpret_cast<uint8_t*>(&rcSessionID), sizeof(rcSessionID),
+ iter);
std::advance(iter, sizeof(rcSessionID));
// Managed System Session ID
@@ -111,18 +112,17 @@
// Copy the Remote Console Random Number from the RAKP1 request to the
// Authentication Algorithm
- std::copy_n(reinterpret_cast<const uint8_t*>
- (request->remote_console_random_number),
- cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN,
- authAlgo->rcRandomNum.begin());
+ std::copy_n(
+ reinterpret_cast<const uint8_t*>(request->remote_console_random_number),
+ cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN,
+ authAlgo->rcRandomNum.begin());
- std::copy(authAlgo->rcRandomNum.begin(), authAlgo->rcRandomNum.end(),
- iter);
+ std::copy(authAlgo->rcRandomNum.begin(), authAlgo->rcRandomNum.end(), iter);
std::advance(iter, cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN);
// Generate the Managed System Random Number
if (!RAND_bytes(input.data() + sizeof(rcSessionID) + sizeof(bmcSessionID) +
- cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN,
+ cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN,
cipher::rakp_auth::BMC_RANDOM_NUMBER_LEN))
{
response->rmcpStatusCode =
@@ -140,8 +140,8 @@
std::advance(iter, BMC_GUID_LEN);
// Requested Privilege Level
- session->curPrivLevel = static_cast<session::Privilege>
- (request->req_max_privilege_level);
+ session->curPrivLevel =
+ static_cast<session::Privilege>(request->req_max_privilege_level);
std::copy_n(&(request->req_max_privilege_level),
sizeof(request->req_max_privilege_level), iter);
std::advance(iter, sizeof(request->req_max_privilege_level));
@@ -162,15 +162,14 @@
response->messageTag = request->messageTag;
response->rmcpStatusCode = static_cast<uint8_t>(RAKP_ReturnCode::NO_ERROR);
response->reserved = 0;
- response->remoteConsoleSessionID = rcSessionID ;
+ response->remoteConsoleSessionID = rcSessionID;
// Copy Managed System Random Number to the Response
std::copy(authAlgo->bmcRandomNum.begin(), authAlgo->bmcRandomNum.end(),
response->managed_system_random_number);
// Copy System GUID to the Response
- std::copy_n(cache::guid.data(),
- cache::guid.size(),
+ std::copy_n(cache::guid.data(), cache::guid.size(),
response->managed_system_guid);
// Insert the HMAC output into the payload
diff --git a/command/rakp12.hpp b/command/rakp12.hpp
index 189b5e5..1ce533a 100644
--- a/command/rakp12.hpp
+++ b/command/rakp12.hpp
@@ -1,9 +1,9 @@
#pragma once
-#include <vector>
-
-#include "message_handler.hpp"
#include "comm_module.hpp"
+#include "message_handler.hpp"
+
+#include <vector>
namespace command
{
diff --git a/command/rakp34.cpp b/command/rakp34.cpp
index 37335a8..76236d5 100644
--- a/command/rakp34.cpp
+++ b/command/rakp34.cpp
@@ -1,22 +1,23 @@
#include "rakp34.hpp"
-#include <algorithm>
-#include <cstring>
-#include <iostream>
-
#include "comm_module.hpp"
#include "endian.hpp"
#include "guid.hpp"
#include "main.hpp"
#include "rmcp.hpp"
+#include <algorithm>
+#include <cstring>
+#include <iostream>
+
namespace command
{
void applyIntegrityAlgo(const uint32_t bmcSessionID)
{
- auto session = (std::get<session::Manager&>(singletonPool).getSession(
- bmcSessionID)).lock();
+ auto session =
+ (std::get<session::Manager&>(singletonPool).getSession(bmcSessionID))
+ .lock();
auto authAlgo = session->getAuthAlgo();
@@ -25,15 +26,15 @@
case cipher::integrity::Algorithms::HMAC_SHA1_96:
{
session->setIntegrityAlgo(
- std::make_unique<cipher::integrity::AlgoSHA1>(
- authAlgo->sessionIntegrityKey));
+ std::make_unique<cipher::integrity::AlgoSHA1>(
+ authAlgo->sessionIntegrityKey));
break;
}
case cipher::integrity::Algorithms::HMAC_SHA256_128:
{
session->setIntegrityAlgo(
std::make_unique<cipher::integrity::AlgoSHA256>(
- authAlgo->sessionIntegrityKey));
+ authAlgo->sessionIntegrityKey));
break;
}
default:
@@ -43,8 +44,9 @@
void applyCryptAlgo(const uint32_t bmcSessionID)
{
- auto session = (std::get<session::Manager&>(singletonPool).getSession(
- bmcSessionID)).lock();
+ auto session =
+ (std::get<session::Manager&>(singletonPool).getSession(bmcSessionID))
+ .lock();
auto authAlgo = session->getAuthAlgo();
@@ -53,10 +55,10 @@
case cipher::crypt::Algorithms::AES_CBC_128:
{
auto intAlgo = session->getIntegrityAlgo();
- auto k2 = intAlgo->generateKn(
- authAlgo->sessionIntegrityKey, rmcp::const_2);
+ auto k2 = intAlgo->generateKn(authAlgo->sessionIntegrityKey,
+ rmcp::const_2);
session->setCryptAlgo(
- std::make_unique<cipher::crypt::AlgoAES128>(k2));
+ std::make_unique<cipher::crypt::AlgoAES128>(k2));
break;
}
default:
@@ -82,8 +84,8 @@
}
// Session ID zero is reserved for Session Setup
- if(endian::from_ipmi(request->managedSystemSessionID) ==
- session::SESSION_ZERO)
+ if (endian::from_ipmi(request->managedSystemSessionID) ==
+ session::SESSION_ZERO)
{
std::cerr << "RAKP34: BMC invalid Session ID\n";
response->rmcpStatusCode =
@@ -94,8 +96,10 @@
std::shared_ptr<session::Session> session;
try
{
- session = (std::get<session::Manager&>(singletonPool).getSession(
- endian::from_ipmi(request->managedSystemSessionID))).lock();
+ session = (std::get<session::Manager&>(singletonPool)
+ .getSession(
+ endian::from_ipmi(request->managedSystemSessionID)))
+ .lock();
}
catch (std::exception& e)
{
@@ -159,19 +163,19 @@
auto output = authAlgo->generateHMAC(input);
if (inPayload.size() != (sizeof(RAKP3request) + output.size()) ||
- std::memcmp(output.data(), request+1, output.size()))
+ std::memcmp(output.data(), request + 1, output.size()))
{
std::cerr << "Mismatch in HMAC sent by remote console\n";
response->messageTag = request->messageTag;
- response->rmcpStatusCode = static_cast<uint8_t>
- (RAKP_ReturnCode::INVALID_INTEGRITY_VALUE);
+ response->rmcpStatusCode =
+ static_cast<uint8_t>(RAKP_ReturnCode::INVALID_INTEGRITY_VALUE);
response->reserved = 0;
response->remoteConsoleSessionID = rcSessionID;
- //close the session
- std::get<session::Manager&>(singletonPool).stopSession(
- session->getBMCSessionID());
+ // close the session
+ std::get<session::Manager&>(singletonPool)
+ .stopSession(session->getBMCSessionID());
return outPayload;
}
@@ -194,8 +198,7 @@
iter = input.begin();
// Remote Console Random Number
- std::copy(authAlgo->rcRandomNum.begin(), authAlgo->rcRandomNum.end(),
- iter);
+ std::copy(authAlgo->rcRandomNum.begin(), authAlgo->rcRandomNum.end(), iter);
std::advance(iter, cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN);
// Managed Console Random Number
@@ -239,8 +242,7 @@
iter = input.begin();
// Remote Console Random Number
- std::copy(authAlgo->rcRandomNum.begin(), authAlgo->rcRandomNum.end(),
- iter);
+ std::copy(authAlgo->rcRandomNum.begin(), authAlgo->rcRandomNum.end(), iter);
std::advance(iter, cipher::rakp_auth::REMOTE_CONSOLE_RANDOM_NUMBER_LEN);
// Managed System Session ID
diff --git a/command/rakp34.hpp b/command/rakp34.hpp
index 2f00823..e582256 100644
--- a/command/rakp34.hpp
+++ b/command/rakp34.hpp
@@ -1,9 +1,9 @@
#pragma once
-#include <vector>
-
-#include "message_handler.hpp"
#include "comm_module.hpp"
+#include "message_handler.hpp"
+
+#include <vector>
namespace command
{
diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
index e199532..fb2d074 100644
--- a/command/session_cmds.cpp
+++ b/command/session_cmds.cpp
@@ -1,28 +1,31 @@
#include "session_cmds.hpp"
-#include <iostream>
-
#include "endian.hpp"
#include "main.hpp"
+
#include <host-ipmid/ipmid-api.h>
+#include <iostream>
+
namespace command
{
-std::vector<uint8_t> setSessionPrivilegeLevel(
- const std::vector<uint8_t>& inPayload, const message::Handler& handler)
+std::vector<uint8_t>
+ setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
+ const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(SetSessionPrivLevelResp));
- auto request = reinterpret_cast<const SetSessionPrivLevelReq*>
- (inPayload.data());
- auto response = reinterpret_cast<SetSessionPrivLevelResp*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const SetSessionPrivLevelReq*>(inPayload.data());
+ auto response =
+ reinterpret_cast<SetSessionPrivLevelResp*>(outPayload.data());
response->completionCode = IPMI_CC_OK;
uint8_t reqPrivilegeLevel = request->reqPrivLevel;
- auto session = (std::get<session::Manager&>(singletonPool).getSession(
- handler.sessionID)).lock();
+ auto session = (std::get<session::Manager&>(singletonPool)
+ .getSession(handler.sessionID))
+ .lock();
if (reqPrivilegeLevel == 0) // Just return present privilege level
{
@@ -30,8 +33,8 @@
}
else if (reqPrivilegeLevel <= static_cast<uint8_t>(session->maxPrivLevel))
{
- session->curPrivLevel = static_cast<session::Privilege>
- (reqPrivilegeLevel);
+ session->curPrivLevel =
+ static_cast<session::Privilege>(reqPrivilegeLevel);
response->newPrivLevel = reqPrivilegeLevel;
}
else
@@ -46,10 +49,10 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(CloseSessionResponse));
- auto request = reinterpret_cast<const CloseSessionRequest*>
- (inPayload.data());
+ auto request =
+ reinterpret_cast<const CloseSessionRequest*>(inPayload.data());
auto response = reinterpret_cast<CloseSessionResponse*>(outPayload.data());
- response->completionCode = IPMI_CC_OK ;
+ response->completionCode = IPMI_CC_OK;
auto bmcSessionID = endian::from_ipmi(request->sessionID);
@@ -61,9 +64,9 @@
}
else
{
- auto status = std::get<session::Manager&>(singletonPool).stopSession
- (bmcSessionID);
- if(!status)
+ auto status = std::get<session::Manager&>(singletonPool)
+ .stopSession(bmcSessionID);
+ if (!status)
{
response->completionCode = IPMI_CC_INVALID_SESSIONID;
}
diff --git a/command/session_cmds.hpp b/command/session_cmds.hpp
index 738bd03..9737fdb 100644
--- a/command/session_cmds.hpp
+++ b/command/session_cmds.hpp
@@ -1,9 +1,9 @@
#pragma once
-#include <vector>
-
#include "message_handler.hpp"
+#include <vector>
+
namespace command
{
@@ -71,8 +71,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t> setSessionPrivilegeLevel(
- const std::vector<uint8_t>& inPayload, const message::Handler& handler);
+std::vector<uint8_t>
+ setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
+ const message::Handler& handler);
constexpr uint8_t IPMI_CC_INVALID_SESSIONID = 0x87;
diff --git a/command/sol_cmds.cpp b/command/sol_cmds.cpp
index fffefb3..fb6f19e 100644
--- a/command/sol_cmds.cpp
+++ b/command/sol_cmds.cpp
@@ -1,8 +1,10 @@
-#include <phosphor-logging/log.hpp>
+#include "sol_cmds.hpp"
+
#include "main.hpp"
#include "sol/sol_context.hpp"
#include "sol/sol_manager.hpp"
-#include "sol_cmds.hpp"
+
+#include <phosphor-logging/log.hpp>
namespace sol
{
@@ -19,23 +21,20 @@
auto solDataSize = inPayload.size() - sizeof(Payload);
std::vector<uint8_t> charData(solDataSize);
- if( solDataSize > 0)
+ if (solDataSize > 0)
{
- std::copy_n(inPayload.data() + sizeof(Payload),
- solDataSize,
+ std::copy_n(inPayload.data() + sizeof(Payload), solDataSize,
charData.begin());
}
try
{
- auto& context = std::get<sol::Manager&>(singletonPool).
- getContext(handler.sessionID);
+ auto& context = std::get<sol::Manager&>(singletonPool)
+ .getContext(handler.sessionID);
- context.processInboundPayload(request->packetSeqNum,
- request->packetAckSeqNum,
- request->acceptedCharCount,
- request->inOperation.ack,
- charData);
+ context.processInboundPayload(
+ request->packetSeqNum, request->packetAckSeqNum,
+ request->acceptedCharCount, request->inOperation.ack, charData);
}
catch (std::exception& e)
{
@@ -50,21 +49,20 @@
{
std::vector<uint8_t> outPayload(sizeof(ActivatingRequest));
- auto request = reinterpret_cast<ActivatingRequest*>
- (outPayload.data());
+ auto request = reinterpret_cast<ActivatingRequest*>(outPayload.data());
request->sessionState = 0;
request->payloadInstance = payloadInstance;
request->majorVersion = MAJOR_VERSION;
request->minorVersion = MINOR_VERSION;
- auto session = (std::get<session::Manager&>(singletonPool).getSession(
- sessionID)).lock();
+ auto session =
+ (std::get<session::Manager&>(singletonPool).getSession(sessionID))
+ .lock();
message::Handler msgHandler(session->channelPtr, sessionID);
- msgHandler.sendUnsolicitedIPMIPayload(netfnTransport,
- solActivatingCmd,
+ msgHandler.sendUnsolicitedIPMIPayload(netfnTransport, solActivatingCmd,
outPayload);
}
@@ -72,10 +70,9 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(SetConfParamsResponse));
- auto request = reinterpret_cast<const SetConfParamsRequest*>
- (inPayload.data());
- auto response = reinterpret_cast<SetConfParamsResponse*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const SetConfParamsRequest*>(inPayload.data());
+ auto response = reinterpret_cast<SetConfParamsResponse*>(outPayload.data());
response->completionCode = IPMI_CC_OK;
switch (static_cast<Parameter>(request->paramSelector))
@@ -99,16 +96,16 @@
response->completionCode = ipmiCCWriteReadParameter;
}
else if (request->auth.privilege <
- static_cast<uint8_t>(session::Privilege::USER) ||
+ static_cast<uint8_t>(session::Privilege::USER) ||
request->auth.privilege >
- static_cast<uint8_t>(session::Privilege::OEM))
+ static_cast<uint8_t>(session::Privilege::OEM))
{
response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
}
else
{
std::get<sol::Manager&>(singletonPool).solMinPrivilege =
- static_cast<session::Privilege>(request->auth.privilege);
+ static_cast<session::Privilege>(request->auth.privilege);
}
break;
}
@@ -123,9 +120,9 @@
}
std::get<sol::Manager&>(singletonPool).accumulateInterval =
- request->acc.interval * sol::accIntervalFactor * 1ms;
+ request->acc.interval * sol::accIntervalFactor * 1ms;
std::get<sol::Manager&>(singletonPool).sendThreshold =
- request->acc.threshold;
+ request->acc.threshold;
break;
}
case Parameter::RETRY:
@@ -133,9 +130,9 @@
using namespace std::chrono_literals;
std::get<sol::Manager&>(singletonPool).retryCount =
- request->retry.count;
+ request->retry.count;
std::get<sol::Manager&>(singletonPool).retryInterval =
- request->retry.interval * sol::retryIntervalFactor * 1ms;
+ request->retry.interval * sol::retryIntervalFactor * 1ms;
break;
}
case Parameter::PORT:
@@ -157,10 +154,9 @@
const message::Handler& handler)
{
std::vector<uint8_t> outPayload(sizeof(GetConfParamsResponse));
- auto request = reinterpret_cast<const GetConfParamsRequest*>
- (inPayload.data());
- auto response = reinterpret_cast<GetConfParamsResponse*>
- (outPayload.data());
+ auto request =
+ reinterpret_cast<const GetConfParamsRequest*>(inPayload.data());
+ auto response = reinterpret_cast<GetConfParamsResponse*>(outPayload.data());
response->completionCode = IPMI_CC_OK;
response->paramRev = parameterRevision;
@@ -173,50 +169,51 @@
{
case Parameter::PROGRESS:
{
- outPayload.push_back(std::get<sol::Manager&>
- (singletonPool).progress);
+ outPayload.push_back(
+ std::get<sol::Manager&>(singletonPool).progress);
break;
}
case Parameter::ENABLE:
{
- outPayload.push_back(std::get<sol::Manager&>
- (singletonPool).enable);
+ outPayload.push_back(std::get<sol::Manager&>(singletonPool).enable);
break;
}
case Parameter::AUTHENTICATION:
{
- Auth value {0};
+ Auth value{0};
value.encrypt = std::get<sol::Manager&>(singletonPool).forceEncrypt;
value.auth = std::get<sol::Manager&>(singletonPool).forceAuth;
- value.privilege = static_cast<uint8_t>(std::get<sol::Manager&>
- (singletonPool).solMinPrivilege);
- auto buffer = reinterpret_cast<const uint8_t *>(&value);
+ value.privilege = static_cast<uint8_t>(
+ std::get<sol::Manager&>(singletonPool).solMinPrivilege);
+ auto buffer = reinterpret_cast<const uint8_t*>(&value);
std::copy_n(buffer, sizeof(value), std::back_inserter(outPayload));
break;
}
case Parameter::ACCUMULATE:
{
- Accumulate value {0};
+ Accumulate value{0};
value.interval = std::get<sol::Manager&>(singletonPool)
- .accumulateInterval.count()/sol::accIntervalFactor;
- value.threshold = std::get<sol::Manager&>
- (singletonPool).sendThreshold;
- auto buffer = reinterpret_cast<const uint8_t *>(&value);
+ .accumulateInterval.count() /
+ sol::accIntervalFactor;
+ value.threshold =
+ std::get<sol::Manager&>(singletonPool).sendThreshold;
+ auto buffer = reinterpret_cast<const uint8_t*>(&value);
std::copy_n(buffer, sizeof(value), std::back_inserter(outPayload));
break;
}
case Parameter::RETRY:
{
- Retry value {0};
+ Retry value{0};
value.count = std::get<sol::Manager&>(singletonPool).retryCount;
- value.interval = std::get<sol::Manager&>(singletonPool)
- .retryInterval.count()/sol::retryIntervalFactor;
- auto buffer = reinterpret_cast<const uint8_t *>(&value);
+ value.interval =
+ std::get<sol::Manager&>(singletonPool).retryInterval.count() /
+ sol::retryIntervalFactor;
+ auto buffer = reinterpret_cast<const uint8_t*>(&value);
std::copy_n(buffer, sizeof(value), std::back_inserter(outPayload));
break;
@@ -224,15 +221,15 @@
case Parameter::PORT:
{
auto port = endian::to_ipmi<uint16_t>(IPMI_STD_PORT);
- auto buffer = reinterpret_cast<const uint8_t *>(&port);
+ auto buffer = reinterpret_cast<const uint8_t*>(&port);
std::copy_n(buffer, sizeof(port), std::back_inserter(outPayload));
break;
}
case Parameter::CHANNEL:
{
- outPayload.push_back(std::get<sol::Manager&>
- (singletonPool).channel);
+ outPayload.push_back(
+ std::get<sol::Manager&>(singletonPool).channel);
break;
}
case Parameter::NVBITRATE:
diff --git a/command/sol_cmds.hpp b/command/sol_cmds.hpp
index cc19323..182b73e 100644
--- a/command/sol_cmds.hpp
+++ b/command/sol_cmds.hpp
@@ -1,8 +1,9 @@
#pragma once
-#include <vector>
#include "message_handler.hpp"
+#include <vector>
+
namespace sol
{
@@ -33,18 +34,18 @@
struct ActivatingRequest
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t sessionState : 4; //!< SOL session state.
- uint8_t reserved : 4; //!< Reserved.
+ uint8_t sessionState : 4; //!< SOL session state.
+ uint8_t reserved : 4; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved : 4; //!< Reserved.
- uint8_t sessionState : 4; //!< SOL session state.
+ uint8_t reserved : 4; //!< Reserved.
+ uint8_t sessionState : 4; //!< SOL session state.
#endif
- uint8_t payloadInstance; //!< Payload instance.
- uint8_t majorVersion; //!< SOL format major version
- uint8_t minorVersion; //!< SOL format minor version
+ uint8_t payloadInstance; //!< Payload instance.
+ uint8_t majorVersion; //!< SOL format major version
+ uint8_t minorVersion; //!< SOL format minor version
} __attribute__((packed));
/** @brief SOL Activating Command.
@@ -90,17 +91,17 @@
struct Auth
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t privilege : 4; //!< SOL privilege level.
- uint8_t reserved : 2; //!< Reserved.
- uint8_t auth : 1; //!< Force SOL payload Authentication.
- uint8_t encrypt : 1; //!< Force SOL payload encryption.
+ uint8_t privilege : 4; //!< SOL privilege level.
+ uint8_t reserved : 2; //!< Reserved.
+ uint8_t auth : 1; //!< Force SOL payload Authentication.
+ uint8_t encrypt : 1; //!< Force SOL payload encryption.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t encrypt : 1; //!< Force SOL payload encryption.
- uint8_t auth : 1; //!< Force SOL payload Authentication.
- uint8_t reserved : 2; //!< Reserved.
- uint8_t privilege : 4; //!< SOL privilege level.
+ uint8_t encrypt : 1; //!< Force SOL payload encryption.
+ uint8_t auth : 1; //!< Force SOL payload Authentication.
+ uint8_t reserved : 2; //!< Reserved.
+ uint8_t privilege : 4; //!< SOL privilege level.
#endif
} __attribute__((packed));
@@ -110,8 +111,8 @@
*/
struct Accumulate
{
- uint8_t interval; //!< Character accumulate interval.
- uint8_t threshold; //!< Character send threshold.
+ uint8_t interval; //!< Character accumulate interval.
+ uint8_t threshold; //!< Character send threshold.
} __attribute__((packed));
constexpr uint8_t retryCountMask = 0x07;
@@ -123,16 +124,16 @@
struct Retry
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t count : 3; //!< SOL retry count.
- uint8_t reserved : 5; //!< Reserved.
+ uint8_t count : 3; //!< SOL retry count.
+ uint8_t reserved : 5; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved : 5; //!< Reserved.
- uint8_t count : 3; //!< SOL retry count.
+ uint8_t reserved : 5; //!< Reserved.
+ uint8_t count : 3; //!< SOL retry count.
#endif
- uint8_t interval; //!< SOL retry interval.
+ uint8_t interval; //!< SOL retry interval.
} __attribute__((packed));
constexpr uint8_t ipmiCCParamNotSupported = 0x80;
@@ -148,22 +149,22 @@
struct SetConfParamsRequest
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t channelNumber : 4; //!< Channel number.
- uint8_t reserved : 4; //!< Reserved.
+ uint8_t channelNumber : 4; //!< Channel number.
+ uint8_t reserved : 4; //!< Reserved.
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved : 4; //!< Reserved.
- uint8_t channelNumber : 4; //!< Channel number.
+ uint8_t reserved : 4; //!< Reserved.
+ uint8_t channelNumber : 4; //!< Channel number.
#endif
- uint8_t paramSelector; //!< Parameter selector.
+ uint8_t paramSelector; //!< Parameter selector.
union
{
- uint8_t value; //!< Represents one byte SOL parameters.
- struct Accumulate acc; //!< Character accumulate values.
- struct Retry retry; //!< Retry values.
- struct Auth auth; //!< Authentication parameters.
+ uint8_t value; //!< Represents one byte SOL parameters.
+ struct Accumulate acc; //!< Character accumulate values.
+ struct Retry retry; //!< Retry values.
+ struct Auth auth; //!< Authentication parameters.
};
} __attribute__((packed));
@@ -173,7 +174,7 @@
*/
struct SetConfParamsResponse
{
- uint8_t completionCode; //!< Completion code.
+ uint8_t completionCode; //!< Completion code.
} __attribute__((packed));
/** @brief Set SOL configuration parameters command.
@@ -193,20 +194,20 @@
struct GetConfParamsRequest
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t channelNum : 4; //!< Channel number.
- uint8_t reserved : 3; //!< Reserved.
- uint8_t getParamRev : 1; //!< Get parameter or Get parameter revision
+ uint8_t channelNum : 4; //!< Channel number.
+ uint8_t reserved : 3; //!< Reserved.
+ uint8_t getParamRev : 1; //!< Get parameter or Get parameter revision
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t getParamRev : 1; //!< Get parameter or Get parameter revision
- uint8_t reserved : 3; //!< Reserved.
- uint8_t channelNum : 4; //!< Channel number.
+ uint8_t getParamRev : 1; //!< Get parameter or Get parameter revision
+ uint8_t reserved : 3; //!< Reserved.
+ uint8_t channelNum : 4; //!< Channel number.
#endif
- uint8_t paramSelector; //!< Parameter selector.
- uint8_t setSelector; //!< Set selector.
- uint8_t blockSelector; //!< Block selector.
+ uint8_t paramSelector; //!< Parameter selector.
+ uint8_t setSelector; //!< Set selector.
+ uint8_t blockSelector; //!< Block selector.
} __attribute__((packed));
/** @struct GetConfParamsResponse
@@ -215,8 +216,8 @@
*/
struct GetConfParamsResponse
{
- uint8_t completionCode; //!< Completion code.
- uint8_t paramRev; //!< Parameter revision.
+ uint8_t completionCode; //!< Completion code.
+ uint8_t paramRev; //!< Parameter revision.
} __attribute__((packed));
/** @brief Get SOL configuration parameters command.