match: add optional context parameter
Change-Id: I5992ea1dffd2a9faf8fed45aea3d0b12c36add8d
diff --git a/sdbusplus/server/match.hpp b/sdbusplus/server/match.hpp
index e7902f6..05907bd 100644
--- a/sdbusplus/server/match.hpp
+++ b/sdbusplus/server/match.hpp
@@ -34,12 +34,14 @@
* @param[in] bus - The bus to register on.
* @param[in] match - The match to register.
* @param[in] handler - The callback for matches.
+ * @param[in] context - An optional context to pass to the handler.
*/
match(sdbusplus::bus::bus& bus, const char* match,
- sd_bus_message_handler_t handler) : _slot(nullptr)
+ sd_bus_message_handler_t handler, void* context = nullptr)
+ : _slot(nullptr)
{
sd_bus_slot* slot = nullptr;
- sd_bus_add_match(bus.get(), &slot, match, handler, nullptr);
+ sd_bus_add_match(bus.get(), &slot, match, handler, context);
_slot = decltype(_slot){slot};
}