diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2015-02-01 14:52:27 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2015-02-13 11:20:21 +0100 |
commit | a5e5f391a1e5c400049124ceb30d96ba6c089fbb (patch) | |
tree | 5de4175a5726c97ab2242a8baf91df4923ebc176 /bus/driver.c | |
parent | 53d39149463737523328483ae7de0787da43788c (diff) | |
download | dbus-a5e5f391a1e5c400049124ceb30d96ba6c089fbb.tar.gz |
Add org.freedesktop.DBus.Verbose interface to dbus-daemon when compiled with DBUS_ENABLE_VERBOSE_MODE.
This interface contains methods 'EnableVerbose' and 'DisableVerbose'
to control verbose mode on daemon runtime.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'bus/driver.c')
-rw-r--r-- | bus/driver.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/bus/driver.c b/bus/driver.c index e82602bc..603504f6 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -1770,6 +1770,72 @@ bus_driver_handle_reload_config (DBusConnection *connection, return FALSE; } +#ifdef DBUS_ENABLE_VERBOSE_MODE +static dbus_bool_t +bus_driver_handle_enable_verbose (DBusConnection *connection, + BusTransaction *transaction, + DBusMessage *message, + DBusError *error) +{ + DBusMessage *reply = NULL; + + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + reply = dbus_message_new_method_return (message); + if (reply == NULL) + goto oom; + + if (! bus_transaction_send_from_driver (transaction, connection, reply)) + goto oom; + + _dbus_set_verbose(TRUE); + + dbus_message_unref (reply); + return TRUE; + + oom: + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + BUS_SET_OOM (error); + + if (reply) + dbus_message_unref (reply); + return FALSE; +} + +static dbus_bool_t +bus_driver_handle_disable_verbose (DBusConnection *connection, + BusTransaction *transaction, + DBusMessage *message, + DBusError *error) +{ + DBusMessage *reply = NULL; + + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + reply = dbus_message_new_method_return (message); + if (reply == NULL) + goto oom; + + if (! bus_transaction_send_from_driver (transaction, connection, reply)) + goto oom; + + _dbus_set_verbose(FALSE); + + dbus_message_unref (reply); + return TRUE; + + oom: + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + BUS_SET_OOM (error); + + if (reply) + dbus_message_unref (reply); + return FALSE; +} +#endif + static dbus_bool_t bus_driver_handle_get_id (DBusConnection *connection, BusTransaction *transaction, @@ -2042,6 +2108,14 @@ static const MessageHandler monitoring_message_handlers[] = { { NULL, NULL, NULL, NULL } }; +#ifdef DBUS_ENABLE_VERBOSE_MODE +static const MessageHandler verbose_message_handlers[] = { + { "EnableVerbose", "", "", bus_driver_handle_enable_verbose}, + { "DisableVerbose", "", "", bus_driver_handle_disable_verbose}, + { NULL, NULL, NULL, NULL } +}; +#endif + #ifdef DBUS_ENABLE_STATS static const MessageHandler stats_message_handlers[] = { { "GetStats", "", "a{sv}", bus_stats_handle_get_stats }, @@ -2074,6 +2148,9 @@ static InterfaceHandler interface_handlers[] = { " </signal>\n" }, { DBUS_INTERFACE_INTROSPECTABLE, introspectable_message_handlers, NULL }, { DBUS_INTERFACE_MONITORING, monitoring_message_handlers, NULL }, +#ifdef DBUS_ENABLE_VERBOSE_MODE + { DBUS_INTERFACE_VERBOSE, verbose_message_handlers, NULL }, +#endif #ifdef DBUS_ENABLE_STATS { BUS_INTERFACE_STATS, stats_message_handlers, NULL }, #endif |