clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: I2a188ebd3faf376ecba3e20ef6a28ffbaa986628
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index a75a2c2..e5530e6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -104,7 +104,7 @@
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
-PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyReturnTypeOnItsOwnLine: 150
PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
diff --git a/auth_algo.cpp b/auth_algo.cpp
index e686aeb..23cefda 100644
--- a/auth_algo.cpp
+++ b/auth_algo.cpp
@@ -14,8 +14,8 @@
namespace rakp_auth
{
-std::vector<uint8_t>
- AlgoSHA1::generateHMAC(const std::vector<uint8_t>& input) const
+std::vector<uint8_t> AlgoSHA1::generateHMAC(
+ const std::vector<uint8_t>& input) const
{
std::vector<uint8_t> output(SHA_DIGEST_LENGTH);
unsigned int mdLen = 0;
@@ -30,8 +30,8 @@
return output;
}
-std::vector<uint8_t>
- AlgoSHA1::generateICV(const std::vector<uint8_t>& input) const
+std::vector<uint8_t> AlgoSHA1::generateICV(
+ const std::vector<uint8_t>& input) const
{
std::vector<uint8_t> output(SHA_DIGEST_LENGTH);
unsigned int mdLen = 0;
@@ -48,8 +48,8 @@
return output;
}
-std::vector<uint8_t>
- AlgoSHA256::generateHMAC(const std::vector<uint8_t>& input) const
+std::vector<uint8_t> AlgoSHA256::generateHMAC(
+ const std::vector<uint8_t>& input) const
{
std::vector<uint8_t> output(SHA256_DIGEST_LENGTH);
unsigned int mdLen = 0;
@@ -65,8 +65,8 @@
return output;
}
-std::vector<uint8_t>
- AlgoSHA256::generateICV(const std::vector<uint8_t>& input) const
+std::vector<uint8_t> AlgoSHA256::generateICV(
+ const std::vector<uint8_t>& input) const
{
std::vector<uint8_t> output(SHA256_DIGEST_LENGTH);
unsigned int mdLen = 0;
diff --git a/auth_algo.hpp b/auth_algo.hpp
index a4dbcc4..e179d72 100644
--- a/auth_algo.hpp
+++ b/auth_algo.hpp
@@ -173,11 +173,11 @@
AlgoSHA1(AlgoSHA1&&) = default;
AlgoSHA1& operator=(AlgoSHA1&&) = default;
- std::vector<uint8_t>
- generateHMAC(const std::vector<uint8_t>& input) const override;
+ std::vector<uint8_t> generateHMAC(
+ const std::vector<uint8_t>& input) const override;
- std::vector<uint8_t>
- generateICV(const std::vector<uint8_t>& input) const override;
+ std::vector<uint8_t> generateICV(
+ const std::vector<uint8_t>& input) const override;
};
/**
@@ -207,11 +207,11 @@
AlgoSHA256(AlgoSHA256&&) = default;
AlgoSHA256& operator=(AlgoSHA256&&) = default;
- std::vector<uint8_t>
- generateHMAC(const std::vector<uint8_t>& input) const override;
+ std::vector<uint8_t> generateHMAC(
+ const std::vector<uint8_t>& input) const override;
- std::vector<uint8_t>
- generateICV(const std::vector<uint8_t>& input) const override;
+ std::vector<uint8_t> generateICV(
+ const std::vector<uint8_t>& input) const override;
};
} // namespace rakp_auth
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index 44d5cad..ba101e4 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -23,9 +23,9 @@
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using Json = nlohmann::json;
-std::vector<uint8_t>
- GetChannelCapabilities(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& /* handler */)
+std::vector<uint8_t> GetChannelCapabilities(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& /* handler */)
{
auto request =
reinterpret_cast<const GetChannelCapabilitiesReq*>(inPayload.data());
@@ -184,9 +184,9 @@
* @returns ipmi completion code plus response data
* - vector of response data: cc, channel, record data
**/
-std::vector<uint8_t>
- getChannelCipherSuites(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& /* handler */)
+std::vector<uint8_t> getChannelCipherSuites(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& /* handler */)
{
const auto errorResponse = [](uint8_t cc) {
std::vector<uint8_t> rsp(1);
diff --git a/command/channel_auth.hpp b/command/channel_auth.hpp
index 7dc4677..059d0c7 100644
--- a/command/channel_auth.hpp
+++ b/command/channel_auth.hpp
@@ -118,9 +118,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t>
- GetChannelCapabilities(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler);
+std::vector<uint8_t> GetChannelCapabilities(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
/**
* @brief Get Channel Cipher Suites
@@ -136,8 +136,8 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t>
- getChannelCipherSuites(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler);
+std::vector<uint8_t> getChannelCipherSuites(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
} // namespace command
diff --git a/command/open_session.cpp b/command/open_session.cpp
index 21e0f3f..9d5fc49 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -9,9 +9,9 @@
namespace command
{
-std::vector<uint8_t>
- openSession(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& /* handler */)
+std::vector<uint8_t> openSession(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& /* handler */)
{
auto request =
reinterpret_cast<const OpenSessionRequest*>(inPayload.data());
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index e2b154e..ea517e8 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -114,9 +114,9 @@
return outPayload;
}
-std::vector<uint8_t>
- deactivatePayload(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler)
+std::vector<uint8_t> deactivatePayload(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const DeactivatePayloadRequest*>(inPayload.data());
@@ -201,9 +201,9 @@
return outPayload;
}
-std::vector<uint8_t>
- getPayloadStatus(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& /* handler */)
+std::vector<uint8_t> getPayloadStatus(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& /* handler */)
{
auto request =
reinterpret_cast<const GetPayloadStatusRequest*>(inPayload.data());
@@ -235,9 +235,9 @@
return outPayload;
}
-std::vector<uint8_t>
- getPayloadInfo(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& /* handler */)
+std::vector<uint8_t> getPayloadInfo(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& /* handler */)
{
auto request =
reinterpret_cast<const GetPayloadInfoRequest*>(inPayload.data());
diff --git a/command/payload_cmds.hpp b/command/payload_cmds.hpp
index 470d693..37e071f 100644
--- a/command/payload_cmds.hpp
+++ b/command/payload_cmds.hpp
@@ -109,9 +109,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t>
- activatePayload(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler);
+std::vector<uint8_t> activatePayload(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
constexpr uint8_t IPMI_CC_PAYLOAD_DEACTIVATED = 0x80;
@@ -173,9 +173,9 @@
*
* @return Response data for the command.
*/
-std::vector<uint8_t>
- deactivatePayload(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler);
+std::vector<uint8_t> deactivatePayload(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
/** @struct GetPayloadStatusRequest
*
@@ -252,9 +252,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t>
- getPayloadStatus(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler);
+std::vector<uint8_t> getPayloadStatus(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
/** @struct GetPayloadInfoRequest
*
diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
index 1a7c266..5ee7f8f 100644
--- a/command/session_cmds.cpp
+++ b/command/session_cmds.cpp
@@ -16,9 +16,9 @@
namespace command
{
-std::vector<uint8_t>
- setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler)
+std::vector<uint8_t> setSessionPrivilegeLevel(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler)
{
auto request =
reinterpret_cast<const SetSessionPrivLevelReq*>(inPayload.data());
diff --git a/command/session_cmds.hpp b/command/session_cmds.hpp
index b3d0ca6..b94143e 100644
--- a/command/session_cmds.hpp
+++ b/command/session_cmds.hpp
@@ -74,9 +74,9 @@
*
* @return Response data for the command
*/
-std::vector<uint8_t>
- setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
- std::shared_ptr<message::Handler>& handler);
+std::vector<uint8_t> setSessionPrivilegeLevel(
+ const std::vector<uint8_t>& inPayload,
+ std::shared_ptr<message::Handler>& handler);
/**
* @struct CloseSessionRequest
*
diff --git a/command_table.cpp b/command_table.cpp
index c0e655a..c6f7625 100644
--- a/command_table.cpp
+++ b/command_table.cpp
@@ -137,9 +137,9 @@
}
}
-std::vector<uint8_t>
- NetIpmidEntry::executeCommand(std::vector<uint8_t>& commandData,
- std::shared_ptr<message::Handler> handler)
+std::vector<uint8_t> NetIpmidEntry::executeCommand(
+ std::vector<uint8_t>& commandData,
+ std::shared_ptr<message::Handler> handler)
{
std::vector<uint8_t> errResponse;
diff --git a/command_table.hpp b/command_table.hpp
index 821a070..3a5e344 100644
--- a/command_table.hpp
+++ b/command_table.hpp
@@ -128,9 +128,9 @@
*
* @return Response data for the command
*/
- virtual std::vector<uint8_t>
- executeCommand(std::vector<uint8_t>& commandData,
- std::shared_ptr<message::Handler> handler) = 0;
+ virtual std::vector<uint8_t> executeCommand(
+ std::vector<uint8_t>& commandData,
+ std::shared_ptr<message::Handler> handler) = 0;
auto getCommand() const
{
@@ -184,9 +184,9 @@
*
* @return Response data for the command
*/
- std::vector<uint8_t>
- executeCommand(std::vector<uint8_t>& commandData,
- std::shared_ptr<message::Handler> handler) override;
+ std::vector<uint8_t> executeCommand(
+ std::vector<uint8_t>& commandData,
+ std::shared_ptr<message::Handler> handler) override;
virtual ~NetIpmidEntry() = default;
NetIpmidEntry(const NetIpmidEntry&) = default;
diff --git a/crypt_algo.cpp b/crypt_algo.cpp
index 75eea15..69c333d 100644
--- a/crypt_algo.cpp
+++ b/crypt_algo.cpp
@@ -58,8 +58,8 @@
return plainPayload;
}
-std::vector<uint8_t>
- AlgoAES128::encryptPayload(std::vector<uint8_t>& payload) const
+std::vector<uint8_t> AlgoAES128::encryptPayload(
+ std::vector<uint8_t>& payload) const
{
auto payloadLen = payload.size();
@@ -148,8 +148,8 @@
return output;
}
-std::vector<uint8_t>
- AlgoAES128::encryptData(const uint8_t* input, const int inputLen) const
+std::vector<uint8_t> AlgoAES128::encryptData(const uint8_t* input,
+ const int inputLen) const
{
std::vector<uint8_t> output(inputLen + AESCBC128BlockSize);
diff --git a/crypt_algo.hpp b/crypt_algo.hpp
index e7af67f..534f1a0 100644
--- a/crypt_algo.hpp
+++ b/crypt_algo.hpp
@@ -73,8 +73,8 @@
* @return encrypted payload if the operation is successful
*
*/
- virtual std::vector<uint8_t>
- encryptPayload(std::vector<uint8_t>& payload) const = 0;
+ virtual std::vector<uint8_t> encryptPayload(
+ std::vector<uint8_t>& payload) const = 0;
/**
* @brief Check if the Confidentiality algorithm is supported
@@ -171,8 +171,8 @@
* @return encrypted payload if the operation is successful
*
*/
- std::vector<uint8_t>
- encryptPayload(std::vector<uint8_t>& payload) const override;
+ std::vector<uint8_t> encryptPayload(
+ std::vector<uint8_t>& payload) const override;
private:
/**
diff --git a/integrity_algo.cpp b/integrity_algo.cpp
index acfc46f..3110fff 100644
--- a/integrity_algo.cpp
+++ b/integrity_algo.cpp
@@ -18,8 +18,8 @@
k1 = generateKn(sik, rmcp::const_1);
}
-std::vector<uint8_t>
- AlgoSHA1::generateHMAC(const uint8_t* input, const size_t len) const
+std::vector<uint8_t> AlgoSHA1::generateHMAC(const uint8_t* input,
+ const size_t len) const
{
std::vector<uint8_t> output(SHA_DIGEST_LENGTH);
unsigned int mdLen = 0;
@@ -53,8 +53,8 @@
integrityDataEnd));
}
-std::vector<uint8_t>
- AlgoSHA1::generateIntegrityData(const std::vector<uint8_t>& packet) const
+std::vector<uint8_t> AlgoSHA1::generateIntegrityData(
+ const std::vector<uint8_t>& packet) const
{
return generateHMAC(
packet.data() + message::parser::RMCP_SESSION_HEADER_SIZE,
@@ -84,8 +84,8 @@
k1 = generateKn(sik, rmcp::const_1);
}
-std::vector<uint8_t>
- AlgoSHA256::generateHMAC(const uint8_t* input, const size_t len) const
+std::vector<uint8_t> AlgoSHA256::generateHMAC(const uint8_t* input,
+ const size_t len) const
{
std::vector<uint8_t> output(SHA256_DIGEST_LENGTH);
unsigned int mdLen = 0;
@@ -119,8 +119,8 @@
integrityDataEnd));
}
-std::vector<uint8_t>
- AlgoSHA256::generateIntegrityData(const std::vector<uint8_t>& packet) const
+std::vector<uint8_t> AlgoSHA256::generateIntegrityData(
+ const std::vector<uint8_t>& packet) const
{
return generateHMAC(
packet.data() + message::parser::RMCP_SESSION_HEADER_SIZE,
diff --git a/message_parsers.cpp b/message_parsers.cpp
index ef10b04..c4e4bd4 100644
--- a/message_parsers.cpp
+++ b/message_parsers.cpp
@@ -13,8 +13,8 @@
namespace parser
{
-std::tuple<std::shared_ptr<Message>, SessionHeader>
- unflatten(std::vector<uint8_t>& inPacket)
+std::tuple<std::shared_ptr<Message>, SessionHeader> unflatten(
+ std::vector<uint8_t>& inPacket)
{
// Check if the packet has atleast the size of the RMCP Header
if (inPacket.size() < sizeof(RmcpHeader_t))
@@ -133,9 +133,9 @@
return message;
}
-std::vector<uint8_t>
- flatten(const std::shared_ptr<Message>& outMessage,
- const std::shared_ptr<session::Session>& /* session */)
+std::vector<uint8_t> flatten(
+ const std::shared_ptr<Message>& outMessage,
+ const std::shared_ptr<session::Session>& /* session */)
{
std::vector<uint8_t> packet(sizeof(SessionHeader_t));
@@ -403,9 +403,9 @@
packet, sizeof(SessionHeader_t), payloadLen);
}
-std::vector<uint8_t>
- encryptPayload(const std::shared_ptr<Message>& message,
- const std::shared_ptr<session::Session>& session)
+std::vector<uint8_t> encryptPayload(
+ const std::shared_ptr<Message>& message,
+ const std::shared_ptr<session::Session>& session)
{
return session->getCryptAlgo()->encryptPayload(message->payload);
}
diff --git a/message_parsers.hpp b/message_parsers.hpp
index a7d376a..ed75ce2 100644
--- a/message_parsers.hpp
+++ b/message_parsers.hpp
@@ -81,8 +81,8 @@
* header type. In case of failure nullptr and session header type
* would be invalid.
*/
-std::tuple<std::shared_ptr<Message>, SessionHeader>
- unflatten(std::vector<uint8_t>& inPacket);
+std::tuple<std::shared_ptr<Message>, SessionHeader> unflatten(
+ std::vector<uint8_t>& inPacket);
/**
* @brief Flatten an IPMI message and generate the IPMI packet with the
@@ -246,9 +246,9 @@
*
* @return on successful completion, return the encrypted payload
*/
-std::vector<uint8_t>
- encryptPayload(const std::shared_ptr<Message>& message,
- const std::shared_ptr<session::Session>& session);
+std::vector<uint8_t> encryptPayload(
+ const std::shared_ptr<Message>& message,
+ const std::shared_ptr<session::Session>& session);
} // namespace internal
diff --git a/sessions_manager.cpp b/sessions_manager.cpp
index 79bf9de..8c18cba 100644
--- a/sessions_manager.cpp
+++ b/sessions_manager.cpp
@@ -188,8 +188,8 @@
}
}
-std::shared_ptr<Session>
- Manager::getSession(SessionID sessionID, RetrieveOption option)
+std::shared_ptr<Session> Manager::getSession(SessionID sessionID,
+ RetrieveOption option)
{
switch (option)
{
diff --git a/sessions_manager.hpp b/sessions_manager.hpp
index 754f618..d6f847b 100644
--- a/sessions_manager.hpp
+++ b/sessions_manager.hpp
@@ -84,11 +84,11 @@
* @return session handle on success and nullptr on failure
*
*/
- std::shared_ptr<Session>
- startSession(SessionID remoteConsoleSessID, Privilege priv,
- cipher::rakp_auth::Algorithms authAlgo,
- cipher::integrity::Algorithms intAlgo,
- cipher::crypt::Algorithms cryptAlgo);
+ std::shared_ptr<Session> startSession(
+ SessionID remoteConsoleSessID, Privilege priv,
+ cipher::rakp_auth::Algorithms authAlgo,
+ cipher::integrity::Algorithms intAlgo,
+ cipher::crypt::Algorithms cryptAlgo);
/**
* @brief Stop IPMI Session
@@ -110,9 +110,9 @@
* @return session handle on success and nullptr on failure
*
*/
- std::shared_ptr<Session>
- getSession(SessionID sessionID,
- RetrieveOption option = RetrieveOption::BMC_SESSION_ID);
+ std::shared_ptr<Session> getSession(
+ SessionID sessionID,
+ RetrieveOption option = RetrieveOption::BMC_SESSION_ID);
uint8_t getActiveSessionCount() const;
uint8_t getSessionHandle(SessionID bmcSessionID) const;
uint8_t storeSessionHandle(SessionID bmcSessionID);