dbus-connection-internal.h 8.67 KB
Newer Older
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 3 4 5
/* dbus-connection-internal.h DBusConnection internal interfaces
 *
 * Copyright (C) 2002  Red Hat Inc.
 *
6
 * Licensed under the Academic Free License version 2.1
7 8 9 10 11 12 13 14 15 16 17 18 19
 * 
 * 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
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 22 23 24 25 26 27
 *
 */
#ifndef DBUS_CONNECTION_INTERNAL_H
#define DBUS_CONNECTION_INTERNAL_H

#include <dbus/dbus-internals.h>
#include <dbus/dbus-connection.h>
28
#include <dbus/dbus-credentials.h>
29 30
#include <dbus/dbus-message.h>
#include <dbus/dbus-transport.h>
31
#include <dbus/dbus-resources.h>
32
#include <dbus/dbus-list.h>
33
#include <dbus/dbus-timeout.h>
34
#include <dbus/dbus-dataslot.h>
35

36
DBUS_BEGIN_DECLS
37 38 39 40 41 42 43

typedef enum
{
  DBUS_ITERATION_DO_WRITING = 1 << 0, /**< Write messages out. */
  DBUS_ITERATION_DO_READING = 1 << 1, /**< Read messages in. */
  DBUS_ITERATION_BLOCK      = 1 << 2  /**< Block if nothing to do. */
} DBusIterationFlags;
44

45 46
/** default timeout value when waiting for a message reply, 25 seconds */
#define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
47

48 49
typedef void (* DBusPendingFdsChangeFunction) (void *data);

50
DBUS_PRIVATE_EXPORT
51
void              _dbus_connection_lock                        (DBusConnection     *connection);
52
DBUS_PRIVATE_EXPORT
53
void              _dbus_connection_unlock                      (DBusConnection     *connection);
54
DBUS_PRIVATE_EXPORT
55
DBusConnection *  _dbus_connection_ref_unlocked                (DBusConnection     *connection);
56
DBUS_PRIVATE_EXPORT
57
void              _dbus_connection_unref_unlocked              (DBusConnection     *connection);
58 59
void              _dbus_connection_queue_received_message_link (DBusConnection     *connection,
                                                                DBusList           *link);
60
dbus_bool_t       _dbus_connection_has_messages_to_send_unlocked (DBusConnection     *connection);
61
DBusMessage*      _dbus_connection_get_message_to_send         (DBusConnection     *connection);
62
void              _dbus_connection_message_sent_unlocked       (DBusConnection     *connection,
63
                                                                DBusMessage        *message);
64
dbus_bool_t       _dbus_connection_add_watch_unlocked          (DBusConnection     *connection,
65
                                                                DBusWatch          *watch);
66
void              _dbus_connection_remove_watch_unlocked       (DBusConnection     *connection,
67
                                                                DBusWatch          *watch);
68
void              _dbus_connection_toggle_watch_unlocked       (DBusConnection     *connection,
69 70
                                                                DBusWatch          *watch,
                                                                dbus_bool_t         enabled);
71 72 73
dbus_bool_t       _dbus_connection_handle_watch                (DBusWatch          *watch,
                                                                unsigned int        condition,
                                                                void               *data);
74
dbus_bool_t       _dbus_connection_add_timeout_unlocked        (DBusConnection     *connection,
75
                                                                DBusTimeout        *timeout);
76
void              _dbus_connection_remove_timeout_unlocked     (DBusConnection     *connection,
77
                                                                DBusTimeout        *timeout);
78
void              _dbus_connection_toggle_timeout_unlocked     (DBusConnection     *connection,
79 80 81
                                                                DBusTimeout        *timeout,
                                                                dbus_bool_t         enabled);
DBusConnection*   _dbus_connection_new_for_transport           (DBusTransport      *transport);
82
void              _dbus_connection_do_iteration_unlocked       (DBusConnection     *connection,
83
                                                                DBusPendingCall    *pending,
84 85
                                                                unsigned int        flags,
                                                                int                 timeout_milliseconds);
86 87
void              _dbus_connection_close_possibly_shared       (DBusConnection     *connection);
void              _dbus_connection_close_if_only_one_ref       (DBusConnection     *connection);
88

89 90 91 92 93 94
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);
95
void              _dbus_connection_block_pending_call          (DBusPendingCall    *pending);
96 97
void              _dbus_pending_call_complete_and_unlock       (DBusPendingCall    *pending,
                                                                DBusMessage        *message);
98
dbus_bool_t       _dbus_connection_send_and_unlock             (DBusConnection     *connection,
99 100
                                                                DBusMessage        *message,
                                                                dbus_uint32_t      *client_serial);
101

102 103
void              _dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
						                   DBusList *link);
104
DBUS_PRIVATE_EXPORT
105 106 107 108 109 110
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);
111
DBUS_PRIVATE_EXPORT
112
int               _dbus_connection_get_pending_fds_count          (DBusConnection *connection);
113
DBUS_PRIVATE_EXPORT
114 115 116
void              _dbus_connection_set_pending_fds_function       (DBusConnection *connection,
                                                                   DBusPendingFdsChangeFunction callback,
                                                                   void *data);
117

118
DBUS_PRIVATE_EXPORT
119 120
dbus_bool_t       _dbus_connection_get_linux_security_label       (DBusConnection  *connection,
                                                                   char           **label_p);
121 122
DBUS_PRIVATE_EXPORT
DBusCredentials  *_dbus_connection_get_credentials                (DBusConnection  *connection);
123

124
/* if DBUS_ENABLE_STATS */
125
DBUS_PRIVATE_EXPORT
126 127 128 129
void _dbus_connection_get_stats (DBusConnection *connection,
                                 dbus_uint32_t  *in_messages,
                                 dbus_uint32_t  *in_bytes,
                                 dbus_uint32_t  *in_fds,
130 131
                                 dbus_uint32_t  *in_peak_bytes,
                                 dbus_uint32_t  *in_peak_fds,
132 133
                                 dbus_uint32_t  *out_messages,
                                 dbus_uint32_t  *out_bytes,
134 135
                                 dbus_uint32_t  *out_fds,
                                 dbus_uint32_t  *out_peak_bytes,
136
                                 dbus_uint32_t  *out_peak_fds);
137

138

139
/* if DBUS_ENABLE_EMBEDDED_TESTS */
140 141
const char* _dbus_connection_get_address (DBusConnection *connection);

142 143 144 145 146 147 148 149 150 151 152 153 154
/* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
 * silly for one function
 */
/**
 * @addtogroup DBusBusInternals
 * @{
 */

void           _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection);

/** @} */


155
DBUS_END_DECLS
156 157

#endif /* DBUS_CONNECTION_INTERNAL_H */