From: Adrian Szyndela Date: Wed, 5 May 2021 12:40:41 +0000 (+0200) Subject: bus: add ConnectionOverflow signal API X-Git-Tag: accepted/tizen/unified/20210531.130419~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fdbus.git;a=commitdiff_plain;h=3f4d8751bd55394a10425866a69199295ddd6d07 bus: add ConnectionOverflow signal API Change-Id: Iea17de732637ea990944cb63d1ef7a1a4bc4b1b8 --- diff --git a/bus/driver.c b/bus/driver.c index ba227a4..1d05eab 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -210,6 +210,67 @@ static dbus_bool_t bus_driver_send_welcome_message (DBusConnection *connection, DBusError *error); dbus_bool_t +bus_driver_send_connection_overflow (DBusConnection *connection, + BusTransaction *transaction, + DBusError *error) +{ + DBusMessage *message; + dbus_bool_t retval; + const char *name; + + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + message = dbus_message_new_signal (DBUS_PATH_DBUS, + DBUS_INTERFACE_TIZEN, + DBUS_TIZEN_CONNECTION_OVERFLOW_SIGNAL); + + if (message == NULL) + { + BUS_SET_OOM (error); + return FALSE; + } + + if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS)) + goto oom; + + name = bus_connection_get_name (connection); + + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, &name, + DBUS_TYPE_INVALID)) + goto oom; + + _dbus_assert (dbus_message_has_signature (message, "s")); + + if (!bus_transaction_capture (transaction, NULL, NULL, message)) + goto oom; + + switch (bus_dispatch_matches (transaction, NULL, NULL, message, NULL, error)) + { + case BUS_RESULT_TRUE: + retval = TRUE; + break; + case BUS_RESULT_FALSE: + retval = FALSE; + break; + case BUS_RESULT_LATER: + default: + /* should never happen */ + _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly"); + retval = FALSE; + break; + } + dbus_message_unref (message); + + return retval; + + oom: + dbus_message_unref (message); + BUS_SET_OOM (error); + return FALSE; +} + +dbus_bool_t bus_driver_send_service_owner_changed (const char *service_name, const char *old_owner, const char *new_owner, diff --git a/bus/driver.h b/bus/driver.h index 183c28b..aa27ea9 100644 --- a/bus/driver.h +++ b/bus/driver.h @@ -67,4 +67,8 @@ dbus_bool_t bus_driver_send_ack_reply (DBusConnection *connection, DBusMessage *message, DBusError *error); +dbus_bool_t bus_driver_send_connection_overflow (DBusConnection *connection, + BusTransaction *transaction, + DBusError *error); + #endif /* BUS_DRIVER_H */ diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h index 1ef1e57..5d0efb0 100644 --- a/dbus/dbus-shared.h +++ b/dbus/dbus-shared.h @@ -99,6 +99,10 @@ typedef enum /** The interface supported by most dbus peers */ #define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer" +/** The interface for Tizen extensions */ +#define DBUS_INTERFACE_TIZEN "org.tizen.DBus" +#define DBUS_TIZEN_CONNECTION_OVERFLOW_SIGNAL "ConnectionOverflow" + /** This is a special interface whose methods can only be invoked * by the local implementation (messages from remote apps aren't * allowed to specify this interface).