diff options
author | Havoc Pennington <hp@redhat.com> | 2005-01-18 20:42:15 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2005-01-18 20:42:15 +0000 |
commit | 8873c90f99303f9cc308f15f8d03e637911f5b9e (patch) | |
tree | 03e459881912388cc6c3759d91fb0cf75739a5a7 | |
parent | 4fce285052c143296cd9e08a48de0175b5207853 (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
33 files changed, 1606 insertions, 1044 deletions
@@ -1,3 +1,15 @@ +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 + 2005-01-17 Havoc Pennington <hp@redhat.com> * dbus/dbus-types.h: remove 16-bit types since we don't use them diff --git a/bus/activation.c b/bus/activation.c index 7461720a..10839b9f 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -789,13 +789,13 @@ child_setup (void *data) /* If no memory, we simply have the child exit, so it won't try * to connect to the wrong thing. */ - if (!_dbus_setenv ("DBUS_ACTIVATION_ADDRESS", activation->server_address)) + if (!_dbus_setenv ("DBUS_STARTER_ADDRESS", activation->server_address)) _dbus_exit (1); type = bus_context_get_type (activation->context); if (type != NULL) { - if (!_dbus_setenv ("DBUS_BUS_TYPE", type)) + if (!_dbus_setenv ("DBUS_STARTER_BUS_TYPE", type)) _dbus_exit (1); if (strcmp (type, "session") == 0) @@ -920,7 +920,7 @@ bus_activation_service_created (BusActivation *activation, goto error; } - result = DBUS_ACTIVATION_REPLY_ACTIVATED; + result = DBUS_START_REPLY_SUCCESS; if (!dbus_message_append_args (message, DBUS_TYPE_UINT32, &result, @@ -1280,8 +1280,8 @@ activation_find_entry (BusActivation *activation, if (!entry) { - dbus_set_error (error, DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND, - "The service %s was not found in the activation entry list", + dbus_set_error (error, DBUS_ERROR_SERVICE_UNKNOWN, + "The name %s was not provided by any .service files", service_name); return NULL; } @@ -1347,7 +1347,7 @@ bus_activation_activate_service (BusActivation *activation, return FALSE; } - result = DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE; + result = DBUS_START_REPLY_ALREADY_RUNNING; if (!dbus_message_append_args (message, DBUS_TYPE_UINT32, &result, diff --git a/bus/config-parser.c b/bus/config-parser.c index 074c6218..d105cb0e 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -1677,7 +1677,7 @@ set_limit (BusConfigParser *parser, must_be_positive = TRUE; parser->limits.max_message_size = value; } - else if (strcmp (name, "activation_timeout") == 0) + else if (strcmp (name, "service_start_timeout") == 0) { must_be_positive = TRUE; must_be_int = TRUE; @@ -1713,13 +1713,13 @@ set_limit (BusConfigParser *parser, must_be_int = TRUE; parser->limits.max_connections_per_user = value; } - else if (strcmp (name, "max_pending_activations") == 0) + else if (strcmp (name, "max_pending_service_starts") == 0) { must_be_positive = TRUE; must_be_int = TRUE; parser->limits.max_pending_activations = value; } - else if (strcmp (name, "max_services_per_connection") == 0) + else if (strcmp (name, "max_names_per_connection") == 0) { must_be_positive = TRUE; must_be_int = TRUE; @@ -2814,28 +2814,29 @@ all_are_equiv (const DBusString *target_directory) printf (" %s\n", _dbus_string_get_const_data (&filename)); parser = bus_config_load (&full_path, TRUE, NULL, &error); - _dbus_string_free (&full_path); if (parser == NULL) { _dbus_warn ("Could not load file %s: %s\n", _dbus_string_get_const_data (&full_path), error.message); + _dbus_string_free (&full_path); dbus_error_free (&error); goto finished; } else if (first_parser == NULL) { + _dbus_string_free (&full_path); first_parser = parser; } else { + _dbus_string_free (&full_path); equal = config_parsers_equal (first_parser, parser); bus_config_parser_unref (parser); if (! equal) goto finished; } - } retval = TRUE; diff --git a/bus/dbus-daemon-1.1.in b/bus/dbus-daemon-1.1.in index 2498c55b..c38ca68a 100644 --- a/bus/dbus-daemon-1.1.in +++ b/bus/dbus-daemon-1.1.in @@ -23,7 +23,7 @@ exchange messages with one another. .PP There are two standard message bus instances: the systemwide message bus -(installed on many systems as the "messagebus" service) and the +(installed on many systems as the "messagebus" init service) and the per-user-login-session message bus (started each time a user logs in). \fIdbus-daemon-1\fP is used for both of these instances, but with a different configuration file. @@ -212,7 +212,7 @@ Example: <listen>unix:path=/tmp/foo</listen> .PP If there are multiple <listen> elements, then the bus listens on multiple addresses. The bus will pass its address to -activated services or other interested parties with +started services or other interested parties with the last address given in <listen> first. That is, apps will try to connect to the last <listen> address first. @@ -241,8 +241,8 @@ scanned starting with the last to appear in the config file service will be used). .PP -Service files tell the bus how to automatically start a particular -service. They are primarily used with the per-user-session bus, +Service files tell the bus how to automatically start a program. +They are primarily used with the per-user-session bus, not the systemwide bus. .TP @@ -265,8 +265,8 @@ Available limit names are: queued up for a single connection "max_message_size" : max size of a single message in bytes - "activation_timeout" : milliseconds (thousandths) until - an activated service has to connect + "service_start_timeout" : milliseconds (thousandths) until + a started service has to connect "auth_timeout" : milliseconds (thousandths) a connection is given to authenticate @@ -275,9 +275,9 @@ Available limit names are: connections "max_connections_per_user" : max number of completed connections from the same user - "max_pending_activations" : max number of activations in + "max_pending_service_starts" : max number of service launches in progress at the same time - "max_services_per_connection": max number of services a single + "max_names_per_connection" : max number of names a single connection can own "max_match_rules_per_connection": max number of match rules for a single connection @@ -347,14 +347,14 @@ The possible attributes of these elements are: send_interface="interface_name" send_member="method_or_signal_name" send_error="error_name" - send_destination="service_name" + send_destination="name" send_type="method_call" | "method_return" | "signal" | "error" send_path="/path/name" receive_interface="interface_name" receive_member="method_or_signal_name" receive_error="error_name" - receive_sender="service_name" + receive_sender="name" receive_type="method_call" | "method_return" | "signal" | "error" receive_path="/path/name" @@ -363,7 +363,7 @@ The possible attributes of these elements are: eavesdrop="true" | "false" - own="servicename" + own="name" user="username" group="groupname" .fi @@ -387,8 +387,8 @@ rules in the config file allow it). .PP send_destination and receive_sender rules mean that messages may not be -sent to or received from the *owner* of the given service, not that -they may not be sent *to that service name*. That is, if a connection +sent to or received from the *owner* of the given name, not that +they may not be sent *to that name*. That is, if a connection owns services A, B, C, and sending to A is denied, sending to B or C will not work either. @@ -398,7 +398,7 @@ matches against the given field in the message header. .PP "Eavesdropping" occurs when an application receives a message that -was explicitly addressed to a service the application does not own. +was explicitly addressed to a name the application does not own. Eavesdropping thus only applies to messages that are addressed to services (i.e. it does not apply to signals). @@ -437,7 +437,7 @@ user and group denials mean that the given user or group may not connect to the message bus. .PP -For "service_name", "username", "groupname", etc. +For "name", "username", "groupname", etc. the character "*" can be substituted, meaning "any." Complex globs like "foo.bar.*" aren't allowed for now because they'd be work to implement and maybe encourage sloppy security anyway. @@ -449,10 +449,10 @@ context="default" or context="mandatory" policies. .PP A single <deny> rule may specify combinations of attributes such as -send_service and send_interface and send_type. In this case, the +send_destination and send_interface and send_type. In this case, the denial applies only if both attributes match the message being denied. -e.g. <deny send_interface="foo.bar" send_service="foo.blah"/> would -deny messages of the given interface AND to the given service. +e.g. <deny send_interface="foo.bar" send_destination="foo.blah"/> would +deny messages with the given interface AND the given bus name. To get an OR effect you specify multiple <deny> rules. .PP @@ -482,17 +482,17 @@ creates a mapping. Right now only one kind of association is possible: .fi .PP -This means that if a connection asks to own the service +This means that if a connection asks to own the name "org.freedesktop.Foobar" then the source context will be the context of the connection and the target context will be "foo_t" - see the short discussion of SELinux below. .PP -Note, the context here is the target context when acquiring a service, -NOT the context of the connection owning the service. +Note, the context here is the target context when requesting a name, +NOT the context of the connection owning the name. .PP -There's currently no way to set a default for owning any service, if +There's currently no way to set a default for owning any name, if we add this syntax it will look like: .nf <associate own="*" context="foo_t"/> @@ -501,9 +501,8 @@ If you find a reason this is useful, let the developers know. Right now the default will be the security context of the bus itself. .PP -If two <associate> elements specify the same service name, -the element appearing later in the configuration file will -be used. +If two <associate> elements specify the same name, the element +appearing later in the configuration file will be used. .SH SELinux @@ -557,14 +556,14 @@ connect to the systemwide bus. If this changes, we'll probably add a way to set the default connection context. .PP -Second, any time a connection asks to own a service, +Second, any time a connection asks to own a name, the bus daemon will check permissions with the security context of the connection as source, the security context specified -for the service name with an <associate> element as target, object +for the name with an <associate> element as target, object class "dbus" and requested permission "acquire_svc". .PP -If the service name has no security context associated in the +If the name has no security context associated in the configuration file, the security context of the bus daemon itself will be used. diff --git a/bus/dispatch.c b/bus/dispatch.c index 4f7620b1..120c9037 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -258,7 +258,7 @@ bus_dispatch (DBusConnection *connection, _dbus_string_init_const (&service_string, service_name); service = bus_registry_lookup (registry, &service_string); - if (service == NULL && dbus_message_get_auto_activation (message)) + if (service == NULL && dbus_message_get_auto_start (message)) { BusActivation *activation; @@ -281,8 +281,8 @@ bus_dispatch (DBusConnection *connection, else if (service == NULL) { dbus_set_error (&error, - DBUS_ERROR_SERVICE_DOES_NOT_EXIST, - "Service \"%s\" does not exist", + DBUS_ERROR_NAME_HAS_NO_OWNER, + "Name \"%s\" does not exist", service_name); goto out; } @@ -539,14 +539,14 @@ check_service_owner_changed_foreach (DBusConnection *connection, if (message == NULL) { _dbus_warn ("Did not receive a message on %p, expecting %s\n", - connection, "ServiceOwnerChanged"); + connection, "NameOwnerChanged"); goto out; } else if (!dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged")) + "NameOwnerChanged")) { - warn_unexpected (connection, message, "ServiceOwnerChanged"); + warn_unexpected (connection, message, "NameOwnerChanged"); goto out; } @@ -582,7 +582,7 @@ check_service_owner_changed_foreach (DBusConnection *connection, || (d->expected_kind == OWNER_CHANGED && (!old_owner[0] || !new_owner[0])) || (d->expected_kind == SERVICE_DELETED && (!old_owner[0] || new_owner[0]))) { - _dbus_warn ("inconsistent ServiceOwnerChanged arguments"); + _dbus_warn ("inconsistent NameOwnerChanged arguments"); goto out; } @@ -625,7 +625,7 @@ kill_client_connection (BusContext *context, _dbus_verbose ("killing connection %p\n", connection); - s = dbus_bus_get_base_service (connection); + s = dbus_bus_get_unique_name (connection); _dbus_assert (s != NULL); while ((base_service = _dbus_strdup (s)) == NULL) @@ -660,7 +660,7 @@ kill_client_connection (BusContext *context, dbus_free (base_service); if (socd.failed) - _dbus_assert_not_reached ("didn't get the expected ServiceOwnerChanged (deletion) messages"); + _dbus_assert_not_reached ("didn't get the expected NameOwnerChanged (deletion) messages"); if (!check_no_leftovers (context)) _dbus_assert_not_reached ("stuff left in message queues after disconnecting a client"); @@ -877,7 +877,7 @@ check_hello_message (BusContext *context, _dbus_verbose ("Got hello name: %s\n", name); - while (!dbus_bus_set_base_service (connection, name)) + while (!dbus_bus_set_unique_name (connection, name)) _dbus_wait_for_memory (); socd.expected_kind = SERVICE_CREATED; @@ -897,14 +897,14 @@ check_hello_message (BusContext *context, if (message == NULL) { _dbus_warn ("Expecting %s, got nothing\n", - "ServiceAcquired"); + "NameAcquired"); goto out; } if (! dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceAcquired")) + "NameAcquired")) { _dbus_warn ("Expecting %s, got smthg else\n", - "ServiceAcquired"); + "NameAcquired"); goto out; } @@ -1076,7 +1076,7 @@ check_get_connection_unix_user (BusContext *context, if (message == NULL) return TRUE; - base_service_name = dbus_bus_get_base_service (connection); + base_service_name = dbus_bus_get_unique_name (connection); if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &base_service_name, @@ -1213,7 +1213,7 @@ check_get_connection_unix_process_id (BusContext *context, if (message == NULL) return TRUE; - base_service_name = dbus_bus_get_base_service (connection); + base_service_name = dbus_bus_get_unique_name (connection); if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &base_service_name, @@ -1500,7 +1500,7 @@ check_hello_connection (BusContext *context) if (!check_hello_message (context, connection)) return FALSE; - if (dbus_bus_get_base_service (connection) == NULL) + if (dbus_bus_get_unique_name (connection) == NULL) { /* We didn't successfully register, so we can't * do the usual kill_client_connection() checks @@ -1536,8 +1536,8 @@ check_nonexistent_service_activation (BusContext *context, message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ActivateService"); - + "StartServiceByName"); + if (message == NULL) return TRUE; @@ -1576,7 +1576,7 @@ check_nonexistent_service_activation (BusContext *context, if (message == NULL) { _dbus_warn ("Did not receive a reply to %s %d on %p\n", - "ActivateService", serial, connection); + "StartServiceByName", serial, connection); goto out; } @@ -1598,7 +1598,7 @@ check_nonexistent_service_activation (BusContext *context, ; /* good, this is a valid response */ } else if (dbus_message_is_error (message, - DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND)) + DBUS_ERROR_SERVICE_UNKNOWN)) { ; /* good, this is expected also */ } @@ -1643,7 +1643,7 @@ check_nonexistent_service_auto_activation (BusContext *context, if (message == NULL) return TRUE; - dbus_message_set_auto_activation (message, TRUE); + dbus_message_set_auto_start (message, TRUE); if (!dbus_connection_send (connection, message, &serial)) { @@ -1693,7 +1693,7 @@ check_nonexistent_service_auto_activation (BusContext *context, ; /* good, this is a valid response */ } else if (dbus_message_is_error (message, - DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND)) + DBUS_ERROR_SERVICE_UNKNOWN)) { ; /* good, this is expected also */ } @@ -1742,7 +1742,7 @@ check_base_service_activated (BusContext *context, if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged")) + "NameOwnerChanged")) { CheckServiceOwnerChangedData socd; @@ -1766,7 +1766,7 @@ check_base_service_activated (BusContext *context, else { _dbus_warn ("Message %s doesn't have a service name: %s\n", - "ServiceOwnerChanged (creation)", + "NameOwnerChanged (creation)", error.message); goto out; } @@ -1805,7 +1805,7 @@ check_base_service_activated (BusContext *context, } else { - warn_unexpected (connection, message, "ServiceOwnerChanged (creation) for base service"); + warn_unexpected (connection, message, "NameOwnerChanged (creation) for base service"); goto out; } @@ -1844,7 +1844,7 @@ check_service_activated (BusContext *context, if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged")) + "NameOwnerChanged")) { CheckServiceOwnerChangedData socd; const char *service_name, *base_service_from_bus, *old_owner; @@ -1869,7 +1869,7 @@ check_service_activated (BusContext *context, else { _dbus_warn ("Message %s doesn't have a service name: %s\n", - "ServiceOwnerChanged (creation)", + "NameOwnerChanged (creation)", error.message); goto out; } @@ -1884,7 +1884,7 @@ check_service_activated (BusContext *context, if (strcmp (base_service_name, base_service_from_bus) != 0) { - _dbus_warn ("ServiceOwnerChanged reports wrong base service: %s owner, expected %s instead\n", + _dbus_warn ("NameOwnerChanged reports wrong base service: %s owner, expected %s instead\n", base_service_from_bus, base_service_name); goto out; } @@ -1892,8 +1892,8 @@ check_service_activated (BusContext *context, if (old_owner[0]) { _dbus_warn ("expected a %s, got a %s\n", - "ServiceOwnerChanged (creation)", - "ServiceOwnerChanged (change)"); + "NameOwnerChanged (creation)", + "NameOwnerChanged (change)"); goto out; } @@ -1916,20 +1916,20 @@ check_service_activated (BusContext *context, if (message == NULL) { _dbus_warn ("Expected a reply to %s, got nothing\n", - "ActivateService"); + "StartServiceByName"); goto out; } } else { - warn_unexpected (connection, message, "ServiceOwnerChanged for the activated name"); + warn_unexpected (connection, message, "NameOwnerChanged for the activated name"); goto out; } if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN) { - warn_unexpected (connection, message, "reply to ActivateService"); + warn_unexpected (connection, message, "reply to StartServiceByName"); goto out; } @@ -1942,7 +1942,7 @@ check_service_activated (BusContext *context, if (!dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY)) { _dbus_warn ("Did not have activation result first argument to %s: %s\n", - "ActivateService", error.message); + "StartServiceByName", error.message); goto out; } @@ -1950,13 +1950,13 @@ check_service_activated (BusContext *context, } else { - if (activation_result == DBUS_ACTIVATION_REPLY_ACTIVATED) + if (activation_result == DBUS_START_REPLY_SUCCESS) ; /* Good */ - else if (activation_result == DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE) + else if (activation_result == DBUS_START_REPLY_ALREADY_RUNNING) ; /* Good also */ else { - _dbus_warn ("Activation result was 0x%x, no good.\n", + _dbus_warn ("Activation result was %u, no good.\n", activation_result); goto out; } @@ -2001,7 +2001,7 @@ check_service_auto_activated (BusContext *context, if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged")) + "NameOwnerChanged")) { const char *service_name; CheckServiceOwnerChangedData socd; @@ -2020,7 +2020,7 @@ check_service_auto_activated (BusContext *context, else { _dbus_warn ("Message %s doesn't have a service name: %s\n", - "ServiceOwnerChanged", + "NameOwnerChanged", error.message); dbus_error_free (&error); goto out; @@ -2054,7 +2054,7 @@ check_service_auto_activated (BusContext *context, } else { - warn_unexpected (connection, message, "ServiceOwnerChanged for the activated name"); + warn_unexpected (connection, message, "NameOwnerChanged for the activated name"); goto out; } @@ -2335,7 +2335,7 @@ check_got_service_info (DBusMessage *message) if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged")) + "NameOwnerChanged")) { DBusError error; const char *service_name, *old_owner, *new_owner; @@ -2360,7 +2360,7 @@ check_got_service_info (DBusMessage *message) } else { - _dbus_warn ("unexpected arguments for ServiceOwnerChanged message"); + _dbus_warn ("unexpected arguments for NameOwnerChanged message"); message_kind = GOT_SOMETHING_ELSE; } } @@ -2403,7 +2403,7 @@ check_existent_service_activation (BusContext *context, message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ActivateService"); + "StartServiceByName"); if (message == NULL) return TRUE; @@ -2448,12 +2448,12 @@ check_existent_service_activation (BusContext *context, if (message == NULL) { _dbus_warn ("Did not receive any messages after %s %d on %p\n", - "ActivateService", serial, connection); + "StartServiceByName", serial, connection); goto out; } verbose_message_received (connection, message); - _dbus_verbose (" (after sending %s)\n", "ActivateService"); + _dbus_verbose (" (after sending %s)\n", "StartServiceByName"); if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) { @@ -2570,7 +2570,7 @@ check_existent_service_activation (BusContext *context, if (message == NULL) { _dbus_warn ("Failed to pop message we just put back! " - "should have been a ServiceOwnerChanged (creation)\n"); + "should have been a NameOwnerChanged (creation)\n"); goto out; } @@ -2623,7 +2623,7 @@ check_segfault_service_activation (BusContext *context, message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ActivateService"); + "StartServiceByName"); if (message == NULL) return TRUE; @@ -2664,7 +2664,7 @@ check_segfault_service_activation (BusContext *context, if (message == NULL) { _dbus_warn ("Did not receive a reply to %s %d on %p\n", - "ActivateService", serial, connection); + "StartServiceByName", serial, connection); goto out; } @@ -2732,7 +2732,7 @@ check_segfault_service_auto_activation (BusContext *context, if (message == NULL) return TRUE; - dbus_message_set_auto_activation (message, TRUE); + dbus_message_set_auto_start (message, TRUE); if (!dbus_connection_send (connection, message, &serial)) { @@ -2833,7 +2833,7 @@ check_existent_service_auto_activation (BusContext *context, if (message == NULL) return TRUE; - dbus_message_set_auto_activation (message, TRUE); + dbus_message_set_auto_start (message, TRUE); text = TEST_ECHO_MESSAGE; if (!dbus_message_append_args (message, @@ -2872,13 +2872,13 @@ check_existent_service_auto_activation (BusContext *context, message = pop_message_waiting_for_memory (connection); if (message == NULL) { - _dbus_warn ("Did not receive any messages after auto activation %d on %p\n", + _dbus_warn ("Did not receive any messages after auto start %d on %p\n", serial, connection); goto out; } verbose_message_received (connection, message); - _dbus_verbose (" (after sending %s)\n", "auto activation"); + _dbus_verbose (" (after sending %s)\n", "auto start"); /* we should get zero or two ServiceOwnerChanged signals */ if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_SIGNAL) @@ -2920,7 +2920,7 @@ check_existent_service_auto_activation (BusContext *context, if (message == NULL) { _dbus_warn ("Failed to pop message we just put back! " - "should have been a ServiceOwnerChanged (creation)\n"); + "should have been a NameOwnerChanged (creation)\n"); goto out; } diff --git a/bus/driver.c b/bus/driver.c index 0eef59e1..3a9e555d 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -52,14 +52,14 @@ bus_driver_send_service_owner_changed (const char *service_name, _DBUS_ASSERT_ERROR_IS_CLEAR (error); null_service = ""; - _dbus_verbose ("sending service owner changed: %s [%s -> %s]\n", + _dbus_verbose ("sending name owner changed: %s [%s -> %s]\n", service_name, old_owner ? old_owner : null_service, new_owner ? new_owner : null_service); message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged"); + "NameOwnerChanged"); if (message == NULL) { @@ -102,7 +102,7 @@ bus_driver_send_service_lost (DBusConnection *connection, message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceLost"); + "NameLost"); if (message == NULL) { @@ -145,7 +145,7 @@ bus_driver_send_service_acquired (DBusConnection *connection, message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceAcquired"); + "NameAcquired"); if (message == NULL) { @@ -597,7 +597,7 @@ bus_driver_handle_activate_service (DBusConnection *connection, DBUS_TYPE_INVALID)) { _DBUS_ASSERT_ERROR_IS_SET (error); - _dbus_verbose ("No memory to get arguments to ActivateService\n"); + _dbus_verbose ("No memory to get arguments to StartServiceByName\n"); return FALSE; } @@ -795,17 +795,18 @@ bus_driver_handle_get_service_owner (DBusConnection *connection, if (service == NULL) { dbus_set_error (error, - DBUS_ERROR_SERVICE_HAS_NO_OWNER, - "Could not get owner of service '%s': no such service", text); + DBUS_ERROR_NAME_HAS_NO_OWNER, + "Could not get owner of name '%s': no such name", text); goto failed; } base_name = bus_connection_get_name (bus_service_get_primary_owner (service)); if (base_name == NULL) { + /* FIXME - how is this error possible? */ dbus_set_error (error, DBUS_ERROR_FAILED, - "Could not determine base service for '%s'", text); + "Could not determine unique name for '%s'", text); goto failed; } _dbus_assert (*base_name == ':'); @@ -870,8 +871,8 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection, if (serv == NULL) { dbus_set_error (error, - DBUS_ERROR_SERVICE_HAS_NO_OWNER, - "Could not get owner of service '%s': no such service", service); + DBUS_ERROR_NAME_HAS_NO_OWNER, + "Could not get UID of name '%s': no such name", service); goto failed; } @@ -946,8 +947,8 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection, if (serv == NULL) { dbus_set_error (error, - DBUS_ERROR_SERVICE_HAS_NO_OWNER, - "Could not get owner of service '%s': no such service", service); + DBUS_ERROR_NAME_HAS_NO_OWNER, + "Could not get PID of name '%s': no such name", service); goto failed; } @@ -1026,14 +1027,14 @@ struct DBusMessage *message, DBusError *error); } message_handlers[] = { - { "AcquireService", bus_driver_handle_acquire_service }, - { "ActivateService", bus_driver_handle_activate_service }, + { "RequestName", bus_driver_handle_acquire_service }, + { "StartServiceByName", bus_driver_handle_activate_service }, { "Hello", bus_driver_handle_hello }, - { "ServiceExists", bus_driver_handle_service_exists }, - { "ListServices", bus_driver_handle_list_services }, + { "NameHasOwner", bus_driver_handle_service_exists }, + { "ListNames", bus_driver_handle_list_services }, { "AddMatch", bus_driver_handle_add_match }, { "RemoveMatch", bus_driver_handle_remove_match }, - { "GetServiceOwner", bus_driver_handle_get_service_owner }, + { "GetNameOwner", bus_driver_handle_get_service_owner }, { "GetConnectionUnixUser", bus_driver_handle_get_connection_unix_user }, { "GetConnectionUnixProcessID", bus_driver_handle_get_connection_unix_process_id }, { "ReloadConfig", bus_driver_handle_reload_config } diff --git a/bus/services.c b/bus/services.c index 8f223f4e..90c8d1d8 100644 --- a/bus/services.c +++ b/bus/services.c @@ -375,14 +375,14 @@ bus_registry_acquire_service (BusRegistry *registry, _dbus_assert (current_owner == connection); bus_service_set_prohibit_replacement (service, - (flags & DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT)); + (flags & DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT)); - *result = DBUS_SERVICE_REPLY_PRIMARY_OWNER; + *result = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER; } else if (old_owner == connection) - *result = DBUS_SERVICE_REPLY_ALREADY_OWNER; - else if (!((flags & DBUS_SERVICE_FLAG_REPLACE_EXISTING))) - *result = DBUS_SERVICE_REPLY_SERVICE_EXISTS; + *result = DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER; + else if (!((flags & DBUS_NAME_FLAG_REPLACE_EXISTING))) + *result = DBUS_REQUEST_NAME_REPLY_EXISTS; else if (bus_service_get_prohibit_replacement (service)) { /* Queue the connection */ @@ -390,14 +390,14 @@ bus_registry_acquire_service (BusRegistry *registry, transaction, error)) goto out; - *result = DBUS_SERVICE_REPLY_IN_QUEUE; + *result = DBUS_REQUEST_NAME_REPLY_IN_QUEUE; } else { /* Replace the current owner */ /* We enqueue the new owner and remove the first one because - * that will cause ServiceAcquired and ServiceLost messages to + * that will cause NameAcquired and NameLost messages to * be sent. */ @@ -410,7 +410,7 @@ bus_registry_acquire_service (BusRegistry *registry, goto out; _dbus_assert (connection == bus_service_get_primary_owner (service)); - *result = DBUS_SERVICE_REPLY_PRIMARY_OWNER; + *result = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER; } activation = bus_context_get_activation (registry->context); diff --git a/bus/signals.c b/bus/signals.c index 2b5aa13f..eedeff6f 100644 --- a/bus/signals.c +++ b/bus/signals.c @@ -657,10 +657,10 @@ bus_match_rule_parse (DBusConnection *matches_go_to, goto failed; } - if (!_dbus_validate_service (&tmp_str, 0, len)) + if (!_dbus_validate_bus_name (&tmp_str, 0, len)) { dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID, - "Sender service name '%s' is invalid\n", value); + "Sender name '%s' is invalid\n", value); goto failed; } @@ -745,10 +745,10 @@ bus_match_rule_parse (DBusConnection *matches_go_to, goto failed; } - if (!_dbus_validate_service (&tmp_str, 0, len)) + if (!_dbus_validate_bus_name (&tmp_str, 0, len)) { dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID, - "Destination service name '%s' is invalid\n", value); + "Destination name '%s' is invalid\n", value); goto failed; } 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 @@ -1,5 +1,7 @@ Important for 1.0 === + + - change .service files to have Names=list rather than Name=string - How we will handle DCOP needs sorting out. Among other things, we need to check that service and service-ownership semantics map to DCOP @@ -38,18 +40,14 @@ Important for 1.0 (though they are kind of a pita to pass in as size_t with the varargs, so maybe not - what does glib do with g_object_get()?) - - rename the service thing. unique service names (":1") and well-known - ("org.foo.bar") should have different names probably; something like - "address" for the unique and "alias" for the well-known, or - "application id" for the unique and "common name" or "published - name" for the well-known; not sure yet. - - things are broken now when mixing endianness, because DBusMessage doesn't autoswap itself when you access a message of alternate endian. - add string array support back to append_args() + - auto-activate by default + Important for 1.0 GLib Bindings === @@ -71,6 +69,8 @@ Important for 1.0 GLib Bindings so it can figure out how to invoke the callback, or we have to rely on having introspection data. + - DBusGProxy doesn't emit "destroy" when it should + Might as Well for 1.0 === @@ -90,6 +90,10 @@ Might as Well for 1.0 Can Be Post 1.0 === + - The message bus internal code still says "service" for + "name", "base service" for "unique name", "activate" for + "start"; would be nice to clean up. + - Property list feature on message bus (list of properties associated with a connection). May also include message matching rules that involve the properties of the source or destination diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index f2c0146b..821c6011 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -96,6 +96,30 @@ monitoring service or a configuration service. </para> + <para> + D-BUS is designed for two specific use cases: + <itemizedlist> + <listitem> + <para> + A "system bus" for notifications from the system to user sessions, + and to allow the system to request input from user sessions. + </para> + </listitem> + <listitem> + <para> + A "session bus" used to implement desktop environments such as + GNOME and KDE. + </para> + </listitem> + </itemizedlist> + D-BUS is not intended to be a generic IPC system for any possible + application, and intentionally omits many features found in other + IPC systems for this reason. D-BUS may turn out to be useful + in unanticipated applications, but future versions of this + spec and the reference implementation probably will not + incorporate features that interfere with the core use cases. + </para> + </sect1> <sect1 id="message-protocol"> @@ -733,10 +757,11 @@ to return the reply despite this flag.</entry> </row> <row> - <entry><literal>AUTO_ACTIVATION</literal></entry> + <entry><literal>AUTO_START</literal></entry> <entry>0x2</entry> - <entry>This message automatically activates the - addressed service before the message is delivered.</entry> + <entry>This message automatically launches an owner + for the destination name before the message is delivered. + </entry> </row> </tbody> </tgroup> @@ -841,7 +866,7 @@ <entry>6</entry> <entry><literal>STRING</literal></entry> <entry>optional</entry> - <entry>The name of the service this message should be routed to. + <entry>The name of the connection this message should be routed to. Only used in combination with the message bus, see <xref linkend="message-bus"/>.</entry> </row> @@ -850,8 +875,8 @@ <entry>7</entry> <entry><literal>STRING</literal></entry> <entry>optional</entry> - <entry>Sender service. The name of the base service that sent - this message. The message bus fills in this field; the field is + <entry>Unique name of the sending connection. + The message bus fills in this field so it is reliable; the field is only meaningful in combination with the message bus.</entry> </row> <row> @@ -877,8 +902,7 @@ </para> <para> There is a <firstterm>maximum name length</firstterm> - of 255 which applies to service, interface, and member - names. + of 255 which applies to bus names, interfaces, and members. </para> <sect3 id="message-protocol-names-interface"> <title>Interface names</title> @@ -907,15 +931,15 @@ </itemizedlist> </para> </sect3> - <sect3 id="message-protocol-names-service"> - <title>Service names</title> + <sect3 id="message-protocol-names-bus"> + <title>Bus names</title> <para> - Service names have the same restrictions as interface names, with a - special exception for base services. A base service name's first + Bus names have the same restrictions as interface names, with a + special exception for unique connection names. A unique name's first element must start with a colon (':') character. After the colon, any characters in "[A-Z][a-z][0-9]_" may appear. Elements after the first must follow the usual rules, except that they may start with - a digit. Service names not starting with a colon have none of these + a digit. Bus names not starting with a colon have none of these exceptions and follow the same rules as interface names. </para> </sect3> @@ -966,10 +990,11 @@ implementations must not require an interface field. </para> <para> - Method call messages also include a <literal>PATH</literal> field indicating the - object to invoke the method on. If the call is passing through - a message bus, the message will also have a <literal>DESTINATION</literal> field giving - the service to receive the message. + Method call messages also include a <literal>PATH</literal> field + indicating the object to invoke the method on. If the call is passing + through a message bus, the message will also have a + <literal>DESTINATION</literal> field giving the name of the connection + to receive the message. </para> <para> When an application handles a method call message, it is expected to @@ -1002,14 +1027,13 @@ flag and reply anyway. </para> <para> - If a message has the flag <literal>AUTO_ACTIVATION</literal>, then the addressed - service will be activated before the message is delivered, if - not already active. The message will be held until the service - is successfully activated or has failed to activate; in case - of failure, an activation error will be returned. Activation - is only relevant in the context of a message bus, so this - flag is ignored for one-to-one communication with no - intermediate bus. + If a message has the flag <literal>AUTO_START</literal> and the + destination name does not exist, then a program to own the destination + name will be started before the message is delivered. The message + will be held until the new program is successfully started or has + failed to start; in case of failure, an error will be returned. This + flag is only relevant in the context of a message bus, it is ignored + during one-to-one communication with no intermediate bus. </para> <sect4 id="message-protocol-types-method-apis"> <title>Mapping method calls to native APIs</title> @@ -1086,10 +1110,10 @@ This document uses a simple pseudo-IDL to describe particular method calls and signals. Here is an example of a method call: <programlisting> - org.freedesktop.DBus.ActivateService (in STRING service_name, in UINT32 flags, - out UINT32 resultcode) + org.freedesktop.DBus.StartServiceByName (in STRING name, in UINT32 flags, + out UINT32 resultcode) </programlisting> - This means <literal>INTERFACE</literal> = org.freedesktop.DBus, <literal>MEMBER</literal> = ActivateService, + This means <literal>INTERFACE</literal> = org.freedesktop.DBus, <literal>MEMBER</literal> = StartServiceByName, <literal>METHOD_CALL</literal> arguments are <literal>STRING</literal> and <literal>UINT32</literal>, <literal>METHOD_RETURN</literal> argument is <literal>UINT32</literal>. Remember that the <literal>MEMBER</literal> field can't contain any '.' (period) characters so it's known that the last part of the name in @@ -1098,14 +1122,14 @@ <para> In C++ that might end up looking like this: <programlisting> - unsigned int org::freedesktop::DBus::ActivateService (const char *service_name, - unsigned int flags); + unsigned int org::freedesktop::DBus::StartServiceByName (const char *name, + unsigned int flags); </programlisting> or equally valid, the return value could be done as an argument: <programlisting> - void org::freedesktop::DBus::ActivateService (const char *service_name, - unsigned int flags, - unsigned int *resultcode); + void org::freedesktop::DBus::StartServiceByName (const char *name, + unsigned int flags, + unsigned int *resultcode); </programlisting> It's really up to the API designer how they want to make this look. You could design an API where the namespace wasn't used @@ -1114,7 +1138,7 @@ <para> Signals are written as follows: <programlisting> - org.freedesktop.DBus.ServiceLost (STRING service_name) + org.freedesktop.DBus.NameLost (STRING name) </programlisting> Signals don't specify "in" vs. "out" because only a single direction is possible. @@ -1988,42 +2012,6 @@ </para> </sect2> - <sect2 id="standard-messages-get-props"> - <title><literal>org.freedesktop.Props.Get</literal></title> - <para> - [FIXME this is just a bogus made-up method that isn't implemented - or thought through, to save an example of table formatting for the - argument descriptions] - <programlisting> - org.freedesktop.Props.Get (in STRING property_name, - out ANY_OR_NIL property_value) - </programlisting> - Message arguments: - <informaltable> - <tgroup cols="3"> - <thead> - <row> - <entry>Argument</entry> - <entry>Type</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>0</entry> - <entry>in STRING</entry> - <entry>Name of the property to get</entry> - </row> - <row> - <entry>1</entry> - <entry>out ANY_OR_NIL</entry> - <entry>The value of the property. The type depends on the property.</entry> - </row> - </tbody> - </tgroup> - </informaltable> - </para> - </sect2> </sect1> <sect1 id="message-bus"> @@ -2032,188 +2020,316 @@ <title>Message Bus Overview</title> <para> The message bus accepts connections from one or more applications. - Once connected, applications can send and receive messages from - the message bus, as in the one-to-one case. + Once connected, applications can exchange messages with other + applications that are also connected to the bus. </para> <para> - The message bus keeps track of a set of - <firstterm>services</firstterm>. A service is simply a name, such as - <literal>com.yoyodyne.Screensaver</literal>, which can be - <firstterm>owned</firstterm> by one or more of the connected - applications. The message bus itself always owns the special service - <literal>org.freedesktop.DBus</literal>. + In order to route messages among connections, the message bus keeps a + mapping from names to connections. Each connection has one + unique-for-the-lifetime-of-the-bus name automatically assigned. + Applications may request additional names for a connection. Additional + names are usually "well-known names" such as + "org.freedesktop.TextEditor". When a name is bound to a connection, + that connection is said to <firstterm>own</firstterm> the name. </para> <para> - Services may have <firstterm>secondary owners</firstterm>. Secondary owners - of a service are kept in a queue; if the primary owner of a service - disconnects, or releases the service, the next secondary owner becomes - the new owner of the service. + The bus itself owns a special name, <literal>org.freedesktop.DBus</literal>. + This name routes messages to the bus, allowing applications to make + administrative requests. For example, applications can ask the bus + to assign a name to a connection. </para> <para> + Each name may have <firstterm>queued owners</firstterm>. When an + application requests a name for a connection and the name is already in + use, the bus will optionally add the connection to a queue waiting for + the name. If the current owner of the name disconnects or releases + the name, the next connection in the queue will become the new owner. + </para> + + <para> + This feature causes the right thing to happen if you start two text + editors for example; the first one may request "org.freedesktop.TextEditor", + and the second will be queued as a possible owner of that name. When + the first exits, the second will take over. + </para> + + <para> Messages may have a <literal>DESTINATION</literal> field (see <xref - linkend="message-protocol-header-fields"/>). When the message bus - receives a message, if the <literal>DESTINATION</literal> field is absent, the - message is taken to be a standard one-to-one message and interpreted - by the message bus itself. For example, sending - an <literal>org.freedesktop.Peer.Ping</literal> message with no - <literal>DESTINATION</literal> will cause the message bus itself to reply - to the ping immediately; the message bus would never make - this message visible to other applications. - </para> - <para> - If the <literal>DESTINATION</literal> field is present, then it indicates a - request for the message bus to route the message. In the usual case, - messages are routed to the owner of the named service. - Messages may also be <firstterm>broadcast</firstterm> - by sending them to the special service - <literal>org.freedesktop.DBus.Broadcast</literal>. Broadcast messages are - sent to all applications with <firstterm>message matching - rules</firstterm> that match the message. + linkend="message-protocol-header-fields"/>). If the + <literal>DESTINATION</literal> field is present, it specifies a message + recipient by name. Method calls and replies normally specify this field. </para> + + <para> + Signals normally do not specify a destination; they are sent to all + applications with <firstterm>message matching rules</firstterm> that + match the message. + </para> + + <para> + When the message bus receives a method call, if the + <literal>DESTINATION</literal> field is absent, the call is taken to be + a standard one-to-one message and interpreted by the message bus + itself. For example, sending an + <literal>org.freedesktop.Peer.Ping</literal> message with no + <literal>DESTINATION</literal> will cause the message bus itself to + reply to the ping immediately; the message bus will not make this + message visible to other applications. + </para> + <para> Continuing the <literal>org.freedesktop.Peer.Ping</literal> example, if the ping message were sent with a <literal>DESTINATION</literal> name of <literal>com.yoyodyne.Screensaver</literal>, then the ping would be forwarded, and the Yoyodyne Corporation screensaver application would be - expected to reply to the ping. If - <literal>org.freedesktop.Peer.Ping</literal> were sent to - <literal>org.freedesktop.DBus.Broadcast</literal>, then multiple applications - might receive the ping, and all would normally reply to it. + expected to reply to the ping. </para> </sect2> - <sect2 id="message-bus-services"> - <title>Message Bus Services</title> + <sect2 id="message-bus-names"> + <title>Message Bus Names</title> <para> - A service is a name that identifies a certain application. Each - application connected to the message bus has at least one service name - assigned at connection time and returned in response to the - <literal>org.freedesktop.DBus.Hello</literal> message. - This automatically-assigned service name is called - the application's <firstterm>base service</firstterm>. - Base service names are unique and MUST never be reused for two different - applications. + Each connection has at least one name, assigned at connection time and + returned in response to the + <literal>org.freedesktop.DBus.Hello</literal> method call. This + automatically-assigned name is called the connection's <firstterm>unique + name</firstterm>. Unique names are never reused for two different + connections to the same bus. </para> <para> - Ownership of the base service is a prerequisite for interaction with - the message bus. It logically follows that the base service is always - the first service that an application comes to own, and the last - service that it loses ownership of. + Ownership of a unique name is a prerequisite for interaction with + the message bus. It logically follows that the unique name is always + the first name that an application comes to own, and the last + one that it loses ownership of. </para> <para> - Base service names must begin with the character ':' (ASCII colon - character); service names that are not base service names must not begin + Unique connection names must begin with the character ':' (ASCII colon + character); bus names that are not unique names must not begin with this character. (The bus must reject any attempt by an application - to manually create a service name beginning with ':'.) This restriction - categorically prevents "spoofing"; messages sent to a base service name - will always go to a single application instance and that instance only. - </para> - <para> - An application can request additional service names to be associated - with it using the - <literal>org.freedesktop.DBus.AcquireService</literal> - message. [FIXME what service names are allowed; ASCII or unicode; - length limit; etc.] - </para> - <para> - [FIXME this needs more detail, and should move the service-related message - descriptions up into this section perhaps] - Service ownership handling can be specified in the flags part - of the <literal>org.freedesktop.DBus.AcquireService</literal> - message. If an application specifies the - <literal>DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT</literal> flag, then all applications - trying to acquire the service will be put in a queue. When the - primary owner disconnects from the bus or removes ownership - from the service, the next application in the queue will be the - primary owner. If the <literal>DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT</literal> - flag is not specified, then the primary owner will lose - ownership whenever another application requests ownership of the - service. - </para> - <para> - When a client disconnects from the bus, all the services that - the clients own are deleted, or in the case of a service that - prohibits replacement, ownership is transferred to the next - client in the queue, if any. + to manually request a name beginning with ':'.) This restriction + categorically prevents "spoofing"; messages sent to a unique name + will always go to the expected connection. </para> + <para> + When a connection is closed, all the names that it owns are deleted (or + transferred to the next connection in the queue if any). + </para> + <para> + A connection can request additional names to be associated with it using + the <literal>org.freedesktop.DBus.RequestName</literal> message. <xref + linkend="message-protocol-names-bus"/> describes the format of a valid + name. + </para> + + <sect3 id="bus-messages-request-name"> + <title><literal>org.freedesktop.DBus.RequestName</literal></title> + <para> + As a method: + <programlisting> + UINT32 RequestName (in STRING name, in UINT32 flags) + </programlisting> + Message arguments: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Argument</entry> + <entry>Type</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>0</entry> + <entry>STRING</entry> + <entry>Name to request</entry> + </row> + <row> + <entry>1</entry> + <entry>UINT32</entry> + <entry>Flags</entry> + </row> + </tbody> + </tgroup> + </informaltable> + Reply arguments: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Argument</entry> + <entry>Type</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>0</entry> + <entry>UINT32</entry> + <entry>Return value</entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + <para> + This method call should be sent to + <literal>org.freedesktop.DBus</literal> and asks the message bus to + assign the given name to the method caller. The flags argument + contains any of the following values logically ORed together: + + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Conventional Name</entry> + <entry>Value</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT</entry> + <entry>0x1</entry> + <entry> + If the application succeeds in becoming the owner of the specified name, + then ownership of the name can't be transferred until the application + disconnects. If this flag is not set, then any application trying to become + the owner of the name will succeed and the previous owner will be + sent a <literal>org.freedesktop.DBus.NameOwnerChanged</literal> signal. + </entry> + </row> + <row> + <entry>DBUS_NAME_FLAG_REPLACE_EXISTING</entry> + <entry>0x2</entry> + <entry> + Try to replace the current owner if there is one. If this + flag is not set the application will only become the owner of + the name if there is no current owner. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + + The return code can be one of the following values: + + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Conventional Name</entry> + <entry>Value</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER</entry> + <entry>1</entry> <entry>The caller is now the primary owner of + the name, replacing any previous owner. Either the name had no + owner before, or the caller specified + DBUS_NAME_FLAG_REPLACE_EXISTING and the current owner did not + specify DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT.</entry> + </row> + <row> + <entry>DBUS_REQUEST_NAME_REPLY_IN_QUEUE</entry> + <entry>2</entry> + <entry>The name already had an owner, DBUS_NAME_FLAG_REPLACE_EXISTING was not specified, and the current owner specified DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT.</entry> + </row> + <row> + <entry>DBUS_REQUEST_NAME_REPLY_EXISTS</entry> + <entry>3</entry> + <entry>The name already has an owner, and DBUS_NAME_FLAG_REPLACE_EXISTING was not specified.</entry> + </row> + <row> + <entry>DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER</entry> + <entry>4</entry> + <entry>The application trying to request ownership of a name is already the owner of it.</entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </sect3> </sect2> + <sect2 id="message-bus-routing"> <title>Message Bus Message Routing</title> <para> - When a message is received by the message bus, the message's - <literal>sndr</literal> header field MUST be set to the base service of - the application which sent the message. If the service already has - a <literal>sndr</literal> field, the pre-existing field is replaced. - This rule means that a replies are always sent to the base service name, - i.e. to the same application that sent the message being replied to. + FIXME </para> + </sect2> + <sect2 id="message-bus-starting-services"> + <title>Message Bus Starting Services</title> <para> - [FIXME go into detail about broadcast, multicast, unicast, etc.] + The message bus can start applications on behalf of other applications. + In CORBA terms, this would be called <firstterm>activation</firstterm>. + An application that can be started in this way is called a + <firstterm>service</firstterm>. </para> - </sect2> - <sect2 id="message-bus-activation"> - <title>Message Bus Service Activation</title> <para> - <firstterm>Activation</firstterm> means to locate a service - owner for a service that is currently unowned. For now, it - means to launch an executable that will take ownership of - a particular service. + With D-BUS, starting a service is normally done by name. That is, + applications ask the message bus to start some program that will own a + well-known name, such as <literal>org.freedesktop.TextEditor</literal>. + This implies a contract documented along with the name + <literal>org.freedesktop.TextEditor</literal> for which objects + the owner of that name will provide, and what interfaces those + objects will have. </para> <para> - To find an executable corresponding to a particular service, the bus - daemon looks for <firstterm>service description files</firstterm>. - Service description files define a mapping from service names to - executables. Different kinds of message bus will look for these files - in different places, see <xref linkend="message-bus-types"/>. + To find an executable corresponding to a particular name, the bus daemon + looks for <firstterm>service description files</firstterm>. Service + description files define a mapping from names to executables. Different + kinds of message bus will look for these files in different places, see + <xref linkend="message-bus-types"/>. </para> <para> - [FIXME the file format should be much better specified than - "similar to .desktop entries" esp. since desktop entries are - already badly-specified. ;-)] Service description files have - the ".service" file extension. The message bus will only load - service description files ending with .service; all other - files will be ignored. The file format is similar to that of - <ulink + [FIXME the file format should be much better specified than "similar to + .desktop entries" esp. since desktop entries are already + badly-specified. ;-)] Service description files have the ".service" file + extension. The message bus will only load service description files + ending with .service; all other files will be ignored. The file format + is similar to that of <ulink url="http://www.freedesktop.org/standards/desktop-entry-spec/desktop-entry-spec.html">desktop - entries</ulink>. All service description files must be in - UTF-8 encoding. To ensure that there will be no name - collisions, service files must be namespaced using the same - mechanism as messages and service names. + entries</ulink>. All service description files must be in UTF-8 + encoding. To ensure that there will be no name collisions, service files + must be namespaced using the same mechanism as messages and service + names. <figure> <title>Example service description file</title> <programlisting> # Sample service description file [D-BUS Service] - Name=org.gnome.ConfigurationDatabase + Names=org.freedesktop.ConfigurationDatabase;org.gnome.GConf; Exec=/usr/libexec/gconfd-2 </programlisting> </figure> </para> <para> - When an application requests a service to be activated, the - bus daemon tries to find it in the list of activation - entries. It then tries to spawn the executable associated with - it. If this fails, it will report an error. [FIXME what - happens if two .service files offer the same service; what - kind of error is reported, should we have a way for the client - to choose one?] + When an application asks to start a service by name, the bus daemon tries to + find a service that will own that name. It then tries to spawn the + executable associated with it. If this fails, it will report an + error. [FIXME what happens if two .service files offer the same service; + what kind of error is reported, should we have a way for the client to + choose one?] </para> <para> The executable launched will have the environment variable - <literal>DBUS_ACTIVATION_ADDRESS</literal> set to the address of the - message bus so it can connect and register the appropriate services. + <literal>DBUS_STARTER_ADDRESS</literal> set to the address of the + message bus so it can connect and request the appropriate names. </para> <para> The executable being launched may want to know whether the message bus - activating it is one of the well-known message buses (see <xref + starting it is one of the well-known message buses (see <xref linkend="message-bus-types"/>). To facilitate this, the bus MUST also set - the <literal>DBUS_ACTIVATION_BUS_TYPE</literal> environment variable if it is one + the <literal>DBUS_STARTER_BUS_TYPE</literal> environment variable if it is one of the well-known buses. The currently-defined values for this variable are <literal>system</literal> for the systemwide message bus, and <literal>session</literal> for the per-login-session message - bus. The activated executable must still connect to the address given - in <literal>DBUS_ACTIVATION_ADDRESS</literal>, but may assume that the + bus. The new executable must still connect to the address given + in <literal>DBUS_STARTER_ADDRESS</literal>, but may assume that the resulting connection is to the well-known bus. </para> <para> @@ -2262,7 +2378,7 @@ changes in the printer queue, and so forth. </para> <para> - The address of the login session message bus is given + The address of the system message bus is given in the <literal>DBUS_SYSTEM_BUS_ADDRESS</literal> environment variable. If that variable is not set, applications should try to connect to the well-known address @@ -2284,9 +2400,8 @@ <sect2 id="message-bus-messages"> <title>Message Bus Messages</title> <para> - The special message bus service <literal>org.freedesktop.DBus</literal> - responds to a number of messages, allowing applications to - interact with the message bus. + The special message bus name <literal>org.freedesktop.DBus</literal> + responds to a number of additional messages. </para> <sect3 id="bus-messages-hello"> @@ -2310,34 +2425,33 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service assigned to the application</entry> + <entry>Unique name assigned to the connection</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> - Before an application is able to send messages to other - applications it must send the - <literal>org.freedesktop.DBus.Hello</literal> message to the - message bus service. If an application tries to send a - message to another application, or a message to the message - bus service that isn't the - <literal>org.freedesktop.DBus.Hello</literal> message, it - will be disconnected from the bus. If a client wishes to - disconnect from the bus, it just has to disconnect from the - transport used. No de-registration message is necessary. + Before an application is able to send messages to other applications + it must send the <literal>org.freedesktop.DBus.Hello</literal> message + to the message bus to obtain a unique name. If an application without + a unique name tries to send a message to another application, or a + message to the message bus itself that isn't the + <literal>org.freedesktop.DBus.Hello</literal> message, it will be + disconnected from the bus. </para> <para> - The reply message contains the name of the application's base service. + There is no corresponding "disconnect" request; if a client wishes to + disconnect from the bus, it simply closes the socket (or other + communication channel). </para> </sect3> - <sect3 id="bus-messages-list-services"> - <title><literal>org.freedesktop.DBus.ListServices</literal></title> + <sect3 id="bus-messages-list-names"> + <title><literal>org.freedesktop.DBus.ListNames</literal></title> <para> As a method: <programlisting> - STRING_ARRAY ListServices () + ARRAY of STRING ListNames () </programlisting> Reply arguments: <informaltable> @@ -2352,23 +2466,23 @@ <tbody> <row> <entry>0</entry> - <entry>STRING_ARRAY</entry> - <entry>Array of strings where each string is the name of a service</entry> + <entry>ARRAY of STRING</entry> + <entry>Array of strings where each string is a bus name</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> - Returns a list of all existing services registered with the message bus. + Returns a list of all currently-owned names on the bus. </para> </sect3> - <sect3 id="bus-messages-service-exists"> - <title><literal>org.freedesktop.DBus.ServiceExists</literal></title> + <sect3 id="bus-messages-name-exists"> + <title><literal>org.freedesktop.DBus.NameHasOwner</literal></title> <para> As a method: <programlisting> - BOOLEAN ServiceExists (in STRING service_name) + BOOLEAN NameHasOwner (in STRING name) </programlisting> Message arguments: <informaltable> @@ -2384,7 +2498,7 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service</entry> + <entry>Name to check</entry> </row> </tbody> </tgroup> @@ -2403,23 +2517,23 @@ <row> <entry>0</entry> <entry>BOOLEAN</entry> - <entry>Return value, true if the service exists</entry> + <entry>Return value, true if the name exists</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> - Checks if a service with a specified name exists. + Checks if the specified name exists (currently has an owner). </para> </sect3> - <sect3 id="bus-messages-acquire-service"> - <title><literal>org.freedesktop.DBus.AcquireService</literal></title> + <sect3 id="bus-messages-name-owner-changed"> + <title><literal>org.freedesktop.DBus.NameOwnerChanged</literal></title> <para> - As a method: + This is a signal: <programlisting> - UINT32 AcquireService (in STRING service_name) + NameOwnerChanged (STRING name, STRING old_owner, STRING new_owner) </programlisting> Message arguments: <informaltable> @@ -2435,154 +2549,34 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service</entry> + <entry>Name with a new owner</entry> </row> <row> <entry>1</entry> - <entry>UINT32</entry> - <entry>Flags</entry> - </row> - </tbody> - </tgroup> - </informaltable> - Reply arguments: - <informaltable> - <tgroup cols="3"> - <thead> - <row> - <entry>Argument</entry> - <entry>Type</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>0</entry> - <entry>UINT32</entry> - <entry>Return value</entry> - </row> - </tbody> - </tgroup> - </informaltable> - </para> - <para> - Tries to become owner of a specific service. The flags - specified can be the following values logically ORed together: - - <informaltable> - <tgroup cols="3"> - <thead> - <row> - <entry>Identifier</entry> - <entry>Value</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT</entry> - <entry>0x1</entry> - <entry> - If the application succeeds in being the owner of the specified service, - then ownership of the service can't be transferred until the service - disconnects. If this flag is not set, then any application trying to become - the owner of the service will succeed and the previous owner will be - sent a <literal>org.freedesktop.DBus.ServiceLost</literal> message. - </entry> - </row> - <row> - <entry>DBUS_SERVICE_FLAGS_REPLACE_EXISTING</entry> - <entry>0x2</entry> - <entry>Try to replace the current owner if there is one. If this flag - is not set the application will only become the owner of the service if - there is no current owner.</entry> - </row> - </tbody> - </tgroup> - </informaltable> - - [FIXME if it's one of the following values, why are the values - done as flags instead of just 0, 1, 2, 3, 4] - The return value can be one of the following values: - - <informaltable> - <tgroup cols="3"> - <thead> - <row> - <entry>Identifier</entry> - <entry>Value</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>DBUS_SERVICE_REPLY_PRIMARY_OWNER</entry> - <entry>0x1</entry> - <entry>The application is now the primary owner of the service.</entry> - </row> - <row> - <entry>DBUS_SERVICE_REPLY_IN_QUEUE</entry> - <entry>0x2</entry> - <entry>The service already has an owner which do not want to give up ownership and therefore the application has been put in a queue.</entry> - </row> - <row> - <entry>DBUS_SERVICE_REPLY_SERVICE_EXISTS</entry> - <entry>0x4</entry> - <entry>The service does already have a primary owner, and DBUS_SERVICE_FLAG_REPLACE_EXISTING was not specified when trying to acquire the service.</entry> - </row> - <row> - <entry>DBUS_SERVICE_REPLY_ALREADY_OWNER</entry> - <entry>0x8</entry> - <entry>The application trying to request ownership of the service is already the owner of it.</entry> + <entry>STRING</entry> + <entry>Old owner or empty string if none</entry> </row> - </tbody> - </tgroup> - </informaltable> - </para> - </sect3> - <sect3 id="bus-messages-service-acquired"> - <title><literal>org.freedesktop.DBus.ServiceAcquired</literal></title> - <para> - As a method: - <programlisting> - ServiceAcquired (in STRING service_name) - </programlisting> - Message arguments: - <informaltable> - <tgroup cols="3"> - <thead> - <row> - <entry>Argument</entry> - <entry>Type</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>0</entry> - <entry>STRING</entry> - <entry>Name of the service</entry> - </row> <row> - <entry>1</entry> - <entry>UINT32</entry> - <entry>Flags</entry> + <entry>2</entry> + <entry>STRING</entry> + <entry>New owner or empty string if none</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> - This message is sent to a specific application when it becomes the - primary owner of a service. + This signal indicates that the owner of a name has changed. + It's also the signal to use to detect the appearance of + new names on the bus. </para> </sect3> - <sect3 id="bus-messages-service-lost"> - <title><literal>org.freedesktop.DBus.ServiceLost</literal></title> + <sect3 id="bus-messages-name-lost"> + <title><literal>org.freedesktop.DBus.NameLost</literal></title> <para> - As a method: + This is a signal: <programlisting> - ServiceLost (in STRING service_name) + NameLost (STRING name) </programlisting> Message arguments: <informaltable> @@ -2598,28 +2592,24 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service</entry> + <entry>Name which was lost</entry> </row> - <row> - <entry>1</entry> - <entry>UINT32</entry> - <entry>Flags</entry> - </row> </tbody> </tgroup> </informaltable> </para> <para> - This message is sent to a specific application when it loses primary - ownership of a service. + This signal is sent to a specific application when it loses + ownership of a name. </para> </sect3> - <sect3 id="bus-messages-service-owner-changed"> - <title><literal>org.freedesktop.DBus.ServiceOwnerChanged</literal></title> + <sect3 id="bus-messages-name-acquired"> + <title><literal>org.freedesktop.DBus.NameAcquired</literal></title> <para> + This is a signal: <programlisting> - ServiceOwnerChanged (STRING service_name, STRING old_owner, STRING new_owner) + NameAcquired (STRING name) </programlisting> Message arguments: <informaltable> @@ -2635,37 +2625,24 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service</entry> + <entry>Name which was acquired</entry> </row> - <row> - <entry>1</entry> - <entry>STRING</entry> - <entry>Base service of previous owner, empty string if the - service is newly created</entry> - </row> - <row> - <entry>2</entry> - <entry>STRING</entry> - <entry>Base service of new owner, empty string if the - service is no longer available</entry> - </row> </tbody> </tgroup> </informaltable> </para> <para> - This message is broadcast to all applications when a service has been - successfully registered on the message bus, has been deleted - or its primary owner has changed. + This signal is sent to a specific application when it gains + ownership of a name. </para> </sect3> - <sect3 id="bus-messages-activate-service"> - <title><literal>org.freedesktop.DBus.ActivateService</literal></title> + <sect3 id="bus-messages-start-service-by-name"> + <title><literal>org.freedesktop.DBus.StartServiceByName</literal></title> <para> As a method: <programlisting> - UINT32 ActivateService (in STRING service_name, in UINT32 flags) + UINT32 StartServiceByName (in STRING name, in UINT32 flags) </programlisting> Message arguments: <informaltable> @@ -2681,7 +2658,7 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service to activate</entry> + <entry>Name of the service to start</entry> </row> <row> <entry>1</entry> @@ -2710,15 +2687,12 @@ </tbody> </tgroup> </informaltable> - Tries to launch the executable associated with a service. For more information, see <xref linkend="message-bus-activation"/>. + Tries to launch the executable associated with a name. For more information, see <xref linkend="message-bus-starting-services"/>. - [FIXME need semantics in much more detail here; for example, - if I activate a service then send it a message, is the message - queued for the new service or is there a race] </para> <para> The return value can be one of the following values: - <informaltable> + <informaltable> <tgroup cols="3"> <thead> <row> @@ -2729,14 +2703,14 @@ </thead> <tbody> <row> - <entry>DBUS_ACTIVATION_REPLY_ACTIVATED</entry> - <entry>0x0</entry> - <entry>The service was activated successfully.</entry> + <entry>DBUS_START_REPLY_SUCCESS</entry> + <entry>1</entry> + <entry>The service was successfully started.</entry> </row> <row> - <entry>DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE</entry> - <entry>0x1</entry> - <entry>The service is already active.</entry> + <entry>DBUS_START_REPLY_ALREADY_RUNNING</entry> + <entry>2</entry> + <entry>A connection already owns the given name.</entry> </row> </tbody> </tgroup> @@ -2745,12 +2719,12 @@ </sect3> - <sect3 id="bus-messages-get-service-owner"> - <title><literal>org.freedesktop.DBus.GetServiceOwner</literal></title> + <sect3 id="bus-messages-get-name-owner"> + <title><literal>org.freedesktop.DBus.GetNameOwner</literal></title> <para> As a method: <programlisting> - STRING GetServiceOwner (in STRING service_name) + STRING GetNameOwner (in STRING name) </programlisting> Message arguments: <informaltable> @@ -2766,7 +2740,7 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the service to query</entry> + <entry>Name to get the owner of</entry> </row> </tbody> </tgroup> @@ -2785,15 +2759,14 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Return value, a base service name</entry> + <entry>Return value, a unique connection name</entry> </row> </tbody> </tgroup> </informaltable> - Returns the base service name of the primary owner of the - service in argument. If the requested service isn't active, - returns a - <literal>org.freedesktop.DBus.Error.ServiceHasNoOwner</literal> error. + Returns the unique connection name of the primary owner of the name + given. If the requested name doesn't have an owner, returns a + <literal>org.freedesktop.DBus.Error.NameHasNoOwner</literal> error. </para> </sect3> @@ -2818,7 +2791,7 @@ <row> <entry>0</entry> <entry>STRING</entry> - <entry>Name of the connection/service to query</entry> + <entry>Name of the connection to query</entry> </row> </tbody> </tgroup> @@ -2848,31 +2821,6 @@ </para> </sect3> - <sect3 id="bus-messages-out-of-memory"> - <title><literal>org.freedesktop.DBus.Error.NoMemory</literal></title> - <para> - As a method: - <programlisting> - void NoMemory () - </programlisting> - </para> - <para> - Sent by the message bus when it can't process a message due to an out of memory failure. - </para> - </sect3> - - <sect3 id="bus-messages-service-does-not-exist"> - <title><literal>org.freedesktop.DBus.Error.ServiceDoesNotExist</literal></title> - <para> - As a method: - <programlisting> - void ServiceDoesNotExist (in STRING error) - </programlisting> - </para> - <para> - Sent by the message bus as a reply to a client that tried to send a message to a service that doesn't exist. - </para> - </sect3> </sect2> </sect1> @@ -2892,32 +2840,22 @@ This glossary defines some of the terms used in this specification. </para> - <glossentry id="term-activation"><glossterm>Activation</glossterm> + <glossentry id="term-bus-name"><glossterm>Bus Name</glossterm> <glossdef> <para> - The process of creating an owner for a particular service, - typically by launching an executable. - </para> - </glossdef> - </glossentry> - - <glossentry id="term-base-service"><glossterm>Base Service</glossterm> - <glossdef> - <para> - The special service automatically assigned to an application by the - message bus. This service may never change owner, and the service - name will be unique (never reused during the lifetime of the - message bus). - </para> - </glossdef> - </glossentry> - - <glossentry id="term-broadcast"><glossterm>Broadcast</glossterm> - <glossdef> - <para> - A message sent to the special <literal>org.freedesktop.DBus.Broadcast</literal> - service; the message bus will forward the broadcast message - to all applications that have expressed interest in it. + The message bus maintains an association between names and + connections. (Normally, there's one connection per application.) A + bus name is simply an identifier used to locate connections. For + example, the hypothetical <literal>com.yoyodyne.Screensaver</literal> + name might be used to send a message to a screensaver from Yoyodyne + Corporation. An application is said to <firstterm>own</firstterm> a + name if the message bus has associated the application's connection + with the name. Names may also have <firstterm>queued + owners</firstterm> (see <xref linkend="term-queued-owner"/>). + The bus assigns a unique name to each connection, + see <xref linkend="term-unique-name"/>. Other names + can be thought of as "well-known names" and are + used to find applications that offer specific functionality. </para> </glossdef> </glossentry> @@ -2937,9 +2875,20 @@ <glossdef> <para> The message bus is a special application that forwards - or broadcasts messages between a group of applications + or routes messages between a group of applications connected to the message bus. It also manages - <firstterm>services</firstterm>. + <firstterm>names</firstterm> used for routing + messages. + </para> + </glossdef> + </glossentry> + + <glossentry id="term-name"><glossterm>Name</glossterm> + <glossdef> + <para> + See <xref linkend="term-bus-name"/>. "Name" may + also be used to refer to some of the other names + in D-BUS, such as interface names. </para> </glossdef> </glossentry> @@ -2947,9 +2896,9 @@ <glossentry id="namespace"><glossterm>Namespace</glossterm> <glossdef> <para> - Used to prevent collisions when defining message and service - names. The convention used is the same as Java uses for - defining classes: a reversed domain name. + Used to prevent collisions when defining new interfaces or bus + names. The convention used is the same one Java uses for defining + classes: a reversed domain name. </para> </glossdef> </glossentry> @@ -2957,73 +2906,80 @@ <glossentry id="term-object"><glossterm>Object</glossterm> <glossdef> <para> - Each application contains <firstterm>objects</firstterm>, - which have <firstterm>interfaces</firstterm> and - <firstterm>methods</firstterm>. Objects are referred to - by a name, called a <firstterm>path</firstterm> or - <firstterm>object reference</firstterm>. + Each application contains <firstterm>objects</firstterm>, which have + <firstterm>interfaces</firstterm> and + <firstterm>methods</firstterm>. Objects are referred to by a name, + called a <firstterm>path</firstterm>. </para> </glossdef> </glossentry> - <glossentry id="term-path"><glossterm>Path</glossterm> + <glossentry id="one-to-one"><glossterm>One-to-One</glossterm> <glossdef> - <para> - Object references (object names) in D-BUS are - organized into a filesystem-style hierarchy, so - each object is named by a path. As in LDAP, - there's no difference between "files" and "directories"; - a path can refer to an object, while still having - child objects below it. + <para> + An application talking directly to another application, without going + through a message bus. One-to-one connections may be "peer to peer" or + "client to server." The D-BUS protocol has no concept of client + vs. server after a connection has authenticated; the flow of messages + is symmetrical (full duplex). </para> </glossdef> </glossentry> - <glossentry id="one-to-one"><glossterm>One-to-One</glossterm> + <glossentry id="term-path"><glossterm>Path</glossterm> <glossdef> - <para> - An application talking directly to another application, without going through a message bus. + <para> + Object references (object names) in D-BUS are organized into a + filesystem-style hierarchy, so each object is named by a path. As in + LDAP, there's no difference between "files" and "directories"; a path + can refer to an object, while still having child objects below it. </para> </glossdef> </glossentry> - <glossentry id="term-secondary-owner"><glossterm>Secondary service owner</glossterm> + + <glossentry id="term-queued-owner"><glossterm>Queued Name Owner</glossterm> <glossdef> <para> - Each service has a primary owner; messages sent to the service name - go to the primary owner. However, certain services also maintain - a queue of secondary owners "waiting in the wings." If - the primary owner releases the service, then the first secondary - owner in the queue automatically becomes the primary owner. + Each bus name has a primary owner; messages sent to the name go to the + primary owner. However, certain names also maintain a queue of + secondary owners "waiting in the wings." If the primary owner releases + the name, then the first secondary owner in the queue automatically + becomes the new owner of the name. </para> </glossdef> </glossentry> + <glossentry id="term-service"><glossterm>Service</glossterm> <glossdef> <para> - A service is simply a named list of applications. For example, the - hypothetical <literal>com.yoyodyne.Screensaver</literal> service might - accept messages that affect a screensaver from Yoyodyne Corporation. - An application is said to <firstterm>own</firstterm> a service if the - message bus has associated the application with the service name. - Services may also have <firstterm>secondary owners</firstterm> (see - <xref linkend="term-secondary-owner"/>). + A service is an executable that can be launched by the bus daemon. + Services normally guarantee some particular features, for example they + may guarantee that they will request a specific name such as + "org.freedesktop.Screensaver", have a singleton object + "/org/freedesktop/Application", and that object will implement the + interface "org.freedesktop.ScreensaverControl". </para> </glossdef> </glossentry> - <glossentry id="term-service-name"><glossterm>Service name</glossterm> + + <glossentry id="term-service-description-files"><glossterm>Service Description Files</glossterm> <glossdef> - <para> - The name used when referring to a service. If the service is - a base service it has a unique service name, for example - ":1-20", and otherwise it should be namespaced. + <para> + ".service files" tell the bus about service applications that can be + launched (see <xref linkend="term-service"/>). Most importantly they + provide a mapping from bus names to services that will request those + names when they start up. </para> </glossdef> </glossentry> - <glossentry id="term-service-description-files"><glossterm>Service Description Files</glossterm> + + <glossentry id="term-unique-name"><glossterm>Unique Connection Name</glossterm> <glossdef> <para> - ".service files" tell the bus how to activate a particular service. - See <xref linkend="term-activation"/> + The special name automatically assigned to each connection by the + message bus. This name will never change owner, and will be unique + (never reused during the lifetime of the message bus). + It will begin with a ':' character. </para> </glossdef> </glossentry> diff --git a/doc/dbus-tutorial.xml b/doc/dbus-tutorial.xml index 6d1b7f3b..44f2f7ca 100644 --- a/doc/dbus-tutorial.xml +++ b/doc/dbus-tutorial.xml @@ -7,8 +7,8 @@ <article id="index"> <articleinfo> <title>D-BUS Tutorial</title> - <releaseinfo>Version 0.2</releaseinfo> - <date>10 August 2004</date> + <releaseinfo>Version 0.3</releaseinfo> + <date>18 January 2005</date> <authorgroup> <author> <firstname>Havoc</firstname> @@ -296,8 +296,8 @@ </para> </sect2> - <sect2 id="services"> - <title>Services</title> + <sect2 id="bus-names"> + <title>Bus Names</title> <para> Object paths, interfaces, and messages exist on the level of @@ -306,55 +306,55 @@ </para> <para> - Services, on the other hand, are a property of the message bus daemon. - A <firstterm>service</firstterm> is simply a name mapped to - some application connected to the message bus daemon. + Bus names, on the other hand, are a property of the message bus daemon. + The bus maintains a mapping from names to message bus connections. These names are used to specify the origin and destination of messages passing through the message bus. When a name is mapped - to a particular application, the application is said to - <firstterm>own</firstterm> that service. + to a particular application's connection, that application is said to + <firstterm>own</firstterm> that name. </para> <para> On connecting to the bus daemon, each application immediately owns a - special name called the <firstterm>base service</firstterm>. A base - service begins with a ':' (colon) character; no other services are - allowed to begin with that character. Base services are special because - each one is unique. They are created dynamically, and are never re-used - during the lifetime of the same bus daemon. You know that a given - base service name will have the same owner at all times. - An example of a base service name might be <literal>:34-907</literal>. + special name called the <firstterm>unique connection name</firstterm>. + A unique name begins with a ':' (colon) character; no other names are + allowed to begin with that character. Unique names are special because + they are created dynamically, and are never re-used during the lifetime + of the same bus daemon. You know that a given unique name will have the + same owner at all times. An example of a unique name might be + <literal>:34-907</literal>. The numbers after the colon have + no meaning other than their uniqueness. </para> <para> Applications may ask to own additional <firstterm>well-known - services</firstterm>. For example, you could write a specification to - define a service called <literal>com.mycompany.TextEditor</literal>. - Your definition could specify that to own this service, an application + names</firstterm>. For example, you could write a specification to + define a name called <literal>com.mycompany.TextEditor</literal>. + Your definition could specify that to own this name, an application should have an object at the path <literal>/com/mycompany/TextFileManager</literal> supporting the interface <literal>org.freedesktop.FileHandler</literal>. </para> <para> - Applications could then send messages to this service, + Applications could then send messages to this bus name, object, and interface to execute method calls. </para> <para> - You could think of the base service names as IP addresses, and the - well-known services as domain names. So + You could think of the unique names as IP addresses, and the + well-known names as domain names. So <literal>com.mycompany.TextEditor</literal> might map to something like <literal>:34-907</literal> just as <literal>mycompany.com</literal> maps to something like <literal>192.168.0.5</literal>. </para> <para> - Services have a second important use, other than routing messages. They + Names have a second important use, other than routing messages. They are used to track lifecycle. When an application exits (or crashes), its connection to the message bus will be closed by the operating system kernel. The message bus then sends out notification messages telling - remaining applications that the application's services have lost their + remaining applications that the application's names have lost their owner. By tracking these notifications, your application can reliably monitor the lifetime of other applications. </para> @@ -408,12 +408,12 @@ method call on a particular object instance, a number of nested components have to be named: <programlisting> - Address -> [Service] -> Path -> Interface -> Method + Address -> [Bus Name] -> Path -> Interface -> Method </programlisting> - The service is in brackets to indicate that it's optional -- you only - provide a service name to route the method call to the right application + The bus name is in brackets to indicate that it's optional -- you only + provide a name to route the method call to the right application when using the bus daemon. If you have a direct connection to another - application, services aren't used; there's no bus daemon. + application, bus names aren't used; there's no bus daemon. </para> <para> @@ -455,8 +455,8 @@ main (int argc, char **argv) GError *error; DBusGProxy *proxy; DBusGPendingCall *call; - char **service_list; - int service_list_len; + char **name_list; + int name_list_len; int i; g_type_init (); @@ -472,24 +472,24 @@ main (int argc, char **argv) exit (1); } - /* Create a proxy object for the "bus driver" (service org.freedesktop.DBus) */ + /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */ - proxy = dbus_g_proxy_new_for_service (connection, - DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, - DBUS_PATH_ORG_FREEDESKTOP_DBUS, - DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS); + proxy = dbus_g_proxy_new_for_name (connection, + DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, + DBUS_PATH_ORG_FREEDESKTOP_DBUS, + DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS); - /* Call ListServices method */ + /* Call ListNames method */ - call = dbus_g_proxy_begin_call (proxy, "ListServices", DBUS_TYPE_INVALID); + call = dbus_g_proxy_begin_call (proxy, "ListNames", DBUS_TYPE_INVALID); error = NULL; if (!dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, - &service_list, &service_list_len, + &name_list, &name_list_len, DBUS_TYPE_INVALID)) { - g_printerr ("Failed to complete ListServices call: %s\n", + g_printerr ("Failed to complete ListNames call: %s\n", error->message); g_error_free (error); exit (1); @@ -497,17 +497,17 @@ main (int argc, char **argv) /* Print the results */ - g_print ("Services on the message bus:\n"); + g_print ("Names on the message bus:\n"); i = 0; - while (i < service_list_len) + while (i < name_list_len) { - g_assert (service_list[i] != NULL); - g_print (" %s\n", service_list[i]); + g_assert (name_list[i] != NULL); + g_print (" %s\n", name_list[i]); ++i; } - g_assert (service_list[i] == NULL); + g_assert (name_list[i] == NULL); - g_strfreev (service_list); + g_strfreev (name_list); return 0; } diff --git a/doc/diagram.png b/doc/diagram.png Binary files differnew file mode 100644 index 00000000..5cb84a99 --- /dev/null +++ b/doc/diagram.png diff --git a/doc/diagram.svg b/doc/diagram.svg new file mode 100644 index 00000000..193c5679 --- /dev/null +++ b/doc/diagram.svg @@ -0,0 +1,590 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" +"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + id="svg1" + sodipodi:version="0.32" + inkscape:version="0.39" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://web.resource.org/cc/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + width="841.88975pt" + height="595.27559pt" + sodipodi:docbase="/home/hp/dbus-cvs/dbus/doc" + sodipodi:docname="diagram.svg"> + <defs + id="defs3"> + <marker + style="overflow:visible;" + id="Arrow1M" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow1M"> + <path + transform="scale(0.4)" + style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + id="path3519" + sodipodi:nodetypes="ccccc" /> + </marker> + <marker + style="overflow:visible;" + id="Arrow2L" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow2L"> + <path + transform="scale(1.1) translate(-5,0)" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;" + id="path3515" + sodipodi:nodetypes="cccc" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.90210318" + inkscape:cx="420.94487" + inkscape:cy="297.63779" + inkscape:window-width="1024" + inkscape:window-height="701" + showgrid="false" + inkscape:grid-bbox="false" + inkscape:grid-points="true" + inkscape:window-x="0" + inkscape:window-y="24" + gridspacingy="2.5000000mm" + gridspacingx="2.5000000mm" + showguides="true" + inkscape:guide-bbox="true"> + <sodipodi:guide + orientation="horizontal" + position="268.85797" + id="guide3566" /> + <sodipodi:guide + orientation="horizontal" + position="294.31223" + id="guide4235" /> + <sodipodi:guide + orientation="horizontal" + position="300.40909" + id="guide4882" /> + </sodipodi:namedview> + <metadata + id="metadata4"> + <rdf:RDF + id="RDF5"> + <cc:Work + rdf:about="" + id="Work6"> + <dc:format + id="format7">image/svg+xml</dc:format> + <dc:type + id="type9" + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:3.7500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;" + id="rect908" + width="325.23203" + height="354.33072" + x="17.716536" + y="372.04724" /> + <text + xml:space="preserve" + style="font-size:18.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="70.778252" + y="712.73920" + id="text1532" + sodipodi:linespacing="100%"><tspan + id="tspan1533">Application Process 1</tspan></text> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.5000000 2.5000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect1535" + width="148.46259" + height="46.656849" + x="106.29921" + y="378.54001" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="180.61389" + y="400.40048" + id="text2158" + sodipodi:linespacing="100%"><tspan + id="tspan2159">DBusConnection</tspan><tspan + sodipodi:role="line" + id="tspan2161" + x="180.61389" + y="414.40048">Instance</tspan></text> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.9950929;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.9950928 2.9950928 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect2170" + width="148.46259" + height="66.966240" + x="28.702768" + y="549.21259" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="103.01745" + y="577.56586" + id="text2171" + sodipodi:linespacing="100%"><tspan + x="103.01745" + y="577.56586" + sodipodi:role="line" + id="tspan2176">C/C++/Python/etc.</tspan><tspan + x="103.01745" + y="591.56586" + sodipodi:role="line" + id="tspan2178">Object Instance</tspan></text> + <path + style="fill:#000000;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + id="path3535" + d="M 98.938952,408.61479 C 98.744753,409.20303 97.917886,409.67295 97.440945,410.11435 C 95.534947,411.94763 94.266934,414.11555 93.172614,416.33858 C 91.902056,419.02725 90.969281,421.79944 90.107252,424.59229 C 89.589105,426.27374 88.983534,427.90634 88.266907,429.53700 C 87.919667,430.33438 87.622593,431.17598 87.120464,431.91970 C 86.832222,432.30665 86.469422,432.65145 86.167985,433.03184 C 86.015931,433.22254 85.868997,433.41563 85.722131,433.60898 L 82.914336,433.11743 C 83.063402,432.91879 83.213428,432.72069 83.368121,432.52498 C 83.654681,432.15308 83.980737,431.80834 84.285389,431.44731 C 84.811957,430.77175 85.122523,429.97914 85.482400,429.23872 C 86.253056,427.64929 86.903084,426.03861 87.474578,424.39321 C 88.439548,421.58552 89.442843,418.78792 90.703938,416.05898 C 91.810966,413.77525 92.999191,411.45961 94.849464,409.50748 C 95.094704,409.24876 96.091789,407.90149 95.865737,408.61479 L 98.938952,408.61479 z " /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;" + x="34.109497" + y="446.13382" + id="text3536"><tspan + id="tspan3537">Locate Object</tspan><tspan + sodipodi:role="line" + id="tspan3539" + x="34.109497" + y="458.13382">via Object Path</tspan></text> + <path + style="fill:#000000;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + id="path3541" + d="M 60.509867,462.78767 C 60.704066,463.37591 61.530933,463.84583 62.007874,464.28723 C 63.913872,466.12051 65.181885,468.28843 66.276205,470.51146 C 67.546763,473.20013 68.479538,475.97232 69.341567,478.76517 C 69.859714,480.44662 70.465285,482.07922 71.181912,483.70988 C 71.529152,484.50726 71.826226,485.34886 72.328355,486.09258 C 72.616597,486.47953 72.979397,486.82433 73.280834,487.20472 C 73.432888,487.39542 73.579822,487.58851 73.726688,487.78186 L 76.534483,487.29031 C 76.385417,487.09167 76.235391,486.89357 76.080698,486.69786 C 75.794138,486.32596 75.468082,485.98122 75.163430,485.62019 C 74.636862,484.94463 74.326296,484.15202 73.966419,483.41160 C 73.195763,481.82217 72.545735,480.21149 71.974241,478.56609 C 71.009271,475.75840 70.005976,472.96080 68.744881,470.23186 C 67.637853,467.94813 66.449628,465.63249 64.599355,463.68036 C 64.354115,463.42164 63.357030,462.07437 63.583082,462.78767 L 60.509867,462.78767 z " /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="49.100315" + y="501.60959" + id="text3542" + sodipodi:linespacing="100%"><tspan + x="49.100315" + y="501.60959" + sodipodi:role="line" + id="tspan3547">Bindings Marshal</tspan><tspan + x="49.100315" + y="513.60959" + sodipodi:role="line" + id="tspan3549">to Method Call</tspan></text> + <path + style="fill:#000000;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + id="path3551" + d="M 95.295239,519.43211 C 95.101039,520.02035 94.274169,520.49027 93.797229,520.93167 C 91.891239,522.76495 90.623219,524.93287 89.528899,527.15590 C 88.258339,529.84457 87.325569,532.61676 86.463539,535.40961 C 85.945389,537.09106 85.339819,538.72366 84.623199,540.35432 C 84.275959,541.15170 83.978879,541.99330 83.476749,542.73702 C 83.188509,543.12397 82.825709,543.46877 82.524269,543.84916 C 82.372219,544.03986 82.225289,544.23295 82.078419,544.42630 L 79.270619,543.93475 C 79.419689,543.73611 79.569719,543.53801 79.724409,543.34230 C 80.010969,542.97040 80.337029,542.62566 80.641679,542.26463 C 81.168249,541.58907 81.478809,540.79646 81.838689,540.05604 C 82.609339,538.46661 83.259369,536.85593 83.830869,535.21053 C 84.795839,532.40284 85.799129,529.60524 87.060229,526.87630 C 88.167249,524.59257 89.355479,522.27693 91.205749,520.32480 C 91.450989,520.06608 92.448079,518.71881 92.222029,519.43211 L 95.295239,519.43211 z " /> + <path + style="fill:#000000;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + id="path3552" + d="M 261.83533,408.61479 C 262.02953,409.20303 262.85640,409.67295 263.33334,410.11435 C 265.23934,411.94763 266.50735,414.11555 267.60167,416.33858 C 268.87223,419.02725 269.80501,421.79944 270.66703,424.59229 C 271.18518,426.27374 271.79075,427.90634 272.50738,429.53700 C 272.85462,430.33438 273.15169,431.17598 273.65382,431.91970 C 273.94206,432.30665 274.30486,432.65145 274.60630,433.03184 C 274.75836,433.22254 274.90529,433.41563 275.05216,433.60898 L 277.85995,433.11743 C 277.71088,432.91879 277.56086,432.72069 277.40617,432.52498 C 277.11961,432.15308 276.79355,431.80834 276.48890,431.44731 C 275.96233,430.77175 275.65176,429.97914 275.29189,429.23872 C 274.52123,427.64929 273.87120,426.03861 273.29971,424.39321 C 272.33474,421.58552 271.33144,418.78792 270.07035,416.05898 C 268.96332,413.77525 267.77510,411.45961 265.92482,409.50748 C 265.67958,409.24876 264.68250,407.90149 264.90855,408.61479 L 261.83533,408.61479 z " /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="223.98749" + y="446.13382" + id="text3553" + sodipodi:linespacing="100%"><tspan + x="223.98749" + y="446.13382" + sodipodi:role="line" + id="tspan3562">Marshal Method</tspan><tspan + x="223.98749" + y="458.13382" + sodipodi:role="line" + id="tspan3564">Call to Message</tspan></text> + <path + style="fill:#000000;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + id="path3567" + d="M 278.96485,463.29453 C 278.77065,463.88277 277.94378,464.35269 277.46684,464.79409 C 275.56085,466.62737 274.29283,468.79529 273.19851,471.01832 C 271.92795,473.70699 270.99518,476.47918 270.13315,479.27203 C 269.61500,480.95348 269.00943,482.58608 268.29281,484.21674 C 267.94557,485.01412 267.64849,485.85572 267.14636,486.59944 C 266.85812,486.98639 266.49532,487.33119 266.19388,487.71158 C 266.04183,487.90228 265.89490,488.09537 265.74803,488.28872 L 262.94023,487.79717 C 263.08930,487.59853 263.23933,487.40043 263.39402,487.20472 C 263.68058,486.83282 264.00664,486.48808 264.31129,486.12705 C 264.83786,485.45149 265.14842,484.65888 265.50830,483.91846 C 266.27895,482.32903 266.92898,480.71835 267.50048,479.07295 C 268.46545,476.26526 269.46874,473.46766 270.72984,470.73872 C 271.83686,468.45499 273.02509,466.13935 274.87536,464.18722 C 275.12060,463.92850 276.11769,462.58123 275.89164,463.29453 L 278.96485,463.29453 z " /> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.7377086;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.7377084 2.7377084 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect3568" + width="124.01746" + height="66.979813" + x="189.79265" + y="495.08902" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="248.94049" + y="523.44220" + id="text3569" + sodipodi:linespacing="100%"><tspan + x="248.94049" + y="523.44220" + sodipodi:role="line" + id="tspan3574">Bindings Proxy</tspan><tspan + x="248.94049" + y="537.44220" + sodipodi:role="line" + id="tspan3576">Object Instance</tspan></text> + <path + style="fill:#000000;fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + id="path3578" + d="M 259.03547,566.92913 C 259.22967,567.51737 260.05653,567.98729 260.53348,568.42869 C 262.43947,570.26197 263.70749,572.42989 264.80181,574.65292 C 266.07236,577.34159 267.00514,580.11378 267.86717,582.90663 C 268.38532,584.58808 268.99089,586.22068 269.70751,587.85134 C 270.05475,588.64872 270.35183,589.49032 270.85396,590.23404 C 271.14220,590.62099 271.50500,590.96579 271.80644,591.34618 C 271.95849,591.53688 272.10542,591.72997 272.25229,591.92332 L 275.06008,591.43177 C 274.91102,591.23313 274.76099,591.03503 274.60630,590.83932 C 274.31974,590.46742 273.99368,590.12268 273.68903,589.76165 C 273.16246,589.08609 272.85190,588.29348 272.49202,587.55306 C 271.72136,585.96363 271.07134,584.35295 270.49984,582.70755 C 269.53487,579.89986 268.53158,577.10226 267.27048,574.37332 C 266.16345,572.08959 264.97523,569.77395 263.12496,567.82182 C 262.87972,567.56310 261.88263,566.21583 262.10868,566.92913 L 259.03547,566.92913 z " /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="217.40741" + y="607.90881" + id="text3579" + sodipodi:linespacing="100%"><tspan + x="217.40741" + y="607.90881" + sodipodi:role="line" + id="tspan3584">Application Code</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.96172028pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 26.574803,408.60009 C 26.574803,539.68912 26.574803,539.68911 26.574803,531.49606" + id="path3586" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="25.977146" + y="386.45212" + id="text4220" + sodipodi:linespacing="100%"><tspan + id="tspan4221">Incoming</tspan><tspan + sodipodi:role="line" + id="tspan4223" + x="25.977146" + y="398.45212">Call</tspan></text> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:end;writing-mode:lr;" + x="335.61411" + y="386.45212" + id="text4226" + sodipodi:linespacing="100%"><tspan + x="335.61411" + y="386.45212" + sodipodi:role="line" + id="tspan4231">Outgoing</tspan><tspan + x="335.61411" + y="398.45212" + sodipodi:role="line" + id="tspan4233">Call</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.96172028pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-start:url(#Arrow1M);marker-end:none;" + d="M 327.75591,416.33858 C 327.75591,547.42761 327.75591,547.42760 327.75591,539.23455" + id="path4236" + sodipodi:nodetypes="cc" /> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:5.7914310;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;" + id="rect4870" + width="885.86591" + height="310.27252" + x="88.582680" + y="8.8582621" /> + <text + xml:space="preserve" + style="font-size:18.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="515.42737" + y="305.44489" + id="text4871" + sodipodi:linespacing="100%"><tspan + x="515.42737" + y="305.44489" + sodipodi:role="line" + id="tspan4874">Bus Daemon Process</tspan></text> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:3.7500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;" + id="rect4876" + width="325.23203" + height="354.33072" + x="708.66144" + y="373.08359" /> + <text + xml:space="preserve" + style="font-size:18.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="761.72314" + y="713.77551" + id="text4877" + sodipodi:linespacing="100%"><tspan + x="761.72314" + y="713.77551" + sodipodi:role="line" + id="tspan4880">Application Process 2</tspan></text> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="823.49664" + y="505.18018" + id="text4883" + sodipodi:linespacing="100%"><tspan + x="823.49664" + y="505.18018" + sodipodi:role="line" + id="tspan4888">Same Stuff as in</tspan><tspan + x="823.49664" + y="517.18018" + sodipodi:role="line" + id="tspan4890">Process 1</tspan></text> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="47.891071" + y="638.05420" + id="text4892" + sodipodi:linespacing="100%"><tspan + x="47.891071" + y="638.05420" + sodipodi:role="line" + id="tspan4901">(Object Instance Has</tspan><tspan + x="47.891071" + y="650.05420" + sodipodi:role="line" + id="tspan4903">1 or More Interfaces)</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;marker-start:url(#Arrow1M);marker-end:url(#Arrow1M);stroke-dasharray:none;" + d="M 162.57260,358.02041 C 165.25213,354.60516 186.01858,328.13688 184.00893,330.69832" + id="path4905" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;" + x="190.57170" + y="342.62018" + id="text5539"><tspan + id="tspan5540">Socket</tspan><tspan + sodipodi:role="line" + id="tspan5544" + x="190.57170" + y="354.62018">(Bidirectional Message Stream)</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.2500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;marker-start:url(#Arrow1M);marker-end:url(#Arrow1M);" + d="M 827.53876,363.18897 C 824.85916,359.77372 804.09276,333.30544 806.10236,335.86688" + id="path5546" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;" + x="840.79150" + y="345.73135" + id="text5547"><tspan + id="tspan5548">Socket</tspan><tspan + sodipodi:role="line" + id="tspan5550" + x="840.79150" + y="357.73135">(Bidirectional Message Stream)</tspan></text> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.5000000 2.5000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect5552" + width="148.46259" + height="46.656849" + x="124.01575" + y="263.38251" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="198.33043" + y="285.24298" + id="text5553" + sodipodi:linespacing="100%"><tspan + id="tspan5554">DBusConnection</tspan><tspan + sodipodi:role="line" + id="tspan5556" + x="198.33043" + y="299.24298">Instance</tspan></text> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.5000000 2.5000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect5558" + width="148.46259" + height="46.656849" + x="719.64764" + y="263.38251" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="793.96234" + y="285.24298" + id="text5559" + sodipodi:linespacing="100%"><tspan + id="tspan5560">DBusConnection</tspan><tspan + sodipodi:role="line" + id="tspan5562" + x="793.96234" + y="299.24298">Instance</tspan></text> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.5000000 2.5000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect5564" + width="148.46259" + height="46.656849" + x="763.77222" + y="378.54001" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="838.08691" + y="400.40048" + id="text5565" + sodipodi:linespacing="100%"><tspan + id="tspan5566">DBusConnection</tspan><tspan + sodipodi:role="line" + id="tspan5568" + x="838.08691" + y="414.40048">Instance</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 186.02362,248.03149 C 106.29921,26.574797 372.04724,26.574797 372.04724,26.574797" + id="path5571" + sodipodi:nodetypes="cc" /> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:2.1854961;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:2.1854960 2.1854960 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;" + id="rect6205" + width="148.46259" + height="35.656227" + x="391.89175" + y="17.493374" /> + <text + xml:space="preserve" + style="font-size:14.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="466.20642" + y="39.577003" + id="text6206" + sodipodi:linespacing="100%"><tspan + x="466.20642" + y="39.577003" + sodipodi:role="line" + id="tspan6211">Message Dispatcher</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 806.10236,248.03149 C 814.96063,17.716530 549.21260,26.574797 558.07087,26.574797" + id="path6213" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:start;writing-mode:lr;" + x="380.24341" + y="71.125053" + id="text6214" + sodipodi:linespacing="100%"><tspan + x="380.24341" + y="71.125053" + sodipodi:role="line" + id="tspan6860">if (message is signal)</tspan><tspan + x="380.24341" + y="83.125053" + sodipodi:role="line" + id="tspan6862"> broadcast</tspan><tspan + x="380.24341" + y="95.125053" + sodipodi:role="line" + id="tspan6864">else</tspan><tspan + x="380.24341" + y="107.12505" + sodipodi:role="line" + id="tspan6866"> find destination named by message</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 380.90551,79.724404 C 177.16536,53.149601 203.74016,256.88976 203.74016,248.03149" + id="path6868" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 451.77165,79.724404 C 788.38583,44.291333 779.52756,256.88976 779.52756,248.03149" + id="path6869" + sodipodi:nodetypes="cc" /> + <rect + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#6a6a6a;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:1.2500000,1.2500000;stroke-dashoffset:0.0000000;" + id="rect7503" + width="318.89764" + height="168.30708" + x="345.47244" + y="115.15748" /> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;" + x="507.10016" + y="132.70409" + id="text8137" + sodipodi:linespacing="100%"><tspan + id="tspan8138">Destination Table</tspan></text> + <text + xml:space="preserve" + style="font-size:12.000000;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;font-stretch:normal;font-variant:normal;text-anchor:start;writing-mode:lr;" + x="422.71124" + y="158.39366" + id="text8140" + sodipodi:linespacing="120%"><tspan + x="422.71124" + y="158.39366" + sodipodi:role="line" + id="tspan8818">Connection 1</tspan><tspan + x="422.71124" + y="172.79366" + sodipodi:role="line" + id="tspan8820">Connection 2</tspan><tspan + x="422.71124" + y="187.19366" + sodipodi:role="line" + id="tspan8822">"The Session Manager"</tspan><tspan + x="422.71124" + y="201.59366" + sodipodi:role="line" + id="tspan8824">"The Window Manager"</tspan><tspan + x="422.71124" + y="215.99366" + sodipodi:role="line" + id="tspan8826">"The Screensaver"</tspan><tspan + x="422.71124" + y="230.39366" + sodipodi:role="line" + id="tspan8828">"The Text Editor"</tspan><tspan + x="422.71124" + y="244.79366" + sodipodi:role="line" + id="tspan8830">"The Hardware Directory"</tspan><tspan + x="422.71124" + y="259.19367" + sodipodi:role="line" + id="tspan8832">"The Address Book"</tspan><tspan + x="422.71124" + y="273.59367" + sodipodi:role="line" + id="tspan8834">"The Dictionary"</tspan></text> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 416.33858,150.59055 C 239.17323,97.440935 221.45669,256.88976 221.45669,248.03149" + id="path8179" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 504.92126,168.30708 C 726.37795,106.29921 770.66929,265.74802 761.81102,239.17322" + id="path8180" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" + d="" + id="path8181" + sodipodi:nodetypes="" /> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 584.64567,239.17322 C 717.51969,194.88188 761.81102,256.88976 752.95276,248.03149" + id="path8182" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;marker-end:url(#Arrow1M);" + d="M 416.33858,177.16535 C 301.18111,124.01574 230.31496,265.74803 239.17323,248.03149" + id="path8184" + sodipodi:nodetypes="cc" /> +</svg> diff --git a/glib/dbus-gproxy.c b/glib/dbus-gproxy.c index 24ce6bf3..624a95ca 100644 --- a/glib/dbus-gproxy.c +++ b/glib/dbus-gproxy.c @@ -45,7 +45,7 @@ struct DBusGProxy GObject parent; /**< Parent instance */ DBusGProxyManager *manager; /**< Proxy manager */ - char *service; /**< Service messages go to or NULL */ + char *name; /**< Name messages go to or NULL */ char *path; /**< Path messages go to or NULL */ char *interface; /**< Interface messages go to or NULL */ }; @@ -68,14 +68,14 @@ static void dbus_g_proxy_emit_received (DBusGProxy *proxy, /** - * A list of proxies with a given service+path+interface, used to + * A list of proxies with a given name+path+interface, used to * route incoming signals. */ typedef struct { GSList *proxies; /**< The list of proxies */ - char name[4]; /**< service (empty string for none), nul byte, + char name[4]; /**< name (empty string for none), nul byte, * path, nul byte, * interface, nul byte */ @@ -85,7 +85,7 @@ typedef struct /** * DBusGProxyManager's primary task is to route signals to the proxies * those signals are emitted on. In order to do this it also has to - * track the owners of the services proxies are bound to. + * track the owners of the names proxies are bound to. */ struct DBusGProxyManager { @@ -100,9 +100,10 @@ struct DBusGProxyManager }; static DBusGProxyManager *dbus_g_proxy_manager_ref (DBusGProxyManager *manager); -static DBusHandlerResult dbus_g_proxy_manager_filter (DBusConnection *connection, - DBusMessage *message, - void *user_data); +static DBusHandlerResult dbus_g_proxy_manager_filter (DBusConnection *connection, + DBusMessage *message, + void *user_data); + /** Lock the DBusGProxyManager */ #define LOCK_MANAGER(mgr) (g_static_mutex_lock (&(mgr)->lock)) @@ -293,48 +294,48 @@ tristring_equal (gconstpointer a, static char* tristring_alloc_from_strings (size_t padding_before, - const char *service, + const char *name, const char *path, const char *interface) { - size_t service_len, iface_len, path_len, len; + size_t name_len, iface_len, path_len, len; char *tri; - if (service) - service_len = strlen (service); + if (name) + name_len = strlen (name); else - service_len = 0; + name_len = 0; path_len = strlen (path); iface_len = strlen (interface); - tri = g_malloc (padding_before + service_len + path_len + iface_len + 3); + tri = g_malloc (padding_before + name_len + path_len + iface_len + 3); len = padding_before; - if (service) - memcpy (&tri[len], service, service_len); + if (name) + memcpy (&tri[len], name, name_len); - len += service_len; + len += name_len; tri[len] = '\0'; len += 1; - g_assert (len == (padding_before + service_len + 1)); + g_assert (len == (padding_before + name_len + 1)); memcpy (&tri[len], path, path_len); len += path_len; tri[len] = '\0'; len += 1; - g_assert (len == (padding_before + service_len + path_len + 2)); + g_assert (len == (padding_before + name_len + path_len + 2)); memcpy (&tri[len], interface, iface_len); len += iface_len; tri[len] = '\0'; len += 1; - g_assert (len == (padding_before + service_len + path_len + iface_len + 3)); + g_assert (len == (padding_before + name_len + path_len + iface_len + 3)); return tri; } @@ -343,7 +344,7 @@ static char* tristring_from_proxy (DBusGProxy *proxy) { return tristring_alloc_from_strings (0, - proxy->service, + proxy->name, proxy->path, proxy->interface); } @@ -363,7 +364,7 @@ g_proxy_list_new (DBusGProxy *first_proxy) DBusGProxyList *list; list = (void*) tristring_alloc_from_strings (G_STRUCT_OFFSET (DBusGProxyList, name), - first_proxy->service, + first_proxy->name, first_proxy->path, first_proxy->interface); list->proxies = NULL; @@ -387,9 +388,9 @@ g_proxy_get_match_rule (DBusGProxy *proxy) { /* FIXME Escaping is required here */ - if (proxy->service) + if (proxy->name) return g_strdup_printf ("type='signal',sender='%s',path='%s',interface='%s'", - proxy->service, proxy->path, proxy->interface); + proxy->name, proxy->path, proxy->interface); else return g_strdup_printf ("type='signal',path='%s',interface='%s'", proxy->path, proxy->interface); @@ -397,7 +398,7 @@ g_proxy_get_match_rule (DBusGProxy *proxy) static void dbus_g_proxy_manager_register (DBusGProxyManager *manager, - DBusGProxy *proxy) + DBusGProxy *proxy) { DBusGProxyList *list; @@ -738,7 +739,7 @@ dbus_g_proxy_finalize (GObject *object) dbus_g_proxy_manager_unref (proxy->manager); } - g_free (proxy->service); + g_free (proxy->name); g_free (proxy->path); g_free (proxy->interface); @@ -842,9 +843,9 @@ dbus_g_proxy_get_type (void) static DBusGProxy* dbus_g_proxy_new (DBusGConnection *connection, - const char *service_name, - const char *path_name, - const char *interface_name) + const char *name, + const char *path_name, + const char *interface_name) { DBusGProxy *proxy; @@ -858,7 +859,7 @@ dbus_g_proxy_new (DBusGConnection *connection, proxy->manager = dbus_g_proxy_manager_get (DBUS_CONNECTION_FROM_G_CONNECTION (connection)); - proxy->service = g_strdup (service_name); + proxy->name = g_strdup (name); proxy->path = g_strdup (path_name); proxy->interface = g_strdup (interface_name); @@ -868,101 +869,105 @@ dbus_g_proxy_new (DBusGConnection *connection, } /** - * Creates a new proxy for a remote interface exported by a service on - * a message bus. Method calls and signal connections over this proxy - * will go to the service owner; the service owner is expected to - * support the given interface name. THE SERVICE OWNER MAY CHANGE OVER - * TIME, for example between two different method calls. If you need a - * fixed owner, you need to request the current owner and bind a proxy - * to that rather than to the generic service name; see - * dbus_g_proxy_new_for_service_owner(). + * Creates a new proxy for a remote interface exported by a connection + * on a message bus. Method calls and signal connections over this + * proxy will go to the name owner; the name's owner is expected to + * support the given interface name. THE NAME OWNER MAY CHANGE OVER + * TIME, for example between two different method calls, unless the + * name is a unique name. If you need a fixed owner, you need to + * request the current owner and bind a proxy to its unique name + * rather than to the generic name; see + * dbus_g_proxy_new_for_name_owner(). * - * A service-associated proxy only makes sense with a message bus, - * not for app-to-app direct dbus connections. + * A name-associated proxy only makes sense with a message bus, not + * for app-to-app direct dbus connections. * - * This proxy will only emit the "destroy" signal if the #DBusConnection - * is disconnected or the proxy is has no remaining references. + * This proxy will only emit the "destroy" signal if the + * #DBusConnection is disconnected, the proxy has no remaining + * references, or the name is a unique name and its owner + * disappears. If a well-known name changes owner, the proxy will + * still be alive. * * @param connection the connection to the remote bus - * @param service_name name of the service on the message bus - * @param path_name name of the object inside the service to call methods on + * @param name any name on the message bus + * @param path_name name of the object instance to call methods on * @param interface_name name of the interface to call methods on * @returns new proxy object */ DBusGProxy* -dbus_g_proxy_new_for_service (DBusGConnection *connection, - const char *service_name, - const char *path_name, - const char *interface_name) +dbus_g_proxy_new_for_name (DBusGConnection *connection, + const char *name, + const char *path_name, + const char *interface_name) { DBusGProxy *proxy; g_return_val_if_fail (connection != NULL, NULL); - g_return_val_if_fail (service_name != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (path_name != NULL, NULL); g_return_val_if_fail (interface_name != NULL, NULL); - proxy = dbus_g_proxy_new (connection, service_name, + proxy = dbus_g_proxy_new (connection, name, path_name, interface_name); return proxy; } /** - * Similar to dbus_g_proxy_new_for_service(), but makes a round-trip - * request to the message bus to get the current service owner, then - * binds the proxy specifically to the current owner. As a result, the - * service owner will not change over time, and the proxy will emit - * the "destroy" signal when the owner disappears from the message - * bus. + * Similar to dbus_g_proxy_new_for_name(), but makes a round-trip + * request to the message bus to get the current name owner, then + * binds the proxy to the unique name of the current owner, rather + * than to the well-known name. As a result, the name owner will + * not change over time, and the proxy will emit the "destroy" signal + * when the owner disappears from the message bus. * - * An example of the difference between dbus_g_proxy_new_for_service() - * and dbus_g_proxy_new_for_service_owner(): if you pass the service name - * "org.freedesktop.Database" dbus_g_proxy_new_for_service() remains bound - * to that name as it changes owner. dbus_g_proxy_new_for_service_owner() - * will fail if the service has no owner. If the service has an owner, - * dbus_g_proxy_new_for_service_owner() will bind to the unique name - * of that owner rather than the generic service name. + * An example of the difference between dbus_g_proxy_new_for_name() + * and dbus_g_proxy_new_for_name_owner(): if you provide the well-known name + * "org.freedesktop.Database" dbus_g_proxy_new_for_name() remains bound + * to that name as it changes owner. dbus_g_proxy_new_for_name_owner() + * will fail if the name has no owner. If the name has an owner, + * dbus_g_proxy_new_for_name_owner() will bind to the unique name + * of that owner rather than the generic name. * * @param connection the connection to the remote bus - * @param service_name name of the service on the message bus + * @param name any name on the message bus * @param path_name name of the object inside the service to call methods on * @param interface_name name of the interface to call methods on * @param error return location for an error * @returns new proxy object, or #NULL on error */ DBusGProxy* -dbus_g_proxy_new_for_service_owner (DBusGConnection *connection, - const char *service_name, - const char *path_name, - const char *interface_name, - GError **error) +dbus_g_proxy_new_for_name_owner (DBusGConnection *connection, + const char *name, + const char *path_name, + const char *interface_name, + GError **error) { DBusGProxy *proxy; DBusMessage *request, *reply; DBusError derror; - const char *base_service_name; + const char *unique_name; g_return_val_if_fail (connection != NULL, NULL); - g_return_val_if_fail (service_name != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (path_name != NULL, NULL); g_return_val_if_fail (interface_name != NULL, NULL); dbus_error_init (&derror); proxy = NULL; - base_service_name = NULL; + unique_name = NULL; reply = NULL; request = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, DBUS_PATH_ORG_FREEDESKTOP_DBUS, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "GetServiceOwner"); + "GetNameOwner"); if (request == NULL) g_error ("Out of memory"); if (! dbus_message_append_args (request, - DBUS_TYPE_STRING, &service_name, + DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) g_error ("Out of memory"); @@ -977,13 +982,13 @@ dbus_g_proxy_new_for_service_owner (DBusGConnection *connection, goto error; if (! dbus_message_get_args (reply, &derror, - DBUS_TYPE_STRING, &base_service_name, + DBUS_TYPE_STRING, &unique_name, DBUS_TYPE_INVALID)) goto error; - proxy = dbus_g_proxy_new (connection, base_service_name, - path_name, interface_name); + proxy = dbus_g_proxy_new (connection, unique_name, + path_name, interface_name); goto out; @@ -1017,8 +1022,8 @@ dbus_g_proxy_new_for_service_owner (DBusGConnection *connection, */ DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection, - const char *path_name, - const char *interface_name) + const char *path_name, + const char *interface_name) { DBusGProxy *proxy; @@ -1063,7 +1068,7 @@ dbus_g_proxy_begin_call (DBusGProxy *proxy, g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL); - message = dbus_message_new_method_call (proxy->service, + message = dbus_message_new_method_call (proxy->name, proxy->path, proxy->interface, method); @@ -1191,7 +1196,7 @@ dbus_g_proxy_call_no_reply (DBusGProxy *proxy, g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - message = dbus_message_new_method_call (proxy->service, + message = dbus_message_new_method_call (proxy->name, proxy->path, proxy->interface, method); @@ -1224,7 +1229,7 @@ dbus_g_proxy_call_no_reply (DBusGProxy *proxy, * dbus_connection_flush(). * * The message is modified to be addressed to the target interface. - * That is, a destination service field or whatever is needed will be + * That is, a destination name field or whatever is needed will be * added to the message. The basic point of this function is to add * the necessary header fields, otherwise it's equivalent to * dbus_connection_send(). @@ -1242,9 +1247,9 @@ dbus_g_proxy_send (DBusGProxy *proxy, { g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - if (proxy->service) + if (proxy->name) { - if (!dbus_message_set_destination (message, proxy->service)) + if (!dbus_message_set_destination (message, proxy->name)) g_error ("Out of memory"); } if (proxy->path) diff --git a/test/data/equiv-config-files/basic/basic-1.conf b/test/data/equiv-config-files/basic/basic-1.conf index 4500ad70..99f41e80 100644 --- a/test/data/equiv-config-files/basic/basic-1.conf +++ b/test/data/equiv-config-files/basic/basic-1.conf @@ -14,12 +14,12 @@ <limit name="max_incoming_bytes">5000</limit> <limit name="max_outgoing_bytes">5000</limit> <limit name="max_message_size">300</limit> - <limit name="activation_timeout">5000</limit> + <limit name="service_start_timeout">5000</limit> <limit name="auth_timeout">6000</limit> <limit name="max_completed_connections">50</limit> <limit name="max_incomplete_connections">80</limit> <limit name="max_connections_per_user">64</limit> - <limit name="max_pending_activations">64</limit> - <limit name="max_services_per_connection">256</limit> + <limit name="max_pending_service_starts">64</limit> + <limit name="max_names_per_connection">256</limit> </busconfig> diff --git a/test/data/valid-config-files/basic.conf b/test/data/valid-config-files/basic.conf index 73bd02ac..5297097d 100644 --- a/test/data/valid-config-files/basic.conf +++ b/test/data/valid-config-files/basic.conf @@ -14,13 +14,13 @@ <limit name="max_incoming_bytes">5000</limit> <limit name="max_outgoing_bytes">5000</limit> <limit name="max_message_size">300</limit> - <limit name="activation_timeout">5000</limit> + <limit name="service_start_timeout">5000</limit> <limit name="auth_timeout">6000</limit> <limit name="max_completed_connections">50</limit> <limit name="max_incomplete_connections">80</limit> <limit name="max_connections_per_user">64</limit> - <limit name="max_pending_activations">64</limit> - <limit name="max_services_per_connection">256</limit> + <limit name="max_pending_service_starts">64</limit> + <limit name="max_names_per_connection">256</limit> <selinux> <associate own="org.freedesktop.FrobationaryMeasures" diff --git a/test/data/valid-config-files/many-rules.conf b/test/data/valid-config-files/many-rules.conf index 0c675828..ab05909f 100644 --- a/test/data/valid-config-files/many-rules.conf +++ b/test/data/valid-config-files/many-rules.conf @@ -46,13 +46,13 @@ <limit name="max_incoming_bytes">5000</limit> <limit name="max_outgoing_bytes">5000</limit> <limit name="max_message_size">300</limit> - <limit name="activation_timeout">5000</limit> + <limit name="service_start_timeout">5000</limit> <limit name="auth_timeout">6000</limit> <limit name="max_completed_connections">50</limit> <limit name="max_incomplete_connections">80</limit> <limit name="max_connections_per_user">64</limit> - <limit name="max_pending_activations">64</limit> - <limit name="max_services_per_connection">256</limit> + <limit name="max_pending_service_starts">64</limit> + <limit name="max_names_per_connection">256</limit> <limit name="max_match_rules_per_connection">512</limit> </busconfig> diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c index 5ebf3b9d..f217cf5e 100644 --- a/test/glib/test-dbus-glib.c +++ b/test/glib/test-dbus-glib.c @@ -58,8 +58,8 @@ main (int argc, char **argv) DBusGProxy *driver; DBusGProxy *proxy; DBusGPendingCall *call; - char **service_list; - int service_list_len; + char **name_list; + int name_list_len; int i; guint32 result; const char *v_STRING; @@ -82,38 +82,38 @@ main (int argc, char **argv) /* Create a proxy object for the "bus driver" */ - driver = dbus_g_proxy_new_for_service (connection, - DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, - DBUS_PATH_ORG_FREEDESKTOP_DBUS, - DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS); + driver = dbus_g_proxy_new_for_name (connection, + DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, + DBUS_PATH_ORG_FREEDESKTOP_DBUS, + DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS); - /* Call ListServices method */ + /* Call ListNames method */ - call = dbus_g_proxy_begin_call (driver, "ListServices", DBUS_TYPE_INVALID); + call = dbus_g_proxy_begin_call (driver, "ListNames", DBUS_TYPE_INVALID); error = NULL; if (!dbus_g_proxy_end_call (driver, call, &error, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, - &service_list, &service_list_len, + &name_list, &name_list_len, DBUS_TYPE_INVALID)) { - g_printerr ("Failed to complete ListServices call: %s\n", + g_printerr ("Failed to complete ListNames call: %s\n", error->message); g_error_free (error); exit (1); } - g_print ("Services on the message bus:\n"); + g_print ("Names on the message bus:\n"); i = 0; - while (i < service_list_len) + while (i < name_list_len) { - g_assert (service_list[i] != NULL); - g_print (" %s\n", service_list[i]); + g_assert (name_list[i] != NULL); + g_print (" %s\n", name_list[i]); ++i; } - g_assert (service_list[i] == NULL); + g_assert (name_list[i] == NULL); - g_strfreev (service_list); + g_strfreev (name_list); /* Test handling of unknown method */ v_STRING = "blah blah blah blah blah"; @@ -140,7 +140,7 @@ main (int argc, char **argv) /* Activate a service */ v_STRING = "org.freedesktop.DBus.TestSuiteEchoService"; v_UINT32 = 0; - call = dbus_g_proxy_begin_call (driver, "ActivateService", + call = dbus_g_proxy_begin_call (driver, "StartServiceByName", DBUS_TYPE_STRING, &v_STRING, DBUS_TYPE_UINT32, @@ -158,12 +158,12 @@ main (int argc, char **argv) exit (1); } - g_print ("Activation of echo service = 0x%x\n", result); + g_print ("Starting echo service result = 0x%x\n", result); /* Activate a service again */ v_STRING = "org.freedesktop.DBus.TestSuiteEchoService"; v_UINT32 = 0; - call = dbus_g_proxy_begin_call (driver, "ActivateService", + call = dbus_g_proxy_begin_call (driver, "StartServiceByName", DBUS_TYPE_STRING, &v_STRING, DBUS_TYPE_UINT32, @@ -181,19 +181,19 @@ main (int argc, char **argv) exit (1); } - g_print ("Duplicate activation of echo service = 0x%x\n", result); + g_print ("Duplicate start of echo service = 0x%x\n", result); /* Talk to the new service */ - proxy = dbus_g_proxy_new_for_service_owner (connection, - "org.freedesktop.DBus.TestSuiteEchoService", - "/org/freedesktop/TestSuite", - "org.freedesktop.TestSuite", - &error); + proxy = dbus_g_proxy_new_for_name_owner (connection, + "org.freedesktop.DBus.TestSuiteEchoService", + "/org/freedesktop/TestSuite", + "org.freedesktop.TestSuite", + &error); if (proxy == NULL) { - g_printerr ("Failed to create proxy for service owner: %s\n", + g_printerr ("Failed to create proxy for name owner: %s\n", error->message); g_error_free (error); exit (1); diff --git a/test/glib/test-profile.c b/test/glib/test-profile.c index 77ce4369..6b4e9058 100644 --- a/test/glib/test-profile.c +++ b/test/glib/test-profile.c @@ -423,19 +423,19 @@ with_bus_server_filter (DBusConnection *connection, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) && dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged")) + "NameOwnerChanged")) { - const char *service_name, *old_owner, *new_owner; + const char *name, *old_owner, *new_owner; DBusError error; - service_name = NULL; + name = NULL; old_owner = NULL; new_owner = NULL; dbus_error_init (&error); if (!dbus_message_get_args (message, &error, - DBUS_TYPE_STRING, &service_name, + DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old_owner, DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID)) @@ -445,12 +445,12 @@ with_bus_server_filter (DBusConnection *connection, } if (g_hash_table_lookup (server->client_names, - service_name) && + name) && *old_owner != '\0' && *new_owner == '\0') { g_hash_table_remove (server->client_names, - service_name); + name); server->sd->n_clients -= 1; if (server->sd->n_clients == 0) g_main_loop_quit (server->sd->loop); @@ -525,13 +525,13 @@ with_bus_init_server (ServerData *sd) connection = dbus_g_connection_get_connection (gconnection); - dbus_bus_acquire_service (connection, - ECHO_SERVICE, - 0, NULL); /* ignore errors because we suck */ + dbus_bus_request_name (connection, + ECHO_SERVICE, + 0, NULL); /* ignore errors because we suck */ rule = g_strdup_printf ("type='signal',sender='%s',member='%s'", DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, - "ServiceOwnerChanged"); + "NameOwnerChanged"); /* ignore errors because we suck */ dbus_bus_add_match (connection, rule, NULL); diff --git a/test/glib/test-service-glib.c b/test/glib/test-service-glib.c index aa409aa3..cad6f168 100644 --- a/test/glib/test-service-glib.c +++ b/test/glib/test-service-glib.c @@ -17,7 +17,7 @@ main (int argc, char **argv) loop = g_main_loop_new (NULL, FALSE); error = NULL; - connection = dbus_g_bus_get (DBUS_BUS_ACTIVATION, + connection = dbus_g_bus_get (DBUS_BUS_STARTER, &error); if (connection == NULL) { diff --git a/test/test-service.c b/test/test-service.c index 3ba16bbf..588ef01f 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -165,7 +165,7 @@ main (int argc, int result; dbus_error_init (&error); - connection = dbus_bus_get (DBUS_BUS_ACTIVATION, &error); + connection = dbus_bus_get (DBUS_BUS_STARTER, &error); if (connection == NULL) { fprintf (stderr, "*** Failed to open connection to activating message bus: %s\n", @@ -191,8 +191,8 @@ main (int argc, NULL)) die ("No memory"); - result = dbus_bus_acquire_service (connection, "org.freedesktop.DBus.TestSuiteEchoService", - 0, &error); + result = dbus_bus_request_name (connection, "org.freedesktop.DBus.TestSuiteEchoService", + 0, &error); if (dbus_error_is_set (&error)) { fprintf (stderr, "Error %s\n", error.message); diff --git a/tools/dbus-send.1 b/tools/dbus-send.1 index 725507c0..0b846045 100644 --- a/tools/dbus-send.1 +++ b/tools/dbus-send.1 @@ -8,7 +8,7 @@ dbus-send \- Send a message to a message bus .SH SYNOPSIS .PP .B dbus-send -[\-\-system | \-\-session] [\-\-dest=SERVICE] [\-\-print-reply] +[\-\-system | \-\-session] [\-\-dest=NAME] [\-\-print-reply] [\-\-type=TYPE] <destination object path> <message name> [contents ...] .SH DESCRIPTION @@ -27,9 +27,8 @@ specified, \fIdbus-send\fP sends to the session bus. .PP Nearly all uses of \fIdbus-send\fP must provide the \-\-dest argument -which is the name of a service on the bus to send the message to. If -\-\-dest is omitted, a default service name of -"org.freedesktop.Broadcast" is used. +which is the name of a connection on the bus to send the message to. If +\-\-dest is omitted, no destination is set. .PP The object path and the name of the message to send must always be @@ -43,7 +42,7 @@ these, but \fIdbus-send\fP currently does not.) Here is an example invocation: .nf - dbus-send \-\-dest='org.freedesktop.ExampleService' \\ + dbus-send \-\-dest='org.freedesktop.ExampleName \\ /org/freedesktop/sample/object/name \\ org.freedesktop.ExampleInterface.ExampleMethod \\ int32:47 string:'hello world' double:65.32 @@ -57,8 +56,8 @@ and the interface member are separate fields. .SH OPTIONS The following options are supported: .TP -.I "--dest=SERVICE" -Specify the service to receive the message. +.I "--dest=NAME" +Specify the name of the connection to receive the message. .TP .I "--print-reply" Block for a reply to the message sent, and print any reply received. diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 412f5fdc..ed513fb4 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -30,7 +30,7 @@ static void usage (char *name, int ecode) { - fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]\n", name); + fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=NAME] [--type=TYPE] [--print-reply] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]\n", name); exit (ecode); } |