diff options
author | Ryan Lortie <desrt@desrt.ca> | 2005-02-18 18:18:32 +0000 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2005-02-18 18:18:32 +0000 |
commit | b0e260cd15f5d95f501eba254a803f180d547174 (patch) | |
tree | d384badec538ef759dad0a867b4b3dd72f9d4b9e | |
parent | 74ae666f06076e8ebd9bc8267e3b824ef042b0ab (diff) |
This commit was manufactured by cvs2svn to create tag 'dbus-0.23.2'.dbus-0.23.2
-rw-r--r-- | ChangeLog | 1136 | ||||
-rw-r--r-- | NEWS | 14 | ||||
-rw-r--r-- | bus/policy.c | 5 | ||||
-rw-r--r-- | bus/session.conf.in | 2 | ||||
-rw-r--r-- | configure.in | 66 | ||||
-rw-r--r-- | dbus/dbus-connection.c | 11 | ||||
-rw-r--r-- | dbus/dbus-server-unix.c | 8 | ||||
-rw-r--r-- | dbus/dbus-transport.c | 8 | ||||
-rw-r--r-- | glib/dbus-gproxy.c | 637 | ||||
-rw-r--r-- | mono/Connection.cs | 6 | ||||
-rw-r--r-- | mono/Service.cs | 22 |
11 files changed, 247 insertions, 1668 deletions
@@ -1,332 +1,19 @@ -2005-02-17 Colin Walters <walters@verbum.org> - - * glib/dbus-gobject.h: Don't export - _dbus_glib_marshal_dbus_message_to_gvalue_array. - - * glib/dbus-gobject.c (_dbus_glib_marshal_dbus_message_to_gvalue_array): Do rename. - (invoke_object_method): Handle it. - - * glib/dbus-gproxy.c (marshal_dbus_message_to_g_marshaller): - Handle rename. - -2005-02-17 Colin Walters <walters@verbum.org> - - * bus/.cvsignore, doc/.cvsignore - * test/data/valid-service-files/.cvsignore, test/glib/.cvsignore: - Update. - -2005-02-17 Colin Walters <walters@verbum.org> - - * dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS): - Rename to DBUS_SERVICE_DBUS. - (DBUS_PATH_ORG_FREEDESKTOP_DBUS): Rename to DBUS_PATH_DBUS. - (DBUS_PATH_ORG_FREEDESKTOP_LOCAL): Rename to DBUS_PATH_LOCAL. - Change the value from "org.freedesktop.Local" - to "org.freedesktop.DBus.Local". - (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS): Rename to DBUS_INTERFACE_DBUS. - (DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE): Rename to - DBUS_INTERFACE_INTROSPECTABLE. - Change the value from "org.freedesktop.Introspectable" - to "org.freedesktop.DBus.Introspectable". - (DBUS_INTERFACE_ORG_FREEDESKTOP_PROPERTIES): Rename to - DBUS_INTERFACE_PROPERTIES. - Change the value from "org.freedesktop.Properties" - to "org.freedesktop.DBus.Properties". - (DBUS_INTERFACE_ORG_FREEDESKTOP_PEER): Rename to - DBUS_INTERFACE_PEER. - Change the value from "org.freedesktop.Peer" - to "org.freedesktop.DBus.Peer". - (DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL): - DBUS_INTERFACE_LOCAL. - Change the value from "org.freedesktop.Local" - to "org.freedesktop.DBus.Local". - - All other users of those constants have been changed. - - * bus/driver.c (bus_driver_handle_introspect): Use constants. - - * glib/dbus-gobject.c (handle_introspect): Use constants. - - * doc/dbus-faq.xml, doc/dbus-specification.xml: Update for rename. - -2005-02-17 Colin Walters <walters@verbum.org> - - * glib/dbus-gparser.c (struct Parser): Add in_annotation boolean. - (parse_node, parse_interface, parse_method, parse_signal) - (parse_property, parse_annotation): Lose if we're currently in an - annotation. - (parse_annotation): New function. - (parser_start_element, parser_end_element): Handle annotation. - (parse_method, parse_interface): Remove support for c_name attribute, - switch to annotations. - - * glib/dbus-gidl.h (interface_info_get_binding_names) - (method_info_get_binding_names) - (interface_info_get_binding_name, method_info_get_binding_name) - (interface_info_set_binding_name, method_info_set_binding_name): - Remove. - (interface_info_get_annotations, method_info_get_annotations) - (interface_info_get_annotation, method_info_get_annotation) - (interface_info_add_annotation, method_info_add_annotation): - Prototype. - - * glib/dbus-gidl.c (struct InterfaceInfo): Substitute "annotations" - for "bindings". - (struct MethodInfo): Ditto. - Straightfoward conversion of binding methods into annotation methods - as prototyped. - - * glib/dbus-glib-tool.c (pretty_print): Print annotations. - - * glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_C_SYMBOL): Define. - - * glib/dbus-binding-tool-glib.c (gather_marshallers, generate_glue): - Use new annotation API. - - * doc/introspect.dtd: Fix a number of DTD syntax errors. Add - annotation element. - - * doc/dbus-specification.xml: Discuss introspection annotations, - include list of well-known annotations. - - * test/glib/test-service-glib.xml: Make validate against new DTD. - -2005-02-17 Colin Walters <walters@verbum.org> - - This patch is based on initial work from - Paul Kuliniewicz <kuliniew@purdue.edu>. - - * glib/dbus-gvalue.c (dbus_gvalue_init): New function; move - initialization of GValue from dbus type to here. - (dbus_gvalue_genmarshal_name_from_type): New function; generates a string - for the "glib-genmarshal" program from a DBus type. - (dbus_gvalue_binding_type_from_type): New function; turns a DBus type - into the C name for it we use in the glib bindings. - (dbus_gvalue_ctype_from_type): New function; maps a DBus type into a - glib C type (not GValue). - (dbus_gvalue_demarshal): invoke dbus_gvalue_init. - - * glib/dbus-gutils.c (_dbus_gutils_wincaps_to_uscore): Moved here - from dbus-gobject.c. - - * glib/dbus-gutils.h: Prototype it. - - * glib/dbus-gproxy.c: Include new dbus-gobject.h. - (marshal_dbus_message_to_g_marshaller): Use new shared function - dbus_glib_marshal_dbus_message_to_gvalue_array. - - * glib/dbus-gparser.c (parse_interface, parse_method): Handle c_name attribute. - Will be changed once we have annotations. - - * glib/dbus-gobject.c: Change info_hash_mutex from GStaticMutex to - GStaticRWLock. Callers updated. - (wincaps_to_uscore): Move to dbus-gutils.c. Callers updated. - (string_table_next): New function for iterating over zero-terminated - string value array. - (string_table_lookup): New function; retrieves specific entry in - array. - (get_method_data): New function; look up method data in object data chunk. - (object_error_domain_prefix_from_object_info) - (object_error_code_from_object_info): New functions, but not implemented yet. - (method_interface_from_object_info): New function; retrieve interface name. - (method_name_from_object_info): New function; retrieve method name. - (method_arg_info_from_object_info): New function; retrieve argument data. - (arg_iterate): New function; iterates over serialized argument data. - (method_dir_signature_from_object_info): New function; returns a - GString holding type signature for arguments for just one - direction (input or output). - (method_input_signature_from_object_info) - (method_output_signature_from_object_info): New functions. - (dbus_glib_marshal_dbus_message_to_gvalue_array): New shared function; - converts dbus message arguments into a GValue array. Used for both - signal handling and method invocation. - (struct DBusGlibWriteIterfaceData): New utility structure. - (write_interface): New function; generate introspection XML for - an interface. - (introspect_interfaces): New function; gathers all interface->methods, - generates introspection XML for them. - (handle_introspect): Invoke introspect_interfaces. - (get_object_property): Be sure to zero-initalize stack-allocated GValue. - (lookup_object_and_method): New function; examines an incoming message - and attempts to match it up (via interface, method name, and argument - signature) with a known object and method. - (gerror_domaincode_to_dbus_error_name): New function; converts a - GError domain and code into a DBus error name. Needs GError data - added to object introspection to work well. - (gerror_to_dbus_error_message): Creates a DBusMessage error return from - GError. - (invoke_object_method): New function to invoke an object method - looked up via lookup_object_and_method. Parses the incoming - message, turns it into a GValue array, then invokes the marshaller - specified in the DBusGMethodInfo. Creates a new message with - either return values or error message as appropriate. - (gobject_message_function): Invoke lookup_object_and_method and - invoke_object_method. - - * glib/dbus-glib-tool.c: Include dbus-binding-tool-glib.h. - (enum DBusBindingOutputMode): New enum for binding output modes. - (pretty_print): Print binding names. - (dbus_binding_tool_error_quark): GError bits. - (version): Fix typo. - (main): Create GIOChannel for output. Parse new --mode argument, - possible values are "pretty-print", "glib-server", "glib-client". - Use mode to invoke appropriate function. - - * glib/dbus-gobject.h: Prototype dbus_glib_marshal_dbus_message_to_gvalue_array. - - * glib/dbus-glib-tool.h: New header, just includes GError bits - for now. - - * glib/dbus-gidl.c (struct InterfaceInfo): Add bindings hashtable; - maps binding style to name. - (struct MethodInfo): Ditto. - (get_hash_keys, get_hash_key): Utility function, returns keys for - a GHashTable. - (interface_info_new, method_info_new): Initialize bindings. - (interface_info_unref, method_info_unref): Destroy bindings. - (method_info_get_binding_names, method_info_get_binding_name) - (interface_info_get_binding_names, interface_info_get_binding_name): - Functions for retrieving binding names. - (method_info_set_binding_name, interface_info_set_binding_name): - Functions for setting binding names. - - * glib/dbus-binding-tool-glib.h: New file, has prototypes - for glib binding generation. - - * glib/dbus-binding-tool-glib.c: New file, implements server-side - and client-side glib glue generation. - - * glib/Makefile.am (dbus_binding_tool_SOURCES): Add - dbus-binding-tool-glib.c, dbus-binding-tool-glib.h, - dbus-glib-tool.h. - - * dbus/dbus-glib.h (struct DBusGMethodMarshaller): Remove in favor - of using GClosureMarshal directly. - (struct DBusGObjectInfo): Add n_infos member. - - * test/glib/test-service-glib.xml: New file; contains introspection data - for MyTestObject used in test-service-glib.c. - - * test/glib/test-service-glib.c (enum MyObjectError): New GError enum. - (my_object_do_nothing, my_object_increment, my_object_throw_error) - (my_object_uppercase, my_object_many_args): New test methods. - (main): Use dbus_g_object_class_install_info to include generated object - info. - - * test/glib/Makefile.am: Generate server-side glue for test-service-glib.c, - as well as client-side bindings. - - * test/glib/test-dbus-glib.c: Include test-service-glib-bindings.h. - (main): Activate TestSuiteGLibService; test invoke a bunch of its methods - using both the dbus_gproxy stuff directly as well as the generated bindings. - -2005-02-15 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-connection.c (dbus_connection_dispatch): always - complete a pending call, don't run filters first. - - * glib/dbus-gproxy.c (dbus_g_proxy_end_call): change to use - dbus_pending_call_steal_reply - - * dbus/dbus-pending-call.c (dbus_pending_call_block): just call - _dbus_connection_block_pending_call - (dbus_pending_call_get_reply): change to steal_reply and return a - ref +2005-02-18 Joe Shaw <joeshaw@novell.com> + + * NEWS: Update for 0.23.2 + + * configure.in: Release 0.23.2 - * dbus/dbus-connection.c - (dbus_connection_send_with_reply_and_block): port to work in terms - of DBusPendingCall - (_dbus_connection_block_pending_call): replace block_for_reply - with this - -2005-02-14 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-userdb-util.c (_dbus_user_database_lookup_group): - properly handle looking up group information by name; fix - from j@bootlab.org - -2005-02-13 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-connection.c (dbus_connection_return_message) - (dbus_connection_borrow_message): hold dispatch lock while message - is outstanding - (_dbus_connection_block_for_reply): hold dispatch lock while we - block for the reply, so nobody steals our reply - (dbus_connection_pop_message): hold the dispatch lock while we - pluck the message - -2005-02-13 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-connection.c (_dbus_connection_acquire_dispatch) - (_dbus_connection_release_dispatch) - (_dbus_connection_acquire_io_path) - (_dbus_connection_release_io_path): make the mutex and condvar - control access to the "acquired" flag. Drop the connection lock - while waiting on the condvar. Hopefully these are baby steps in - roughly the right direction. - -2005-02-13 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-connection.c: use separate mutexes for the condition - variables; this is some kind of baseline for sanity, but the - condition variables still aren't used correctly afaict - -2005-02-13 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-object-tree.c (handle_default_introspect_and_unlock): - fix a double-unlock - - * dbus/dbus-connection.c - (_dbus_connection_detach_pending_call_unlocked): add this - - Initial semi-correct pass through to fix thread locking; there are - still some issues with the condition variable paths I'm pretty - sure - - * dbus/dbus-server.c: add a mutex on DBusServer and appropriate - lock/unlock calls - - * dbus/dbus-connection.c (_dbus_connection_do_iteration_unlocked): - rename to add _unlocked - (struct DBusConnection): move "dispatch_acquired" and - "io_path_acquired" to use only one bit each. - (CONNECTION_LOCK, CONNECTION_UNLOCK): add checks with !DBUS_DISABLE_CHECKS - (dbus_connection_set_watch_functions): hacky fix to reentrancy - (_dbus_connection_add_watch, _dbus_connection_remove_watch) - (_dbus_connection_toggle_watch, _dbus_connection_add_timeout) - (_dbus_connection_remove_timeout) - (_dbus_connection_toggle_timeout): drop lock when calling out to - user functions; done in a hacky/bad way. - (_dbus_connection_send_and_unlock): add a missing unlock - (_dbus_connection_block_for_reply): add a missing unlock - - * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): - drop lock in a hacky probably unsafe way to call out to user - function - -2005-02-12 Havoc Pennington <hp@redhat.com> - - * tools/dbus-tree-view.c (info_set_func_text): display more - details on args - - * bus/driver.c (bus_driver_handle_list_services): list the bus - driver +2005-02-16 Joe Shaw <joeshaw@novell.com> - * glib/dbus-gparser.c (parse_arg): generate an arg name if none is supplied + * dbus/dbus-connection-internal.h, dbus/dbus-connection.[ch], + dbus/dbus-pending-call.[ch], dbus/dbus-server-protected.h, + dbus/dbus-server-unix.c, dbus/dbus-server.c, + dbus/dbus-transport-unix.c, dbus/dbus-transport.c: Backport + a ton of thread-related fixes from HEAD to this branch. - * glib/dbus-gidl.c (signal_info_get_n_args): new function - (method_info_get_n_args): new function - -2005-02-12 Havoc Pennington <hp@redhat.com> - - * bus/driver.c (bus_driver_handle_introspect): add introspection - for bus driver - -2005-02-12 Havoc Pennington <hp@redhat.com> - - * bus/driver.c: put the signature of each bus driver method in the - table of handlers and check it on incoming calls; this isn't - really useful, but going to add introspect support in a minute. + * glib/dbus-gproxy.c: Update dbus_pending_call_get_reply() to + dbus_pending_call_steal_reply(). 2005-02-11 Joe Shaw <joeshaw@novell.com> @@ -338,91 +25,11 @@ * mono/Service.cs: Remove the code, add code which calls the methods now on the Connection class. -2005-02-11 John (J5) Palmieri <johnp@redhat.com> - - * python/dbus.py (class Sender): added to support dbus signals better - (Bus::add_signal_receiver): added expand_args parameter which defaults - to True. When expand args is True the signal handler will pass the - message arguments as parameters to the signal handler. If False - revert to previous behavior where the signal handler must get the - argument list from the message. This is to help port applications - like HAL that have a tendancy to send variable length argument lists. - self._match_rule_to_receivers is now a dict of dicts. - (Bus::remove_signal_receiver): pop handler off the dict intead of - removing it from a list - (Bus::_signal_func): change signal handlers so that interface, - signal_name, service, path and message are packed into a Sender - object and that is passed to the handler. If expand_args is True - extract the args list from the message and append it to the parameter - list - - * python/dbus_bindings.pyx.in (class Signature): added to support - signiature types - (MessageIter::__init__): changed iteration limit to match D-BUS - (MessageIter::get*): added INT16, UINT16, SIGNATURE, DICT_ENTRY, - STRUCT and VARIENT type support - (MessageIter::python_value_to_dbus_sig): made recursive to support - recursive types - (MessageIter::append*): added Signature, dict, tuple - support - - * python/examples/example-client.py: added examples of getting tuples - and dicts - - * python/examples/example-service.py: added examples of sending tuples - and dicts - - * python/examples/example-signal-recipient.py: Fixed to handle new - signal callback format - -2005-02-10 Havoc Pennington <hp@redhat.com> - - * test/glib/test-dbus-glib.c (main): fix so this test doesn't fail - (call dbus_g_proxy_add_signal) - - * dbus/dbus-server-unix.c (_dbus_server_new_for_tcp_socket): - escape the hostname - (_dbus_server_new_for_domain_socket): escape the path - - * dbus/dbus-address.c (dbus_address_escape_value): new - (dbus_address_unescape_value): new - (dbus_parse_address): unescape values - - * dbus/dbus-string.c (_dbus_string_append_byte_as_hex): new function - - * doc/dbus-specification.xml: explain how to escape values in - addresses - -2005-02-10 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-message-factory.c (generate_special): modify test to - avoid using a non-basic dict key - - * dbus/dbus-marshal-validate-util.c: add test for the below - - * doc/dbus-specification.xml: require that dict keys are a basic - type - - * dbus/dbus-marshal-validate.c - (_dbus_validate_signature_with_reason): require that dict key is a - basic type - -2005-02-10 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-object-tree.c (handle_default_introspect_and_unlock): - change to be _and_unlock instead of _unlocked - - * dbus/dbus-connection.c - (_dbus_connection_send_preallocated_unlocked_no_update): rename to - have no_update so we can find this bug quickly in future - -2005-02-10 Havoc Pennington <hp@redhat.com> +2005-02-11 Joe Shaw <joeshaw@novell.com> - * dbus/dbus-message-util.c (verify_test_message): tests for string - array + * NEWS: Update for 0.23.1 - * dbus/dbus-message.c (dbus_message_append_args_valist): add - support for arrays of string/signature/path + * configure.in: Release 0.23.1 2005-02-10 Joe Shaw <joeshaw@novell.com> @@ -448,713 +55,14 @@ we don't get unmanaged code calling back into a GCed delegate. (RemoveFilter); Added. -2005-02-09 John (J5) Palmieri <johnp@redhat.com> - - * dbus/dbus-message.c (dbus_message_iter_open_container): - - Removed check for iterator type being an array because - get_arg_type does not work with writer iterators - - Pass NULL to _dbus_type_writer_recurse if signiture is NULL - -2005-02-07 Havoc Pennington <hp@redhat.com> - - * doc/dbus-specification.xml: some more language cleanups; add - stuff about how to deal with invalid protocol and extension - points; add _ to allowed chars in auth commands; add EXTENSION_ - auth command prefix - -2005-02-06 Havoc Pennington <hp@redhat.com> - - * s/expected/required/ in a couple places for clarity - -2005-02-07 Colin Walters <walters@verbum.org> - - * bus/selinux.c (bus_selinux_allows_send): Handle NULL for - sender or proposed_recipient. - -2005-02-06 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-message-factory.c (generate_special): more tests - - * dbus/dbus-marshal-validate.c (validate_body_helper): detect - array length that exceeds the maximum - -2005-02-05 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-message-factory.c (generate_special): more test cases, - increasing coverage - - * dbus/dbus-marshal-validate.c (validate_body_helper): return the - reason why a signature was invalid - - * dbus/dbus-marshal-header.c (load_and_validate_field): fix to - skip the length of the string before we look at it in validation - - * dbus/dbus-string-util.c (_dbus_string_test): add tests for - equal_substring - - * dbus/dbus-message.c (_dbus_message_loader_new): default - max_message_length to DBUS_MAXIMUM_MESSAGE_LENGTH - -2005-02-05 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-marshal-validate.c (validate_body_helper): fix crash - if the signature of a variant was empty - (_dbus_validate_signature_with_reason): catch "(a)" (array inside - struct with no element type) - - * dbus/dbus-message-factory.c (generate_uint32_changed): add more - mangled messages to break things - -2005-02-04 Havoc Pennington <hp@redhat.com> - - * glib/dbus-gproxy.c (dbus_g_proxy_disconnect_signal): use - g_quark_try_string() so it actually can return 0 - (dbus_g_proxy_connect_signal): ditto - -2005-02-04 Havoc Pennington <hp@redhat.com> - - * glib/dbus-gproxy.c (dbus_g_proxy_emit_remote_signal): fix a - bogus warning - (tristring_from_message): assert cleanly on null path/interface - (should not be possible though I decided later) - (dbus_g_proxy_dispose): move proxy manager unregistration here - (DBUS_G_PROXY_DESTROYED): add this macro, and use it in a bunch of - g_return_if_fail() checks - -2005-02-04 Havoc Pennington <hp@redhat.com> - - * doc/Makefile.am (EXTRA_DIST): add DTDs to makefile - - * doc/introspect.dtd: add introspect.dtd from David A. Wheeler - (with some minor changes) - - * doc/dbus-specification.xml: add deprecated attribute to - introspection format - 2005-01-31 Havoc Pennington <hp@redhat.com> + + * bus/policy.c (bus_policy_allow_user): change default "user is + allowed" to be "user has same uid as the bus itself"; any + allow/deny rules will override. - * glib/dbus-gproxy.c: rewrite how signals work again, this time I - think it's sort of right - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * tools/dbus-viewer.c: kind of half-ass hook up the option menu. - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * tools/dbus-names-model.c: dynamically watch NameOwnerChanged - - * autogen.sh: change to autotools 1.9 - - * glib/dbus-gproxy.c: completely change how signals work - (dbus_g_proxy_add_signal): new function to specify signature of a - signal - (dbus_g_proxy_emit_received): marshal the dbus message to GValues, - and g_warning if the incoming message has the wrong signature. - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * tools/dbus-names-model.c (have_names_notify): fix this - - * dbus/dbus-message.c (_dbus_message_iter_get_args_valist): clean - up the string array handling a bit - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * glib/dbus-glib.c (dbus_g_pending_call_set_notify): new function - (dbus_g_pending_call_cancel): new function - - * dbus/dbus-glib.h: move GType decls for connection/message here; - * dbus/dbus-glib.c: move all the g_type and ref/unref stuff in - here, just kind of rationalizing how we handle all that - - * tools/dbus-names-model.c: new file for a tree model listing the - services on a bus - - * tools/dbus-tree-view.c (model_new): use proper typing on the - model rows - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * glib/dbus-gmain.c: add a custom GSource back that just checks - whether the message queue has anything in it; otherwise, there are - cases where we won't see messages in the queue since there was no - IO visible to the glib main loop - - * dbus/dbus-connection-internal.h (_DBUS_DEFAULT_TIMEOUT_VALUE): - increase default message timeout to 25 seconds - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * test/glib/test-profile.c (no_bus_stop_server): remove the - warning about the g_warning that I just fixed - - * glib/dbus-gmain.c: rewrite the main loop stuff to avoid the - custom source, seems to be a lot easier to understand and work - better. - -2005-01-30 Havoc Pennington <hp@redhat.com> - - I think this main loop thing is conceptually broken, but here are - some band aids. I'll maybe rewrite it in a minute. - - * glib/dbus-gmain.c (add_timeout): timeout stuff doesn't use the - custom GSource, so don't pass it in; confusing - (gsource_server_finalize, gsource_connection_finalize): add - finalize handlers that remove all the watches. - -2005-01-30 Havoc Pennington <hp@redhat.com> - - * glib/dbus-gobject.c (introspect_properties): fix the XML - generated - - * dbus/dbus-message.c (dbus_message_unref): add an in_cache flag - which effectively detects the use of freed messages - - * glib/dbus-gobject.c (handle_introspect): modify and return the - reply message instead of the incoming message - - * dbus/dbus-object-tree.c (handle_default_introspect_unlocked): - gee, maybe it should SEND THE XML instead of just making a string - and freeing it again ;-) - - * tools/dbus-print-message.c (print_message): improve printing of - messages - - * configure.in: add debug-glib.service to the output - -2005-01-30 Havoc Pennington <hp@redhat.com> - - dbus-viewer introspected and displayed the bus driver - - * dbus/dbus-object-tree.c - (object_tree_test_iteration): add tests for a handler registered on "/" - - * dbus/dbus-object-tree.c - (_dbus_decompose_path): fix to handle path "/" properly - (run_decompose_tests): add tests for path decomposition - - * glib/dbus-gutils.c (_dbus_gutils_split_path): fix to handle "/" - properly - - * glib/dbus-gobject.c (handle_introspect): fix quotes - - * test/glib/run-test.sh: support launching the bus, then running - dbus-viewer - - * test/glib/test-service-glib.c (main): put in a trivial gobject - subclass and register it on the connection - - * bus/driver.c (bus_driver_handle_introspect): implement - introspection of the bus driver service - - * dbus/dbus-protocol.h: add #defines for the XML namespace, - identifiers, doctype decl - - * bus/driver.c (bus_driver_handle_get_service_owner): handle - attempts to get owner of DBUS_SERVICE_ORG_FREEDESKTOP_DBUS by - returning the service unchanged. - (bus_driver_handle_message): remove old check for reply_serial in - method calls, now the message type deals with that - (bus_driver_handle_message): handle NULL interface - - * glib/dbus-gproxy.c (dbus_g_proxy_get_bus_name): new function - - * glib/dbus-gloader-expat.c (description_load_from_string): allow - -1 for len - - * tools/dbus-viewer.c: add support for introspecting a service on - a bus - - * glib/dbus-gproxy.c (dbus_g_pending_call_ref): add - (dbus_g_pending_call_unref): add - -2005-01-29 Havoc Pennington <hp@redhat.com> - - * tools/dbus-tree-view.c: add support for displaying properties. - (run dbus-viewer with an introspect xml file as arg, then resize - the window so the tree elements show up, not sure what that is) - - * glib/dbus-gobject.c (handle_introspect): return - org.freedesktop.Properties and org.freedesktop.Introspectable - interfaces when we are introspected. - - * doc/dbus-specification.xml: allow empty interface name when - Get/Set a property - -2005-01-29 Havoc Pennington <hp@redhat.com> - - * glib/Makefile.am: rename dbus-glib-tool to dbus-binding-tool; - though it uses glib, it could be extended for any binding in - principle - - * glib/dbus-gobject.c (gobject_message_function): change to the - new way properties work - - * dbus/dbus-protocol.h: add the new interfaces - - * doc/dbus-specification.xml: document the introspection format, - Introspectable interface, and add an org.freedesktop.Properties - interface. - - * glib/dbus-gparser.c: add support for a <property> element - - * glib/dbus-gidl.c: add PropertyInfo - - * glib/dbus-gobject.c (handle_introspect): put the outermost - <node> outside the signal and property descriptions. - (introspect_properties): export properties as <property> rather - than as method calls - -2005-01-28 Havoc Pennington <hp@redhat.com> - - * doc/TODO, doc/dbus-specification.xml: spec and TODO tweaks - related to authentication protocol - -2005-01-28 John (J5) Palmieri <johnp@redhat.com> - - * python/dbus_bindings.pyx.in: Updated to handle new D-BUS type system - - BUS_ACTIVATION -> BUS_STARTER - - DBUS_BUS_ACTIVATION -> DBUS_BUS_STARTER - - class MessageIter (__init__): Added recursion checking - so we throw a nice error instead of just disconnecting from the - bus. - (get): Added arg_type parameter for recursion. - Removed the nil type - Added signiture type placeholder (not implemented) - Added struct type placeholder (not implemented) - Added varient type placeholder (not implemented) - Commented out dict type for now - (get_element_type): renamed from get_array_type - (get_*): changed to use the dbus_message_iter_get_basic API - (get_*_array): removed in favor of recursive get_array method - (get_array): new recursive method which calls get to marshal - the elements of the array - (value_to_dbus_sig): New method returns the corrasponding - dbus signiture to a python value - (append): Comment out dict handling for now - Handle lists with the new recursive API - Comment out None handling for now - (append_nil): removed - (append_*): changed to use dbus_message_iter_append_basic API - (append_*_array): removed in favor of recursive append_array - method - (__str__): Make it easier to print out recursive iterators - for debugging - - class Message (__str__): moved type inspection to the - MessageIter class' __str__ method - (get_iter): Added an append parameter wich defaults to False - If True use the new API's to create an append iterator - - * python/dbus.py: Update to use new bindings API - - TYPE_ACTIVATION -> TYPE_STARTER - - class Bus (_get_match_rule): GetServiceOwner -> GetNameOwner - - class ActivationBus -> class StarterBus - - class RemoteObject (__call__): get an append iterator - - (_dispatch_dbus_method_call): get an append iterator - - class Object (emit_signal): get an append iterator - - * python/examples/: Fixed up the examples to work with the new API - -2005-01-28 Joe Shaw <joeshaw@novell.com> - - * configure.in: Bump version up to 0.30. - - * HACKING: Add a release item to bump the version number up after - a release. - -2005-01-28 Havoc Pennington <hp@redhat.com> - - * doc/dbus-specification.xml: update to describe 16-bit types and - dict entries - - * dbus/dbus-marshal-basic.c (_dbus_unpack_uint16): fix broken - assertion - - * dbus/dbus-protocol.h (DBUS_TYPE_DICT_ENTRY): add DICT_ENTRY as a - type - - * dbus/dbus-marshal-recursive.c: implement - -2005-01-27 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-arch-deps.h.in: add 16/32-bit types - - * configure.in: find the right type for 16 and 32 bit ints as well - as 64 - - * dbus/dbus-protocol.h (DBUS_TYPE_INT16, DBUS_TYPE_UINT16): add - the 16-bit types so people don't have to stuff them in 32-bit or - byte arrays. - -2005-01-27 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-message.c: byteswap the message if you init an - iterator to read/write from it - - * dbus/dbus-marshal-byteswap.c: new file implementing - _dbus_marshal_byteswap() - - * dbus/dbus-marshal-basic.c: add _dbus_swap_array() - -2005-01-26 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-marshal-validate-util.c: break this out (and fix - build, apparently - nobody noticed?) - -2005-01-26 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-marshal-recursive.h: remove todo comment - -2005-01-25 Joe Shaw <joeshaw@novell.com> - - * Land the mono binding changes to conform to the new APIs. - - * mono/Makefile.am: Remove Custom.cs, DBusType/Custom.cs, - DBusType/Dict.cs, and DBusType/Nil.cs from the build. - - * mono/Arguments.cs (GetCodeAsString): Added. Returns the dbus - type code as a string. - (InitAppending): Rename dbus_message_append_iter_init() to - dbus_message_iter_init_append(). - - * mono/BusDriver.cs: Rename ServiceEventHandler to - NameOwnerChangedHandler. Rename GetServiceOwner to GetOwner. - Rename ServiceOwnerChanged to NameOwnerChanged. - - * mono/Connection.cs: Rename BaseService to UniqueName, and the - underlying C call. - - * mono/Custom.cs: Removed. The CUSTOM type has been removed. - - * mono/Service.cs: Rename Exists to HasOwner, internally rename - dbus_bus_acquire_service() to dbus_bus_request_name(). - - * mono/DBusType/Array.cs (ctor): Use Type.GetElementType() instead - of Type.UnderlyingSystemType to get the correct element type for - the array. - (ctor): Update code for new APIs: use dbus_message_iter_recurse(), - dbus_message_get_{element|arg}_type() instead of - dbus_message_iter_init_array_iterator(). - (Append): Replace dbus_message_iter_append_array() with - dbus_message_iter_open_container() and - dbus_message_iter_close_container(). - - * mono/DBusType/Custom.cs, mono/DBusType/Nil.cs: Removed. These - types have been removed. - - * mono/DBusType/*.cs: Replace calls of - dbus_message_iter_get_[type]() to dbus_message_iter_get_basic(), - but specify the type in the DllImport extern declaration. Ditto - for dbus_message_iter_append_[type]() -> - dbus_message_iter_append_basic(). - - * mono/example/BusListener.cs: Update for ServiceEventHandler -> - NameOwnerChangedHandler. - -2005-01-25 John (J5) Palmieri <johnp@redhat.com> - - * python/dbus_bindings.pyx.in: Rename of methods and bindings - - get_base_service -> get_unique_name - - bus_get_base_service -> bus_get_unique_name - - dbus_bus_get_base_service -> dbus_bus_get_unique_name - - ACTIVATION_REPLY_ACTIVATED -> DBUS_START_REPLY_SUCCESS - - ACTIVATION_REPLY_ALREADY_ACTIVE -> DBUS_START_REPLY_ALREADY_RUNNING - - bus_activate_service -> bus_start_service_by_name - - dbus_bus_activate_service -> dbus_bus_start_service_by_name - - bus_acquire_service -> bus_request_name - - dbus_bus_acquire_service -> dbus_bus_request_name - - bus_service_exists -> bus_name_has_owner - - dbus_bus_service_exists -> dbus_bus_name_has_owner - - * python/dbus.py: Rename of methods - - activate_service -> start_service_by_name - - bus_acquire_service -> bus_request_name - - ACTIVATION_REPLY_ACTIVATED -> START_REPLY_SUCCESS - - ACTIVATION_REPLY_ALREADY_ACTIVE -> START_REPLY_ALREADY_RUNNING - - -2005-01-24 Joe Shaw <joeshaw@novell.com> - - * dbus/dbus-connection.c (dbus_connection_dispatch): Print out the - signature for the method that can't be found. - - * dbus/dbus-message.c (dbus_message_iter_init): To check to see if - the message has any arguments, we need to call - _dbus_type_reader_get_current_type(), not - _dbus_type_reader_has_next(). - -2005-01-24 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-message-factory.c: more testing of message validation - - * dbus/dbus-protocol.h (DBUS_MINIMUM_HEADER_SIZE): move to this - header - -2005-01-23 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-message-factory.c, dbus/dbus-message-util.c: - get this all working, not many tests in the framework yet though - -2005-01-22 Havoc Pennington <hp@redhat.com> - - * doc/dbus-faq.xml, doc/dbus-tutorial: add a FAQ and update - tutorial, based on work from David Wheeler. - -2005-01-21 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-bus.c: add more return_if_fail checks - - * dbus/dbus-message.c (load_message): have the "no validation" - mode (have to edit the code to toggle the mode for now though) - - * dbus/dbus-marshal-header.c (_dbus_header_load): have a mode that - skips all validation; I want to use this at least for benchmark - baseline, I'm not sure if it should be a publicly-available switch. - -2005-01-21 Havoc Pennington <hp@redhat.com> - - * glib/dbus-gmain.c: don't put the GLib bindings in the same - toplevel doxygen group as the low-level API stuff - - * dbus/dbus.h: note that libdbus is the low-level API - -2005-01-20 Havoc Pennington <hp@redhat.com> - - * update-dbus-docs.sh: script to update docs on the web site, only - works for me though. neener. - -2005-01-20 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-sysdeps.c (_dbus_poll): amazingly, trying to compile - code can reveal bugs in it - -2005-01-20 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-sysdeps.c (_dbus_poll): fix several bugs in the - select() version, patches from Tor Lillqvist - -2005-01-20 Havoc Pennington <hp@redhat.com> - - * doc/dbus-tutorial.xml: replace > with > - - * bus/services.c (bus_registry_acquire_service): validate the name - and return a better error if it's no good. - - * doc/dbus-specification.xml: note NO_AUTO_START change - - * dbus/dbus-protocol.h (DBUS_HEADER_FLAG_NO_AUTO_START): change - from AUTO_START, we're toggling the default - - * bus/dispatch.c: adapt the tests to change of auto-start default - -2005-01-18 Havoc Pennington <hp@redhat.com> - - * rename dbus-daemon-1 to dbus-daemon throughout - -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 - ever - - * dbus/dbus-marshal-validate.c (_dbus_validate_path): disallow any - "invalid name character" not only non-ASCII - - * doc/dbus-specification.xml: further update spec, message bus - parts are still out-of-date but the marshaling etc. stuff is now - accurate-ish - -2005-01-17 Havoc Pennington <hp@redhat.com> - - * doc/dbus-specification.xml: partially update spec - -2005-01-17 Havoc Pennington <hp@redhat.com> - - * Throughout, align variant bodies according to the contained - type, rather than always to 8. Should save a fair bit of space in - message headers. - - * dbus/dbus-marshal-validate.c (_dbus_validate_body_with_reason): - fix handling of case where p == end - - * doc/TODO: remove the dbus_bool_t item and variant alignment items - -2005-01-17 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-types.h: hardcode dbus_bool_t to 32 bits - - * Throughout: modify DBUS_TYPE_BOOLEAN to be a 32-bit type instead - of an 8-bit type. Now dbus_bool_t is the type to use whenever you - are marshaling/unmarshaling a boolean. - -2005-01-16 Havoc Pennington <hp@redhat.com> - - This is about it on what can be disabled/deleted from libdbus - easily, back below 150K anyhow. Deeper cuts are more work than - just turning the code off as I've done here. - - * dbus/dbus-marshal-basic.c (_dbus_pack_int32): we don't need the - signed int convenience funcs - - * dbus/dbus-internals.c (_dbus_verbose_real): omit when not in - verbose mode - - * dbus/dbus-string-util.c, dbus/dbus-string.c: more breaking - things out of libdbus - - * dbus/dbus-sysdeps.c, dbus/dbus-sysdeps-util.c: same - - * dbus/dbus-hash.c: purge the TWO_STRINGS crap (well, make it - tests-enabled-only, though it should probably be deleted) - - * dbus/dbus-message-util.c: same stuff - - * dbus/dbus-auth-util.c: same stuff - -2005-01-16 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-userdb-util.c: split out part of dbus-userdb.c - - * dbus/dbus-sysdeps.c (_dbus_uid_from_string): move here to pave - way for stripping down dbus-userdb.c stuff included in libdbus. - Rename _dbus_parse_uid for consistency. - -2005-01-16 Havoc Pennington <hp@redhat.com> - - * dbus/dbus-internals.c (_dbus_real_assert): print the function - name the assertion failed in - - * dbus/dbus-internals.h (_dbus_return_if_fail) - (_dbus_return_val_if_fail): assert that the name of the function - containing the check doesn't start with '_', since we only want to - use checks on public functions - - * dbus/dbus-connection.c (_dbus_connection_ref_unlocked): change - checks to assertions - - * dbus/dbus-marshal-header.c (_dbus_header_set_field_basic): - change checks to asserts for private function - - * dbus/dbus-message.c (_dbus_message_set_serial): checks - to asserts for private function - - * dbus/dbus-marshal-recursive.c (skip_one_complete_type): remove - broken assertion that was breaking make check - (_dbus_type_reader_array_is_empty): remove this rather than fix - it, was only used in assertions - -2005-01-16 Havoc Pennington <hp@redhat.com> - - * test/unused-code-gc.py: hacky script to find code that's used - only by the bus (not libdbus) or used only by tests or not used at - all. It has some false alarms, but looks like we can clean up a - lot of size from libdbus. - - * dbus/dbus-sysdeps.c, dbus/dbus-sysdeps-utils.c, - dbus/Makefile.am: initially move 10K of binary size out of libdbus - -2005-01-16 Havoc Pennington <hp@redhat.com> - - * Add and fix docs according to Doxygen warnings throughout - source. - - * dbus/dbus-marshal-recursive.c - (_dbus_type_reader_array_is_empty): change this to just call - array_reader_get_array_len() and make it static - - * dbus/dbus-message.c (dbus_message_iter_get_element_type): rename - from get_array_type - (dbus_message_iter_init_append): rename from append_iter_init - - * dbus/dbus-marshal-recursive.c - (_dbus_type_reader_get_element_type): rename from - _dbus_type_reader_get_array_type - -2005-01-15 Havoc Pennington <hp@redhat.com> - - * test/glib/test-profile.c (with_bus_server_filter): fix crash - - * dbus/dbus-marshal-basic.c (_dbus_unpack_uint32): inline as macro - when DBUS_DISABLE_ASSERT - (_dbus_marshal_set_basic): be sure we align for the string length - - * dbus/dbus-marshal-recursive.c (skip_one_complete_type): make - this look faster - - * dbus/dbus-string.c (_dbus_string_get_const_data_len): add an - inline macro version - (_dbus_string_set_byte): provide inline macro version - -2005-01-15 Havoc Pennington <hp@redhat.com> - - * Land the new message args API and type system. - - This patch is huge, but the public API change is not - really large. The set of D-BUS types has changed somewhat, - and the arg "getters" are more geared toward language bindings; - they don't make a copy, etc. - - There are also some known issues. See these emails for details - on this huge patch: - http://lists.freedesktop.org/archives/dbus/2004-December/001836.html - http://lists.freedesktop.org/archives/dbus/2005-January/001922.html - - * dbus/dbus-marshal-*: all the new stuff - - * dbus/dbus-message.c: basically rewritten - - * dbus/dbus-memory.c (check_guards): with "guards" enabled, init - freed blocks to be all non-nul bytes so using freed memory is less - likely to work right - - * dbus/dbus-internals.c (_dbus_test_oom_handling): add - DBUS_FAIL_MALLOC=N environment variable, so you can do - DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or - DBUS_FAIL_MALLOC=10 to make it really, really, really slow and - thorough. - - * qt/message.cpp: port to the new message args API - (operator<<): use str.utf8() rather than str.unicode() - (pretty sure this is right from the Qt docs?) - - * glib/dbus-gvalue.c: port to the new message args API - - * bus/dispatch.c, bus/driver.c: port to the new message args API - - * dbus/dbus-string.c (_dbus_string_init_const_len): initialize the - "locked" flag to TRUE and align_offset to 0; I guess we never - looked at these anyhow, but seems cleaner. - - * dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING): - move allocation padding macro to this header; use it to implement - (_DBUS_STRING_STATIC): ability to declare a static string. - - * dbus/dbus-message.c (_dbus_message_has_type_interface_member): - change to return TRUE if the interface is not set. - - * dbus/dbus-string.[hc]: move the D-BUS specific validation stuff - to dbus-marshal-validate.[hc] - - * dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from - dbus-internals.c - - * dbus/Makefile.am: cut over from dbus-marshal.[hc] - to dbus-marshal-*.[hc] - - * dbus/dbus-object-tree.c (_dbus_decompose_path): move this - function here from dbus-marshal.c + * bus/session.conf.in: don't allow all users, since now by default + the user that ran the bus can connect. 2005-01-12 Joe Shaw <joeshaw@novell.com> @@ -1,3 +1,17 @@ +D-BUS 0.23.2 (18 Feb 2005) +=== +- shuffle some code around in the mono bindings to deterministically + finalize classes so that delegates are unregistered correctly. +- backport a bunch of thread locking-related fixes from HEAD. + +D-BUS 0.23.1 (11 Feb 2005) +=== +- fix a bug in which the bus daemon wouldn't recognize that a service + owner quit +- fix a bug in the mono bindings that would cause unmanaged code to + call back into a delegate that had been garbage collected and + crashed. + D-BUS 0.23 (11 Jan 2005) === diff --git a/bus/policy.c b/bus/policy.c index 7759dfad..c0244bdc 100644 --- a/bus/policy.c +++ b/bus/policy.c @@ -453,8 +453,9 @@ bus_policy_allow_user (BusPolicy *policy, uid); return FALSE; } - - allowed = FALSE; + + /* Default to "user owning bus" or root can connect */ + allowed = uid == _dbus_getuid (); allowed = list_allows_user (allowed, &policy->default_rules, diff --git a/bus/session.conf.in b/bus/session.conf.in index 8b6d65f7..1a6dfda5 100644 --- a/bus/session.conf.in +++ b/bus/session.conf.in @@ -19,8 +19,6 @@ <allow eavesdrop="true"/> <!-- Allow anyone to own anything --> <allow own="*"/> - <!-- Allow any user to connect --> - <allow user="*"/> </policy> <!-- This is included last so local configuration can override what's diff --git a/configure.in b/configure.in index 0e76921b..27388129 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_PREREQ(2.52) AC_INIT(dbus/dbus.h) -AM_INIT_AUTOMAKE(dbus, 0.30) +AM_INIT_AUTOMAKE(dbus, 0.23.2) AM_CONFIG_HEADER(config.h) @@ -369,53 +369,6 @@ AC_SUBST(DBUS_INT64_CONSTANT) AC_SUBST(DBUS_UINT64_CONSTANT) AC_SUBST(DBUS_HAVE_INT64) -### see what 32-bit int is called -AC_MSG_CHECKING([32-bit integer type]) - -case 4 in -$ac_cv_sizeof_short) - dbusint32=int - ;; -$ac_cv_sizeof_int) - dbusint32=int - ;; -$ac_cv_sizeof_long) - dbusint32=long - ;; -esac - -if test -z "$dbusint32" ; then - DBUS_INT32_TYPE="no_int32_type_detected" - AC_MSG_ERROR([No 32-bit integer type found]) -else - DBUS_INT32_TYPE="$dbusint32" - AC_MSG_RESULT($DBUS_INT32_TYPE) -fi - -AC_SUBST(DBUS_INT32_TYPE) - -### see what 16-bit int is called -AC_MSG_CHECKING([16-bit integer type]) - -case 2 in -$ac_cv_sizeof_short) - dbusint16=short - ;; -$ac_cv_sizeof_int) - dbusint16=int - ;; -esac - -if test -z "$dbusint16" ; then - DBUS_INT16_TYPE="no_int16_type_detected" - AC_MSG_ERROR([No 16-bit integer type found]) -else - DBUS_INT16_TYPE="$dbusint16" - AC_MSG_RESULT($DBUS_INT16_TYPE) -fi - -AC_SUBST(DBUS_INT16_TYPE) - ## byte order AC_C_BIGENDIAN @@ -819,13 +772,6 @@ fi AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes) AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes) -if test x$have_glib = xyes; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` -else - GLIB_GENMARSHAL=glib-not-enabled-so-there-is-no-genmarshal -fi -AC_SUBST(GLIB_GENMARSHAL) - dnl GLib flags AC_SUBST(DBUS_GLIB_CFLAGS) AC_SUBST(DBUS_GLIB_LIBS) @@ -842,7 +788,6 @@ if test x$have_glib = xno ; then have_gtk=no else PKG_CHECK_MODULES(DBUS_GTK, gtk+-2.0, have_gtk=yes, have_gtk=no) - PKG_CHECK_MODULES(DBUS_GTK_THREADS, gtk+-2.0 gthread-2.0, have_gtk_threads=yes, have_gtk_threads=no) fi if test x$have_gtk = xno ; then @@ -864,8 +809,6 @@ AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes) dnl Gtk flags AC_SUBST(DBUS_GTK_CFLAGS) AC_SUBST(DBUS_GTK_LIBS) -AC_SUBST(DBUS_GTK_THREADS_CFLAGS) -AC_SUBST(DBUS_GTK_THREADS_LIBS) # Qt detection AC_PATH_PROG(QT_MOC, moc, no) @@ -1121,7 +1064,7 @@ AC_SUBST(TEST_$1) TEST_PATH(SERVICE_DIR, data/valid-service-files) TEST_PATH(SERVICE_BINARY, test-service) -TEST_PATH(GLIB_SERVICE_BINARY, glib/test-service-glib) +TEST_PATH(GLIB_SERVICE_BINARY, test-service-glib) TEST_PATH(EXIT_BINARY, test-exit) TEST_PATH(SEGFAULT_BINARY, test-segfault) TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever) @@ -1198,7 +1141,7 @@ bus/system.conf bus/session.conf bus/messagebus bus/rc.messagebus -bus/dbus-daemon.1 +bus/dbus-daemon-1.1 Makefile dbus/Makefile glib/Makefile @@ -1226,7 +1169,6 @@ test/data/valid-config-files/debug-allow-all.conf test/data/valid-config-files/debug-allow-all-sha1.conf test/data/valid-service-files/debug-echo.service test/data/valid-service-files/debug-segfault.service -test/data/valid-service-files/debug-glib.service ]) ### FIXME it's bizarre that have_qt and have_glib are used @@ -1252,8 +1194,6 @@ echo " cppflags: ${CPPFLAGS} cxxflags: ${CXXFLAGS} 64-bit int: ${DBUS_INT64_TYPE} - 32-bit int: ${DBUS_INT32_TYPE} - 16-bit int: ${DBUS_INT16_TYPE} Doxygen: ${DOXYGEN} xmlto: ${XMLTO}" diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index ae83af69..46e0c52b 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -38,6 +38,7 @@ #include "dbus-string.h" #include "dbus-pending-call.h" #include "dbus-object-tree.h" +#include "dbus-marshal.h" #ifdef DBUS_DISABLE_CHECKS #define TOOK_LOCK_CHECK(connection) @@ -124,8 +125,8 @@ * * When a connection is disconnected, you are guaranteed to get a * signal "Disconnected" from the interface - * #DBUS_INTERFACE_LOCAL, path - * #DBUS_PATH_LOCAL. + * #DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, path + * #DBUS_PATH_ORG_FREEDESKTOP_LOCAL. * * You may not drop the last reference to a #DBusConnection * until that connection has been disconnected. @@ -1137,8 +1138,8 @@ _dbus_connection_new_for_transport (DBusTransport *transport) if (io_path_cond == NULL) goto error; - disconnect_message = dbus_message_new_signal (DBUS_PATH_LOCAL, - DBUS_INTERFACE_LOCAL, + disconnect_message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_LOCAL, + DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, "Disconnected"); if (disconnect_message == NULL) @@ -3214,7 +3215,7 @@ dbus_connection_dispatch (DBusConnection *connection) if (connection->exit_on_disconnect && dbus_message_is_signal (message, - DBUS_INTERFACE_LOCAL, + DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, "Disconnected")) { _dbus_verbose ("Exiting on Disconnected signal\n"); diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c index 4a07f149..e6e1c9a3 100644 --- a/dbus/dbus-server-unix.c +++ b/dbus/dbus-server-unix.c @@ -308,7 +308,6 @@ _dbus_server_new_for_domain_socket (const char *path, int listen_fd; DBusString address; char *path_copy; - DBusString path_str; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -318,12 +317,11 @@ _dbus_server_new_for_domain_socket (const char *path, return NULL; } - _dbus_string_init_const (&path_str, path); if ((abstract && !_dbus_string_append (&address, "unix:abstract=")) || (!abstract && !_dbus_string_append (&address, "unix:path=")) || - !_dbus_address_append_escaped (&address, &path_str)) + !_dbus_string_append (&address, path)) { dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); goto failed_0; @@ -386,7 +384,6 @@ _dbus_server_new_for_tcp_socket (const char *host, DBusServer *server; int listen_fd; DBusString address; - DBusString host_str; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -399,9 +396,8 @@ _dbus_server_new_for_tcp_socket (const char *host, if (host == NULL) host = "localhost"; - _dbus_string_init_const (&host_str, host); if (!_dbus_string_append (&address, "tcp:host=") || - !_dbus_address_append_escaped (&address, &host_str) || + !_dbus_string_append (&address, host) || !_dbus_string_append (&address, ",port=") || !_dbus_string_append_int (&address, port)) { diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index c08573d8..59eb8e44 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -953,10 +953,10 @@ _dbus_transport_get_unix_user (DBusTransport *transport, { DBusCredentials auth_identity; - *uid = _DBUS_INT32_MAX; /* better than some root or system user in - * case of bugs in the caller. Caller should - * never use this value on purpose, however. - */ + *uid = _DBUS_INT_MAX; /* better than some root or system user in + * case of bugs in the caller. Caller should + * never use this value on purpose, however. + */ if (!transport->authenticated) return FALSE; diff --git a/glib/dbus-gproxy.c b/glib/dbus-gproxy.c index 65f14e12..744efdef 100644 --- a/glib/dbus-gproxy.c +++ b/glib/dbus-gproxy.c @@ -1,7 +1,7 @@ /* -*- mode: C; c-file-style: "gnu" -*- */ -/* dbus-gproxy.c Proxy for remote objects +/* dbus-gcall.c convenience routines for calling methods, etc. * - * Copyright (C) 2003, 2004, 2005 Red Hat, Inc. + * Copyright (C) 2003, 2004 Red Hat, Inc. * * Licensed under the Academic Free License version 2.1 * @@ -23,9 +23,6 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include "dbus-gutils.h" -#include "dbus-gmarshal.h" -#include "dbus-gvalue.h" -#include "dbus-gobject.h" #include <string.h> /** @@ -48,11 +45,9 @@ struct DBusGProxy GObject parent; /**< Parent instance */ DBusGProxyManager *manager; /**< Proxy manager */ - char *name; /**< Name messages go to or NULL */ + char *service; /**< Service messages go to or NULL */ char *path; /**< Path messages go to or NULL */ char *interface; /**< Interface messages go to or NULL */ - - GData *signal_signatures; /**< D-BUS signatures for each signal */ }; /** @@ -63,23 +58,24 @@ struct DBusGProxyClass GObjectClass parent_class; /**< Parent class */ }; -static void dbus_g_proxy_init (DBusGProxy *proxy); -static void dbus_g_proxy_class_init (DBusGProxyClass *klass); -static void dbus_g_proxy_finalize (GObject *object); -static void dbus_g_proxy_dispose (GObject *object); -static void dbus_g_proxy_destroy (DBusGProxy *proxy); -static void dbus_g_proxy_emit_remote_signal (DBusGProxy *proxy, - DBusMessage *message); +static void dbus_g_proxy_init (DBusGProxy *proxy); +static void dbus_g_proxy_class_init (DBusGProxyClass *klass); +static void dbus_g_proxy_finalize (GObject *object); +static void dbus_g_proxy_dispose (GObject *object); +static void dbus_g_proxy_destroy (DBusGProxy *proxy); +static void dbus_g_proxy_emit_received (DBusGProxy *proxy, + DBusMessage *message); + /** - * A list of proxies with a given name+path+interface, used to + * A list of proxies with a given service+path+interface, used to * route incoming signals. */ typedef struct { GSList *proxies; /**< The list of proxies */ - char name[4]; /**< name (empty string for none), nul byte, + char name[4]; /**< service (empty string for none), nul byte, * path, nul byte, * interface, nul byte */ @@ -89,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 names proxies are bound to. + * track the owners of the services proxies are bound to. */ struct DBusGProxyManager { @@ -104,10 +100,9 @@ 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)) @@ -298,48 +293,48 @@ tristring_equal (gconstpointer a, static char* tristring_alloc_from_strings (size_t padding_before, - const char *name, + const char *service, const char *path, const char *interface) { - size_t name_len, iface_len, path_len, len; + size_t service_len, iface_len, path_len, len; char *tri; - if (name) - name_len = strlen (name); + if (service) + service_len = strlen (service); else - name_len = 0; + service_len = 0; path_len = strlen (path); iface_len = strlen (interface); - tri = g_malloc (padding_before + name_len + path_len + iface_len + 3); + tri = g_malloc (padding_before + service_len + path_len + iface_len + 3); len = padding_before; - if (name) - memcpy (&tri[len], name, name_len); + if (service) + memcpy (&tri[len], service, service_len); - len += name_len; + len += service_len; tri[len] = '\0'; len += 1; - g_assert (len == (padding_before + name_len + 1)); + g_assert (len == (padding_before + service_len + 1)); memcpy (&tri[len], path, path_len); len += path_len; tri[len] = '\0'; len += 1; - g_assert (len == (padding_before + name_len + path_len + 2)); + g_assert (len == (padding_before + service_len + path_len + 2)); memcpy (&tri[len], interface, iface_len); len += iface_len; tri[len] = '\0'; len += 1; - g_assert (len == (padding_before + name_len + path_len + iface_len + 3)); + g_assert (len == (padding_before + service_len + path_len + iface_len + 3)); return tri; } @@ -348,7 +343,7 @@ static char* tristring_from_proxy (DBusGProxy *proxy) { return tristring_alloc_from_strings (0, - proxy->name, + proxy->service, proxy->path, proxy->interface); } @@ -356,18 +351,10 @@ tristring_from_proxy (DBusGProxy *proxy) static char* tristring_from_message (DBusMessage *message) { - const char *path; - const char *interface; - - path = dbus_message_get_path (message); - interface = dbus_message_get_interface (message); - - g_assert (path); - g_assert (interface); - return tristring_alloc_from_strings (0, dbus_message_get_sender (message), - path, interface); + dbus_message_get_path (message), + dbus_message_get_interface (message)); } static DBusGProxyList* @@ -376,7 +363,7 @@ g_proxy_list_new (DBusGProxy *first_proxy) DBusGProxyList *list; list = (void*) tristring_alloc_from_strings (G_STRUCT_OFFSET (DBusGProxyList, name), - first_proxy->name, + first_proxy->service, first_proxy->path, first_proxy->interface); list->proxies = NULL; @@ -400,9 +387,9 @@ g_proxy_get_match_rule (DBusGProxy *proxy) { /* FIXME Escaping is required here */ - if (proxy->name) + if (proxy->service) return g_strdup_printf ("type='signal',sender='%s',path='%s',interface='%s'", - proxy->name, proxy->path, proxy->interface); + proxy->service, proxy->path, proxy->interface); else return g_strdup_printf ("type='signal',path='%s',interface='%s'", proxy->path, proxy->interface); @@ -410,7 +397,7 @@ g_proxy_get_match_rule (DBusGProxy *proxy) static void dbus_g_proxy_manager_register (DBusGProxyManager *manager, - DBusGProxy *proxy) + DBusGProxy *proxy) { DBusGProxyList *list; @@ -565,8 +552,8 @@ dbus_g_proxy_manager_list_all (DBusGProxyManager *manager) static DBusHandlerResult dbus_g_proxy_manager_filter (DBusConnection *connection, - DBusMessage *message, - void *user_data) + DBusMessage *message, + void *user_data) { DBusGProxyManager *manager; @@ -580,7 +567,7 @@ dbus_g_proxy_manager_filter (DBusConnection *connection, LOCK_MANAGER (manager); if (dbus_message_is_signal (message, - DBUS_INTERFACE_LOCAL, + DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, "Disconnected")) { /* Destroy all the proxies, quite possibly resulting in unreferencing @@ -617,11 +604,6 @@ dbus_g_proxy_manager_filter (DBusConnection *connection, { char *tri; DBusGProxyList *list; - - /* dbus spec requires these, libdbus validates */ - g_assert (dbus_message_get_path (message) != NULL); - g_assert (dbus_message_get_interface (message) != NULL); - g_assert (dbus_message_get_member (message) != NULL); tri = tristring_from_message (message); @@ -658,7 +640,7 @@ dbus_g_proxy_manager_filter (DBusConnection *connection, proxy = DBUS_G_PROXY (tmp->data); UNLOCK_MANAGER (manager); - dbus_g_proxy_emit_remote_signal (proxy, message); + dbus_g_proxy_emit_received (proxy, message); g_object_unref (G_OBJECT (proxy)); LOCK_MANAGER (manager); @@ -682,15 +664,7 @@ dbus_g_proxy_manager_filter (DBusConnection *connection, /* ---------- DBusGProxy -------------- */ -#define DBUS_G_PROXY_DESTROYED(proxy) (DBUS_G_PROXY (proxy)->manager == NULL) -static void -marshal_dbus_message_to_g_marshaller (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); enum { @@ -705,7 +679,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; static void dbus_g_proxy_init (DBusGProxy *proxy) { - g_datalist_init (&proxy->signal_signatures); + /* Nothing */ } static void @@ -726,17 +700,19 @@ dbus_g_proxy_class_init (DBusGProxyClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + signals[RECEIVED] = g_signal_new ("received", G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, + G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, - marshal_dbus_message_to_g_marshaller, - G_TYPE_NONE, 2, DBUS_TYPE_MESSAGE, G_TYPE_STRING); + NULL, NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_NONE, 1, + DBUS_TYPE_MESSAGE); } + static void dbus_g_proxy_dispose (GObject *object) { @@ -744,15 +720,6 @@ dbus_g_proxy_dispose (GObject *object) proxy = DBUS_G_PROXY (object); - if (proxy->manager) - { - dbus_g_proxy_manager_unregister (proxy->manager, proxy); - dbus_g_proxy_manager_unref (proxy->manager); - proxy->manager = NULL; - } - - g_datalist_clear (&proxy->signal_signatures); - g_signal_emit (object, signals[DESTROY], 0); G_OBJECT_CLASS (parent_class)->dispose (object); @@ -762,12 +729,16 @@ static void dbus_g_proxy_finalize (GObject *object) { DBusGProxy *proxy; - + proxy = DBUS_G_PROXY (object); - g_return_if_fail (DBUS_G_PROXY_DESTROYED (proxy)); + if (proxy->manager) + { + dbus_g_proxy_manager_unregister (proxy->manager, proxy); + dbus_g_proxy_manager_unref (proxy->manager); + } - g_free (proxy->name); + g_free (proxy->service); g_free (proxy->path); g_free (proxy->interface); @@ -783,169 +754,29 @@ dbus_g_proxy_destroy (DBusGProxy *proxy) g_object_run_dispose (G_OBJECT (proxy)); } -/* this is to avoid people using g_signal_connect() directly, - * to avoid confusion with local signal names, and because - * of the horribly broken current setup (signals are added - * globally to all proxies) - */ static char* -create_signal_name (const char *interface, - const char *signal) +create_signal_detail (const char *interface, + const char *signal) { GString *str; - char *p; str = g_string_new (interface); - g_string_append (str, "-"); - + g_string_append (str, "."); + g_string_append (str, signal); - /* GLib will silently barf on '.' in signal names */ - p = str->str; - while (*p) - { - if (*p == '.') - *p = '-'; - ++p; - } - return g_string_free (str, FALSE); } -static GSignalCMarshaller -lookup_g_marshaller (DBusGProxy *proxy, - const char *signature) -{ - /* The "proxy" arg would eventually be used if you could provide - * a marshaller when adding a signal to the proxy - */ - -#define MATCH1(sig, t0) ((sig)[0] == (DBUS_TYPE_##t0) && (sig)[1] == '\0') -#define MATCH2(sig, t0, t1) ((sig)[0] == (DBUS_TYPE_##t0) && (sig)[1] == (DBUS_TYPE_##t1) && (sig)[2] == '\0') -#define MATCH3(sig, t0, t1, t2) ((sig)[0] == (DBUS_TYPE_##t0) && (sig)[1] == (DBUS_TYPE_##t1) && (sig)[2] == (DBUS_TYPE_##t2) && (sig)[3] == '\0') - - switch (*signature) - { - case '\0': - return g_cclosure_marshal_VOID__VOID; - - case DBUS_TYPE_BOOLEAN: - if (MATCH1 (signature, BOOLEAN)) - return g_cclosure_marshal_VOID__BOOLEAN; - break; - - case DBUS_TYPE_BYTE: - if (MATCH1 (signature, BYTE)) - return g_cclosure_marshal_VOID__UCHAR; - break; - - case DBUS_TYPE_INT16: - if (MATCH1 (signature, INT16)) - return g_cclosure_marshal_VOID__INT; - break; - - case DBUS_TYPE_UINT16: - if (MATCH1 (signature, UINT16)) - return g_cclosure_marshal_VOID__UINT; - break; - - case DBUS_TYPE_INT32: - if (MATCH1 (signature, INT32)) - return g_cclosure_marshal_VOID__INT; - break; - - case DBUS_TYPE_UINT32: - if (MATCH1 (signature, UINT32)) - return g_cclosure_marshal_VOID__UINT; - break; - - case DBUS_TYPE_DOUBLE: - if (MATCH1 (signature, DOUBLE)) - return g_cclosure_marshal_VOID__DOUBLE; - break; - - case DBUS_TYPE_OBJECT_PATH: - if (MATCH1 (signature, OBJECT_PATH)) - return g_cclosure_marshal_VOID__STRING; - break; - - case DBUS_TYPE_SIGNATURE: - if (MATCH1 (signature, SIGNATURE)) - return g_cclosure_marshal_VOID__STRING; - break; - - case DBUS_TYPE_STRING: - if (MATCH1 (signature, STRING)) - return g_cclosure_marshal_VOID__STRING; - /* This is for NameOwnerChanged */ - else if (MATCH3 (signature, STRING, STRING, STRING)) - return _dbus_g_marshal_NONE__STRING_STRING_STRING; - break; - } - - return NULL; -} - static void -marshal_dbus_message_to_g_marshaller (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - /* Incoming here we have three params, the instance (Proxy), the - * DBusMessage, the signature. We want to convert that to an - * expanded GValue array, then call an appropriate normal GLib - * marshaller. - */ -#define MAX_SIGNATURE_ARGS 20 - GValueArray *value_array; - GValue value = {0, }; - GSignalCMarshaller c_marshaller; - DBusGProxy *proxy; - DBusMessage *message; - const char *signature; - - g_assert (n_param_values == 3); - - proxy = g_value_get_object (¶m_values[0]); - message = g_value_get_boxed (¶m_values[1]); - signature = g_value_get_string (¶m_values[2]); - - g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - g_return_if_fail (message != NULL); - g_return_if_fail (signature != NULL); - - c_marshaller = lookup_g_marshaller (proxy, signature); - - g_return_if_fail (c_marshaller != NULL); - - value_array = _dbus_glib_marshal_dbus_message_to_gvalue_array (message); - - g_return_if_fail (value_array != NULL); - - g_value_init (&value, G_TYPE_FROM_INSTANCE (proxy)); - g_value_set_instance (&value, proxy); - g_value_array_prepend (value_array, &value); - - (* c_marshaller) (closure, return_value, value_array->n_values, - value_array->values, invocation_hint, marshal_data); - - g_value_array_free (value_array); -} - -static void -dbus_g_proxy_emit_remote_signal (DBusGProxy *proxy, - DBusMessage *message) +dbus_g_proxy_emit_received (DBusGProxy *proxy, + DBusMessage *message) { const char *interface; const char *signal; - char *name; + char *detail; GQuark q; - - g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); interface = dbus_message_get_interface (message); signal = dbus_message_get_member (message); @@ -953,47 +784,21 @@ dbus_g_proxy_emit_remote_signal (DBusGProxy *proxy, g_assert (interface != NULL); g_assert (signal != NULL); - name = create_signal_name (interface, signal); + detail = create_signal_detail (interface, signal); /* If the quark isn't preexisting, there's no way there * are any handlers connected. We don't want to create * extra quarks for every possible signal. */ - q = g_quark_try_string (name); + q = g_quark_try_string (detail); if (q != 0) - { - const char *signature; + g_signal_emit (G_OBJECT (proxy), + signals[RECEIVED], + q, + message); - signature = g_datalist_id_get_data (&proxy->signal_signatures, q); - if (signature == NULL) - { -#if 0 - /* this should not trigger a warning, as you shouldn't have to - * add signals you don't care about - */ - g_warning ("Signal '%s' has not been added to this proxy object\n", - name); -#endif - } - else if (!dbus_message_has_signature (message, signature)) - { - g_warning ("Signature '%s' expected for signal '%s', actual signature '%s'\n", - signature, - name, - dbus_message_get_signature (message)); - } - else - { - g_signal_emit (proxy, - signals[RECEIVED], - q, - message, - signature); - } - } - - g_free (name); + g_free (detail); } /** @} End of DBusGLibInternals */ @@ -1037,9 +842,9 @@ dbus_g_proxy_get_type (void) static DBusGProxy* dbus_g_proxy_new (DBusGConnection *connection, - const char *name, - const char *path_name, - const char *interface_name) + const char *service_name, + const char *path_name, + const char *interface_name) { DBusGProxy *proxy; @@ -1053,7 +858,7 @@ dbus_g_proxy_new (DBusGConnection *connection, proxy->manager = dbus_g_proxy_manager_get (DBUS_CONNECTION_FROM_G_CONNECTION (connection)); - proxy->name = g_strdup (name); + proxy->service = g_strdup (service_name); proxy->path = g_strdup (path_name); proxy->interface = g_strdup (interface_name); @@ -1063,105 +868,101 @@ dbus_g_proxy_new (DBusGConnection *connection, } /** - * 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(). + * 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(). * - * A name-associated proxy only makes sense with a message bus, not - * for app-to-app direct dbus connections. + * A service-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, 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. + * This proxy will only emit the "destroy" signal if the #DBusConnection + * is disconnected or the proxy is has no remaining references. * * @param connection the connection to the remote bus - * @param name any name on the message bus - * @param path_name name of the object instance to call methods on + * @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 interface_name name of the interface to call methods on * @returns new proxy object */ DBusGProxy* -dbus_g_proxy_new_for_name (DBusGConnection *connection, - const char *name, - const char *path_name, - const char *interface_name) +dbus_g_proxy_new_for_service (DBusGConnection *connection, + const char *service_name, + const char *path_name, + const char *interface_name) { DBusGProxy *proxy; g_return_val_if_fail (connection != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (service_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, name, + proxy = dbus_g_proxy_new (connection, service_name, path_name, interface_name); return proxy; } /** - * 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. + * 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. * - * 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. + * 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. * * @param connection the connection to the remote bus - * @param name any name on the message 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 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_name_owner (DBusGConnection *connection, - const char *name, - const char *path_name, - const char *interface_name, - GError **error) +dbus_g_proxy_new_for_service_owner (DBusGConnection *connection, + const char *service_name, + const char *path_name, + const char *interface_name, + GError **error) { DBusGProxy *proxy; DBusMessage *request, *reply; DBusError derror; - const char *unique_name; - + char *base_service_name; + g_return_val_if_fail (connection != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (service_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; - unique_name = NULL; + base_service_name = NULL; reply = NULL; - request = dbus_message_new_method_call (DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS, - "GetNameOwner"); + request = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, + DBUS_PATH_ORG_FREEDESKTOP_DBUS, + DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, + "GetServiceOwner"); if (request == NULL) g_error ("Out of memory"); if (! dbus_message_append_args (request, - DBUS_TYPE_STRING, &name, + DBUS_TYPE_STRING, service_name, DBUS_TYPE_INVALID)) g_error ("Out of memory"); @@ -1176,13 +977,13 @@ dbus_g_proxy_new_for_name_owner (DBusGConnection *connection, goto error; if (! dbus_message_get_args (reply, &derror, - DBUS_TYPE_STRING, &unique_name, + DBUS_TYPE_STRING, &base_service_name, DBUS_TYPE_INVALID)) goto error; - proxy = dbus_g_proxy_new (connection, unique_name, - path_name, interface_name); + proxy = dbus_g_proxy_new (connection, base_service_name, + path_name, interface_name); goto out; @@ -1196,6 +997,7 @@ dbus_g_proxy_new_for_name_owner (DBusGConnection *connection, dbus_message_unref (request); if (reply) dbus_message_unref (reply); + dbus_free (base_service_name); return proxy; } @@ -1216,8 +1018,8 @@ dbus_g_proxy_new_for_name_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; @@ -1226,32 +1028,12 @@ dbus_g_proxy_new_for_peer (DBusGConnection *connection, g_return_val_if_fail (interface_name != NULL, NULL); proxy = dbus_g_proxy_new (connection, NULL, - path_name, interface_name); + path_name, interface_name); return proxy; } /** - * Gets the bus name a proxy is bound to (may be #NULL in some cases). - * If you created the proxy with dbus_g_proxy_new_for_name(), then - * the name you passed to that will be returned. - * If you created it with dbus_g_proxy_new_for_name_owner(), then the - * unique connection name will be returned. If you created it - * with dbus_g_proxy_new_for_peer() then #NULL will be returned. - * - * @param proxy the proxy - * @returns the bus name the proxy sends messages to - */ -const char* -dbus_g_proxy_get_bus_name (DBusGProxy *proxy) -{ - g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL); - g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), NULL); - - return proxy->name; -} - -/** * Invokes a method on a remote interface. This function does not * block; instead it returns an opaque #DBusPendingCall object that * tracks the pending call. The method call will not be sent over the @@ -1281,9 +1063,8 @@ dbus_g_proxy_begin_call (DBusGProxy *proxy, va_list args; g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL); - g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), NULL); - message = dbus_message_new_method_call (proxy->name, + message = dbus_message_new_method_call (proxy->service, proxy->path, proxy->interface, method); @@ -1318,43 +1099,39 @@ dbus_g_proxy_begin_call (DBusGProxy *proxy, * Collects the results of a method call. The method call was normally * initiated with dbus_g_proxy_end_call(). This function will block if * the results haven't yet been received; use - * dbus_g_pending_call_set_notify() to be notified asynchronously that a - * pending call has been completed. If it's completed, it will not block. + * dbus_pending_call_set_notify() to be notified asynchronously that a + * pending call has been completed. Use + * dbus_pending_call_get_completed() to check whether a call has been + * completed. If it's completed, it will not block. * * If the call results in an error, the error is set as normal for * GError and the function returns #FALSE. * * Otherwise, the "out" parameters and return value of the * method are stored in the provided varargs list. - * The list should be terminated with #DBUS_TYPE_INVALID. + * The list should be terminated with DBUS_TYPE_INVALID. * * This function doesn't affect the reference count of the - * #DBusGPendingCall, the caller of dbus_g_proxy_begin_call() still owns + * #DBusPendingCall, the caller of dbus_g_proxy_begin_call() still owns * a reference. * - * @todo this should be changed to make a g_malloc() copy of the - * data returned probably; right now the data vanishes - * when you free the PendingCall which is sort of strange. - * * @param proxy a proxy for a remote interface * @param pending the pending call from dbus_g_proxy_begin_call() * @param error return location for an error * @param first_arg_type type of first "out" argument - * @returns #FALSE if an error is set - */ + * @returns #FALSE if an error is set */ gboolean dbus_g_proxy_end_call (DBusGProxy *proxy, - DBusGPendingCall *pending, - GError **error, - int first_arg_type, - ...) + DBusGPendingCall *pending, + GError **error, + int first_arg_type, + ...) { DBusMessage *message; va_list args; DBusError derror; g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), FALSE); - g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), FALSE); g_return_val_if_fail (pending != NULL, FALSE); dbus_pending_call_block (DBUS_PENDING_CALL_FROM_G_PENDING_CALL (pending)); @@ -1390,7 +1167,6 @@ dbus_g_proxy_end_call (DBusGProxy *proxy, error: dbus_message_unref (message); - dbus_set_g_error (error, &derror); dbus_error_free (&derror); return FALSE; @@ -1417,9 +1193,8 @@ dbus_g_proxy_call_no_reply (DBusGProxy *proxy, va_list args; g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); - message = dbus_message_new_method_call (proxy->name, + message = dbus_message_new_method_call (proxy->service, proxy->path, proxy->interface, method); @@ -1452,7 +1227,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 name field or whatever is needed will be + * That is, a destination service 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(). @@ -1465,15 +1240,14 @@ dbus_g_proxy_call_no_reply (DBusGProxy *proxy, * @param client_serial return location for message's serial, or #NULL */ void dbus_g_proxy_send (DBusGProxy *proxy, - DBusMessage *message, - dbus_uint32_t *client_serial) + DBusMessage *message, + dbus_uint32_t *client_serial) { g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); - if (proxy->name) + if (proxy->service) { - if (!dbus_message_set_destination (message, proxy->name)) + if (!dbus_message_set_destination (message, proxy->service)) g_error ("Out of memory"); } if (proxy->path) @@ -1492,49 +1266,14 @@ dbus_g_proxy_send (DBusGProxy *proxy, } /** - * Specifies the signature of a signal, such that it's possible to - * connect to the signal on this proxy. - * - * @param proxy the proxy for a remote interface - * @param signal_name the name of the signal - * @param signature D-BUS signature of the signal - */ -void -dbus_g_proxy_add_signal (DBusGProxy *proxy, - const char *signal_name, - const char *signature) -{ - GQuark q; - char *name; - - g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); - g_return_if_fail (signal_name != NULL); - g_return_if_fail (signature != NULL); -#ifndef G_DISABLE_CHECKS - if (lookup_g_marshaller (proxy, signature) == NULL) - g_warning ("No marshaller for signature '%s', we need to add API for providing your own", - signature); -#endif - - name = create_signal_name (proxy->interface, signal_name); - - q = g_quark_from_string (name); - - g_return_if_fail (g_datalist_id_get_data (&proxy->signal_signatures, q) == NULL); - - g_datalist_id_set_data_full (&proxy->signal_signatures, - q, g_strdup (signature), - g_free); - - g_free (name); -} - -/** * Connect a signal handler to a proxy for a remote interface. When * the remote interface emits the specified signal, the proxy will * emit a corresponding GLib signal. * + * @todo Right now there's no way to specify the signature to use + * for invoking the GCallback. Need to either rely on introspection, + * or require signature here. + * * @param proxy a proxy for a remote interface * @param signal_name the DBus signal name to listen for * @param handler the handler to connect @@ -1543,41 +1282,27 @@ dbus_g_proxy_add_signal (DBusGProxy *proxy, */ void dbus_g_proxy_connect_signal (DBusGProxy *proxy, - const char *signal_name, - GCallback handler, - void *data, - GClosureNotify free_data_func) + const char *signal_name, + GCallback handler, + void *data, + GClosureNotify free_data_func) { - char *name; GClosure *closure; - GQuark q; + char *detail; g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); g_return_if_fail (signal_name != NULL); g_return_if_fail (handler != NULL); - name = create_signal_name (proxy->interface, signal_name); - - q = g_quark_try_string (name); - -#ifndef G_DISABLE_CHECKS - if (q == 0 || g_datalist_id_get_data (&proxy->signal_signatures, q) == NULL) - { - g_warning ("Must add the signal '%s' with dbus_g_proxy_add_signal() prior to connecting to it\n", name); - g_free (name); - return; - } -#endif + detail = create_signal_detail (proxy->interface, signal_name); closure = g_cclosure_new (G_CALLBACK (handler), data, free_data_func); - g_signal_connect_closure_by_id (G_OBJECT (proxy), signals[RECEIVED], - q, + g_quark_from_string (detail), closure, FALSE); - - g_free (name); + + g_free (detail); } /** @@ -1591,40 +1316,38 @@ dbus_g_proxy_connect_signal (DBusGProxy *proxy, */ void dbus_g_proxy_disconnect_signal (DBusGProxy *proxy, - const char *signal_name, - GCallback handler, - void *data) + const char *signal_name, + GCallback handler, + void *data) { - char *name; + char *detail; GQuark q; g_return_if_fail (DBUS_IS_G_PROXY (proxy)); - g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); g_return_if_fail (signal_name != NULL); g_return_if_fail (handler != NULL); - name = create_signal_name (proxy->interface, signal_name); + detail = create_signal_detail (proxy->interface, signal_name); + q = g_quark_try_string (detail); + g_free (detail); - q = g_quark_try_string (name); - - if (q != 0) - { - g_signal_handlers_disconnect_matched (G_OBJECT (proxy), - G_SIGNAL_MATCH_DETAIL | - G_SIGNAL_MATCH_FUNC | - G_SIGNAL_MATCH_DATA, - signals[RECEIVED], - q, - NULL, - G_CALLBACK (handler), data); - } - else +#ifndef G_DISABLE_CHECKS + if (q == 0) { - g_warning ("Attempt to disconnect from signal '%s' which is not registered\n", - name); + g_warning ("%s: No signal handlers for %s found on this DBusGProxy", + G_GNUC_FUNCTION, signal_name); + return; } +#endif - g_free (name); + g_signal_handlers_disconnect_matched (G_OBJECT (proxy), + G_SIGNAL_MATCH_DETAIL | + G_SIGNAL_MATCH_FUNC | + G_SIGNAL_MATCH_DATA, + signals[RECEIVED], + q, + NULL, + G_CALLBACK (handler), data); } /** @} End of DBusGLib public */ diff --git a/mono/Connection.cs b/mono/Connection.cs index 699fee9e..5eb4a9f4 100644 --- a/mono/Connection.cs +++ b/mono/Connection.cs @@ -121,11 +121,11 @@ namespace DBus this.matches.Remove (match_rule); } - public string UniqueName + public string BaseService { get { - return Marshal.PtrToStringAnsi (dbus_bus_get_unique_name (RawConnection)); + return Marshal.PtrToStringAnsi (dbus_bus_get_base_service (RawConnection)); } } @@ -237,7 +237,7 @@ namespace DBus private extern static void dbus_connection_disconnect (IntPtr ptr); [DllImport ("dbus-1")] - private extern static IntPtr dbus_bus_get_unique_name (IntPtr ptr); + private extern static IntPtr dbus_bus_get_base_service (IntPtr ptr); [DllImport("dbus-1")] private extern static bool dbus_connection_add_filter(IntPtr rawConnection, diff --git a/mono/Service.cs b/mono/Service.cs index 4280c6b3..183f8a71 100644 --- a/mono/Service.cs +++ b/mono/Service.cs @@ -20,9 +20,6 @@ namespace DBus private static AssemblyBuilder proxyAssembly; private ModuleBuilder module = null; - // Add a match for signals. FIXME: Can we filter the service? - private const string MatchRule = "type='signal'"; - internal Service(string name, Connection connection) { this.name = name; @@ -38,7 +35,7 @@ namespace DBus // This isn't used for now uint flags = 0; - if (dbus_bus_request_name (connection.RawConnection, name, flags, ref error) == -1) { + if (dbus_bus_acquire_service(connection.RawConnection, name, flags, ref error) == -1) { throw new DBusException(error); } @@ -47,12 +44,12 @@ namespace DBus this.local = true; } - public static bool HasOwner(Connection connection, string name) + public static bool Exists(Connection connection, string name) { Error error = new Error(); error.Init(); - if (dbus_bus_name_has_owner(connection.RawConnection, + if (dbus_bus_service_exists(connection.RawConnection, name, ref error)) { return true; @@ -66,10 +63,10 @@ namespace DBus public static Service Get(Connection connection, string name) { - if (HasOwner(connection, name)) { + if (Exists(connection, name)) { return new Service(name, connection); } else { - throw new ApplicationException("Name '" + name + "' does not exist."); + throw new ApplicationException("Service '" + name + "' does not exist."); } } @@ -178,14 +175,15 @@ namespace DBus } [DllImport("dbus-1")] - private extern static int dbus_bus_request_name(IntPtr rawConnection, - string serviceName, - uint flags, ref Error error); + private extern static int dbus_bus_acquire_service(IntPtr rawConnection, + string serviceName, + uint flags, ref Error error); [DllImport("dbus-1")] - private extern static bool dbus_bus_name_has_owner(IntPtr rawConnection, + private extern static bool dbus_bus_service_exists(IntPtr rawConnection, string serviceName, ref Error error); + } } |