Make register_method accept 'Flags'

Problem statement:
SD_BUS_METHOD() takes 'Flags' as one of it's arguments.
The flags parameter is used to specify a combination of D-Bus annotations.
Reference https://man7.org/linux/man-pages/man3/sd_bus_add_object.3.html

'register_method' function in file sdbusplus\include\sdbusplus\asio\object_server.hpp
makes the following call

method_callbacks_.emplace_back(name, std::move(func), argType.data(),
    resultType.data());

This calls ends up in following function which calls SD_BUS_METHOD

constexpr vtable_t method(const char* member, const char* signature,
    const char* result, sd_bus_message_handler_t handler,
    decltype(vtable_t::flags) flags)
{
    return vtable_t SD_BUS_METHOD(member, signature, result, handler, flags);
}

Problem is register_method does not take 'Flags' as one of it's arguments.
So SD_BUS_METHOD is called with flags = 0, default value.

Proposed solution:
Add 'Flags' as one of the arguments in register_method function.

Tested:
By passing flag SD_BUS_VTABLE_UNPRIVILEGED to register_method function
and making sure the property of flag is reflected in dbus.

Change-Id: I4845d3b7e3619c8b10bed9db0d92a90ec09578b4
Signed-off-by: Arun Lal K M <arun.lal@intel.com>
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index e8590b6..d489d85 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -58,15 +58,17 @@
   public:
     method_callback(const std::string& name,
                     std::function<int(message_t&)>&& call,
-                    const char* arg_signature, const char* return_signature) :
+                    const char* arg_signature, const char* return_signature,
+                    decltype(vtable_t::flags) flags) :
         name_(name),
         call_(std::move(call)), arg_signature_(arg_signature),
-        return_signature_(return_signature)
+        return_signature_(return_signature), flags_(flags)
     {}
     std::string name_;
     std::function<int(message_t&)> call_;
     const char* arg_signature_;
     const char* return_signature_;
+    decltype(vtable_t::flags) flags_;
 };
 
 class signal
@@ -578,7 +580,8 @@
     }
 
     template <typename CallbackType>
-    bool register_method(const std::string& name, CallbackType&& handler)
+    bool register_method(const std::string& name, CallbackType&& handler,
+                         decltype(vtable_t::flags) flags = 0)
     {
         using ActualSignature = boost::callable_traits::args_t<CallbackType>;
         using CallbackSignature = utility::strip_first_n_args_t<
@@ -607,7 +610,7 @@
             func = callback_method_instance<CallbackType>(std::move(handler));
         }
         method_callbacks_.emplace_back(name, std::move(func), argType.data(),
-                                       resultType.data());
+                                       resultType.data(), flags);
 
         return true;
     }
@@ -755,11 +758,11 @@
         method_callbacks_.shrink_to_fit();
         for (auto& element : method_callbacks_)
         {
-            vtable_.emplace_back(
-                vtable::method_o(element.name_.c_str(), element.arg_signature_,
-                                 element.return_signature_, method_handler,
-                                 reinterpret_cast<size_t>(&element),
-                                 SD_BUS_VTABLE_ABSOLUTE_OFFSET));
+            vtable_.emplace_back(vtable::method_o(
+                element.name_.c_str(), element.arg_signature_,
+                element.return_signature_, method_handler,
+                reinterpret_cast<size_t>(&element),
+                element.flags_ | SD_BUS_VTABLE_ABSOLUTE_OFFSET));
         }
 
         signals_.shrink_to_fit();