Add setUpRedfishRoute to all nodes in redfish

For better or worse, the series ahead of this is making use of
setUpRedfishRoute to do the common "redfish specified" things that need
to be done for a connection, like header checking, filtering, and other
things.  In the current model, where BMCWEB_ROUTE is a common function
for all HTTP routes, this means we need to propagate this injection call
into the whole tree ahead of the requests being handled.

In a perfect world, we would invent something like a REDFISH_ROUTE
macro, but because macros are discouraged, the routes take a variadic
template of parameters, and each call to the route has a .privileges()
call in the middle, there's no good way to effect this change in a less
costly manner.  This was messaged both in the prior reviews, and on
discord sourcing improvements on this pattern, to which none arose.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id29cc799e214edad41e48fc7ce6eed0521f90ecb
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index c030e5a..fe4c592 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -22,15 +22,20 @@
 #include "registries/task_event_message_registry.hpp"
 
 #include <app.hpp>
+#include <query.hpp>
 #include <registries/privilege_registry.hpp>
 
 namespace redfish
 {
 
 inline void handleMessageRegistryFileCollectionGet(
-    const crow::Request& /*req*/,
+    crow::App& app, const crow::Request& req,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
+    if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+    {
+        return;
+    }
     // Collections don't include the static data added by SubRoute
     // because it has a duplicate entry for members
 
@@ -55,15 +60,19 @@
      */
     BMCWEB_ROUTE(app, "/redfish/v1/Registries/")
         .privileges(redfish::privileges::getMessageRegistryFileCollection)
-        .methods(boost::beast::http::verb::get)(
-            handleMessageRegistryFileCollectionGet);
+        .methods(boost::beast::http::verb::get)(std::bind_front(
+            handleMessageRegistryFileCollectionGet, std::ref(app)));
 }
 
 inline void handleMessageRoutesMessageRegistryFileGet(
-    const crow::Request& /*req*/,
+    crow::App& app, const crow::Request& req,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& registry)
 {
+    if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+    {
+        return;
+    }
     const registries::Header* header = nullptr;
     std::string dmtf = "DMTF ";
     const char* url = nullptr;
@@ -120,16 +129,20 @@
 {
     BMCWEB_ROUTE(app, "/redfish/v1/Registries/<str>/")
         .privileges(redfish::privileges::getMessageRegistryFile)
-        .methods(boost::beast::http::verb::get)(
-            handleMessageRoutesMessageRegistryFileGet);
+        .methods(boost::beast::http::verb::get)(std::bind_front(
+            handleMessageRoutesMessageRegistryFileGet, std::ref(app)));
 }
 
 inline void handleMessageRegistryGet(
-    const crow::Request& /*req*/,
+    crow::App& app, const crow::Request& req,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& registry, const std::string& registryMatch)
 
 {
+    if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+    {
+        return;
+    }
     const registries::Header* header = nullptr;
     std::vector<const registries::MessageEntry*> registryEntries;
     if (registry == "Base")
@@ -223,6 +236,7 @@
 {
     BMCWEB_ROUTE(app, "/redfish/v1/Registries/<str>/<str>/")
         .privileges(redfish::privileges::getMessageRegistryFile)
-        .methods(boost::beast::http::verb::get)(handleMessageRegistryGet);
+        .methods(boost::beast::http::verb::get)(
+            std::bind_front(handleMessageRegistryGet, std::ref(app)));
 }
 } // namespace redfish