From 6043a0be440c916d6e78463c7e850d9b172b8d6f Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Wed, 15 Jun 2005 16:20:28 +0000 Subject: * 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 --- ChangeLog | 12 ++++++++++++ dbus/dbus-connection.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++- doc/TODO | 7 ++----- 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9875c600..324f7b5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-06-15 John (J5) Palmieri + + * 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 * dbus/dbus-message.c: 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 @@ -3361,6 +3361,53 @@ dbus_connection_get_dispatch_status (DBusConnection *connection) return status; } +/** +* 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 @@ -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 === -- cgit