summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2021-05-05 14:40:41 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2021-05-14 16:29:31 +0200
commit3f4d8751bd55394a10425866a69199295ddd6d07 (patch)
treea02c84aac10597c93598f017307c86d30aa6cc0e
parent20a70a03d80e151d251121c3c7daf05fcb6fe32b (diff)
downloaddbus-3f4d8751bd55394a10425866a69199295ddd6d07.tar.gz
dbus-3f4d8751bd55394a10425866a69199295ddd6d07.tar.bz2
dbus-3f4d8751bd55394a10425866a69199295ddd6d07.zip
bus: add ConnectionOverflow signal API
Change-Id: Iea17de732637ea990944cb63d1ef7a1a4bc4b1b8
-rw-r--r--bus/driver.c61
-rw-r--r--bus/driver.h4
-rw-r--r--dbus/dbus-shared.h4
3 files changed, 69 insertions, 0 deletions
diff --git a/bus/driver.c b/bus/driver.c
index ba227a4b..1d05eab3 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 183c28b9..aa27ea94 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 1ef1e570..5d0efb04 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).