-/* -*- mode: C; c-file-style: "gnu" -*- */
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-connection-internal.h DBusConnection internal interfaces
*
* Copyright (C) 2002 Red Hat Inc.
*
- * Licensed under the Academic Free License version 1.2
+ * Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_CONNECTION_INTERNAL_H
#include <dbus/dbus-resources.h>
#include <dbus/dbus-list.h>
#include <dbus/dbus-timeout.h>
+#include <dbus/dbus-dataslot.h>
-DBUS_BEGIN_DECLS;
+DBUS_BEGIN_DECLS
typedef enum
{
DBUS_ITERATION_BLOCK = 1 << 2 /**< Block if nothing to do. */
} DBusIterationFlags;
-/** default timeout value when waiting for a message reply */
-#define _DBUS_DEFAULT_TIMEOUT_VALUE (15 * 1000)
+/** default timeout value when waiting for a message reply, 25 seconds */
+#define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
void _dbus_connection_lock (DBusConnection *connection);
void _dbus_connection_unlock (DBusConnection *connection);
-void _dbus_connection_ref_unlocked (DBusConnection *connection);
+DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection);
void _dbus_connection_unref_unlocked (DBusConnection *connection);
-dbus_bool_t _dbus_connection_queue_received_message (DBusConnection *connection,
- DBusMessage *message);
void _dbus_connection_queue_received_message_link (DBusConnection *connection,
DBusList *link);
-dbus_bool_t _dbus_connection_have_messages_to_send (DBusConnection *connection);
+dbus_bool_t _dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection);
DBusMessage* _dbus_connection_get_message_to_send (DBusConnection *connection);
-void _dbus_connection_message_sent (DBusConnection *connection,
+void _dbus_connection_message_sent_unlocked (DBusConnection *connection,
DBusMessage *message);
-dbus_bool_t _dbus_connection_add_watch (DBusConnection *connection,
+dbus_bool_t _dbus_connection_add_watch_unlocked (DBusConnection *connection,
DBusWatch *watch);
-void _dbus_connection_remove_watch (DBusConnection *connection,
+void _dbus_connection_remove_watch_unlocked (DBusConnection *connection,
DBusWatch *watch);
-void _dbus_connection_toggle_watch (DBusConnection *connection,
+void _dbus_connection_toggle_watch_unlocked (DBusConnection *connection,
DBusWatch *watch,
dbus_bool_t enabled);
dbus_bool_t _dbus_connection_handle_watch (DBusWatch *watch,
unsigned int condition,
void *data);
-dbus_bool_t _dbus_connection_add_timeout (DBusConnection *connection,
+dbus_bool_t _dbus_connection_add_timeout_unlocked (DBusConnection *connection,
DBusTimeout *timeout);
-void _dbus_connection_remove_timeout (DBusConnection *connection,
+void _dbus_connection_remove_timeout_unlocked (DBusConnection *connection,
DBusTimeout *timeout);
-void _dbus_connection_toggle_timeout (DBusConnection *connection,
+void _dbus_connection_toggle_timeout_unlocked (DBusConnection *connection,
DBusTimeout *timeout,
dbus_bool_t enabled);
DBusConnection* _dbus_connection_new_for_transport (DBusTransport *transport);
-void _dbus_connection_do_iteration (DBusConnection *connection,
+void _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
+ DBusPendingCall *pending,
unsigned int flags,
int timeout_milliseconds);
-void _dbus_connection_notify_disconnected (DBusConnection *connection);
-void _dbus_connection_handler_destroyed_locked (DBusConnection *connection,
- DBusMessageHandler *handler);
-dbus_bool_t _dbus_message_handler_add_connection (DBusMessageHandler *handler,
- DBusConnection *connection);
-void _dbus_message_handler_remove_connection (DBusMessageHandler *handler,
- DBusConnection *connection);
-DBusHandlerResult _dbus_message_handler_handle_message (DBusMessageHandler *handler,
- DBusConnection *connection,
- DBusMessage *message);
-void _dbus_connection_init_id (DBusConnection *connection,
- DBusObjectID *id);
+void _dbus_connection_close_possibly_shared (DBusConnection *connection);
+void _dbus_connection_close_if_only_one_ref (DBusConnection *connection);
DBusPendingCall* _dbus_pending_call_new (DBusConnection *connection,
int timeout_milliseconds,
DBusTimeoutHandler timeout_handler);
-
void _dbus_pending_call_notify (DBusPendingCall *pending);
-
void _dbus_connection_remove_pending_call (DBusConnection *connection,
DBusPendingCall *pending);
-
-/**
- * @addtogroup DBusPendingCallInternals DBusPendingCall implementation details
- * @{
+void _dbus_connection_block_pending_call (DBusPendingCall *pending);
+void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
+ DBusMessage *message);
+dbus_bool_t _dbus_connection_send_and_unlock (DBusConnection *connection,
+ DBusMessage *message,
+ dbus_uint32_t *client_serial);
+
+void _dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
+ DBusList *link);
+void _dbus_connection_test_get_locks (DBusConnection *conn,
+ DBusMutex **mutex_loc,
+ DBusMutex **dispatch_mutex_loc,
+ DBusMutex **io_path_mutex_loc,
+ DBusCondVar **dispatch_cond_loc,
+ DBusCondVar **io_path_cond_loc);
+
+/* if DBUS_ENABLE_STATS */
+void _dbus_connection_get_stats (DBusConnection *connection,
+ dbus_uint32_t *in_messages,
+ dbus_uint32_t *in_bytes,
+ dbus_uint32_t *in_fds,
+ dbus_uint32_t *in_peak_bytes,
+ dbus_uint32_t *in_peak_fds,
+ dbus_uint32_t *out_messages,
+ dbus_uint32_t *out_bytes,
+ dbus_uint32_t *out_fds,
+ dbus_uint32_t *out_peak_bytes,
+ dbus_uint32_t *out_peak_fds);
+
+
+/* if DBUS_ENABLE_EMBEDDED_TESTS */
+const char* _dbus_connection_get_address (DBusConnection *connection);
+
+/* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
+ * silly for one function
*/
/**
- * @brief Internals of DBusPendingCall
- *
- * Object representing a reply message that we're waiting for.
+ * @addtogroup DBusBusInternals
+ * @{
*/
-struct DBusPendingCall
-{
- DBusAtomic refcount; /**< reference count */
-
- DBusPendingCallNotifyFunction function; /**< Notifier when reply arrives. */
- void *user_data; /**< user data for function */
- DBusFreeFunction free_user_data; /**< free the user data */
-
- DBusConnection *connection; /**< Connections we're associated with */
- DBusMessage *reply; /**< Reply (after we've received it) */
- DBusTimeout *timeout; /**< Timeout */
-
- DBusList *timeout_link; /**< Preallocated timeout response */
-
- dbus_uint32_t reply_serial; /**< Expected serial of reply */
- unsigned int completed : 1; /**< TRUE if completed */
- unsigned int timeout_added : 1; /**< Have added the timeout */
-};
+void _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection);
-/** @} End of DBusPendingCallInternals */
+/** @} */
-DBUS_END_DECLS;
+DBUS_END_DECLS
#endif /* DBUS_CONNECTION_INTERNAL_H */