+2003-05-13 James Willcox <jwillcox@gnome.org>
+
+ * configure.in:
+ * bus/activation.c: (bus_activation_service_created),
+ (bus_activation_activate_service):
+ * bus/driver.c: (bus_driver_send_service_deleted),
+ (bus_driver_send_service_created), (bus_driver_send_service_lost),
+ (bus_driver_send_service_acquired),
+ (bus_driver_send_welcome_message),
+ (bus_driver_handle_list_services):
+ * bus/session.conf.in:
+ * dbus/dbus-bus.c: (dbus_bus_acquire_service),
+ (dbus_bus_service_exists), (dbus_bus_activate_service):
+ * dbus/dbus-bus.h:
+
+ Add some convenience API which lets you activate a service, and did a
+ bunch of s/0/DBUS_TYPE_INVALID/ in calls to dbus_message_append_args()
+ and dbus_message_get_args()
+
2003-05-11 Havoc Pennington <hp@pobox.com>
* dbus/dbus-marshal.c (_dbus_marshal_validate_arg): fix to avoid
if (!dbus_message_append_args (message,
DBUS_TYPE_UINT32, DBUS_ACTIVATION_REPLY_ACTIVATED,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
BUS_SET_OOM (error);
if (!dbus_message_append_args (message,
DBUS_TYPE_UINT32, DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE,
- 0))
+ DBUS_TYPE_INVALID))
{
_dbus_verbose ("No memory to set args of reply to activate message\n");
BUS_SET_OOM (error);
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS) ||
!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
BUS_SET_OOM (error);
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
BUS_SET_OOM (error);
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
BUS_SET_OOM (error);
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
BUS_SET_OOM (error);
if (!dbus_message_append_args (welcome,
DBUS_TYPE_STRING, name,
- NULL))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (welcome);
BUS_SET_OOM (error);
if (!dbus_message_append_args (reply,
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, services, len,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_free_string_array (services);
dbus_message_unref (reply);
if (!dbus_message_get_args (message, error,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &flags,
- 0))
+ DBUS_TYPE_INVALID))
return FALSE;
_dbus_verbose ("Trying to own service %s with flags 0x%x\n", name, flags);
if (!dbus_message_get_args (message, error,
DBUS_TYPE_STRING, &name,
- 0))
+ DBUS_TYPE_INVALID))
return FALSE;
retval = FALSE;
if (!dbus_message_get_args (message, error,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &flags,
- 0))
+ DBUS_TYPE_INVALID))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_verbose ("No memory to get arguments to ActivateService\n");
<listen>unix:tmpdir=@DBUS_SESSION_SOCKET_DIR@</listen>
+ <servicedir>@EXPANDED_LIBDIR@/dbus-1.0/services</servicedir>
+
<policy context="default">
<!-- Allow everything -->
<allow send="*"/>
prefix=$old_prefix
AC_SUBST(EXPANDED_BINDIR)
+old_exec_prefix=${exec_prefix}
+test "x$exec_prefix" = xNONE && eval exec_prefix=${prefix}
+eval EXPANDED_LIBDIR=${libdir}
+exec_prefix=${old_exec_prefix}
+AC_SUBST(EXPANDED_LIBDIR)
+
#### Check our operating system
operating_system=unknown
if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
AC_SUBST(DBUS_SESSION_SOCKET_DIR)
+
AC_OUTPUT([
Doxyfile
dbus/dbus-arch-deps.h
fi
if test x$enable_checks = xno; then
echo "NOTE: building without checks for arguments passed to public API makes it harder to debug apps using D-BUS, but will slightly decrease D-BUS library size and _very_ slightly improve performance."
-fi
\ No newline at end of file
+fi
goto out;
else if (!dbus_message_get_args (reply, error,
DBUS_TYPE_STRING, &name,
- 0))
+ DBUS_TYPE_INVALID))
goto out;
bd->base_service = name;
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
DBUS_TYPE_UINT32, flags,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
_DBUS_SET_OOM (error);
if (!dbus_message_get_args (reply, error,
DBUS_TYPE_UINT32, &service_result,
- 0))
+ DBUS_TYPE_INVALID))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
dbus_message_unref (reply);
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
- 0))
+ DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
_DBUS_SET_OOM (error);
if (!dbus_message_get_args (reply, error,
DBUS_TYPE_UINT32, &exists,
- 0))
+ DBUS_TYPE_INVALID))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
return FALSE;
return (exists != FALSE);
}
+/**
+ * Activates a given service
+ *
+ * @param connection the connection
+ * @param service_name the service name
+ * @param flags the flags
+ * @param result a place to store the result of the activation, which will
+ * be one of DBUS_ACTIVATION_REPLY_ACTIVATED or
+ * DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE if successful. Pass NULL if you
+ * don't care about the result.
+ * @param error location to store any errors
+ * @returns #TRUE if the activation succeeded, #FALSE if not
+ *
+ * @todo document what the flags do
+ */
+dbus_bool_t
+dbus_bus_activate_service (DBusConnection *connection,
+ const char *service_name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *result,
+ DBusError *error)
+{
+ DBusMessage *msg;
+ DBusMessage *reply;
+
+ msg = dbus_message_new (DBUS_MESSAGE_ACTIVATE_SERVICE,
+ DBUS_SERVICE_DBUS);
+
+ if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, service_name,
+ DBUS_TYPE_UINT32, flags, DBUS_TYPE_INVALID))
+ {
+ dbus_message_unref (msg);
+ _DBUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ reply = dbus_connection_send_with_reply_and_block (connection, msg,
+ -1, error);
+ dbus_message_unref (msg);
+
+ if (reply == NULL)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ return FALSE;
+ }
+
+ if (dbus_set_error_from_message (error, reply))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ dbus_message_unref (reply);
+ return FALSE;
+ }
+
+ if (result != NULL &&
+ !dbus_message_get_args (reply, error, DBUS_TYPE_UINT32,
+ result, DBUS_TYPE_INVALID))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ dbus_message_unref (reply);
+ return FALSE;
+ }
+
+ dbus_message_unref (reply);
+ return TRUE;
+}
+
+
/** @} */
const char *service_name,
DBusError *error);
+dbus_bool_t dbus_bus_activate_service (DBusConnection *connection,
+ const char *service_name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *reply,
+ DBusError *error);
+
DBUS_END_DECLS;
#endif /* DBUS_BUS_H */
* followed by the value to add. Array values are specified by an int
* typecode followed by a pointer to the array followed by an int
* giving the length of the array. The argument list must be
- * terminated with DBUS_TYPE_INVALID.
+ * terminated with #DBUS_TYPE_INVALID.
*
* This function doesn't support dicts or non-fundamental arrays.
*
* Gets arguments from a message given a variable argument list.
* The variable argument list should contain the type of the
* argumen followed by a pointer to where the value should be
- * stored. The list is terminated with 0.
+ * stored. The list is terminated with #DBUS_TYPE_INVALID.
*
* @param message the message
* @param error error to be filled in on failure