summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-01-18 20:42:15 +0000
committerHavoc Pennington <hp@redhat.com>2005-01-18 20:42:15 +0000
commit8873c90f99303f9cc308f15f8d03e637911f5b9e (patch)
tree03e459881912388cc6c3759d91fb0cf75739a5a7 /dbus
parent4fce285052c143296cd9e08a48de0175b5207853 (diff)
2005-01-18 Havoc Pennington <hp@redhat.com>
* Throughout, grand renaming to strip out the use of "service", just say "name" instead (or "bus name" when ambiguous). Did not change the internal code of the message bus itself, only the programmer-facing API and messages. * doc/dbus-specification.xml: further update the message bus section * bus/config-parser.c (all_are_equiv): fix bug using freed string in error case
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-bus.c153
-rw-r--r--dbus/dbus-bus.h26
-rw-r--r--dbus/dbus-glib.h16
-rw-r--r--dbus/dbus-marshal-header.c6
-rw-r--r--dbus/dbus-marshal-validate.c88
-rw-r--r--dbus/dbus-marshal-validate.h4
-rw-r--r--dbus/dbus-message.c107
-rw-r--r--dbus/dbus-message.h12
-rw-r--r--dbus/dbus-protocol.h39
-rw-r--r--dbus/dbus-shared.h2
10 files changed, 224 insertions, 229 deletions
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index bc1750b6..68b69719 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -61,7 +61,7 @@
typedef struct
{
DBusConnection *connection; /**< Connection we're associated with */
- char *base_service; /**< Base service name of this connection */
+ char *unique_name; /**< Unique name of this connection */
unsigned int is_well_known : 1; /**< Is one of the well-known connections in our global array */
} BusData;
@@ -76,7 +76,7 @@ static dbus_int32_t bus_data_slot = -1;
static DBusConnection *bus_connections[N_BUS_TYPES];
static char *bus_connection_addresses[N_BUS_TYPES] = { NULL, NULL, NULL };
-static DBusBusType activation_bus_type = DBUS_BUS_ACTIVATION;
+static DBusBusType activation_bus_type = DBUS_BUS_STARTER;
static dbus_bool_t initialized = FALSE;
@@ -101,7 +101,7 @@ addresses_shutdown_func (void *data)
++i;
}
- activation_bus_type = DBUS_BUS_ACTIVATION;
+ activation_bus_type = DBUS_BUS_STARTER;
}
static dbus_bool_t
@@ -180,22 +180,22 @@ init_connections_unlocked (void)
bus_connection_addresses[DBUS_BUS_SESSION] : "none set");
}
- if (bus_connection_addresses[DBUS_BUS_ACTIVATION] == NULL)
+ if (bus_connection_addresses[DBUS_BUS_STARTER] == NULL)
{
_dbus_verbose ("Filling in activation bus address...\n");
- if (!get_from_env (&bus_connection_addresses[DBUS_BUS_ACTIVATION],
- "DBUS_ACTIVATION_ADDRESS"))
+ if (!get_from_env (&bus_connection_addresses[DBUS_BUS_STARTER],
+ "DBUS_STARTER_ADDRESS"))
return FALSE;
- _dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_ACTIVATION] ?
- bus_connection_addresses[DBUS_BUS_ACTIVATION] : "none set");
+ _dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_STARTER] ?
+ bus_connection_addresses[DBUS_BUS_STARTER] : "none set");
}
- if (bus_connection_addresses[DBUS_BUS_ACTIVATION] != NULL)
+ if (bus_connection_addresses[DBUS_BUS_STARTER] != NULL)
{
- s = _dbus_getenv ("DBUS_ACTIVATION_BUS_TYPE");
+ s = _dbus_getenv ("DBUS_STARTER_BUS_TYPE");
if (s != NULL)
{
@@ -212,9 +212,9 @@ init_connections_unlocked (void)
/* Default to the session bus instead if available */
if (bus_connection_addresses[DBUS_BUS_SESSION] != NULL)
{
- bus_connection_addresses[DBUS_BUS_ACTIVATION] =
+ bus_connection_addresses[DBUS_BUS_STARTER] =
_dbus_strdup (bus_connection_addresses[DBUS_BUS_SESSION]);
- if (bus_connection_addresses[DBUS_BUS_ACTIVATION] == NULL)
+ if (bus_connection_addresses[DBUS_BUS_STARTER] == NULL)
return FALSE;
}
}
@@ -260,7 +260,7 @@ bus_data_free (void *data)
_DBUS_UNLOCK (bus);
}
- dbus_free (bd->base_service);
+ dbus_free (bd->unique_name);
dbus_free (bd);
dbus_connection_free_data_slot (&bus_data_slot);
@@ -352,9 +352,9 @@ dbus_bus_get (DBusBusType type,
/* Use the real type of the activation bus for getting its
* connection, but only if the real type's address is available. (If
* the activating bus isn't a well-known bus then
- * activation_bus_type == DBUS_BUS_ACTIVATION)
+ * activation_bus_type == DBUS_BUS_STARTER)
*/
- if (type == DBUS_BUS_ACTIVATION &&
+ if (type == DBUS_BUS_STARTER &&
bus_connection_addresses[activation_bus_type] != NULL)
type = activation_bus_type;
@@ -415,11 +415,8 @@ dbus_bus_get (DBusBusType type,
/**
* Registers a connection with the bus. This must be the first
* thing an application does when connecting to the message bus.
- * If registration succeeds, the base service name will be set,
- * and can be obtained using dbus_bus_get_base_service().
- *
- * @todo if we get an error reply, it has to be converted into
- * DBusError and returned
+ * If registration succeeds, the unique name will be set,
+ * and can be obtained using dbus_bus_get_unique_name().
*
* @param connection the connection
* @param error place to store errors
@@ -446,7 +443,7 @@ dbus_bus_register (DBusConnection *connection,
return FALSE;
}
- if (bd->base_service != NULL)
+ if (bd->unique_name != NULL)
{
_dbus_warn ("Attempt to register the same DBusConnection with the message bus, but it is already registered\n");
/* This isn't an error, it's a programming bug. We'll be nice
@@ -479,8 +476,8 @@ dbus_bus_register (DBusConnection *connection,
DBUS_TYPE_INVALID))
goto out;
- bd->base_service = _dbus_strdup (name);
- if (bd->base_service == NULL)
+ bd->unique_name = _dbus_strdup (name);
+ if (bd->unique_name == NULL)
{
_DBUS_SET_OOM (error);
goto out;
@@ -500,45 +497,42 @@ dbus_bus_register (DBusConnection *connection,
/**
- * Sets the base service name of the connection.
- * Can only be used if you registered with the
- * bus manually (i.e. if you did not call
- * dbus_bus_register()). Can only be called
- * once per connection.
+ * Sets the unique name of the connection. Can only be used if you
+ * registered with the bus manually (i.e. if you did not call
+ * dbus_bus_register()). Can only be called once per connection.
*
* @param connection the connection
- * @param base_service the base service name
+ * @param unique_name the unique name
* @returns #FALSE if not enough memory
*/
dbus_bool_t
-dbus_bus_set_base_service (DBusConnection *connection,
- const char *base_service)
+dbus_bus_set_unique_name (DBusConnection *connection,
+ const char *unique_name)
{
BusData *bd;
_dbus_return_val_if_fail (connection != NULL, FALSE);
- _dbus_return_val_if_fail (base_service != NULL, FALSE);
+ _dbus_return_val_if_fail (unique_name != NULL, FALSE);
bd = ensure_bus_data (connection);
if (bd == NULL)
return FALSE;
- _dbus_assert (bd->base_service == NULL);
+ _dbus_assert (bd->unique_name == NULL);
- bd->base_service = _dbus_strdup (base_service);
- return bd->base_service != NULL;
+ bd->unique_name = _dbus_strdup (unique_name);
+ return bd->unique_name != NULL;
}
/**
- * Gets the base service name of the connection.
- * Only possible after the connection has been registered
- * with the message bus.
+ * Gets the unique name of the connection. Only possible after the
+ * connection has been registered with the message bus.
*
* @param connection the connection
- * @returns the base service name
+ * @returns the unique name
*/
const char*
-dbus_bus_get_base_service (DBusConnection *connection)
+dbus_bus_get_unique_name (DBusConnection *connection)
{
BusData *bd;
@@ -548,27 +542,28 @@ dbus_bus_get_base_service (DBusConnection *connection)
if (bd == NULL)
return NULL;
- return bd->base_service;
+ return bd->unique_name;
}
/**
- * Asks the bus to return the uid of a service.
+ * Asks the bus to return the uid of the named
+ * connection.
*
* @param connection the connection
- * @param service the service name
+ * @param name a name owned by the connection
* @param error location to store the error
* @returns a result code, -1 if error is set
*/
unsigned long
dbus_bus_get_unix_user (DBusConnection *connection,
- const char *service,
+ const char *name,
DBusError *error)
{
DBusMessage *message, *reply;
dbus_uint32_t uid;
_dbus_return_val_if_fail (connection != NULL, DBUS_UID_UNSET);
- _dbus_return_val_if_fail (service != NULL, DBUS_UID_UNSET);
+ _dbus_return_val_if_fail (name != NULL, DBUS_UID_UNSET);
_dbus_return_val_if_error_is_set (error, DBUS_UID_UNSET);
message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
@@ -583,7 +578,7 @@ dbus_bus_get_unix_user (DBusConnection *connection,
}
if (!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &service,
+ DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
@@ -625,7 +620,7 @@ dbus_bus_get_unix_user (DBusConnection *connection,
/**
- * Asks the bus to try to acquire a certain service.
+ * Asks the bus to assign the given name to this connection.
*
* @todo these docs are not complete, need to document the
* return value and flags
@@ -634,28 +629,28 @@ dbus_bus_get_unix_user (DBusConnection *connection,
* DBusError and returned
*
* @param connection the connection
- * @param service_name the service name
+ * @param name the name to request
* @param flags flags
* @param error location to store the error
* @returns a result code, -1 if error is set
*/
int
-dbus_bus_acquire_service (DBusConnection *connection,
- const char *service_name,
- unsigned int flags,
- DBusError *error)
+dbus_bus_request_name (DBusConnection *connection,
+ const char *name,
+ unsigned int flags,
+ DBusError *error)
{
DBusMessage *message, *reply;
- dbus_uint32_t service_result;
+ dbus_uint32_t result;
_dbus_return_val_if_fail (connection != NULL, 0);
- _dbus_return_val_if_fail (service_name != NULL, 0);
+ _dbus_return_val_if_fail (name != NULL, 0);
_dbus_return_val_if_error_is_set (error, 0);
message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
DBUS_PATH_ORG_FREEDESKTOP_DBUS,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
- "AcquireService");
+ "RequestName");
if (message == NULL)
{
@@ -664,7 +659,7 @@ dbus_bus_acquire_service (DBusConnection *connection,
}
if (!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &service_name,
+ DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &flags,
DBUS_TYPE_INVALID))
{
@@ -692,7 +687,7 @@ dbus_bus_acquire_service (DBusConnection *connection,
}
if (!dbus_message_get_args (reply, error,
- DBUS_TYPE_UINT32, &service_result,
+ DBUS_TYPE_UINT32, &result,
DBUS_TYPE_INVALID))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
@@ -702,33 +697,33 @@ dbus_bus_acquire_service (DBusConnection *connection,
dbus_message_unref (reply);
- return service_result;
+ return result;
}
/**
- * Checks whether a certain service exists.
+ * Checks whether a certain name has an owner.
*
* @param connection the connection
- * @param service_name the service name
+ * @param name the name
* @param error location to store any errors
- * @returns #TRUE if the service exists, #FALSE if not or on error
+ * @returns #TRUE if the name exists, #FALSE if not or on error
*/
dbus_bool_t
-dbus_bus_service_exists (DBusConnection *connection,
- const char *service_name,
+dbus_bus_name_has_owner (DBusConnection *connection,
+ const char *name,
DBusError *error)
{
DBusMessage *message, *reply;
dbus_bool_t exists;
_dbus_return_val_if_fail (connection != NULL, FALSE);
- _dbus_return_val_if_fail (service_name != NULL, FALSE);
+ _dbus_return_val_if_fail (name != NULL, FALSE);
_dbus_return_val_if_error_is_set (error, FALSE);
message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
DBUS_PATH_ORG_FREEDESKTOP_DBUS,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
- "ServiceExists");
+ "NameHasOwner");
if (message == NULL)
{
_DBUS_SET_OOM (error);
@@ -736,7 +731,7 @@ dbus_bus_service_exists (DBusConnection *connection,
}
if (!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &service_name,
+ DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
@@ -767,26 +762,26 @@ dbus_bus_service_exists (DBusConnection *connection,
}
/**
- * Activates a given service
+ * Starts a service that will request ownership of the given name.
+ * The returned result will be one of be one of
+ * #DBUS_START_REPLY_SUCCESS or #DBUS_START_REPLY_ALREADY_RUNNING if
+ * successful. Pass #NULL if you don't care about the result.
*
* @param connection the connection
- * @param service_name the service name
+ * @param name the name we want the new service to request
* @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 result a place to store the result or #NULL
* @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)
+dbus_bus_start_service_by_name (DBusConnection *connection,
+ const char *name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *result,
+ DBusError *error)
{
DBusMessage *msg;
DBusMessage *reply;
@@ -794,9 +789,9 @@ dbus_bus_activate_service (DBusConnection *connection,
msg = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
DBUS_PATH_ORG_FREEDESKTOP_DBUS,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
- "ActivateService");
+ "StartServiceByName");
- if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, &service_name,
+ if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &flags, DBUS_TYPE_INVALID))
{
dbus_message_unref (msg);
diff --git a/dbus/dbus-bus.h b/dbus/dbus-bus.h
index a17d724f..7843c7ed 100644
--- a/dbus/dbus-bus.h
+++ b/dbus/dbus-bus.h
@@ -35,25 +35,25 @@ DBusConnection *dbus_bus_get (DBusBusType type,
DBusError *error);
dbus_bool_t dbus_bus_register (DBusConnection *connection,
DBusError *error);
-dbus_bool_t dbus_bus_set_base_service (DBusConnection *connection,
- const char *base_service);
-const char* dbus_bus_get_base_service (DBusConnection *connection);
+dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection,
+ const char *unique_name);
+const char* dbus_bus_get_unique_name (DBusConnection *connection);
unsigned long dbus_bus_get_unix_user (DBusConnection *connection,
- const char *service,
+ const char *name,
DBusError *error);
-int dbus_bus_acquire_service (DBusConnection *connection,
- const char *service_name,
+int dbus_bus_request_name (DBusConnection *connection,
+ const char *name,
unsigned int flags,
DBusError *error);
-dbus_bool_t dbus_bus_service_exists (DBusConnection *connection,
- const char *service_name,
+dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
+ const char *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_bool_t dbus_bus_start_service_by_name (DBusConnection *connection,
+ const char *name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *reply,
+ DBusError *error);
void dbus_bus_add_match (DBusConnection *connection,
const char *rule,
diff --git a/dbus/dbus-glib.h b/dbus/dbus-glib.h
index 7cf99f06..de53d14a 100644
--- a/dbus/dbus-glib.h
+++ b/dbus/dbus-glib.h
@@ -111,14 +111,14 @@ typedef struct DBusGProxyClass DBusGProxyClass;
GType dbus_g_proxy_get_type (void) G_GNUC_CONST;
-DBusGProxy* dbus_g_proxy_new_for_service (DBusGConnection *connection,
- const char *service_name,
- const char *path_name,
- const char *interface_name);
-DBusGProxy* dbus_g_proxy_new_for_service_owner (DBusGConnection *connection,
- const char *service_name,
- const char *path_name,
- const char *interface_name,
+DBusGProxy* dbus_g_proxy_new_for_name (DBusGConnection *connection,
+ const char *name,
+ const char *path,
+ const char *interface);
+DBusGProxy* dbus_g_proxy_new_for_name_owner (DBusGConnection *connection,
+ const char *name,
+ const char *path,
+ const char *interface,
GError **error);
DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection,
const char *path_name,
diff --git a/dbus/dbus-marshal-header.c b/dbus/dbus-marshal-header.c
index 8c5120cf..8346c3af 100644
--- a/dbus/dbus-marshal-header.c
+++ b/dbus/dbus-marshal-header.c
@@ -505,7 +505,7 @@ _dbus_header_copy (const DBusHeader *header,
*
* @param header the header
* @param message_type the message type
- * @param destination service field or #NULL
+ * @param destination destination field or #NULL
* @param path path field or #NULL
* @param interface interface field or #NULL
* @param member member field or #NULL
@@ -833,7 +833,7 @@ load_and_validate_field (DBusHeader *header,
switch (field)
{
case DBUS_HEADER_FIELD_DESTINATION:
- string_validation_func = _dbus_validate_service;
+ string_validation_func = _dbus_validate_bus_name;
bad_string_code = DBUS_INVALID_BAD_DESTINATION;
break;
case DBUS_HEADER_FIELD_INTERFACE:
@@ -861,7 +861,7 @@ load_and_validate_field (DBusHeader *header,
break;
case DBUS_HEADER_FIELD_SENDER:
- string_validation_func = _dbus_validate_service;
+ string_validation_func = _dbus_validate_bus_name;
bad_string_code = DBUS_INVALID_BAD_SENDER;
break;
diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c
index ced5e1ea..ad61847e 100644
--- a/dbus/dbus-marshal-validate.c
+++ b/dbus/dbus-marshal-validate.c
@@ -729,13 +729,13 @@ _dbus_validate_error_name (const DBusString *str,
/* This assumes the first char exists and is ':' */
static dbus_bool_t
-_dbus_validate_base_service (const DBusString *str,
- int start,
- int len)
+_dbus_validate_unique_name (const DBusString *str,
+ int start,
+ int len)
{
const unsigned char *s;
const unsigned char *end;
- const unsigned char *service;
+ const unsigned char *name;
_dbus_assert (start >= 0);
_dbus_assert (len >= 0);
@@ -749,10 +749,10 @@ _dbus_validate_base_service (const DBusString *str,
_dbus_assert (len > 0);
- service = _dbus_string_get_const_data (str) + start;
- end = service + len;
- _dbus_assert (*service == ':');
- s = service + 1;
+ name = _dbus_string_get_const_data (str) + start;
+ end = name + len;
+ _dbus_assert (*name == ':');
+ s = name + 1;
while (s != end)
{
@@ -776,9 +776,9 @@ _dbus_validate_base_service (const DBusString *str,
}
/**
- * Checks that the given range of the string is a valid service name
- * in the D-BUS protocol. This includes a length restriction, etc.,
- * see the specification.
+ * Checks that the given range of the string is a valid bus name in
+ * the D-BUS protocol. This includes a length restriction, etc., see
+ * the specification.
*
* @todo this is inconsistent with most of DBusString in that
* it allows a start,len range that extends past the string end.
@@ -789,14 +789,14 @@ _dbus_validate_base_service (const DBusString *str,
* @returns #TRUE if the byte range exists and is a valid name
*/
dbus_bool_t
-_dbus_validate_service (const DBusString *str,
- int start,
- int len)
+_dbus_validate_bus_name (const DBusString *str,
+ int start,
+ int len)
{
if (_DBUS_UNLIKELY (len == 0))
return FALSE;
if (_dbus_string_get_byte (str, start) == ':')
- return _dbus_validate_base_service (str, start, len);
+ return _dbus_validate_unique_name (str, start, len);
else
return _dbus_validate_interface (str, start, len);
}
@@ -836,8 +836,8 @@ DEFINE_DBUS_NAME_CHECK(interface);
DEFINE_DBUS_NAME_CHECK(member);
/** define _dbus_check_is_valid_error_name() */
DEFINE_DBUS_NAME_CHECK(error_name);
-/** define _dbus_check_is_valid_service() */
-DEFINE_DBUS_NAME_CHECK(service);
+/** define _dbus_check_is_valid_bus_name() */
+DEFINE_DBUS_NAME_CHECK(bus_name);
/** define _dbus_check_is_valid_signature() */
DEFINE_DBUS_NAME_CHECK(signature);
@@ -974,7 +974,7 @@ _dbus_marshal_validate_test (void)
"foo bar"
};
- const char *valid_base_services[] = {
+ const char *valid_unique_names[] = {
":0",
":a",
":",
@@ -985,7 +985,7 @@ _dbus_marshal_validate_test (void)
":.blah",
":abce.freedesktop.blah"
};
- const char *invalid_base_services[] = {
+ const char *invalid_unique_names[] = {
":-",
":!",
":0-10",
@@ -1104,7 +1104,7 @@ _dbus_marshal_validate_test (void)
++i;
}
- /* Service validation (check that valid interfaces are valid services,
+ /* Bus name validation (check that valid interfaces are valid bus names,
* and invalid interfaces are invalid services except if they start with ':')
*/
i = 0;
@@ -1112,11 +1112,11 @@ _dbus_marshal_validate_test (void)
{
_dbus_string_init_const (&str, valid_interfaces[i]);
- if (!_dbus_validate_service (&str, 0,
+ if (!_dbus_validate_bus_name (&str, 0,
_dbus_string_get_length (&str)))
{
- _dbus_warn ("Service \"%s\" should have been valid\n", valid_interfaces[i]);
- _dbus_assert_not_reached ("invalid service");
+ _dbus_warn ("Bus name \"%s\" should have been valid\n", valid_interfaces[i]);
+ _dbus_assert_not_reached ("invalid bus name");
}
++i;
@@ -1129,43 +1129,43 @@ _dbus_marshal_validate_test (void)
{
_dbus_string_init_const (&str, invalid_interfaces[i]);
- if (_dbus_validate_service (&str, 0,
- _dbus_string_get_length (&str)))
+ if (_dbus_validate_bus_name (&str, 0,
+ _dbus_string_get_length (&str)))
{
- _dbus_warn ("Service \"%s\" should have been invalid\n", invalid_interfaces[i]);
- _dbus_assert_not_reached ("valid service");
+ _dbus_warn ("Bus name \"%s\" should have been invalid\n", invalid_interfaces[i]);
+ _dbus_assert_not_reached ("valid bus name");
}
}
++i;
}
- /* Base service validation */
+ /* unique name validation */
i = 0;
- while (i < (int) _DBUS_N_ELEMENTS (valid_base_services))
+ while (i < (int) _DBUS_N_ELEMENTS (valid_unique_names))
{
- _dbus_string_init_const (&str, valid_base_services[i]);
+ _dbus_string_init_const (&str, valid_unique_names[i]);
- if (!_dbus_validate_service (&str, 0,
- _dbus_string_get_length (&str)))
+ if (!_dbus_validate_bus_name (&str, 0,
+ _dbus_string_get_length (&str)))
{
- _dbus_warn ("Service \"%s\" should have been valid\n", valid_base_services[i]);
- _dbus_assert_not_reached ("invalid base service");
+ _dbus_warn ("Bus name \"%s\" should have been valid\n", valid_unique_names[i]);
+ _dbus_assert_not_reached ("invalid unique name");
}
++i;
}
i = 0;
- while (i < (int) _DBUS_N_ELEMENTS (invalid_base_services))
+ while (i < (int) _DBUS_N_ELEMENTS (invalid_unique_names))
{
- _dbus_string_init_const (&str, invalid_base_services[i]);
+ _dbus_string_init_const (&str, invalid_unique_names[i]);
- if (_dbus_validate_service (&str, 0,
- _dbus_string_get_length (&str)))
+ if (_dbus_validate_bus_name (&str, 0,
+ _dbus_string_get_length (&str)))
{
- _dbus_warn ("Service \"%s\" should have been invalid\n", invalid_base_services[i]);
- _dbus_assert_not_reached ("valid base service");
+ _dbus_warn ("Bus name \"%s\" should have been invalid\n", invalid_unique_names[i]);
+ _dbus_assert_not_reached ("valid unique name");
}
++i;
@@ -1271,7 +1271,7 @@ _dbus_marshal_validate_test (void)
/* Validate claimed length longer than real length */
_dbus_string_init_const (&str, "abc.efg");
- if (_dbus_validate_service (&str, 0, 8))
+ if (_dbus_validate_bus_name (&str, 0, 8))
_dbus_assert_not_reached ("validated too-long string");
if (_dbus_validate_interface (&str, 0, 8))
_dbus_assert_not_reached ("validated too-long string");
@@ -1294,7 +1294,7 @@ _dbus_marshal_validate_test (void)
if (!_dbus_string_append (&str, "abc.def"))
_dbus_assert_not_reached ("no memory");
- if (_dbus_validate_service (&str, 0, _dbus_string_get_length (&str)))
+ if (_dbus_validate_bus_name (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
if (_dbus_validate_interface (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
@@ -1310,14 +1310,14 @@ _dbus_marshal_validate_test (void)
if (_dbus_validate_member (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
- /* overlong base service */
+ /* overlong unique name */
_dbus_string_set_length (&str, 0);
_dbus_string_append (&str, ":");
while (_dbus_string_get_length (&str) <= DBUS_MAXIMUM_NAME_LENGTH)
if (!_dbus_string_append (&str, "abc"))
_dbus_assert_not_reached ("no memory");
- if (_dbus_validate_service (&str, 0, _dbus_string_get_length (&str)))
+ if (_dbus_validate_bus_name (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
_dbus_string_free (&str);
diff --git a/dbus/dbus-marshal-validate.h b/dbus/dbus-marshal-validate.h
index a4950dbe..6b37338b 100644
--- a/dbus/dbus-marshal-validate.h
+++ b/dbus/dbus-marshal-validate.h
@@ -115,7 +115,7 @@ dbus_bool_t _dbus_validate_member (const DBusString *str,
dbus_bool_t _dbus_validate_error_name (const DBusString *str,
int start,
int len);
-dbus_bool_t _dbus_validate_service (const DBusString *str,
+dbus_bool_t _dbus_validate_bus_name (const DBusString *str,
int start,
int len);
dbus_bool_t _dbus_validate_signature (const DBusString *str,
@@ -159,7 +159,7 @@ DECLARE_DBUS_NAME_CHECK(path);
DECLARE_DBUS_NAME_CHECK(interface);
DECLARE_DBUS_NAME_CHECK(member);
DECLARE_DBUS_NAME_CHECK(error_name);
-DECLARE_DBUS_NAME_CHECK(service);
+DECLARE_DBUS_NAME_CHECK(bus_name);
DECLARE_DBUS_NAME_CHECK(signature);
#endif /* DBUS_MARSHAL_VALIDATE_H */
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 8bb48667..e4c761c2 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -728,7 +728,7 @@ dbus_message_new (int message_type)
* that if multiple methods with the given name exist it is undefined
* which one will be invoked.
*
- * @param destination service that the message should be sent to or #NULL
+ * @param destination name that the message should be sent to or #NULL
* @param path object path the message should be sent to
* @param interface interface to invoke method on
* @param method method to invoke
@@ -747,7 +747,7 @@ dbus_message_new_method_call (const char *destination,
_dbus_return_val_if_fail (path != NULL, NULL);
_dbus_return_val_if_fail (method != NULL, NULL);
_dbus_return_val_if_fail (destination == NULL ||
- _dbus_check_is_valid_service (destination), NULL);
+ _dbus_check_is_valid_bus_name (destination), NULL);
_dbus_return_val_if_fail (_dbus_check_is_valid_path (path), NULL);
_dbus_return_val_if_fail (interface == NULL ||
_dbus_check_is_valid_interface (interface), NULL);
@@ -2190,41 +2190,41 @@ dbus_message_get_no_reply (DBusMessage *message)
}
/**
- * Sets a flag indicating that the addressed service will be
- * auto-activated before the message is delivered. When this flag is
- * set, the message is held until the service is succesfully activated
- * or fails to activate. In case of failure, the reply will be an
- * activation error. If this flag is not set (the default
+ * Sets a flag indicating that an owner for the destination name will
+ * be automatically started before the message is delivered. When this
+ * flag is set, the message is held until a name owner finishes
+ * starting up, or fails to start up. In case of failure, the reply
+ * will be an error.
*
* @param message the message
- * @param auto_activation #TRUE if auto-activation is desired
+ * @param auto_start #TRUE if auto-starting is desired
*/
void
-dbus_message_set_auto_activation (DBusMessage *message,
- dbus_bool_t auto_activation)
+dbus_message_set_auto_start (DBusMessage *message,
+ dbus_bool_t auto_start)
{
_dbus_return_if_fail (message != NULL);
_dbus_return_if_fail (!message->locked);
_dbus_header_toggle_flag (&message->header,
- DBUS_HEADER_FLAG_AUTO_ACTIVATION,
- auto_activation);
+ DBUS_HEADER_FLAG_AUTO_START,
+ auto_start);
}
/**
- * Returns #TRUE if the message will cause the addressed service to be
- * auto-activated.
+ * Returns #TRUE if the message will cause an owner for
+ * destination name to be auto-started.
*
* @param message the message
- * @returns #TRUE if the message will use auto-activation
+ * @returns #TRUE if the message will use auto-start
*/
dbus_bool_t
-dbus_message_get_auto_activation (DBusMessage *message)
+dbus_message_get_auto_start (DBusMessage *message)
{
_dbus_return_val_if_fail (message != NULL, FALSE);
return _dbus_header_get_flag (&message->header,
- DBUS_HEADER_FLAG_AUTO_ACTIVATION);
+ DBUS_HEADER_FLAG_AUTO_START);
}
@@ -2462,10 +2462,13 @@ dbus_message_get_error_name (DBusMessage *message)
}
/**
- * Sets the message's destination service.
+ * Sets the message's destination. The destination is the name of
+ * another connection on the bus and may be either the unique name
+ * assigned by the bus to each connection, or a well-known name
+ * specified in advance.
*
* @param message the message
- * @param destination the destination service name or #NULL to unset
+ * @param destination the destination name or #NULL to unset
* @returns #FALSE if not enough memory
*/
dbus_bool_t
@@ -2475,7 +2478,7 @@ dbus_message_set_destination (DBusMessage *message,
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (!message->locked, FALSE);
_dbus_return_val_if_fail (destination == NULL ||
- _dbus_check_is_valid_service (destination),
+ _dbus_check_is_valid_bus_name (destination),
FALSE);
return set_or_delete_string_field (message,
@@ -2485,11 +2488,10 @@ dbus_message_set_destination (DBusMessage *message,
}
/**
- * Gets the destination service of a message or #NULL if there is
- * none set.
+ * Gets the destination of a message or #NULL if there is none set.
*
* @param message the message
- * @returns the message destination service (should not be freed) or #NULL
+ * @returns the message destination (should not be freed) or #NULL
*/
const char*
dbus_message_get_destination (DBusMessage *message)
@@ -2520,7 +2522,7 @@ dbus_message_set_sender (DBusMessage *message,
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (!message->locked, FALSE);
_dbus_return_val_if_fail (sender == NULL ||
- _dbus_check_is_valid_service (sender),
+ _dbus_check_is_valid_bus_name (sender),
FALSE);
return set_or_delete_string_field (message,
@@ -2530,11 +2532,12 @@ dbus_message_set_sender (DBusMessage *message,
}
/**
- * Gets the service which originated this message,
- * or #NULL if unknown or inapplicable.
+ * Gets the unique name of the connection which originated this
+ * message, or #NULL if unknown or inapplicable. The sender is filled
+ * in by the message bus.
*
* @param message the message
- * @returns the service name or #NULL
+ * @returns the unique name of the sender or #NULL
*/
const char*
dbus_message_get_sender (DBusMessage *message)
@@ -2706,67 +2709,65 @@ dbus_message_is_error (DBusMessage *message,
}
/**
- * Checks whether the message was sent to the given service. If the
- * message has no service specified or has a different name, returns
- * #FALSE.
+ * Checks whether the message was sent to the given name. If the
+ * message has no destination specified or has a different
+ * destination, returns #FALSE.
*
* @param message the message
- * @param service the service to check (must not be #NULL)
+ * @param name the name to check (must not be #NULL)
*
- * @returns #TRUE if the message has the given destination service
+ * @returns #TRUE if the message has the given destination name
*/
dbus_bool_t
dbus_message_has_destination (DBusMessage *message,
- const char *service)
+ const char *name)
{
const char *s;
_dbus_return_val_if_fail (message != NULL, FALSE);
- _dbus_return_val_if_fail (service != NULL, FALSE);
- /* don't check that service name is valid since it would be expensive,
- * and not catch many common errors
+ _dbus_return_val_if_fail (name != NULL, FALSE);
+ /* don't check that name is valid since it would be expensive, and
+ * not catch many common errors
*/
s = dbus_message_get_destination (message);
- if (s && strcmp (s, service) == 0)
+ if (s && strcmp (s, name) == 0)
return TRUE;
else
return FALSE;
}
/**
- * Checks whether the message has the given service as its sender. If
- * the message has no sender specified or has a different sender,
- * returns #FALSE. Note that if a peer application owns multiple
- * services, its messages will have only one of those services as the
- * sender (usually the base service). So you can't use this
- * function to prove the sender didn't own service Foo, you can
- * only use it to prove that it did.
+ * Checks whether the message has the given unique name as its sender.
+ * If the message has no sender specified or has a different sender,
+ * returns #FALSE. Note that a peer application will always have the
+ * unique name of the connection as the sender. So you can't use this
+ * function to see whether a sender owned a well-known name.
*
- * @todo this function is probably useless unless we make a hard guarantee
- * that the sender field in messages will always be the base service name
+ * Messages from the bus itself will have #DBUS_SERVICE_ORG_FREEDESKTOP_DBUS
+ * as the sender.
*
* @param message the message
- * @param service the service to check (must not be #NULL)
+ * @param name the name to check (must not be #NULL)
*
- * @returns #TRUE if the message has the given origin service
+ * @returns #TRUE if the message has the given sender
*/
dbus_bool_t
dbus_message_has_sender (DBusMessage *message,
- const char *service)
+ const char *name)
{
const char *s;
_dbus_return_val_if_fail (message != NULL, FALSE);
- _dbus_return_val_if_fail (service != NULL, FALSE);
- /* don't check that service name is valid since it would be expensive,
- * and not catch many common errors
+ _dbus_return_val_if_fail (name != NULL, FALSE);
+ /* don't check that name is valid since it would be expensive, and
+ * not catch many common errors
*/
s = dbus_message_get_sender (message);
- if (s && strcmp (s, service) == 0)
+ if (s && strcmp (s, name) == 0)
return TRUE;
else
return FALSE;
diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h
index 7dcedcc7..421ed6ba 100644
--- a/dbus/dbus-message.h
+++ b/dbus/dbus-message.h
@@ -61,7 +61,7 @@ struct DBusMessageIter
};
DBusMessage* dbus_message_new (int message_type);
-DBusMessage* dbus_message_new_method_call (const char *service,
+DBusMessage* dbus_message_new_method_call (const char *bus_name,
const char *path,
const char *interface,
const char *method);
@@ -113,9 +113,9 @@ dbus_bool_t dbus_message_is_signal (DBusMessage *message,
dbus_bool_t dbus_message_is_error (DBusMessage *message,
const char *error_name);
dbus_bool_t dbus_message_has_destination (DBusMessage *message,
- const char *service);
+ const char *bus_name);
dbus_bool_t dbus_message_has_sender (DBusMessage *message,
- const char *service);
+ const char *unique_bus_name);
dbus_bool_t dbus_message_has_signature (DBusMessage *message,
const char *signature);
dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
@@ -123,9 +123,9 @@ dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
dbus_uint32_t reply_serial);
dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
-void dbus_message_set_auto_activation (DBusMessage *message,
- dbus_bool_t auto_activation);
-dbus_bool_t dbus_message_get_auto_activation (DBusMessage *message);
+void dbus_message_set_auto_start (DBusMessage *message,
+ dbus_bool_t auto_start);
+dbus_bool_t dbus_message_get_auto_start (DBusMessage *message);
dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
char ***path);
diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h
index 6edd84f1..fec94d8c 100644
--- a/dbus/dbus-protocol.h
+++ b/dbus/dbus-protocol.h
@@ -89,11 +89,11 @@ extern "C" {
#define DBUS_STRUCT_END_CHAR ((int) ')')
#define DBUS_STRUCT_END_CHAR_AS_STRING ")"
-/* Max length in bytes of a service or interface or member name (not
- * object path, paths are unlimited). This is limited because lots of
- * stuff is O(n) in this number, plus it would be obnoxious to type in
- * a paragraph-long method name so most likely something like that
- * would be an exploit.
+/* Max length in bytes of a bus name, interface, or member (not object
+ * path, paths are unlimited). This is limited because lots of stuff
+ * is O(n) in this number, plus it would be obnoxious to type in a
+ * paragraph-long method name so most likely something like that would
+ * be an exploit.
*/
#define DBUS_MAXIMUM_NAME_LENGTH 255
@@ -142,7 +142,7 @@ extern "C" {
/* Header flags */
#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
-#define DBUS_HEADER_FLAG_AUTO_ACTIVATION 0x2
+#define DBUS_HEADER_FLAG_AUTO_START 0x2
/* Header fields */
#define DBUS_HEADER_FIELD_INVALID 0
@@ -203,19 +203,19 @@ extern "C" {
*/
#define DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL "org.freedesktop.Local"
-/* Service owner flags */
-#define DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT 0x1
-#define DBUS_SERVICE_FLAG_REPLACE_EXISTING 0x2
+/* Owner flags */
+#define DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT 0x1
+#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2
-/* Service replies */
-#define DBUS_SERVICE_REPLY_PRIMARY_OWNER 0x1
-#define DBUS_SERVICE_REPLY_IN_QUEUE 0x2
-#define DBUS_SERVICE_REPLY_SERVICE_EXISTS 0x4
-#define DBUS_SERVICE_REPLY_ALREADY_OWNER 0x8
+/* Replies to request for a name */
+#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1
+#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2
+#define DBUS_REQUEST_NAME_REPLY_EXISTS 3
+#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4
-/* Activation replies */
-#define DBUS_ACTIVATION_REPLY_ACTIVATED 0x0
-#define DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE 0x1
+/* Replies to service starts */
+#define DBUS_START_REPLY_SUCCESS 1
+#define DBUS_START_REPLY_ALREADY_RUNNING 2
/* Errors */
/* WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
@@ -225,9 +225,8 @@ extern "C" {
*/
#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
-#define DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.ServiceNotFound"
-#define DBUS_ERROR_SERVICE_DOES_NOT_EXIST "org.freedesktop.DBus.Error.ServiceDoesNotExist"
-#define DBUS_ERROR_SERVICE_HAS_NO_OWNER "org.freedesktop.DBus.Error.ServiceHasNoOwner"
+#define DBUS_ERROR_SERVICE_UNKNOWN "org.freedesktop.DBus.Error.ServiceUnknown"
+#define DBUS_ERROR_NAME_HAS_NO_OWNER "org.freedesktop.DBus.Error.NameHasNoOwner"
#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h
index a1c8b1ce..4fca1c57 100644
--- a/dbus/dbus-shared.h
+++ b/dbus/dbus-shared.h
@@ -36,7 +36,7 @@ typedef enum
{
DBUS_BUS_SESSION, /**< The login session bus */
DBUS_BUS_SYSTEM, /**< The systemwide bus */
- DBUS_BUS_ACTIVATION /**< The bus that activated us, if any */
+ DBUS_BUS_STARTER /**< The bus that started us, if any */
} DBusBusType;
typedef enum