blob: 721b5d738aac2669565e22f5da429ef5219c5ae3 [file] [log] [blame]
Havoc Penningtond0123872007-07-14 02:44:01 +00001/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
Havoc Pennington041b0762002-11-25 05:13:09 +00002/* dbus-connection-internal.h DBusConnection internal interfaces
3 *
4 * Copyright (C) 2002 Red Hat Inc.
5 *
Havoc Pennington43605a62004-08-10 03:07:01 +00006 * Licensed under the Academic Free License version 2.1
Havoc Pennington041b0762002-11-25 05:13:09 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
Tobias Mueller5baf2f82009-07-10 19:32:38 -040020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Havoc Pennington041b0762002-11-25 05:13:09 +000021 *
22 */
23#ifndef DBUS_CONNECTION_INTERNAL_H
24#define DBUS_CONNECTION_INTERNAL_H
25
26#include <dbus/dbus-internals.h>
27#include <dbus/dbus-connection.h>
28#include <dbus/dbus-message.h>
29#include <dbus/dbus-transport.h>
Havoc Pennington14cc2702003-01-19 05:14:46 +000030#include <dbus/dbus-resources.h>
Havoc Pennington5c53fb22003-03-16 08:31:00 +000031#include <dbus/dbus-list.h>
Havoc Penningtonef614202003-08-15 04:17:58 +000032#include <dbus/dbus-timeout.h>
Havoc Pennington583994c2003-09-17 03:52:07 +000033#include <dbus/dbus-dataslot.h>
Havoc Pennington041b0762002-11-25 05:13:09 +000034
Olivier Andrieua9ff3412004-09-09 10:20:17 +000035DBUS_BEGIN_DECLS
Havoc Pennington041b0762002-11-25 05:13:09 +000036
37typedef enum
38{
39 DBUS_ITERATION_DO_WRITING = 1 << 0, /**< Write messages out. */
40 DBUS_ITERATION_DO_READING = 1 << 1, /**< Read messages in. */
41 DBUS_ITERATION_BLOCK = 1 << 2 /**< Block if nothing to do. */
42} DBusIterationFlags;
Havoc Pennington3df260c2003-04-18 04:18:57 +000043
Havoc Pennington4d985d92005-01-30 20:06:52 +000044/** default timeout value when waiting for a message reply, 25 seconds */
45#define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
Havoc Penningtonef614202003-08-15 04:17:58 +000046
Havoc Pennington5c53fb22003-03-16 08:31:00 +000047void _dbus_connection_lock (DBusConnection *connection);
48void _dbus_connection_unlock (DBusConnection *connection);
Mikael Hallendal9f1a60d2003-11-27 01:25:50 +000049DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection);
Havoc Penningtoncefb84e2003-08-07 02:18:54 +000050void _dbus_connection_unref_unlocked (DBusConnection *connection);
Havoc Pennington5c53fb22003-03-16 08:31:00 +000051dbus_bool_t _dbus_connection_queue_received_message (DBusConnection *connection,
52 DBusMessage *message);
53void _dbus_connection_queue_received_message_link (DBusConnection *connection,
54 DBusList *link);
Havoc Penningtondbdea922004-11-26 01:53:13 +000055dbus_bool_t _dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection);
Havoc Pennington5c53fb22003-03-16 08:31:00 +000056DBusMessage* _dbus_connection_get_message_to_send (DBusConnection *connection);
57void _dbus_connection_message_sent (DBusConnection *connection,
58 DBusMessage *message);
Mark McLoughlin5e8110d2005-09-11 10:02:47 +000059dbus_bool_t _dbus_connection_add_watch_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000060 DBusWatch *watch);
Mark McLoughlin5e8110d2005-09-11 10:02:47 +000061void _dbus_connection_remove_watch_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000062 DBusWatch *watch);
Mark McLoughlin5e8110d2005-09-11 10:02:47 +000063void _dbus_connection_toggle_watch_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000064 DBusWatch *watch,
65 dbus_bool_t enabled);
Havoc Pennington3df260c2003-04-18 04:18:57 +000066dbus_bool_t _dbus_connection_handle_watch (DBusWatch *watch,
67 unsigned int condition,
68 void *data);
Mark McLoughlin5e8110d2005-09-11 10:02:47 +000069dbus_bool_t _dbus_connection_add_timeout_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000070 DBusTimeout *timeout);
Mark McLoughlin5e8110d2005-09-11 10:02:47 +000071void _dbus_connection_remove_timeout_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000072 DBusTimeout *timeout);
Mark McLoughlin5e8110d2005-09-11 10:02:47 +000073void _dbus_connection_toggle_timeout_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000074 DBusTimeout *timeout,
75 dbus_bool_t enabled);
76DBusConnection* _dbus_connection_new_for_transport (DBusTransport *transport);
Havoc Penningtonf349e6b2005-02-13 17:16:25 +000077void _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
Havoc Pennington5c53fb22003-03-16 08:31:00 +000078 unsigned int flags,
79 int timeout_milliseconds);
Havoc Penningtona2129f72006-10-01 15:36:19 +000080void _dbus_connection_close_possibly_shared (DBusConnection *connection);
81void _dbus_connection_close_if_only_one_ref (DBusConnection *connection);
Havoc Pennington8d38a2e2003-08-29 01:05:00 +000082
Havoc Penningtonef614202003-08-15 04:17:58 +000083DBusPendingCall* _dbus_pending_call_new (DBusConnection *connection,
84 int timeout_milliseconds,
85 DBusTimeoutHandler timeout_handler);
Havoc Penningtonef614202003-08-15 04:17:58 +000086void _dbus_pending_call_notify (DBusPendingCall *pending);
Havoc Penningtonef614202003-08-15 04:17:58 +000087void _dbus_connection_remove_pending_call (DBusConnection *connection,
88 DBusPendingCall *pending);
Havoc Pennington9e445082005-02-16 04:37:27 +000089void _dbus_connection_block_pending_call (DBusPendingCall *pending);
Havoc Penningtona1b0bd32003-08-15 23:10:12 +000090void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
91 DBusMessage *message);
Havoc Penningtondf0c6402005-02-10 23:47:55 +000092dbus_bool_t _dbus_connection_send_and_unlock (DBusConnection *connection,
Havoc Pennington98ad8a82005-01-30 07:44:08 +000093 DBusMessage *message,
94 dbus_uint32_t *client_serial);
Havoc Penningtonef614202003-08-15 04:17:58 +000095
John (J5) Palmierie3dc6e22006-07-12 15:57:01 +000096void _dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
97 DBusList *link);
John (J5) Palmierib1951192006-09-07 19:02:22 +000098void _dbus_connection_test_get_locks (DBusConnection *conn,
99 DBusMutex **mutex_loc,
100 DBusMutex **dispatch_mutex_loc,
101 DBusMutex **io_path_mutex_loc,
102 DBusCondVar **dispatch_cond_loc,
103 DBusCondVar **io_path_cond_loc);
Havoc Penningtonef614202003-08-15 04:17:58 +0000104
Havoc Pennington8ea5a532006-10-22 15:03:10 +0000105/* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
106 * silly for one function
107 */
108/**
109 * @addtogroup DBusBusInternals
110 * @{
111 */
112
113void _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection);
114
115/** @} */
116
117
Olivier Andrieua9ff3412004-09-09 10:20:17 +0000118DBUS_END_DECLS
Havoc Pennington041b0762002-11-25 05:13:09 +0000119
120#endif /* DBUS_CONNECTION_INTERNAL_H */