D-Bus  1.10.12
dbus-connection-internal.h
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 /* dbus-connection-internal.h DBusConnection internal interfaces
00003  *
00004  * Copyright (C) 2002  Red Hat Inc.
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  *
00022  */
00023 #ifndef DBUS_CONNECTION_INTERNAL_H
00024 #define DBUS_CONNECTION_INTERNAL_H
00025 
00026 #include <dbus/dbus-internals.h>
00027 #include <dbus/dbus-connection.h>
00028 #include <dbus/dbus-message.h>
00029 #include <dbus/dbus-transport.h>
00030 #include <dbus/dbus-resources.h>
00031 #include <dbus/dbus-list.h>
00032 #include <dbus/dbus-timeout.h>
00033 #include <dbus/dbus-dataslot.h>
00034 
00035 DBUS_BEGIN_DECLS
00036 
00037 typedef enum
00038 {
00039   DBUS_ITERATION_DO_WRITING = 1 << 0, 
00040   DBUS_ITERATION_DO_READING = 1 << 1, 
00041   DBUS_ITERATION_BLOCK      = 1 << 2  
00042 } DBusIterationFlags;
00043 
00045 #define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
00046 
00047 typedef void (* DBusPendingFdsChangeFunction) (void *data);
00048 
00049 DBUS_PRIVATE_EXPORT
00050 void              _dbus_connection_lock                        (DBusConnection     *connection);
00051 DBUS_PRIVATE_EXPORT
00052 void              _dbus_connection_unlock                      (DBusConnection     *connection);
00053 DBUS_PRIVATE_EXPORT
00054 DBusConnection *  _dbus_connection_ref_unlocked                (DBusConnection     *connection);
00055 DBUS_PRIVATE_EXPORT
00056 void              _dbus_connection_unref_unlocked              (DBusConnection     *connection);
00057 void              _dbus_connection_queue_received_message_link (DBusConnection     *connection,
00058                                                                 DBusList           *link);
00059 dbus_bool_t       _dbus_connection_has_messages_to_send_unlocked (DBusConnection     *connection);
00060 DBusMessage*      _dbus_connection_get_message_to_send         (DBusConnection     *connection);
00061 void              _dbus_connection_message_sent_unlocked       (DBusConnection     *connection,
00062                                                                 DBusMessage        *message);
00063 dbus_bool_t       _dbus_connection_add_watch_unlocked          (DBusConnection     *connection,
00064                                                                 DBusWatch          *watch);
00065 void              _dbus_connection_remove_watch_unlocked       (DBusConnection     *connection,
00066                                                                 DBusWatch          *watch);
00067 void              _dbus_connection_toggle_watch_unlocked       (DBusConnection     *connection,
00068                                                                 DBusWatch          *watch,
00069                                                                 dbus_bool_t         enabled);
00070 dbus_bool_t       _dbus_connection_handle_watch                (DBusWatch          *watch,
00071                                                                 unsigned int        condition,
00072                                                                 void               *data);
00073 dbus_bool_t       _dbus_connection_add_timeout_unlocked        (DBusConnection     *connection,
00074                                                                 DBusTimeout        *timeout);
00075 void              _dbus_connection_remove_timeout_unlocked     (DBusConnection     *connection,
00076                                                                 DBusTimeout        *timeout);
00077 void              _dbus_connection_toggle_timeout_unlocked     (DBusConnection     *connection,
00078                                                                 DBusTimeout        *timeout,
00079                                                                 dbus_bool_t         enabled);
00080 DBusConnection*   _dbus_connection_new_for_transport           (DBusTransport      *transport);
00081 void              _dbus_connection_do_iteration_unlocked       (DBusConnection     *connection,
00082                                                                 DBusPendingCall    *pending,
00083                                                                 unsigned int        flags,
00084                                                                 int                 timeout_milliseconds);
00085 void              _dbus_connection_close_possibly_shared       (DBusConnection     *connection);
00086 void              _dbus_connection_close_if_only_one_ref       (DBusConnection     *connection);
00087 
00088 DBusPendingCall*  _dbus_pending_call_new                       (DBusConnection     *connection,
00089                                                                 int                 timeout_milliseconds,
00090                                                                 DBusTimeoutHandler  timeout_handler);
00091 void              _dbus_pending_call_notify                    (DBusPendingCall    *pending);
00092 void              _dbus_connection_remove_pending_call         (DBusConnection     *connection,
00093                                                                 DBusPendingCall    *pending);
00094 void              _dbus_connection_block_pending_call          (DBusPendingCall    *pending);
00095 void              _dbus_pending_call_complete_and_unlock       (DBusPendingCall    *pending,
00096                                                                 DBusMessage        *message);
00097 dbus_bool_t       _dbus_connection_send_and_unlock             (DBusConnection     *connection,
00098                                                                 DBusMessage        *message,
00099                                                                 dbus_uint32_t      *client_serial);
00100 
00101 void              _dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
00102                                                                    DBusList *link);
00103 DBUS_PRIVATE_EXPORT
00104 void              _dbus_connection_test_get_locks                 (DBusConnection *conn,
00105                                                                    DBusMutex **mutex_loc,
00106                                                                    DBusMutex **dispatch_mutex_loc,
00107                                                                    DBusMutex **io_path_mutex_loc,
00108                                                                    DBusCondVar **dispatch_cond_loc,
00109                                                                    DBusCondVar **io_path_cond_loc);
00110 DBUS_PRIVATE_EXPORT
00111 int               _dbus_connection_get_pending_fds_count          (DBusConnection *connection);
00112 DBUS_PRIVATE_EXPORT
00113 void              _dbus_connection_set_pending_fds_function       (DBusConnection *connection,
00114                                                                    DBusPendingFdsChangeFunction callback,
00115                                                                    void *data);
00116 
00117 DBUS_PRIVATE_EXPORT
00118 dbus_bool_t       _dbus_connection_get_linux_security_label       (DBusConnection  *connection,
00119                                                                    char           **label_p);
00120 
00121 /* if DBUS_ENABLE_STATS */
00122 DBUS_PRIVATE_EXPORT
00123 void _dbus_connection_get_stats (DBusConnection *connection,
00124                                  dbus_uint32_t  *in_messages,
00125                                  dbus_uint32_t  *in_bytes,
00126                                  dbus_uint32_t  *in_fds,
00127                                  dbus_uint32_t  *in_peak_bytes,
00128                                  dbus_uint32_t  *in_peak_fds,
00129                                  dbus_uint32_t  *out_messages,
00130                                  dbus_uint32_t  *out_bytes,
00131                                  dbus_uint32_t  *out_fds,
00132                                  dbus_uint32_t  *out_peak_bytes,
00133                                  dbus_uint32_t  *out_peak_fds);
00134 
00135 
00136 /* if DBUS_ENABLE_EMBEDDED_TESTS */
00137 const char* _dbus_connection_get_address (DBusConnection *connection);
00138 
00139 /* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
00140  * silly for one function
00141  */
00147 void           _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection);
00148 
00152 DBUS_END_DECLS
00153 
00154 #endif /* DBUS_CONNECTION_INTERNAL_H */