Next round of boost-uri updates

Boost url has changed some APIs again.  This commit updates our URIs to
handle it.  As part of this work, it also removes some of the debug
prints that were put in early on.  These aren't really needed these
days.

This commit invents a temporary #define of NEW_BOOST_URL, so we can get
through the subtree update without a hard dependency on this specific
version of bmcweb.  Ideally boost-url would have some version field, but
unfortunately, it is thusfar unversioned, as the long term intent of the
author is to be included in boost, and would be versioned there.

All the code within the else of the NEW_BOOST_URL flag will be removed
once the subtree update is landed.

Tested:
Added CXXFLAGS:append = " -DNEW_BOOST_URL" to the recipe and checked out
on top of the subtree update, and build succeeded.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie2064e45efbc4331bdc5a5ddf44d877cde5e13cb
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 41438cb..43be44b 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -181,6 +181,51 @@
     entryTimestamp = crow::utility::getDateTimeUint(timestamp / 1000 / 1000);
     return true;
 }
+#ifdef NEW_BOOST_URL
+static bool getSkipParam(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+                         const crow::Request& req, uint64_t& skip)
+{
+    boost::urls::params_view::iterator it = req.urlView.params().find("$skip");
+    if (it != req.urlView.params().end())
+    {
+        std::from_chars_result r = std::from_chars(
+            (*it).value.data(), (*it).value.data() + (*it).value.size(), skip);
+        if (r.ec != std::errc())
+        {
+            messages::queryParameterValueTypeError(asyncResp->res, "", "$skip");
+            return false;
+        }
+    }
+    return true;
+}
+
+static constexpr const uint64_t maxEntriesPerPage = 1000;
+static bool getTopParam(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+                        const crow::Request& req, uint64_t& top)
+{
+    boost::urls::params_view::iterator it = req.urlView.params().find("$top");
+    if (it != req.urlView.params().end())
+    {
+        std::from_chars_result r = std::from_chars(
+            (*it).value.data(), (*it).value.data() + (*it).value.size(), top);
+        if (r.ec != std::errc())
+        {
+            messages::queryParameterValueTypeError(asyncResp->res, "", "$top");
+            return false;
+        }
+        if (top < 1U || top > maxEntriesPerPage)
+        {
+
+            messages::queryParameterOutOfRange(
+                asyncResp->res, std::to_string(top), "$top",
+                "1-" + std::to_string(maxEntriesPerPage));
+            return false;
+        }
+    }
+    return true;
+}
+
+#else
 
 static bool getSkipParam(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const crow::Request& req, uint64_t& skip)
@@ -230,6 +275,8 @@
     return true;
 }
 
+#endif
+
 inline static bool getUniqueEntryID(sd_journal* journal, std::string& entryID,
                                     const bool firstEntry = true)
 {