dbus/dbus dbus-bus.c, 1.45, 1.46 dbus-bus.h, 1.15,
1.16 dbus-shared.h, 1.4, 1.5
Robert McQueen
robot101 at freedesktop.org
Tue Nov 15 09:19:21 PST 2005
Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv7289/dbus
Modified Files:
dbus-bus.c dbus-bus.h dbus-shared.h
Log Message:
2005-11-15 Robert McQueen <robot101 at debian.org>
* bus/driver.c, bus/services.c, bus/services.h: Add a ReleaseName
method to org.freedesktop.DBus to release a bus name or give up
waiting in the queue for it.
* dbus/dbus-bus.c, dbus/dbus-bus.h, dbus/dbus-shared.h: Add a
dbus_bus_release_name method to send the ReleaseName method calls.
Add constants for the return values to dbus/dbus-shared.h.
* doc/dbus-specification.xml: Document the new ReleaseName method
in the specification.
* python/dbus_bindings.pyx: Add a low-level python binding for the
release name method.
* python/exceptions.py, python/service.py: Make freeing BusName
objects release the name. Add a NameExistsException, and fix a
bug with creating UnknownMethodException.
* test/python/test-client.py: Add tests for freeing BusName
objects causing names to be released.
Index: dbus-bus.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- dbus-bus.c 26 Sep 2005 18:49:53 -0000 1.45
+++ dbus-bus.c 15 Nov 2005 17:19:19 -0000 1.46
@@ -777,6 +777,71 @@
return result;
}
+int
+dbus_bus_release_name (DBusConnection *connection,
+ const char *name,
+ DBusError *error)
+{
+ DBusMessage *message, *reply;
+ dbus_uint32_t result;
+
+ _dbus_return_val_if_fail (connection != NULL, 0);
+ _dbus_return_val_if_fail (name != NULL, 0);
+ _dbus_return_val_if_fail (_dbus_check_is_valid_bus_name (name), 0);
+ _dbus_return_val_if_error_is_set (error, 0);
+
+ message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS,
+ "ReleaseName");
+
+ if (message == NULL)
+ {
+ _DBUS_SET_OOM (error);
+ return -1;
+ }
+
+ if (!dbus_message_append_args (message,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+ {
+ dbus_message_unref (message);
+ _DBUS_SET_OOM (error);
+ return -1;
+ }
+
+ reply = dbus_connection_send_with_reply_and_block (connection, message, -1,
+ error);
+
+ dbus_message_unref (message);
+
+ if (reply == NULL)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ return -1;
+ }
+
+ if (dbus_set_error_from_message (error, reply))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ dbus_message_unref (reply);
+ return -1;
+ }
+
+ if (!dbus_message_get_args (reply, error,
+ DBUS_TYPE_UINT32, &result,
+ DBUS_TYPE_INVALID))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ dbus_message_unref (reply);
+ return -1;
+ }
+
+ dbus_message_unref (reply);
+
+ return result;
+}
+
/**
* Checks whether a certain name has an owner.
*
Index: dbus-bus.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dbus-bus.h 26 Sep 2005 18:49:53 -0000 1.15
+++ dbus-bus.h 15 Nov 2005 17:19:19 -0000 1.16
@@ -48,6 +48,9 @@
const char *name,
unsigned int flags,
DBusError *error);
+int dbus_bus_release_name (DBusConnection *connection,
+ const char *name,
+ DBusError *error);
dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
const char *name,
DBusError *error);
Index: dbus-shared.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-shared.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-shared.h 25 May 2005 16:03:53 -0000 1.4
+++ dbus-shared.h 15 Nov 2005 17:19:19 -0000 1.5
@@ -77,6 +77,11 @@
#define DBUS_REQUEST_NAME_REPLY_EXISTS 3
#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4
+/* Replies to releasing a name */
+#define DBUS_RELEASE_NAME_REPLY_RELEASED 1
+#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2
+#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3
+
/* Replies to service starts */
#define DBUS_START_REPLY_SUCCESS 1
#define DBUS_START_REPLY_ALREADY_RUNNING 2
More information about the dbus-commit
mailing list