clang-format: update to latest from docs repo
This is from openbmc/docs/style/cpp/.clang-format
Other OpenBMC repos are doing the same.
Tested: Built and validator passed.
Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/.clang-format b/.clang-format
index d17cf52..52ac0a1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,7 +5,7 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
+AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
@@ -14,14 +14,13 @@
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
- AfterCaseLabel: true
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -30,20 +29,27 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
@@ -52,17 +58,21 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -80,12 +90,17 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
SortIncludes: true
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -93,7 +108,8 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
+
diff --git a/http/app.h b/http/app.h
index 1e5f985..ca871dc 100644
--- a/http/app.h
+++ b/http/app.h
@@ -1,5 +1,12 @@
#pragma once
+#include "http_request.h"
+#include "http_server.h"
+#include "logging.h"
+#include "middleware_context.h"
+#include "routing.h"
+#include "utility.h"
+
#include "privileges.hpp"
#include <chrono>
@@ -10,13 +17,6 @@
#include <string>
#include <utility>
-#include "http_request.h"
-#include "http_server.h"
-#include "logging.h"
-#include "middleware_context.h"
-#include "routing.h"
-#include "utility.h"
-
#define BMCWEB_ROUTE(app, url) \
app.template route<crow::black_magic::get_parameter_tag(url)>(url)
@@ -25,7 +25,8 @@
#ifdef BMCWEB_ENABLE_SSL
using ssl_context_t = boost::asio::ssl::context;
#endif
-template <typename... Middlewares> class Crow
+template <typename... Middlewares>
+class Crow
{
public:
using self_t = Crow;
@@ -41,8 +42,7 @@
explicit Crow(std::shared_ptr<boost::asio::io_context> ioIn =
std::make_shared<boost::asio::io_context>()) :
io(std::move(ioIn))
- {
- }
+ {}
~Crow()
{
this->stop();
@@ -64,7 +64,8 @@
return router.newRuleDynamic(rule);
}
- template <uint64_t Tag> auto& route(std::string&& rule)
+ template <uint64_t Tag>
+ auto& route(std::string&& rule)
{
return router.newRuleTagged<Tag>(std::move(rule));
}
@@ -190,7 +191,8 @@
std::shared_ptr<ssl_context_t> sslContext = nullptr;
#else
- template <typename T, typename... Remain> self_t& ssl_file(T&&, Remain&&...)
+ template <typename T, typename... Remain>
+ self_t& ssl_file(T&&, Remain&&...)
{
// We can't call .ssl() member function unless BMCWEB_ENABLE_SSL is
// defined.
@@ -201,7 +203,8 @@
return *this;
}
- template <typename T> self_t& ssl(T&&)
+ template <typename T>
+ self_t& ssl(T&&)
{
// We can't call .ssl() member function unless BMCWEB_ENABLE_SSL is
// defined.
@@ -215,7 +218,8 @@
// middleware
using context_t = detail::Context<Middlewares...>;
- template <typename T> typename T::Context& getContext(const Request& req)
+ template <typename T>
+ typename T::Context& getContext(const Request& req)
{
static_assert(black_magic::Contains<T, Middlewares...>::value,
"App doesn't have the specified middleware type.");
@@ -223,12 +227,14 @@
return ctx.template get<T>();
}
- template <typename T> T& getMiddleware()
+ template <typename T>
+ T& getMiddleware()
{
return utility::getElementByType<T, Middlewares...>(middlewares);
}
- template <typename Duration, typename Func> self_t& tick(Duration d, Func f)
+ template <typename Duration, typename Func>
+ self_t& tick(Duration d, Func f)
{
tickInterval = std::chrono::duration_cast<std::chrono::milliseconds>(d);
tickFunction = f;
@@ -257,6 +263,7 @@
std::unique_ptr<server_t> server;
#endif
};
-template <typename... Middlewares> using App = Crow<Middlewares...>;
+template <typename... Middlewares>
+using App = Crow<Middlewares...>;
using SimpleApp = Crow<>;
} // namespace crow
diff --git a/http/common.h b/http/common.h
index 77c2074..47df7e6 100644
--- a/http/common.h
+++ b/http/common.h
@@ -1,13 +1,14 @@
#pragma once
+#include "utility.h"
+
#include <boost/beast/http/verb.hpp>
+
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
-#include "utility.h"
-
namespace crow
{
@@ -81,20 +82,24 @@
std::cerr << std::endl;
}
- template <typename T> T get(unsigned) const;
+ template <typename T>
+ T get(unsigned) const;
};
-template <> inline int64_t RoutingParams::get<int64_t>(unsigned index) const
+template <>
+inline int64_t RoutingParams::get<int64_t>(unsigned index) const
{
return intParams[index];
}
-template <> inline uint64_t RoutingParams::get<uint64_t>(unsigned index) const
+template <>
+inline uint64_t RoutingParams::get<uint64_t>(unsigned index) const
{
return uintParams[index];
}
-template <> inline double RoutingParams::get<double>(unsigned index) const
+template <>
+inline double RoutingParams::get<double>(unsigned index) const
{
return doubleParams[index];
}
diff --git a/http/http_client.hpp b/http/http_client.hpp
index caaaccb..8b1fb5c 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -18,6 +18,7 @@
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
+
#include <cstdlib>
#include <functional>
#include <iostream>
diff --git a/http/http_connection.h b/http/http_connection.h
index 6d28405..1a8f6cd 100644
--- a/http/http_connection.h
+++ b/http/http_connection.h
@@ -3,29 +3,32 @@
#include "http_utility.hpp"
-#include <atomic>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/beast/core/flat_static_buffer.hpp>
+
+#include <atomic>
#if BOOST_VERSION >= 107000
#include <boost/beast/ssl/ssl_stream.hpp>
#else
#include <boost/beast/experimental/core/ssl_stream.hpp>
#endif
-#include <boost/beast/http.hpp>
-#include <boost/beast/websocket.hpp>
-#include <chrono>
-#include <vector>
-
#include "http_response.h"
#include "logging.h"
#include "middleware_context.h"
#include "timer_queue.h"
#include "utility.h"
+#include <boost/beast/http.hpp>
+#include <boost/beast/websocket.hpp>
+#include <ssl_key_handler.hpp>
+
+#include <chrono>
+#include <vector>
+
namespace crow
{
@@ -64,45 +67,46 @@
namespace detail
{
-template <typename MW> struct CheckBeforeHandleArity3Const
+template <typename MW>
+struct CheckBeforeHandleArity3Const
{
template <typename T,
void (T::*)(Request&, Response&, typename MW::Context&) const =
&T::beforeHandle>
struct Get
- {
- };
+ {};
};
-template <typename MW> struct CheckBeforeHandleArity3
+template <typename MW>
+struct CheckBeforeHandleArity3
{
template <typename T, void (T::*)(Request&, Response&,
typename MW::Context&) = &T::beforeHandle>
struct Get
- {
- };
+ {};
};
-template <typename MW> struct CheckAfterHandleArity3Const
+template <typename MW>
+struct CheckAfterHandleArity3Const
{
template <typename T,
void (T::*)(Request&, Response&, typename MW::Context&) const =
&T::afterHandle>
struct Get
- {
- };
+ {};
};
-template <typename MW> struct CheckAfterHandleArity3
+template <typename MW>
+struct CheckAfterHandleArity3
{
template <typename T, void (T::*)(Request&, Response&,
typename MW::Context&) = &T::afterHandle>
struct Get
- {
- };
+ {};
};
-template <typename T> struct IsBeforeHandleArity3Impl
+template <typename T>
+struct IsBeforeHandleArity3Impl
{
template <typename C>
static std::true_type
@@ -112,13 +116,15 @@
static std::true_type
f(typename CheckBeforeHandleArity3<T>::template Get<C>*);
- template <typename C> static std::false_type f(...);
+ template <typename C>
+ static std::false_type f(...);
public:
static constexpr bool value = decltype(f<T>(nullptr))::value;
};
-template <typename T> struct IsAfterHandleArity3Impl
+template <typename T>
+struct IsAfterHandleArity3Impl
{
template <typename C>
static std::true_type
@@ -128,7 +134,8 @@
static std::true_type
f(typename CheckAfterHandleArity3<T>::template Get<C>*);
- template <typename C> static std::false_type f(...);
+ template <typename C>
+ static std::false_type f(...);
public:
static constexpr bool value = decltype(f<T>(nullptr))::value;
@@ -207,8 +214,7 @@
typename std::enable_if<(N < 0)>::type
afterHandlersCallHelper(Container& /*middlewares*/, Context& /*Context*/,
Request& /*req*/, Response& /*res*/)
-{
-}
+{}
template <size_t N, typename Context, typename Container>
typename std::enable_if<(N == 0)>::type
@@ -248,8 +254,9 @@
1024 * 1024 * BMCWEB_HTTP_REQ_BODY_LIMIT_MB;
template <typename Adaptor, typename Handler, typename... Middlewares>
-class Connection : public std::enable_shared_from_this<
- Connection<Adaptor, Handler, Middlewares...>>
+class Connection :
+ public std::enable_shared_from_this<
+ Connection<Adaptor, Handler, Middlewares...>>
{
public:
Connection(boost::asio::io_context& ioService, Handler* handlerIn,
diff --git a/http/http_request.h b/http/http_request.h
index 0dd7e35..67cc944 100644
--- a/http/http_request.h
+++ b/http/http_request.h
@@ -1,14 +1,14 @@
#pragma once
+#include "common.h"
+#include "query_string.h"
+
#include "sessions.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/websocket.hpp>
-#include "common.h"
-#include "query_string.h"
-
#if BOOST_VERSION >= 107000
#include <boost/beast/ssl/ssl_stream.hpp>
#else
@@ -45,8 +45,7 @@
boost::beast::http::request<boost::beast::http::string_body>& reqIn) :
req(reqIn),
fields(reqIn.base()), body(reqIn.body())
- {
- }
+ {}
boost::beast::http::verb method() const
{
diff --git a/http/http_response.h b/http/http_response.h
index 6d7ca26..d5d1e4b 100644
--- a/http/http_response.h
+++ b/http/http_response.h
@@ -1,11 +1,12 @@
#pragma once
+#include "http_request.h"
+#include "logging.h"
+
#include "nlohmann/json.hpp"
#include <boost/beast/http.hpp>
-#include <string>
-#include "http_request.h"
-#include "logging.h"
+#include <string>
namespace crow
{
@@ -35,8 +36,7 @@
}
Response() : stringResponse(response_type{})
- {
- }
+ {}
Response(Response&& r)
{
diff --git a/http/http_server.h b/http/http_server.h
index 6e63cbd..50e96c2 100644
--- a/http/http_server.h
+++ b/http/http_server.h
@@ -1,31 +1,33 @@
#pragma once
-#include <atomic>
#include <boost/asio/ip/address.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/asio/ssl/context.hpp>
#include <boost/asio/steady_timer.hpp>
+
+#include <atomic>
#if BOOST_VERSION >= 107000
#include <boost/beast/ssl/ssl_stream.hpp>
#else
#include <boost/beast/experimental/core/ssl_stream.hpp>
#endif
+#include "http_connection.h"
+#include "logging.h"
+#include "timer_queue.h"
+
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <ssl_key_handler.hpp>
+
#include <chrono>
#include <cstdint>
#include <filesystem>
#include <future>
#include <memory>
-#include <ssl_key_handler.hpp>
#include <utility>
#include <vector>
-#include "http_connection.h"
-#include "logging.h"
-#include "timer_queue.h"
-
namespace crow
{
using namespace boost;
@@ -46,8 +48,7 @@
signals(*ioService, SIGINT, SIGTERM, SIGHUP), tickTimer(*ioService),
timer(*ioService), handler(handler), middlewares(middlewares),
adaptorCtx(adaptor_ctx)
- {
- }
+ {}
Server(Handler* handler, const std::string& bindaddr, uint16_t port,
std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
@@ -59,8 +60,7 @@
*io, tcp::endpoint(boost::asio::ip::make_address(bindaddr),
port)),
adaptor_ctx, middlewares, io)
- {
- }
+ {}
Server(Handler* handler, int existing_socket,
std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
@@ -71,8 +71,7 @@
std::make_unique<tcp::acceptor>(*io, boost::asio::ip::tcp::v6(),
existing_socket),
adaptor_ctx, middlewares, io)
- {
- }
+ {}
void setTickFunction(std::chrono::milliseconds d, std::function<void()> f)
{
diff --git a/http/logging.h b/http/logging.h
index eb04cc1..fcac94d 100644
--- a/http/logging.h
+++ b/http/logging.h
@@ -62,7 +62,8 @@
}
//
- template <typename T> logger& operator<<(T const& value)
+ template <typename T>
+ logger& operator<<(T const& value)
{
if (level >= get_current_log_level())
{
diff --git a/http/middleware_context.h b/http/middleware_context.h
index fbe1d80..fa399d6 100644
--- a/http/middleware_context.h
+++ b/http/middleware_context.h
@@ -9,10 +9,10 @@
namespace detail
{
template <typename... Middlewares>
-struct PartialContext
- : public black_magic::PopBack<Middlewares...>::template rebind<
- PartialContext>,
- public black_magic::LastElementType<Middlewares...>::type::Context
+struct PartialContext :
+ public black_magic::PopBack<Middlewares...>::template rebind<
+ PartialContext>,
+ public black_magic::LastElementType<Middlewares...>::type::Context
{
using parent_context = typename black_magic::PopBack<
Middlewares...>::template rebind<::crow::detail::PartialContext>;
@@ -21,15 +21,18 @@
N == sizeof...(Middlewares) - 1, PartialContext,
typename parent_context::template partial<N>>::type;
- template <typename T> typename T::Context& get()
+ template <typename T>
+ typename T::Context& get()
{
return static_cast<typename T::Context&>(*this);
}
};
-template <> struct PartialContext<>
+template <>
+struct PartialContext<>
{
- template <size_t> using partial = PartialContext;
+ template <size_t>
+ using partial = PartialContext;
};
template <size_t N, typename Context, typename Container, typename CurrentMW,
@@ -55,7 +58,8 @@
friend bool middlewareCallHelper(Container& middlewares, Request& req,
Response& res, Context& ctx);
- template <typename T> typename T::Context& get()
+ template <typename T>
+ typename T::Context& get()
{
return static_cast<typename T::Context&>(*this);
}
diff --git a/http/routing.h b/http/routing.h
index cc5c75f..b2729ef 100644
--- a/http/routing.h
+++ b/http/routing.h
@@ -1,5 +1,12 @@
#pragma once
+#include "common.h"
+#include "http_request.h"
+#include "http_response.h"
+#include "logging.h"
+#include "utility.h"
+#include "websocket.h"
+
#include "error_messages.hpp"
#include "privileges.hpp"
#include "sessions.hpp"
@@ -8,6 +15,7 @@
#include <boost/container/flat_map.hpp>
#include <boost/container/small_vector.hpp>
#include <boost/lexical_cast.hpp>
+
#include <cerrno>
#include <cstdint>
#include <cstdlib>
@@ -17,13 +25,6 @@
#include <utility>
#include <vector>
-#include "common.h"
-#include "http_request.h"
-#include "http_response.h"
-#include "logging.h"
-#include "utility.h"
-#include "websocket.h"
-
namespace crow
{
@@ -34,8 +35,7 @@
{
public:
BaseRule(std::string thisRule) : rule(std::move(thisRule))
- {
- }
+ {}
virtual ~BaseRule() = default;
@@ -99,20 +99,23 @@
std::unique_ptr<BaseRule> ruleToUpgrade;
friend class Router;
- template <typename T> friend struct RuleParameterTraits;
+ template <typename T>
+ friend struct RuleParameterTraits;
};
namespace detail
{
namespace routing_handler_call_helper
{
-template <typename T, int Pos> struct CallPair
+template <typename T, int Pos>
+struct CallPair
{
using type = T;
static const int pos = Pos;
};
-template <typename H1> struct CallParams
+template <typename H1>
+struct CallParams
{
H1& handler;
const RoutingParams& params;
@@ -123,8 +126,7 @@
template <typename F, int NInt, int NUint, int NDouble, int NString,
typename S1, typename S2>
struct Call
-{
-};
+{};
template <typename F, int NInt, int NUint, int NDouble, int NString,
typename... Args1, typename... Args2>
@@ -195,7 +197,8 @@
}
};
-template <typename Func, typename... ArgsWrapped> struct Wrapped
+template <typename Func, typename... ArgsWrapped>
+struct Wrapped
{
template <typename... Args>
void set(
@@ -213,11 +216,11 @@
};
}
- template <typename Req, typename... Args> struct ReqHandlerWrapper
+ template <typename Req, typename... Args>
+ struct ReqHandlerWrapper
{
ReqHandlerWrapper(Func f) : f(std::move(f))
- {
- }
+ {}
void operator()(const Request& req, Response& res, Args... args)
{
@@ -264,7 +267,8 @@
handler = std::move(f);
}
- template <typename... Args> struct HandlerTypeHelper
+ template <typename... Args>
+ struct HandlerTypeHelper
{
using type =
std::function<void(const crow::Request&, crow::Response&, Args...)>;
@@ -312,12 +316,10 @@
public:
WebSocketRule(std::string rule) : BaseRule(std::move(rule))
- {
- }
+ {}
void validate() override
- {
- }
+ {}
void handle(const Request&, Response& res, const RoutingParams&) override
{
@@ -351,25 +353,29 @@
}
#endif
- template <typename Func> self_t& onopen(Func f)
+ template <typename Func>
+ self_t& onopen(Func f)
{
openHandler = f;
return *this;
}
- template <typename Func> self_t& onmessage(Func f)
+ template <typename Func>
+ self_t& onmessage(Func f)
{
messageHandler = f;
return *this;
}
- template <typename Func> self_t& onclose(Func f)
+ template <typename Func>
+ self_t& onclose(Func f)
{
closeHandler = f;
return *this;
}
- template <typename Func> self_t& onerror(Func f)
+ template <typename Func>
+ self_t& onerror(Func f)
{
errorHandler = f;
return *this;
@@ -386,7 +392,8 @@
std::function<void(crow::websocket::Connection&)> errorHandler;
};
-template <typename T> struct RuleParameterTraits
+template <typename T>
+struct RuleParameterTraits
{
using self_t = T;
WebSocketRule& websocket()
@@ -444,8 +451,7 @@
{
public:
DynamicRule(std::string rule) : BaseRule(std::move(rule))
- {
- }
+ {}
void validate() override
{
@@ -462,7 +468,8 @@
erasedHandler(req, res, params);
}
- template <typename Func> void operator()(Func f)
+ template <typename Func>
+ void operator()(Func f)
{
using function_t = utility::function_traits<Func>;
@@ -497,7 +504,8 @@
return ret;
}
- template <typename Func> void operator()(std::string name, Func&& f)
+ template <typename Func>
+ void operator()(std::string name, Func&& f)
{
nameStr = std::move(name);
(*this).template operator()<Func>(std::forward(f));
@@ -509,15 +517,15 @@
};
template <typename... Args>
-class TaggedRule : public BaseRule,
- public RuleParameterTraits<TaggedRule<Args...>>
+class TaggedRule :
+ public BaseRule,
+ public RuleParameterTraits<TaggedRule<Args...>>
{
public:
using self_t = TaggedRule<Args...>;
TaggedRule(std::string ruleIn) : BaseRule(std::move(ruleIn))
- {
- }
+ {}
void validate() override
{
@@ -606,7 +614,8 @@
handler = std::move(f);
}
- template <typename Func> void operator()(std::string name, Func&& f)
+ template <typename Func>
+ void operator()(std::string name, Func&& f)
{
nameStr = std::move(name);
(*this).template operator()<Func>(std::forward(f));
@@ -647,8 +656,7 @@
};
Trie() : nodes(1)
- {
- }
+ {}
private:
void optimizeNode(Node* node)
@@ -1406,8 +1414,7 @@
// rule index 0, 1 has special meaning; preallocate it to avoid
// duplication.
PerMethod() : rules(2)
- {
- }
+ {}
};
std::array<PerMethod, maxHttpVerbCount> perMethods;
std::vector<std::unique_ptr<BaseRule>> allRules;
diff --git a/http/timer_queue.h b/http/timer_queue.h
index b61c188..f2a933b 100644
--- a/http/timer_queue.h
+++ b/http/timer_queue.h
@@ -1,12 +1,13 @@
#pragma once
+#include "logging.h"
+
#include <boost/circular_buffer.hpp>
#include <boost/circular_buffer/space_optimized.hpp>
+
#include <chrono>
#include <functional>
-#include "logging.h"
-
namespace crow
{
namespace detail
diff --git a/http/utility.h b/http/utility.h
index c71187d..59abc8d 100644
--- a/http/utility.h
+++ b/http/utility.h
@@ -19,8 +19,7 @@
struct OutOfRange
{
OutOfRange(unsigned /*pos*/, unsigned /*length*/)
- {
- }
+ {}
};
constexpr unsigned requiresInRange(unsigned i, unsigned len)
{
@@ -124,7 +123,8 @@
return isEquN(s, i, "<path>", 0, 6);
}
-template <typename T> constexpr int getParameterTag()
+template <typename T>
+constexpr int getParameterTag()
{
if constexpr (std::is_same_v<int, T>)
{
@@ -177,9 +177,11 @@
return 0;
}
-template <typename... Args> struct compute_parameter_tag_from_args_list;
+template <typename... Args>
+struct compute_parameter_tag_from_args_list;
-template <> struct compute_parameter_tag_from_args_list<>
+template <>
+struct compute_parameter_tag_from_args_list<>
{
static constexpr int value = 0;
};
@@ -305,110 +307,132 @@
: get_parameter_tag(s, p + 1);
}
-template <typename... T> struct S
+template <typename... T>
+struct S
{
- template <typename U> using push = S<U, T...>;
- template <typename U> using push_back = S<T..., U>;
- template <template <typename... Args> class U> using rebind = U<T...>;
+ template <typename U>
+ using push = S<U, T...>;
+ template <typename U>
+ using push_back = S<T..., U>;
+ template <template <typename... Args> class U>
+ using rebind = U<T...>;
};
-template <typename F, typename Set> struct CallHelper;
-template <typename F, typename... Args> struct CallHelper<F, S<Args...>>
+template <typename F, typename Set>
+struct CallHelper;
+template <typename F, typename... Args>
+struct CallHelper<F, S<Args...>>
{
template <typename F1, typename... Args1,
typename = decltype(std::declval<F1>()(std::declval<Args1>()...))>
static char __test(int);
- template <typename...> static int __test(...);
+ template <typename...>
+ static int __test(...);
static constexpr bool value = sizeof(__test<F, Args...>(0)) == sizeof(char);
};
-template <uint64_t N> struct SingleTagToType
-{
-};
+template <uint64_t N>
+struct SingleTagToType
+{};
-template <> struct SingleTagToType<1>
+template <>
+struct SingleTagToType<1>
{
using type = int64_t;
};
-template <> struct SingleTagToType<2>
+template <>
+struct SingleTagToType<2>
{
using type = uint64_t;
};
-template <> struct SingleTagToType<3>
+template <>
+struct SingleTagToType<3>
{
using type = double;
};
-template <> struct SingleTagToType<4>
+template <>
+struct SingleTagToType<4>
{
using type = std::string;
};
-template <> struct SingleTagToType<5>
+template <>
+struct SingleTagToType<5>
{
using type = std::string;
};
-template <uint64_t Tag> struct Arguments
+template <uint64_t Tag>
+struct Arguments
{
using subarguments = typename Arguments<Tag / 6>::type;
using type = typename subarguments::template push<
typename SingleTagToType<Tag % 6>::type>;
};
-template <> struct Arguments<0>
+template <>
+struct Arguments<0>
{
using type = S<>;
};
-template <typename... T> struct LastElementType
+template <typename... T>
+struct LastElementType
{
using type =
typename std::tuple_element<sizeof...(T) - 1, std::tuple<T...>>::type;
};
-template <> struct LastElementType<>
-{
-};
+template <>
+struct LastElementType<>
+{};
// from
// http://stackoverflow.com/questions/13072359/c11-compile-time-array-with-logarithmic-evaluation-depth
-template <class T> using Invoke = typename T::type;
+template <class T>
+using Invoke = typename T::type;
-template <unsigned...> struct Seq
+template <unsigned...>
+struct Seq
{
using type = Seq;
};
-template <class S1, class S2> struct concat;
+template <class S1, class S2>
+struct concat;
template <unsigned... I1, unsigned... I2>
struct concat<Seq<I1...>, Seq<I2...>> : Seq<I1..., (sizeof...(I1) + I2)...>
-{
-};
+{};
-template <class S1, class S2> using Concat = Invoke<concat<S1, S2>>;
+template <class S1, class S2>
+using Concat = Invoke<concat<S1, S2>>;
-template <size_t N> struct gen_seq;
-template <size_t N> using GenSeq = Invoke<gen_seq<N>>;
+template <size_t N>
+struct gen_seq;
+template <size_t N>
+using GenSeq = Invoke<gen_seq<N>>;
-template <size_t N> struct gen_seq : Concat<GenSeq<N / 2>, GenSeq<N - N / 2>>
-{
-};
+template <size_t N>
+struct gen_seq : Concat<GenSeq<N / 2>, GenSeq<N - N / 2>>
+{};
-template <> struct gen_seq<0> : Seq<>
-{
-};
-template <> struct gen_seq<1> : Seq<0>
-{
-};
+template <>
+struct gen_seq<0> : Seq<>
+{};
+template <>
+struct gen_seq<1> : Seq<0>
+{};
-template <typename Seq, typename Tuple> struct PopBackHelper;
+template <typename Seq, typename Tuple>
+struct PopBackHelper;
-template <unsigned... N, typename Tuple> struct PopBackHelper<Seq<N...>, Tuple>
+template <unsigned... N, typename Tuple>
+struct PopBackHelper<Seq<N...>, Tuple>
{
template <template <typename... Args> class U>
using rebind = U<typename std::tuple_element<N, Tuple>::type...>;
@@ -424,39 +448,42 @@
std::tuple<T...>>::template rebind<U>;
};
-template <> struct PopBack<>
+template <>
+struct PopBack<>
{
- template <template <typename... Args> class U> using rebind = U<>;
+ template <template <typename... Args> class U>
+ using rebind = U<>;
};
// from
// http://stackoverflow.com/questions/2118541/check-if-c0x-parameter-pack-contains-a-type
-template <typename Tp, typename... List> struct Contains : std::true_type
-{
-};
+template <typename Tp, typename... List>
+struct Contains : std::true_type
+{};
template <typename Tp, typename Head, typename... Rest>
-struct Contains<Tp, Head, Rest...>
- : std::conditional<std::is_same<Tp, Head>::value, std::true_type,
- Contains<Tp, Rest...>>::type
-{
-};
+struct Contains<Tp, Head, Rest...> :
+ std::conditional<std::is_same<Tp, Head>::value, std::true_type,
+ Contains<Tp, Rest...>>::type
+{};
-template <typename Tp> struct Contains<Tp> : std::false_type
-{
-};
+template <typename Tp>
+struct Contains<Tp> : std::false_type
+{};
-template <typename T> struct EmptyContext
-{
-};
+template <typename T>
+struct EmptyContext
+{};
-template <typename T> struct promote
+template <typename T>
+struct promote
{
using type = T;
};
#define BMCWEB_INTERNAL_PROMOTE_TYPE(t1, t2) \
- template <> struct promote<t1> \
+ template <> \
+ struct promote<t1> \
{ \
using type = t2; \
}
@@ -474,7 +501,8 @@
BMCWEB_INTERNAL_PROMOTE_TYPE(float, double);
#undef BMCWEB_INTERNAL_PROMOTE_TYPE
-template <typename T> using promote_t = typename promote<T>::type;
+template <typename T>
+using promote_t = typename promote<T>::type;
} // namespace black_magic
@@ -504,13 +532,15 @@
namespace utility
{
-template <class T, class... Args> T& getElementByType(std::tuple<Args...>& t)
+template <class T, class... Args>
+T& getElementByType(std::tuple<Args...>& t)
{
return std::get<
detail::GetIndexOfElementFromTupleByTypeImpl<T, 0, Args...>::value>(t);
}
-template <typename T> struct function_traits;
+template <typename T>
+struct function_traits;
template <typename T>
struct function_traits : public function_traits<decltype(&T::operator())>
@@ -518,7 +548,8 @@
using parent_t = function_traits<decltype(&T::operator())>;
static const size_t arity = parent_t::arity;
using result_type = typename parent_t::result_type;
- template <size_t i> using arg = typename parent_t::template arg<i>;
+ template <size_t i>
+ using arg = typename parent_t::template arg<i>;
};
template <typename ClassType, typename r, typename... Args>
diff --git a/http/websocket.h b/http/websocket.h
index ad090e0..b89a74b 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -1,12 +1,13 @@
#pragma once
-#include <array>
+#include "http_request.h"
+
#include <async_resp.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/beast/websocket.hpp>
-#include <functional>
-#include "http_request.h"
+#include <array>
+#include <functional>
#ifdef BMCWEB_ENABLE_SSL
#include <boost/beast/websocket/ssl.hpp>
@@ -56,7 +57,8 @@
void* userdataPtr;
};
-template <typename Adaptor> class ConnectionImpl : public Connection
+template <typename Adaptor>
+class ConnectionImpl : public Connection
{
public:
ConnectionImpl(
diff --git a/include/async_resp.hpp b/include/async_resp.hpp
index 78994cf..f596dcd 100644
--- a/include/async_resp.hpp
+++ b/include/async_resp.hpp
@@ -14,13 +14,11 @@
{
public:
AsyncResp(crow::Response& response) : res(response)
- {
- }
+ {}
AsyncResp(crow::Response& response, std::function<void()>&& function) :
res(response), func(std::move(function))
- {
- }
+ {}
~AsyncResp()
{
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 1747810..4cc5b06 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -9,11 +9,13 @@
#include <openbmc_dbus_rest.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message/types.hpp>
+
#include <variant>
namespace nlohmann
{
-template <typename... Args> struct adl_serializer<std::variant<Args...>>
+template <typename... Args>
+struct adl_serializer<std::variant<Args...>>
{
static void to_json(json& j, const std::variant<Args...>& v)
{
@@ -112,7 +114,8 @@
return 0;
}
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
BMCWEB_ROUTE(app, "/subscribe")
.requires({"Login"})
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index ddf1e61..e1360f7 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -15,9 +15,10 @@
*/
#pragma once
-#include <regex>
#include <sdbusplus/message.hpp>
+#include <regex>
+
namespace dbus
{
diff --git a/include/dump_offload.hpp b/include/dump_offload.hpp
index 0c470b4..1b956e7 100644
--- a/include/dump_offload.hpp
+++ b/include/dump_offload.hpp
@@ -6,6 +6,7 @@
#include <boost/beast/core/flat_static_buffer.hpp>
#include <boost/beast/http.hpp>
#include <boost/process.hpp>
+
#include <cstdio>
#include <cstdlib>
@@ -39,12 +40,10 @@
boost::beast::flat_static_buffer<nbdBufferSize>>()),
inputBuffer(
std::make_unique<boost::beast::flat_static_buffer<nbdBufferSize>>())
- {
- }
+ {}
~Handler()
- {
- }
+ {}
/**
* @brief Invokes InitiateOffload method of dump manager which
diff --git a/include/http_utility.hpp b/include/http_utility.hpp
index 6f55c59..88b0247 100644
--- a/include/http_utility.hpp
+++ b/include/http_utility.hpp
@@ -1,8 +1,8 @@
#pragma once
-#include <boost/algorithm/string.hpp>
-
#include "http_request.h"
+#include <boost/algorithm/string.hpp>
+
namespace http_helpers
{
inline bool requestPrefersHtml(const crow::Request& req)
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 3c4f8ec..6e9421f 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -5,9 +5,10 @@
#include <boost/algorithm/string.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/endian/conversion.hpp>
+#include <nlohmann/json.hpp>
+
#include <filesystem>
#include <fstream>
-#include <nlohmann/json.hpp>
namespace crow
{
@@ -36,7 +37,7 @@
using RcReleaseLockApi = std::pair<bool, std::variant<bool, RcRelaseLock>>;
using SessionFlags = std::pair<SType, SType>;
using ListOfSessionIds = std::vector<std::string>;
-static constexpr const char *fileName =
+static constexpr const char* fileName =
"/var/lib/obmc/bmc-console-mgmt/locks/ibm_mc_persistent_lock_data.json";
class Lock
@@ -106,22 +107,22 @@
* Returns : False (if the request HMC or Session does not own the lock(s))
*/
- virtual RcRelaseLock isItMyLock(const ListOfTransactionIds &,
- const SessionFlags &);
+ virtual RcRelaseLock isItMyLock(const ListOfTransactionIds&,
+ const SessionFlags&);
/*
* This function validates the the list of transactionID's and returns false
* if the transaction ID is not valid & not present in the lock table
*/
- virtual bool validateRids(const ListOfTransactionIds &);
+ virtual bool validateRids(const ListOfTransactionIds&);
/*
* This function releases the locks that are already obtained by the
* requesting Management console.
*/
- void releaseLock(const ListOfTransactionIds &);
+ void releaseLock(const ListOfTransactionIds&);
Lock()
{
@@ -165,31 +166,30 @@
* Client can choose either of the ways by using `Type` JSON key.
*
*/
- RcReleaseLockApi releaseLock(const ListOfTransactionIds &,
- const SessionFlags &);
+ RcReleaseLockApi releaseLock(const ListOfTransactionIds&,
+ const SessionFlags&);
/*
* This function implements the logic for getting the list of locks obtained
* by a particular management console.
*/
- RcGetLockList getLockList(const ListOfSessionIds &);
+ RcGetLockList getLockList(const ListOfSessionIds&);
/*
* This function is releases all the locks obtained by a particular
* session.
*/
- void releaseLock(const std::string &);
+ void releaseLock(const std::string&);
- static Lock &getInstance()
+ static Lock& getInstance()
{
static Lock lockObject;
return lockObject;
}
virtual ~Lock()
- {
- }
+ {}
};
inline bool Lock::createPersistentLockFilePath()
@@ -235,7 +235,7 @@
return;
}
BMCWEB_LOG_DEBUG << "The persistent lock data is available";
- for (const auto &item : data.items())
+ for (const auto& item : data.items())
{
BMCWEB_LOG_DEBUG << item.key();
BMCWEB_LOG_DEBUG << item.value();
@@ -265,7 +265,7 @@
fs::perms::owner_read | fs::perms::owner_write | fs::perms::group_read;
fs::permissions(fileName, permission);
nlohmann::json data;
- for (const auto &it : lockTable)
+ for (const auto& it : lockTable)
{
data[std::to_string(it.first)] = it.second;
}
@@ -273,14 +273,14 @@
persistentFile << data;
}
-inline RcGetLockList Lock::getLockList(const ListOfSessionIds &listSessionId)
+inline RcGetLockList Lock::getLockList(const ListOfSessionIds& listSessionId)
{
std::vector<std::pair<uint32_t, LockRequests>> lockList;
if (!lockTable.empty())
{
- for (const auto &i : listSessionId)
+ for (const auto& i : listSessionId)
{
auto it = lockTable.begin();
while (it != lockTable.end())
@@ -306,8 +306,8 @@
return lockList;
}
-inline RcReleaseLockApi Lock::releaseLock(const ListOfTransactionIds &p,
- const SessionFlags &ids)
+inline RcReleaseLockApi Lock::releaseLock(const ListOfTransactionIds& p,
+ const SessionFlags& ids)
{
bool status = validateRids(p);
@@ -339,7 +339,7 @@
// validate the lock request
- for (auto &lockRecord : lockRequestStructure)
+ for (auto& lockRecord : lockRequestStructure)
{
bool status = isValidLockRequest(lockRecord);
if (!status)
@@ -351,7 +351,7 @@
}
// check for conflict record
- const LockRequests &multiRequest = lockRequestStructure;
+ const LockRequests& multiRequest = lockRequestStructure;
bool status = isConflictRequest(multiRequest);
if (status)
@@ -374,9 +374,9 @@
return std::make_pair(true, std::make_pair(true, 1));
}
-inline void Lock::releaseLock(const ListOfTransactionIds &refRids)
+inline void Lock::releaseLock(const ListOfTransactionIds& refRids)
{
- for (const auto &id : refRids)
+ for (const auto& id : refRids)
{
if (lockTable.erase(id))
{
@@ -395,7 +395,7 @@
saveLocks();
}
-inline void Lock::releaseLock(const std::string &sessionId)
+inline void Lock::releaseLock(const std::string& sessionId)
{
bool isErased = false;
if (!lockTable.empty())
@@ -429,10 +429,10 @@
}
}
}
-inline RcRelaseLock Lock::isItMyLock(const ListOfTransactionIds &refRids,
- const SessionFlags &ids)
+inline RcRelaseLock Lock::isItMyLock(const ListOfTransactionIds& refRids,
+ const SessionFlags& ids)
{
- for (const auto &id : refRids)
+ for (const auto& id : refRids)
{
// Just need to compare the client id of the first lock records in the
// complete lock row(in the map), because the rest of the lock records
@@ -456,9 +456,9 @@
return std::make_pair(true, std::make_pair(0, LockRequest()));
}
-inline bool Lock::validateRids(const ListOfTransactionIds &refRids)
+inline bool Lock::validateRids(const ListOfTransactionIds& refRids)
{
- for (const auto &id : refRids)
+ for (const auto& id : refRids)
{
auto search = lockTable.find(id);
@@ -505,7 +505,7 @@
int lockFlag = 0;
// validate the lockflags & segment length
- for (const auto &p : std::get<4>(refLockRecord))
+ for (const auto& p : std::get<4>(refLockRecord))
{
// validate the lock flags
@@ -571,11 +571,11 @@
// Lock table is not empty, compare the lockrequest entries with
// the entries in the lock table
- for (const auto &lockRecord1 : refLockRequestStructure)
+ for (const auto& lockRecord1 : refLockRequestStructure)
{
- for (const auto &map : lockTable)
+ for (const auto& map : lockTable)
{
- for (const auto &lockRecord2 : map.second)
+ for (const auto& lockRecord2 : map.second)
{
bool status = isConflictRecord(lockRecord1, lockRecord2);
if (status)
@@ -627,8 +627,8 @@
{
for (uint32_t j = i + 1; j < refLockRequestStructure.size(); j++)
{
- const LockRequest &p = refLockRequestStructure[i];
- const LockRequest &q = refLockRequestStructure[j];
+ const LockRequest& p = refLockRequestStructure[i];
+ const LockRequest& q = refLockRequestStructure[j];
bool status = isConflictRecord(p, q);
if (status)
@@ -652,8 +652,8 @@
inline bool Lock::checkByte(uint64_t resourceId1, uint64_t resourceId2,
uint32_t position)
{
- uint8_t *p = reinterpret_cast<uint8_t *>(&resourceId1);
- uint8_t *q = reinterpret_cast<uint8_t *>(&resourceId2);
+ uint8_t* p = reinterpret_cast<uint8_t*>(&resourceId1);
+ uint8_t* q = reinterpret_cast<uint8_t*>(&resourceId2);
BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(p[position]) << ","
<< std::to_string(q[position]);
@@ -685,7 +685,7 @@
else
{
uint32_t i = 0;
- for (const auto &p : std::get<4>(refLockRecord1))
+ for (const auto& p : std::get<4>(refLockRecord1))
{
// return conflict when any of them is try to lock all resources
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 9f8f8d2..e9805d6 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -6,14 +6,15 @@
#include <boost/algorithm/string.hpp>
#include <boost/container/flat_set.hpp>
#include <error_messages.hpp>
-#include <filesystem>
-#include <fstream>
#include <ibm/locks.hpp>
#include <nlohmann/json.hpp>
-#include <regex>
#include <sdbusplus/message/types.hpp>
#include <utils/json_utils.hpp>
+#include <filesystem>
+#include <fstream>
+#include <regex>
+
// Allow save area file size to 500KB
#define MAX_SAVE_AREA_FILESIZE 500000
@@ -29,12 +30,12 @@
{
namespace ibm_mc
{
-constexpr const char *methodNotAllowedMsg = "Method Not Allowed";
-constexpr const char *resourceNotFoundMsg = "Resource Not Found";
-constexpr const char *contentNotAcceptableMsg = "Content Not Acceptable";
-constexpr const char *internalServerError = "Internal Server Error";
+constexpr const char* methodNotAllowedMsg = "Method Not Allowed";
+constexpr const char* resourceNotFoundMsg = "Resource Not Found";
+constexpr const char* contentNotAcceptableMsg = "Content Not Acceptable";
+constexpr const char* internalServerError = "Internal Server Error";
-bool createSaveAreaPath(crow::Response &res)
+bool createSaveAreaPath(crow::Response& res)
{
// The path /var/lib/obmc will be created by initrdscripts
// Create the directories for the save-area files, when we get
@@ -71,8 +72,8 @@
}
return true;
}
-void handleFilePut(const crow::Request &req, crow::Response &res,
- const std::string &fileID)
+void handleFilePut(const crow::Request& req, crow::Response& res,
+ const std::string& fileID)
{
// Check the content-type of the request
std::string_view contentType = req.getHeaderValue("content-type");
@@ -129,13 +130,13 @@
}
}
-void handleConfigFileList(crow::Response &res)
+void handleConfigFileList(crow::Response& res)
{
std::vector<std::string> pathObjList;
std::filesystem::path loc("/var/lib/obmc/bmc-console-mgmt/save-area");
if (std::filesystem::exists(loc) && std::filesystem::is_directory(loc))
{
- for (const auto &file : std::filesystem::directory_iterator(loc))
+ for (const auto& file : std::filesystem::directory_iterator(loc))
{
std::filesystem::path pathObj(file.path());
pathObjList.push_back("/ibm/v1/Host/ConfigFiles/" +
@@ -154,7 +155,7 @@
res.end();
}
-void deleteConfigFiles(crow::Response &res)
+void deleteConfigFiles(crow::Response& res)
{
std::vector<std::string> pathObjList;
std::error_code ec;
@@ -174,7 +175,7 @@
res.end();
}
-void getLockServiceData(crow::Response &res)
+void getLockServiceData(crow::Response& res)
{
res.jsonValue["@odata.type"] = "#LockService.v1_0_0.LockService";
res.jsonValue["@odata.id"] = "/ibm/v1/HMC/LockService/";
@@ -190,7 +191,7 @@
res.end();
}
-void handleFileGet(crow::Response &res, const std::string &fileID)
+void handleFileGet(crow::Response& res, const std::string& fileID)
{
BMCWEB_LOG_DEBUG << "HandleGet on SaveArea files on path: " << fileID;
std::filesystem::path loc("/var/lib/obmc/bmc-console-mgmt/save-area/" +
@@ -222,7 +223,7 @@
return;
}
-void handleFileDelete(crow::Response &res, const std::string &fileID)
+void handleFileDelete(crow::Response& res, const std::string& fileID)
{
std::string filePath("/var/lib/obmc/bmc-console-mgmt/save-area/" + fileID);
BMCWEB_LOG_DEBUG << "Removing the file : " << filePath << "\n";
@@ -249,8 +250,8 @@
return;
}
-inline void handleFileUrl(const crow::Request &req, crow::Response &res,
- const std::string &fileID)
+inline void handleFileUrl(const crow::Request& req, crow::Response& res,
+ const std::string& fileID)
{
if (req.method() == "PUT"_method)
{
@@ -272,11 +273,11 @@
}
}
-void handleAcquireLockAPI(const crow::Request &req, crow::Response &res,
+void handleAcquireLockAPI(const crow::Request& req, crow::Response& res,
std::vector<nlohmann::json> body)
{
LockRequests lockRequestStructure;
- for (auto &element : body)
+ for (auto& element : body)
{
std::string lockType;
uint64_t resourceId;
@@ -298,7 +299,7 @@
BMCWEB_LOG_DEBUG << "Segment Flags are present";
- for (auto &e : segmentFlags)
+ for (auto& e : segmentFlags)
{
std::string lockFlags;
uint32_t segmentLength;
@@ -329,13 +330,13 @@
BMCWEB_LOG_DEBUG << std::get<2>(lockRequestStructure[i]);
BMCWEB_LOG_DEBUG << std::get<3>(lockRequestStructure[i]);
- for (const auto &p : std::get<4>(lockRequestStructure[i]))
+ for (const auto& p : std::get<4>(lockRequestStructure[i]))
{
BMCWEB_LOG_DEBUG << p.first << ", " << p.second;
}
}
- const LockRequests &t = lockRequestStructure;
+ const LockRequests& t = lockRequestStructure;
auto varAcquireLock = crow::ibm_mc_lock::Lock::getInstance().acquireLock(t);
@@ -407,7 +408,7 @@
}
}
}
-void handleRelaseAllAPI(const crow::Request &req, crow::Response &res)
+void handleRelaseAllAPI(const crow::Request& req, crow::Response& res)
{
crow::ibm_mc_lock::Lock::getInstance().releaseLock(req.session->uniqueId);
res.result(boost::beast::http::status::ok);
@@ -415,8 +416,8 @@
return;
}
-void handleReleaseLockAPI(const crow::Request &req, crow::Response &res,
- const std::vector<uint32_t> &listTransactionIds)
+void handleReleaseLockAPI(const crow::Request& req, crow::Response& res,
+ const std::vector<uint32_t>& listTransactionIds)
{
BMCWEB_LOG_DEBUG << listTransactionIds.size();
BMCWEB_LOG_DEBUG << "Data is present";
@@ -483,8 +484,8 @@
}
}
-void handleGetLockListAPI(const crow::Request &req, crow::Response &res,
- const ListOfSessionIds &listSessionIds)
+void handleGetLockListAPI(const crow::Request& req, crow::Response& res,
+ const ListOfSessionIds& listSessionIds)
{
BMCWEB_LOG_DEBUG << listSessionIds.size();
@@ -494,9 +495,9 @@
nlohmann::json lockRecords = nlohmann::json::array();
- for (const auto &transactionId : var)
+ for (const auto& transactionId : var)
{
- for (const auto &lockRecord : transactionId.second)
+ for (const auto& lockRecord : transactionId.second)
{
nlohmann::json returnJson;
@@ -509,7 +510,7 @@
nlohmann::json segments;
nlohmann::json segmentInfoArray = nlohmann::json::array();
- for (const auto &segment : std::get<4>(lockRecord))
+ for (const auto& segment : std::get<4>(lockRecord))
{
segments["LockFlag"] = segment.first;
segments["SegmentLength"] = segment.second;
@@ -525,14 +526,15 @@
res.end();
}
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...> &app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
// allowed only for admin
BMCWEB_ROUTE(app, "/ibm/v1/")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("GET"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
res.jsonValue["@odata.type"] =
"#ibmServiceRoot.v1_0_0.ibmServiceRoot";
res.jsonValue["@odata.id"] = "/ibm/v1/";
@@ -548,7 +550,7 @@
BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("GET"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
handleConfigFileList(res);
});
@@ -556,27 +558,27 @@
"/ibm/v1/Host/ConfigFiles/Actions/FileCollection.DeleteAll")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("POST"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
deleteConfigFiles(res);
});
BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("PUT"_method, "GET"_method, "DELETE"_method)(
- [](const crow::Request &req, crow::Response &res,
- const std::string &path) { handleFileUrl(req, res, path); });
+ [](const crow::Request& req, crow::Response& res,
+ const std::string& path) { handleFileUrl(req, res, path); });
BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("GET"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
getLockServiceData(res);
});
BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.AcquireLock")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("POST"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
std::vector<nlohmann::json> body;
if (!redfish::json_util::readJson(req, res, "Request", body))
{
@@ -590,7 +592,7 @@
BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods(
- "POST"_method)([](const crow::Request &req, crow::Response &res) {
+ "POST"_method)([](const crow::Request& req, crow::Response& res) {
std::string type;
std::vector<uint32_t> listTransactionIds;
@@ -620,7 +622,7 @@
BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("POST"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
ListOfSessionIds listSessionIds;
if (!redfish::json_util::readJson(req, res, "SessionIDs",
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 69e5637..64adccd 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -5,8 +5,9 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
-#include <cstdio>
#include <dbus_singleton.hpp>
+
+#include <cstdio>
#include <fstream>
#include <memory>
@@ -108,7 +109,8 @@
timeout.async_wait(timeoutHandler);
}
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
BMCWEB_ROUTE(app, "/upload/image/<str>")
.requires({"ConfigureComponents", "ConfigureManager"})
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 12fbb8e..4a9cfb8 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -22,11 +22,12 @@
#include <boost/beast/core/multi_buffer.hpp>
#include <boost/container/flat_map.hpp>
#include <dbus_utility.hpp>
-#include <experimental/filesystem>
#include <privileges.hpp>
-#include <variant>
#include <webserver_common.hpp>
+#include <experimental/filesystem>
+#include <variant>
+
namespace crow
{
@@ -47,8 +48,7 @@
endpointId(endpointIdIn), path(pathIn),
acceptor(connIn.get_io_context(), stream_protocol::endpoint(socketId)),
connection(connIn)
- {
- }
+ {}
~NbdProxyServer()
{
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 4de6ea0..456c768 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -21,10 +21,11 @@
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
+#include <sdbusplus/message/types.hpp>
+
#include <filesystem>
#include <fstream>
#include <regex>
-#include <sdbusplus/message/types.hpp>
namespace crow
{
@@ -35,23 +36,23 @@
std::pair<std::string,
std::vector<std::pair<std::string, std::vector<std::string>>>>>;
-const char *notFoundMsg = "404 Not Found";
-const char *badReqMsg = "400 Bad Request";
-const char *methodNotAllowedMsg = "405 Method Not Allowed";
-const char *forbiddenMsg = "403 Forbidden";
-const char *methodFailedMsg = "500 Method Call Failed";
-const char *methodOutputFailedMsg = "500 Method Output Error";
-const char *notFoundDesc =
+const char* notFoundMsg = "404 Not Found";
+const char* badReqMsg = "400 Bad Request";
+const char* methodNotAllowedMsg = "405 Method Not Allowed";
+const char* forbiddenMsg = "403 Forbidden";
+const char* methodFailedMsg = "500 Method Call Failed";
+const char* methodOutputFailedMsg = "500 Method Output Error";
+const char* notFoundDesc =
"org.freedesktop.DBus.Error.FileNotFound: path or object not found";
-const char *propNotFoundDesc = "The specified property cannot be found";
-const char *noJsonDesc = "No JSON object could be decoded";
-const char *methodNotFoundDesc = "The specified method cannot be found";
-const char *methodNotAllowedDesc = "Method not allowed";
-const char *forbiddenPropDesc = "The specified property cannot be created";
-const char *forbiddenResDesc = "The specified resource cannot be created";
+const char* propNotFoundDesc = "The specified property cannot be found";
+const char* noJsonDesc = "No JSON object could be decoded";
+const char* methodNotFoundDesc = "The specified method cannot be found";
+const char* methodNotAllowedDesc = "Method not allowed";
+const char* forbiddenPropDesc = "The specified property cannot be created";
+const char* forbiddenResDesc = "The specified resource cannot be created";
-void setErrorResponse(crow::Response &res, boost::beast::http::status result,
- const std::string &desc, const std::string_view msg)
+void setErrorResponse(crow::Response& res, boost::beast::http::status result,
+ const std::string& desc, const std::string_view msg)
{
res.result(result);
res.jsonValue = {{"data", {{"description", desc}}},
@@ -59,8 +60,8 @@
{"status", "error"}};
}
-void introspectObjects(const std::string &processName,
- const std::string &objectPath,
+void introspectObjects(const std::string& processName,
+ const std::string& objectPath,
std::shared_ptr<bmcweb::AsyncResp> transaction)
{
if (transaction->res.jsonValue.is_null())
@@ -74,7 +75,7 @@
[transaction, processName{std::string(processName)},
objectPath{std::string(objectPath)}](
const boost::system::error_code ec,
- const std::string &introspect_xml) {
+ const std::string& introspect_xml) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -89,7 +90,7 @@
tinyxml2::XMLDocument doc;
doc.Parse(introspect_xml.c_str());
- tinyxml2::XMLNode *pRoot = doc.FirstChildElement("node");
+ tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
if (pRoot == nullptr)
{
BMCWEB_LOG_ERROR << "XML document failed to parse "
@@ -97,10 +98,10 @@
}
else
{
- tinyxml2::XMLElement *node = pRoot->FirstChildElement("node");
+ tinyxml2::XMLElement* node = pRoot->FirstChildElement("node");
while (node != nullptr)
{
- const char *childPath = node->Attribute("name");
+ const char* childPath = node->Attribute("name");
if (childPath != nullptr)
{
std::string newpath;
@@ -121,20 +122,19 @@
"Introspect");
}
-void getPropertiesForEnumerate(const std::string &objectPath,
- const std::string &service,
- const std::string &interface,
+void getPropertiesForEnumerate(const std::string& objectPath,
+ const std::string& service,
+ const std::string& interface,
std::shared_ptr<bmcweb::AsyncResp> asyncResp)
{
BMCWEB_LOG_DEBUG << "getPropertiesForEnumerate " << objectPath << " "
<< service << " " << interface;
crow::connections::systemBus->async_method_call(
- [asyncResp, objectPath, service,
- interface](const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, dbus::utility::DbusVariantType>>
- &propertiesList) {
+ [asyncResp, objectPath, service, interface](
+ const boost::system::error_code ec,
+ const std::vector<std::pair<
+ std::string, dbus::utility::DbusVariantType>>& propertiesList) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetAll on path " << objectPath << " iface "
@@ -143,17 +143,17 @@
return;
}
- nlohmann::json &dataJson = asyncResp->res.jsonValue["data"];
- nlohmann::json &objectJson = dataJson[objectPath];
+ nlohmann::json& dataJson = asyncResp->res.jsonValue["data"];
+ nlohmann::json& objectJson = dataJson[objectPath];
if (objectJson.is_null())
{
objectJson = nlohmann::json::object();
}
- for (const auto &[name, value] : propertiesList)
+ for (const auto& [name, value] : propertiesList)
{
- nlohmann::json &propertyJson = objectJson[name];
- std::visit([&propertyJson](auto &&val) { propertyJson = val; },
+ nlohmann::json& propertyJson = objectJson[name];
+ std::visit([&propertyJson](auto&& val) { propertyJson = val; },
value);
}
},
@@ -164,13 +164,13 @@
// Find any results that weren't picked up by ObjectManagers, to be
// called after all ObjectManagers are searched for and called.
void findRemainingObjectsForEnumerate(
- const std::string &objectPath, std::shared_ptr<GetSubTreeType> subtree,
+ const std::string& objectPath, std::shared_ptr<GetSubTreeType> subtree,
std::shared_ptr<bmcweb::AsyncResp> asyncResp)
{
BMCWEB_LOG_DEBUG << "findRemainingObjectsForEnumerate";
- const nlohmann::json &dataJson = asyncResp->res.jsonValue["data"];
+ const nlohmann::json& dataJson = asyncResp->res.jsonValue["data"];
- for (const auto &[path, interface_map] : *subtree)
+ for (const auto& [path, interface_map] : *subtree)
{
if (path == objectPath)
{
@@ -179,9 +179,9 @@
}
if (dataJson.find(path) == dataJson.end())
{
- for (const auto &[service, interfaces] : interface_map)
+ for (const auto& [service, interfaces] : interface_map)
{
- for (const auto &interface : interfaces)
+ for (const auto& interface : interfaces)
{
if (!boost::starts_with(interface, "org.freedesktop.DBus"))
{
@@ -196,12 +196,11 @@
struct InProgressEnumerateData
{
- InProgressEnumerateData(const std::string &objectPath,
+ InProgressEnumerateData(const std::string& objectPath,
std::shared_ptr<bmcweb::AsyncResp> asyncResp) :
objectPath(objectPath),
asyncResp(asyncResp)
- {
- }
+ {}
~InProgressEnumerateData()
{
@@ -214,8 +213,8 @@
};
void getManagedObjectsForEnumerate(
- const std::string &object_name, const std::string &object_manager_path,
- const std::string &connection_name,
+ const std::string& object_name, const std::string& object_manager_path,
+ const std::string& connection_name,
std::shared_ptr<InProgressEnumerateData> transaction)
{
BMCWEB_LOG_DEBUG << "getManagedObjectsForEnumerate " << object_name
@@ -224,7 +223,7 @@
crow::connections::systemBus->async_method_call(
[transaction, object_name,
connection_name](const boost::system::error_code ec,
- const dbus::utility::ManagedObjectType &objects) {
+ const dbus::utility::ManagedObjectType& objects) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetManagedObjects on path " << object_name
@@ -233,33 +232,33 @@
return;
}
- nlohmann::json &dataJson =
+ nlohmann::json& dataJson =
transaction->asyncResp->res.jsonValue["data"];
- for (const auto &objectPath : objects)
+ for (const auto& objectPath : objects)
{
if (boost::starts_with(objectPath.first.str, object_name))
{
BMCWEB_LOG_DEBUG << "Reading object "
<< objectPath.first.str;
- nlohmann::json &objectJson = dataJson[objectPath.first.str];
+ nlohmann::json& objectJson = dataJson[objectPath.first.str];
if (objectJson.is_null())
{
objectJson = nlohmann::json::object();
}
- for (const auto &interface : objectPath.second)
+ for (const auto& interface : objectPath.second)
{
- for (const auto &property : interface.second)
+ for (const auto& property : interface.second)
{
- nlohmann::json &propertyJson =
+ nlohmann::json& propertyJson =
objectJson[property.first];
std::visit([&propertyJson](
- auto &&val) { propertyJson = val; },
+ auto&& val) { propertyJson = val; },
property.second);
}
}
}
- for (const auto &interface : objectPath.second)
+ for (const auto& interface : objectPath.second)
{
if (interface.first == "org.freedesktop.DBus.ObjectManager")
{
@@ -275,7 +274,7 @@
}
void findObjectManagerPathForEnumerate(
- const std::string &object_name, const std::string &connection_name,
+ const std::string& object_name, const std::string& connection_name,
std::shared_ptr<InProgressEnumerateData> transaction)
{
BMCWEB_LOG_DEBUG << "Finding objectmanager for path " << object_name
@@ -285,8 +284,8 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &objects) {
+ std::string, std::vector<std::string>>>&
+ objects) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetAncestors on path " << object_name
@@ -294,9 +293,9 @@
return;
}
- for (const auto &pathGroup : objects)
+ for (const auto& pathGroup : objects)
{
- for (const auto &connectionGroup : pathGroup.second)
+ for (const auto& connectionGroup : pathGroup.second)
{
if (connectionGroup.first == connection_name)
{
@@ -312,7 +311,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetAncestors", object_name,
- std::array<const char *, 1>{"org.freedesktop.DBus.ObjectManager"});
+ std::array<const char*, 1>{"org.freedesktop.DBus.ObjectManager"});
}
// Uses GetObject to add the object info about the target /enumerate path to
@@ -325,7 +324,7 @@
crow::connections::systemBus->async_method_call(
[transaction](const boost::system::error_code ec,
- const GetObjectType &objects) {
+ const GetObjectType& objects) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetObject for path "
@@ -346,13 +345,13 @@
// manager exists
boost::container::flat_map<std::string, std::string> connections;
- for (const auto &object : *(transaction->subtree))
+ for (const auto& object : *(transaction->subtree))
{
- for (const auto &connection : object.second)
+ for (const auto& connection : object.second)
{
- std::string &objectManagerPath =
+ std::string& objectManagerPath =
connections[connection.first];
- for (const auto &interface : connection.second)
+ for (const auto& interface : connection.second)
{
BMCWEB_LOG_DEBUG << connection.first
<< " has interface " << interface;
@@ -367,7 +366,7 @@
}
BMCWEB_LOG_DEBUG << "Got " << connections.size() << " connections";
- for (const auto &connection : connections)
+ for (const auto& connection : connections)
{
// If we already know where the object manager is, we don't
// need to search for it, we can call directly in to
@@ -390,13 +389,13 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- transaction->objectPath, std::array<const char *, 0>());
+ transaction->objectPath, std::array<const char*, 0>());
}
// Structure for storing data on an in progress action
struct InProgressActionData
{
- InProgressActionData(crow::Response &res) : res(res){};
+ InProgressActionData(crow::Response& res) : res(res){};
~InProgressActionData()
{
// Methods could have been called across different owners
@@ -440,12 +439,12 @@
res.end();
}
- void setErrorStatus(const std::string &desc)
+ void setErrorStatus(const std::string& desc)
{
setErrorResponse(res, boost::beast::http::status::bad_request, desc,
badReqMsg);
}
- crow::Response &res;
+ crow::Response& res;
std::string path;
std::string methodName;
std::string interfaceName;
@@ -457,7 +456,7 @@
nlohmann::json arguments;
};
-std::vector<std::string> dbusArgSplit(const std::string &string)
+std::vector<std::string> dbusArgSplit(const std::string& string)
{
std::vector<std::string> ret;
if (string.empty())
@@ -505,8 +504,8 @@
return ret;
}
-int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type,
- const nlohmann::json &input_json)
+int convertJsonToDbus(sd_bus_message* m, const std::string& arg_type,
+ const nlohmann::json& input_json)
{
int r = 0;
BMCWEB_LOG_DEBUG << "Converting " << input_json.dump()
@@ -514,10 +513,10 @@
const std::vector<std::string> argTypes = dbusArgSplit(arg_type);
// Assume a single object for now.
- const nlohmann::json *j = &input_json;
+ const nlohmann::json* j = &input_json;
nlohmann::json::const_iterator jIt = input_json.begin();
- for (const std::string &argCode : argTypes)
+ for (const std::string& argCode : argTypes)
{
// If we are decoding multiple objects, grab the pointer to the
// iterator, and increment it for the next loop
@@ -530,10 +529,10 @@
j = &*jIt;
jIt++;
}
- const int64_t *intValue = j->get_ptr<const int64_t *>();
- const std::string *stringValue = j->get_ptr<const std::string *>();
- const double *doubleValue = j->get_ptr<const double *>();
- const bool *b = j->get_ptr<const bool *>();
+ const int64_t* intValue = j->get_ptr<const int64_t*>();
+ const std::string* stringValue = j->get_ptr<const std::string*>();
+ const double* doubleValue = j->get_ptr<const double*>();
+ const bool* b = j->get_ptr<const bool*>();
int64_t v = 0;
double d = 0.0;
@@ -541,7 +540,7 @@
// converted to int. int and uint can be converted to double
if (intValue == nullptr)
{
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ const uint64_t* uintValue = j->get_ptr<const uint64_t*>();
if (uintValue != nullptr)
{
v = static_cast<int64_t>(*uintValue);
@@ -550,7 +549,7 @@
}
if (doubleValue == nullptr)
{
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ const uint64_t* uintValue = j->get_ptr<const uint64_t*>();
if (uintValue != nullptr)
{
d = static_cast<double>(*uintValue);
@@ -573,7 +572,7 @@
return -1;
}
r = sd_bus_message_append_basic(
- m, argCode[0], static_cast<const void *>(stringValue->data()));
+ m, argCode[0], static_cast<const void*>(stringValue->data()));
if (r < 0)
{
return r;
@@ -671,7 +670,7 @@
}
else if (argCode == "y")
{
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ const uint64_t* uintValue = j->get_ptr<const uint64_t*>();
if (uintValue == nullptr)
{
return -1;
@@ -686,7 +685,7 @@
}
else if (argCode == "q")
{
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ const uint64_t* uintValue = j->get_ptr<const uint64_t*>();
if (uintValue == nullptr)
{
return -1;
@@ -701,7 +700,7 @@
}
else if (argCode == "u")
{
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ const uint64_t* uintValue = j->get_ptr<const uint64_t*>();
if (uintValue == nullptr)
{
return -1;
@@ -716,7 +715,7 @@
}
else if (argCode == "t")
{
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ const uint64_t* uintValue = j->get_ptr<const uint64_t*>();
if (uintValue == nullptr)
{
return -1;
@@ -798,7 +797,7 @@
}
nlohmann::json::const_iterator it = j->begin();
- for (const std::string &argCode : dbusArgSplit(arg_type))
+ for (const std::string& argCode : dbusArgSplit(arg_type))
{
if (it == j->end())
{
@@ -829,8 +828,8 @@
{
return -1;
}
- const std::string &key_type = codes[0];
- const std::string &value_type = codes[1];
+ const std::string& key_type = codes[0];
+ const std::string& value_type = codes[1];
for (auto it : j->items())
{
r = convertJsonToDbus(m, key_type, it.key());
@@ -866,8 +865,8 @@
}
template <typename T>
-int readMessageItem(const std::string &typeCode, sdbusplus::message::message &m,
- nlohmann::json &data)
+int readMessageItem(const std::string& typeCode, sdbusplus::message::message& m,
+ nlohmann::json& data)
{
T value;
@@ -883,12 +882,12 @@
return 0;
}
-int convertDBusToJSON(const std::string &returnType,
- sdbusplus::message::message &m, nlohmann::json &response);
+int convertDBusToJSON(const std::string& returnType,
+ sdbusplus::message::message& m, nlohmann::json& response);
-int readDictEntryFromMessage(const std::string &typeCode,
- sdbusplus::message::message &m,
- nlohmann::json &object)
+int readDictEntryFromMessage(const std::string& typeCode,
+ sdbusplus::message::message& m,
+ nlohmann::json& object)
{
std::vector<std::string> types = dbusArgSplit(typeCode);
if (types.size() != 2)
@@ -913,13 +912,13 @@
return r;
}
- const std::string *keyPtr = key.get_ptr<const std::string *>();
+ const std::string* keyPtr = key.get_ptr<const std::string*>();
if (keyPtr == nullptr)
{
// json doesn't support non-string keys. If we hit this condition,
// convert the result to a string so we can proceed
key = key.dump();
- keyPtr = key.get_ptr<const std::string *>();
+ keyPtr = key.get_ptr<const std::string*>();
// in theory this can't fail now, but lets be paranoid about it
// anyway
if (keyPtr == nullptr)
@@ -927,7 +926,7 @@
return -1;
}
}
- nlohmann::json &value = object[*keyPtr];
+ nlohmann::json& value = object[*keyPtr];
r = convertDBusToJSON(types[1], m, value);
if (r < 0)
@@ -945,8 +944,8 @@
return 0;
}
-int readArrayFromMessage(const std::string &typeCode,
- sdbusplus::message::message &m, nlohmann::json &data)
+int readArrayFromMessage(const std::string& typeCode,
+ sdbusplus::message::message& m, nlohmann::json& data)
{
if (typeCode.size() < 2)
{
@@ -1025,8 +1024,8 @@
return 0;
}
-int readStructFromMessage(const std::string &typeCode,
- sdbusplus::message::message &m, nlohmann::json &data)
+int readStructFromMessage(const std::string& typeCode,
+ sdbusplus::message::message& m, nlohmann::json& data)
{
if (typeCode.size() < 3)
{
@@ -1047,7 +1046,7 @@
return r;
}
- for (const std::string &type : types)
+ for (const std::string& type : types)
{
data.push_back(nlohmann::json());
r = convertDBusToJSON(type, m, data.back());
@@ -1066,9 +1065,9 @@
return 0;
}
-int readVariantFromMessage(sdbusplus::message::message &m, nlohmann::json &data)
+int readVariantFromMessage(sdbusplus::message::message& m, nlohmann::json& data)
{
- const char *containerType;
+ const char* containerType;
int r = sd_bus_message_peek_type(m.get(), nullptr, &containerType);
if (r < 0)
{
@@ -1101,15 +1100,15 @@
return 0;
}
-int convertDBusToJSON(const std::string &returnType,
- sdbusplus::message::message &m, nlohmann::json &response)
+int convertDBusToJSON(const std::string& returnType,
+ sdbusplus::message::message& m, nlohmann::json& response)
{
int r = 0;
const std::vector<std::string> returnTypes = dbusArgSplit(returnType);
- for (const std::string &typeCode : returnTypes)
+ for (const std::string& typeCode : returnTypes)
{
- nlohmann::json *thisElement = &response;
+ nlohmann::json* thisElement = &response;
if (returnTypes.size() > 1)
{
response.push_back(nlohmann::json{});
@@ -1118,7 +1117,7 @@
if (typeCode == "s")
{
- r = readMessageItem<char *>(typeCode, m, *thisElement);
+ r = readMessageItem<char*>(typeCode, m, *thisElement);
if (r < 0)
{
return r;
@@ -1126,7 +1125,7 @@
}
else if (typeCode == "g")
{
- r = readMessageItem<char *>(typeCode, m, *thisElement);
+ r = readMessageItem<char*>(typeCode, m, *thisElement);
if (r < 0)
{
return r;
@@ -1134,7 +1133,7 @@
}
else if (typeCode == "o")
{
- r = readMessageItem<char *>(typeCode, m, *thisElement);
+ r = readMessageItem<char*>(typeCode, m, *thisElement);
if (r < 0)
{
return r;
@@ -1258,8 +1257,8 @@
}
void handleMethodResponse(std::shared_ptr<InProgressActionData> transaction,
- sdbusplus::message::message &m,
- const std::string &returnType)
+ sdbusplus::message::message& m,
+ const std::string& returnType)
{
nlohmann::json data;
@@ -1288,7 +1287,7 @@
if (transaction->methodResponse.is_object() && data.is_object())
{
- for (const auto &obj : data.items())
+ for (const auto& obj : data.items())
{
// Note: Will overwrite the data for a duplicate key
transaction->methodResponse.emplace(obj.key(),
@@ -1299,7 +1298,7 @@
if (transaction->methodResponse.is_array() && data.is_array())
{
- for (auto &obj : data)
+ for (auto& obj : data)
{
transaction->methodResponse.push_back(std::move(obj));
}
@@ -1322,14 +1321,14 @@
}
void findActionOnInterface(std::shared_ptr<InProgressActionData> transaction,
- const std::string &connectionName)
+ const std::string& connectionName)
{
BMCWEB_LOG_DEBUG << "findActionOnInterface for connection "
<< connectionName;
crow::connections::systemBus->async_method_call(
[transaction, connectionName{std::string(connectionName)}](
const boost::system::error_code ec,
- const std::string &introspect_xml) {
+ const std::string& introspect_xml) {
BMCWEB_LOG_DEBUG << "got xml:\n " << introspect_xml;
if (ec)
{
@@ -1341,18 +1340,18 @@
tinyxml2::XMLDocument doc;
doc.Parse(introspect_xml.data(), introspect_xml.size());
- tinyxml2::XMLNode *pRoot = doc.FirstChildElement("node");
+ tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
if (pRoot == nullptr)
{
BMCWEB_LOG_ERROR << "XML document failed to parse "
<< connectionName << "\n";
return;
}
- tinyxml2::XMLElement *interfaceNode =
+ tinyxml2::XMLElement* interfaceNode =
pRoot->FirstChildElement("interface");
while (interfaceNode != nullptr)
{
- const char *thisInterfaceName =
+ const char* thisInterfaceName =
interfaceNode->Attribute("name");
if (thisInterfaceName != nullptr)
{
@@ -1364,11 +1363,11 @@
continue;
}
- tinyxml2::XMLElement *methodNode =
+ tinyxml2::XMLElement* methodNode =
interfaceNode->FirstChildElement("method");
while (methodNode != nullptr)
{
- const char *thisMethodName =
+ const char* thisMethodName =
methodNode->Attribute("name");
BMCWEB_LOG_DEBUG << "Found method: " << thisMethodName;
if (thisMethodName != nullptr &&
@@ -1384,7 +1383,7 @@
thisInterfaceName,
transaction->methodName.c_str());
- tinyxml2::XMLElement *argumentNode =
+ tinyxml2::XMLElement* argumentNode =
methodNode->FirstChildElement("arg");
std::string returnType;
@@ -1392,9 +1391,9 @@
// Find the output type
while (argumentNode != nullptr)
{
- const char *argDirection =
+ const char* argDirection =
argumentNode->Attribute("direction");
- const char *argType =
+ const char* argType =
argumentNode->Attribute("type");
if (argDirection != nullptr &&
argType != nullptr &&
@@ -1414,9 +1413,9 @@
while (argumentNode != nullptr)
{
- const char *argDirection =
+ const char* argDirection =
argumentNode->Attribute("direction");
- const char *argType =
+ const char* argType =
argumentNode->Attribute("type");
if (argDirection != nullptr &&
argType != nullptr &&
@@ -1446,11 +1445,11 @@
crow::connections::systemBus->async_send(
m, [transaction, returnType](
boost::system::error_code ec,
- sdbusplus::message::message &m) {
+ sdbusplus::message::message& m) {
if (ec)
{
transaction->methodFailed = true;
- const sd_bus_error *e = m.get_error();
+ const sd_bus_error* e = m.get_error();
if (e)
{
@@ -1491,8 +1490,8 @@
"org.freedesktop.DBus.Introspectable", "Introspect");
}
-void handleAction(const crow::Request &req, crow::Response &res,
- const std::string &objectPath, const std::string &methodName)
+void handleAction(const crow::Request& req, crow::Response& res,
+ const std::string& objectPath, const std::string& methodName)
{
BMCWEB_LOG_DEBUG << "handleAction on path: " << objectPath << " and method "
<< methodName;
@@ -1530,8 +1529,8 @@
crow::connections::systemBus->async_method_call(
[transaction](
const boost::system::error_code ec,
- const std::vector<std::pair<std::string, std::vector<std::string>>>
- &interfaceNames) {
+ const std::vector<std::pair<std::string, std::vector<std::string>>>&
+ interfaceNames) {
if (ec || interfaceNames.size() <= 0)
{
BMCWEB_LOG_ERROR << "Can't find object";
@@ -1544,8 +1543,8 @@
BMCWEB_LOG_DEBUG << "GetObject returned " << interfaceNames.size()
<< " object(s)";
- for (const std::pair<std::string, std::vector<std::string>>
- &object : interfaceNames)
+ for (const std::pair<std::string, std::vector<std::string>>&
+ object : interfaceNames)
{
findActionOnInterface(transaction, object.first);
}
@@ -1556,16 +1555,16 @@
std::array<std::string, 0>());
}
-void handleDelete(const crow::Request &req, crow::Response &res,
- const std::string &objectPath)
+void handleDelete(const crow::Request& req, crow::Response& res,
+ const std::string& objectPath)
{
BMCWEB_LOG_DEBUG << "handleDelete on path: " << objectPath;
crow::connections::systemBus->async_method_call(
[&res, objectPath](
const boost::system::error_code ec,
- const std::vector<std::pair<std::string, std::vector<std::string>>>
- &interfaceNames) {
+ const std::vector<std::pair<std::string, std::vector<std::string>>>&
+ interfaceNames) {
if (ec || interfaceNames.size() <= 0)
{
BMCWEB_LOG_ERROR << "Can't find object";
@@ -1581,8 +1580,8 @@
transaction->methodName = "Delete";
transaction->interfaceName = "xyz.openbmc_project.Object.Delete";
- for (const std::pair<std::string, std::vector<std::string>>
- &object : interfaceNames)
+ for (const std::pair<std::string, std::vector<std::string>>&
+ object : interfaceNames)
{
findActionOnInterface(transaction, object.first);
}
@@ -1590,15 +1589,15 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject", objectPath,
- std::array<const char *, 0>());
+ std::array<const char*, 0>());
}
-void handleList(crow::Response &res, const std::string &objectPath,
+void handleList(crow::Response& res, const std::string& objectPath,
int32_t depth = 0)
{
crow::connections::systemBus->async_method_call(
[&res](const boost::system::error_code ec,
- std::vector<std::string> &objectPaths) {
+ std::vector<std::string>& objectPaths) {
if (ec)
{
setErrorResponse(res, boost::beast::http::status::not_found,
@@ -1618,7 +1617,7 @@
depth, std::array<std::string, 0>());
}
-void handleEnumerate(crow::Response &res, const std::string &objectPath)
+void handleEnumerate(crow::Response& res, const std::string& objectPath)
{
BMCWEB_LOG_DEBUG << "Doing enumerate on " << objectPath;
auto asyncResp = std::make_shared<bmcweb::AsyncResp>(res);
@@ -1629,7 +1628,7 @@
crow::connections::systemBus->async_method_call(
[objectPath, asyncResp](const boost::system::error_code ec,
- GetSubTreeType &object_names) {
+ GetSubTreeType& object_names) {
auto transaction = std::make_shared<InProgressEnumerateData>(
objectPath, asyncResp);
@@ -1653,11 +1652,11 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree", objectPath, 0,
- std::array<const char *, 0>());
+ std::array<const char*, 0>());
}
-void handleGet(crow::Response &res, std::string &objectPath,
- std::string &destProperty)
+void handleGet(crow::Response& res, std::string& objectPath,
+ std::string& destProperty)
{
BMCWEB_LOG_DEBUG << "handleGet: " << objectPath << " prop:" << destProperty;
std::shared_ptr<std::string> propertyName =
@@ -1670,7 +1669,7 @@
std::vector<std::pair<std::string, std::vector<std::string>>>;
crow::connections::systemBus->async_method_call(
[&res, path, propertyName](const boost::system::error_code ec,
- const GetObjectType &object_names) {
+ const GetObjectType& object_names) {
if (ec || object_names.size() <= 0)
{
setErrorResponse(res, boost::beast::http::status::not_found,
@@ -1685,7 +1684,7 @@
for (const std::pair<std::string, std::vector<std::string>>
connection : object_names)
{
- const std::vector<std::string> &interfaceNames =
+ const std::vector<std::string>& interfaceNames =
connection.second;
if (interfaceNames.size() <= 0)
@@ -1696,7 +1695,7 @@
return;
}
- for (const std::string &interface : interfaceNames)
+ for (const std::string& interface : interfaceNames)
{
sdbusplus::message::message m =
crow::connections::systemBus->new_method_call(
@@ -1706,7 +1705,7 @@
crow::connections::systemBus->async_send(
m, [&res, response,
propertyName](const boost::system::error_code ec,
- sdbusplus::message::message &msg) {
+ sdbusplus::message::message& msg) {
if (ec)
{
BMCWEB_LOG_ERROR << "Bad dbus request error: "
@@ -1724,7 +1723,7 @@
}
else
{
- for (auto &prop : properties.items())
+ for (auto& prop : properties.items())
{
// if property name is empty, or
// matches our search query, add it
@@ -1771,9 +1770,8 @@
struct AsyncPutRequest
{
- AsyncPutRequest(crow::Response &res) : res(res)
- {
- }
+ AsyncPutRequest(crow::Response& res) : res(res)
+ {}
~AsyncPutRequest()
{
if (res.jsonValue.empty())
@@ -1785,20 +1783,20 @@
res.end();
}
- void setErrorStatus(const std::string &desc)
+ void setErrorStatus(const std::string& desc)
{
setErrorResponse(res, boost::beast::http::status::internal_server_error,
desc, badReqMsg);
}
- crow::Response &res;
+ crow::Response& res;
std::string objectPath;
std::string propertyName;
nlohmann::json propertyValue;
};
-void handlePut(const crow::Request &req, crow::Response &res,
- const std::string &objectPath, const std::string &destProperty)
+void handlePut(const crow::Request& req, crow::Response& res,
+ const std::string& objectPath, const std::string& destProperty)
{
if (destProperty.empty())
{
@@ -1827,7 +1825,7 @@
res.end();
return;
}
- const nlohmann::json &propertySetValue = *propertyIt;
+ const nlohmann::json& propertySetValue = *propertyIt;
auto transaction = std::make_shared<AsyncPutRequest>(res);
transaction->objectPath = objectPath;
transaction->propertyName = destProperty;
@@ -1838,7 +1836,7 @@
crow::connections::systemBus->async_method_call(
[transaction](const boost::system::error_code ec,
- const GetObjectType &object_names) {
+ const GetObjectType& object_names) {
if (!ec && object_names.size() <= 0)
{
setErrorResponse(transaction->res,
@@ -1850,12 +1848,12 @@
for (const std::pair<std::string, std::vector<std::string>>
connection : object_names)
{
- const std::string &connectionName = connection.first;
+ const std::string& connectionName = connection.first;
crow::connections::systemBus->async_method_call(
[connectionName{std::string(connectionName)},
transaction](const boost::system::error_code ec,
- const std::string &introspectXml) {
+ const std::string& introspectXml) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1868,7 +1866,7 @@
tinyxml2::XMLDocument doc;
doc.Parse(introspectXml.c_str());
- tinyxml2::XMLNode *pRoot =
+ tinyxml2::XMLNode* pRoot =
doc.FirstChildElement("node");
if (pRoot == nullptr)
{
@@ -1877,25 +1875,25 @@
transaction->setErrorStatus("Unexpected Error");
return;
}
- tinyxml2::XMLElement *ifaceNode =
+ tinyxml2::XMLElement* ifaceNode =
pRoot->FirstChildElement("interface");
while (ifaceNode != nullptr)
{
- const char *interfaceName =
+ const char* interfaceName =
ifaceNode->Attribute("name");
BMCWEB_LOG_DEBUG << "found interface "
<< interfaceName;
- tinyxml2::XMLElement *propNode =
+ tinyxml2::XMLElement* propNode =
ifaceNode->FirstChildElement("property");
while (propNode != nullptr)
{
- const char *propertyName =
+ const char* propertyName =
propNode->Attribute("name");
BMCWEB_LOG_DEBUG << "Found property "
<< propertyName;
if (propertyName == transaction->propertyName)
{
- const char *argType =
+ const char* argType =
propNode->Attribute("type");
if (argType != nullptr)
{
@@ -1952,12 +1950,12 @@
[transaction](
boost::system::error_code
ec,
- sdbusplus::message::message
- &m) {
+ sdbusplus::message::message&
+ m) {
BMCWEB_LOG_DEBUG << "sent";
if (ec)
{
- const sd_bus_error *e =
+ const sd_bus_error* e =
m.get_error();
setErrorResponse(
transaction->res,
@@ -1999,14 +1997,14 @@
transaction->objectPath, std::array<std::string, 0>());
}
-inline void handleDBusUrl(const crow::Request &req, crow::Response &res,
- std::string &objectPath)
+inline void handleDBusUrl(const crow::Request& req, crow::Response& res,
+ std::string& objectPath)
{
// If accessing a single attribute, fill in and update objectPath,
// otherwise leave destProperty blank
std::string destProperty = "";
- const char *attrSeperator = "/attr/";
+ const char* attrSeperator = "/attr/";
size_t attrPosition = objectPath.find(attrSeperator);
if (attrPosition != objectPath.npos)
{
@@ -2017,7 +2015,7 @@
if (req.method() == "POST"_method)
{
- constexpr const char *actionSeperator = "/action/";
+ constexpr const char* actionSeperator = "/action/";
size_t actionPosition = objectPath.find(actionSeperator);
if (actionPosition != objectPath.npos)
{
@@ -2074,12 +2072,13 @@
res.end();
}
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...> &app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
BMCWEB_ROUTE(app, "/bus/")
.requires({"Login"})
.methods("GET"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
res.jsonValue = {{"busses", {{{"name", "system"}}}},
{"status", "ok"}};
res.end();
@@ -2088,9 +2087,9 @@
BMCWEB_ROUTE(app, "/bus/system/")
.requires({"Login"})
.methods("GET"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
auto myCallback = [&res](const boost::system::error_code ec,
- std::vector<std::string> &names) {
+ std::vector<std::string>& names) {
if (ec)
{
BMCWEB_LOG_ERROR << "Dbus call failed with code " << ec;
@@ -2101,8 +2100,8 @@
{
std::sort(names.begin(), names.end());
res.jsonValue = {{"status", "ok"}};
- auto &objectsSub = res.jsonValue["objects"];
- for (auto &name : names)
+ auto& objectsSub = res.jsonValue["objects"];
+ for (auto& name : names)
{
objectsSub.push_back({{"name", name}});
}
@@ -2117,14 +2116,14 @@
BMCWEB_ROUTE(app, "/list/")
.requires({"Login"})
.methods("GET"_method)(
- [](const crow::Request &req, crow::Response &res) {
+ [](const crow::Request& req, crow::Response& res) {
handleList(res, "/");
});
BMCWEB_ROUTE(app, "/xyz/<path>")
.requires({"Login"})
- .methods("GET"_method)([](const crow::Request &req, crow::Response &res,
- const std::string &path) {
+ .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
+ const std::string& path) {
std::string objectPath = "/xyz/" + path;
handleDBusUrl(req, res, objectPath);
});
@@ -2132,16 +2131,16 @@
BMCWEB_ROUTE(app, "/xyz/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("PUT"_method, "POST"_method, "DELETE"_method)(
- [](const crow::Request &req, crow::Response &res,
- const std::string &path) {
+ [](const crow::Request& req, crow::Response& res,
+ const std::string& path) {
std::string objectPath = "/xyz/" + path;
handleDBusUrl(req, res, objectPath);
});
BMCWEB_ROUTE(app, "/org/<path>")
.requires({"Login"})
- .methods("GET"_method)([](const crow::Request &req, crow::Response &res,
- const std::string &path) {
+ .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
+ const std::string& path) {
std::string objectPath = "/org/" + path;
handleDBusUrl(req, res, objectPath);
});
@@ -2149,16 +2148,16 @@
BMCWEB_ROUTE(app, "/org/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("PUT"_method, "POST"_method, "DELETE"_method)(
- [](const crow::Request &req, crow::Response &res,
- const std::string &path) {
+ [](const crow::Request& req, crow::Response& res,
+ const std::string& path) {
std::string objectPath = "/org/" + path;
handleDBusUrl(req, res, objectPath);
});
BMCWEB_ROUTE(app, "/download/dump/<str>/")
.requires({"ConfigureManager"})
- .methods("GET"_method)([](const crow::Request &req, crow::Response &res,
- const std::string &dumpId) {
+ .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
+ const std::string& dumpId) {
std::regex validFilename("^[\\w\\- ]+(\\.?[\\w\\- ]*)$");
if (!std::regex_match(dumpId, validFilename))
{
@@ -2181,7 +2180,7 @@
}
std::filesystem::directory_iterator files(loc);
- for (auto &file : files)
+ for (auto& file : files)
{
std::ifstream readFile(file.path());
if (!readFile.good())
@@ -2224,8 +2223,8 @@
BMCWEB_ROUTE(app, "/bus/system/<str>/")
.requires({"Login"})
- .methods("GET"_method)([](const crow::Request &req, crow::Response &res,
- const std::string &Connection) {
+ .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
+ const std::string& Connection) {
introspectObjects(Connection, "/",
std::make_shared<bmcweb::AsyncResp>(res));
});
@@ -2233,10 +2232,10 @@
BMCWEB_ROUTE(app, "/bus/system/<str>/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
.methods("GET"_method,
- "POST"_method)([](const crow::Request &req,
- crow::Response &res,
- const std::string &processName,
- const std::string &requestedPath) {
+ "POST"_method)([](const crow::Request& req,
+ crow::Response& res,
+ const std::string& processName,
+ const std::string& requestedPath) {
std::vector<std::string> strs;
boost::split(strs, requestedPath, boost::is_any_of("/"));
std::string objectPath;
@@ -2293,7 +2292,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, processName,
objectPath](const boost::system::error_code ec,
- const std::string &introspect_xml) {
+ const std::string& introspect_xml) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -2306,7 +2305,7 @@
tinyxml2::XMLDocument doc;
doc.Parse(introspect_xml.c_str());
- tinyxml2::XMLNode *pRoot =
+ tinyxml2::XMLNode* pRoot =
doc.FirstChildElement("node");
if (pRoot == nullptr)
{
@@ -2325,15 +2324,15 @@
{"status", "ok"},
{"bus_name", processName},
{"object_path", objectPath}};
- nlohmann::json &interfacesArray =
+ nlohmann::json& interfacesArray =
asyncResp->res.jsonValue["interfaces"];
interfacesArray = nlohmann::json::array();
- tinyxml2::XMLElement *interface =
+ tinyxml2::XMLElement* interface =
pRoot->FirstChildElement("interface");
while (interface != nullptr)
{
- const char *ifaceName =
+ const char* ifaceName =
interface->Attribute("name");
if (ifaceName != nullptr)
{
@@ -2356,7 +2355,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, processName, objectPath,
interfaceName](const boost::system::error_code ec,
- const std::string &introspect_xml) {
+ const std::string& introspect_xml) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -2369,7 +2368,7 @@
tinyxml2::XMLDocument doc;
doc.Parse(introspect_xml.data(), introspect_xml.size());
- tinyxml2::XMLNode *pRoot =
+ tinyxml2::XMLNode* pRoot =
doc.FirstChildElement("node");
if (pRoot == nullptr)
{
@@ -2386,25 +2385,25 @@
{"interface", interfaceName},
{"object_path", objectPath}};
- nlohmann::json &methodsArray =
+ nlohmann::json& methodsArray =
asyncResp->res.jsonValue["methods"];
methodsArray = nlohmann::json::array();
- nlohmann::json &signalsArray =
+ nlohmann::json& signalsArray =
asyncResp->res.jsonValue["signals"];
signalsArray = nlohmann::json::array();
- nlohmann::json &propertiesObj =
+ nlohmann::json& propertiesObj =
asyncResp->res.jsonValue["properties"];
propertiesObj = nlohmann::json::object();
// if we know we're the only call, build the
// json directly
- tinyxml2::XMLElement *interface =
+ tinyxml2::XMLElement* interface =
pRoot->FirstChildElement("interface");
while (interface != nullptr)
{
- const char *ifaceName =
+ const char* ifaceName =
interface->Attribute("name");
if (ifaceName != nullptr &&
@@ -2425,21 +2424,21 @@
return;
}
- tinyxml2::XMLElement *methods =
+ tinyxml2::XMLElement* methods =
interface->FirstChildElement("method");
while (methods != nullptr)
{
nlohmann::json argsArray = nlohmann::json::array();
- tinyxml2::XMLElement *arg =
+ tinyxml2::XMLElement* arg =
methods->FirstChildElement("arg");
while (arg != nullptr)
{
nlohmann::json thisArg;
- for (const char *fieldName :
- std::array<const char *, 3>{
+ for (const char* fieldName :
+ std::array<const char*, 3>{
"name", "direction", "type"})
{
- const char *fieldValue =
+ const char* fieldValue =
arg->Attribute(fieldName);
if (fieldValue != nullptr)
{
@@ -2450,7 +2449,7 @@
arg = arg->NextSiblingElement("arg");
}
- const char *name = methods->Attribute("name");
+ const char* name = methods->Attribute("name");
if (name != nullptr)
{
methodsArray.push_back(
@@ -2462,18 +2461,18 @@
}
methods = methods->NextSiblingElement("method");
}
- tinyxml2::XMLElement *signals =
+ tinyxml2::XMLElement* signals =
interface->FirstChildElement("signal");
while (signals != nullptr)
{
nlohmann::json argsArray = nlohmann::json::array();
- tinyxml2::XMLElement *arg =
+ tinyxml2::XMLElement* arg =
signals->FirstChildElement("arg");
while (arg != nullptr)
{
- const char *name = arg->Attribute("name");
- const char *type = arg->Attribute("type");
+ const char* name = arg->Attribute("name");
+ const char* type = arg->Attribute("type");
if (name != nullptr && type != nullptr)
{
argsArray.push_back({
@@ -2483,7 +2482,7 @@
}
arg = arg->NextSiblingElement("arg");
}
- const char *name = signals->Attribute("name");
+ const char* name = signals->Attribute("name");
if (name != nullptr)
{
signalsArray.push_back(
@@ -2493,12 +2492,12 @@
signals = signals->NextSiblingElement("signal");
}
- tinyxml2::XMLElement *property =
+ tinyxml2::XMLElement* property =
interface->FirstChildElement("property");
while (property != nullptr)
{
- const char *name = property->Attribute("name");
- const char *type = property->Attribute("type");
+ const char* name = property->Attribute("name");
+ const char* type = property->Attribute("type");
if (type != nullptr && name != nullptr)
{
sdbusplus::message::message m =
@@ -2510,12 +2509,12 @@
"Properties",
"Get");
m.append(interfaceName, name);
- nlohmann::json &propertyItem =
+ nlohmann::json& propertyItem =
propertiesObj[name];
crow::connections::systemBus->async_send(
m, [&propertyItem, asyncResp](
- boost::system::error_code &e,
- sdbusplus::message::message &msg) {
+ boost::system::error_code& e,
+ sdbusplus::message::message& msg) {
if (e)
{
return;
diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp
index f8afbb1..59c8cd6 100644
--- a/include/pam_authenticate.hpp
+++ b/include/pam_authenticate.hpp
@@ -3,6 +3,7 @@
#include <security/pam_appl.h>
#include <boost/utility/string_view.hpp>
+
#include <cstring>
#include <memory>
diff --git a/include/persistent_data_middleware.hpp b/include/persistent_data_middleware.hpp
index 348079b..de3a6ba 100644
--- a/include/persistent_data_middleware.hpp
+++ b/include/persistent_data_middleware.hpp
@@ -8,13 +8,14 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
-#include <filesystem>
#include <nlohmann/json.hpp>
#include <pam_authenticate.hpp>
-#include <random>
#include <sessions.hpp>
#include <webassets.hpp>
+#include <filesystem>
+#include <random>
+
namespace crow
{
@@ -32,8 +33,7 @@
static constexpr const char* filename = "bmcweb_persistent_data.json";
struct Context
- {
- };
+ {};
Middleware()
{
@@ -49,12 +49,10 @@
}
void beforeHandle(crow::Request& req, Response& res, Context& ctx)
- {
- }
+ {}
void afterHandle(Request& req, Response& res, Context& ctx)
- {
- }
+ {}
// TODO(ed) this should really use protobuf, or some other serialization
// library, but adding another dependency is somewhat outside the scope of
diff --git a/include/redfish_v1.hpp b/include/redfish_v1.hpp
index 3e97ad1..d77d893 100644
--- a/include/redfish_v1.hpp
+++ b/include/redfish_v1.hpp
@@ -4,16 +4,18 @@
#include <boost/algorithm/string.hpp>
#include <dbus_singleton.hpp>
-#include <fstream>
#include <persistent_data_middleware.hpp>
+#include <token_authorization_middleware.hpp>
+
+#include <fstream>
#include <streambuf>
#include <string>
-#include <token_authorization_middleware.hpp>
namespace crow
{
namespace redfish
{
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
BMCWEB_ROUTE(app, "/redfish/")
.methods("GET"_method)(
diff --git a/include/security_headers_middleware.hpp b/include/security_headers_middleware.hpp
index f60ce76..ec72cbb 100644
--- a/include/security_headers_middleware.hpp
+++ b/include/security_headers_middleware.hpp
@@ -8,8 +8,7 @@
struct SecurityHeadersMiddleware
{
struct Context
- {
- };
+ {};
void beforeHandle(crow::Request& req, Response& res, Context& ctx)
{
diff --git a/include/sessions.hpp b/include/sessions.hpp
index a7ffe28..1176cfc 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -1,20 +1,21 @@
#pragma once
+#include "logging.h"
+#include "utility.h"
+
#include <openssl/rand.h>
#include <boost/container/flat_map.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
-#include <csignal>
#include <dbus_singleton.hpp>
#include <nlohmann/json.hpp>
#include <pam_authenticate.hpp>
-#include <random>
#include <sdbusplus/bus/match.hpp>
-#include "logging.h"
-#include "utility.h"
+#include <csignal>
+#include <random>
#ifdef BMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE
#include <ibm/locks.hpp>
#endif
@@ -366,8 +367,7 @@
private:
SessionStore() : timeoutInMinutes(60)
- {
- }
+ {}
void applySessionTimeouts()
{
@@ -431,7 +431,8 @@
}
};
-template <> struct adl_serializer<crow::persistent_data::AuthConfigMethods>
+template <>
+struct adl_serializer<crow::persistent_data::AuthConfigMethods>
{
static void to_json(nlohmann::json& j,
const crow::persistent_data::AuthConfigMethods& c)
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 57c96a5..7178195 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -12,13 +12,14 @@
#include <openssl/ssl.h>
#include <boost/asio/ssl/context.hpp>
+
#include <random>
namespace ensuressl
{
-constexpr char const *trustStorePath = "/etc/ssl/certs/authority";
+constexpr char const* trustStorePath = "/etc/ssl/certs/authority";
static void initOpenssl();
-static EVP_PKEY *createEcKey();
+static EVP_PKEY* createEcKey();
// Trust chain related errors.`
inline bool isTrustChainError(int errnum)
@@ -37,10 +38,10 @@
}
}
-inline bool validateCertificate(X509 *const cert)
+inline bool validateCertificate(X509* const cert)
{
// Create an empty X509_STORE structure for certificate validation.
- X509_STORE *x509Store = X509_STORE_new();
+ X509_STORE* x509Store = X509_STORE_new();
if (!x509Store)
{
BMCWEB_LOG_ERROR << "Error occured during X509_STORE_new call";
@@ -48,7 +49,7 @@
}
// Load Certificate file into the X509 structure.
- X509_STORE_CTX *storeCtx = X509_STORE_CTX_new();
+ X509_STORE_CTX* storeCtx = X509_STORE_CTX_new();
if (!storeCtx)
{
BMCWEB_LOG_ERROR << "Error occured during X509_STORE_CTX_new call";
@@ -99,20 +100,20 @@
return false;
}
-inline bool verifyOpensslKeyCert(const std::string &filepath)
+inline bool verifyOpensslKeyCert(const std::string& filepath)
{
bool privateKeyValid = false;
bool certValid = false;
std::cout << "Checking certs in file " << filepath << "\n";
- FILE *file = fopen(filepath.c_str(), "r");
+ FILE* file = fopen(filepath.c_str(), "r");
if (file != nullptr)
{
- EVP_PKEY *pkey = PEM_read_PrivateKey(file, nullptr, nullptr, nullptr);
+ EVP_PKEY* pkey = PEM_read_PrivateKey(file, nullptr, nullptr, nullptr);
if (pkey != nullptr)
{
- RSA *rsa = EVP_PKEY_get1_RSA(pkey);
+ RSA* rsa = EVP_PKEY_get1_RSA(pkey);
if (rsa != nullptr)
{
std::cout << "Found an RSA key\n";
@@ -129,7 +130,7 @@
}
else
{
- EC_KEY *ec = EVP_PKEY_get1_EC_KEY(pkey);
+ EC_KEY* ec = EVP_PKEY_get1_EC_KEY(pkey);
if (ec != nullptr)
{
std::cout << "Found an EC key\n";
@@ -154,7 +155,7 @@
// key order issue.
fseek(file, 0, SEEK_SET);
- X509 *x509 = PEM_read_X509(file, nullptr, nullptr, nullptr);
+ X509* x509 = PEM_read_X509(file, nullptr, nullptr, nullptr);
if (x509 == nullptr)
{
std::cout << "error getting x509 cert " << ERR_get_error()
@@ -174,19 +175,19 @@
return certValid;
}
-inline void generateSslCertificate(const std::string &filepath)
+inline void generateSslCertificate(const std::string& filepath)
{
- FILE *pFile = nullptr;
+ FILE* pFile = nullptr;
std::cout << "Generating new keys\n";
initOpenssl();
std::cerr << "Generating EC key\n";
- EVP_PKEY *pPrivKey = createEcKey();
+ EVP_PKEY* pPrivKey = createEcKey();
if (pPrivKey != nullptr)
{
std::cerr << "Generating x509 Certificate\n";
// Use this code to directly generate a certificate
- X509 *x509;
+ X509* x509;
x509 = X509_new();
if (x509 != nullptr)
{
@@ -208,18 +209,18 @@
X509_set_pubkey(x509, pPrivKey);
// get the subject name
- X509_NAME *name;
+ X509_NAME* name;
name = X509_get_subject_name(x509);
X509_NAME_add_entry_by_txt(
name, "C", MBSTRING_ASC,
- reinterpret_cast<const unsigned char *>("US"), -1, -1, 0);
+ reinterpret_cast<const unsigned char*>("US"), -1, -1, 0);
X509_NAME_add_entry_by_txt(
name, "O", MBSTRING_ASC,
- reinterpret_cast<const unsigned char *>("OpenBMC"), -1, -1, 0);
+ reinterpret_cast<const unsigned char*>("OpenBMC"), -1, -1, 0);
X509_NAME_add_entry_by_txt(
name, "CN", MBSTRING_ASC,
- reinterpret_cast<const unsigned char *>("testhost"), -1, -1, 0);
+ reinterpret_cast<const unsigned char*>("testhost"), -1, -1, 0);
// set the CSR options
X509_set_issuer_name(x509, name);
@@ -248,13 +249,13 @@
// cleanup_openssl();
}
-EVP_PKEY *createEcKey()
+EVP_PKEY* createEcKey()
{
- EVP_PKEY *pKey = nullptr;
+ EVP_PKEY* pKey = nullptr;
int eccgrp = 0;
eccgrp = OBJ_txt2nid("secp384r1");
- EC_KEY *myecc = EC_KEY_new_by_curve_name(eccgrp);
+ EC_KEY* myecc = EC_KEY_new_by_curve_name(eccgrp);
if (myecc != nullptr)
{
EC_KEY_set_asn1_flag(myecc, OPENSSL_EC_NAMED_CURVE);
@@ -284,7 +285,7 @@
#endif
}
-inline void ensureOpensslKeyPresentAndValid(const std::string &filepath)
+inline void ensureOpensslKeyPresentAndValid(const std::string& filepath)
{
bool pemFileValid = false;
@@ -298,7 +299,7 @@
}
inline std::shared_ptr<boost::asio::ssl::context>
- getSslContext(const std::string &ssl_pem_file)
+ getSslContext(const std::string& ssl_pem_file)
{
std::shared_ptr<boost::asio::ssl::context> mSslContext =
std::make_shared<boost::asio::ssl::context>(
diff --git a/include/token_authorization_middleware.hpp b/include/token_authorization_middleware.hpp
index ccea929..a455926 100644
--- a/include/token_authorization_middleware.hpp
+++ b/include/token_authorization_middleware.hpp
@@ -8,9 +8,10 @@
#include <boost/container/flat_set.hpp>
#include <pam_authenticate.hpp>
#include <persistent_data_middleware.hpp>
-#include <random>
#include <webassets.hpp>
+#include <random>
+
namespace crow
{
@@ -21,8 +22,7 @@
{
public:
struct Context
- {
- };
+ {};
void beforeHandle(crow::Request& req, Response& res, Context& ctx)
{
@@ -282,7 +282,8 @@
// TODO(ed) see if there is a better way to allow middlewares to request
// routes.
// Possibly an init function on first construction?
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
static_assert(
black_magic::Contains<persistent_data::Middleware,
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index a8380a7..07f72c6 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -5,9 +5,10 @@
#include <boost/beast/core/flat_static_buffer.hpp>
#include <boost/process.hpp>
-#include <csignal>
#include <webserver_common.hpp>
+#include <csignal>
+
namespace crow
{
namespace obmc_vm
@@ -27,8 +28,7 @@
pipeOut(ios), pipeIn(ios), media(mediaIn), doingWrite(false),
outputBuffer(new boost::beast::flat_static_buffer<nbdBufferSize>),
inputBuffer(new boost::beast::flat_static_buffer<nbdBufferSize>)
- {
- }
+ {}
~Handler() = default;
@@ -155,7 +155,8 @@
static std::shared_ptr<Handler> handler;
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
BMCWEB_ROUTE(app, "/vm/0/0")
.requires({"ConfigureComponents", "ConfigureManager"})
diff --git a/include/webassets.hpp b/include/webassets.hpp
index 847696a..fc58d37 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -7,6 +7,7 @@
#include <boost/algorithm/string/replace.hpp>
#include <boost/container/flat_set.hpp>
+
#include <filesystem>
#include <fstream>
#include <string>
@@ -28,7 +29,8 @@
static boost::container::flat_set<std::string> routes;
-template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)
+template <typename... Middlewares>
+void requestRoutes(Crow<Middlewares...>& app)
{
const static boost::container::flat_map<const char*, const char*, CmpStr>
contentTypes{
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 6e280c0..ca921e9 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -22,10 +22,10 @@
* ids can be retrieved from Base.__ver__.json file.
***************************************************************/
#pragma once
-#include <nlohmann/json.hpp>
-
#include "http_response.h"
+#include <nlohmann/json.hpp>
+
namespace redfish
{
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 569c307..fb0cfbc 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -18,13 +18,14 @@
#include <boost/asio/io_context.hpp>
#include <boost/container/flat_map.hpp>
+#include <error_messages.hpp>
+#include <http_client.hpp>
+#include <utils/json_utils.hpp>
+
#include <cstdlib>
#include <ctime>
-#include <error_messages.hpp>
#include <fstream>
-#include <http_client.hpp>
#include <memory>
-#include <utils/json_utils.hpp>
#include <variant>
namespace redfish
@@ -69,8 +70,7 @@
crow::connections::systemBus->get_io_context(), host, port, path);
}
~Subscription()
- {
- }
+ {}
void sendEvent(const std::string& msg)
{
diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index a6e1e27..c2c10d5 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -15,15 +15,16 @@
*/
#pragma once
+#include "http_request.h"
+#include "http_response.h"
+
#include "privileges.hpp"
#include "token_authorization_middleware.hpp"
#include "webserver_common.hpp"
#include <error_messages.hpp>
-#include <vector>
-#include "http_request.h"
-#include "http_response.h"
+#include <vector>
namespace redfish
{
@@ -36,8 +37,7 @@
{
public:
AsyncResp(crow::Response& response) : res(response)
- {
- }
+ {}
~AsyncResp()
{
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index 35f619b..0282f35 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -17,10 +17,11 @@
#include <logging.h>
-#include <array>
-#include <bitset>
#include <boost/beast/http/verb.hpp>
#include <boost/container/flat_map.hpp>
+
+#include <array>
+#include <bitset>
#include <cstdint>
#include <vector>
@@ -211,8 +212,7 @@
private:
Privileges(const std::bitset<maxPrivilegeCount>& p) : privilegeBitset{p}
- {
- }
+ {}
std::bitset<maxPrivilegeCount> privilegeBitset = 0;
};
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 653b067..0fd02c7 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -1,5 +1,6 @@
#pragma once
#include <async_resp.hpp>
+
#include <string>
namespace redfish
@@ -7,11 +8,11 @@
namespace fw_util
{
/* @brief String that indicates a bios firmware instance */
-constexpr const char *biosPurpose =
+constexpr const char* biosPurpose =
"xyz.openbmc_project.Software.Version.VersionPurpose.Host";
/* @brief String that indicates a BMC firmware instance */
-constexpr const char *bmcPurpose =
+constexpr const char* bmcPurpose =
"xyz.openbmc_project.Software.Version.VersionPurpose.BMC";
/**
@@ -24,14 +25,14 @@
* @return void
*/
void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp,
- const std::string &fwVersionPurpose,
- const std::string &jsonIdxStr)
+ const std::string& fwVersionPurpose,
+ const std::string& jsonIdxStr)
{
// Get active FW images
crow::connections::systemBus->async_method_call(
[aResp, fwVersionPurpose,
jsonIdxStr](const boost::system::error_code ec,
- const std::variant<std::vector<std::string>> &resp) {
+ const std::variant<std::vector<std::string>>& resp) {
if (ec)
{
BMCWEB_LOG_ERROR << "error_code = " << ec;
@@ -39,7 +40,7 @@
messages::internalError(aResp->res);
return;
}
- const std::vector<std::string> *functionalFw =
+ const std::vector<std::string>* functionalFw =
std::get_if<std::vector<std::string>>(&resp);
if ((functionalFw == nullptr) || (functionalFw->size() == 0))
{
@@ -50,7 +51,7 @@
// example functionalFw:
// v as 2 "/xyz/openbmc_project/software/ace821ef"
// "/xyz/openbmc_project/software/230fb078"
- for (auto &fw : *functionalFw)
+ for (auto& fw : *functionalFw)
{
// if can't parse fw id then return
std::string::size_type idPos = fw.rfind("/");
@@ -74,7 +75,7 @@
[aResp, fw, swId, fwVersionPurpose, jsonIdxStr](
const boost::system::error_code ec,
const std::vector<std::pair<
- std::string, std::vector<std::string>>> &objInfo) {
+ std::string, std::vector<std::string>>>& objInfo) {
if (ec)
{
BMCWEB_LOG_DEBUG << "error_code = " << ec;
@@ -109,7 +110,7 @@
[aResp, swId, fwVersionPurpose, jsonIdxStr](
const boost::system::error_code ec,
const boost::container::flat_map<
- std::string, VariantType> &propertiesList) {
+ std::string, VariantType>& propertiesList) {
if (ec)
{
BMCWEB_LOG_ERROR << "error_code = " << ec;
@@ -134,7 +135,7 @@
messages::internalError(aResp->res);
return;
}
- const std::string *swInvPurpose =
+ const std::string* swInvPurpose =
std::get_if<std::string>(&it->second);
if (swInvPurpose == nullptr)
{
@@ -157,7 +158,7 @@
messages::internalError(aResp->res);
return;
}
- const std::string *version =
+ const std::string* version =
std::get_if<std::string>(&it->second);
if (version == nullptr)
{
@@ -175,7 +176,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject", fw,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Software.Activation"});
}
},
@@ -196,7 +197,7 @@
*
* @return The corresponding Redfish state
*/
-std::string getRedfishFWState(const std::string &fwState)
+std::string getRedfishFWState(const std::string& fwState)
{
if (fwState == "xyz.openbmc_project.Software.Activation.Activations.Active")
{
@@ -228,7 +229,7 @@
*
* @return The corresponding Redfish health state
*/
-std::string getRedfishFWHealth(const std::string &fwState)
+std::string getRedfishFWHealth(const std::string& fwState)
{
if ((fwState ==
"xyz.openbmc_project.Software.Activation.Activations.Active") ||
@@ -260,15 +261,15 @@
*/
void getFwStatus(std::shared_ptr<AsyncResp> asyncResp,
const std::shared_ptr<std::string> swId,
- const std::string &dbusSvc)
+ const std::string& dbusSvc)
{
BMCWEB_LOG_DEBUG << "getFwStatus: swId " << *swId << " svc " << dbusSvc;
crow::connections::systemBus->async_method_call(
[asyncResp,
swId](const boost::system::error_code error_code,
- const boost::container::flat_map<std::string, VariantType>
- &propertiesList) {
+ const boost::container::flat_map<std::string, VariantType>&
+ propertiesList) {
if (error_code)
{
// not all fwtypes are updateable, this is ok
@@ -283,7 +284,7 @@
messages::propertyMissing(asyncResp->res, "Activation");
return;
}
- const std::string *swInvActivation =
+ const std::string* swInvActivation =
std::get_if<std::string>(&it->second);
if (swInvActivation == nullptr)
{
@@ -318,7 +319,7 @@
{
crow::connections::systemBus->async_method_call(
[asyncResp, fwId](const boost::system::error_code ec,
- const std::variant<std::vector<std::string>> &resp) {
+ const std::variant<std::vector<std::string>>& resp) {
if (ec)
{
BMCWEB_LOG_DEBUG << __FUNCTION__ << " error_code = " << ec
@@ -327,7 +328,7 @@
// so don't throw error here.
return;
}
- const std::vector<std::string> *objPaths =
+ const std::vector<std::string>* objPaths =
std::get_if<std::vector<std::string>>(&resp);
if (objPaths)
{
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index de732ce..d578de4 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -18,10 +18,11 @@
#include <http_request.h>
#include <http_response.h>
-#include <bitset>
#include <error_messages.hpp>
#include <nlohmann/json.hpp>
+#include <bitset>
+
namespace redfish
{
@@ -44,36 +45,35 @@
namespace details
{
-template <typename Type> struct is_optional : std::false_type
-{
-};
+template <typename Type>
+struct is_optional : std::false_type
+{};
template <typename Type>
struct is_optional<std::optional<Type>> : std::true_type
-{
-};
+{};
template <typename Type>
constexpr bool is_optional_v = is_optional<Type>::value;
-template <typename Type> struct is_vector : std::false_type
-{
-};
+template <typename Type>
+struct is_vector : std::false_type
+{};
-template <typename Type> struct is_vector<std::vector<Type>> : std::true_type
-{
-};
+template <typename Type>
+struct is_vector<std::vector<Type>> : std::true_type
+{};
-template <typename Type> constexpr bool is_vector_v = is_vector<Type>::value;
+template <typename Type>
+constexpr bool is_vector_v = is_vector<Type>::value;
-template <typename Type> struct is_std_array : std::false_type
-{
-};
+template <typename Type>
+struct is_std_array : std::false_type
+{};
template <typename Type, std::size_t size>
struct is_std_array<std::array<Type, size>> : std::true_type
-{
-};
+{};
template <typename Type>
constexpr bool is_std_array_v = is_std_array<Type>::value;
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index d41a419..8c67f36 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -20,6 +20,7 @@
#include <error_messages.hpp>
#include <openbmc_dbus_rest.hpp>
#include <utils/json_utils.hpp>
+
#include <variant>
namespace redfish
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 94f1cb9..9e0a294 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -10,14 +10,14 @@
class BiosService : public Node
{
public:
- BiosService(CrowApp &app) : Node(app, "/redfish/v1/Systems/system/Bios/")
+ BiosService(CrowApp& app) : Node(app, "/redfish/v1/Systems/system/Bios/")
{
entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}};
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -39,7 +39,7 @@
class BiosReset : public Node
{
public:
- BiosReset(CrowApp &app) :
+ BiosReset(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/")
{
entityPrivileges = {
@@ -51,8 +51,8 @@
* Function handles POST method request.
* Analyzes POST body message before sends Reset request data to D-Bus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 66ddab8..4831617 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -19,27 +19,28 @@
#include <boost/convert.hpp>
#include <boost/convert/strtol.hpp>
+
#include <variant>
namespace redfish
{
namespace certs
{
-constexpr char const *httpsObjectPath =
+constexpr char const* httpsObjectPath =
"/xyz/openbmc_project/certs/server/https";
-constexpr char const *certInstallIntf = "xyz.openbmc_project.Certs.Install";
-constexpr char const *certReplaceIntf = "xyz.openbmc_project.Certs.Replace";
-constexpr char const *objDeleteIntf = "xyz.openbmc_project.Object.Delete";
-constexpr char const *certPropIntf = "xyz.openbmc_project.Certs.Certificate";
-constexpr char const *dbusPropIntf = "org.freedesktop.DBus.Properties";
-constexpr char const *dbusObjManagerIntf = "org.freedesktop.DBus.ObjectManager";
-constexpr char const *ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap";
-constexpr char const *httpsServiceName =
+constexpr char const* certInstallIntf = "xyz.openbmc_project.Certs.Install";
+constexpr char const* certReplaceIntf = "xyz.openbmc_project.Certs.Replace";
+constexpr char const* objDeleteIntf = "xyz.openbmc_project.Object.Delete";
+constexpr char const* certPropIntf = "xyz.openbmc_project.Certs.Certificate";
+constexpr char const* dbusPropIntf = "org.freedesktop.DBus.Properties";
+constexpr char const* dbusObjManagerIntf = "org.freedesktop.DBus.ObjectManager";
+constexpr char const* ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap";
+constexpr char const* httpsServiceName =
"xyz.openbmc_project.Certs.Manager.Server.Https";
-constexpr char const *ldapServiceName =
+constexpr char const* ldapServiceName =
"xyz.openbmc_project.Certs.Manager.Client.Ldap";
-constexpr char const *authorityServiceName =
+constexpr char const* authorityServiceName =
"xyz.openbmc_project.Certs.Manager.Authority.Ldap";
-constexpr char const *authorityObjectPath =
+constexpr char const* authorityObjectPath =
"/xyz/openbmc_project/certs/authority/ldap";
} // namespace certs
@@ -51,7 +52,7 @@
class CertificateService : public Node
{
public:
- CertificateService(CrowApp &app) :
+ CertificateService(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/")
{
// TODO: Issue#61 No entries are available for Certificate
@@ -68,8 +69,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.type", "#CertificateService.v1_0_0.CertificateService"},
@@ -116,8 +117,8 @@
}
std::string
- getCertificateFromReqBody(const std::shared_ptr<AsyncResp> &asyncResp,
- const crow::Request &req)
+ getCertificateFromReqBody(const std::shared_ptr<AsyncResp>& asyncResp,
+ const crow::Request& req)
{
nlohmann::json reqJson = nlohmann::json::parse(req.body, nullptr, false);
@@ -155,14 +156,14 @@
{
public:
CertificateFile() = delete;
- CertificateFile(const CertificateFile &) = delete;
- CertificateFile &operator=(const CertificateFile &) = delete;
- CertificateFile(CertificateFile &&) = delete;
- CertificateFile &operator=(CertificateFile &&) = delete;
- CertificateFile(const std::string &certString)
+ CertificateFile(const CertificateFile&) = delete;
+ CertificateFile& operator=(const CertificateFile&) = delete;
+ CertificateFile(CertificateFile&&) = delete;
+ CertificateFile& operator=(CertificateFile&&) = delete;
+ CertificateFile(const std::string& certString)
{
char dirTemplate[] = "/tmp/Certs.XXXXXX";
- char *tempDirectory = mkdtemp(dirTemplate);
+ char* tempDirectory = mkdtemp(dirTemplate);
if (tempDirectory)
{
certDirectory = tempDirectory;
@@ -184,7 +185,7 @@
{
std::filesystem::remove_all(certDirectory);
}
- catch (const std::filesystem::filesystem_error &e)
+ catch (const std::filesystem::filesystem_error& e)
{
BMCWEB_LOG_ERROR << "Failed to remove temp directory"
<< certDirectory;
@@ -212,17 +213,17 @@
* @param[in] csrObjPath CSR D-Bus object path
* @return None
*/
-static void getCSR(const std::shared_ptr<AsyncResp> &asyncResp,
- const std::string &certURI, const std::string &service,
- const std::string &certObjPath,
- const std::string &csrObjPath)
+static void getCSR(const std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& certURI, const std::string& service,
+ const std::string& certObjPath,
+ const std::string& csrObjPath)
{
BMCWEB_LOG_DEBUG << "getCSR CertObjectPath" << certObjPath
<< " CSRObjectPath=" << csrObjPath
<< " service=" << service;
crow::connections::systemBus->async_method_call(
[asyncResp, certURI](const boost::system::error_code ec,
- const std::string &csr) {
+ const std::string& csr) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -248,7 +249,7 @@
class CertificateActionGenerateCSR : public Node
{
public:
- CertificateActionGenerateCSR(CrowApp &app) :
+ CertificateActionGenerateCSR(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/Actions/"
"CertificateService.GenerateCSR/")
{
@@ -262,8 +263,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
static const int RSA_KEY_BIT_LENGTH = 2048;
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -427,7 +428,7 @@
// Make this static so it survives outside this method
static boost::asio::steady_timer timeout(*req.ioService);
timeout.expires_after(std::chrono::seconds(TIME_OUT));
- timeout.async_wait([asyncResp](const boost::system::error_code &ec) {
+ timeout.async_wait([asyncResp](const boost::system::error_code& ec) {
csrMatcher = nullptr;
if (ec)
{
@@ -454,7 +455,7 @@
csrMatcher = std::make_unique<sdbusplus::bus::match::match>(
*crow::connections::systemBus, match,
[asyncResp, service, objectPath,
- certURI](sdbusplus::message::message &m) {
+ certURI](sdbusplus::message::message& m) {
timeout.cancel();
if (m.is_method_error())
{
@@ -469,7 +470,7 @@
sdbusplus::message::object_path csrObjectPath;
m.read(csrObjectPath, interfacesProperties);
BMCWEB_LOG_DEBUG << "CSR object added" << csrObjectPath.str;
- for (auto &interface : interfacesProperties)
+ for (auto& interface : interfacesProperties)
{
if (interface.first == "xyz.openbmc_project.Certs.CSR")
{
@@ -480,8 +481,8 @@
}
});
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code &ec,
- const std::string &path) {
+ [asyncResp](const boost::system::error_code& ec,
+ const std::string& path) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec.message();
@@ -506,7 +507,7 @@
* @param[in] type Issuer/Subject
* @return None
*/
-static void updateCertIssuerOrSubject(nlohmann::json &out,
+static void updateCertIssuerOrSubject(nlohmann::json& out,
const std::string_view value)
{
// example: O=openbmc-project.xyz,CN=localhost
@@ -576,9 +577,9 @@
* @return None
*/
static void getCertificateProperties(
- const std::shared_ptr<AsyncResp> &asyncResp, const std::string &objectPath,
- const std::string &service, long certId, const std::string &certURL,
- const std::string &name)
+ const std::shared_ptr<AsyncResp>& asyncResp, const std::string& objectPath,
+ const std::string& service, long certId, const std::string& certURL,
+ const std::string& name)
{
using PropertyType =
std::variant<std::string, uint64_t, std::vector<std::string>>;
@@ -587,7 +588,7 @@
<< " certId=" << certId << " certURl=" << certURL;
crow::connections::systemBus->async_method_call(
[asyncResp, certURL, certId, name](const boost::system::error_code ec,
- const PropertiesMap &properties) {
+ const PropertiesMap& properties) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -601,12 +602,12 @@
{"Id", std::to_string(certId)},
{"Name", name},
{"Description", name}};
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first == "CertificateString")
{
asyncResp->res.jsonValue["CertificateString"] = "";
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value)
{
@@ -615,14 +616,14 @@
}
else if (property.first == "KeyUsage")
{
- nlohmann::json &keyUsage =
+ nlohmann::json& keyUsage =
asyncResp->res.jsonValue["KeyUsage"];
keyUsage = nlohmann::json::array();
- const std::vector<std::string> *value =
+ const std::vector<std::string>* value =
std::get_if<std::vector<std::string>>(&property.second);
if (value)
{
- for (const std::string &usage : *value)
+ for (const std::string& usage : *value)
{
keyUsage.push_back(usage);
}
@@ -630,7 +631,7 @@
}
else if (property.first == "Issuer")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value)
{
@@ -640,7 +641,7 @@
}
else if (property.first == "Subject")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value)
{
@@ -650,7 +651,7 @@
}
else if (property.first == "ValidNotAfter")
{
- const uint64_t *value =
+ const uint64_t* value =
std::get_if<uint64_t>(&property.second);
if (value)
{
@@ -661,7 +662,7 @@
}
else if (property.first == "ValidNotBefore")
{
- const uint64_t *value =
+ const uint64_t* value =
std::get_if<uint64_t>(&property.second);
if (value)
{
@@ -686,7 +687,7 @@
class CertificateActionsReplaceCertificate : public Node
{
public:
- CertificateActionsReplaceCertificate(CrowApp &app) :
+ CertificateActionsReplaceCertificate(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/Actions/"
"CertificateService.ReplaceCertificate/")
{
@@ -700,8 +701,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::string certificate;
nlohmann::json certificateUri;
@@ -812,7 +813,7 @@
{
public:
template <typename CrowApp>
- HTTPSCertificate(CrowApp &app) :
+ HTTPSCertificate(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"
"<str>/",
@@ -827,8 +828,8 @@
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -858,7 +859,7 @@
{
public:
template <typename CrowApp>
- HTTPSCertificateCollection(CrowApp &app) :
+ HTTPSCertificateCollection(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/")
{
@@ -870,8 +871,8 @@
{boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id",
@@ -882,16 +883,16 @@
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &cert : certs)
+ for (const auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -910,8 +911,8 @@
certs::dbusObjManagerIntf, "GetManagedObjects");
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -932,7 +933,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, certFile](const boost::system::error_code ec,
- const std::string &objectPath) {
+ const std::string& objectPath) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -970,7 +971,7 @@
{
public:
template <typename CrowApp>
- CertificateLocations(CrowApp &app) :
+ CertificateLocations(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/CertificateLocations/")
{
entityPrivileges = {
@@ -983,8 +984,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id",
@@ -997,7 +998,7 @@
"Defines a resource that an administrator can use in order to "
"locate all certificates installed on a given service"}};
auto asyncResp = std::make_shared<AsyncResp>(res);
- nlohmann::json &links =
+ nlohmann::json& links =
asyncResp->res.jsonValue["Links"]["Certificates"];
links = nlohmann::json::array();
getCertificateLocations(
@@ -1020,25 +1021,25 @@
* @param[in] path Path of the D-Bus service object
* @return None
*/
- void getCertificateLocations(std::shared_ptr<AsyncResp> &asyncResp,
- const std::string &certURL,
- const std::string &path,
- const std::string &service)
+ void getCertificateLocations(std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& certURL,
+ const std::string& path,
+ const std::string& service)
{
BMCWEB_LOG_DEBUG << "getCertificateLocations URI=" << certURL
<< " Path=" << path << " service= " << service;
crow::connections::systemBus->async_method_call(
[asyncResp, certURL](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &links =
+ nlohmann::json& links =
asyncResp->res.jsonValue["Links"]["Certificates"];
- for (auto &cert : certs)
+ for (auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -1061,7 +1062,7 @@
{
public:
template <typename CrowApp>
- LDAPCertificateCollection(CrowApp &app) :
+ LDAPCertificateCollection(CrowApp& app) :
Node(app, "/redfish/v1/AccountService/LDAP/Certificates/")
{
entityPrivileges = {
@@ -1072,8 +1073,8 @@
{boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id", "/redfish/v1/AccountService/LDAP/Certificates"},
@@ -1083,16 +1084,16 @@
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &cert : certs)
+ for (const auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -1110,8 +1111,8 @@
certs::dbusObjManagerIntf, "GetManagedObjects");
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
@@ -1128,7 +1129,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, certFile](const boost::system::error_code ec,
- const std::string &objectPath) {
+ const std::string& objectPath) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -1165,7 +1166,7 @@
{
public:
template <typename CrowApp>
- LDAPCertificate(CrowApp &app) :
+ LDAPCertificate(CrowApp& app) :
Node(app, "/redfish/v1/AccountService/LDAP/Certificates/<str>/",
std::string())
{
@@ -1178,8 +1179,8 @@
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
long id = getIDFromURL(req.url);
@@ -1206,7 +1207,7 @@
{
public:
template <typename CrowApp>
- TrustStoreCertificateCollection(CrowApp &app) :
+ TrustStoreCertificateCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/")
{
entityPrivileges = {
@@ -1217,8 +1218,8 @@
{boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id", "/redfish/v1/Managers/bmc/Truststore/Certificates/"},
@@ -1229,16 +1230,16 @@
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &cert : certs)
+ for (const auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -1256,8 +1257,8 @@
certs::dbusObjManagerIntf, "GetManagedObjects");
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
@@ -1273,7 +1274,7 @@
std::make_shared<CertificateFile>(certFileBody);
crow::connections::systemBus->async_method_call(
[asyncResp, certFile](const boost::system::error_code ec,
- const std::string &objectPath) {
+ const std::string& objectPath) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -1311,7 +1312,7 @@
{
public:
template <typename CrowApp>
- TrustStoreCertificate(CrowApp &app) :
+ TrustStoreCertificate(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/<str>/",
std::string())
{
@@ -1324,8 +1325,8 @@
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
long id = getIDFromURL(req.url);
@@ -1348,8 +1349,8 @@
"TrustStore Certificate");
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 69a48a7..2b098a9 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -20,6 +20,7 @@
#include "node.hpp"
#include <boost/container/flat_map.hpp>
+
#include <variant>
namespace redfish
@@ -37,7 +38,7 @@
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const std::variant<std::string> &chassisState) {
+ const std::variant<std::string>& chassisState) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -45,7 +46,7 @@
return;
}
- const std::string *s = std::get_if<std::string>(&chassisState);
+ const std::string* s = std::get_if<std::string>(&chassisState);
BMCWEB_LOG_DEBUG << "Chassis state: " << *s;
if (s != nullptr)
{
@@ -85,14 +86,14 @@
using PropertiesType = boost::container::flat_map<std::string, VariantType>;
void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &service,
- const std::string &objPath)
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get intrusion status by service \n";
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](const boost::system::error_code ec,
- const std::variant<std::string> &value) {
+ const std::variant<std::string>& value) {
if (ec)
{
// do not add err msg in redfish response, becaues this is not
@@ -101,7 +102,7 @@
return;
}
- const std::string *status = std::get_if<std::string>(&value);
+ const std::string* status = std::get_if<std::string>(&value);
if (status == nullptr)
{
@@ -126,8 +127,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::vector<std::pair<std::string, std::vector<std::string>>>>>&
+ subtree) {
if (ec)
{
// do not add err msg in redfish response, becaues this is not
@@ -137,9 +138,9 @@
return;
}
// Iterate over all retrieved ObjectPaths.
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
- for (const auto &service : object.second)
+ for (const auto& service : object.second)
{
getIntrusionByService(aResp, service.first, object.first);
return;
@@ -150,7 +151,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/Intrusion", 1,
- std::array<const char *, 1>{"xyz.openbmc_project.Chassis.Intrusion"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Chassis.Intrusion"});
}
/**
@@ -159,7 +160,7 @@
class ChassisCollection : public Node
{
public:
- ChassisCollection(CrowApp &app) : Node(app, "/redfish/v1/Chassis/")
+ ChassisCollection(CrowApp& app) : Node(app, "/redfish/v1/Chassis/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -174,30 +175,30 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#ChassisCollection.ChassisCollection";
res.jsonValue["@odata.id"] = "/redfish/v1/Chassis";
res.jsonValue["Name"] = "Chassis Collection";
- const std::array<const char *, 2> interfaces = {
+ const std::array<const char*, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::string> &chassisList) {
+ const std::vector<std::string>& chassisList) {
if (ec)
{
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &chassisArray =
+ nlohmann::json& chassisArray =
asyncResp->res.jsonValue["Members"];
chassisArray = nlohmann::json::array();
- for (const std::string &objpath : chassisList)
+ for (const std::string& objpath : chassisList)
{
std::size_t lastPos = objpath.rfind("/");
if (lastPos == std::string::npos)
@@ -226,7 +227,7 @@
class Chassis : public Node
{
public:
- Chassis(CrowApp &app) :
+ Chassis(CrowApp& app) :
Node(app, "/redfish/v1/Chassis/<str>/", std::string())
{
entityPrivileges = {
@@ -242,10 +243,10 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
- const std::array<const char *, 2> interfaces = {
+ const std::array<const char*, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
@@ -257,13 +258,13 @@
res.end();
return;
}
- const std::string &chassisId = params[0];
+ const std::string& chassisId = params[0];
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId(std::string(chassisId))](
const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -273,13 +274,13 @@
for (const std::pair<
std::string,
std::vector<
- std::pair<std::string, std::vector<std::string>>>>
- &object : subtree)
+ std::pair<std::string, std::vector<std::string>>>>&
+ object : subtree)
{
- const std::string &path = object.first;
+ const std::string& path = object.first;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object.second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
if (!boost::ends_with(path, chassisId))
{
@@ -290,12 +291,12 @@
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- std::variant<std::vector<std::string>> &resp) {
+ std::variant<std::vector<std::string>>& resp) {
if (ec)
{
return; // no sensors = no failures
}
- std::vector<std::string> *data =
+ std::vector<std::string>* data =
std::get_if<std::vector<std::string>>(&resp);
if (data == nullptr)
{
@@ -326,16 +327,16 @@
{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices"}};
- const std::string &connectionName =
+ const std::string& connectionName =
connectionNames[0].first;
- const std::vector<std::string> &interfaces =
+ const std::vector<std::string>& interfaces =
connectionNames[0].second;
- const std::array<const char *, 2> hasIndicatorLed = {
+ const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
"xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
- for (const char *interface : hasIndicatorLed)
+ for (const char* interface : hasIndicatorLed)
{
if (std::find(interfaces.begin(), interfaces.end(),
interface) != interfaces.end())
@@ -349,20 +350,20 @@
[asyncResp, chassisId(std::string(chassisId))](
const boost::system::error_code ec,
const std::vector<std::pair<
- std::string, VariantType>> &propertiesList) {
- for (const std::pair<std::string, VariantType>
- &property : propertiesList)
+ std::string, VariantType>>& propertiesList) {
+ for (const std::pair<std::string, VariantType>&
+ property : propertiesList)
{
// Store DBus properties that are also Redfish
// properties with same name and a string value
- const std::string &propertyName =
+ const std::string& propertyName =
property.first;
if ((propertyName == "PartNumber") ||
(propertyName == "SerialNumber") ||
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value != nullptr)
@@ -414,8 +415,8 @@
getPhysicalSecurityData(asyncResp);
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::optional<std::string> indicatorLed;
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -435,16 +436,16 @@
return; // delete this when we support more patch properties
}
- const std::array<const char *, 2> interfaces = {
+ const std::array<const char*, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
- const std::string &chassisId = params[0];
+ const std::string& chassisId = params[0];
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId, indicatorLed](
const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -455,13 +456,13 @@
for (const std::pair<
std::string,
std::vector<
- std::pair<std::string, std::vector<std::string>>>>
- &object : subtree)
+ std::pair<std::string, std::vector<std::string>>>>&
+ object : subtree)
{
- const std::string &path = object.first;
+ const std::string& path = object.first;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object.second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
if (!boost::ends_with(path, chassisId))
{
@@ -474,17 +475,17 @@
continue;
}
- const std::vector<std::string> &interfaces =
+ const std::vector<std::string>& interfaces =
connectionNames[0].second;
if (indicatorLed)
{
- const std::array<const char *, 2> hasIndicatorLed = {
+ const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
"xyz.openbmc_project.Inventory.Item.Board."
"Motherboard"};
bool indicatorChassis = false;
- for (const char *interface : hasIndicatorLed)
+ for (const char* interface : hasIndicatorLed)
{
if (std::find(interfaces.begin(), interfaces.end(),
interface) != interfaces.end())
diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp
index 5f6baa3..2e49b99 100644
--- a/redfish-core/lib/cpudimm.hpp
+++ b/redfish-core/lib/cpudimm.hpp
@@ -29,8 +29,8 @@
boost::container::flat_map<std::string, dbus::utility::DbusVariantType>>;
void getResourceList(std::shared_ptr<AsyncResp> aResp,
- const std::string &subclass,
- const std::vector<const char *> &collectionName)
+ const std::string& subclass,
+ const std::vector<const char*>& collectionName)
{
BMCWEB_LOG_DEBUG << "Get available system cpu/mem resources.";
crow::connections::systemBus->async_method_call(
@@ -38,18 +38,18 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &subtree) {
+ std::string, std::vector<std::string>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
messages::internalError(aResp->res);
return;
}
- nlohmann::json &members = aResp->res.jsonValue["Members"];
+ nlohmann::json& members = aResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
auto iter = object.first.rfind("/");
if ((iter != std::string::npos) && (iter < object.first.size()))
@@ -69,19 +69,19 @@
}
void getCpuDataByInterface(std::shared_ptr<AsyncResp> aResp,
- const InterfacesProperties &cpuInterfacesProperties)
+ const InterfacesProperties& cpuInterfacesProperties)
{
BMCWEB_LOG_DEBUG << "Get CPU resources by interface.";
- const bool *present = nullptr;
- const bool *functional = nullptr;
- for (const auto &interface : cpuInterfacesProperties)
+ const bool* present = nullptr;
+ const bool* functional = nullptr;
+ for (const auto& interface : cpuInterfacesProperties)
{
- for (const auto &property : interface.second)
+ for (const auto& property : interface.second)
{
if (property.first == "ProcessorCoreCount")
{
- const uint16_t *coresCount =
+ const uint16_t* coresCount =
std::get_if<uint16_t>(&property.second);
if (coresCount == nullptr)
{
@@ -106,7 +106,7 @@
}
else if (property.first == "Manufacturer")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -134,7 +134,7 @@
}
else if (property.first == "Model")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -193,15 +193,15 @@
}
void getCpuDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &cpuId, const std::string &service,
- const std::string &objPath)
+ const std::string& cpuId, const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get available system cpu resources by service.";
crow::connections::systemBus->async_method_call(
[cpuId, service, objPath, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const dbus::utility::ManagedObjectType &dbusData) {
+ const dbus::utility::ManagedObjectType& dbusData) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -214,7 +214,7 @@
std::string corePath = objPath + "/core";
size_t totalCores = 0;
- for (const auto &object : dbusData)
+ for (const auto& object : dbusData)
{
if (object.first.str == objPath)
{
@@ -222,16 +222,16 @@
}
else if (boost::starts_with(object.first.str, corePath))
{
- for (const auto &interface : object.second)
+ for (const auto& interface : object.second)
{
if (interface.first ==
"xyz.openbmc_project.Inventory.Item")
{
- for (const auto &property : interface.second)
+ for (const auto& property : interface.second)
{
if (property.first == "Present")
{
- const bool *present =
+ const bool* present =
std::get_if<bool>(&property.second);
if (present != nullptr)
{
@@ -263,9 +263,9 @@
}
void getAcceleratorDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &acclrtrId,
- const std::string &service,
- const std::string &objPath)
+ const std::string& acclrtrId,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG
<< "Get available system Accelerator resources by service.";
@@ -274,7 +274,7 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, std::variant<std::string, uint32_t, uint16_t,
- bool>> &properties) {
+ bool>>& properties) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -283,11 +283,11 @@
}
aResp->res.jsonValue["Id"] = acclrtrId;
aResp->res.jsonValue["Name"] = "Processor";
- const bool *accPresent = nullptr;
- const bool *accFunctional = nullptr;
+ const bool* accPresent = nullptr;
+ const bool* accFunctional = nullptr;
std::string state = "";
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first == "Functional")
{
@@ -326,8 +326,8 @@
service, objPath, "org.freedesktop.DBus.Properties", "GetAll", "");
}
-void getCpuData(std::shared_ptr<AsyncResp> aResp, const std::string &cpuId,
- const std::vector<const char *> inventoryItems)
+void getCpuData(std::shared_ptr<AsyncResp> aResp, const std::string& cpuId,
+ const std::vector<const char*> inventoryItems)
{
BMCWEB_LOG_DEBUG << "Get available system cpu resources.";
@@ -336,21 +336,21 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &subtree) {
+ std::string, std::vector<std::string>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
messages::internalError(aResp->res);
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
if (boost::ends_with(object.first, cpuId))
{
- for (const auto &service : object.second)
+ for (const auto& service : object.second)
{
- for (const auto &inventory : service.second)
+ for (const auto& inventory : service.second)
if (inventory ==
"xyz.openbmc_project.Inventory.Item.Cpu")
{
@@ -378,8 +378,8 @@
}
void getDimmDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &dimmId, const std::string &service,
- const std::string &objPath)
+ const std::string& dimmId, const std::string& service,
+ const std::string& objPath)
{
auto health = std::make_shared<HealthPopulate>(aResp);
health->selfPath = objPath;
@@ -390,8 +390,8 @@
[dimmId, aResp{std::move(aResp)}](
const boost::system::error_code ec,
const boost::container::flat_map<
- std::string, std::variant<std::string, uint32_t, uint16_t>>
- &properties) {
+ std::string, std::variant<std::string, uint32_t, uint16_t>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -405,7 +405,7 @@
const auto memorySizeProperty = properties.find("MemorySizeInKB");
if (memorySizeProperty != properties.end())
{
- const uint32_t *memorySize =
+ const uint32_t* memorySize =
std::get_if<uint32_t>(&memorySizeProperty->second);
if (memorySize == nullptr)
{
@@ -427,7 +427,7 @@
aResp->res.jsonValue["Status"]["State"] = "Enabled";
aResp->res.jsonValue["Status"]["Health"] = "OK";
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first == "MemoryDataWidth")
{
@@ -447,7 +447,7 @@
}
else if (property.first == "MemoryType")
{
- const auto *value =
+ const auto* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -463,7 +463,7 @@
service, objPath, "org.freedesktop.DBus.Properties", "GetAll", "");
}
-void getDimmData(std::shared_ptr<AsyncResp> aResp, const std::string &dimmId)
+void getDimmData(std::shared_ptr<AsyncResp> aResp, const std::string& dimmId)
{
BMCWEB_LOG_DEBUG << "Get available system dimm resources.";
crow::connections::systemBus->async_method_call(
@@ -471,8 +471,8 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &subtree) {
+ std::string, std::vector<std::string>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -480,11 +480,11 @@
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
if (boost::ends_with(object.first, dimmId))
{
- for (const auto &service : object.second)
+ for (const auto& service : object.second)
{
getDimmDataByService(aResp, dimmId, service.first,
object.first);
@@ -500,7 +500,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", 0,
- std::array<const char *, 1>{"xyz.openbmc_project.Inventory.Item.Dimm"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Inventory.Item.Dimm"});
}
class ProcessorCollection : public Node
@@ -509,7 +509,7 @@
/*
* Default Constructor
*/
- ProcessorCollection(CrowApp &app) :
+ ProcessorCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Processors/")
{
entityPrivileges = {
@@ -525,8 +525,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] =
"#ProcessorCollection.ProcessorCollection";
@@ -547,7 +547,7 @@
/*
* Default Constructor
*/
- Processor(CrowApp &app) :
+ Processor(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Processors/<str>/", std::string())
{
entityPrivileges = {
@@ -563,8 +563,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Check if there is required param, truly entering this shall be
// impossible
@@ -575,7 +575,7 @@
res.end();
return;
}
- const std::string &processorId = params[0];
+ const std::string& processorId = params[0];
res.jsonValue["@odata.type"] = "#Processor.v1_7_0.Processor";
res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/Processors/" + processorId;
@@ -594,7 +594,7 @@
/*
* Default Constructor
*/
- MemoryCollection(CrowApp &app) :
+ MemoryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Memory/")
{
entityPrivileges = {
@@ -610,8 +610,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#MemoryCollection.MemoryCollection";
res.jsonValue["Name"] = "Memory Module Collection";
@@ -629,7 +629,7 @@
/*
* Default Constructor
*/
- Memory(CrowApp &app) :
+ Memory(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Memory/<str>/", std::string())
{
entityPrivileges = {
@@ -645,8 +645,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Check if there is required param, truly entering this shall be
// impossible
@@ -656,7 +656,7 @@
res.end();
return;
}
- const std::string &dimmId = params[0];
+ const std::string& dimmId = params[0];
res.jsonValue["@odata.type"] = "#Memory.v1_6_0.Memory";
res.jsonValue["@odata.id"] =
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 1f65254..a76b01b 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -20,9 +20,10 @@
#include <dbus_singleton.hpp>
#include <error_messages.hpp>
#include <node.hpp>
+#include <utils/json_utils.hpp>
+
#include <optional>
#include <regex>
-#include <utils/json_utils.hpp>
#include <variant>
namespace redfish
@@ -65,7 +66,7 @@
std::string origin;
LinkType linktype;
- bool operator<(const IPv4AddressData &obj) const
+ bool operator<(const IPv4AddressData& obj) const
{
return id < obj.id;
}
@@ -81,7 +82,7 @@
std::string origin;
uint8_t prefixLength;
- bool operator<(const IPv6AddressData &obj) const
+ bool operator<(const IPv6AddressData& obj) const
{
return id < obj.id;
}
@@ -133,7 +134,7 @@
return netmask;
}
-inline bool translateDHCPEnabledToBool(const std::string &inputDHCP,
+inline bool translateDHCPEnabledToBool(const std::string& inputDHCP,
bool isIPv4)
{
if (isIPv4)
@@ -168,7 +169,7 @@
}
inline std::string
- translateAddressOriginDbusToRedfish(const std::string &inputOrigin,
+ translateAddressOriginDbusToRedfish(const std::string& inputOrigin,
bool isIPv4)
{
if (inputOrigin == "xyz.openbmc_project.Network.IP.AddressOrigin.Static")
@@ -204,25 +205,25 @@
return "";
}
-inline bool extractEthernetInterfaceData(const std::string ðiface_id,
- const GetManagedObjects &dbus_data,
- EthernetInterfaceData ðData)
+inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
+ const GetManagedObjects& dbus_data,
+ EthernetInterfaceData& ethData)
{
bool idFound = false;
- for (const auto &objpath : dbus_data)
+ for (const auto& objpath : dbus_data)
{
- for (const auto &ifacePair : objpath.second)
+ for (const auto& ifacePair : objpath.second)
{
if (objpath.first == "/xyz/openbmc_project/network/" + ethiface_id)
{
idFound = true;
if (ifacePair.first == "xyz.openbmc_project.Network.MACAddress")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "MACAddress")
{
- const std::string *mac =
+ const std::string* mac =
std::get_if<std::string>(&propertyPair.second);
if (mac != nullptr)
{
@@ -233,11 +234,11 @@
}
else if (ifacePair.first == "xyz.openbmc_project.Network.VLAN")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "Id")
{
- const uint32_t *id =
+ const uint32_t* id =
std::get_if<uint32_t>(&propertyPair.second);
if (id != nullptr)
{
@@ -249,11 +250,11 @@
else if (ifacePair.first ==
"xyz.openbmc_project.Network.EthernetInterface")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "AutoNeg")
{
- const bool *auto_neg =
+ const bool* auto_neg =
std::get_if<bool>(&propertyPair.second);
if (auto_neg != nullptr)
{
@@ -262,7 +263,7 @@
}
else if (propertyPair.first == "Speed")
{
- const uint32_t *speed =
+ const uint32_t* speed =
std::get_if<uint32_t>(&propertyPair.second);
if (speed != nullptr)
{
@@ -271,7 +272,7 @@
}
else if (propertyPair.first == "LinkUp")
{
- const bool *linkUp =
+ const bool* linkUp =
std::get_if<bool>(&propertyPair.second);
if (linkUp != nullptr)
{
@@ -280,7 +281,7 @@
}
else if (propertyPair.first == "NICEnabled")
{
- const bool *nicEnabled =
+ const bool* nicEnabled =
std::get_if<bool>(&propertyPair.second);
if (nicEnabled != nullptr)
{
@@ -289,7 +290,7 @@
}
else if (propertyPair.first == "Nameservers")
{
- const std::vector<std::string> *nameservers =
+ const std::vector<std::string>* nameservers =
std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (nameservers != nullptr)
@@ -299,7 +300,7 @@
}
else if (propertyPair.first == "StaticNameServers")
{
- const std::vector<std::string> *staticNameServers =
+ const std::vector<std::string>* staticNameServers =
std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (staticNameServers != nullptr)
@@ -310,7 +311,7 @@
}
else if (propertyPair.first == "DHCPEnabled")
{
- const std::string *DHCPEnabled =
+ const std::string* DHCPEnabled =
std::get_if<std::string>(&propertyPair.second);
if (DHCPEnabled != nullptr)
{
@@ -319,7 +320,7 @@
}
else if (propertyPair.first == "DomainName")
{
- const std::vector<std::string> *domainNames =
+ const std::vector<std::string>* domainNames =
std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (domainNames != nullptr)
@@ -336,11 +337,11 @@
if (ifacePair.first ==
"xyz.openbmc_project.Network.DHCPConfiguration")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "DNSEnabled")
{
- const bool *DNSEnabled =
+ const bool* DNSEnabled =
std::get_if<bool>(&propertyPair.second);
if (DNSEnabled != nullptr)
{
@@ -349,7 +350,7 @@
}
else if (propertyPair.first == "NTPEnabled")
{
- const bool *NTPEnabled =
+ const bool* NTPEnabled =
std::get_if<bool>(&propertyPair.second);
if (NTPEnabled != nullptr)
{
@@ -358,7 +359,7 @@
}
else if (propertyPair.first == "HostNameEnabled")
{
- const bool *HostNameEnabled =
+ const bool* HostNameEnabled =
std::get_if<bool>(&propertyPair.second);
if (HostNameEnabled != nullptr)
{
@@ -367,7 +368,7 @@
}
else if (propertyPair.first == "SendHostNameEnabled")
{
- const bool *SendHostNameEnabled =
+ const bool* SendHostNameEnabled =
std::get_if<bool>(&propertyPair.second);
if (SendHostNameEnabled != nullptr)
{
@@ -383,11 +384,11 @@
if (ifacePair.first ==
"xyz.openbmc_project.Network.SystemConfiguration")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "HostName")
{
- const std::string *hostname =
+ const std::string* hostname =
std::get_if<std::string>(&propertyPair.second);
if (hostname != nullptr)
{
@@ -396,7 +397,7 @@
}
else if (propertyPair.first == "DefaultGateway")
{
- const std::string *defaultGateway =
+ const std::string* defaultGateway =
std::get_if<std::string>(&propertyPair.second);
if (defaultGateway != nullptr)
{
@@ -405,7 +406,7 @@
}
else if (propertyPair.first == "DefaultGateway6")
{
- const std::string *defaultGateway6 =
+ const std::string* defaultGateway6 =
std::get_if<std::string>(&propertyPair.second);
if (defaultGateway6 != nullptr)
{
@@ -421,21 +422,21 @@
// Helper function that extracts data for single ethernet ipv6 address
inline void
- extractIPV6Data(const std::string ðiface_id,
- const GetManagedObjects &dbus_data,
- boost::container::flat_set<IPv6AddressData> &ipv6_config)
+ extractIPV6Data(const std::string& ethiface_id,
+ const GetManagedObjects& dbus_data,
+ boost::container::flat_set<IPv6AddressData>& ipv6_config)
{
const std::string ipv6PathStart =
"/xyz/openbmc_project/network/" + ethiface_id + "/ipv6/";
// Since there might be several IPv6 configurations aligned with
// single ethernet interface, loop over all of them
- for (const auto &objpath : dbus_data)
+ for (const auto& objpath : dbus_data)
{
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv6PathStart))
{
- for (auto &interface : objpath.second)
+ for (auto& interface : objpath.second)
{
if (interface.first == "xyz.openbmc_project.Network.IP")
{
@@ -445,14 +446,14 @@
boost::container::flat_set<IPv6AddressData>::iterator,
bool>
it = ipv6_config.insert(IPv6AddressData{});
- IPv6AddressData &ipv6_address = *it.first;
+ IPv6AddressData& ipv6_address = *it.first;
ipv6_address.id =
objpath.first.str.substr(ipv6PathStart.size());
- for (auto &property : interface.second)
+ for (auto& property : interface.second)
{
if (property.first == "Address")
{
- const std::string *address =
+ const std::string* address =
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
@@ -461,7 +462,7 @@
}
else if (property.first == "Origin")
{
- const std::string *origin =
+ const std::string* origin =
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
@@ -472,7 +473,7 @@
}
else if (property.first == "PrefixLength")
{
- const uint8_t *prefix =
+ const uint8_t* prefix =
std::get_if<uint8_t>(&property.second);
if (prefix != nullptr)
{
@@ -494,21 +495,21 @@
// Helper function that extracts data for single ethernet ipv4 address
inline void
- extractIPData(const std::string ðiface_id,
- const GetManagedObjects &dbus_data,
- boost::container::flat_set<IPv4AddressData> &ipv4_config)
+ extractIPData(const std::string& ethiface_id,
+ const GetManagedObjects& dbus_data,
+ boost::container::flat_set<IPv4AddressData>& ipv4_config)
{
const std::string ipv4PathStart =
"/xyz/openbmc_project/network/" + ethiface_id + "/ipv4/";
// Since there might be several IPv4 configurations aligned with
// single ethernet interface, loop over all of them
- for (const auto &objpath : dbus_data)
+ for (const auto& objpath : dbus_data)
{
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv4PathStart))
{
- for (auto &interface : objpath.second)
+ for (auto& interface : objpath.second)
{
if (interface.first == "xyz.openbmc_project.Network.IP")
{
@@ -518,14 +519,14 @@
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
it = ipv4_config.insert(IPv4AddressData{});
- IPv4AddressData &ipv4_address = *it.first;
+ IPv4AddressData& ipv4_address = *it.first;
ipv4_address.id =
objpath.first.str.substr(ipv4PathStart.size());
- for (auto &property : interface.second)
+ for (auto& property : interface.second)
{
if (property.first == "Address")
{
- const std::string *address =
+ const std::string* address =
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
@@ -534,7 +535,7 @@
}
else if (property.first == "Gateway")
{
- const std::string *gateway =
+ const std::string* gateway =
std::get_if<std::string>(&property.second);
if (gateway != nullptr)
{
@@ -543,7 +544,7 @@
}
else if (property.first == "Origin")
{
- const std::string *origin =
+ const std::string* origin =
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
@@ -554,7 +555,7 @@
}
else if (property.first == "PrefixLength")
{
- const uint8_t *mask =
+ const uint8_t* mask =
std::get_if<uint8_t>(&property.second);
if (mask != nullptr)
{
@@ -590,8 +591,8 @@
* @return None.
*/
template <typename CallbackFunc>
-void changeVlanId(const std::string &ifaceId, const uint32_t &inputVlanId,
- CallbackFunc &&callback)
+void changeVlanId(const std::string& ifaceId, const uint32_t& inputVlanId,
+ CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
callback, "xyz.openbmc_project.Network",
@@ -611,8 +612,8 @@
*
* @return true in case of success, false otherwise
*/
-inline bool ipv4VerifyIpAndGetBitcount(const std::string &ip,
- uint8_t *bits = nullptr)
+inline bool ipv4VerifyIpAndGetBitcount(const std::string& ip,
+ uint8_t* bits = nullptr)
{
std::vector<std::string> bytesInMask;
@@ -629,10 +630,10 @@
*bits = 0;
}
- char *endPtr;
+ char* endPtr;
long previousValue = 255;
bool firstZeroInByteHit;
- for (const std::string &byte : bytesInMask)
+ for (const std::string& byte : bytesInMask)
{
if (byte.empty())
{
@@ -703,7 +704,7 @@
*
* @return None
*/
-inline void deleteIPv4(const std::string &ifaceId, const std::string &ipHash,
+inline void deleteIPv4(const std::string& ifaceId, const std::string& ipHash,
const std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -729,9 +730,9 @@
*
* @return None
*/
-inline void createIPv4(const std::string &ifaceId, unsigned int ipIdx,
- uint8_t prefixLength, const std::string &gateway,
- const std::string &address,
+inline void createIPv4(const std::string& ifaceId, unsigned int ipIdx,
+ uint8_t prefixLength, const std::string& gateway,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -761,10 +762,10 @@
*
* @return None
*/
-inline void deleteAndCreateIPv4(const std::string &ifaceId,
- const std::string &id, uint8_t prefixLength,
- const std::string &gateway,
- const std::string &address,
+inline void deleteAndCreateIPv4(const std::string& ifaceId,
+ const std::string& id, uint8_t prefixLength,
+ const std::string& gateway,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -801,7 +802,7 @@
*
* @return None
*/
-inline void deleteIPv6(const std::string &ifaceId, const std::string &ipHash,
+inline void deleteIPv6(const std::string& ifaceId, const std::string& ipHash,
const std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -828,9 +829,9 @@
*
* @return None
*/
-inline void deleteAndCreateIPv6(const std::string &ifaceId,
- const std::string &id, uint8_t prefixLength,
- const std::string &address,
+inline void deleteAndCreateIPv6(const std::string& ifaceId,
+ const std::string& id, uint8_t prefixLength,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -868,8 +869,8 @@
*
* @return None
*/
-inline void createIPv6(const std::string &ifaceId, uint8_t prefixLength,
- const std::string &address,
+inline void createIPv6(const std::string& ifaceId, uint8_t prefixLength,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
auto createIpHandler = [asyncResp](const boost::system::error_code ec) {
@@ -897,13 +898,13 @@
* into JSON
*/
template <typename CallbackFunc>
-void getEthernetIfaceData(const std::string ðiface_id,
- CallbackFunc &&callback)
+void getEthernetIfaceData(const std::string& ethiface_id,
+ CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[ethiface_id{std::string{ethiface_id}}, callback{std::move(callback)}](
const boost::system::error_code error_code,
- const GetManagedObjects &resp) {
+ const GetManagedObjects& resp) {
EthernetInterfaceData ethData{};
boost::container::flat_set<IPv4AddressData> ipv4Data;
boost::container::flat_set<IPv6AddressData> ipv6Data;
@@ -924,7 +925,7 @@
extractIPData(ethiface_id, resp, ipv4Data);
// Fix global GW
- for (IPv4AddressData &ipv4 : ipv4Data)
+ for (IPv4AddressData& ipv4 : ipv4Data)
{
if (((ipv4.linktype == LinkType::Global) &&
(ipv4.gateway == "0.0.0.0")) ||
@@ -949,12 +950,12 @@
* into JSON.
*/
template <typename CallbackFunc>
-void getEthernetIfaceList(CallbackFunc &&callback)
+void getEthernetIfaceList(CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code error_code,
- GetManagedObjects &resp) {
+ GetManagedObjects& resp) {
// Callback requires vector<string> to retrieve all available
// ethernet interfaces
boost::container::flat_set<std::string> iface_list;
@@ -966,10 +967,10 @@
}
// Iterate over all retrieved ObjectPaths.
- for (const auto &objpath : resp)
+ for (const auto& objpath : resp)
{
// And all interfaces available for certain ObjectPath.
- for (const auto &interface : objpath.second)
+ for (const auto& interface : objpath.second)
{
// If interface is
// xyz.openbmc_project.Network.EthernetInterface, this is
@@ -978,7 +979,7 @@
"xyz.openbmc_project.Network.EthernetInterface")
{
// Cut out everyting until last "/", ...
- const std::string &iface_id = objpath.first.str;
+ const std::string& iface_id = objpath.first.str;
std::size_t last_pos = iface_id.rfind("/");
if (last_pos != std::string::npos)
{
@@ -1002,7 +1003,7 @@
{
public:
template <typename CrowApp>
- EthernetCollection(CrowApp &app) :
+ EthernetCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/")
{
entityPrivileges = {
@@ -1018,8 +1019,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] =
"#EthernetInterfaceCollection.EthernetInterfaceCollection";
@@ -1033,19 +1034,19 @@
// preparation
getEthernetIfaceList(
[asyncResp](
- const bool &success,
- const boost::container::flat_set<std::string> &iface_list) {
+ const bool& success,
+ const boost::container::flat_set<std::string>& iface_list) {
if (!success)
{
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &iface_array =
+ nlohmann::json& iface_array =
asyncResp->res.jsonValue["Members"];
iface_array = nlohmann::json::array();
std::string tag = "_";
- for (const std::string &iface_item : iface_list)
+ for (const std::string& iface_item : iface_list)
{
std::size_t found = iface_item.find(tag);
if (found == std::string::npos)
@@ -1075,7 +1076,7 @@
* Default Constructor
*/
template <typename CrowApp>
- EthernetInterface(CrowApp &app) :
+ EthernetInterface(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/",
std::string())
{
@@ -1089,7 +1090,7 @@
}
private:
- void handleHostnamePatch(const std::string &hostname,
+ void handleHostnamePatch(const std::string& hostname,
const std::shared_ptr<AsyncResp> asyncResp)
{
// SHOULD handle host names of up to 255 characters(RFC 1123)
@@ -1113,8 +1114,8 @@
std::variant<std::string>(hostname));
}
- void handleDomainnamePatch(const std::string &ifaceId,
- const std::string &domainname,
+ void handleDomainnamePatch(const std::string& ifaceId,
+ const std::string& domainname,
const std::shared_ptr<AsyncResp> asyncResp)
{
std::vector<std::string> vectorDomainname = {domainname};
@@ -1132,7 +1133,7 @@
std::variant<std::vector<std::string>>(vectorDomainname));
}
- void handleFqdnPatch(const std::string &ifaceId, const std::string &fqdn,
+ void handleFqdnPatch(const std::string& ifaceId, const std::string& fqdn,
const std::shared_ptr<AsyncResp> asyncResp)
{
// Total length of FQDN must not exceed 255 characters(RFC 1035)
@@ -1164,7 +1165,7 @@
handleDomainnamePatch(ifaceId, domainname, asyncResp);
}
- bool isHostnameValid(const std::string &hostname)
+ bool isHostnameValid(const std::string& hostname)
{
// A valid host name can never have the dotted-decimal form (RFC 1123)
if (std::all_of(hostname.begin(), hostname.end(), ::isdigit))
@@ -1181,7 +1182,7 @@
return std::regex_match(hostname, pattern);
}
- bool isDomainnameValid(const std::string &domainname)
+ bool isDomainnameValid(const std::string& domainname)
{
// Can have multiple subdomains
// Top Level Domain's min length is 2 character
@@ -1191,9 +1192,9 @@
return std::regex_match(domainname, pattern);
}
- void handleMACAddressPatch(const std::string &ifaceId,
- const std::string &macAddress,
- const std::shared_ptr<AsyncResp> &asyncResp)
+ void handleMACAddressPatch(const std::string& ifaceId,
+ const std::string& macAddress,
+ const std::shared_ptr<AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
[asyncResp, macAddress](const boost::system::error_code ec) {
@@ -1210,8 +1211,8 @@
std::variant<std::string>(macAddress));
}
- void setDHCPEnabled(const std::string &ifaceId,
- const std::string &propertyName, const bool v4Value,
+ void setDHCPEnabled(const std::string& ifaceId,
+ const std::string& propertyName, const bool v4Value,
const bool v6Value,
const std::shared_ptr<AsyncResp> asyncResp)
{
@@ -1233,8 +1234,8 @@
}
void setEthernetInterfaceBoolProperty(
- const std::string &ifaceId, const std::string &propertyName,
- const bool &value, const std::shared_ptr<AsyncResp> asyncResp)
+ const std::string& ifaceId, const std::string& propertyName,
+ const bool& value, const std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
@@ -1252,7 +1253,7 @@
std::variant<bool>{value});
}
- void setDHCPv4Config(const std::string &propertyName, const bool &value,
+ void setDHCPv4Config(const std::string& propertyName, const bool& value,
const std::shared_ptr<AsyncResp> asyncResp)
{
BMCWEB_LOG_DEBUG << propertyName << " = " << value;
@@ -1272,8 +1273,8 @@
std::variant<bool>{value});
}
- void handleDHCPPatch(const std::string &ifaceId,
- const EthernetInterfaceData ðData,
+ void handleDHCPPatch(const std::string& ifaceId,
+ const EthernetInterfaceData& ethData,
DHCPParameters v4dhcpParms, DHCPParameters v6dhcpParms,
const std::shared_ptr<AsyncResp> asyncResp)
{
@@ -1414,8 +1415,8 @@
}
void handleIPv4StaticPatch(
- const std::string &ifaceId, nlohmann::json &input,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
+ const std::string& ifaceId, nlohmann::json& input,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
const std::shared_ptr<AsyncResp> asyncResp)
{
if ((!input.is_array()) || input.empty())
@@ -1433,7 +1434,7 @@
boost::container::flat_set<IPv4AddressData>::const_iterator NICIPentry =
GetNextStaticIPEntry(ipv4Data.cbegin(), ipv4Data.cend());
- for (nlohmann::json &thisJson : input)
+ for (nlohmann::json& thisJson : input)
{
std::string pathString =
"IPv4StaticAddresses/" + std::to_string(entryIdx);
@@ -1457,8 +1458,8 @@
// not explicitly provided are assumed to be unmodified from the
// current state of the interface. Merge existing state into the
// current request.
- const std::string *addr = nullptr;
- const std::string *gw = nullptr;
+ const std::string* addr = nullptr;
+ const std::string* gw = nullptr;
uint8_t prefixLength = 0;
bool errorInEntry = false;
if (address)
@@ -1591,9 +1592,9 @@
}
void handleStaticNameServersPatch(
- const std::string &ifaceId,
- const std::vector<std::string> &updatedStaticNameServers,
- const std::shared_ptr<AsyncResp> &asyncResp)
+ const std::string& ifaceId,
+ const std::vector<std::string>& updatedStaticNameServers,
+ const std::shared_ptr<AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
@@ -1612,8 +1613,8 @@
}
void handleIPv6StaticAddressesPatch(
- const std::string &ifaceId, nlohmann::json &input,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data,
+ const std::string& ifaceId, nlohmann::json& input,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data,
const std::shared_ptr<AsyncResp> asyncResp)
{
if (!input.is_array() || input.empty())
@@ -1625,7 +1626,7 @@
size_t entryIdx = 1;
boost::container::flat_set<IPv6AddressData>::const_iterator NICIPentry =
GetNextStaticIPEntry(ipv6Data.cbegin(), ipv6Data.cend());
- for (nlohmann::json &thisJson : input)
+ for (nlohmann::json& thisJson : input)
{
std::string pathString =
"IPv6StaticAddresses/" + std::to_string(entryIdx);
@@ -1643,7 +1644,7 @@
return;
}
- const std::string *addr;
+ const std::string* addr;
uint8_t prefix;
// Find the address and prefixLength values. Any values that are
@@ -1728,15 +1729,15 @@
}
void parseInterfaceData(
- std::shared_ptr<AsyncResp> asyncResp, const std::string &iface_id,
- const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data)
+ std::shared_ptr<AsyncResp> asyncResp, const std::string& iface_id,
+ const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data)
{
- constexpr const std::array<const char *, 1> inventoryForEthernet = {
+ constexpr const std::array<const char*, 1> inventoryForEthernet = {
"xyz.openbmc_project.Inventory.Item.Ethernet"};
- nlohmann::json &json_response = asyncResp->res.jsonValue;
+ nlohmann::json& json_response = asyncResp->res.jsonValue;
json_response["Id"] = iface_id;
json_response["@odata.id"] =
"/redfish/v1/Managers/bmc/EthernetInterfaces/" + iface_id;
@@ -1746,7 +1747,7 @@
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- std::vector<std::string> &resp) {
+ std::vector<std::string>& resp) {
if (ec)
{
return;
@@ -1810,12 +1811,12 @@
json_response["NameServers"] = ethData.nameServers;
json_response["StaticNameServers"] = ethData.staticNameServers;
- nlohmann::json &ipv4_array = json_response["IPv4Addresses"];
- nlohmann::json &ipv4_static_array =
+ nlohmann::json& ipv4_array = json_response["IPv4Addresses"];
+ nlohmann::json& ipv4_static_array =
json_response["IPv4StaticAddresses"];
ipv4_array = nlohmann::json::array();
ipv4_static_array = nlohmann::json::array();
- for (auto &ipv4_config : ipv4Data)
+ for (auto& ipv4_config : ipv4Data)
{
std::string gatewayStr = ipv4_config.gateway;
@@ -1840,15 +1841,15 @@
json_response["IPv6DefaultGateway"] = ethData.ipv6_default_gateway;
- nlohmann::json &ipv6_array = json_response["IPv6Addresses"];
- nlohmann::json &ipv6_static_array =
+ nlohmann::json& ipv6_array = json_response["IPv6Addresses"];
+ nlohmann::json& ipv6_static_array =
json_response["IPv6StaticAddresses"];
ipv6_array = nlohmann::json::array();
ipv6_static_array = nlohmann::json::array();
- nlohmann::json &ipv6AddrPolicyTable =
+ nlohmann::json& ipv6AddrPolicyTable =
json_response["IPv6AddressPolicyTable"];
ipv6AddrPolicyTable = nlohmann::json::array();
- for (auto &ipv6_config : ipv6Data)
+ for (auto& ipv6_config : ipv6Data)
{
ipv6_array.push_back({{"Address", ipv6_config.address},
{"PrefixLength", ipv6_config.prefixLength},
@@ -1868,8 +1869,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1881,9 +1882,9 @@
getEthernetIfaceData(
params[0],
[this, asyncResp, iface_id{std::string(params[0])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (!success)
{
// TODO(Pawel)consider distinguish between non existing
@@ -1904,8 +1905,8 @@
});
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1914,7 +1915,7 @@
return;
}
- const std::string &iface_id = params[0];
+ const std::string& iface_id = params[0];
std::optional<std::string> hostname;
std::optional<std::string> fqdn;
@@ -1978,9 +1979,9 @@
v4dhcpParms = std::move(v4dhcpParms),
v6dhcpParms = std::move(v6dhcpParms),
interfaceEnabled = std::move(interfaceEnabled)](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (!success)
{
// ... otherwise return error
@@ -2065,7 +2066,7 @@
* Default Constructor
*/
template <typename CrowApp>
- VlanNetworkInterface(CrowApp &app) :
+ VlanNetworkInterface(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/<str>/",
std::string(), std::string())
@@ -2081,10 +2082,10 @@
private:
void parseInterfaceData(
- nlohmann::json &json_response, const std::string &parent_iface_id,
- const std::string &iface_id, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data)
+ nlohmann::json& json_response, const std::string& parent_iface_id,
+ const std::string& iface_id, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data)
{
// Fill out obvious data...
json_response["Id"] = iface_id;
@@ -2099,7 +2100,7 @@
}
}
- bool verifyNames(const std::string &parent, const std::string &iface)
+ bool verifyNames(const std::string& parent, const std::string& iface)
{
if (!boost::starts_with(iface, parent + "_"))
{
@@ -2114,8 +2115,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// TODO(Pawel) this shall be parameterized call (two params) to get
@@ -2129,8 +2130,8 @@
return;
}
- const std::string &parent_iface_id = params[0];
- const std::string &iface_id = params[1];
+ const std::string& parent_iface_id = params[0];
+ const std::string& iface_id = params[1];
res.jsonValue["@odata.type"] =
"#VLanNetworkInterface.v1_1_0.VLanNetworkInterface";
res.jsonValue["Name"] = "VLAN Network Interface";
@@ -2146,9 +2147,9 @@
params[1],
[this, asyncResp, parent_iface_id{std::string(params[0])},
iface_id{std::string(params[1])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (success && ethData.vlan_id.size() != 0)
{
parseInterfaceData(asyncResp->res.jsonValue,
@@ -2166,8 +2167,8 @@
});
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -2176,8 +2177,8 @@
return;
}
- const std::string &parentIfaceId = params[0];
- const std::string &ifaceId = params[1];
+ const std::string& parentIfaceId = params[0];
+ const std::string& ifaceId = params[1];
if (!verifyNames(parentIfaceId, ifaceId))
{
@@ -2201,9 +2202,9 @@
params[1],
[asyncResp, parentIfaceId{std::string(params[0])},
ifaceId{std::string(params[1])}, &vlanEnable, &vlanId](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (success && !ethData.vlan_id.empty())
{
auto callback =
@@ -2245,8 +2246,8 @@
});
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -2255,8 +2256,8 @@
return;
}
- const std::string &parentIfaceId = params[0];
- const std::string &ifaceId = params[1];
+ const std::string& parentIfaceId = params[0];
+ const std::string& ifaceId = params[1];
if (!verifyNames(parentIfaceId, ifaceId))
{
@@ -2271,9 +2272,9 @@
params[1],
[asyncResp, parentIfaceId{std::string(params[0])},
ifaceId{std::string(params[1])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (success && !ethData.vlan_id.empty())
{
auto callback =
@@ -2308,7 +2309,7 @@
{
public:
template <typename CrowApp>
- VlanNetworkInterfaceCollection(CrowApp &app) :
+ VlanNetworkInterfaceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/",
std::string())
{
@@ -2325,8 +2326,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2336,14 +2337,14 @@
return;
}
- const std::string &rootInterfaceName = params[0];
+ const std::string& rootInterfaceName = params[0];
// Get eth interface list, and call the below callback for JSON
// preparation
getEthernetIfaceList(
[asyncResp, rootInterfaceName{std::string(rootInterfaceName)}](
- const bool &success,
- const boost::container::flat_set<std::string> &iface_list) {
+ const bool& success,
+ const boost::container::flat_set<std::string>& iface_list) {
if (!success)
{
messages::internalError(asyncResp->res);
@@ -2366,7 +2367,7 @@
nlohmann::json iface_array = nlohmann::json::array();
- for (const std::string &iface_item : iface_list)
+ for (const std::string& iface_item : iface_list)
{
if (boost::starts_with(iface_item, rootInterfaceName + "_"))
{
@@ -2386,8 +2387,8 @@
});
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2416,7 +2417,7 @@
return;
}
- const std::string &rootInterfaceName = params[0];
+ const std::string& rootInterfaceName = params[0];
auto callback = [asyncResp](const boost::system::error_code ec) {
if (ec)
{
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index b9f2e38..59c8a27 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -20,6 +20,7 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
+
#include <variant>
namespace redfish
@@ -27,33 +28,31 @@
struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
{
- HealthPopulate(const std::shared_ptr<AsyncResp> &asyncResp) :
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp) :
asyncResp(asyncResp), jsonStatus(asyncResp->res.jsonValue["Status"])
- {
- }
+ {}
- HealthPopulate(const std::shared_ptr<AsyncResp> &asyncResp,
- nlohmann::json &status) :
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp,
+ nlohmann::json& status) :
asyncResp(asyncResp),
jsonStatus(status)
- {
- }
+ {}
~HealthPopulate()
{
- nlohmann::json &health = jsonStatus["Health"];
- nlohmann::json &rollup = jsonStatus["HealthRollup"];
+ nlohmann::json& health = jsonStatus["Health"];
+ nlohmann::json& rollup = jsonStatus["HealthRollup"];
health = "OK";
rollup = "OK";
- for (const std::shared_ptr<HealthPopulate> &health : children)
+ for (const std::shared_ptr<HealthPopulate>& health : children)
{
health->globalInventoryPath = globalInventoryPath;
health->statuses = statuses;
}
- for (const auto &[path, interfaces] : statuses)
+ for (const auto& [path, interfaces] : statuses)
{
bool isChild = false;
bool isSelf =
@@ -67,7 +66,7 @@
// of this association is an inventory item, or one of the
// endpoints in this association is a child
- for (const std::string &child : inventory)
+ for (const std::string& child : inventory)
{
if (boost::starts_with(path.str, child))
{
@@ -90,7 +89,7 @@
<< path.str;
continue;
}
- const std::vector<std::string> *endpoints =
+ const std::vector<std::string>* endpoints =
std::get_if<std::vector<std::string>>(
&endpointsIt->second);
if (endpoints == nullptr)
@@ -100,7 +99,7 @@
continue;
}
bool containsChild = false;
- for (const std::string &endpoint : *endpoints)
+ for (const std::string& endpoint : *endpoints)
{
if (std::find(inventory.begin(), inventory.end(),
endpoint) != inventory.end())
@@ -174,7 +173,7 @@
std::shared_ptr<HealthPopulate> self = shared_from_this();
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- std::vector<std::string> &resp) {
+ std::vector<std::string>& resp) {
if (ec || resp.size() != 1)
{
// no global item, or too many
@@ -185,7 +184,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "/", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.Global"});
}
@@ -194,7 +193,7 @@
std::shared_ptr<HealthPopulate> self = shared_from_this();
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- dbus::utility::ManagedObjectType &resp) {
+ dbus::utility::ManagedObjectType& resp) {
if (ec)
{
return;
@@ -216,7 +215,7 @@
}
std::shared_ptr<AsyncResp> asyncResp;
- nlohmann::json &jsonStatus;
+ nlohmann::json& jsonStatus;
// we store pointers to other HealthPopulate items so we can update their
// members and reduce dbus calls. As we hold a shared_ptr to them, they get
diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp
index 910d33b..38759a1 100644
--- a/redfish-core/lib/hypervisor_ethernet.hpp
+++ b/redfish-core/lib/hypervisor_ethernet.hpp
@@ -5,8 +5,9 @@
#include <dbus_singleton.hpp>
#include <error_messages.hpp>
#include <node.hpp>
-#include <optional>
#include <utils/json_utils.hpp>
+
+#include <optional>
#include <variant>
namespace redfish
@@ -21,7 +22,7 @@
/*
* Default Constructor
*/
- HypervisorSystem(CrowApp &app) :
+ HypervisorSystem(CrowApp& app) :
Node(app, "/redfish/v1/Systems/hypervisor/")
{
entityPrivileges = {
@@ -34,13 +35,13 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::variant<std::string> &hostName) {
+ const std::variant<std::string>& hostName) {
if (ec)
{
messages::resourceNotFound(asyncResp->res, "System",
@@ -77,7 +78,7 @@
{
public:
template <typename CrowApp>
- HypervisorInterfaceCollection(CrowApp &app) :
+ HypervisorInterfaceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/hypervisor/EthernetInterfaces/")
{
entityPrivileges = {
@@ -90,16 +91,16 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
- const std::array<const char *, 1> interfaces = {
+ const std::array<const char*, 1> interfaces = {
"xyz.openbmc_project.Network.EthernetInterface"};
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code error,
- const std::vector<std::string> &ifaceList) {
+ const std::vector<std::string>& ifaceList) {
if (error)
{
messages::resourceNotFound(asyncResp->res, "System",
@@ -118,10 +119,10 @@
"Collection of Virtual Management "
"Interfaces for the hypervisor";
- nlohmann::json &ifaceArray =
+ nlohmann::json& ifaceArray =
asyncResp->res.jsonValue["Members"];
ifaceArray = nlohmann::json::array();
- for (const std::string &iface : ifaceList)
+ for (const std::string& iface : ifaceList)
{
std::size_t last_pos = iface.rfind("/");
if (last_pos != std::string::npos)
@@ -143,14 +144,14 @@
};
inline bool extractHypervisorInterfaceData(
- const std::string ðifaceId, const GetManagedObjects &dbusData,
- EthernetInterfaceData ðData,
- boost::container::flat_set<IPv4AddressData> &ipv4Config)
+ const std::string& ethifaceId, const GetManagedObjects& dbusData,
+ EthernetInterfaceData& ethData,
+ boost::container::flat_set<IPv4AddressData>& ipv4Config)
{
bool idFound = false;
- for (const auto &objpath : dbusData)
+ for (const auto& objpath : dbusData)
{
- for (const auto &ifacePair : objpath.second)
+ for (const auto& ifacePair : objpath.second)
{
if (objpath.first ==
"/xyz/openbmc_project/network/vmi/" + ethifaceId)
@@ -158,11 +159,11 @@
idFound = true;
if (ifacePair.first == "xyz.openbmc_project.Network.MACAddress")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "MACAddress")
{
- const std::string *mac =
+ const std::string* mac =
std::get_if<std::string>(&propertyPair.second);
if (mac != nullptr)
{
@@ -181,12 +182,12 @@
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
it = ipv4Config.insert(IPv4AddressData{});
- IPv4AddressData &ipv4Address = *it.first;
- for (auto &property : ifacePair.second)
+ IPv4AddressData& ipv4Address = *it.first;
+ for (auto& property : ifacePair.second)
{
if (property.first == "Address")
{
- const std::string *address =
+ const std::string* address =
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
@@ -195,7 +196,7 @@
}
else if (property.first == "Origin")
{
- const std::string *origin =
+ const std::string* origin =
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
@@ -206,7 +207,7 @@
}
else if (property.first == "PrefixLength")
{
- const uint8_t *mask =
+ const uint8_t* mask =
std::get_if<uint8_t>(&property.second);
if (mask != nullptr)
{
@@ -230,11 +231,11 @@
if (ifacePair.first ==
"xyz.openbmc_project.Network.SystemConfiguration")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "HostName")
{
- const std::string *hostName =
+ const std::string* hostName =
std::get_if<std::string>(&propertyPair.second);
if (hostName != nullptr)
{
@@ -243,7 +244,7 @@
}
else if (propertyPair.first == "DefaultGateway")
{
- const std::string *defaultGateway =
+ const std::string* defaultGateway =
std::get_if<std::string>(&propertyPair.second);
if (defaultGateway != nullptr)
{
@@ -265,13 +266,13 @@
* into JSON
*/
template <typename CallbackFunc>
-void getHypervisorIfaceData(const std::string ðifaceId,
- CallbackFunc &&callback)
+void getHypervisorIfaceData(const std::string& ethifaceId,
+ CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[ethifaceId{std::string{ethifaceId}},
callback{std::move(callback)}](const boost::system::error_code error,
- const GetManagedObjects &resp) {
+ const GetManagedObjects& resp) {
EthernetInterfaceData ethData{};
boost::container::flat_set<IPv4AddressData> ipv4Data;
if (error)
@@ -302,14 +303,14 @@
* @return None.
*/
inline void setHypervisorIPv4Address(std::shared_ptr<AsyncResp> aResp,
- const std::string ðifaceId,
- const std::string &ipv4Aaddress)
+ const std::string& ethifaceId,
+ const std::string& ipv4Aaddress)
{
BMCWEB_LOG_DEBUG << "Setting the Hypervisor IPaddress : " << ipv4Aaddress
<< " on Iface: " << ethifaceId;
std::string path =
"/xyz/openbmc_project/network/vmi/" + ethifaceId + "/ipv4/addr0";
- const char *vmiObj = path.c_str();
+ const char* vmiObj = path.c_str();
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec) {
@@ -337,14 +338,14 @@
* @return None.
*/
inline void setHypervisorIPv4Subnet(std::shared_ptr<AsyncResp> aResp,
- const std::string ðifaceId,
+ const std::string& ethifaceId,
const uint8_t subnet)
{
BMCWEB_LOG_DEBUG << "Setting the Hypervisor subnet : " << subnet
<< " on Iface: " << ethifaceId;
std::string path =
"/xyz/openbmc_project/network/vmi/" + ethifaceId + "/ipv4/addr0";
- const char *vmiObj = path.c_str();
+ const char* vmiObj = path.c_str();
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec) {
@@ -372,8 +373,8 @@
* @return None.
*/
inline void setHypervisorIPv4Gateway(std::shared_ptr<AsyncResp> aResp,
- const std::string ðifaceId,
- const std::string &gateway)
+ const std::string& ethifaceId,
+ const std::string& gateway)
{
BMCWEB_LOG_DEBUG
<< "Setting the DefaultGateway to the last configured gateway";
@@ -405,10 +406,10 @@
*
* @return None
*/
-inline void createHypervisorIPv4(const std::string &ifaceId,
+inline void createHypervisorIPv4(const std::string& ifaceId,
uint8_t prefixLength,
- const std::string &gateway,
- const std::string &address,
+ const std::string& gateway,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
setHypervisorIPv4Address(asyncResp, ifaceId, address);
@@ -424,7 +425,7 @@
*
* @return None
*/
-inline void deleteHypervisorIPv4(const std::string &ifaceId,
+inline void deleteHypervisorIPv4(const std::string& ifaceId,
const std::shared_ptr<AsyncResp> asyncResp)
{
std::string address = "0.0.0.0";
@@ -445,7 +446,7 @@
* Default Constructor
*/
template <typename CrowApp>
- HypervisorInterface(CrowApp &app) :
+ HypervisorInterface(CrowApp& app) :
Node(app, "/redfish/v1/Systems/hypervisor/EthernetInterfaces/<str>/",
std::string())
{
@@ -457,9 +458,9 @@
private:
void parseInterfaceData(
- nlohmann::json &jsonResponse, const std::string &ifaceId,
- const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data)
+ nlohmann::json& jsonResponse, const std::string& ifaceId,
+ const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data)
{
jsonResponse["Id"] = ifaceId;
jsonResponse["@odata.id"] =
@@ -469,11 +470,11 @@
jsonResponse["HostName"] = ethData.hostname;
- nlohmann::json &ipv4Array = jsonResponse["IPv4Addresses"];
- nlohmann::json &ipv4StaticArray = jsonResponse["IPv4StaticAddresses"];
+ nlohmann::json& ipv4Array = jsonResponse["IPv4Addresses"];
+ nlohmann::json& ipv4StaticArray = jsonResponse["IPv4StaticAddresses"];
ipv4Array = nlohmann::json::array();
ipv4StaticArray = nlohmann::json::array();
- for (auto &ipv4Config : ipv4Data)
+ for (auto& ipv4Config : ipv4Data)
{
ipv4Array.push_back({{"AddressOrigin", ipv4Config.origin},
{"SubnetMask", ipv4Config.netmask},
@@ -491,7 +492,7 @@
}
void handleHypervisorIPv4StaticPatch(
- const std::string &ifaceId, nlohmann::json &&input,
+ const std::string& ifaceId, nlohmann::json&& input,
const std::shared_ptr<AsyncResp> asyncResp)
{
if ((!input.is_array()) || input.empty())
@@ -504,7 +505,7 @@
// Hypervisor considers the first IP address in the array list
// as the Hypervisor's virtual management interface supports single IPv4
// address
- nlohmann::json &thisJson = input[0];
+ nlohmann::json& thisJson = input[0];
// For the error string
std::string pathString = "IPv4StaticAddresses/1";
@@ -594,7 +595,7 @@
}
}
- bool isHostnameValid(const std::string &hostName)
+ bool isHostnameValid(const std::string& hostName)
{
// As per RFC 1123
// Allow up to 255 characters
@@ -609,7 +610,7 @@
return std::regex_match(hostName, pattern);
}
- void handleHostnamePatch(const std::string &hostName,
+ void handleHostnamePatch(const std::string& hostName,
const std::shared_ptr<AsyncResp> asyncResp)
{
if (!isHostnameValid(hostName))
@@ -636,8 +637,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -649,8 +650,8 @@
getHypervisorIfaceData(
params[0],
[this, asyncResp, ifaceId{std::string(params[0])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data) {
if (!success)
{
messages::resourceNotFound(
@@ -668,8 +669,8 @@
});
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -678,7 +679,7 @@
return;
}
- const std::string &ifaceId = params[0];
+ const std::string& ifaceId = params[0];
std::optional<std::string> hostName;
std::optional<nlohmann::json> ipv4StaticAddresses;
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 43e1b5c..25248f8 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -40,7 +40,7 @@
// proceed to get enclosure_identify state.
if (!ec)
{
- const bool *blinking = std::get_if<bool>(&asserted);
+ const bool* blinking = std::get_if<bool>(&asserted);
if (!blinking)
{
BMCWEB_LOG_DEBUG << "Get identity blinking LED failed";
@@ -59,7 +59,7 @@
const std::variant<bool> asserted) {
if (!ec)
{
- const bool *ledOn = std::get_if<bool>(&asserted);
+ const bool* ledOn = std::get_if<bool>(&asserted);
if (!ledOn)
{
BMCWEB_LOG_DEBUG
@@ -99,7 +99,7 @@
* @return None.
*/
void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
- const std::string &ledState)
+ const std::string& ledState)
{
BMCWEB_LOG_DEBUG << "Set led groups";
bool ledOn = false;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 3f10725..753334e 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -29,6 +29,7 @@
#include <boost/system/linux_error.hpp>
#include <dump_offload.hpp>
#include <error_messages.hpp>
+
#include <filesystem>
#include <string_view>
#include <variant>
@@ -36,26 +37,26 @@
namespace redfish
{
-constexpr char const *crashdumpObject = "com.intel.crashdump";
-constexpr char const *crashdumpPath = "/com/intel/crashdump";
-constexpr char const *crashdumpOnDemandPath = "/com/intel/crashdump/OnDemand";
-constexpr char const *crashdumpInterface = "com.intel.crashdump";
-constexpr char const *deleteAllInterface =
+constexpr char const* crashdumpObject = "com.intel.crashdump";
+constexpr char const* crashdumpPath = "/com/intel/crashdump";
+constexpr char const* crashdumpOnDemandPath = "/com/intel/crashdump/OnDemand";
+constexpr char const* crashdumpInterface = "com.intel.crashdump";
+constexpr char const* deleteAllInterface =
"xyz.openbmc_project.Collection.DeleteAll";
-constexpr char const *crashdumpOnDemandInterface =
+constexpr char const* crashdumpOnDemandInterface =
"com.intel.crashdump.OnDemand";
-constexpr char const *crashdumpRawPECIInterface =
+constexpr char const* crashdumpRawPECIInterface =
"com.intel.crashdump.SendRawPeci";
namespace message_registries
{
-static const Message *getMessageFromRegistry(
- const std::string &messageKey,
+static const Message* getMessageFromRegistry(
+ const std::string& messageKey,
const boost::beast::span<const MessageEntry> registry)
{
boost::beast::span<const MessageEntry>::const_iterator messageIt =
std::find_if(registry.cbegin(), registry.cend(),
- [&messageKey](const MessageEntry &messageEntry) {
+ [&messageKey](const MessageEntry& messageEntry) {
return !std::strcmp(messageEntry.first,
messageKey.c_str());
});
@@ -67,7 +68,7 @@
return nullptr;
}
-static const Message *getMessage(const std::string_view &messageID)
+static const Message* getMessage(const std::string_view& messageID)
{
// Redfish MessageIds are in the form
// RegistryName.MajorVersion.MinorVersion.MessageKey, so parse it to find
@@ -75,8 +76,8 @@
std::vector<std::string> fields;
fields.reserve(4);
boost::split(fields, messageID, boost::is_any_of("."));
- std::string ®istryName = fields[0];
- std::string &messageKey = fields[3];
+ std::string& registryName = fields[0];
+ std::string& messageKey = fields[3];
// Find the right registry and check it for the MessageKey
if (std::string(base::header.registryPrefix) == registryName)
@@ -104,7 +105,7 @@
sdbusplus::message::object_path,
boost::container::flat_map<std::string, GetManagedPropertyType>>;
-inline std::string translateSeverityDbusToRedfish(const std::string &s)
+inline std::string translateSeverityDbusToRedfish(const std::string& s)
{
if (s == "xyz.openbmc_project.Logging.Entry.Level.Alert")
{
@@ -141,8 +142,8 @@
return "";
}
-inline void deleteSystemDumpEntry(crow::Response &res,
- const std::string &entryID)
+inline void deleteSystemDumpEntry(crow::Response& res,
+ const std::string& entryID)
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -163,16 +164,16 @@
"xyz.openbmc_project.Object.Delete", "Delete");
}
-static int getJournalMetadata(sd_journal *journal,
- const std::string_view &field,
- std::string_view &contents)
+static int getJournalMetadata(sd_journal* journal,
+ const std::string_view& field,
+ std::string_view& contents)
{
- const char *data = nullptr;
+ const char* data = nullptr;
size_t length = 0;
int ret = 0;
// Get the metadata from the requested field of the journal entry
ret = sd_journal_get_data(journal, field.data(),
- reinterpret_cast<const void **>(&data), &length);
+ reinterpret_cast<const void**>(&data), &length);
if (ret < 0)
{
return ret;
@@ -183,9 +184,9 @@
return ret;
}
-static int getJournalMetadata(sd_journal *journal,
- const std::string_view &field, const int &base,
- long int &contents)
+static int getJournalMetadata(sd_journal* journal,
+ const std::string_view& field, const int& base,
+ long int& contents)
{
int ret = 0;
std::string_view metadata;
@@ -200,10 +201,10 @@
}
static bool getTimestampStr(const uint64_t usecSinceEpoch,
- std::string &entryTimestamp)
+ std::string& entryTimestamp)
{
time_t t = static_cast<time_t>(usecSinceEpoch / 1000 / 1000);
- struct tm *loctime = localtime(&t);
+ struct tm* loctime = localtime(&t);
char entryTime[64] = {};
if (nullptr != loctime)
{
@@ -221,7 +222,7 @@
return true;
}
-static bool getEntryTimestamp(sd_journal *journal, std::string &entryTimestamp)
+static bool getEntryTimestamp(sd_journal* journal, std::string& entryTimestamp)
{
int ret = 0;
uint64_t timestamp = 0;
@@ -235,13 +236,13 @@
return getTimestampStr(timestamp, entryTimestamp);
}
-static bool getSkipParam(crow::Response &res, const crow::Request &req,
- uint64_t &skip)
+static bool getSkipParam(crow::Response& res, const crow::Request& req,
+ uint64_t& skip)
{
- char *skipParam = req.urlParams.get("$skip");
+ char* skipParam = req.urlParams.get("$skip");
if (skipParam != nullptr)
{
- char *ptr = nullptr;
+ char* ptr = nullptr;
skip = std::strtoul(skipParam, &ptr, 10);
if (*skipParam == '\0' || *ptr != '\0')
{
@@ -255,13 +256,13 @@
}
static constexpr const uint64_t maxEntriesPerPage = 1000;
-static bool getTopParam(crow::Response &res, const crow::Request &req,
- uint64_t &top)
+static bool getTopParam(crow::Response& res, const crow::Request& req,
+ uint64_t& top)
{
- char *topParam = req.urlParams.get("$top");
+ char* topParam = req.urlParams.get("$top");
if (topParam != nullptr)
{
- char *ptr = nullptr;
+ char* ptr = nullptr;
top = std::strtoul(topParam, &ptr, 10);
if (*topParam == '\0' || *ptr != '\0')
{
@@ -281,7 +282,7 @@
return true;
}
-static bool getUniqueEntryID(sd_journal *journal, std::string &entryID,
+static bool getUniqueEntryID(sd_journal* journal, std::string& entryID,
const bool firstEntry = true)
{
int ret = 0;
@@ -322,7 +323,7 @@
return true;
}
-static bool getUniqueEntryID(const std::string &logEntry, std::string &entryID,
+static bool getUniqueEntryID(const std::string& logEntry, std::string& entryID,
const bool firstEntry = true)
{
static time_t prevTs = 0;
@@ -361,8 +362,8 @@
return true;
}
-static bool getTimestampFromID(crow::Response &res, const std::string &entryID,
- uint64_t ×tamp, uint64_t &index)
+static bool getTimestampFromID(crow::Response& res, const std::string& entryID,
+ uint64_t& timestamp, uint64_t& index)
{
if (entryID.empty())
{
@@ -383,12 +384,12 @@
{
index = std::stoul(std::string(indexStr), &pos);
}
- catch (std::invalid_argument &)
+ catch (std::invalid_argument&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
}
- catch (std::out_of_range &)
+ catch (std::out_of_range&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
@@ -405,12 +406,12 @@
{
timestamp = std::stoull(std::string(tsStr), &pos);
}
- catch (std::invalid_argument &)
+ catch (std::invalid_argument&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
}
- catch (std::out_of_range &)
+ catch (std::out_of_range&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
@@ -424,13 +425,13 @@
}
static bool
- getRedfishLogFiles(std::vector<std::filesystem::path> &redfishLogFiles)
+ getRedfishLogFiles(std::vector<std::filesystem::path>& redfishLogFiles)
{
static const std::filesystem::path redfishLogDir = "/var/log";
static const std::string redfishLogFilename = "redfish";
// Loop through the directory looking for redfish log files
- for (const std::filesystem::directory_entry &dirEnt :
+ for (const std::filesystem::directory_entry& dirEnt :
std::filesystem::directory_iterator(redfishLogDir))
{
// If we find a redfish log file, save the path
@@ -449,14 +450,14 @@
}
static void ParseCrashdumpParameters(
- const std::vector<std::pair<std::string, VariantType>> ¶ms,
- std::string &filename, std::string ×tamp, std::string &logfile)
+ const std::vector<std::pair<std::string, VariantType>>& params,
+ std::string& filename, std::string& timestamp, std::string& logfile)
{
for (auto property : params)
{
if (property.first == "Timestamp")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -465,7 +466,7 @@
}
else if (property.first == "Filename")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -474,7 +475,7 @@
}
else if (property.first == "Log")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -484,12 +485,12 @@
}
}
-constexpr char const *postCodeIface = "xyz.openbmc_project.State.Boot.PostCode";
+constexpr char const* postCodeIface = "xyz.openbmc_project.State.Boot.PostCode";
class SystemLogServiceCollection : public Node
{
public:
template <typename CrowApp>
- SystemLogServiceCollection(CrowApp &app) :
+ SystemLogServiceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/")
{
entityPrivileges = {
@@ -505,8 +506,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Collections don't include the static data added by SubRoute because
@@ -518,7 +519,7 @@
asyncResp->res.jsonValue["Name"] = "System Log Services Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of LogServices for this Computer System";
- nlohmann::json &logServiceArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logServiceArray = asyncResp->res.jsonValue["Members"];
logServiceArray = nlohmann::json::array();
logServiceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/LogServices/EventLog"}});
@@ -537,18 +538,18 @@
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::string> &subtreePath) {
+ const std::vector<std::string>& subtreePath) {
if (ec)
{
BMCWEB_LOG_ERROR << ec;
return;
}
- for (auto &pathStr : subtreePath)
+ for (auto& pathStr : subtreePath)
{
if (pathStr.find("PostCode") != std::string::npos)
{
- nlohmann::json &logServiceArray =
+ nlohmann::json& logServiceArray =
asyncResp->res.jsonValue["Members"];
logServiceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/"
@@ -562,7 +563,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "/", 0,
- std::array<const char *, 1>{postCodeIface});
+ std::array<const char*, 1>{postCodeIface});
}
};
@@ -570,7 +571,7 @@
{
public:
template <typename CrowApp>
- EventLogService(CrowApp &app) :
+ EventLogService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/")
{
entityPrivileges = {
@@ -583,8 +584,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -609,7 +610,7 @@
class JournalEventLogClear : public Node
{
public:
- JournalEventLogClear(CrowApp &app) :
+ JournalEventLogClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Actions/"
"LogService.ClearLog/")
{
@@ -623,8 +624,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -632,7 +633,7 @@
std::vector<std::filesystem::path> redfishLogFiles;
if (getRedfishLogFiles(redfishLogFiles))
{
- for (const std::filesystem::path &file : redfishLogFiles)
+ for (const std::filesystem::path& file : redfishLogFiles)
{
std::error_code ec;
std::filesystem::remove(file, ec);
@@ -657,9 +658,9 @@
}
};
-static int fillEventLogEntryJson(const std::string &logEntryID,
+static int fillEventLogEntryJson(const std::string& logEntryID,
const std::string logEntry,
- nlohmann::json &logEntryJson)
+ nlohmann::json& logEntryJson)
{
// The redfish log format is "<Timestamp> <MessageId>,<MessageArgs>"
// First get the Timestamp
@@ -686,10 +687,10 @@
{
return 1;
}
- std::string &messageID = logEntryFields[0];
+ std::string& messageID = logEntryFields[0];
// Get the Message from the MessageRegistry
- const message_registries::Message *message =
+ const message_registries::Message* message =
message_registries::getMessage(messageID);
std::string msg;
@@ -704,7 +705,7 @@
boost::beast::span<std::string> messageArgs;
if (logEntryFields.size() > 1)
{
- std::string &messageArgsStart = logEntryFields[1];
+ std::string& messageArgsStart = logEntryFields[1];
// If the first string is empty, assume there are no MessageArgs
std::size_t messageArgsSize = 0;
if (!messageArgsStart.empty())
@@ -716,7 +717,7 @@
// Fill the MessageArgs into the Message
int i = 0;
- for (const std::string &messageArg : messageArgs)
+ for (const std::string& messageArg : messageArgs)
{
std::string argStr = "%" + std::to_string(++i);
size_t argPos = msg.find(argStr);
@@ -758,7 +759,7 @@
{
public:
template <typename CrowApp>
- JournalEventLogEntryCollection(CrowApp &app) :
+ JournalEventLogEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/")
{
entityPrivileges = {
@@ -771,8 +772,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
uint64_t skip = 0;
@@ -795,7 +796,7 @@
asyncResp->res.jsonValue["Description"] =
"Collection of System Event Log Entries";
- nlohmann::json &logEntryArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
logEntryArray = nlohmann::json::array();
// Go through the log files and create a unique ID for each entry
std::vector<std::filesystem::path> redfishLogFiles;
@@ -837,7 +838,7 @@
}
logEntryArray.push_back({});
- nlohmann::json &bmcLogEntry = logEntryArray.back();
+ nlohmann::json& bmcLogEntry = logEntryArray.back();
if (fillEventLogEntryJson(idStr, logEntry, bmcLogEntry) != 0)
{
messages::internalError(asyncResp->res);
@@ -859,7 +860,7 @@
class JournalEventLogEntry : public Node
{
public:
- JournalEventLogEntry(CrowApp &app) :
+ JournalEventLogEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/",
std::string())
@@ -874,8 +875,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -883,7 +884,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &targetID = params[0];
+ const std::string& targetID = params[0];
// Go through the log files and check the unique ID for each entry to
// find the target entry
@@ -937,7 +938,7 @@
{
public:
template <typename CrowApp>
- DBusEventLogEntryCollection(CrowApp &app) :
+ DBusEventLogEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/")
{
entityPrivileges = {
@@ -950,8 +951,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -969,7 +970,7 @@
// Make call to Logging Service to find all log entry objects
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- GetManagedObjectsType &resp) {
+ GetManagedObjectsType& resp) {
if (ec)
{
// TODO Handle for specific error code
@@ -979,12 +980,12 @@
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &entriesArray =
+ nlohmann::json& entriesArray =
asyncResp->res.jsonValue["Members"];
entriesArray = nlohmann::json::array();
- for (auto &objectPath : resp)
+ for (auto& objectPath : resp)
{
- for (auto &interfaceMap : objectPath.second)
+ for (auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first !=
"xyz.openbmc_project.Logging.Entry")
@@ -994,12 +995,12 @@
continue;
}
entriesArray.push_back({});
- nlohmann::json &thisEntry = entriesArray.back();
- uint32_t *id = nullptr;
+ nlohmann::json& thisEntry = entriesArray.back();
+ uint32_t* id = nullptr;
std::time_t timestamp{};
- std::string *severity = nullptr;
- std::string *message = nullptr;
- for (auto &propertyMap : interfaceMap.second)
+ std::string* severity = nullptr;
+ std::string* message = nullptr;
+ for (auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Id")
{
@@ -1012,7 +1013,7 @@
}
else if (propertyMap.first == "Timestamp")
{
- const uint64_t *millisTimeStamp =
+ const uint64_t* millisTimeStamp =
std::get_if<uint64_t>(&propertyMap.second);
if (millisTimeStamp == nullptr)
{
@@ -1066,8 +1067,8 @@
}
}
std::sort(entriesArray.begin(), entriesArray.end(),
- [](const nlohmann::json &left,
- const nlohmann::json &right) {
+ [](const nlohmann::json& left,
+ const nlohmann::json& right) {
return (left["Id"] <= right["Id"]);
});
asyncResp->res.jsonValue["Members@odata.count"] =
@@ -1081,7 +1082,7 @@
class DBusEventLogEntry : public Node
{
public:
- DBusEventLogEntry(CrowApp &app) :
+ DBusEventLogEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/",
std::string())
@@ -1096,8 +1097,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1105,13 +1106,13 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
// DBus implementation of EventLog/Entries
// Make call to Logging Service to find all log entry objects
crow::connections::systemBus->async_method_call(
[asyncResp, entryID](const boost::system::error_code ec,
- GetManagedPropertyType &resp) {
+ GetManagedPropertyType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1119,11 +1120,11 @@
messages::internalError(asyncResp->res);
return;
}
- uint32_t *id = nullptr;
+ uint32_t* id = nullptr;
std::time_t timestamp{};
- std::string *severity = nullptr;
- std::string *message = nullptr;
- for (auto &propertyMap : resp)
+ std::string* severity = nullptr;
+ std::string* message = nullptr;
+ for (auto& propertyMap : resp)
{
if (propertyMap.first == "Id")
{
@@ -1135,7 +1136,7 @@
}
else if (propertyMap.first == "Timestamp")
{
- const uint64_t *millisTimeStamp =
+ const uint64_t* millisTimeStamp =
std::get_if<uint64_t>(&propertyMap.second);
if (millisTimeStamp == nullptr)
{
@@ -1195,8 +1196,8 @@
"xyz.openbmc_project.Logging.Entry");
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete single event entries.";
@@ -1241,7 +1242,7 @@
{
public:
template <typename CrowApp>
- BMCLogServiceCollection(CrowApp &app) :
+ BMCLogServiceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/")
{
entityPrivileges = {
@@ -1257,8 +1258,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Collections don't include the static data added by SubRoute because
@@ -1270,7 +1271,7 @@
asyncResp->res.jsonValue["Name"] = "Open BMC Log Services Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of LogServices for this Manager";
- nlohmann::json &logServiceArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logServiceArray = asyncResp->res.jsonValue["Members"];
logServiceArray = nlohmann::json::array();
#ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
logServiceArray.push_back(
@@ -1285,7 +1286,7 @@
{
public:
template <typename CrowApp>
- BMCJournalLogService(CrowApp &app) :
+ BMCJournalLogService(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/Journal/")
{
entityPrivileges = {
@@ -1298,8 +1299,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue["@odata.type"] =
@@ -1316,9 +1317,9 @@
}
};
-static int fillBMCJournalLogEntryJson(const std::string &bmcJournalLogEntryID,
- sd_journal *journal,
- nlohmann::json &bmcJournalLogEntryJson)
+static int fillBMCJournalLogEntryJson(const std::string& bmcJournalLogEntryID,
+ sd_journal* journal,
+ nlohmann::json& bmcJournalLogEntryJson)
{
// Get the Log Entry contents
int ret = 0;
@@ -1366,7 +1367,7 @@
{
public:
template <typename CrowApp>
- BMCJournalLogEntryCollection(CrowApp &app) :
+ BMCJournalLogEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/")
{
entityPrivileges = {
@@ -1379,8 +1380,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
static constexpr const long maxEntriesPerPage = 1000;
@@ -1407,12 +1408,12 @@
"Collection of BMC Journal Entries";
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Managers/bmc/LogServices/BmcLog/Entries";
- nlohmann::json &logEntryArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
logEntryArray = nlohmann::json::array();
// Go through the journal and use the timestamp to create a unique ID
// for each entry
- sd_journal *journalTmp = nullptr;
+ sd_journal* journalTmp = nullptr;
int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
if (ret < 0)
{
@@ -1448,7 +1449,7 @@
}
logEntryArray.push_back({});
- nlohmann::json &bmcJournalLogEntry = logEntryArray.back();
+ nlohmann::json& bmcJournalLogEntry = logEntryArray.back();
if (fillBMCJournalLogEntryJson(idStr, journal.get(),
bmcJournalLogEntry) != 0)
{
@@ -1469,7 +1470,7 @@
class BMCJournalLogEntry : public Node
{
public:
- BMCJournalLogEntry(CrowApp &app) :
+ BMCJournalLogEntry(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/<str>/",
std::string())
{
@@ -1483,8 +1484,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1492,7 +1493,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
// Convert the unique ID back to a timestamp to find the entry
uint64_t ts = 0;
uint64_t index = 0;
@@ -1501,7 +1502,7 @@
return;
}
- sd_journal *journalTmp = nullptr;
+ sd_journal* journalTmp = nullptr;
int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
if (ret < 0)
{
@@ -1557,7 +1558,7 @@
{
public:
template <typename CrowApp>
- SystemDumpService(CrowApp &app) :
+ SystemDumpService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/System/")
{
entityPrivileges = {
@@ -1570,8 +1571,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -1602,7 +1603,7 @@
{
public:
template <typename CrowApp>
- SystemDumpEntryCollection(CrowApp &app) :
+ SystemDumpEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/System/Entries/")
{
entityPrivileges = {
@@ -1618,8 +1619,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -1633,7 +1634,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &resp) {
+ const crow::openbmc_mapper::GetSubTreeType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR << " resp_handler got error " << ec;
@@ -1641,12 +1642,12 @@
return;
}
- nlohmann::json &logArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logArray = asyncResp->res.jsonValue["Members"];
logArray = nlohmann::json::array();
- for (auto &object : resp)
+ for (auto& object : resp)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastPos = path.rfind("/");
if (lastPos == std::string::npos)
{
@@ -1665,7 +1666,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/dump", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Dump.Entry.System"});
}
};
@@ -1673,7 +1674,7 @@
class SystemDumpEntry : public Node
{
public:
- SystemDumpEntry(CrowApp &app) :
+ SystemDumpEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/System/Entries/<str>/",
std::string())
@@ -1688,8 +1689,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1697,10 +1698,10 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
crow::connections::systemBus->async_method_call(
[asyncResp, entryID](const boost::system::error_code ec,
- GetManagedObjectsType &resp) {
+ GetManagedObjectsType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1709,7 +1710,7 @@
return;
}
- for (auto &objectPath : resp)
+ for (auto& objectPath : resp)
{
if (objectPath.first.str.find(
"/xyz/openbmc_project/dump/entry/" + entryID) ==
@@ -1719,7 +1720,7 @@
}
bool foundSystemDumpEntry = false;
- for (auto &interfaceMap : objectPath.second)
+ for (auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first ==
"xyz.openbmc_project.Dump.Entry.System")
@@ -1738,12 +1739,12 @@
std::string timestamp{};
uint64_t size = 0;
- for (auto &interfaceMap : objectPath.second)
+ for (auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first ==
"xyz.openbmc_project.Dump.Entry")
{
- for (auto &propertyMap : interfaceMap.second)
+ for (auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Size")
{
@@ -1763,11 +1764,11 @@
else if (interfaceMap.first ==
"xyz.openbmc_project.Time.EpochTime")
{
- for (auto &propertyMap : interfaceMap.second)
+ for (auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Elapsed")
{
- const uint64_t *usecsTimeStamp =
+ const uint64_t* usecsTimeStamp =
std::get_if<uint64_t>(
&propertyMap.second);
if (usecsTimeStamp == nullptr)
@@ -1807,8 +1808,8 @@
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete single dump entry";
@@ -1824,7 +1825,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp,
entryID](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &resp) {
+ const crow::openbmc_mapper::GetSubTreeType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR << " resp_handler got error " << ec;
@@ -1832,10 +1833,10 @@
return;
}
- for (auto &object : resp)
+ for (auto& object : resp)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t pos = path.rfind(
"/xyz/openbmc_project/dump/entry/" + entryID);
@@ -1850,7 +1851,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/dump", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Dump.Entry.System"});
}
};
@@ -1858,7 +1859,7 @@
class SystemDumpEntryDownload : public Node
{
public:
- SystemDumpEntryDownload(CrowApp &app) :
+ SystemDumpEntryDownload(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/System/Entries/<str>/"
"Actions/"
@@ -1872,15 +1873,15 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
if (params.size() != 1)
{
messages::internalError(res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
crow::obmc_dump::handleDumpOffloadUrl(req, res, entryID);
}
};
@@ -1888,7 +1889,7 @@
class SystemDumpClear : public Node
{
public:
- SystemDumpClear(CrowApp &app) :
+ SystemDumpClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/System/"
"Actions/"
"LogService.ClearLog/")
@@ -1900,21 +1901,21 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::string> &dumpList) {
+ const std::vector<std::string>& dumpList) {
if (ec)
{
messages::internalError(asyncResp->res);
return;
}
- for (const std::string &objectPath : dumpList)
+ for (const std::string& objectPath : dumpList)
{
std::size_t pos = objectPath.rfind("/");
if (pos != std::string::npos)
@@ -1928,7 +1929,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
"/xyz/openbmc_project/dump", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Dump.Entry.System"});
}
};
@@ -1937,7 +1938,7 @@
{
public:
template <typename CrowApp>
- CrashdumpService(CrowApp &app) :
+ CrashdumpService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/")
{
// Note: Deviated from redfish privilege registry for GET & HEAD
@@ -1955,8 +1956,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Copy over the static data to include the entries added by SubRoute
@@ -1993,7 +1994,7 @@
class CrashdumpClear : public Node
{
public:
- CrashdumpClear(CrowApp &app) :
+ CrashdumpClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/"
"LogService.ClearLog/")
{
@@ -2009,14 +2010,14 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::string &resp) {
+ const std::string& resp) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -2029,13 +2030,13 @@
};
static void logCrashdumpEntry(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &logID,
- nlohmann::json &logEntryJson)
+ const std::string& logID,
+ nlohmann::json& logEntryJson)
{
auto getStoredLogCallback =
[asyncResp, logID, &logEntryJson](
const boost::system::error_code ec,
- const std::vector<std::pair<std::string, VariantType>> ¶ms) {
+ const std::vector<std::pair<std::string, VariantType>>& params) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
@@ -2087,7 +2088,7 @@
{
public:
template <typename CrowApp>
- CrashdumpEntryCollection(CrowApp &app) :
+ CrashdumpEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/")
{
// Note: Deviated from redfish privilege registry for GET & HEAD
@@ -2105,15 +2106,15 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Collections don't include the static data added by SubRoute because
// it has a duplicate entry for members
auto getLogEntriesCallback = [asyncResp](
const boost::system::error_code ec,
- const std::vector<std::string> &resp) {
+ const std::vector<std::string>& resp) {
if (ec)
{
if (ec.value() !=
@@ -2132,12 +2133,12 @@
asyncResp->res.jsonValue["Name"] = "Open BMC Crashdump Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of Crashdump Entries";
- nlohmann::json &logEntryArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
logEntryArray = nlohmann::json::array();
std::vector<std::string> logIDs;
// Get the list of log entries and build up an empty array big
// enough to hold them
- for (const std::string &objpath : resp)
+ for (const std::string& objpath : resp)
{
// Get the log ID
std::size_t lastPos = objpath.rfind("/");
@@ -2152,7 +2153,7 @@
}
// Now go through and set up async calls to fill in the entries
size_t index = 0;
- for (const std::string &logID : logIDs)
+ for (const std::string& logID : logIDs)
{
// Add the log entry to the array
logCrashdumpEntry(asyncResp, logID, logEntryArray[index++]);
@@ -2165,14 +2166,14 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "", 0,
- std::array<const char *, 1>{crashdumpInterface});
+ std::array<const char*, 1>{crashdumpInterface});
}
};
class CrashdumpEntry : public Node
{
public:
- CrashdumpEntry(CrowApp &app) :
+ CrashdumpEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/<str>/",
std::string())
@@ -2189,8 +2190,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2198,7 +2199,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &logID = params[0];
+ const std::string& logID = params[0];
logCrashdumpEntry(asyncResp, logID, asyncResp->res.jsonValue);
}
};
@@ -2206,7 +2207,7 @@
class CrashdumpFile : public Node
{
public:
- CrashdumpFile(CrowApp &app) :
+ CrashdumpFile(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/<str>/"
"<str>/",
@@ -2224,8 +2225,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -2233,13 +2234,13 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &logID = params[0];
- const std::string &fileName = params[1];
+ const std::string& logID = params[0];
+ const std::string& fileName = params[1];
auto getStoredLogCallback =
[asyncResp, logID, fileName](
const boost::system::error_code ec,
- const std::vector<std::pair<std::string, VariantType>> &resp) {
+ const std::vector<std::pair<std::string, VariantType>>& resp) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to get log ec: "
@@ -2309,7 +2310,7 @@
class OnDemandCrashdump : public Node
{
public:
- OnDemandCrashdump(CrowApp &app) :
+ OnDemandCrashdump(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Actions/Oem/"
"Crashdump.OnDemand/")
@@ -2326,15 +2327,15 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
auto generateonDemandLogCallback = [asyncResp,
req](const boost::system::error_code
ec,
- const std::string &resp) {
+ const std::string& resp) {
if (ec)
{
if (ec.value() == boost::system::errc::operation_not_supported)
@@ -2354,8 +2355,8 @@
return;
}
std::shared_ptr<task::TaskData> task = task::TaskData::createTask(
- [](boost::system::error_code err, sdbusplus::message::message &,
- const std::shared_ptr<task::TaskData> &taskData) {
+ [](boost::system::error_code err, sdbusplus::message::message&,
+ const std::shared_ptr<task::TaskData>& taskData) {
if (!err)
{
taskData->messages.emplace_back(
@@ -2381,7 +2382,7 @@
class SendRawPECI : public Node
{
public:
- SendRawPECI(CrowApp &app) :
+ SendRawPECI(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Actions/Oem/"
"Crashdump.SendRawPeci/")
@@ -2398,8 +2399,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
std::vector<std::vector<uint8_t>> peciCommands;
@@ -2413,12 +2414,12 @@
return;
}
uint32_t idx = 0;
- for (auto const &cmd : peciCommands)
+ for (auto const& cmd : peciCommands)
{
if (cmd.size() < 3)
{
std::string s("[");
- for (auto const &val : cmd)
+ for (auto const& val : cmd)
{
if (val != *cmd.begin())
{
@@ -2454,7 +2455,7 @@
// Callback to return the Raw PECI response
auto sendRawPECICallback =
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::vector<uint8_t>> &resp) {
+ const std::vector<std::vector<uint8_t>>& resp) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to process PECI commands ec: "
@@ -2478,7 +2479,7 @@
class DBusLogServiceActionsClear : public Node
{
public:
- DBusLogServiceActionsClear(CrowApp &app) :
+ DBusLogServiceActionsClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Actions/"
"LogService.ClearLog/")
{
@@ -2497,8 +2498,8 @@
* The Clear Log actions does not require any parameter.The action deletes
* all entries found in the Entries collection for this Log Service.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete all entries.";
@@ -2533,7 +2534,7 @@
class PostCodesLogService : public Node
{
public:
- PostCodesLogService(CrowApp &app) :
+ PostCodesLogService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/PostCodes/")
{
entityPrivileges = {
@@ -2546,8 +2547,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -2571,7 +2572,7 @@
class PostCodesClear : public Node
{
public:
- PostCodesClear(CrowApp &app) :
+ PostCodesClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/"
"LogService.ClearLog/")
{
@@ -2585,8 +2586,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete all postcodes entries.";
@@ -2613,19 +2614,19 @@
static void fillPostCodeEntry(
std::shared_ptr<AsyncResp> aResp,
- const boost::container::flat_map<uint64_t, uint64_t> &postcode,
+ const boost::container::flat_map<uint64_t, uint64_t>& postcode,
const uint16_t bootIndex, const uint64_t codeIndex = 0,
const uint64_t skip = 0, const uint64_t top = 0)
{
// Get the Message from the MessageRegistry
- const message_registries::Message *message =
+ const message_registries::Message* message =
message_registries::getMessage("OpenBMC.0.1.BIOSPOSTCode");
uint64_t currentCodeIndex = 0;
- nlohmann::json &logEntryArray = aResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = aResp->res.jsonValue["Members"];
uint64_t firstCodeTimeUs = 0;
- for (const std::pair<uint64_t, uint64_t> &code : postcode)
+ for (const std::pair<uint64_t, uint64_t>& code : postcode)
{
currentCodeIndex++;
std::string postcodeEntryID =
@@ -2694,7 +2695,7 @@
// fill in this post code value
int i = 0;
- for (const std::string &messageArg : messageArgs)
+ for (const std::string& messageArg : messageArgs)
{
std::string argStr = "%" + std::to_string(++i);
size_t argPos = msg.find(argStr);
@@ -2714,7 +2715,7 @@
// add to AsyncResp
logEntryArray.push_back({});
- nlohmann::json &bmcLogEntry = logEntryArray.back();
+ nlohmann::json& bmcLogEntry = logEntryArray.back();
bmcLogEntry = {
{"@odata.type", "#LogEntry.v1_4_0.LogEntry"},
{"@odata.context", "/redfish/v1/$metadata#LogEntry.LogEntry"},
@@ -2739,7 +2740,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootIndex, codeIndex](
const boost::system::error_code ec,
- const boost::container::flat_map<uint64_t, uint64_t> &postcode) {
+ const boost::container::flat_map<uint64_t, uint64_t>& postcode) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
@@ -2773,7 +2774,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootIndex, bootCount, entryCount, skip,
top](const boost::system::error_code ec,
- const boost::container::flat_map<uint64_t, uint64_t> &postcode) {
+ const boost::container::flat_map<uint64_t, uint64_t>& postcode) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
@@ -2826,7 +2827,7 @@
crow::connections::systemBus->async_method_call(
[aResp, entryCount, skip,
top](const boost::system::error_code ec,
- const std::variant<uint16_t> &bootCount) {
+ const std::variant<uint16_t>& bootCount) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -2853,7 +2854,7 @@
{
public:
template <typename CrowApp>
- PostCodesEntryCollection(CrowApp &app) :
+ PostCodesEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/")
{
entityPrivileges = {
@@ -2866,8 +2867,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -2901,7 +2902,7 @@
class PostCodesEntry : public Node
{
public:
- PostCodesEntry(CrowApp &app) :
+ PostCodesEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str>/",
std::string())
@@ -2916,8 +2917,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2926,7 +2927,7 @@
return;
}
- const std::string &targetID = params[0];
+ const std::string& targetID = params[0];
size_t bootPos = targetID.find('B');
if (bootPos == std::string::npos)
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 8a74ed2..756c75f 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -22,10 +22,11 @@
#include <boost/algorithm/string/replace.hpp>
#include <boost/date_time.hpp>
#include <dbus_utility.hpp>
-#include <memory>
-#include <sstream>
#include <utils/fw_utils.hpp>
#include <utils/systemd_utils.hpp>
+
+#include <memory>
+#include <sstream>
#include <variant>
namespace redfish
@@ -1067,8 +1068,7 @@
GetPIDValues(const std::shared_ptr<AsyncResp>& asyncResp) :
asyncResp(asyncResp)
- {
- }
+ {}
void run()
{
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 7c957e9..1878070 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -28,7 +28,7 @@
{
public:
template <typename CrowApp>
- MessageRegistryFileCollection(CrowApp &app) :
+ MessageRegistryFileCollection(CrowApp& app) :
Node(app, "/redfish/v1/Registries/")
{
entityPrivileges = {
@@ -44,8 +44,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Collections don't include the static data added by SubRoute because
// it has a duplicate entry for members
@@ -70,7 +70,7 @@
{
public:
template <typename CrowApp>
- MessageRegistryFile(CrowApp &app) :
+ MessageRegistryFile(CrowApp& app) :
Node(app, "/redfish/v1/Registries/<str>/", std::string())
{
entityPrivileges = {
@@ -83,8 +83,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
if (params.size() != 1)
{
@@ -93,10 +93,10 @@
return;
}
- const std::string ®istry = params[0];
- const message_registries::Header *header;
+ const std::string& registry = params[0];
+ const message_registries::Header* header;
std::string dmtf = "DMTF ";
- const char *url = nullptr;
+ const char* url = nullptr;
if (registry == "Base")
{
@@ -151,7 +151,7 @@
{
public:
template <typename CrowApp>
- MessageRegistry(CrowApp &app) :
+ MessageRegistry(CrowApp& app) :
Node(app, "/redfish/v1/Registries/<str>/<str>/", std::string(),
std::string())
{
@@ -165,8 +165,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
if (params.size() != 2)
{
@@ -175,15 +175,15 @@
return;
}
- const std::string ®istry = params[0];
- const std::string ®istry1 = params[1];
+ const std::string& registry = params[0];
+ const std::string& registry1 = params[1];
- const message_registries::Header *header;
- std::vector<const message_registries::MessageEntry *> registryEntries;
+ const message_registries::Header* header;
+ std::vector<const message_registries::MessageEntry*> registryEntries;
if (registry == "Base")
{
header = &message_registries::base::header;
- for (const message_registries::MessageEntry &entry :
+ for (const message_registries::MessageEntry& entry :
message_registries::base::registry)
{
registryEntries.emplace_back(&entry);
@@ -192,7 +192,7 @@
else if (registry == "TaskEvent")
{
header = &message_registries::task_event::header;
- for (const message_registries::MessageEntry &entry :
+ for (const message_registries::MessageEntry& entry :
message_registries::task_event::registry)
{
registryEntries.emplace_back(&entry);
@@ -201,7 +201,7 @@
else if (registry == "OpenBMC")
{
header = &message_registries::openbmc::header;
- for (const message_registries::MessageEntry &entry :
+ for (const message_registries::MessageEntry& entry :
message_registries::openbmc::registry)
{
registryEntries.emplace_back(&entry);
@@ -233,12 +233,12 @@
{"RegistryVersion", header->registryVersion},
{"OwningEntity", header->owningEntity}};
- nlohmann::json &messageObj = res.jsonValue["Messages"];
+ nlohmann::json& messageObj = res.jsonValue["Messages"];
// Go through the Message Registry and populate each Message
- for (const message_registries::MessageEntry *message : registryEntries)
+ for (const message_registries::MessageEntry* message : registryEntries)
{
- nlohmann::json &obj = messageObj[message->first];
+ nlohmann::json& obj = messageObj[message->first];
obj = {{"Description", message->second.description},
{"Message", message->second.message},
{"Severity", message->second.severity},
@@ -246,8 +246,8 @@
{"Resolution", message->second.resolution}};
if (message->second.numberOfArgs > 0)
{
- nlohmann::json &messageParamArray = obj["ParamTypes"];
- for (const char *str : message->second.paramTypes)
+ nlohmann::json& messageParamArray = obj["ParamTypes"];
+ for (const char* str : message->second.paramTypes)
{
if (str == nullptr)
{
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 2ce952d..60735d0 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -18,8 +18,9 @@
#include "error_messages.hpp"
#include "node.hpp"
-#include <optional>
#include <utils/json_utils.hpp>
+
+#include <optional>
#include <variant>
namespace redfish
{
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index f8a5e29..ac2a2f9 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -23,17 +23,17 @@
namespace redfish
{
-static constexpr char const *pcieService = "xyz.openbmc_project.PCIe";
-static constexpr char const *pciePath = "/xyz/openbmc_project/PCIe";
-static constexpr char const *pcieDeviceInterface =
+static constexpr char const* pcieService = "xyz.openbmc_project.PCIe";
+static constexpr char const* pciePath = "/xyz/openbmc_project/PCIe";
+static constexpr char const* pcieDeviceInterface =
"xyz.openbmc_project.PCIe.Device";
static inline void getPCIeDeviceList(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &name)
+ const std::string& name)
{
auto getPCIeMapCallback = [asyncResp, name](
const boost::system::error_code ec,
- std::vector<std::string> &pcieDevicePaths) {
+ std::vector<std::string>& pcieDevicePaths) {
if (ec)
{
BMCWEB_LOG_DEBUG << "no PCIe device paths found ec: "
@@ -41,9 +41,9 @@
// Not an error, system just doesn't have PCIe info
return;
}
- nlohmann::json &pcieDeviceList = asyncResp->res.jsonValue[name];
+ nlohmann::json& pcieDeviceList = asyncResp->res.jsonValue[name];
pcieDeviceList = nlohmann::json::array();
- for (const std::string &pcieDevicePath : pcieDevicePaths)
+ for (const std::string& pcieDevicePath : pcieDevicePaths)
{
size_t devStart = pcieDevicePath.rfind("/");
if (devStart == std::string::npos)
@@ -73,7 +73,7 @@
{
public:
template <typename CrowApp>
- SystemPCIeDeviceCollection(CrowApp &app) :
+ SystemPCIeDeviceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/PCIeDevices/")
{
entityPrivileges = {
@@ -89,8 +89,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue = {
@@ -107,7 +107,7 @@
class SystemPCIeDevice : public Node
{
public:
- SystemPCIeDevice(CrowApp &app) :
+ SystemPCIeDevice(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/PCIeDevices/<str>/",
std::string())
{
@@ -121,8 +121,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -130,14 +130,14 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &device = params[0];
+ const std::string& device = params[0];
auto getPCIeDeviceCallback =
[asyncResp,
device](const boost::system::error_code ec,
boost::container::flat_map<std::string,
- std::variant<std::string>>
- &pcieDevProperties) {
+ std::variant<std::string>>&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -163,14 +163,14 @@
{"Name", "PCIe Device"},
{"Id", device}};
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Manufacturer"]);
property)
{
asyncResp->res.jsonValue["Manufacturer"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["DeviceType"]);
property)
{
@@ -193,7 +193,7 @@
{
public:
template <typename CrowApp>
- SystemPCIeFunctionCollection(CrowApp &app) :
+ SystemPCIeFunctionCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions/",
std::string())
{
@@ -210,8 +210,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -219,7 +219,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &device = params[0];
+ const std::string& device = params[0];
asyncResp->res.jsonValue = {
{"@odata.type", "#PCIeFunctionCollection.PCIeFunctionCollection"},
{"@odata.id", "/redfish/v1/Systems/system/PCIeDevices/" + device +
@@ -232,8 +232,8 @@
[asyncResp,
device](const boost::system::error_code ec,
boost::container::flat_map<std::string,
- std::variant<std::string>>
- &pcieDevProperties) {
+ std::variant<std::string>>&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -252,7 +252,7 @@
return;
}
- nlohmann::json &pcieFunctionList =
+ nlohmann::json& pcieFunctionList =
asyncResp->res.jsonValue["Members"];
pcieFunctionList = nlohmann::json::array();
static constexpr const int maxPciFunctionNum = 8;
@@ -262,7 +262,7 @@
// Check if this function exists by looking for a device ID
std::string devIDProperty =
"Function" + std::to_string(functionNum) + "DeviceId";
- std::string *property = std::get_if<std::string>(
+ std::string* property = std::get_if<std::string>(
&pcieDevProperties[devIDProperty]);
if (property && !property->empty())
{
@@ -287,7 +287,7 @@
class SystemPCIeFunction : public Node
{
public:
- SystemPCIeFunction(CrowApp &app) :
+ SystemPCIeFunction(CrowApp& app) :
Node(
app,
"/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions/<str>/",
@@ -303,8 +303,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -312,15 +312,15 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &device = params[0];
- const std::string &function = params[1];
+ const std::string& device = params[0];
+ const std::string& function = params[1];
auto getPCIeDeviceCallback = [asyncResp, device, function](
const boost::system::error_code ec,
boost::container::flat_map<
std::string,
- std::variant<std::string>>
- &pcieDevProperties) {
+ std::variant<std::string>>&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -341,7 +341,7 @@
// Check if this function exists by looking for a device ID
std::string devIDProperty = "Function" + function + "DeviceId";
- if (std::string *property =
+ if (std::string* property =
std::get_if<std::string>(&pcieDevProperties[devIDProperty]);
property && property->empty())
{
@@ -362,56 +362,56 @@
{{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices/" + device}}}}}};
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "DeviceId"]);
property)
{
asyncResp->res.jsonValue["DeviceId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "VendorId"]);
property)
{
asyncResp->res.jsonValue["VendorId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "FunctionType"]);
property)
{
asyncResp->res.jsonValue["FunctionType"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "DeviceClass"]);
property)
{
asyncResp->res.jsonValue["DeviceClass"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "ClassCode"]);
property)
{
asyncResp->res.jsonValue["ClassCode"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "RevisionId"]);
property)
{
asyncResp->res.jsonValue["RevisionId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "SubsystemId"]);
property)
{
asyncResp->res.jsonValue["SubsystemId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function +
"SubsystemVendorId"]);
property)
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 35b3127..f5ad839 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -21,9 +21,10 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/range/algorithm/replace_copy_if.hpp>
-#include <cmath>
#include <dbus_singleton.hpp>
#include <utils/json_utils.hpp>
+
+#include <cmath>
#include <variant>
namespace redfish
@@ -53,8 +54,7 @@
const std::string& subNode) :
res(response),
chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode)
- {
- }
+ {}
~SensorsAsyncResp()
{
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index cfbcb6f..922d323 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -25,7 +25,7 @@
class StorageCollection : public Node
{
public:
- StorageCollection(CrowApp &app) :
+ StorageCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Storage/")
{
entityPrivileges = {
@@ -38,8 +38,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#StorageCollection.StorageCollection";
res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Storage";
@@ -54,7 +54,7 @@
class Storage : public Node
{
public:
- Storage(CrowApp &app) : Node(app, "/redfish/v1/Systems/system/Storage/1/")
+ Storage(CrowApp& app) : Node(app, "/redfish/v1/Systems/system/Storage/1/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -66,8 +66,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#Storage.v1_7_1.Storage";
res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Storage/1";
@@ -81,11 +81,11 @@
crow::connections::systemBus->async_method_call(
[asyncResp, health](const boost::system::error_code ec,
- const std::vector<std::string> &storageList) {
- nlohmann::json &storageArray =
+ const std::vector<std::string>& storageList) {
+ nlohmann::json& storageArray =
asyncResp->res.jsonValue["Drives"];
storageArray = nlohmann::json::array();
- auto &count = asyncResp->res.jsonValue["Drives@odata.count"];
+ auto& count = asyncResp->res.jsonValue["Drives@odata.count"];
count = 0;
if (ec)
@@ -99,7 +99,7 @@
storageList.begin(),
storageList.end());
- for (const std::string &objpath : storageList)
+ for (const std::string& objpath : storageList)
{
std::size_t lastPos = objpath.rfind("/");
if (lastPos == std::string::npos ||
@@ -121,23 +121,23 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.Drive"});
crow::connections::systemBus->async_method_call(
[asyncResp,
health](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec || !subtree.size())
{
// doesn't have to be there
return;
}
- nlohmann::json &root =
+ nlohmann::json& root =
asyncResp->res.jsonValue["StorageControllers"];
root = nlohmann::json::array();
- for (const auto &[path, interfaceDict] : subtree)
+ for (const auto& [path, interfaceDict] : subtree)
{
std::size_t lastPos = path.rfind("/");
if (lastPos == std::string::npos ||
@@ -156,11 +156,11 @@
return;
}
- const std::string &connectionName =
+ const std::string& connectionName =
interfaceDict.front().first;
size_t index = root.size();
- nlohmann::json &storageController =
+ nlohmann::json& storageController =
root.emplace_back(nlohmann::json::object());
std::string id = path.substr(lastPos + 1);
@@ -184,7 +184,7 @@
{
return;
}
- const bool *enabled = std::get_if<bool>(&present);
+ const bool* enabled = std::get_if<bool>(&present);
if (enabled == nullptr)
{
BMCWEB_LOG_DEBUG << "Illegal property present";
@@ -206,8 +206,8 @@
index](const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::variant<bool, std::string, uint64_t>>>
- &propertiesList) {
+ std::variant<bool, std::string, uint64_t>>>&
+ propertiesList) {
if (ec)
{
// this interface isn't necessary
@@ -215,15 +215,15 @@
}
for (const std::pair<
std::string,
- std::variant<bool, std::string, uint64_t>>
- &property : propertiesList)
+ std::variant<bool, std::string, uint64_t>>&
+ property : propertiesList)
{
// Store DBus properties that are also
// Redfish properties with same name and a
// string value
- const std::string &propertyName =
+ const std::string& propertyName =
property.first;
- nlohmann::json &object =
+ nlohmann::json& object =
asyncResp->res
.jsonValue["StorageControllers"][index];
if ((propertyName == "PartNumber") ||
@@ -231,7 +231,7 @@
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value == nullptr)
@@ -253,7 +253,7 @@
// resized, as json::array uses vector underneath and we need
// references to its members that won't change
size_t count = 0;
- for (const auto &[path, interfaceDict] : subtree)
+ for (const auto& [path, interfaceDict] : subtree)
{
auto subHealth = std::make_shared<HealthPopulate>(
asyncResp, root[count]["Status"]);
@@ -267,7 +267,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.StorageController"});
}
};
@@ -275,7 +275,7 @@
class Drive : public Node
{
public:
- Drive(CrowApp &app) :
+ Drive(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Storage/1/Drives/<str>/",
std::string())
{
@@ -289,8 +289,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -298,12 +298,12 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &driveId = params[0];
+ const std::string& driveId = params[0];
crow::connections::systemBus->async_method_call(
[asyncResp,
driveId](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec)
{
BMCWEB_LOG_ERROR << "Drive mapper call error";
@@ -312,8 +312,8 @@
}
auto object = std::find_if(
- subtree.begin(), subtree.end(), [&driveId](auto &object) {
- const std::string &path = object.first;
+ subtree.begin(), subtree.end(), [&driveId](auto& object) {
+ const std::string& path = object.first;
return boost::ends_with(path, "/" + driveId);
});
@@ -324,10 +324,10 @@
return;
}
- const std::string &path = object->first;
+ const std::string& path = object->first;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object->second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object->second;
asyncResp->res.jsonValue["@odata.type"] = "#Drive.v1_7_0.Drive";
asyncResp->res.jsonValue["@odata.id"] =
@@ -345,19 +345,19 @@
}
getMainChassisId(
- asyncResp, [](const std::string &chassisId,
+ asyncResp, [](const std::string& chassisId,
std::shared_ptr<AsyncResp> aRsp) {
aRsp->res.jsonValue["Links"]["Chassis"] = {
{"@odata.id", "/redfish/v1/Chassis/" + chassisId}};
});
- const std::string &connectionName = connectionNames[0].first;
+ const std::string& connectionName = connectionNames[0].first;
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::variant<bool, std::string, uint64_t>>>
- &propertiesList) {
+ std::variant<bool, std::string, uint64_t>>>&
+ propertiesList) {
if (ec)
{
// this interface isn't necessary
@@ -365,19 +365,19 @@
}
for (const std::pair<std::string,
std::variant<bool, std::string,
- uint64_t>> &property :
+ uint64_t>>& property :
propertiesList)
{
// Store DBus properties that are also
// Redfish properties with same name and a
// string value
- const std::string &propertyName = property.first;
+ const std::string& propertyName = property.first;
if ((propertyName == "PartNumber") ||
(propertyName == "SerialNumber") ||
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value == nullptr)
{
@@ -408,7 +408,7 @@
{
return;
}
- const bool *enabled = std::get_if<bool>(&present);
+ const bool* enabled = std::get_if<bool>(&present);
if (enabled == nullptr)
{
BMCWEB_LOG_DEBUG << "Illegal property present";
@@ -433,7 +433,7 @@
{
return;
}
- const bool *updating = std::get_if<bool>(&rebuilding);
+ const bool* updating = std::get_if<bool>(&rebuilding);
if (updating == nullptr)
{
BMCWEB_LOG_DEBUG << "Illegal property present";
@@ -457,7 +457,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.Drive"});
}
};
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 338bdc3..a68e8de 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -24,6 +24,7 @@
#include <node.hpp>
#include <utils/fw_utils.hpp>
#include <utils/json_utils.hpp>
+
#include <variant>
namespace redfish
@@ -38,9 +39,9 @@
* @return None.
*/
void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool> &dimmState)
+ const std::variant<bool>& dimmState)
{
- const bool *isDimmFunctional = std::get_if<bool>(&dimmState);
+ const bool* isDimmFunctional = std::get_if<bool>(&dimmState);
if (isDimmFunctional == nullptr)
{
messages::internalError(aResp->res);
@@ -51,7 +52,7 @@
// Set it as Enabled if atleast one DIMM is functional
// Update STATE only if previous State was DISABLED and current Dimm is
// ENABLED.
- nlohmann::json &prevMemSummary =
+ nlohmann::json& prevMemSummary =
aResp->res.jsonValue["MemorySummary"]["Status"]["State"];
if (prevMemSummary == "Disabled")
{
@@ -72,9 +73,9 @@
* @return None.
*/
void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool> &cpuPresenceState)
+ const std::variant<bool>& cpuPresenceState)
{
- const bool *isCpuPresent = std::get_if<bool>(&cpuPresenceState);
+ const bool* isCpuPresent = std::get_if<bool>(&cpuPresenceState);
if (isCpuPresent == nullptr)
{
@@ -85,10 +86,10 @@
if (*isCpuPresent == true)
{
- nlohmann::json &procCount =
+ nlohmann::json& procCount =
aResp->res.jsonValue["ProcessorSummary"]["Count"];
auto procCountPtr =
- procCount.get_ptr<nlohmann::json::number_integer_t *>();
+ procCount.get_ptr<nlohmann::json::number_integer_t*>();
if (procCountPtr != nullptr)
{
// shouldn't be possible to be nullptr
@@ -107,9 +108,9 @@
* @return None.
*/
void modifyCpuFunctionalState(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool> &cpuFunctionalState)
+ const std::variant<bool>& cpuFunctionalState)
{
- const bool *isCpuFunctional = std::get_if<bool>(&cpuFunctionalState);
+ const bool* isCpuFunctional = std::get_if<bool>(&cpuFunctionalState);
if (isCpuFunctional == nullptr)
{
@@ -118,7 +119,7 @@
}
BMCWEB_LOG_DEBUG << "Cpu Functional: " << *isCpuFunctional;
- nlohmann::json &prevProcState =
+ nlohmann::json& prevProcState =
aResp->res.jsonValue["ProcessorSummary"]["Status"]["State"];
// Set it as Enabled if atleast one CPU is functional
@@ -152,8 +153,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::vector<std::pair<std::string, std::vector<std::string>>>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -163,14 +164,14 @@
// Iterate over all retrieved ObjectPaths.
for (const std::pair<std::string,
std::vector<std::pair<
- std::string, std::vector<std::string>>>>
- &object : subtree)
+ std::string, std::vector<std::string>>>>&
+ object : subtree)
{
- const std::string &path = object.first;
+ const std::string& path = object.first;
BMCWEB_LOG_DEBUG << "Got path: " << path;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object.second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
if (connectionNames.size() < 1)
{
continue;
@@ -187,9 +188,9 @@
// This is not system, so check if it's cpu, dimm, UUID or
// BiosVer
- for (const auto &connection : connectionNames)
+ for (const auto& connection : connectionNames)
{
- for (const auto &interfaceName : connection.second)
+ for (const auto& interfaceName : connection.second)
{
if (interfaceName ==
"xyz.openbmc_project.Inventory.Item.Dimm")
@@ -202,8 +203,8 @@
path(std::move(path))](
const boost::system::error_code ec,
const std::vector<
- std::pair<std::string, VariantType>>
- &properties) {
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -218,15 +219,15 @@
if (properties.size() > 0)
{
for (const std::pair<std::string,
- VariantType>
- &property : properties)
+ VariantType>&
+ property : properties)
{
if (property.first !=
"MemorySizeInKB")
{
continue;
}
- const uint32_t *value =
+ const uint32_t* value =
std::get_if<uint32_t>(
&property.second);
if (value == nullptr)
@@ -236,15 +237,15 @@
"MemorySize";
continue;
}
- nlohmann::json &totalMemory =
+ nlohmann::json& totalMemory =
aResp->res
.jsonValue["MemorySummar"
"y"]
["TotalSystemMe"
"moryGiB"];
- uint64_t *preValue =
+ uint64_t* preValue =
totalMemory
- .get_ptr<uint64_t *>();
+ .get_ptr<uint64_t*>();
if (preValue == nullptr)
{
continue;
@@ -267,8 +268,8 @@
[aResp](
const boost::system::error_code
ec,
- const std::variant<bool>
- &dimmState) {
+ const std::variant<bool>&
+ dimmState) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -309,8 +310,8 @@
path(std::move(path))](
const boost::system::error_code ec,
const std::vector<
- std::pair<std::string, VariantType>>
- &properties) {
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -324,29 +325,28 @@
if (properties.size() > 0)
{
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first ==
"ProcessorFamily")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value != nullptr)
{
- nlohmann::json
- &procSummary =
+ nlohmann::json&
+ procSummary =
aResp->res.jsonValue
["ProcessorSumm"
"ary"];
- nlohmann::json &procCount =
+ nlohmann::json& procCount =
procSummary["Count"];
auto procCountPtr =
procCount.get_ptr<
nlohmann::json::
- number_integer_t
- *>();
+ number_integer_t*>();
if (procCountPtr != nullptr)
{
// shouldn't be possible
@@ -368,8 +368,8 @@
[aResp](
const boost::system::error_code
ec,
- const std::variant<bool>
- &cpuPresenceCheck) {
+ const std::variant<bool>&
+ cpuPresenceCheck) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -386,8 +386,8 @@
[aResp](
const boost::system::error_code
ec,
- const std::variant<bool>
- &cpuFunctionalCheck) {
+ const std::variant<bool>&
+ cpuFunctionalCheck) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -443,10 +443,11 @@
BMCWEB_LOG_DEBUG
<< "Found UUID, now get its properties.";
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, VariantType>>
- &properties) {
+ [aResp](
+ const boost::system::error_code ec,
+ const std::vector<
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -458,12 +459,12 @@
<< properties.size()
<< " UUID properties.";
for (const std::pair<std::string,
- VariantType>
- &property : properties)
+ VariantType>&
+ property : properties)
{
if (property.first == "UUID")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
@@ -493,10 +494,11 @@
"xyz.openbmc_project.Inventory.Item.System")
{
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, VariantType>>
- &propertiesList) {
+ [aResp](
+ const boost::system::error_code ec,
+ const std::vector<
+ std::pair<std::string, VariantType>>&
+ propertiesList) {
if (ec)
{
// doesn't have to include this
@@ -507,17 +509,17 @@
<< "Got " << propertiesList.size()
<< " properties for system";
for (const std::pair<std::string,
- VariantType>
- &property : propertiesList)
+ VariantType>&
+ property : propertiesList)
{
- const std::string &propertyName =
+ const std::string& propertyName =
property.first;
if ((propertyName == "PartNumber") ||
(propertyName == "SerialNumber") ||
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value != nullptr)
@@ -542,7 +544,7 @@
crow::connections::systemBus->async_method_call(
[aResp](
const boost::system::error_code ec,
- const std::variant<std::string> &property) {
+ const std::variant<std::string>& property) {
if (ec)
{
// doesn't have to include this
@@ -550,7 +552,7 @@
return;
}
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property);
if (value != nullptr)
{
@@ -572,7 +574,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 5>{
+ std::array<const char*, 5>{
"xyz.openbmc_project.Inventory.Decorator.Asset",
"xyz.openbmc_project.Inventory.Item.Cpu",
"xyz.openbmc_project.Inventory.Item.Dimm",
@@ -593,7 +595,7 @@
BMCWEB_LOG_DEBUG << "Get host information.";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<std::string> &hostState) {
+ const std::variant<std::string>& hostState) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -601,7 +603,7 @@
return;
}
- const std::string *s = std::get_if<std::string>(&hostState);
+ const std::string* s = std::get_if<std::string>(&hostState);
BMCWEB_LOG_DEBUG << "Host state: " << *s;
if (s != nullptr)
{
@@ -643,7 +645,7 @@
* @return Returns as a string, the boot source in Redfish terms. If translation
* cannot be done, returns an empty string.
*/
-static std::string dbusToRfBootSource(const std::string &dbusSource)
+static std::string dbusToRfBootSource(const std::string& dbusSource)
{
if (dbusSource == "xyz.openbmc_project.Control.Boot.Source.Sources.Default")
{
@@ -683,7 +685,7 @@
* @return Returns as a string, the boot mode in Redfish terms. If translation
* cannot be done, returns an empty string.
*/
-static std::string dbusToRfBootMode(const std::string &dbusMode)
+static std::string dbusToRfBootMode(const std::string& dbusMode)
{
if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular")
{
@@ -713,8 +715,8 @@
* @return Integer error code.
*/
static int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
- const std::string &rfSource,
- std::string &bootSource, std::string &bootMode)
+ const std::string& rfSource,
+ std::string& bootSource, std::string& bootMode)
{
// The caller has initialized the bootSource and bootMode to:
// bootMode = "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular";
@@ -777,7 +779,7 @@
{
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<std::string> &bootMode) {
+ const std::variant<std::string>& bootMode) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -785,7 +787,7 @@
return;
}
- const std::string *bootModeStr =
+ const std::string* bootModeStr =
std::get_if<std::string>(&bootMode);
if (!bootModeStr)
@@ -848,7 +850,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootDbusObj](const boost::system::error_code ec,
- const std::variant<std::string> &bootSource) {
+ const std::variant<std::string>& bootSource) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -856,7 +858,7 @@
return;
}
- const std::string *bootSourceStr =
+ const std::string* bootSourceStr =
std::get_if<std::string>(&bootSource);
if (!bootSourceStr)
@@ -893,7 +895,7 @@
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<bool> &oneTime) {
+ const std::variant<bool>& oneTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -901,7 +903,7 @@
return;
}
- const bool *oneTimePtr = std::get_if<bool>(&oneTime);
+ const bool* oneTimePtr = std::get_if<bool>(&oneTime);
if (!oneTimePtr)
{
@@ -929,14 +931,14 @@
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- std::variant<bool> &autoRebootEnabled) {
+ std::variant<bool>& autoRebootEnabled) {
if (ec)
{
BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
return;
}
- const bool *autoRebootEnabledPtr =
+ const bool* autoRebootEnabledPtr =
std::get_if<bool>(&autoRebootEnabled);
if (!autoRebootEnabledPtr)
@@ -954,14 +956,14 @@
// attempts are left
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- std::variant<uint32_t> &autoRebootAttemptsLeft) {
+ std::variant<uint32_t>& autoRebootAttemptsLeft) {
if (ec)
{
BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
return;
}
- const uint32_t *autoRebootAttemptsLeftPtr =
+ const uint32_t* autoRebootAttemptsLeftPtr =
std::get_if<uint32_t>(&autoRebootAttemptsLeft);
if (!autoRebootAttemptsLeftPtr)
@@ -1020,7 +1022,7 @@
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- std::variant<std::string> &policy) {
+ std::variant<std::string>& policy) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1039,7 +1041,7 @@
"LastState",
"LastState"}};
- const std::string *policyPtr = std::get_if<std::string>(&policy);
+ const std::string* policyPtr = std::get_if<std::string>(&policy);
if (!policyPtr)
{
@@ -1133,7 +1135,7 @@
// Act on validated parameters
BMCWEB_LOG_DEBUG << "DBUS boot source: " << bootSourceStr;
BMCWEB_LOG_DEBUG << "DBUS boot mode: " << bootModeStr;
- const char *bootObj =
+ const char* bootObj =
oneTimeSetting ? "/xyz/openbmc_project/control/host0/boot/one_time"
: "/xyz/openbmc_project/control/host0/boot";
@@ -1203,7 +1205,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootSource{std::move(bootSource)},
bootEnable{std::move(bootEnable)}](const boost::system::error_code ec,
- const std::variant<bool> &oneTime) {
+ const std::variant<bool>& oneTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1211,7 +1213,7 @@
return;
}
- const bool *oneTimePtr = std::get_if<bool>(&oneTime);
+ const bool* oneTimePtr = std::get_if<bool>(&oneTime);
if (!oneTimePtr)
{
@@ -1239,7 +1241,7 @@
* @return None.
*/
static void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
- const std::string &&automaticRetryConfig)
+ const std::string&& automaticRetryConfig)
{
BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
@@ -1339,8 +1341,8 @@
BMCWEB_LOG_DEBUG << "Get OEM information.";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::vector<std::pair<std::string, VariantType>>
- &propertiesList) {
+ const std::vector<std::pair<std::string, VariantType>>&
+ propertiesList) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1348,9 +1350,9 @@
return;
}
- const bool *provState = nullptr;
- const bool *lockState = nullptr;
- for (const std::pair<std::string, VariantType> &property :
+ const bool* provState = nullptr;
+ const bool* lockState = nullptr;
+ for (const std::pair<std::string, VariantType>& property :
propertiesList)
{
if (property.first == "UfmProvisioned")
@@ -1370,7 +1372,7 @@
return;
}
- nlohmann::json &oemPFR =
+ nlohmann::json& oemPFR =
aResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"];
if (*provState == true)
{
@@ -1402,7 +1404,7 @@
* @return Returns as a string, the timeout action in Redfish terms. If
* translation cannot be done, returns an empty string.
*/
-static std::string dbusToRfWatchdogAction(const std::string &dbusAction)
+static std::string dbusToRfWatchdogAction(const std::string& dbusAction)
{
if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.None")
{
@@ -1435,7 +1437,7 @@
*If translation cannot be done, returns an empty string.
*/
-static std::string rfToDbusWDTTimeOutAct(const std::string &rfAction)
+static std::string rfToDbusWDTTimeOutAct(const std::string& rfAction)
{
if (rfAction == "None")
{
@@ -1469,7 +1471,7 @@
BMCWEB_LOG_DEBUG << "Get host watchodg";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- PropertiesType &properties) {
+ PropertiesType& properties) {
if (ec)
{
// watchdog service is stopped
@@ -1479,18 +1481,18 @@
BMCWEB_LOG_DEBUG << "Got " << properties.size() << " wdt prop.";
- nlohmann::json &hostWatchdogTimer =
+ nlohmann::json& hostWatchdogTimer =
aResp->res.jsonValue["HostWatchdogTimer"];
// watchdog service is running/enabled
hostWatchdogTimer["Status"]["State"] = "Enabled";
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
BMCWEB_LOG_DEBUG << "prop=" << property.first;
if (property.first == "Enabled")
{
- const bool *state = std::get_if<bool>(&property.second);
+ const bool* state = std::get_if<bool>(&property.second);
if (!state)
{
@@ -1502,7 +1504,7 @@
}
else if (property.first == "ExpireAction")
{
- const std::string *s =
+ const std::string* s =
std::get_if<std::string>(&property.second);
if (!s)
{
@@ -1537,7 +1539,7 @@
*/
static void setWDTProperties(std::shared_ptr<AsyncResp> aResp,
const std::optional<bool> wdtEnable,
- const std::optional<std::string> &wdtTimeOutAction)
+ const std::optional<std::string>& wdtTimeOutAction)
{
BMCWEB_LOG_DEBUG << "Set host watchdog";
@@ -1596,7 +1598,7 @@
class SystemsCollection : public Node
{
public:
- SystemsCollection(CrowApp &app) : Node(app, "/redfish/v1/Systems/")
+ SystemsCollection(CrowApp& app) : Node(app, "/redfish/v1/Systems/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -1608,8 +1610,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
res.jsonValue["@odata.type"] =
@@ -1619,11 +1621,11 @@
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::variant<std::string> &hostName) {
- nlohmann::json &iface_array =
+ const std::variant<std::string>& hostName) {
+ nlohmann::json& iface_array =
asyncResp->res.jsonValue["Members"];
iface_array = nlohmann::json::array();
- auto &count = asyncResp->res.jsonValue["Members@odata.count"];
+ auto& count = asyncResp->res.jsonValue["Members@odata.count"];
count = 0;
if (ec)
{
@@ -1652,7 +1654,7 @@
class SystemActionsReset : public Node
{
public:
- SystemActionsReset(CrowApp &app) :
+ SystemActionsReset(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset/")
{
entityPrivileges = {
@@ -1664,8 +1666,8 @@
* Function handles POST method request.
* Analyzes POST body message before sends Reset request data to D-Bus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -1782,15 +1784,15 @@
/**
* Function transceives data with dbus directly.
*/
- void doNMI(const std::shared_ptr<AsyncResp> &asyncResp)
+ void doNMI(const std::shared_ptr<AsyncResp>& asyncResp)
{
- constexpr char const *serviceName =
+ constexpr char const* serviceName =
"xyz.openbmc_project.Control.Host.NMI";
- constexpr char const *objectPath =
+ constexpr char const* objectPath =
"/xyz/openbmc_project/control/host0/nmi";
- constexpr char const *interfaceName =
+ constexpr char const* interfaceName =
"xyz.openbmc_project.Control.Host.NMI";
- constexpr char const *method = "NMI";
+ constexpr char const* method = "NMI";
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
@@ -1815,7 +1817,7 @@
/*
* Default Constructor
*/
- Systems(CrowApp &app) : Node(app, "/redfish/v1/Systems/system/")
+ Systems(CrowApp& app) : Node(app, "/redfish/v1/Systems/system/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -1830,8 +1832,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#ComputerSystem.v1_11_0.ComputerSystem";
res.jsonValue["Name"] = "system";
@@ -1874,7 +1876,7 @@
};
auto asyncResp = std::make_shared<AsyncResp>(res);
- constexpr const std::array<const char *, 4> inventoryForSystems = {
+ constexpr const std::array<const char*, 4> inventoryForSystems = {
"xyz.openbmc_project.Inventory.Item.Dimm",
"xyz.openbmc_project.Inventory.Item.Cpu",
"xyz.openbmc_project.Inventory.Item.Drive",
@@ -1883,7 +1885,7 @@
auto health = std::make_shared<HealthPopulate>(asyncResp);
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- std::vector<std::string> &resp) {
+ std::vector<std::string>& resp) {
if (ec)
{
// no inventory
@@ -1899,7 +1901,7 @@
health->populate();
- getMainChassisId(asyncResp, [](const std::string &chassisId,
+ getMainChassisId(asyncResp, [](const std::string& chassisId,
std::shared_ptr<AsyncResp> aRsp) {
aRsp->res.jsonValue["Links"]["Chassis"] = {
{{"@odata.id", "/redfish/v1/Chassis/" + chassisId}}};
@@ -1918,8 +1920,8 @@
#endif
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::optional<std::string> indicatorLed;
std::optional<nlohmann::json> bootProps;
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index a746239..fe1468f 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -19,8 +19,9 @@
#include <boost/asio.hpp>
#include <boost/container/flat_map.hpp>
-#include <chrono>
#include <task_messages.hpp>
+
+#include <chrono>
#include <variant>
namespace redfish
@@ -36,7 +37,7 @@
struct Payload
{
- Payload(const crow::Request &req) :
+ Payload(const crow::Request& req) :
targetUri(req.url), httpOperation(req.methodString()),
httpHeaders(nlohmann::json::array())
@@ -54,7 +55,7 @@
jsonBody = nullptr;
}
- for (const auto &field : req.fields)
+ for (const auto& field : req.fields)
{
if (std::find(headerWhitelist.begin(), headerWhitelist.end(),
field.name()) == headerWhitelist.end())
@@ -78,7 +79,7 @@
nlohmann::json jsonBody;
};
-inline void to_json(nlohmann::json &j, const Payload &p)
+inline void to_json(nlohmann::json& j, const Payload& p)
{
j = {{"TargetUri", p.targetUri},
{"HttpOperation", p.httpOperation},
@@ -90,9 +91,9 @@
{
private:
TaskData(std::function<bool(boost::system::error_code,
- sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)> &&handler,
- const std::string &match, size_t idx) :
+ sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>&& handler,
+ const std::string& match, size_t idx) :
callback(std::move(handler)),
matchStr(match), index(idx),
startTime(std::chrono::system_clock::to_time_t(
@@ -100,33 +101,31 @@
status("OK"), state("Running"), messages(nlohmann::json::array()),
timer(crow::connections::systemBus->get_io_context())
- {
- }
+ {}
TaskData() = delete;
public:
- static std::shared_ptr<TaskData> &createTask(
+ static std::shared_ptr<TaskData>& createTask(
std::function<bool(boost::system::error_code,
- sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)> &&handler,
- const std::string &match)
+ sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>&& handler,
+ const std::string& match)
{
static size_t lastTask = 0;
struct MakeSharedHelper : public TaskData
{
MakeSharedHelper(
- std::function<bool(
- boost::system::error_code, sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)> &&handler,
- const std::string &match, size_t idx) :
+ std::function<bool(boost::system::error_code,
+ sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>&& handler,
+ const std::string& match, size_t idx) :
TaskData(std::move(handler), match, idx)
- {
- }
+ {}
};
if (tasks.size() >= maxTaskCount)
{
- auto &last = tasks.front();
+ auto& last = tasks.front();
// destroy all references
last->timer.cancel();
@@ -138,7 +137,7 @@
std::move(handler), match, lastTask++));
}
- void populateResp(crow::Response &res, size_t retryAfterSeconds = 30)
+ void populateResp(crow::Response& res, size_t retryAfterSeconds = 30)
{
if (!endTime)
{
@@ -168,7 +167,7 @@
std::chrono::system_clock::now());
}
- void extendTimer(const std::chrono::seconds &timeout)
+ void extendTimer(const std::chrono::seconds& timeout)
{
timer.expires_after(timeout);
timer.async_wait(
@@ -193,16 +192,16 @@
});
}
- void startTimer(const std::chrono::seconds &timeout)
+ void startTimer(const std::chrono::seconds& timeout)
{
if (match)
{
return;
}
match = std::make_unique<sdbusplus::bus::match::match>(
- static_cast<sdbusplus::bus::bus &>(*crow::connections::systemBus),
+ static_cast<sdbusplus::bus::bus&>(*crow::connections::systemBus),
matchStr,
- [self = shared_from_this()](sdbusplus::message::message &message) {
+ [self = shared_from_this()](sdbusplus::message::message& message) {
boost::system::error_code ec;
// callback to return True if callback is done, callback needs
@@ -224,8 +223,8 @@
messages.emplace_back(messages::taskStarted(std::to_string(index)));
}
- std::function<bool(boost::system::error_code, sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)>
+ std::function<bool(boost::system::error_code, sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>
callback;
std::string matchStr;
size_t index;
@@ -245,7 +244,7 @@
class TaskMonitor : public Node
{
public:
- TaskMonitor(CrowApp &app) :
+ TaskMonitor(CrowApp& app) :
Node((app), "/redfish/v1/TaskService/Tasks/<str>/Monitor/",
std::string())
{
@@ -259,8 +258,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -269,10 +268,10 @@
return;
}
- const std::string &strParam = params[0];
+ const std::string& strParam = params[0];
auto find = std::find_if(
task::tasks.begin(), task::tasks.end(),
- [&strParam](const std::shared_ptr<task::TaskData> &task) {
+ [&strParam](const std::shared_ptr<task::TaskData>& task) {
if (!task)
{
return false;
@@ -288,7 +287,7 @@
messages::resourceNotFound(asyncResp->res, "Monitor", strParam);
return;
}
- std::shared_ptr<task::TaskData> &ptr = *find;
+ std::shared_ptr<task::TaskData>& ptr = *find;
// monitor expires after 204
if (ptr->gave204)
{
@@ -302,7 +301,7 @@
class Task : public Node
{
public:
- Task(CrowApp &app) :
+ Task(CrowApp& app) :
Node((app), "/redfish/v1/TaskService/Tasks/<str>/", std::string())
{
entityPrivileges = {
@@ -315,8 +314,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -325,10 +324,10 @@
return;
}
- const std::string &strParam = params[0];
+ const std::string& strParam = params[0];
auto find = std::find_if(
task::tasks.begin(), task::tasks.end(),
- [&strParam](const std::shared_ptr<task::TaskData> &task) {
+ [&strParam](const std::shared_ptr<task::TaskData>& task) {
if (!task)
{
return false;
@@ -345,7 +344,7 @@
return;
}
- std::shared_ptr<task::TaskData> &ptr = *find;
+ std::shared_ptr<task::TaskData>& ptr = *find;
asyncResp->res.jsonValue["@odata.type"] = "#Task.v1_4_3.Task";
asyncResp->res.jsonValue["Id"] = strParam;
@@ -377,7 +376,7 @@
class TaskCollection : public Node
{
public:
- TaskCollection(CrowApp &app) : Node(app, "/redfish/v1/TaskService/Tasks/")
+ TaskCollection(CrowApp& app) : Node(app, "/redfish/v1/TaskService/Tasks/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -389,8 +388,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue["@odata.type"] =
@@ -398,10 +397,10 @@
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/TaskService/Tasks";
asyncResp->res.jsonValue["Name"] = "Task Collection";
asyncResp->res.jsonValue["Members@odata.count"] = task::tasks.size();
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const std::shared_ptr<task::TaskData> &task : task::tasks)
+ for (const std::shared_ptr<task::TaskData>& task : task::tasks)
{
if (task == nullptr)
{
@@ -417,7 +416,7 @@
class TaskService : public Node
{
public:
- TaskService(CrowApp &app) : Node(app, "/redfish/v1/TaskService/")
+ TaskService(CrowApp& app) : Node(app, "/redfish/v1/TaskService/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -429,8 +428,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue["@odata.type"] =
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 9dacbcd..fcb880e 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -19,6 +19,7 @@
#include <boost/container/flat_map.hpp>
#include <utils/fw_utils.hpp>
+
#include <variant>
namespace redfish
@@ -36,8 +37,8 @@
fwUpdateInProgress = false;
fwUpdateMatcher = nullptr;
}
-static void activateImage(const std::string &objPath,
- const std::string &service)
+static void activateImage(const std::string& objPath,
+ const std::string& service)
{
BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
crow::connections::systemBus->async_method_call(
@@ -58,8 +59,8 @@
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
// then no asyncResp updates will occur
static void softwareInterfaceAdded(std::shared_ptr<AsyncResp> asyncResp,
- sdbusplus::message::message &m,
- const crow::Request &req)
+ sdbusplus::message::message& m,
+ const crow::Request& req)
{
std::vector<std::pair<
std::string,
@@ -71,7 +72,7 @@
m.read(objPath, interfacesProperties);
BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
- for (auto &interface : interfacesProperties)
+ for (auto& interface : interfacesProperties)
{
BMCWEB_LOG_DEBUG << "interface = " << interface.first;
@@ -85,7 +86,7 @@
[objPath, asyncResp,
req](const boost::system::error_code error_code,
const std::vector<std::pair<
- std::string, std::vector<std::string>>> &objInfo) {
+ std::string, std::vector<std::string>>>& objInfo) {
if (error_code)
{
BMCWEB_LOG_DEBUG << "error_code = " << error_code;
@@ -121,9 +122,9 @@
std::shared_ptr<task::TaskData> task =
task::TaskData::createTask(
[](boost::system::error_code ec,
- sdbusplus::message::message &msg,
- const std::shared_ptr<task::TaskData>
- &taskData) {
+ sdbusplus::message::message& msg,
+ const std::shared_ptr<task::TaskData>&
+ taskData) {
if (ec)
{
return task::completed;
@@ -148,7 +149,7 @@
{
return !task::completed;
}
- std::string *state =
+ std::string* state =
std::get_if<std::string>(
&(findActivation->second));
@@ -205,7 +206,7 @@
{
return !task::completed;
}
- uint8_t *progress =
+ uint8_t* progress =
std::get_if<uint8_t>(
&(findProgress->second));
@@ -245,7 +246,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Software.Activation"});
}
}
@@ -254,7 +255,7 @@
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
// then no asyncResp updates will occur
static void monitorForSoftwareAvailable(std::shared_ptr<AsyncResp> asyncResp,
- const crow::Request &req,
+ const crow::Request& req,
int timeoutTimeSeconds = 5)
{
// Only allow one FW update at a time
@@ -273,7 +274,7 @@
fwAvailableTimer->expires_after(std::chrono::seconds(timeoutTimeSeconds));
fwAvailableTimer->async_wait(
- [asyncResp](const boost::system::error_code &ec) {
+ [asyncResp](const boost::system::error_code& ec) {
cleanUp();
if (ec == boost::asio::error::operation_aborted)
{
@@ -295,7 +296,7 @@
}
});
- auto callback = [asyncResp, req](sdbusplus::message::message &m) {
+ auto callback = [asyncResp, req](sdbusplus::message::message& m) {
BMCWEB_LOG_DEBUG << "Match fired";
softwareInterfaceAdded(asyncResp, m, req);
};
@@ -316,7 +317,7 @@
class UpdateServiceActionsSimpleUpdate : public Node
{
public:
- UpdateServiceActionsSimpleUpdate(CrowApp &app) :
+ UpdateServiceActionsSimpleUpdate(CrowApp& app) :
Node(app,
"/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate/")
{
@@ -330,8 +331,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::optional<std::string> transferProtocol;
std::string imageURI;
@@ -443,7 +444,7 @@
class UpdateService : public Node
{
public:
- UpdateService(CrowApp &app) : Node(app, "/redfish/v1/UpdateService/")
+ UpdateService(CrowApp& app) : Node(app, "/redfish/v1/UpdateService/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -455,8 +456,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> aResp = std::make_shared<AsyncResp>(res);
res.jsonValue["@odata.type"] = "#UpdateService.v1_4_0.UpdateService";
@@ -471,7 +472,7 @@
{"@odata.id", "/redfish/v1/UpdateService/FirmwareInventory"}};
#ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
// Update Actions object.
- nlohmann::json &updateSvcSimpleUpdate =
+ nlohmann::json& updateSvcSimpleUpdate =
res.jsonValue["Actions"]["#UpdateService.SimpleUpdate"];
updateSvcSimpleUpdate["target"] =
"/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate";
@@ -481,7 +482,7 @@
// Get the current ApplyTime value
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<std::string> &applyTime) {
+ const std::variant<std::string>& applyTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -489,7 +490,7 @@
return;
}
- const std::string *s = std::get_if<std::string>(&applyTime);
+ const std::string* s = std::get_if<std::string>(&applyTime);
if (s == nullptr)
{
return;
@@ -516,8 +517,8 @@
"xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime");
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "doPatch...";
@@ -596,8 +597,8 @@
}
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "doPost...";
@@ -622,7 +623,7 @@
{
public:
template <typename CrowApp>
- SoftwareInventoryCollection(CrowApp &app) :
+ SoftwareInventoryCollection(CrowApp& app) :
Node(app, "/redfish/v1/UpdateService/FirmwareInventory/")
{
entityPrivileges = {
@@ -635,8 +636,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
res.jsonValue["@odata.type"] =
@@ -650,8 +651,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string, std::vector<std::pair<
- std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::string, std::vector<std::string>>>>>&
+ subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -660,7 +661,7 @@
asyncResp->res.jsonValue["Members"] = nlohmann::json::array();
asyncResp->res.jsonValue["Members@odata.count"] = 0;
- for (auto &obj : subtree)
+ for (auto& obj : subtree)
{
// if can't parse fw id then return
std::size_t idPos;
@@ -672,7 +673,7 @@
}
std::string swId = obj.first.substr(idPos + 1);
- nlohmann::json &members =
+ nlohmann::json& members =
asyncResp->res.jsonValue["Members"];
members.push_back(
{{"@odata.id", "/redfish/v1/UpdateService/"
@@ -690,8 +691,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/software", static_cast<int32_t>(0),
- std::array<const char *, 1>{
- "xyz.openbmc_project.Software.Version"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Software.Version"});
}
};
@@ -699,7 +699,7 @@
{
public:
template <typename CrowApp>
- SoftwareInventory(CrowApp &app) :
+ SoftwareInventory(CrowApp& app) :
Node(app, "/redfish/v1/UpdateService/FirmwareInventory/<str>/",
std::string())
{
@@ -715,17 +715,17 @@
private:
/* Fill related item links (i.e. bmc, bios) in for inventory */
static void getRelatedItems(std::shared_ptr<AsyncResp> aResp,
- const std::string &purpose)
+ const std::string& purpose)
{
if (purpose == fw_util::bmcPurpose)
{
- nlohmann::json &members = aResp->res.jsonValue["RelatedItem"];
+ nlohmann::json& members = aResp->res.jsonValue["RelatedItem"];
members.push_back({{"@odata.id", "/redfish/v1/Managers/bmc"}});
aResp->res.jsonValue["Members@odata.count"] = members.size();
}
else if (purpose == fw_util::biosPurpose)
{
- nlohmann::json &members = aResp->res.jsonValue["RelatedItem"];
+ nlohmann::json& members = aResp->res.jsonValue["RelatedItem"];
members.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/Bios"}});
aResp->res.jsonValue["Members@odata.count"] = members.size();
@@ -736,8 +736,8 @@
}
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -759,8 +759,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string, std::vector<std::pair<
- std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::string, std::vector<std::string>>>>>&
+ subtree) {
BMCWEB_LOG_DEBUG << "doGet callback...";
if (ec)
{
@@ -773,8 +773,8 @@
for (const std::pair<
std::string,
std::vector<
- std::pair<std::string, std::vector<std::string>>>>
- &obj : subtree)
+ std::pair<std::string, std::vector<std::string>>>>&
+ obj : subtree)
{
if (boost::ends_with(obj.first, *swId) != true)
{
@@ -793,7 +793,7 @@
[asyncResp,
swId](const boost::system::error_code error_code,
const boost::container::flat_map<
- std::string, VariantType> &propertiesList) {
+ std::string, VariantType>& propertiesList) {
if (error_code)
{
messages::internalError(asyncResp->res);
@@ -810,7 +810,7 @@
"Purpose");
return;
}
- const std::string *swInvPurpose =
+ const std::string* swInvPurpose =
std::get_if<std::string>(&it->second);
if (swInvPurpose == nullptr)
{
@@ -835,7 +835,7 @@
BMCWEB_LOG_DEBUG << "Version found!";
- const std::string *version =
+ const std::string* version =
std::get_if<std::string>(&it->second);
if (version == nullptr)
@@ -896,8 +896,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree", "/",
static_cast<int32_t>(0),
- std::array<const char *, 1>{
- "xyz.openbmc_project.Software.Version"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Software.Version"});
}
};
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 408113f..552e255 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -30,7 +30,7 @@
/**
* @brief Read all known properties from VM object interfaces
*/
-static void vmParseInterfaceObject(const DbusInterfaceType &interface,
+static void vmParseInterfaceObject(const DbusInterfaceType& interface,
std::shared_ptr<AsyncResp> aResp)
{
const auto mountPointIface =
@@ -63,14 +63,14 @@
return;
}
- const bool *activeValue = std::get_if<bool>(&activeProperty->second);
+ const bool* activeValue = std::get_if<bool>(&activeProperty->second);
if (!activeValue)
{
BMCWEB_LOG_DEBUG << "Value Active not found";
return;
}
- const std::string *endpointIdValue =
+ const std::string* endpointIdValue =
std::get_if<std::string>(&endpointIdProperty->second);
if (endpointIdValue)
{
@@ -93,7 +93,7 @@
mountPointIface->second.find("ImageURL");
if (imageUrlProperty != processIface->second.cend())
{
- const std::string *imageUrlValue =
+ const std::string* imageUrlValue =
std::get_if<std::string>(&imageUrlProperty->second);
if (imageUrlValue && !imageUrlValue->empty())
{
@@ -112,8 +112,8 @@
/**
* @brief Fill template for Virtual Media Item.
*/
-static nlohmann::json vmItemTemplate(const std::string &name,
- const std::string &resName)
+static nlohmann::json vmItemTemplate(const std::string& name,
+ const std::string& resName)
{
nlohmann::json item;
item["@odata.id"] =
@@ -140,26 +140,26 @@
* @brief Fills collection data
*/
static void getVmResourceList(std::shared_ptr<AsyncResp> aResp,
- const std::string &service,
- const std::string &name)
+ const std::string& service,
+ const std::string& name)
{
BMCWEB_LOG_DEBUG << "Get available Virtual Media resources.";
crow::connections::systemBus->async_method_call(
[name, aResp{std::move(aResp)}](const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
return;
}
- nlohmann::json &members = aResp->res.jsonValue["Members"];
+ nlohmann::json& members = aResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
nlohmann::json item;
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastIndex = path.rfind("/");
if (lastIndex == std::string::npos)
{
@@ -183,14 +183,14 @@
* @brief Fills data for specific resource
*/
static void getVmData(std::shared_ptr<AsyncResp> aResp,
- const std::string &service, const std::string &name,
- const std::string &resName)
+ const std::string& service, const std::string& name,
+ const std::string& resName)
{
BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
crow::connections::systemBus->async_method_call(
[resName, name, aResp](const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -198,10 +198,10 @@
return;
}
- for (auto &item : subtree)
+ for (auto& item : subtree)
{
- const std::string &path =
- static_cast<const std::string &>(item.first);
+ const std::string& path =
+ static_cast<const std::string&>(item.first);
std::size_t lastItem = path.rfind("/");
if (lastItem == std::string::npos)
@@ -248,7 +248,7 @@
class VirtualMediaActionInsertMedia : public Node
{
public:
- VirtualMediaActionInsertMedia(CrowApp &app) :
+ VirtualMediaActionInsertMedia(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/"
"VirtualMedia.InsertMedia",
@@ -280,7 +280,7 @@
*
*/
std::optional<TransferProtocol>
- getTransferProtocolFromUri(const std::string &imageUri)
+ getTransferProtocolFromUri(const std::string& imageUri)
{
if (imageUri.find("smb://") != std::string::npos)
{
@@ -305,7 +305,7 @@
*
*/
std::optional<TransferProtocol> getTransferProtocolFromParam(
- const std::optional<std::string> &transferProtocolType)
+ const std::optional<std::string>& transferProtocolType)
{
if (transferProtocolType == std::nullopt)
{
@@ -330,8 +330,8 @@
*
*/
const std::string
- getUriWithTransferProtocol(const std::string &imageUri,
- const TransferProtocol &transferProtocol)
+ getUriWithTransferProtocol(const std::string& imageUri,
+ const TransferProtocol& transferProtocol)
{
if (transferProtocol == TransferProtocol::smb)
{
@@ -350,10 +350,10 @@
* @brief Function validate parameters of insert media request.
*
*/
- bool validateParams(crow::Response &res, std::string &imageUrl,
- const std::optional<bool> &inserted,
- const std::optional<std::string> &transferMethod,
- const std::optional<std::string> &transferProtocolType)
+ bool validateParams(crow::Response& res, std::string& imageUrl,
+ const std::optional<bool>& inserted,
+ const std::optional<std::string>& transferMethod,
+ const std::optional<std::string>& transferProtocolType)
{
BMCWEB_LOG_DEBUG << "Validation started";
// required param imageUrl must not be empty
@@ -469,8 +469,8 @@
*
* Analyzes POST body message before sends Reset request data to dbus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto aResp = std::make_shared<AsyncResp>(res);
@@ -481,7 +481,7 @@
}
// take resource name from URL
- const std::string &resName = params[1];
+ const std::string& resName = params[1];
if (params[0] != "bmc")
{
@@ -493,7 +493,7 @@
crow::connections::systemBus->async_method_call(
[this, aResp{std::move(aResp)}, req,
resName](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -508,7 +508,7 @@
crow::connections::systemBus->async_method_call(
[this, service, resName, req, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -516,10 +516,10 @@
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastIndex = path.rfind("/");
if (lastIndex == std::string::npos)
@@ -602,22 +602,22 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
- template <typename T> static void secureCleanup(T &value)
+ template <typename T>
+ static void secureCleanup(T& value)
{
- auto raw = const_cast<typename T::value_type *>(value.data());
+ auto raw = const_cast<typename T::value_type*>(value.data());
explicit_bzero(raw, value.size() * sizeof(*raw));
}
class Credentials
{
public:
- Credentials(std::string &&user, std::string &&password) :
+ Credentials(std::string&& user, std::string&& password) :
userBuf(std::move(user)), passBuf(std::move(password))
- {
- }
+ {}
~Credentials()
{
@@ -625,20 +625,20 @@
secureCleanup(passBuf);
}
- const std::string &user()
+ const std::string& user()
{
return userBuf;
}
- const std::string &password()
+ const std::string& password()
{
return passBuf;
}
private:
Credentials() = delete;
- Credentials(const Credentials &) = delete;
- Credentials &operator=(const Credentials &) = delete;
+ Credentials(const Credentials&) = delete;
+ Credentials& operator=(const Credentials&) = delete;
std::string userBuf;
std::string passBuf;
@@ -647,9 +647,10 @@
class CredentialsProvider
{
public:
- template <typename T> struct Deleter
+ template <typename T>
+ struct Deleter
{
- void operator()(T *buff) const
+ void operator()(T* buff) const
{
if (buff)
{
@@ -663,20 +664,19 @@
using SecureBuffer = std::unique_ptr<Buffer, Deleter<Buffer>>;
// Using explicit definition instead of std::function to avoid implicit
// conversions eg. stack copy instead of reference
- using FormatterFunc = void(const std::string &username,
- const std::string &password, Buffer &dest);
+ using FormatterFunc = void(const std::string& username,
+ const std::string& password, Buffer& dest);
- CredentialsProvider(std::string &&user, std::string &&password) :
+ CredentialsProvider(std::string&& user, std::string&& password) :
credentials(std::move(user), std::move(password))
- {
- }
+ {}
- const std::string &user()
+ const std::string& user()
{
return credentials.user();
}
- const std::string &password()
+ const std::string& password()
{
return credentials.password();
}
@@ -697,15 +697,15 @@
};
// Wrapper for boost::async_pipe ensuring proper pipe cleanup
- template <typename Buffer> class Pipe
+ template <typename Buffer>
+ class Pipe
{
public:
using unix_fd = sdbusplus::message::unix_fd;
- Pipe(boost::asio::io_context &io, Buffer &&buffer) :
+ Pipe(boost::asio::io_context& io, Buffer&& buffer) :
impl(io), buffer{std::move(buffer)}
- {
- }
+ {}
~Pipe()
{
@@ -719,7 +719,7 @@
}
template <typename WriteHandler>
- void async_write(WriteHandler &&handler)
+ void async_write(WriteHandler&& handler)
{
impl.async_write_some(data(), std::forward<WriteHandler>(handler));
}
@@ -753,9 +753,9 @@
* All BMC state properties will be retrieved before sending reset request.
*/
void doMountVmLegacy(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &service, const std::string &name,
- const std::string &imageUrl, const bool rw,
- std::string &&userName, std::string &&password)
+ const std::string& service, const std::string& name,
+ const std::string& imageUrl, const bool rw,
+ std::string&& userName, std::string&& password)
{
using SecurePipe = Pipe<CredentialsProvider::SecureBuffer>;
constexpr const size_t secretLimit = 1024;
@@ -779,8 +779,8 @@
}
// Pack secret
- auto secret = credentials.pack([](const auto &user,
- const auto &pass, auto &buff) {
+ auto secret = credentials.pack([](const auto& user,
+ const auto& pass, auto& buff) {
std::copy(user.begin(), user.end(), std::back_inserter(buff));
buff.push_back('\0');
std::copy(pass.begin(), pass.end(), std::back_inserter(buff));
@@ -795,7 +795,7 @@
// Pass secret over pipe
secretPipe->async_write(
- [asyncResp](const boost::system::error_code &ec,
+ [asyncResp](const boost::system::error_code& ec,
std::size_t size) {
if (ec)
{
@@ -831,7 +831,7 @@
class VirtualMediaActionEjectMedia : public Node
{
public:
- VirtualMediaActionEjectMedia(CrowApp &app) :
+ VirtualMediaActionEjectMedia(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/"
"VirtualMedia.EjectMedia",
@@ -852,8 +852,8 @@
*
* Analyzes POST body message before sends Reset request data to dbus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto aResp = std::make_shared<AsyncResp>(res);
@@ -864,7 +864,7 @@
}
// take resource name from URL
- const std::string &resName = params[1];
+ const std::string& resName = params[1];
if (params[0] != "bmc")
{
@@ -876,7 +876,7 @@
crow::connections::systemBus->async_method_call(
[this, aResp{std::move(aResp)}, req,
resName](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -891,7 +891,7 @@
crow::connections::systemBus->async_method_call(
[this, resName, service, req, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -899,10 +899,10 @@
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastIndex = path.rfind("/");
if (lastIndex == std::string::npos)
@@ -943,7 +943,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
/**
@@ -952,7 +952,7 @@
* All BMC state properties will be retrieved before sending reset request.
*/
void doVmAction(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &service, const std::string &name,
+ const std::string& service, const std::string& name,
bool legacy)
{
@@ -996,7 +996,7 @@
/*
* Default Constructor
*/
- VirtualMediaCollection(CrowApp &app) :
+ VirtualMediaCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/<str>/VirtualMedia/", std::string())
{
entityPrivileges = {
@@ -1012,8 +1012,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -1026,7 +1026,7 @@
return;
}
- const std::string &name = params[0];
+ const std::string& name = params[0];
if (name != "bmc")
{
@@ -1043,7 +1043,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, name](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -1060,7 +1060,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
};
@@ -1070,7 +1070,7 @@
/*
* Default Constructor
*/
- VirtualMedia(CrowApp &app) :
+ VirtualMedia(CrowApp& app) :
Node(app, "/redfish/v1/Managers/<str>/VirtualMedia/<str>/",
std::string(), std::string())
{
@@ -1087,8 +1087,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Check if there is required param, truly entering this shall be
// impossible
@@ -1099,8 +1099,8 @@
res.end();
return;
}
- const std::string &name = params[0];
- const std::string &resName = params[1];
+ const std::string& name = params[0];
+ const std::string& resName = params[1];
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -1113,7 +1113,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, name, resName](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -1130,7 +1130,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
};
diff --git a/redfish-core/ut/lock_test.cpp b/redfish-core/ut/lock_test.cpp
index 0ecd8a9..08ba27a 100644
--- a/redfish-core/ut/lock_test.cpp
+++ b/redfish-core/ut/lock_test.cpp
@@ -1,9 +1,10 @@
#include "ibm/locks.hpp"
#include "nlohmann/json.hpp"
-#include <string>
#include <utils/json_utils.hpp>
+#include <string>
+
#include "gmock/gmock.h"
namespace crow
@@ -59,8 +60,7 @@
{{"LockAll", 2}, {"DontLock", 4}}}};
}
~LockTest()
- {
- }
+ {}
};
class MockLock : public crow::ibm_mc_lock::Lock
diff --git a/src/ast_jpeg_decoder_test.cpp b/src/ast_jpeg_decoder_test.cpp
index 1552f46..7491f5a 100644
--- a/src/ast_jpeg_decoder_test.cpp
+++ b/src/ast_jpeg_decoder_test.cpp
@@ -22,7 +22,7 @@
// This binary blog was created on the aspeed hardware using a blue screen
// consisting of the color 0x8EFFFA in a web browser window
- FILE *fp = fopen("test_resources/aspeedbluescreen.bin", "rb");
+ FILE* fp = fopen("test_resources/aspeedbluescreen.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen =
fread(out.buffer.data(), sizeof(decltype(out.buffer)::value_type),
@@ -47,7 +47,7 @@
// compression artifacts and quanitization)
for (int i = 0; i < out.width * out.height; i++)
{
- ast_video::RGB &pixel = d.outBuffer[i];
+ ast_video::RGB& pixel = d.outBuffer[i];
EXPECT_GT(pixel.r, 0x8E - tolerance);
EXPECT_LT(pixel.r, 0x8E + tolerance);
EXPECT_GT(pixel.g, 0xFF - tolerance);
@@ -62,7 +62,7 @@
ast_video::RawVideoBuffer out;
// This binary blog was created on the aspeed hardware using a black screen
- FILE *fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
+ FILE* fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen = fread(out.buffer.data(), sizeof(char),
out.buffer.size() * sizeof(long), fp);
@@ -100,7 +100,7 @@
// This binary blog was created on the aspeed hardware using a blue screen
// consisting of the color 0x8EFFFA in a web browser window
- FILE *fp = fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb");
+ FILE* fp = fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen = fread(out.buffer.data(), sizeof(char),
out.buffer.size() * sizeof(long), fp);
@@ -138,7 +138,7 @@
ast_video::RawVideoBuffer out;
// This binary blog was created on the aspeed hardware using a black screen
- FILE *fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
+ FILE* fp = fopen("test_resources/aspeedblackscreen.bin", "rb");
EXPECT_NE(fp, nullptr);
size_t bufferlen = fread(out.buffer.data(), sizeof(char),
out.buffer.size() * sizeof(long), fp);
@@ -156,7 +156,7 @@
d.decode(out.buffer, out.width, out.height, out.mode, out.ySelector,
out.uvSelector);
// reserved pixel should be default value
- for (auto &pixel : d.outBuffer)
+ for (auto& pixel : d.outBuffer)
{
EXPECT_EQ(pixel.reserved, 0xAA);
}
diff --git a/src/ast_video_puller_test.cpp b/src/ast_video_puller_test.cpp
index f84b302..a69f47b 100644
--- a/src/ast_video_puller_test.cpp
+++ b/src/ast_video_puller_test.cpp
@@ -5,6 +5,7 @@
#include <ast_jpeg_decoder.hpp>
#include <ast_video_puller.hpp>
+
#include <chrono>
#include <fstream>
#include <iomanip>
@@ -27,7 +28,7 @@
}
else
{
- FILE *fp =
+ FILE* fp =
fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb");
if (fp)
{
@@ -47,7 +48,7 @@
}
}
- FILE *fp = fopen("/tmp/screendata.bin", "wb");
+ FILE* fp = fopen("/tmp/screendata.bin", "wb");
fwrite(out.buffer.data(), sizeof(char), out.buffer.size(), fp);
fclose(fp);
diff --git a/src/base64.cpp b/src/base64.cpp
index 2e64bfa..4b5cc26 100644
--- a/src/base64.cpp
+++ b/src/base64.cpp
@@ -2,7 +2,7 @@
namespace base64
{
-bool base64_encode(const std::string &input, std::string &output)
+bool base64_encode(const std::string& input, std::string& output)
{
// As is, this array is 64 bytes long, which should be greater than the max
// of 0b00111111 when indexed NOLINT calls below are to silence clang-tidy
@@ -67,7 +67,7 @@
return true;
}
-bool base64_decode(const std::string &input, std::string &output)
+bool base64_decode(const std::string& input, std::string& output)
{
constexpr char nop = -1;
// See note on encoding_data[] in above function
diff --git a/src/crow_test.cpp b/src/crow_test.cpp
index f427a2f..f53e519 100644
--- a/src/crow_test.cpp
+++ b/src/crow_test.cpp
@@ -1,9 +1,9 @@
+#include "crow.h"
+
#include <iostream>
#include <sstream>
#include <vector>
-#include "crow.h"
-
#include "gtest/gtest.h"
using namespace std;
@@ -22,7 +22,8 @@
error_print(args...);
}
-template <typename... Args> void fail(Args... args)
+template <typename... Args>
+void fail(Args... args)
{
error_print(args...);
failed__ = true;
@@ -58,8 +59,7 @@
fail("empty handler should fail to validate");
}
catch (runtime_error& e)
- {
- }
+ {}
int x = 0;
@@ -484,33 +484,27 @@
struct NullMiddleware
{
struct Context
- {
- };
+ {};
template <typename AllContext>
void beforeHandle(Request&, Response&, Context&, AllContext&)
- {
- }
+ {}
template <typename AllContext>
void afterHandle(Request&, Response&, Context&, AllContext&)
- {
- }
+ {}
};
struct NullSimpleMiddleware
{
struct Context
- {
- };
+ {};
void beforeHandle(Request& /*req*/, Response& /*res*/, Context& /*ctx*/)
- {
- }
+ {}
void afterHandle(Request& /*req*/, Response& /*res*/, Context& /*ctx*/)
- {
- }
+ {}
};
TEST(Crow, middleware_simple)
@@ -569,8 +563,7 @@
struct SecondMW
{
struct Context
- {
- };
+ {};
template <typename AllContext>
void beforeHandle(Request& req, Response& res, Context&,
AllContext& all_ctx)
@@ -590,8 +583,7 @@
struct ThirdMW
{
struct Context
- {
- };
+ {};
template <typename AllContext>
void beforeHandle(Request&, Response&, Context&, AllContext& all_ctx)
{
@@ -895,8 +887,7 @@
fail();
}
catch (std::exception&)
- {
- }
+ {}
// app is in an invalid state when routeDynamic throws an exception.
try
@@ -905,8 +896,7 @@
fail();
}
catch (std::exception&)
- {
- }
+ {}
{
boost::beast::http::request<boost::beast::http::string_body> r{};
diff --git a/src/gtest_main.cpp b/src/gtest_main.cpp
index 77e70aa..8d2d071 100644
--- a/src/gtest_main.cpp
+++ b/src/gtest_main.cpp
@@ -1,7 +1,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/src/kvm_websocket_test.cpp b/src/kvm_websocket_test.cpp
index 40470a9..07ca515 100644
--- a/src/kvm_websocket_test.cpp
+++ b/src/kvm_websocket_test.cpp
@@ -1,3 +1,5 @@
+#include "crow.h"
+
#include "gzip_helper.hpp"
#include "web_kvm.hpp"
@@ -5,8 +7,6 @@
#include <sstream>
#include <vector>
-#include "crow.h"
-
#include <gmock/gmock.h>
#include <gtest/gtest.h>
diff --git a/src/token_authorization_middleware_test.cpp b/src/token_authorization_middleware_test.cpp
index 8f4c5c8..3ac7947 100644
--- a/src/token_authorization_middleware_test.cpp
+++ b/src/token_authorization_middleware_test.cpp
@@ -16,8 +16,7 @@
TokenAuth() :
lk(std::unique_lock<std::mutex>(m)),
io(std::make_shared<boost::asio::io_context>())
- {
- }
+ {}
std::mutex m;
std::condition_variable cv;
diff --git a/src/webassets_test.cpp b/src/webassets_test.cpp
index 4f010a6..48dc398 100644
--- a/src/webassets_test.cpp
+++ b/src/webassets_test.cpp
@@ -3,9 +3,10 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp>
#include <gzip_helper.hpp>
-#include <sstream>
#include <webassets.hpp>
+#include <sstream>
+
#include "gtest/gtest.h"
#include <gmock/gmock.h>
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index f4e6207..738fb28 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -6,9 +6,10 @@
#include <dbus_singleton.hpp>
#include <image_upload.hpp>
#include <kvm_websocket.hpp>
-#include <memory>
#include <obmc_console.hpp>
#include <openbmc_dbus_rest.hpp>
+
+#include <memory>
#ifdef BMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE
#include <ibm/management_console_rest.hpp>
#endif
@@ -20,12 +21,13 @@
#include <sdbusplus/server.hpp>
#include <security_headers_middleware.hpp>
#include <ssl_key_handler.hpp>
-#include <string>
#include <token_authorization_middleware.hpp>
#include <vm_websocket.hpp>
#include <webassets.hpp>
#include <webserver_common.hpp>
+#include <string>
+
#ifdef BMCWEB_ENABLE_VM_NBDPROXY
#include <nbd_proxy.hpp>
#endif