2003-09-30 02:43:21 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu" -*- */
|
2004-06-20 15:28:15 +00:00
|
|
|
#include <dbus/dbus-glib.h>
|
2003-09-30 02:43:21 +00:00
|
|
|
#include <stdio.h>
|
2003-10-12 05:59:39 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2003-09-30 02:43:21 +00:00
|
|
|
|
2003-10-21 05:46:52 +00:00
|
|
|
static GMainLoop *loop = NULL;
|
|
|
|
|
static int n_times_foo_received = 0;
|
|
|
|
|
|
2004-04-13 22:29:50 +00:00
|
|
|
static gboolean
|
|
|
|
|
timed_exit (gpointer loop)
|
|
|
|
|
{
|
|
|
|
|
g_main_loop_quit (loop);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-21 05:46:52 +00:00
|
|
|
static void
|
|
|
|
|
foo_signal_handler (DBusGProxy *proxy,
|
|
|
|
|
void *user_data)
|
|
|
|
|
{
|
2004-06-20 15:28:15 +00:00
|
|
|
#if 0
|
2003-10-21 05:46:52 +00:00
|
|
|
double d;
|
2004-06-20 15:28:15 +00:00
|
|
|
|
|
|
|
|
/* FIXME - need to fix up dbus_gproxy_signal_connect() to be able to
|
|
|
|
|
* get signal args
|
|
|
|
|
*/
|
|
|
|
|
|
2003-10-21 05:46:52 +00:00
|
|
|
DBusError derror;
|
|
|
|
|
|
|
|
|
|
if (!dbus_message_is_signal (signal,
|
|
|
|
|
"org.freedesktop.TestSuite",
|
|
|
|
|
"Foo"))
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Signal handler received the wrong message\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&derror);
|
|
|
|
|
if (!dbus_message_get_args (signal, &derror, DBUS_TYPE_DOUBLE,
|
|
|
|
|
&d, DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("failed to get signal args: %s\n", derror.message);
|
|
|
|
|
dbus_error_free (&derror);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2004-06-20 15:28:15 +00:00
|
|
|
#endif
|
2003-10-21 05:46:52 +00:00
|
|
|
|
|
|
|
|
n_times_foo_received += 1;
|
|
|
|
|
|
|
|
|
|
g_main_loop_quit (loop);
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-30 02:43:21 +00:00
|
|
|
int
|
|
|
|
|
main (int argc, char **argv)
|
|
|
|
|
{
|
2004-06-20 15:28:15 +00:00
|
|
|
DBusGConnection *connection;
|
2003-10-12 05:59:39 +00:00
|
|
|
GError *error;
|
|
|
|
|
DBusGProxy *driver;
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBusGProxy *proxy;
|
2004-06-20 15:28:15 +00:00
|
|
|
DBusGPendingCall *call;
|
2003-10-12 05:59:39 +00:00
|
|
|
char **service_list;
|
|
|
|
|
int service_list_len;
|
|
|
|
|
int i;
|
2004-06-20 15:28:15 +00:00
|
|
|
guint32 result;
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
char *str;
|
|
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
g_type_init ();
|
|
|
|
|
|
2003-09-30 02:43:21 +00:00
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
error = NULL;
|
2004-06-20 15:28:15 +00:00
|
|
|
connection = dbus_g_bus_get (DBUS_BUS_SESSION,
|
|
|
|
|
&error);
|
2003-09-30 02:43:21 +00:00
|
|
|
if (connection == NULL)
|
|
|
|
|
{
|
2003-10-12 05:59:39 +00:00
|
|
|
g_printerr ("Failed to open connection to bus: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
exit (1);
|
2003-09-30 02:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
/* Create a proxy object for the "bus driver" */
|
|
|
|
|
|
2004-06-20 15:28:15 +00:00
|
|
|
driver = dbus_g_proxy_new_for_service (connection,
|
|
|
|
|
DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
|
|
|
|
|
DBUS_PATH_ORG_FREEDESKTOP_DBUS,
|
|
|
|
|
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS);
|
2003-10-12 05:59:39 +00:00
|
|
|
|
|
|
|
|
/* Call ListServices method */
|
|
|
|
|
|
2004-06-20 15:28:15 +00:00
|
|
|
call = dbus_g_proxy_begin_call (driver, "ListServices", DBUS_TYPE_INVALID);
|
2003-09-30 02:43:21 +00:00
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
error = NULL;
|
2004-06-20 15:28:15 +00:00
|
|
|
if (!dbus_g_proxy_end_call (driver, call, &error,
|
|
|
|
|
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
|
|
|
|
&service_list, &service_list_len,
|
|
|
|
|
DBUS_TYPE_INVALID))
|
2003-10-12 05:59:39 +00:00
|
|
|
{
|
|
|
|
|
g_printerr ("Failed to complete ListServices call: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2003-09-30 02:43:21 +00:00
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
g_print ("Services on the message bus:\n");
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < service_list_len)
|
2003-09-30 02:43:21 +00:00
|
|
|
{
|
2003-10-12 05:59:39 +00:00
|
|
|
g_assert (service_list[i] != NULL);
|
|
|
|
|
g_print (" %s\n", service_list[i]);
|
|
|
|
|
++i;
|
2003-09-30 02:43:21 +00:00
|
|
|
}
|
2003-10-12 05:59:39 +00:00
|
|
|
g_assert (service_list[i] == NULL);
|
2004-06-20 15:28:15 +00:00
|
|
|
|
|
|
|
|
g_strfreev (service_list);
|
2003-10-12 05:59:39 +00:00
|
|
|
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
/* Test handling of unknown method */
|
2004-06-20 15:28:15 +00:00
|
|
|
call = dbus_g_proxy_begin_call (driver, "ThisMethodDoesNotExist",
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_STRING,
|
|
|
|
|
"blah blah blah blah blah",
|
|
|
|
|
DBUS_TYPE_INT32,
|
|
|
|
|
10,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
error = NULL;
|
2004-06-20 15:28:15 +00:00
|
|
|
if (dbus_g_proxy_end_call (driver, call, &error,
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Calling nonexistent method succeeded!\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_print ("Got EXPECTED error from calling unknown method: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
|
|
|
|
|
/* Activate a service */
|
2004-06-20 15:28:15 +00:00
|
|
|
call = dbus_g_proxy_begin_call (driver, "ActivateService",
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_STRING,
|
|
|
|
|
"org.freedesktop.DBus.TestSuiteEchoService",
|
|
|
|
|
DBUS_TYPE_UINT32,
|
|
|
|
|
0,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
error = NULL;
|
2004-06-20 15:28:15 +00:00
|
|
|
if (!dbus_g_proxy_end_call (driver, call, &error,
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_UINT32, &result,
|
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Failed to complete Activate call: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_print ("Activation of echo service = 0x%x\n", result);
|
|
|
|
|
|
|
|
|
|
/* Activate a service again */
|
2004-06-20 15:28:15 +00:00
|
|
|
call = dbus_g_proxy_begin_call (driver, "ActivateService",
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_STRING,
|
|
|
|
|
"org.freedesktop.DBus.TestSuiteEchoService",
|
|
|
|
|
DBUS_TYPE_UINT32,
|
|
|
|
|
0,
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
error = NULL;
|
2004-06-20 15:28:15 +00:00
|
|
|
if (!dbus_g_proxy_end_call (driver, call, &error,
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_UINT32, &result,
|
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Failed to complete Activate call: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_print ("Duplicate activation of echo service = 0x%x\n", result);
|
|
|
|
|
|
|
|
|
|
/* Talk to the new service */
|
|
|
|
|
|
2004-06-20 15:28:15 +00:00
|
|
|
proxy = dbus_g_proxy_new_for_service_owner (connection,
|
|
|
|
|
"org.freedesktop.DBus.TestSuiteEchoService",
|
|
|
|
|
"/org/freedesktop/TestSuite",
|
|
|
|
|
"org.freedesktop.TestSuite",
|
|
|
|
|
&error);
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
|
2004-04-15 22:08:05 +00:00
|
|
|
if (proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Failed to create proxy for service owner: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-20 15:28:15 +00:00
|
|
|
call = dbus_g_proxy_begin_call (proxy, "Echo",
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_STRING,
|
|
|
|
|
"my string hello",
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
error = NULL;
|
2004-06-20 15:28:15 +00:00
|
|
|
if (!dbus_g_proxy_end_call (proxy, call, &error,
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
DBUS_TYPE_STRING, &str,
|
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Failed to complete Echo call: %s\n",
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_print ("String echoed = \"%s\"\n", str);
|
2004-06-20 15:28:15 +00:00
|
|
|
g_free (str);
|
2003-10-21 05:46:52 +00:00
|
|
|
|
|
|
|
|
/* Test oneway call and signal handling */
|
|
|
|
|
|
2004-06-20 15:28:15 +00:00
|
|
|
dbus_g_proxy_connect_signal (proxy, "Foo",
|
|
|
|
|
G_CALLBACK (foo_signal_handler),
|
|
|
|
|
NULL, NULL);
|
2003-10-21 05:46:52 +00:00
|
|
|
|
2004-06-20 15:28:15 +00:00
|
|
|
dbus_g_proxy_call_no_reply (proxy, "EmitFoo",
|
|
|
|
|
DBUS_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
dbus_g_connection_flush (connection);
|
2003-10-21 05:46:52 +00:00
|
|
|
|
2004-04-13 22:29:50 +00:00
|
|
|
g_timeout_add (5000, timed_exit, loop);
|
|
|
|
|
|
2003-10-21 05:46:52 +00:00
|
|
|
g_main_loop_run (loop);
|
|
|
|
|
|
|
|
|
|
if (n_times_foo_received != 1)
|
|
|
|
|
{
|
|
|
|
|
g_printerr ("Foo signal received %d times, should have been 1\n",
|
|
|
|
|
n_times_foo_received);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
g_object_unref (G_OBJECT (driver));
|
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-16 06:34:51 +00:00
|
|
|
g_object_unref (G_OBJECT (proxy));
|
2003-09-30 02:43:21 +00:00
|
|
|
|
2003-10-12 05:59:39 +00:00
|
|
|
g_print ("Successfully completed %s\n", argv[0]);
|
2003-09-30 02:43:21 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|