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
diff --git a/http/verb.hpp b/http/verb.hpp
index 33dd569..8eec68a 100644
--- a/http/verb.hpp
+++ b/http/verb.hpp
@@ -17,6 +17,14 @@
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)