summaryrefslogtreecommitdiff
path: root/http/verb.hpp
diff options
context:
space:
mode:
authorEdward Lee <edwarddl@google.com>2022-11-12 02:38:17 +0300
committerEd Tanous <ed@tanous.net>2022-12-06 02:18:40 +0300
commitc0bdf22334f859d1d2a522d3841160f579a3cbab (patch)
tree9a3081531e9d5340eabd076ae7006c8b7bcef8fd /http/verb.hpp
parent2c9efc3cb140e5c1d4d57b73f0a511880ac7a11f (diff)
downloadbmcweb-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
Diffstat (limited to 'http/verb.hpp')
-rw-r--r--http/verb.hpp8
1 files changed, 8 insertions, 0 deletions
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)