summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-06-15 16:20:28 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-06-15 16:20:28 +0000
commit6043a0be440c916d6e78463c7e850d9b172b8d6f (patch)
tree8ffe58e4939533b08108ddb3928d6bfe873362ed
parenta93f9c04acedc37277ef60dc7225464b8b62f0ee (diff)
* dbus/dbus-connection.c (_dbus_connection_peer_filter): New method
(_dbus_connection_run_builtin_filters): New method (dbus_connection_dispatch): Run the builtin filters which in turn runs the peer filter which handles Ping messages. * doc/TODO: - Ping isn't handled: This patch fixes it - Add a test case for the Ping message: added TODO item
-rw-r--r--ChangeLog12
-rw-r--r--dbus/dbus-connection.c53
-rw-r--r--doc/TODO7
3 files changed, 66 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 9875c600..324f7b5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2005-06-15 John (J5) Palmieri <johnp@redhat.com>
+ * dbus/dbus-connection.c (_dbus_connection_peer_filter): New method
+ (_dbus_connection_run_builtin_filters): New method
+ (dbus_connection_dispatch): Run the builtin filters which in turn
+ runs the peer filter which handles Ping messages.
+
+ * doc/TODO:
+ - Ping isn't handled: This patch fixes it
+
+ - Add a test case for the Ping message: added TODO item
+
+2005-06-15 John (J5) Palmieri <johnp@redhat.com>
+
* dbus/dbus-message.c:
(dbus_message_has_path): New method
(dbus_message_has_interface): New method
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index b2bc6a73..10a2d0f2 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -3362,6 +3362,53 @@ dbus_connection_get_dispatch_status (DBusConnection *connection)
}
/**
+* Filter funtion for handling the Peer standard interface
+**/
+static DBusHandlerResult
+_dbus_connection_peer_filter (DBusConnection *connection,
+ DBusMessage *message)
+{
+ if (dbus_message_is_method_call (message,
+ DBUS_INTERFACE_PEER,
+ "Ping"))
+ {
+ DBusMessage *ret;
+ dbus_bool_t sent;
+
+ ret = dbus_message_new_method_return (message);
+ if (ret == NULL)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ sent = dbus_connection_send (connection, ret, NULL);
+ dbus_message_unref (ret);
+
+ if (!sent)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+/**
+* Processes all builtin filter functions
+*
+* If the spec specifies a standard interface
+* they should be processed from this method
+**/
+static DBusHandlerResult
+_dbus_connection_run_builtin_filters (DBusConnection *connection,
+ DBusMessage *message)
+{
+ /* We just run one filter for now but have the option to run more
+ if the spec calls for it in the future */
+
+ return _dbus_connection_peer_filter (connection, message);
+}
+
+/**
* Processes data buffered while handling watches, queueing zero or
* more incoming messages. Then pops the first-received message from
* the current incoming message queue, runs any handlers for it, and
@@ -3469,7 +3516,11 @@ dbus_connection_dispatch (DBusConnection *connection)
result = DBUS_HANDLER_RESULT_HANDLED;
goto out;
}
-
+
+ result = _dbus_connection_run_builtin_filters (connection, message);
+ if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
+ goto out;
+
if (!_dbus_list_copy (&connection->filter_list, &filter_list_copy))
{
_dbus_connection_release_dispatch (connection);
diff --git a/doc/TODO b/doc/TODO
index 7eedcd4a..e88d78f2 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -18,16 +18,13 @@ Important for 1.0
- just before 1.0, try a HAVE_INT64=0 build and be sure it runs
- - in dbus-keyring.c, enforce that the keyring dir is not
- world readable/writable
-
- - Ping isn't handled
-
- dbus-pending-call.c has some API and thread safety issues to review
- Add test harness for selinux allow/deny cf. this message
http://lists.freedesktop.org/archives/dbus/2005-April/002506.html
+ - Add a test case for handling the Ping message
+
Important for 1.0 GLib Bindings
===