Havoc Pennington | d012387 | 2007-07-14 02:44:01 +0000 | [diff] [blame] | 1 | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ |
Havoc Pennington | 041b076 | 2002-11-25 05:13:09 +0000 | [diff] [blame] | 2 | /* dbus-connection-internal.h DBusConnection internal interfaces |
| 3 | * |
| 4 | * Copyright (C) 2002 Red Hat Inc. |
| 5 | * |
Havoc Pennington | 43605a6 | 2004-08-10 03:07:01 +0000 | [diff] [blame] | 6 | * Licensed under the Academic Free License version 2.1 |
Havoc Pennington | 041b076 | 2002-11-25 05:13:09 +0000 | [diff] [blame] | 7 | * |
| 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 Mueller | 5baf2f8 | 2009-07-10 19:32:38 -0400 | [diff] [blame] | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
Havoc Pennington | 041b076 | 2002-11-25 05:13:09 +0000 | [diff] [blame] | 21 | * |
| 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 Pennington | 14cc270 | 2003-01-19 05:14:46 +0000 | [diff] [blame] | 30 | #include <dbus/dbus-resources.h> |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 31 | #include <dbus/dbus-list.h> |
Havoc Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 32 | #include <dbus/dbus-timeout.h> |
Havoc Pennington | 583994c | 2003-09-17 03:52:07 +0000 | [diff] [blame] | 33 | #include <dbus/dbus-dataslot.h> |
Havoc Pennington | 041b076 | 2002-11-25 05:13:09 +0000 | [diff] [blame] | 34 | |
Olivier Andrieu | a9ff341 | 2004-09-09 10:20:17 +0000 | [diff] [blame] | 35 | DBUS_BEGIN_DECLS |
Havoc Pennington | 041b076 | 2002-11-25 05:13:09 +0000 | [diff] [blame] | 36 | |
| 37 | typedef 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 Pennington | 3df260c | 2003-04-18 04:18:57 +0000 | [diff] [blame] | 43 | |
Havoc Pennington | 4d985d9 | 2005-01-30 20:06:52 +0000 | [diff] [blame] | 44 | /** default timeout value when waiting for a message reply, 25 seconds */ |
| 45 | #define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000) |
Havoc Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 46 | |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 47 | void _dbus_connection_lock (DBusConnection *connection); |
| 48 | void _dbus_connection_unlock (DBusConnection *connection); |
Mikael Hallendal | 9f1a60d | 2003-11-27 01:25:50 +0000 | [diff] [blame] | 49 | DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection); |
Havoc Pennington | cefb84e | 2003-08-07 02:18:54 +0000 | [diff] [blame] | 50 | void _dbus_connection_unref_unlocked (DBusConnection *connection); |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 51 | dbus_bool_t _dbus_connection_queue_received_message (DBusConnection *connection, |
| 52 | DBusMessage *message); |
| 53 | void _dbus_connection_queue_received_message_link (DBusConnection *connection, |
| 54 | DBusList *link); |
Havoc Pennington | dbdea92 | 2004-11-26 01:53:13 +0000 | [diff] [blame] | 55 | dbus_bool_t _dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection); |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 56 | DBusMessage* _dbus_connection_get_message_to_send (DBusConnection *connection); |
| 57 | void _dbus_connection_message_sent (DBusConnection *connection, |
| 58 | DBusMessage *message); |
Mark McLoughlin | 5e8110d | 2005-09-11 10:02:47 +0000 | [diff] [blame] | 59 | dbus_bool_t _dbus_connection_add_watch_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 60 | DBusWatch *watch); |
Mark McLoughlin | 5e8110d | 2005-09-11 10:02:47 +0000 | [diff] [blame] | 61 | void _dbus_connection_remove_watch_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 62 | DBusWatch *watch); |
Mark McLoughlin | 5e8110d | 2005-09-11 10:02:47 +0000 | [diff] [blame] | 63 | void _dbus_connection_toggle_watch_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 64 | DBusWatch *watch, |
| 65 | dbus_bool_t enabled); |
Havoc Pennington | 3df260c | 2003-04-18 04:18:57 +0000 | [diff] [blame] | 66 | dbus_bool_t _dbus_connection_handle_watch (DBusWatch *watch, |
| 67 | unsigned int condition, |
| 68 | void *data); |
Mark McLoughlin | 5e8110d | 2005-09-11 10:02:47 +0000 | [diff] [blame] | 69 | dbus_bool_t _dbus_connection_add_timeout_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 70 | DBusTimeout *timeout); |
Mark McLoughlin | 5e8110d | 2005-09-11 10:02:47 +0000 | [diff] [blame] | 71 | void _dbus_connection_remove_timeout_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 72 | DBusTimeout *timeout); |
Mark McLoughlin | 5e8110d | 2005-09-11 10:02:47 +0000 | [diff] [blame] | 73 | void _dbus_connection_toggle_timeout_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 74 | DBusTimeout *timeout, |
| 75 | dbus_bool_t enabled); |
| 76 | DBusConnection* _dbus_connection_new_for_transport (DBusTransport *transport); |
Havoc Pennington | f349e6b | 2005-02-13 17:16:25 +0000 | [diff] [blame] | 77 | void _dbus_connection_do_iteration_unlocked (DBusConnection *connection, |
Havoc Pennington | 5c53fb2 | 2003-03-16 08:31:00 +0000 | [diff] [blame] | 78 | unsigned int flags, |
| 79 | int timeout_milliseconds); |
Havoc Pennington | a2129f7 | 2006-10-01 15:36:19 +0000 | [diff] [blame] | 80 | void _dbus_connection_close_possibly_shared (DBusConnection *connection); |
| 81 | void _dbus_connection_close_if_only_one_ref (DBusConnection *connection); |
Havoc Pennington | 8d38a2e | 2003-08-29 01:05:00 +0000 | [diff] [blame] | 82 | |
Havoc Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 83 | DBusPendingCall* _dbus_pending_call_new (DBusConnection *connection, |
| 84 | int timeout_milliseconds, |
| 85 | DBusTimeoutHandler timeout_handler); |
Havoc Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 86 | void _dbus_pending_call_notify (DBusPendingCall *pending); |
Havoc Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 87 | void _dbus_connection_remove_pending_call (DBusConnection *connection, |
| 88 | DBusPendingCall *pending); |
Havoc Pennington | 9e44508 | 2005-02-16 04:37:27 +0000 | [diff] [blame] | 89 | void _dbus_connection_block_pending_call (DBusPendingCall *pending); |
Havoc Pennington | a1b0bd3 | 2003-08-15 23:10:12 +0000 | [diff] [blame] | 90 | void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending, |
| 91 | DBusMessage *message); |
Havoc Pennington | df0c640 | 2005-02-10 23:47:55 +0000 | [diff] [blame] | 92 | dbus_bool_t _dbus_connection_send_and_unlock (DBusConnection *connection, |
Havoc Pennington | 98ad8a8 | 2005-01-30 07:44:08 +0000 | [diff] [blame] | 93 | DBusMessage *message, |
| 94 | dbus_uint32_t *client_serial); |
Havoc Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 95 | |
John (J5) Palmieri | e3dc6e2 | 2006-07-12 15:57:01 +0000 | [diff] [blame] | 96 | void _dbus_connection_queue_synthesized_message_link (DBusConnection *connection, |
| 97 | DBusList *link); |
John (J5) Palmieri | b195119 | 2006-09-07 19:02:22 +0000 | [diff] [blame] | 98 | void _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 Pennington | ef61420 | 2003-08-15 04:17:58 +0000 | [diff] [blame] | 104 | |
Havoc Pennington | 8ea5a53 | 2006-10-22 15:03:10 +0000 | [diff] [blame] | 105 | /* 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 | |
| 113 | void _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection); |
| 114 | |
| 115 | /** @} */ |
| 116 | |
| 117 | |
Olivier Andrieu | a9ff341 | 2004-09-09 10:20:17 +0000 | [diff] [blame] | 118 | DBUS_END_DECLS |
Havoc Pennington | 041b076 | 2002-11-25 05:13:09 +0000 | [diff] [blame] | 119 | |
| 120 | #endif /* DBUS_CONNECTION_INTERNAL_H */ |