diff options
author | Edward Lee <edwarddl@google.com> | 2022-11-12 02:38:17 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-12-06 02:18:40 +0300 |
commit | c0bdf22334f859d1d2a522d3841160f579a3cbab (patch) | |
tree | 9a3081531e9d5340eabd076ae7006c8b7bcef8fd | |
parent | 2c9efc3cb140e5c1d4d57b73f0a511880ac7a11f (diff) | |
download | bmcweb-c0bdf22334f859d1d2a522d3841160f579a3cbab.tar.xz |
Code move to prevent circular dependency
While implementing https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57932,
there has been an issue where there is a circular dependency between
routing.hpp and privileges.hpp. This code move predates this change
to resolve it before implementing the heart of redfish authz.
Circular dependency will occur when we try to use the http verb
index variables in privilege.hpp. If this occurs routing.hpp
and privilege.hpp will co-depend on each other
and this code move prevents this from occuring.
Tested:
bitbake bmcweb
Code compiles (code move only)
Redfish Validator passed on next commit
Signed-off-by: Edward Lee <edwarddl@google.com>
Change-Id: I46551d9fe222e702d239ed3ea6d3d7e505d488c8
-rw-r--r-- | http/routing.hpp | 8 | ||||
-rw-r--r-- | http/verb.hpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/http/routing.hpp b/http/routing.hpp index 6c393ab33b..650aeb5aed 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -29,14 +29,6 @@ namespace crow { -static constexpr size_t maxVerbIndex = static_cast<size_t>(HttpVerb::Max) - 1U; - -// MaxVerb + 1 is designated as the "not found" verb. It is done this way -// to keep the BaseRule as a single bitfield (thus keeping the struct small) -// while still having a way to declare a route a "not found" route. -static constexpr const size_t notFoundIndex = maxVerbIndex + 1; -static constexpr const size_t methodNotAllowedIndex = notFoundIndex + 1; - class BaseRule { public: diff --git a/http/verb.hpp b/http/verb.hpp index 33dd5690dc..8eec68a352 100644 --- a/http/verb.hpp +++ b/http/verb.hpp @@ -17,6 +17,14 @@ enum class HttpVerb Max, }; +static constexpr size_t maxVerbIndex = static_cast<size_t>(HttpVerb::Max) - 1U; + +// MaxVerb + 1 is designated as the "not found" verb. It is done this way +// to keep the BaseRule as a single bitfield (thus keeping the struct small) +// while still having a way to declare a route a "not found" route. +static constexpr const size_t notFoundIndex = maxVerbIndex + 1; +static constexpr const size_t methodNotAllowedIndex = notFoundIndex + 1; + inline std::optional<HttpVerb> httpVerbFromBoost(boost::beast::http::verb bv) { switch (bv) |