27#include "dbus-shared.h"
28#include "dbus-connection.h"
30#include "dbus-timeout.h"
31#include "dbus-transport.h"
32#include "dbus-watch.h"
33#include "dbus-connection-internal.h"
34#include "dbus-pending-call-internal.h"
37#include "dbus-message-internal.h"
38#include "dbus-message-private.h"
39#include "dbus-threads.h"
40#include "dbus-protocol.h"
41#include "dbus-dataslot.h"
42#include "dbus-string.h"
43#include "dbus-signature.h"
44#include "dbus-pending-call.h"
45#include "dbus-object-tree.h"
46#include "dbus-threads-internal.h"
48#include "dbus-marshal-basic.h"
50#ifdef DBUS_DISABLE_CHECKS
51#define TOOK_LOCK_CHECK(connection)
52#define RELEASING_LOCK_CHECK(connection)
53#define HAVE_LOCK_CHECK(connection)
55#define TOOK_LOCK_CHECK(connection) do { \
56 _dbus_assert (!(connection)->have_connection_lock); \
57 (connection)->have_connection_lock = TRUE; \
59#define RELEASING_LOCK_CHECK(connection) do { \
60 _dbus_assert ((connection)->have_connection_lock); \
61 (connection)->have_connection_lock = FALSE; \
63#define HAVE_LOCK_CHECK(connection) _dbus_assert ((connection)->have_connection_lock)
69#define CONNECTION_LOCK(connection) do { \
70 if (TRACE_LOCKS) { _dbus_verbose ("LOCK\n"); } \
71 _dbus_rmutex_lock ((connection)->mutex); \
72 TOOK_LOCK_CHECK (connection); \
75#define CONNECTION_UNLOCK(connection) _dbus_connection_unlock (connection)
77#define SLOTS_LOCK(connection) do { \
78 _dbus_rmutex_lock ((connection)->slot_mutex); \
81#define SLOTS_UNLOCK(connection) do { \
82 _dbus_rmutex_unlock ((connection)->slot_mutex); \
85#define DISPATCH_STATUS_NAME(s) \
86 ((s) == DBUS_DISPATCH_COMPLETE ? "complete" : \
87 (s) == DBUS_DISPATCH_DATA_REMAINS ? "data remains" : \
88 (s) == DBUS_DISPATCH_NEED_MEMORY ? "need memory" : \
214#ifdef DBUS_ENABLE_VERBOSE_MODE
215 static int enabled = -1;
217 _dbus_trace_ref (
"DBusConnection", connection, old_refcount, new_refcount,
218 why,
"DBUS_CONNECTION_TRACE", &enabled);
249#if HAVE_DECL_MSG_NOSIGNAL
333#ifndef DBUS_DISABLE_CHECKS
337#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT)
343static void _dbus_connection_update_dispatch_status_and_unlock (
DBusConnection *connection,
345static void _dbus_connection_last_unref (
DBusConnection *connection);
346static void _dbus_connection_acquire_dispatch (
DBusConnection *connection);
347static void _dbus_connection_release_dispatch (
DBusConnection *connection);
349static void _dbus_connection_close_possibly_shared_and_unlock (
DBusConnection *connection);
350static dbus_bool_t _dbus_connection_get_is_connected_unlocked (
DBusConnection *connection);
351static dbus_bool_t _dbus_connection_peek_for_reply_unlocked (
DBusConnection *connection,
352 dbus_uint32_t client_serial);
357#ifdef DBUS_DISABLE_ASSERT
360 dbus_int32_t old_value;
372 dbus_int32_t old_value;
394 CONNECTION_LOCK (connection);
410 _dbus_verbose (
"UNLOCK\n");
418 RELEASING_LOCK_CHECK (connection);
446#ifdef DBUS_ENABLE_EMBEDDED_TESTS
470 *dispatch_cond_loc = connection->dispatch_cond;
471 *io_path_cond_loc = connection->io_path_cond;
488 dbus_uint32_t reply_serial;
495 message = link->
data;
499 if (reply_serial != 0)
517 _dbus_connection_wakeup_mainloop (connection);
519 _dbus_verbose (
"Message %p (%s %s %s %s '%s' reply to %u) added to incoming queue %p, %d incoming\n",
536 _dbus_message_trace_ref (message, -1, -1,
537 "_dbus_conection_queue_received_message_link");
552 HAVE_LOCK_CHECK (connection);
558 _dbus_connection_wakeup_mainloop (connection);
560 _dbus_message_trace_ref (link->
data, -1, -1,
561 "_dbus_connection_queue_synthesized_message_link");
563 _dbus_verbose (
"Synthesized message %p added to incoming queue %p, %d incoming\n",
578 HAVE_LOCK_CHECK (connection);
596 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
598 CONNECTION_LOCK (connection);
600 CONNECTION_UNLOCK (connection);
615 HAVE_LOCK_CHECK (connection);
634 HAVE_LOCK_CHECK (connection);
651 _dbus_verbose (
"Message %p (%s %s %s %s '%s') removed from outgoing queue %p, %d left to send\n",
682 dbus_bool_t enabled);
694 HAVE_LOCK_CHECK (connection);
717 retval = (* add_function) (connection->
watches, watch);
718 else if (remove_function)
721 (* remove_function) (connection->
watches, watch);
726 (* toggle_function) (connection->
watches, watch, enabled);
750 return protected_change_watch (connection, watch,
768 protected_change_watch (connection, watch,
791 protected_change_watch (connection, watch,
806 dbus_bool_t enabled);
818 HAVE_LOCK_CHECK (connection);
841 retval = (* add_function) (connection->
timeouts, timeout);
842 else if (remove_function)
845 (* remove_function) (connection->
timeouts, timeout);
850 (* toggle_function) (connection->
timeouts, timeout, enabled);
874 return protected_change_timeout (connection, timeout,
892 protected_change_timeout (connection, timeout,
913 protected_change_timeout (connection, timeout,
920_dbus_connection_attach_pending_call_unlocked (
DBusConnection *connection,
923 dbus_uint32_t reply_serial;
926 HAVE_LOCK_CHECK (connection);
946 HAVE_LOCK_CHECK (connection);
958 HAVE_LOCK_CHECK (connection);
965 HAVE_LOCK_CHECK (connection);
971free_pending_call_on_hash_removal (
void *data)
983 HAVE_LOCK_CHECK (connection);
1000 CONNECTION_LOCK (connection);
1005_dbus_connection_detach_pending_call_unlocked (
DBusConnection *connection,
1016_dbus_connection_detach_pending_call_and_unlock (
DBusConnection *connection,
1051 CONNECTION_LOCK (connection);
1052 _dbus_connection_detach_pending_call_and_unlock (connection, pending);
1066 int timeout_milliseconds)
1068 dbus_bool_t we_acquired;
1070 HAVE_LOCK_CHECK (connection);
1076 CONNECTION_UNLOCK (connection);
1078 _dbus_verbose (
"locking io_path_mutex\n");
1081 _dbus_verbose (
"start connection->io_path_acquired = %d timeout = %d\n",
1084 we_acquired =
FALSE;
1088 if (timeout_milliseconds != -1)
1090 _dbus_verbose (
"waiting %d for IO path to be acquirable\n",
1091 timeout_milliseconds);
1095 timeout_milliseconds))
1111 _dbus_verbose (
"waiting for IO path to be acquirable\n");
1124 _dbus_verbose (
"end connection->io_path_acquired = %d we_acquired = %d\n",
1127 _dbus_verbose (
"unlocking io_path_mutex\n");
1130 CONNECTION_LOCK (connection);
1132 HAVE_LOCK_CHECK (connection);
1149 HAVE_LOCK_CHECK (connection);
1151 _dbus_verbose (
"locking io_path_mutex\n");
1156 _dbus_verbose (
"start connection->io_path_acquired = %d\n",
1162 _dbus_verbose (
"unlocking io_path_mutex\n");
1205 int timeout_milliseconds)
1207 _dbus_verbose (
"start\n");
1209 HAVE_LOCK_CHECK (connection);
1212 flags &= ~DBUS_ITERATION_DO_WRITING;
1214 if (_dbus_connection_acquire_io_path (connection,
1215 (flags & DBUS_ITERATION_BLOCK) ? timeout_milliseconds : 0))
1217 HAVE_LOCK_CHECK (connection);
1221 _dbus_verbose (
"pending call completed while acquiring I/O path");
1223 else if ( (pending !=
NULL) &&
1224 _dbus_connection_peek_for_reply_unlocked (connection,
1227 _dbus_verbose (
"pending call completed while acquiring I/O path (reply found in queue)");
1232 flags, timeout_milliseconds);
1235 _dbus_connection_release_io_path (connection);
1238 HAVE_LOCK_CHECK (connection);
1240 _dbus_verbose (
"end\n");
1266 pending_replies =
NULL;
1267 timeout_list =
NULL;
1268 disconnect_link =
NULL;
1269 disconnect_message =
NULL;
1270 outgoing_counter =
NULL;
1274 if (watch_list ==
NULL)
1278 if (timeout_list ==
NULL)
1285 if (pending_replies ==
NULL)
1289 if (connection ==
NULL)
1320 if (disconnect_message ==
NULL)
1324 if (disconnect_link ==
NULL)
1328 if (outgoing_counter ==
NULL)
1332 if (objects ==
NULL)
1341 connection->
watches = watch_list;
1342 connection->
timeouts = timeout_list;
1347 connection->
objects = objects;
1355#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT)
1365 CONNECTION_LOCK (connection);
1369 CONNECTION_UNLOCK (connection);
1376 CONNECTION_UNLOCK (connection);
1378 _dbus_connection_trace_ref (connection, 0, 1,
"new_for_transport");
1382 if (disconnect_message !=
NULL)
1385 if (disconnect_link !=
NULL)
1388 if (connection !=
NULL)
1398 if (pending_replies)
1407 if (outgoing_counter)
1426 dbus_int32_t old_refcount;
1431 HAVE_LOCK_CHECK (connection);
1434 _dbus_connection_trace_ref (connection, old_refcount, old_refcount + 1,
1449 dbus_int32_t old_refcount;
1451 HAVE_LOCK_CHECK (connection);
1457 _dbus_connection_trace_ref (connection, old_refcount, old_refcount - 1,
1460 if (old_refcount == 1)
1461 _dbus_connection_last_unref (connection);
1476 dbus_uint32_t serial;
1501 unsigned int condition,
1510 _dbus_verbose (
"start\n");
1512 CONNECTION_LOCK (connection);
1514 if (!_dbus_connection_acquire_io_path (connection, 1))
1517 CONNECTION_UNLOCK (connection);
1521 HAVE_LOCK_CHECK (connection);
1525 _dbus_connection_release_io_path (connection);
1527 HAVE_LOCK_CHECK (connection);
1529 _dbus_verbose (
"middle\n");
1531 status = _dbus_connection_get_dispatch_status_unlocked (connection);
1534 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
1536 _dbus_verbose (
"end\n");
1562shared_connections_shutdown (
void *data)
1585 close_connection_on_shutdown (connection);
1596 shared_connections =
NULL;
1598 if (shared_connections_no_guid !=
NULL)
1602 while (connection !=
NULL)
1605 close_connection_on_shutdown (connection);
1612 shared_connections_no_guid =
NULL;
1621 _dbus_verbose (
"checking for existing connection\n");
1632 if (shared_connections ==
NULL)
1634 _dbus_verbose (
"creating shared_connections hash table\n");
1639 if (shared_connections ==
NULL)
1648 shared_connections =
NULL;
1653 _dbus_verbose (
" successfully created shared_connections\n");
1687 CONNECTION_LOCK (connection);
1688 if (_dbus_connection_get_is_connected_unlocked (connection))
1691 *result = connection;
1692 _dbus_verbose (
"looked up existing connection to server guid %s\n",
1697 _dbus_verbose (
"looked up existing connection to server guid %s but it was disconnected so ignoring it\n",
1700 CONNECTION_UNLOCK (connection);
1714 char *guid_in_connection;
1716 HAVE_LOCK_CHECK (connection);
1747 if (guid_key ==
NULL)
1751 if (guid_in_connection ==
NULL)
1767 guid_key, connection))
1777 _dbus_verbose (
"stored connection to %s to be shared\n",
1790 HAVE_LOCK_CHECK (connection);
1804 _dbus_verbose (
"dropping connection to %s out of the shared table\n",
1834 if (transport ==
NULL)
1836 _DBUS_ASSERT_ERROR_IS_SET (error);
1844 if (connection ==
NULL)
1846 _DBUS_SET_OOM (error);
1850#ifndef DBUS_DISABLE_CHECKS
1869_dbus_connection_open_internal (
const char *address,
1879 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1881 _dbus_verbose (
"opening %s connection to: %s\n",
1882 shared ?
"shared" :
"private", address);
1887 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1891 for (i = 0; i < len; i++)
1895 if (!connection_lookup_shared (entries[i], &connection))
1896 _DBUS_SET_OOM (&tmp_error);
1899 if (connection ==
NULL)
1901 connection = connection_try_from_address_entry (entries[i],
1904 if (connection !=
NULL && shared)
1913 CONNECTION_LOCK (connection);
1915 if (!connection_record_shared_unlocked (connection, guid))
1917 _DBUS_SET_OOM (&tmp_error);
1918 _dbus_connection_close_possibly_shared_and_unlock (connection);
1923 CONNECTION_UNLOCK (connection);
1930 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
1938 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1939 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
1941 if (connection ==
NULL)
1943 _DBUS_ASSERT_ERROR_IS_SET (&first_error);
1967 CONNECTION_LOCK (connection);
1968 _dbus_connection_close_possibly_shared_and_unlock (connection);
1972_dbus_connection_preallocate_send_unlocked (
DBusConnection *connection)
1976 HAVE_LOCK_CHECK (connection);
1981 if (preallocated ==
NULL)
1996 return preallocated;
2008_dbus_connection_send_preallocated_unlocked_no_update (
DBusConnection *connection,
2011 dbus_uint32_t *client_serial)
2013 dbus_uint32_t serial;
2025 preallocated =
NULL;
2031 _dbus_verbose (
"Message %p (%s %s %s %s '%s') for %s added to outgoing queue %p, %d pending to send\n",
2048 connection->n_outgoing);
2055 *client_serial = serial;
2063 _dbus_verbose (
"Message %p serial is %u\n",
2073 DBUS_ITERATION_DO_WRITING,
2078 _dbus_connection_wakeup_mainloop (connection);
2082_dbus_connection_send_preallocated_and_unlock (
DBusConnection *connection,
2085 dbus_uint32_t *client_serial)
2089 HAVE_LOCK_CHECK (connection);
2091 _dbus_connection_send_preallocated_unlocked_no_update (connection,
2093 message, client_serial);
2095 _dbus_verbose (
"middle\n");
2096 status = _dbus_connection_get_dispatch_status_unlocked (connection);
2099 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
2114 dbus_uint32_t *client_serial)
2121 preallocated = _dbus_connection_preallocate_send_unlocked (connection);
2122 if (preallocated ==
NULL)
2124 CONNECTION_UNLOCK (connection);
2128 _dbus_connection_send_preallocated_and_unlock (connection,
2162 dbus_int32_t refcount;
2164 CONNECTION_LOCK (connection);
2171 _dbus_connection_close_possibly_shared_and_unlock (connection);
2173 CONNECTION_UNLOCK (connection);
2187_dbus_memory_pause_based_on_timeout (
int timeout_milliseconds)
2189 if (timeout_milliseconds == -1)
2191 else if (timeout_milliseconds < 100)
2193 else if (timeout_milliseconds <= 1000)
2200generate_local_error_message (dbus_uint32_t serial,
2201 const char *error_name,
2202 const char *error_msg)
2226 if (error_msg !=
NULL)
2249_dbus_connection_peek_for_reply_unlocked (
DBusConnection *connection,
2250 dbus_uint32_t client_serial)
2253 HAVE_LOCK_CHECK (connection);
2257 while (link !=
NULL)
2263 _dbus_verbose (
"%s reply to %d found in queue\n", _DBUS_FUNCTION_NAME, client_serial);
2277 dbus_uint32_t client_serial)
2281 HAVE_LOCK_CHECK (connection);
2285 while (link !=
NULL)
2302connection_timeout_and_complete_all_pending_calls_unlocked (
DBusConnection *connection)
2330 CONNECTION_LOCK (connection);
2332 HAVE_LOCK_CHECK (connection);
2343 _dbus_connection_detach_pending_call_and_unlock (connection, pending);
2351check_for_reply_and_update_dispatch_unlocked (
DBusConnection *connection,
2357 reply = check_for_reply_unlocked (connection,
2361 _dbus_verbose (
"checked for reply\n");
2363 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): got reply\n");
2365 complete_pending_call_and_unlock (connection, pending, reply);
2368 CONNECTION_LOCK (connection);
2369 status = _dbus_connection_get_dispatch_status_unlocked (connection);
2370 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
2396 dbus_int64_t start_tv_sec;
2398 dbus_int64_t tv_sec;
2402 dbus_uint32_t client_serial;
2404 int timeout_milliseconds, elapsed_milliseconds;
2416 _dbus_connection_flush_unlocked (connection);
2430 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): will block %d milliseconds for reply serial %u from %" DBUS_INT64_MODIFIER "d sec %ld usec\n",
2431 timeout_milliseconds,
2433 start_tv_sec, start_tv_usec);
2437 timeout_milliseconds = -1;
2439 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): will block for reply serial %u\n", client_serial);
2444 if (check_for_reply_and_update_dispatch_unlocked (connection, pending))
2451 DBUS_ITERATION_DO_READING |
2452 DBUS_ITERATION_BLOCK,
2453 timeout_milliseconds);
2457 _dbus_verbose (
"top of recheck\n");
2459 HAVE_LOCK_CHECK (connection);
2463 status = _dbus_connection_get_dispatch_status_unlocked (connection);
2470 _dbus_verbose (
"Pending call completed by dispatch\n");
2471 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
2478 if (check_for_reply_and_update_dispatch_unlocked (connection, pending))
2483 elapsed_milliseconds = (tv_sec - start_tv_sec) * 1000 +
2484 (tv_usec - start_tv_usec) / 1000;
2486 if (!_dbus_connection_get_is_connected_unlocked (connection))
2490 error_msg = generate_local_error_message (client_serial,
2492 "Connection was disconnected before a reply was received");
2495 complete_pending_call_and_unlock (connection, pending, error_msg);
2496 if (error_msg !=
NULL)
2502 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): disconnected\n");
2503 else if (timeout ==
NULL)
2511 _dbus_verbose (
"dbus_connection_send_with_reply_and_block() waiting for more memory\n");
2513 _dbus_memory_pause_based_on_timeout (timeout_milliseconds - elapsed_milliseconds);
2520 DBUS_ITERATION_DO_READING |
2521 DBUS_ITERATION_BLOCK,
2522 timeout_milliseconds - elapsed_milliseconds);
2525 goto recheck_status;
2527 else if (tv_sec < start_tv_sec)
2528 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): clock set backward\n");
2529 else if (elapsed_milliseconds < timeout_milliseconds)
2531 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n", timeout_milliseconds - elapsed_milliseconds);
2539 _dbus_verbose (
"dbus_connection_send_with_reply_and_block() waiting for more memory\n");
2541 _dbus_memory_pause_based_on_timeout (timeout_milliseconds - elapsed_milliseconds);
2548 DBUS_ITERATION_DO_READING |
2549 DBUS_ITERATION_BLOCK,
2550 timeout_milliseconds - elapsed_milliseconds);
2553 goto recheck_status;
2556 _dbus_verbose (
"dbus_connection_send_with_reply_and_block(): Waited %d milliseconds and got no reply\n",
2557 elapsed_milliseconds);
2562 complete_pending_call_and_unlock (connection, pending,
NULL);
2565 CONNECTION_LOCK (connection);
2566 status = _dbus_connection_get_dispatch_status_unlocked (connection);
2567 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
2591 DBusPendingFdsChangeFunction callback,
2640 _dbus_return_val_if_fail (address !=
NULL,
NULL);
2641 _dbus_return_val_if_error_is_set (error,
NULL);
2643 connection = _dbus_connection_open_internal (address,
2683 _dbus_return_val_if_fail (address !=
NULL,
NULL);
2684 _dbus_return_val_if_error_is_set (error,
NULL);
2686 connection = _dbus_connection_open_internal (address,
2702 dbus_int32_t old_refcount;
2704 _dbus_return_val_if_fail (connection !=
NULL,
NULL);
2707 _dbus_connection_trace_ref (connection, old_refcount, old_refcount + 1,
2714free_outgoing_message (
void *element,
2733 _dbus_verbose (
"Finalizing connection %p\n", connection);
2760 while (link !=
NULL)
2766 _dbus_message_filter_unref (filter);
2781 free_outgoing_message,
2834 dbus_int32_t old_refcount;
2836 _dbus_return_if_fail (connection !=
NULL);
2841 _dbus_connection_trace_ref (connection, old_refcount, old_refcount - 1,
2844 if (old_refcount == 1)
2846#ifndef DBUS_DISABLE_CHECKS
2849 _dbus_warn_check_failed (
"The last reference on a connection was dropped without closing the connection. This is a bug in an application. See dbus_connection_unref() documentation for details.\n%s",
2851 "Most likely, the application called unref() too many times and removed a reference belonging to libdbus, since this is a shared connection." :
2852 "Most likely, the application was supposed to call dbus_connection_close(), since this is a private connection.");
2856 _dbus_connection_last_unref (connection);
2870_dbus_connection_close_possibly_shared_and_unlock (
DBusConnection *connection)
2874 HAVE_LOCK_CHECK (connection);
2876 _dbus_verbose (
"Disconnecting %p\n", connection);
2895 status = _dbus_connection_get_dispatch_status_unlocked (connection);
2898 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
2949 _dbus_return_if_fail (connection !=
NULL);
2952 CONNECTION_LOCK (connection);
2954#ifndef DBUS_DISABLE_CHECKS
2957 CONNECTION_UNLOCK (connection);
2959 _dbus_warn_check_failed (
"Applications must not close shared connections - see dbus_connection_close() docs. This is a bug in the application.");
2964 _dbus_connection_close_possibly_shared_and_unlock (connection);
2968_dbus_connection_get_is_connected_unlocked (
DBusConnection *connection)
2970 HAVE_LOCK_CHECK (connection);
2992 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
2994 CONNECTION_LOCK (connection);
2995 res = _dbus_connection_get_is_connected_unlocked (connection);
2996 CONNECTION_UNLOCK (connection);
3014 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3016 CONNECTION_LOCK (connection);
3018 CONNECTION_UNLOCK (connection);
3048 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3050 CONNECTION_LOCK (connection);
3052 CONNECTION_UNLOCK (connection);
3093 _dbus_return_val_if_fail (connection !=
NULL,
NULL);
3095 CONNECTION_LOCK (connection);
3097 CONNECTION_UNLOCK (connection);
3123 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3131#ifdef HAVE_UNIX_FD_PASSING
3135 CONNECTION_LOCK(connection);
3137 CONNECTION_UNLOCK(connection);
3161 dbus_bool_t exit_on_disconnect)
3163 _dbus_return_if_fail (connection !=
NULL);
3165 CONNECTION_LOCK (connection);
3167 CONNECTION_UNLOCK (connection);
3184 _dbus_return_val_if_fail (connection !=
NULL,
NULL);
3186 CONNECTION_LOCK (connection);
3189 _dbus_connection_preallocate_send_unlocked (connection);
3191 CONNECTION_UNLOCK (connection);
3193 return preallocated;
3209 _dbus_return_if_fail (connection !=
NULL);
3210 _dbus_return_if_fail (preallocated !=
NULL);
3211 _dbus_return_if_fail (connection == preallocated->
connection);
3235 dbus_uint32_t *client_serial)
3237 _dbus_return_if_fail (connection !=
NULL);
3238 _dbus_return_if_fail (preallocated !=
NULL);
3239 _dbus_return_if_fail (message !=
NULL);
3240 _dbus_return_if_fail (preallocated->
connection == connection);
3247 CONNECTION_LOCK (connection);
3249#ifdef HAVE_UNIX_FD_PASSING
3252 message->n_unix_fds > 0)
3257 CONNECTION_UNLOCK (connection);
3263 _dbus_connection_send_preallocated_and_unlock (connection,
3265 message, client_serial);
3269_dbus_connection_send_unlocked_no_update (
DBusConnection *connection,
3271 dbus_uint32_t *client_serial)
3278 preallocated = _dbus_connection_preallocate_send_unlocked (connection);
3279 if (preallocated ==
NULL)
3282 _dbus_connection_send_preallocated_unlocked_no_update (connection,
3319 dbus_uint32_t *serial)
3321 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3322 _dbus_return_val_if_fail (message !=
NULL,
FALSE);
3324 CONNECTION_LOCK (connection);
3326#ifdef HAVE_UNIX_FD_PASSING
3329 message->n_unix_fds > 0)
3334 CONNECTION_UNLOCK (connection);
3346reply_handler_timeout (
void *data)
3361 _dbus_verbose (
"middle\n");
3362 status = _dbus_connection_get_dispatch_status_unlocked (connection);
3365 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
3418 int timeout_milliseconds)
3421 dbus_int32_t serial = -1;
3424 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3425 _dbus_return_val_if_fail (message !=
NULL,
FALSE);
3426 _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
FALSE);
3429 *pending_return =
NULL;
3431 CONNECTION_LOCK (connection);
3433#ifdef HAVE_UNIX_FD_PASSING
3436 message->n_unix_fds > 0)
3442 CONNECTION_UNLOCK (connection);
3448 if (!_dbus_connection_get_is_connected_unlocked (connection))
3450 CONNECTION_UNLOCK (connection);
3456 timeout_milliseconds,
3457 reply_handler_timeout);
3459 if (pending ==
NULL)
3461 CONNECTION_UNLOCK (connection);
3480 if (!_dbus_connection_attach_pending_call_unlocked (connection,
3484 if (!_dbus_connection_send_unlocked_no_update (connection, message,
NULL))
3486 _dbus_connection_detach_pending_call_and_unlock (connection,
3488 goto error_unlocked;
3492 *pending_return = pending;
3495 _dbus_connection_detach_pending_call_unlocked (connection, pending);
3501 status = _dbus_connection_get_dispatch_status_unlocked (connection);
3504 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
3506 if (pending_return ==
NULL)
3512 CONNECTION_UNLOCK (connection);
3553 int timeout_milliseconds,
3559 _dbus_return_val_if_fail (connection !=
NULL,
NULL);
3560 _dbus_return_val_if_fail (message !=
NULL,
NULL);
3561 _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
NULL);
3562 _dbus_return_val_if_error_is_set (error,
NULL);
3564#ifdef HAVE_UNIX_FD_PASSING
3566 CONNECTION_LOCK (connection);
3568 message->n_unix_fds > 0)
3570 CONNECTION_UNLOCK (connection);
3574 CONNECTION_UNLOCK (connection);
3579 &pending, timeout_milliseconds))
3581 _DBUS_SET_OOM (error);
3585 if (pending ==
NULL)
3628 HAVE_LOCK_CHECK (connection);
3631 _dbus_connection_get_is_connected_unlocked (connection))
3633 _dbus_verbose (
"doing iteration in\n");
3634 HAVE_LOCK_CHECK (connection);
3637 DBUS_ITERATION_DO_READING |
3638 DBUS_ITERATION_DO_WRITING |
3639 DBUS_ITERATION_BLOCK,
3643 HAVE_LOCK_CHECK (connection);
3644 _dbus_verbose (
"middle\n");
3645 status = _dbus_connection_get_dispatch_status_unlocked (connection);
3647 HAVE_LOCK_CHECK (connection);
3666 _dbus_return_if_fail (connection !=
NULL);
3668 CONNECTION_LOCK (connection);
3670 status = _dbus_connection_flush_unlocked (connection);
3672 HAVE_LOCK_CHECK (connection);
3674 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
3676 _dbus_verbose (
"end\n");
3691 int timeout_milliseconds,
3692 dbus_bool_t dispatch)
3695 dbus_bool_t progress_possible;
3706 _dbus_verbose (
"doing dispatch\n");
3708 CONNECTION_LOCK (connection);
3712 _dbus_verbose (
"pausing for memory\n");
3713 _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
3714 CONNECTION_LOCK (connection);
3718 CONNECTION_LOCK (connection);
3719 if (_dbus_connection_get_is_connected_unlocked (connection))
3721 _dbus_verbose (
"doing iteration\n");
3724 DBUS_ITERATION_DO_READING |
3725 DBUS_ITERATION_DO_WRITING |
3726 DBUS_ITERATION_BLOCK,
3727 timeout_milliseconds);
3731 HAVE_LOCK_CHECK (connection);
3737 progress_possible = connection->
n_incoming != 0 ||
3740 progress_possible = _dbus_connection_get_is_connected_unlocked (connection);
3742 CONNECTION_UNLOCK (connection);
3746 return progress_possible;
3786 int timeout_milliseconds)
3788 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3789 _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
FALSE);
3790 return _dbus_connection_read_write_dispatch(connection, timeout_milliseconds,
TRUE);
3818 int timeout_milliseconds)
3820 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
3821 _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1,
FALSE);
3822 return _dbus_connection_read_write_dispatch(connection, timeout_milliseconds,
FALSE);
3831check_disconnected_message_arrived_unlocked (
DBusConnection *connection,
3834 HAVE_LOCK_CHECK (connection);
3871 _dbus_return_val_if_fail (connection !=
NULL,
NULL);
3873 _dbus_verbose (
"start\n");
3882 CONNECTION_LOCK (connection);
3884 _dbus_connection_acquire_dispatch (connection);
3893 check_disconnected_message_arrived_unlocked (connection, message);
3896 if (message ==
NULL)
3897 _dbus_connection_release_dispatch (connection);
3899 CONNECTION_UNLOCK (connection);
3901 _dbus_message_trace_ref (message, -1, -1,
"dbus_connection_borrow_message");
3922 _dbus_return_if_fail (connection !=
NULL);
3923 _dbus_return_if_fail (message !=
NULL);
3927 CONNECTION_LOCK (connection);
3933 _dbus_connection_release_dispatch (connection);
3935 status = _dbus_connection_get_dispatch_status_unlocked (connection);
3936 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
3938 _dbus_message_trace_ref (message, -1, -1,
"dbus_connection_return_message");
3957 _dbus_return_if_fail (connection !=
NULL);
3958 _dbus_return_if_fail (message !=
NULL);
3962 CONNECTION_LOCK (connection);
3972 _dbus_verbose (
"Incoming message %p stolen from queue, %d incoming\n",
3977 _dbus_connection_release_dispatch (connection);
3979 status = _dbus_connection_get_dispatch_status_unlocked (connection);
3980 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
3981 _dbus_message_trace_ref (message, -1, -1,
3982 "dbus_connection_steal_borrowed_message");
3989_dbus_connection_pop_message_link_unlocked (
DBusConnection *connection)
3991 HAVE_LOCK_CHECK (connection);
4002 _dbus_verbose (
"Message %p (%s %s %s %s sig:'%s' serial:%u) removed from incoming queue %p, %d incoming\n",
4016 connection, connection->n_incoming);
4018 _dbus_message_trace_ref (link->
data, -1, -1,
4019 "_dbus_connection_pop_message_link_unlocked");
4021 check_disconnected_message_arrived_unlocked (connection, link->
data);
4033_dbus_connection_pop_message_unlocked (
DBusConnection *connection)
4037 HAVE_LOCK_CHECK (connection);
4039 link = _dbus_connection_pop_message_link_unlocked (connection);
4045 message = link->
data;
4056_dbus_connection_putback_message_link_unlocked (
DBusConnection *connection,
4059 HAVE_LOCK_CHECK (connection);
4071 _dbus_verbose (
"Message %p (%s %s %s '%s') put back into queue %p, %d incoming\n",
4081 connection, connection->n_incoming);
4083 _dbus_message_trace_ref (message_link->
data, -1, -1,
4084 "_dbus_connection_putback_message_link_unlocked");
4112 _dbus_verbose (
"start\n");
4121 CONNECTION_LOCK (connection);
4122 _dbus_connection_acquire_dispatch (connection);
4123 HAVE_LOCK_CHECK (connection);
4125 message = _dbus_connection_pop_message_unlocked (connection);
4127 _dbus_verbose (
"Returning popped message %p\n", message);
4129 _dbus_connection_release_dispatch (connection);
4131 status = _dbus_connection_get_dispatch_status_unlocked (connection);
4132 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
4147 HAVE_LOCK_CHECK (connection);
4150 CONNECTION_UNLOCK (connection);
4152 _dbus_verbose (
"locking dispatch_mutex\n");
4157 _dbus_verbose (
"waiting for dispatch to be acquirable\n");
4166 _dbus_verbose (
"unlocking dispatch_mutex\n");
4169 CONNECTION_LOCK (connection);
4183 HAVE_LOCK_CHECK (connection);
4185 _dbus_verbose (
"locking dispatch_mutex\n");
4193 _dbus_verbose (
"unlocking dispatch_mutex\n");
4210 HAVE_LOCK_CHECK (connection);
4228 _dbus_verbose (
"Dropping %d outgoing messages since we're disconnected\n",
4240notify_disconnected_and_dispatch_complete_unlocked (
DBusConnection *connection)
4242 HAVE_LOCK_CHECK (connection);
4246 _dbus_verbose (
"Sending disconnect message\n");
4251 connection_timeout_and_complete_all_pending_calls_unlocked (connection);
4267_dbus_connection_get_dispatch_status_unlocked (
DBusConnection *connection)
4269 HAVE_LOCK_CHECK (connection);
4278 dbus_bool_t is_connected;
4283 _dbus_verbose (
"dispatch status = %s is_connected = %d\n",
4284 DISPATCH_STATUS_NAME (status), is_connected);
4294 notify_disconnected_unlocked (connection);
4302 status = notify_disconnected_and_dispatch_complete_unlocked (connection);
4315_dbus_connection_update_dispatch_status_and_unlock (
DBusConnection *connection,
4318 dbus_bool_t changed;
4322 HAVE_LOCK_CHECK (connection);
4342 connection_forget_shared_unlocked (connection);
4346 CONNECTION_UNLOCK (connection);
4348 _dbus_verbose (
"Exiting on Disconnected signal\n");
4355 CONNECTION_UNLOCK (connection);
4357 if (changed && function)
4359 _dbus_verbose (
"Notifying of change to dispatch status of %p now %d (%s)\n",
4360 connection, new_status,
4361 DISPATCH_STATUS_NAME (new_status));
4362 (* function) (connection, new_status, data);
4400 _dbus_verbose (
"start\n");
4402 CONNECTION_LOCK (connection);
4404 status = _dbus_connection_get_dispatch_status_unlocked (connection);
4406 CONNECTION_UNLOCK (connection);
4415_dbus_connection_peer_filter_unlocked_no_update (
DBusConnection *connection,
4418 dbus_bool_t sent =
FALSE;
4448 sent = _dbus_connection_send_unlocked_no_update (connection, ret,
NULL);
4462 const char *v_STRING;
4472 v_STRING = _dbus_string_get_const_data (&uuid);
4477 sent = _dbus_connection_send_unlocked_no_update (connection, ret,
NULL);
4493 sent = _dbus_connection_send_unlocked_no_update (connection, ret,
4507 "Unknown method invoked on org.freedesktop.DBus.Peer interface");
4511 sent = _dbus_connection_send_unlocked_no_update (connection, ret,
NULL);
4522 expire_link->
data = ret;
4539_dbus_connection_run_builtin_filters_unlocked_no_update (
DBusConnection *connection,
4545 return _dbus_connection_peer_filter_unlocked_no_update (connection, message);
4594 DBusList *link, *filter_list_copy, *message_link;
4597 dbus_int32_t reply_serial;
4599 dbus_bool_t found_object;
4603 _dbus_verbose (
"\n");
4605 CONNECTION_LOCK (connection);
4606 status = _dbus_connection_get_dispatch_status_unlocked (connection);
4610 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
4619 _dbus_connection_acquire_dispatch (connection);
4620 HAVE_LOCK_CHECK (connection);
4622 message_link = _dbus_connection_pop_message_link_unlocked (connection);
4623 if (message_link ==
NULL)
4627 _dbus_verbose (
"another thread dispatched message (during acquire_dispatch above)\n");
4629 _dbus_connection_release_dispatch (connection);
4631 status = _dbus_connection_get_dispatch_status_unlocked (connection);
4633 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
4640 message = message_link->
data;
4642 _dbus_verbose (
" dispatching message %p (%s %s %s '%s')\n",
4667 _dbus_verbose (
"Dispatching a pending reply\n");
4668 complete_pending_call_and_unlock (connection, pending, message);
4671 CONNECTION_LOCK (connection);
4672 _dbus_verbose (
"pending call completed in dispatch\n");
4680 result = _dbus_connection_run_builtin_filters_unlocked_no_update (connection, message);
4687 _dbus_connection_release_dispatch (connection);
4688 HAVE_LOCK_CHECK (connection);
4690 _dbus_connection_failed_pop (connection, message_link);
4693 _dbus_connection_update_dispatch_status_and_unlock (connection,
4703 _dbus_message_filter_ref (link->
data);
4708 CONNECTION_UNLOCK (connection);
4711 while (link !=
NULL)
4718 _dbus_verbose (
" filter was removed in a callback function\n");
4723 _dbus_verbose (
" running filter on message %p\n", message);
4735 CONNECTION_LOCK (connection);
4739 _dbus_verbose (
"No memory\n");
4744 _dbus_verbose (
"filter handled message in dispatch\n");
4751 _dbus_verbose (
" running object path dispatch on message %p (%s %s %s '%s')\n",
4762 HAVE_LOCK_CHECK (connection);
4767 CONNECTION_LOCK (connection);
4771 _dbus_verbose (
"object tree handled message in dispatch\n");
4782 _dbus_verbose (
" sending error %s\n",
4788 _dbus_verbose (
"no memory for error string in dispatch\n");
4793 "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist\n",
4800 _dbus_verbose (
"no memory for error string in dispatch\n");
4806 _dbus_string_get_const_data (&str));
4812 _dbus_verbose (
"no memory for error reply in dispatch\n");
4818 if (expire_link ==
NULL)
4822 _dbus_verbose (
"no memory for error send in dispatch\n");
4826 preallocated = _dbus_connection_preallocate_send_unlocked (connection);
4828 if (preallocated ==
NULL)
4835 _dbus_verbose (
"no memory for error send in dispatch\n");
4839 _dbus_connection_send_preallocated_unlocked_no_update (connection, preallocated,
4847 _dbus_verbose (
" done dispatching %p (%s %s %s '%s') on connection %p\n", message,
4861 _dbus_verbose (
"out of memory\n");
4867 _dbus_connection_putback_message_link_unlocked (connection,
4870 message_link =
NULL;
4875 _dbus_verbose (
" ... done dispatching\n");
4878 _dbus_connection_release_dispatch (connection);
4879 HAVE_LOCK_CHECK (connection);
4881 if (message !=
NULL)
4890 CONNECTION_UNLOCK (connection);
4892 CONNECTION_LOCK (connection);
4895 if (message_link !=
NULL)
4898 _dbus_verbose (
"before final status update\n");
4899 status = _dbus_connection_get_dispatch_status_unlocked (connection);
4902 _dbus_connection_update_dispatch_status_and_unlock (connection, status);
4980 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
4982 CONNECTION_LOCK (connection);
4985 add_function, remove_function,
4987 data, free_data_function);
4989 CONNECTION_UNLOCK (connection);
5043 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5045 CONNECTION_LOCK (connection);
5048 add_function, remove_function,
5050 data, free_data_function);
5052 CONNECTION_UNLOCK (connection);
5080 _dbus_return_if_fail (connection !=
NULL);
5082 CONNECTION_LOCK (connection);
5090 CONNECTION_UNLOCK (connection);
5094 (*old_free_data) (old_data);
5126 _dbus_return_if_fail (connection !=
NULL);
5128 CONNECTION_LOCK (connection);
5136 CONNECTION_UNLOCK (connection);
5140 (*old_free_data) (old_data);
5166 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5199 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5202 CONNECTION_LOCK (connection);
5208 *fd = _dbus_socket_get_int (s);
5211 CONNECTION_UNLOCK (connection);
5245 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5246 _dbus_return_val_if_fail (uid !=
NULL,
FALSE);
5248 CONNECTION_LOCK (connection);
5260 CONNECTION_UNLOCK (connection);
5281 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5282 _dbus_return_val_if_fail (pid !=
NULL,
FALSE);
5284 CONNECTION_LOCK (connection);
5292 CONNECTION_UNLOCK (connection);
5311 dbus_int32_t *data_size)
5315 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5316 _dbus_return_val_if_fail (data !=
NULL,
FALSE);
5317 _dbus_return_val_if_fail (data_size !=
NULL,
FALSE);
5319 CONNECTION_LOCK (connection);
5327 CONNECTION_UNLOCK (connection);
5360 void *old_data =
NULL;
5363 _dbus_return_if_fail (connection !=
NULL);
5365 CONNECTION_LOCK (connection);
5367 function, data, free_data_function,
5368 &old_data, &old_free_function);
5369 CONNECTION_UNLOCK (connection);
5371 if (old_free_function !=
NULL)
5372 (* old_free_function) (old_data);
5377_dbus_connection_get_linux_security_label (
DBusConnection *connection,
5385 CONNECTION_LOCK (connection);
5390 result = _dbus_transport_get_linux_security_label (connection->
transport,
5396 CONNECTION_UNLOCK (connection);
5408 CONNECTION_LOCK (connection);
5415 CONNECTION_UNLOCK (connection);
5453 char **windows_sid_p)
5457 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5458 _dbus_return_val_if_fail (windows_sid_p !=
NULL,
FALSE);
5460 CONNECTION_LOCK (connection);
5472 CONNECTION_UNLOCK (connection);
5504 void *old_data =
NULL;
5507 _dbus_return_if_fail (connection !=
NULL);
5509 CONNECTION_LOCK (connection);
5511 function, data, free_data_function,
5512 &old_data, &old_free_function);
5513 CONNECTION_UNLOCK (connection);
5515 if (old_free_function !=
NULL)
5516 (* old_free_function) (old_data);
5549 _dbus_return_if_fail (connection !=
NULL);
5551 CONNECTION_LOCK (connection);
5553 CONNECTION_UNLOCK (connection);
5581 _dbus_return_if_fail (connection !=
NULL);
5583 CONNECTION_LOCK (connection);
5585 CONNECTION_UNLOCK (connection);
5609 _dbus_return_if_fail (connection !=
NULL);
5611 CONNECTION_LOCK (connection);
5613 CONNECTION_UNLOCK (connection);
5645 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5646 _dbus_return_val_if_fail (function !=
NULL,
FALSE);
5654 CONNECTION_LOCK (connection);
5659 _dbus_message_filter_unref (filter);
5660 CONNECTION_UNLOCK (connection);
5673 CONNECTION_UNLOCK (connection);
5697 _dbus_return_if_fail (connection !=
NULL);
5698 _dbus_return_if_fail (function !=
NULL);
5700 CONNECTION_LOCK (connection);
5705 while (link !=
NULL)
5707 filter = link->
data;
5709 if (filter->
function == function &&
5722 CONNECTION_UNLOCK (connection);
5724#ifndef DBUS_DISABLE_CHECKS
5727 _dbus_warn_check_failed (
"Attempt to remove filter function %p user data %p, but no such filter has been added",
5728 function, user_data);
5740 _dbus_message_filter_unref (filter);
5759_dbus_connection_register_object_path (
DBusConnection *connection,
5760 dbus_bool_t fallback,
5766 char **decomposed_path;
5772 CONNECTION_LOCK (connection);
5776 (
const char **) decomposed_path, vtable,
5779 CONNECTION_UNLOCK (connection);
5805 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5806 _dbus_return_val_if_fail (path !=
NULL,
FALSE);
5807 _dbus_return_val_if_fail (path[0] ==
'/',
FALSE);
5808 _dbus_return_val_if_fail (vtable !=
NULL,
FALSE);
5810 return _dbus_connection_register_object_path (connection,
FALSE, path, vtable, user_data, error);
5837 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5838 _dbus_return_val_if_fail (path !=
NULL,
FALSE);
5839 _dbus_return_val_if_fail (path[0] ==
'/',
FALSE);
5840 _dbus_return_val_if_fail (vtable !=
NULL,
FALSE);
5842 retval = _dbus_connection_register_object_path (connection,
FALSE, path, vtable, user_data, &error);
5875 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5876 _dbus_return_val_if_fail (path !=
NULL,
FALSE);
5877 _dbus_return_val_if_fail (path[0] ==
'/',
FALSE);
5878 _dbus_return_val_if_fail (vtable !=
NULL,
FALSE);
5880 return _dbus_connection_register_object_path (connection,
TRUE, path, vtable, user_data, error);
5909 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5910 _dbus_return_val_if_fail (path !=
NULL,
FALSE);
5911 _dbus_return_val_if_fail (path[0] ==
'/',
FALSE);
5912 _dbus_return_val_if_fail (vtable !=
NULL,
FALSE);
5914 retval = _dbus_connection_register_object_path (connection,
TRUE, path, vtable, user_data, &error);
5939 char **decomposed_path;
5941 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5942 _dbus_return_val_if_fail (path !=
NULL,
FALSE);
5943 _dbus_return_val_if_fail (path[0] ==
'/',
FALSE);
5948 CONNECTION_LOCK (connection);
5972 char **decomposed_path;
5974 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
5975 _dbus_return_val_if_fail (path !=
NULL,
FALSE);
5976 _dbus_return_val_if_fail (data_p !=
NULL,
FALSE);
5983 CONNECTION_LOCK (connection);
5987 CONNECTION_UNLOCK (connection);
6006 const char *parent_path,
6007 char ***child_entries)
6009 char **decomposed_path;
6011 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
6012 _dbus_return_val_if_fail (parent_path !=
NULL,
FALSE);
6013 _dbus_return_val_if_fail (parent_path[0] ==
'/',
FALSE);
6014 _dbus_return_val_if_fail (child_entries !=
NULL,
FALSE);
6019 CONNECTION_LOCK (connection);
6022 (
const char **) decomposed_path,
6067 _dbus_return_if_fail (*slot_p >= 0);
6104 _dbus_return_val_if_fail (connection !=
NULL,
FALSE);
6105 _dbus_return_val_if_fail (slot >= 0,
FALSE);
6107 SLOTS_LOCK (connection);
6111 slot, data, free_data_func,
6112 &old_free_func, &old_data);
6114 SLOTS_UNLOCK (connection);
6120 (* old_free_func) (old_data);
6149 _dbus_return_val_if_fail (connection !=
NULL,
NULL);
6150 _dbus_return_val_if_fail (slot >= 0,
NULL);
6152 SLOTS_LOCK (connection);
6158 SLOTS_UNLOCK (connection);
6172 if (will_modify_sigpipe)
6190 _dbus_return_if_fail (connection !=
NULL);
6192 CONNECTION_LOCK (connection);
6195 CONNECTION_UNLOCK (connection);
6209 _dbus_return_val_if_fail (connection !=
NULL, 0);
6211 CONNECTION_LOCK (connection);
6213 CONNECTION_UNLOCK (connection);
6229 _dbus_return_if_fail (connection !=
NULL);
6231 CONNECTION_LOCK (connection);
6234 CONNECTION_UNLOCK (connection);
6248 _dbus_return_val_if_fail (connection !=
NULL, 0);
6250 CONNECTION_LOCK (connection);
6252 CONNECTION_UNLOCK (connection);
6285 _dbus_return_if_fail (connection !=
NULL);
6287 CONNECTION_LOCK (connection);
6290 CONNECTION_UNLOCK (connection);
6304 _dbus_return_val_if_fail (connection !=
NULL, 0);
6306 CONNECTION_LOCK (connection);
6308 CONNECTION_UNLOCK (connection);
6327 _dbus_return_if_fail (connection !=
NULL);
6329 CONNECTION_LOCK (connection);
6332 CONNECTION_UNLOCK (connection);
6346 _dbus_return_val_if_fail (connection !=
NULL, 0);
6348 CONNECTION_LOCK (connection);
6350 CONNECTION_UNLOCK (connection);
6369 _dbus_return_val_if_fail (connection !=
NULL, 0);
6371 CONNECTION_LOCK (connection);
6373 CONNECTION_UNLOCK (connection);
6377#ifdef DBUS_ENABLE_STATS
6380 dbus_uint32_t *in_messages,
6381 dbus_uint32_t *in_bytes,
6382 dbus_uint32_t *in_fds,
6383 dbus_uint32_t *in_peak_bytes,
6384 dbus_uint32_t *in_peak_fds,
6385 dbus_uint32_t *out_messages,
6386 dbus_uint32_t *out_bytes,
6387 dbus_uint32_t *out_fds,
6388 dbus_uint32_t *out_peak_bytes,
6389 dbus_uint32_t *out_peak_fds)
6391 CONNECTION_LOCK (connection);
6393 if (in_messages !=
NULL)
6396 _dbus_transport_get_stats (connection->
transport,
6397 in_bytes, in_fds, in_peak_bytes, in_peak_fds);
6399 if (out_messages !=
NULL)
6402 if (out_bytes !=
NULL)
6405 if (out_fds !=
NULL)
6408 if (out_peak_bytes !=
NULL)
6409 *out_peak_bytes = _dbus_counter_get_peak_size_value (connection->
outgoing_counter);
6411 if (out_peak_fds !=
NULL)
6412 *out_peak_fds = _dbus_counter_get_peak_unix_fd_value (connection->
outgoing_counter);
6414 CONNECTION_UNLOCK (connection);
6430 _dbus_return_val_if_fail (connection !=
NULL, 0);
6432 CONNECTION_LOCK (connection);
6434 CONNECTION_UNLOCK (connection);
6438#ifdef DBUS_ENABLE_EMBEDDED_TESTS
void dbus_address_entries_free(DBusAddressEntry **entries)
Frees a NULL-terminated array of address entries.
dbus_bool_t dbus_parse_address(const char *address, DBusAddressEntry ***entry_result, int *array_len, DBusError *error)
Parses an address string of the form:
const char * dbus_address_entry_get_value(DBusAddressEntry *entry, const char *key)
Returns a value from a key of an entry.
void _dbus_bus_notify_shared_connection_disconnected_unlocked(DBusConnection *connection)
Internal function that checks to see if this is a shared connection owned by the bus and if it is unr...
dbus_bool_t _dbus_connection_handle_watch(DBusWatch *watch, unsigned int condition, void *data)
A callback for use with dbus_watch_new() to create a DBusWatch.
void _dbus_connection_toggle_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout, dbus_bool_t enabled)
Toggles a timeout and notifies app via connection's DBusTimeoutToggledFunction if available.
dbus_bool_t dbus_connection_has_messages_to_send(DBusConnection *connection)
Checks whether there are messages in the outgoing message queue.
void _dbus_connection_do_iteration_unlocked(DBusConnection *connection, DBusPendingCall *pending, unsigned int flags, int timeout_milliseconds)
Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...
dbus_bool_t _dbus_connection_send_and_unlock(DBusConnection *connection, DBusMessage *message, dbus_uint32_t *client_serial)
Like dbus_connection_send(), but assumes the connection is already locked on function entry,...
DBusConnection * _dbus_connection_new_for_transport(DBusTransport *transport)
Creates a new connection for the given transport.
dbus_bool_t _dbus_connection_has_messages_to_send_unlocked(DBusConnection *connection)
Checks whether there are messages in the outgoing message queue.
void(* DBusWatchRemoveFunction)(DBusWatchList *list, DBusWatch *watch)
Function to be called in protected_change_watch() with refcount held.
void _dbus_connection_unlock(DBusConnection *connection)
Releases the connection lock.
void _dbus_connection_lock(DBusConnection *connection)
Acquires the connection lock.
void _dbus_connection_remove_watch_unlocked(DBusConnection *connection, DBusWatch *watch)
Removes a watch using the connection's DBusRemoveWatchFunction if available.
dbus_bool_t _dbus_connection_add_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout)
Adds a timeout using the connection's DBusAddTimeoutFunction if available.
void _dbus_connection_toggle_watch_unlocked(DBusConnection *connection, DBusWatch *watch, dbus_bool_t enabled)
Toggles a watch and notifies app via connection's DBusWatchToggledFunction if available.
void(* DBusTimeoutToggleFunction)(DBusTimeoutList *list, DBusTimeout *timeout, dbus_bool_t enabled)
Function to be called in protected_change_timeout() with refcount held.
void(* DBusTimeoutRemoveFunction)(DBusTimeoutList *list, DBusTimeout *timeout)
Function to be called in protected_change_timeout() with refcount held.
dbus_bool_t _dbus_connection_add_watch_unlocked(DBusConnection *connection, DBusWatch *watch)
Adds a watch using the connection's DBusAddWatchFunction if available.
void _dbus_connection_remove_pending_call(DBusConnection *connection, DBusPendingCall *pending)
Removes a pending call from the connection, such that the pending reply will be ignored.
void _dbus_connection_close_if_only_one_ref(DBusConnection *connection)
Used internally to handle the semantics of dbus_server_set_new_connection_function().
void _dbus_connection_unref_unlocked(DBusConnection *connection)
Decrements the reference count of a DBusConnection.
DBusMessage * _dbus_connection_get_message_to_send(DBusConnection *connection)
Gets the next outgoing message.
dbus_bool_t(* DBusTimeoutAddFunction)(DBusTimeoutList *list, DBusTimeout *timeout)
Function to be called in protected_change_timeout() with refcount held.
void _dbus_connection_message_sent_unlocked(DBusConnection *connection, DBusMessage *message)
Notifies the connection that a message has been sent, so the message can be removed from the outgoing...
void _dbus_connection_remove_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout)
Removes a timeout using the connection's DBusRemoveTimeoutFunction if available.
dbus_uint32_t _dbus_connection_get_next_client_serial(DBusConnection *connection)
Allocate and return the next non-zero serial number for outgoing messages.
void(* DBusWatchToggleFunction)(DBusWatchList *list, DBusWatch *watch, dbus_bool_t enabled)
Function to be called in protected_change_watch() with refcount held.
void _dbus_connection_queue_received_message_link(DBusConnection *connection, DBusList *link)
Adds a message-containing list link to the incoming message queue, taking ownership of the link and t...
int _dbus_connection_get_pending_fds_count(DBusConnection *connection)
Return how many file descriptors are pending in the loader.
void _dbus_connection_set_pending_fds_function(DBusConnection *connection, DBusPendingFdsChangeFunction callback, void *data)
Register a function to be called whenever the number of pending file descriptors in the loader change...
dbus_bool_t(* DBusWatchAddFunction)(DBusWatchList *list, DBusWatch *watch)
Function to be called in protected_change_watch() with refcount held.
void _dbus_connection_block_pending_call(DBusPendingCall *pending)
Blocks until a pending call times out or gets a reply.
void _dbus_connection_queue_synthesized_message_link(DBusConnection *connection, DBusList *link)
Adds a link + message to the incoming message queue.
void _dbus_connection_close_possibly_shared(DBusConnection *connection)
Closes a shared OR private connection, while dbus_connection_close() can only be used on private conn...
DBusConnection * _dbus_connection_ref_unlocked(DBusConnection *connection)
Increments the reference count of a DBusConnection.
void dbus_connection_return_message(DBusConnection *connection, DBusMessage *message)
Used to return a message after peeking at it using dbus_connection_borrow_message().
void(* DBusWatchToggledFunction)(DBusWatch *watch, void *data)
Called when dbus_watch_get_enabled() may return a different value than it did before.
dbus_bool_t dbus_connection_get_object_path_data(DBusConnection *connection, const char *path, void **data_p)
Gets the user data passed to dbus_connection_register_object_path() or dbus_connection_register_fallb...
void dbus_connection_set_max_message_size(DBusConnection *connection, long size)
Specifies the maximum size message this connection is allowed to receive.
void dbus_connection_flush(DBusConnection *connection)
Blocks until the outgoing message queue is empty.
long dbus_connection_get_max_message_unix_fds(DBusConnection *connection)
Gets the value set by dbus_connection_set_max_message_unix_fds().
void dbus_connection_set_exit_on_disconnect(DBusConnection *connection, dbus_bool_t exit_on_disconnect)
Set whether _exit() should be called when the connection receives a disconnect signal.
dbus_bool_t dbus_connection_get_socket(DBusConnection *connection, int *fd)
Gets the underlying Windows or UNIX socket file descriptor of the connection, if any.
DBusMessage * dbus_connection_pop_message(DBusConnection *connection)
Returns the first-received message from the incoming message queue, removing it from the queue.
long dbus_connection_get_max_received_unix_fds(DBusConnection *connection)
Gets the value set by dbus_connection_set_max_received_unix_fds().
dbus_bool_t dbus_connection_register_object_path(DBusConnection *connection, const char *path, const DBusObjectPathVTable *vtable, void *user_data)
Registers a handler for a given path in the object hierarchy.
void dbus_connection_close(DBusConnection *connection)
Closes a private connection, so no further data can be sent or received.
void dbus_connection_set_max_message_unix_fds(DBusConnection *connection, long n)
Specifies the maximum number of unix fds a message on this connection is allowed to receive.
void dbus_connection_set_wakeup_main_function(DBusConnection *connection, DBusWakeupMainFunction wakeup_main_function, void *data, DBusFreeFunction free_data_function)
Sets the mainloop wakeup function for the connection.
dbus_bool_t dbus_connection_get_windows_user(DBusConnection *connection, char **windows_sid_p)
Gets the Windows user SID of the connection if known.
dbus_bool_t dbus_connection_get_is_authenticated(DBusConnection *connection)
Gets whether the connection was authenticated.
void dbus_connection_send_preallocated(DBusConnection *connection, DBusPreallocatedSend *preallocated, DBusMessage *message, dbus_uint32_t *client_serial)
Sends a message using preallocated resources.
dbus_bool_t dbus_connection_read_write(DBusConnection *connection, int timeout_milliseconds)
This function is intended for use with applications that don't want to write a main loop and deal wit...
long dbus_connection_get_max_received_size(DBusConnection *connection)
Gets the value set by dbus_connection_set_max_received_size().
dbus_bool_t dbus_connection_get_unix_fd(DBusConnection *connection, int *fd)
Get the UNIX file descriptor of the connection, if any.
void(* DBusDispatchStatusFunction)(DBusConnection *connection, DBusDispatchStatus new_status, void *data)
Called when the return value of dbus_connection_get_dispatch_status() may have changed.
dbus_bool_t dbus_connection_can_send_type(DBusConnection *connection, int type)
Tests whether a certain type can be send via the connection.
dbus_bool_t dbus_connection_list_registered(DBusConnection *connection, const char *parent_path, char ***child_entries)
Lists the registered fallback handlers and object path handlers at the given parent_path.
void * dbus_connection_get_data(DBusConnection *connection, dbus_int32_t slot)
Retrieves data previously set with dbus_connection_set_data().
DBusConnection * dbus_connection_open_private(const char *address, DBusError *error)
Opens a new, dedicated connection to a remote address.
long dbus_connection_get_outgoing_size(DBusConnection *connection)
Gets the approximate size in bytes of all messages in the outgoing message queue.
void dbus_connection_set_dispatch_status_function(DBusConnection *connection, DBusDispatchStatusFunction function, void *data, DBusFreeFunction free_data_function)
Set a function to be invoked when the dispatch status changes.
dbus_bool_t dbus_connection_read_write_dispatch(DBusConnection *connection, int timeout_milliseconds)
This function is intended for use with applications that don't want to write a main loop and deal wit...
DBusHandlerResult(* DBusHandleMessageFunction)(DBusConnection *connection, DBusMessage *message, void *user_data)
Called when a message needs to be handled.
void dbus_connection_remove_filter(DBusConnection *connection, DBusHandleMessageFunction function, void *user_data)
Removes a previously-added message filter.
dbus_bool_t dbus_connection_get_is_connected(DBusConnection *connection)
Gets whether the connection is currently open.
DBusPreallocatedSend * dbus_connection_preallocate_send(DBusConnection *connection)
Preallocates resources needed to send a message, allowing the message to be sent without the possibil...
dbus_bool_t(* DBusAddWatchFunction)(DBusWatch *watch, void *data)
Called when libdbus needs a new watch to be monitored by the main loop.
void dbus_connection_unref(DBusConnection *connection)
Decrements the reference count of a DBusConnection, and finalizes it if the count reaches zero.
void dbus_connection_set_max_received_size(DBusConnection *connection, long size)
Sets the maximum total number of bytes that can be used for all messages received on this connection.
void(* DBusTimeoutToggledFunction)(DBusTimeout *timeout, void *data)
Called when dbus_timeout_get_enabled() may return a different value than it did before.
DBusDispatchStatus dbus_connection_dispatch(DBusConnection *connection)
Processes any incoming data.
dbus_bool_t dbus_connection_unregister_object_path(DBusConnection *connection, const char *path)
Unregisters the handler registered with exactly the given path.
void dbus_connection_set_unix_user_function(DBusConnection *connection, DBusAllowUnixUserFunction function, void *data, DBusFreeFunction free_data_function)
Sets a predicate function used to determine whether a given user ID is allowed to connect.
dbus_bool_t dbus_connection_try_register_object_path(DBusConnection *connection, const char *path, const DBusObjectPathVTable *vtable, void *user_data, DBusError *error)
Registers a handler for a given path in the object hierarchy.
void dbus_connection_steal_borrowed_message(DBusConnection *connection, DBusMessage *message)
Used to keep a message after peeking at it using dbus_connection_borrow_message().
dbus_bool_t dbus_connection_allocate_data_slot(dbus_int32_t *slot_p)
Allocates an integer ID to be used for storing application-specific data on any DBusConnection.
void dbus_connection_set_change_sigpipe(dbus_bool_t will_modify_sigpipe)
This function sets a global flag for whether dbus_connection_new() will set SIGPIPE behavior to SIG_I...
long dbus_connection_get_max_message_size(DBusConnection *connection)
Gets the value set by dbus_connection_set_max_message_size().
void dbus_connection_free_data_slot(dbus_int32_t *slot_p)
Deallocates a global ID for connection data slots.
dbus_bool_t(* DBusAddTimeoutFunction)(DBusTimeout *timeout, void *data)
Called when libdbus needs a new timeout to be monitored by the main loop.
void dbus_connection_set_max_received_unix_fds(DBusConnection *connection, long n)
Sets the maximum total number of unix fds that can be used for all messages received on this connecti...
dbus_bool_t dbus_connection_set_data(DBusConnection *connection, dbus_int32_t slot, void *data, DBusFreeFunction free_data_func)
Stores a pointer on a DBusConnection, along with an optional function to be used for freeing the data...
DBusDispatchStatus dbus_connection_get_dispatch_status(DBusConnection *connection)
Gets the current state of the incoming message queue.
DBusMessage * dbus_connection_send_with_reply_and_block(DBusConnection *connection, DBusMessage *message, int timeout_milliseconds, DBusError *error)
Sends a message and blocks a certain time period while waiting for a reply.
dbus_bool_t dbus_connection_try_register_fallback(DBusConnection *connection, const char *path, const DBusObjectPathVTable *vtable, void *user_data, DBusError *error)
Registers a fallback handler for a given subsection of the object hierarchy.
dbus_bool_t dbus_connection_get_adt_audit_session_data(DBusConnection *connection, void **data, dbus_int32_t *data_size)
Gets the ADT audit data of the connection if any.
DBusMessage * dbus_connection_borrow_message(DBusConnection *connection)
Returns the first-received message from the incoming message queue, leaving it in the queue.
dbus_bool_t dbus_connection_send_with_reply(DBusConnection *connection, DBusMessage *message, DBusPendingCall **pending_return, int timeout_milliseconds)
Queues a message to send, as with dbus_connection_send(), but also returns a DBusPendingCall used to ...
void dbus_connection_set_windows_user_function(DBusConnection *connection, DBusAllowWindowsUserFunction function, void *data, DBusFreeFunction free_data_function)
Sets a predicate function used to determine whether a given user ID is allowed to connect.
dbus_bool_t dbus_connection_get_is_anonymous(DBusConnection *connection)
Gets whether the connection is not authenticated as a specific user.
dbus_bool_t dbus_connection_set_timeout_functions(DBusConnection *connection, DBusAddTimeoutFunction add_function, DBusRemoveTimeoutFunction remove_function, DBusTimeoutToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the timeout functions for the connection.
void(* DBusRemoveWatchFunction)(DBusWatch *watch, void *data)
Called when libdbus no longer needs a watch to be monitored by the main loop.
dbus_bool_t(* DBusAllowUnixUserFunction)(DBusConnection *connection, unsigned long uid, void *data)
Called during authentication to check whether the given UNIX user ID is allowed to connect,...
DBusDispatchStatus
Indicates the status of incoming data on a DBusConnection.
dbus_bool_t dbus_connection_register_fallback(DBusConnection *connection, const char *path, const DBusObjectPathVTable *vtable, void *user_data)
Registers a fallback handler for a given subsection of the object hierarchy.
DBusConnection * dbus_connection_open(const char *address, DBusError *error)
Gets a connection to a remote address.
void dbus_connection_free_preallocated_send(DBusConnection *connection, DBusPreallocatedSend *preallocated)
Frees preallocated message-sending resources from dbus_connection_preallocate_send().
long dbus_connection_get_outgoing_unix_fds(DBusConnection *connection)
Gets the approximate number of uni fds of all messages in the outgoing message queue.
void(* DBusWakeupMainFunction)(void *data)
Called when the main loop's thread should be notified that there's now work to do.
void dbus_connection_set_allow_anonymous(DBusConnection *connection, dbus_bool_t value)
This function must be called on the server side of a connection when the connection is first seen in ...
dbus_bool_t dbus_connection_add_filter(DBusConnection *connection, DBusHandleMessageFunction function, void *user_data, DBusFreeFunction free_data_function)
Adds a message filter.
dbus_bool_t dbus_connection_send(DBusConnection *connection, DBusMessage *message, dbus_uint32_t *serial)
Adds a message to the outgoing message queue.
DBusConnection * dbus_connection_ref(DBusConnection *connection)
Increments the reference count of a DBusConnection.
void dbus_connection_set_builtin_filters_enabled(DBusConnection *connection, dbus_bool_t value)
Enables the builtin filtering of messages.
char * dbus_connection_get_server_id(DBusConnection *connection)
Gets the ID of the server address we are authenticated to, if this connection is on the client side.
dbus_bool_t(* DBusAllowWindowsUserFunction)(DBusConnection *connection, const char *user_sid, void *data)
Called during authentication to check whether the given Windows user ID is allowed to connect,...
dbus_bool_t dbus_connection_set_watch_functions(DBusConnection *connection, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the watch functions for the connection.
void(* DBusRemoveTimeoutFunction)(DBusTimeout *timeout, void *data)
Called when libdbus no longer needs a timeout to be monitored by the main loop.
dbus_bool_t dbus_connection_get_unix_process_id(DBusConnection *connection, unsigned long *pid)
Gets the process ID of the connection if any.
dbus_bool_t dbus_connection_get_unix_user(DBusConnection *connection, unsigned long *uid)
Gets the UNIX user ID of the connection if known.
void dbus_connection_set_route_peer_messages(DBusConnection *connection, dbus_bool_t value)
Normally DBusConnection automatically handles all messages to the org.freedesktop....
@ DBUS_DISPATCH_NEED_MEMORY
More memory is needed to continue.
@ DBUS_DISPATCH_COMPLETE
All currently available data has been processed.
@ DBUS_DISPATCH_DATA_REMAINS
There is more data to potentially convert to messages.
void _dbus_data_slot_allocator_free(DBusDataSlotAllocator *allocator, dbus_int32_t *slot_id_p)
Deallocates an ID previously allocated with _dbus_data_slot_allocator_alloc().
void _dbus_data_slot_list_init(DBusDataSlotList *list)
Initializes a slot list.
void _dbus_data_slot_list_free(DBusDataSlotList *list)
Frees the data slot list and all data slots contained in it, calling application-provided free functi...
void * _dbus_data_slot_list_get(DBusDataSlotAllocator *allocator, DBusDataSlotList *list, int slot)
Retrieves data previously set with _dbus_data_slot_list_set_data().
dbus_bool_t _dbus_data_slot_list_set(DBusDataSlotAllocator *allocator, DBusDataSlotList *list, int slot, void *data, DBusFreeFunction free_data_func, DBusFreeFunction *old_free_func, void **old_data)
Stores a pointer in the data slot list, along with an optional function to be used for freeing the da...
dbus_bool_t _dbus_data_slot_allocator_alloc(DBusDataSlotAllocator *allocator, dbus_int32_t *slot_id_p)
Allocates an integer ID to be used for storing data in a DBusDataSlotList.
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack.
void dbus_move_error(DBusError *src, DBusError *dest)
Moves an error src into dest, freeing src and overwriting dest.
dbus_bool_t dbus_error_has_name(const DBusError *error, const char *name)
Checks whether the error is set and has the given name.
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
int _dbus_hash_table_get_n_entries(DBusHashTable *table)
Gets the number of hash entries in a hash table.
void * _dbus_hash_iter_get_value(DBusHashIter *iter)
Gets the value of the current entry.
dbus_bool_t _dbus_hash_table_insert_int(DBusHashTable *table, int key, void *value)
Creates a hash entry with the given key and value.
dbus_bool_t _dbus_hash_table_insert_string(DBusHashTable *table, char *key, void *value)
Creates a hash entry with the given key and value.
void _dbus_hash_table_unref(DBusHashTable *table)
Decrements the reference count for a hash table, freeing the hash table if the count reaches zero.
dbus_bool_t _dbus_hash_iter_next(DBusHashIter *iter)
Move the hash iterator forward one step, to the next hash entry.
void _dbus_hash_iter_init(DBusHashTable *table, DBusHashIter *iter)
Initializes a hash table iterator.
DBusHashTable * _dbus_hash_table_new(DBusHashType type, DBusFreeFunction key_free_function, DBusFreeFunction value_free_function)
Constructs a new hash table.
dbus_bool_t _dbus_hash_table_remove_int(DBusHashTable *table, int key)
Removes the hash entry for the given key.
dbus_bool_t _dbus_hash_table_remove_string(DBusHashTable *table, const char *key)
Removes the hash entry for the given key.
void * _dbus_hash_table_lookup_string(DBusHashTable *table, const char *key)
Looks up the value for a given string in a hash table of type DBUS_HASH_STRING.
void _dbus_hash_iter_remove_entry(DBusHashIter *iter)
Removes the current entry from the hash table.
void * _dbus_hash_table_lookup_int(DBusHashTable *table, int key)
Looks up the value for a given integer in a hash table of type DBUS_HASH_INT.
@ DBUS_HASH_INT
Hash keys are integers.
@ DBUS_HASH_STRING
Hash keys are strings.
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called.
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
#define _DBUS_UNLOCK(name)
Unlocks a global lock.
#define _DBUS_LOCK(name)
Locks a global lock, initializing it first if necessary.
void _dbus_warn_check_failed(const char *format,...)
Prints a "critical" warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...
char * _dbus_strdup(const char *str)
Duplicates a string.
dbus_bool_t _dbus_get_local_machine_uuid_encoded(DBusString *uuid_str, DBusError *error)
Gets the hex-encoded UUID of the machine this function is executed on.
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
#define _DBUS_LOCK_NAME(name)
Expands to name of a global lock variable.
DBusList * _dbus_list_get_first_link(DBusList **list)
Gets the first link in the list.
dbus_bool_t _dbus_list_copy(DBusList **list, DBusList **dest)
Copies a list.
DBusList * _dbus_list_pop_first_link(DBusList **list)
Removes the first link in the list and returns it.
void * _dbus_list_get_last(DBusList **list)
Gets the last data in the list.
dbus_bool_t _dbus_list_remove(DBusList **list, void *data)
Removes a value from the list.
void _dbus_list_append_link(DBusList **list, DBusList *link)
Appends a link to the list.
void _dbus_list_clear_full(DBusList **list, DBusFreeFunction function)
Free every link and every element in the list.
void _dbus_list_remove_link(DBusList **list, DBusList *link)
Removes a link from the list.
void * _dbus_list_get_first(DBusList **list)
Gets the first data in the list.
DBusList * _dbus_list_get_last_link(DBusList **list)
Gets the last link in the list.
void _dbus_list_unlink(DBusList **list, DBusList *link)
Removes the given link from the list, but doesn't free it.
#define _dbus_list_get_prev_link(list, link)
Gets the previous link in the list, or NULL if there are no more links.
void _dbus_list_free_link(DBusList *link)
Frees a linked list node allocated with _dbus_list_alloc_link.
void * _dbus_list_pop_first(DBusList **list)
Removes the first value in the list and returns it.
void _dbus_list_foreach(DBusList **list, DBusForeachFunction function, void *data)
Calls the given function for each element in the list.
void _dbus_list_clear(DBusList **list)
Frees all links in the list and sets the list head to NULL.
void _dbus_list_prepend_link(DBusList **list, DBusList *link)
Prepends a link to the list.
dbus_bool_t _dbus_list_prepend(DBusList **list, void *data)
Prepends a value to the list.
DBusList * _dbus_list_alloc_link(void *data)
Allocates a linked list node.
dbus_bool_t _dbus_list_append(DBusList **list, void *data)
Appends a value to the list.
#define _dbus_list_get_next_link(list, link)
Gets the next link in the list, or NULL if there are no more links.
#define NULL
A null pointer, defined appropriately for C or C++.
#define TRUE
Expands to "1".
#define FALSE
Expands to "0".
int _dbus_current_generation
_dbus_current_generation is used to track each time that dbus_shutdown() is called,...
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_register_shutdown_func(DBusShutdownFunction function, void *data)
Register a cleanup function to be called exactly once the next time dbus_shutdown() is called.
void(* DBusFreeFunction)(void *memory)
The type of a function which frees a block of memory.
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
#define dbus_new(type, count)
Safe macro for using dbus_malloc().
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0().
void dbus_free_string_array(char **str_array)
Frees a NULL-terminated array of strings.
void dbus_message_set_serial(DBusMessage *message, dbus_uint32_t serial)
Sets the serial number of a message.
void dbus_message_lock(DBusMessage *message)
Locks a message.
const char * dbus_message_type_to_string(int type)
Utility function to convert a D-Bus message type into a machine-readable string (not translated).
void _dbus_message_remove_counter(DBusMessage *message, DBusCounter *counter)
Removes a counter tracking the size/unix fds of this message, and decrements the counter by the size/...
void _dbus_message_add_counter_link(DBusMessage *message, DBusList *link)
Adds a counter to be incremented immediately with the size/unix fds of this message,...
dbus_bool_t dbus_message_has_interface(DBusMessage *message, const char *iface)
Checks if the message has an interface.
void dbus_message_set_no_reply(DBusMessage *message, dbus_bool_t no_reply)
Sets a flag indicating that the message does not want a reply; if this flag is set,...
dbus_bool_t dbus_message_iter_append_basic(DBusMessageIter *iter, int type, const void *value)
Appends a basic-typed value to the message.
const char * dbus_message_get_path(DBusMessage *message)
Gets the object path this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitt...
const char * dbus_message_get_interface(DBusMessage *message)
Gets the interface this message is being sent to (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted...
DBusMessage * dbus_message_new_error(DBusMessage *reply_to, const char *error_name, const char *error_message)
Creates a new message that is an error reply to another message.
dbus_uint32_t dbus_message_get_serial(DBusMessage *message)
Returns the serial of a message or 0 if none has been specified.
int dbus_message_get_type(DBusMessage *message)
Gets the type of a message.
dbus_bool_t dbus_message_append_args(DBusMessage *message, int first_arg_type,...)
Appends fields to a message given a variable argument list.
DBusMessage * dbus_message_new_signal(const char *path, const char *iface, const char *name)
Constructs a new message representing a signal emission.
DBusMessage * dbus_message_ref(DBusMessage *message)
Increments the reference count of a DBusMessage.
dbus_bool_t dbus_message_set_error_name(DBusMessage *message, const char *error_name)
Sets the name of the error (DBUS_MESSAGE_TYPE_ERROR).
dbus_uint32_t dbus_message_get_reply_serial(DBusMessage *message)
Returns the serial that the message is a reply to or 0 if none.
DBusMessage * dbus_message_new_method_return(DBusMessage *method_call)
Constructs a message that is a reply to a method call.
const char * dbus_message_get_destination(DBusMessage *message)
Gets the destination of a message or NULL if there is none set.
void dbus_message_unref(DBusMessage *message)
Decrements the reference count of a DBusMessage, freeing the message if the count reaches 0.
DBusMessage * dbus_message_new(int message_type)
Constructs a new message of the given message type.
dbus_bool_t dbus_set_error_from_message(DBusError *error, DBusMessage *message)
Sets a DBusError based on the contents of the given message.
dbus_bool_t dbus_message_is_method_call(DBusMessage *message, const char *iface, const char *method)
Checks whether the message is a method call with the given interface and member fields.
dbus_bool_t dbus_message_set_reply_serial(DBusMessage *message, dbus_uint32_t reply_serial)
Sets the reply serial of a message (the serial of the message this is a reply to).
dbus_bool_t dbus_message_is_signal(DBusMessage *message, const char *iface, const char *signal_name)
Checks whether the message is a signal with the given interface and member fields.
const char * dbus_message_get_signature(DBusMessage *message)
Gets the type signature of the message, i.e.
const char * dbus_message_get_member(DBusMessage *message)
Gets the interface member being invoked (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted (DBUS_MESSAGE_TYPE...
void dbus_message_iter_init_append(DBusMessage *message, DBusMessageIter *iter)
Initializes a DBusMessageIter for appending arguments to the end of a message.
void _dbus_object_tree_free_all_unlocked(DBusObjectTree *tree)
Free all the handlers in the tree.
void _dbus_object_tree_unregister_and_unlock(DBusObjectTree *tree, const char **path)
Unregisters an object subtree that was registered with the same path.
void _dbus_object_tree_unref(DBusObjectTree *tree)
Decrement the reference count.
dbus_bool_t _dbus_object_tree_list_registered_and_unlock(DBusObjectTree *tree, const char **parent_path, char ***child_entries)
Lists the registered fallback handlers and object path handlers at the given parent_path.
dbus_bool_t _dbus_decompose_path(const char *data, int len, char ***path, int *path_len)
Decompose an object path.
dbus_bool_t _dbus_object_tree_register(DBusObjectTree *tree, dbus_bool_t fallback, const char **path, const DBusObjectPathVTable *vtable, void *user_data, DBusError *error)
Registers a new subtree in the global object tree.
void * _dbus_object_tree_get_user_data_unlocked(DBusObjectTree *tree, const char **path)
Looks up the data passed to _dbus_object_tree_register() for a handler at the given path.
DBusHandlerResult _dbus_object_tree_dispatch_and_unlock(DBusObjectTree *tree, DBusMessage *message, dbus_bool_t *found_object)
Tries to dispatch a message by directing it to handler for the object path listed in the message head...
DBusObjectTree * _dbus_object_tree_new(DBusConnection *connection)
Creates a new object tree, representing a mapping from paths to handler vtables.
void _dbus_pending_call_finish_completion(DBusPendingCall *pending)
Call the notifier function for the pending call.
DBusConnection * _dbus_pending_call_get_connection_and_lock(DBusPendingCall *pending)
Gets the connection associated with this pending call.
DBUS_PRIVATE_EXPORT DBusPendingCall * _dbus_pending_call_ref_unlocked(DBusPendingCall *pending)
Increments the reference count on a pending call, while the lock on its connection is already held.
void _dbus_pending_call_queue_timeout_error_unlocked(DBusPendingCall *pending, DBusConnection *connection)
If the pending call hasn't been timed out, add its timeout error reply to the connection's incoming m...
DBUS_PRIVATE_EXPORT void _dbus_pending_call_unref_and_unlock(DBusPendingCall *pending)
Decrements the reference count on a pending call, freeing it if the count reaches 0.
dbus_bool_t _dbus_pending_call_get_completed_unlocked(DBusPendingCall *pending)
Checks whether the pending call has received a reply yet, or not.
void _dbus_pending_call_set_reply_unlocked(DBusPendingCall *pending, DBusMessage *message)
Sets the reply of a pending call with the given message, or if the message is NULL,...
DBUS_PRIVATE_EXPORT DBusPendingCall * _dbus_pending_call_new_unlocked(DBusConnection *connection, int timeout_milliseconds, DBusTimeoutHandler timeout_handler)
Creates a new pending reply object.
dbus_bool_t _dbus_pending_call_set_timeout_error_unlocked(DBusPendingCall *pending, DBusMessage *message, dbus_uint32_t serial)
Sets the reply message associated with the pending call to a timeout error.
void _dbus_pending_call_start_completion_unlocked(DBusPendingCall *pending)
Sets the pending call to completed.
dbus_bool_t _dbus_pending_call_is_timeout_added_unlocked(DBusPendingCall *pending)
Checks to see if a timeout has been added.
dbus_uint32_t _dbus_pending_call_get_reply_serial_unlocked(DBusPendingCall *pending)
Gets the reply's serial number.
DBusConnection * _dbus_pending_call_get_connection_unlocked(DBusPendingCall *pending)
Gets the connection associated with this pending call.
DBusTimeout * _dbus_pending_call_get_timeout_unlocked(DBusPendingCall *pending)
Retrives the timeout.
void _dbus_pending_call_set_timeout_added_unlocked(DBusPendingCall *pending, dbus_bool_t is_added)
Sets wether the timeout has been added.
DBusPendingCall * dbus_pending_call_ref(DBusPendingCall *pending)
Increments the reference count on a pending call.
DBusMessage * dbus_pending_call_steal_reply(DBusPendingCall *pending)
Gets the reply, or returns NULL if none has been received yet.
void dbus_pending_call_block(DBusPendingCall *pending)
Block until the pending call is completed.
dbus_bool_t dbus_pending_call_get_completed(DBusPendingCall *pending)
Checks whether the pending call has received a reply yet, or not.
void dbus_pending_call_unref(DBusPendingCall *pending)
Decrements the reference count on a pending call, freeing it if the count reaches 0.
#define DBUS_MESSAGE_TYPE_METHOD_CALL
Message type of a method call message, see dbus_message_get_type()
#define DBUS_MESSAGE_TYPE_ERROR
Message type of an error reply message, see dbus_message_get_type()
#define DBUS_ERROR_UNKNOWN_METHOD
Method name you invoked isn't known by the object you invoked it on.
#define DBUS_TYPE_UNIX_FD
Type code marking a unix file descriptor.
#define DBUS_ERROR_OBJECT_PATH_IN_USE
There's already an object with the requested object path.
#define DBUS_MESSAGE_TYPE_SIGNAL
Message type of a signal message, see dbus_message_get_type()
#define DBUS_TYPE_STRING
Type code marking a UTF-8 encoded, nul-terminated Unicode string.
#define DBUS_ERROR_UNKNOWN_OBJECT
Object you invoked a method on isn't known.
#define DBUS_TYPE_INVALID
Type code that is never equal to a legitimate type code.
#define DBUS_ERROR_FAILED
A generic error; "something went wrong" - see the error message for more.
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation.
#define DBUS_ERROR_DISCONNECTED
The connection is disconnected and you're trying to use it.
DBusCounter * _dbus_counter_new(void)
Creates a new DBusCounter.
long _dbus_counter_get_unix_fd_value(DBusCounter *counter)
Gets the current value of the unix fd counter.
void _dbus_counter_unref(DBusCounter *counter)
Decrements refcount of the counter and possibly finalizes the counter.
long _dbus_counter_get_size_value(DBusCounter *counter)
Gets the current value of the size counter.
DBusCounter * _dbus_counter_ref(DBusCounter *counter)
Increments refcount of the counter.
DBusHandlerResult
Results that a message handler can return.
#define DBUS_PATH_LOCAL
The object path used in local/in-process-generated messages.
#define DBUS_INTERFACE_LOCAL
This is a special interface whose methods can only be invoked by the local implementation (messages f...
#define DBUS_INTERFACE_PEER
The interface supported by most dbus peers.
@ DBUS_HANDLER_RESULT_NEED_MEMORY
Need more memory in order to return DBUS_HANDLER_RESULT_HANDLED or DBUS_HANDLER_RESULT_NOT_YET_HANDLE...
@ DBUS_HANDLER_RESULT_HANDLED
Message has had its effect - no need to run more handlers.
@ DBUS_HANDLER_RESULT_NOT_YET_HANDLED
Message has not had any effect - see if other handlers want it.
dbus_bool_t dbus_type_is_valid(int typecode)
Return TRUE if the argument is a valid typecode.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as _DBUS_STRING_IN...
dbus_bool_t _dbus_string_append_printf(DBusString *str, const char *format,...)
Appends a printf-style formatted string to the DBusString.
void _dbus_get_monotonic_time(dbus_int64_t *tv_sec, long *tv_usec)
Get current time, as in gettimeofday().
void _dbus_exit(int code)
Exit the process, returning the given value.
void _dbus_atomic_set_nonzero(DBusAtomic *atomic)
Atomically set the value of an integer to something nonzero.
dbus_int32_t _dbus_atomic_dec(DBusAtomic *atomic)
Atomically decrement an integer.
dbus_int32_t _dbus_atomic_get(DBusAtomic *atomic)
Atomically get the value of an integer.
void _dbus_disable_sigpipe(void)
signal (SIGPIPE, SIG_IGN);
void _dbus_sleep_milliseconds(int milliseconds)
Sleeps the given number of milliseconds.
void _dbus_atomic_set_zero(DBusAtomic *atomic)
Atomically set the value of an integer to 0.
dbus_int32_t _dbus_atomic_inc(DBusAtomic *atomic)
Atomically increments an integer.
void _dbus_rmutex_new_at_location(DBusRMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
void _dbus_cmutex_free_at_location(DBusCMutex **location_p)
Frees a DBusCMutex; does nothing if passed a NULL pointer.
void _dbus_condvar_free_at_location(DBusCondVar **location_p)
Frees a condition variable; does nothing if passed a NULL pointer.
DBUS_PRIVATE_EXPORT void _dbus_rmutex_unlock(DBusRMutex *mutex)
Unlocks a mutex.
void _dbus_condvar_wait(DBusCondVar *cond, DBusCMutex *mutex)
Atomically unlocks the mutex and waits for the conditions variable to be signalled.
void _dbus_condvar_new_at_location(DBusCondVar **location_p)
This does the same thing as _dbus_condvar_new.
void _dbus_cmutex_new_at_location(DBusCMutex **location_p)
Creates a new mutex or creates a no-op mutex if threads are not initialized.
void _dbus_condvar_wake_one(DBusCondVar *cond)
If there are threads waiting on the condition variable, wake up exactly one.
dbus_bool_t _dbus_condvar_wait_timeout(DBusCondVar *cond, DBusCMutex *mutex, int timeout_milliseconds)
Atomically unlocks the mutex and waits for the conditions variable to be signalled,...
void _dbus_cmutex_lock(DBusCMutex *mutex)
Locks a mutex.
void _dbus_cmutex_unlock(DBusCMutex *mutex)
Unlocks a mutex.
void _dbus_rmutex_free_at_location(DBusRMutex **location_p)
Frees a DBusRMutex; does nothing if passed a NULL pointer.
struct DBusMutex DBusMutex
An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...
dbus_bool_t _dbus_timeout_list_add_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout)
Adds a new timeout to the timeout list, invoking the application DBusAddTimeoutFunction if appropriat...
void _dbus_timeout_list_free(DBusTimeoutList *timeout_list)
Frees a DBusTimeoutList.
void _dbus_timeout_list_toggle_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout, dbus_bool_t enabled)
Sets a timeout to the given enabled state, invoking the application's DBusTimeoutToggledFunction if a...
DBusTimeoutList * _dbus_timeout_list_new(void)
Creates a new timeout list.
dbus_bool_t _dbus_timeout_list_set_functions(DBusTimeoutList *timeout_list, DBusAddTimeoutFunction add_function, DBusRemoveTimeoutFunction remove_function, DBusTimeoutToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the timeout functions.
void _dbus_timeout_list_remove_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout)
Removes a timeout from the timeout list, invoking the application's DBusRemoveTimeoutFunction if appr...
DBUS_EXPORT int dbus_timeout_get_interval(DBusTimeout *timeout)
Gets the timeout interval.
void _dbus_transport_set_max_message_size(DBusTransport *transport, long size)
See dbus_connection_set_max_message_size().
void _dbus_transport_set_max_received_size(DBusTransport *transport, long size)
See dbus_connection_set_max_received_size().
DBusDispatchStatus _dbus_transport_get_dispatch_status(DBusTransport *transport)
Reports our current dispatch status (whether there's buffered data to be queued as messages,...
int _dbus_transport_get_pending_fds_count(DBusTransport *transport)
Return how many file descriptors are pending in the loader.
dbus_bool_t _dbus_transport_get_adt_audit_session_data(DBusTransport *transport, void **data, int *data_size)
See dbus_connection_get_adt_audit_session_data().
dbus_bool_t _dbus_transport_get_windows_user(DBusTransport *transport, char **windows_sid_p)
See dbus_connection_get_windows_user().
dbus_bool_t _dbus_transport_queue_messages(DBusTransport *transport)
Processes data we've read while handling a watch, potentially converting some of it to messages and q...
dbus_bool_t _dbus_transport_get_socket_fd(DBusTransport *transport, DBusSocket *fd_p)
Get the socket file descriptor, if any.
const char * _dbus_transport_get_address(DBusTransport *transport)
Gets the address of a transport.
dbus_bool_t _dbus_transport_handle_watch(DBusTransport *transport, DBusWatch *watch, unsigned int condition)
Handles a watch by reading data, writing data, or disconnecting the transport, as appropriate for the...
DBusTransport * _dbus_transport_ref(DBusTransport *transport)
Increments the reference count for the transport.
dbus_bool_t _dbus_transport_peek_is_authenticated(DBusTransport *transport)
Returns TRUE if we have been authenticated.
void _dbus_transport_set_allow_anonymous(DBusTransport *transport, dbus_bool_t value)
See dbus_connection_set_allow_anonymous()
void _dbus_transport_disconnect(DBusTransport *transport)
Closes our end of the connection to a remote application.
long _dbus_transport_get_max_received_size(DBusTransport *transport)
See dbus_connection_get_max_received_size().
DBusCredentials * _dbus_transport_get_credentials(DBusTransport *transport)
If the transport has already been authenticated, return its credentials.
dbus_bool_t _dbus_transport_set_connection(DBusTransport *transport, DBusConnection *connection)
Sets the connection using this transport.
void _dbus_transport_set_unix_user_function(DBusTransport *transport, DBusAllowUnixUserFunction function, void *data, DBusFreeFunction free_data_function, void **old_data, DBusFreeFunction *old_free_data_function)
See dbus_connection_set_unix_user_function().
long _dbus_transport_get_max_message_unix_fds(DBusTransport *transport)
See dbus_connection_get_max_message_unix_fds().
void _dbus_transport_set_max_received_unix_fds(DBusTransport *transport, long n)
See dbus_connection_set_max_received_unix_fds().
void _dbus_transport_unref(DBusTransport *transport)
Decrements the reference count for the transport.
dbus_bool_t _dbus_transport_can_pass_unix_fd(DBusTransport *transport)
Returns TRUE if the transport supports sending unix fds.
dbus_bool_t _dbus_transport_try_to_authenticate(DBusTransport *transport)
Returns TRUE if we have been authenticated.
void _dbus_transport_do_iteration(DBusTransport *transport, unsigned int flags, int timeout_milliseconds)
Performs a single poll()/select() on the transport's file descriptors and then reads/writes data as a...
long _dbus_transport_get_max_received_unix_fds(DBusTransport *transport)
See dbus_connection_set_max_received_unix_fds().
dbus_bool_t _dbus_transport_get_is_connected(DBusTransport *transport)
Returns TRUE if the transport has not been disconnected.
void _dbus_transport_set_max_message_unix_fds(DBusTransport *transport, long n)
See dbus_connection_set_max_message_unix_fds().
void _dbus_transport_set_pending_fds_function(DBusTransport *transport, void(*callback)(void *), void *data)
Register a function to be called whenever the number of pending file descriptors in the loader change...
void _dbus_transport_set_windows_user_function(DBusTransport *transport, DBusAllowWindowsUserFunction function, void *data, DBusFreeFunction free_data_function, void **old_data, DBusFreeFunction *old_free_data_function)
See dbus_connection_set_windows_user_function().
long _dbus_transport_get_max_message_size(DBusTransport *transport)
See dbus_connection_get_max_message_size().
dbus_bool_t _dbus_transport_get_unix_process_id(DBusTransport *transport, unsigned long *pid)
See dbus_connection_get_unix_process_id().
DBusTransport * _dbus_transport_open(DBusAddressEntry *entry, DBusError *error)
Try to open a new transport for the given address entry.
const char * _dbus_transport_get_server_id(DBusTransport *transport)
Gets the id of the server we are connected to (see dbus_server_get_id()).
dbus_bool_t _dbus_transport_get_is_anonymous(DBusTransport *transport)
See dbus_connection_get_is_anonymous().
dbus_bool_t _dbus_transport_get_unix_user(DBusTransport *transport, unsigned long *uid)
See dbus_connection_get_unix_user().
#define DBUS_INT64_MODIFIER
A string literal for a length modifier that is appropriate to print the dbus_int64_t and dbus_uint64_...
dbus_bool_t _dbus_watch_list_add_watch(DBusWatchList *watch_list, DBusWatch *watch)
Adds a new watch to the watch list, invoking the application DBusAddWatchFunction if appropriate.
void _dbus_watch_list_toggle_watch(DBusWatchList *watch_list, DBusWatch *watch, dbus_bool_t enabled)
Sets a watch to the given enabled state, invoking the application's DBusWatchToggledFunction if appro...
DBusWatchList * _dbus_watch_list_new(void)
Creates a new watch list.
void _dbus_watch_list_free(DBusWatchList *watch_list)
Frees a DBusWatchList.
dbus_bool_t _dbus_watch_list_set_functions(DBusWatchList *watch_list, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the watch functions.
void _dbus_watch_list_remove_watch(DBusWatchList *watch_list, DBusWatch *watch)
Removes a watch from the watch list, invoking the application's DBusRemoveWatchFunction if appropriat...
Internals of DBusAddressEntry.
An atomic integer safe to increment or decrement from multiple threads.
Implementation details of DBusConnection.
void * dispatch_status_data
Application data for dispatch_status_function.
int n_outgoing
Length of outgoing queue.
DBusDataSlotList slot_list
Data stored by allocated integer ID.
dbus_bool_t dispatch_acquired
Someone has dispatch path (can drain incoming queue)
DBusCondVar * dispatch_cond
Notify when dispatch_acquired is available.
DBusWakeupMainFunction wakeup_main_function
Function to wake up the mainloop
unsigned int exit_on_disconnect
If TRUE, exit after handling disconnect signal.
DBusList * filter_list
List of filters.
unsigned int have_connection_lock
Used to check locking.
unsigned int disconnected_message_processed
We did our default handling of the disconnected message, such as closing the connection.
dbus_uint32_t client_serial
Client serial.
unsigned int disconnected_message_arrived
We popped or are dispatching the disconnected message.
DBusCounter * outgoing_counter
Counts size of outgoing messages.
unsigned int builtin_filters_enabled
If TRUE, handle org.freedesktop.DBus.Peer messages automatically, whether they have a bus name or not...
DBusCondVar * io_path_cond
Notify when io_path_acquired is available.
DBusAtomic refcount
Reference count.
DBusList * outgoing_messages
Queue of messages we need to send, send the end of the list first.
DBusFreeFunction free_dispatch_status_data
free dispatch_status_data
DBusRMutex * slot_mutex
Lock on slot_list so overall connection lock need not be taken.
DBusFreeFunction free_wakeup_main_data
free wakeup_main_data
DBusTransport * transport
Object that sends/receives messages over network.
DBusRMutex * mutex
Lock on the entire DBusConnection.
int n_incoming
Length of incoming queue.
dbus_bool_t io_path_acquired
Someone has transport io path (can use the transport to read/write messages)
DBusList * disconnect_message_link
Preallocated list node for queueing the disconnection message.
DBusCMutex * io_path_mutex
Protects io_path_acquired.
DBusList * incoming_messages
Queue of messages we have received, end of the list received most recently.
unsigned int shareable
TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more...
unsigned int route_peer_messages
If TRUE, if org.freedesktop.DBus.Peer messages have a bus name, don't handle them automatically.
DBusWatchList * watches
Stores active watches.
void * wakeup_main_data
Application data for wakeup_main_function.
DBusObjectTree * objects
Object path handlers registered with this connection.
char * server_guid
GUID of server if we are in shared_connections, NULL if server GUID is unknown or connection is priva...
DBusHashTable * pending_replies
Hash of message serials to DBusPendingCall.
DBusCMutex * dispatch_mutex
Protects dispatch_acquired.
DBusMessage * message_borrowed
Filled in if the first incoming message has been borrowed; dispatch_acquired will be set by the borro...
DBusTimeoutList * timeouts
Stores active timeouts.
DBusDispatchStatus last_dispatch_status
The last dispatch status we reported to the application.
DBusDispatchStatusFunction dispatch_status_function
Function on dispatch status changes
DBusList * expired_messages
Messages that will be released when we next unlock.
Internals of DBusCounter.
An allocator that tracks a set of slot IDs.
Data structure that stores the actual user data set at a given slot.
Object representing an exception.
const char * name
public error name field
const char * message
public error message field
Internals of DBusHashTable.
void * data
Data stored at this element.
Internal struct representing a message filter function.
DBusAtomic refcount
Reference count.
DBusHandleMessageFunction function
Function to call to filter.
void * user_data
User data for the function.
DBusFreeFunction free_user_data_function
Function to free the user data.
DBusMessageIter struct; contains no public fields.
Internals of DBusMessage.
Virtual table that must be implemented to handle a portion of the object path hierarchy.
Internals of DBusObjectTree.
Implementation details of DBusPendingCall - all fields are private.
Internals of DBusPreallocatedSend.
DBusConnection * connection
Connection we'd send the message to.
DBusList * counter_link
Preallocated link in the resource counter.
DBusList * queue_link
Preallocated link in the queue.
DBusTimeoutList implementation details.
Internals of DBusTimeout.
Object representing a transport such as a socket.
DBusWatchList implementation details.
Implementation of DBusWatch.