D-Bus: dbus-connection-internal.h Source File

D-Bus 1.12.16

dbus-connection-internal.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-connection-internal.h DBusConnection internal interfaces
3 *
4 * Copyright (C) 2002 Red Hat Inc.
5 *
6 * Licensed under the Academic Free License version 2.1
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
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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>
30 #include <dbus/dbus-resources.h>
31 #include <dbus/dbus-list.h>
32 #include <dbus/dbus-timeout.h>
33 #include <dbus/dbus-dataslot.h>
34
35 DBUS_BEGIN_DECLS
36
37 typedef enum
38 {
39 DBUS_ITERATION_DO_WRITING = 1 << 0,
40 DBUS_ITERATION_DO_READING = 1 << 1,
41 DBUS_ITERATION_BLOCK = 1 << 2
42 } DBusIterationFlags;
43
45 #define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
46
47 typedef void (* DBusPendingFdsChangeFunction) (void *data);
48
49 DBUS_PRIVATE_EXPORT
50 void _dbus_connection_lock (DBusConnection *connection);
51 DBUS_PRIVATE_EXPORT
52 void _dbus_connection_unlock (DBusConnection *connection);
53 DBUS_PRIVATE_EXPORT
54 DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection);
55 DBUS_PRIVATE_EXPORT
56 void _dbus_connection_unref_unlocked (DBusConnection *connection);
57 void _dbus_connection_queue_received_message_link (DBusConnection *connection,
58 DBusList *link);
59 dbus_bool_t _dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection);
60 DBusMessage* _dbus_connection_get_message_to_send (DBusConnection *connection);
61 void _dbus_connection_message_sent_unlocked (DBusConnection *connection,
62 DBusMessage *message);
63 dbus_bool_t _dbus_connection_add_watch_unlocked (DBusConnection *connection,
64 DBusWatch *watch);
65 void _dbus_connection_remove_watch_unlocked (DBusConnection *connection,
66 DBusWatch *watch);
67 void _dbus_connection_toggle_watch_unlocked (DBusConnection *connection,
68 DBusWatch *watch,
69 dbus_bool_t enabled);
70 dbus_bool_t _dbus_connection_handle_watch (DBusWatch *watch,
71 unsigned int condition,
72 void *data);
73 dbus_bool_t _dbus_connection_add_timeout_unlocked (DBusConnection *connection,
74 DBusTimeout *timeout);
75 void _dbus_connection_remove_timeout_unlocked (DBusConnection *connection,
76 DBusTimeout *timeout);
77 void _dbus_connection_toggle_timeout_unlocked (DBusConnection *connection,
78 DBusTimeout *timeout,
79 dbus_bool_t enabled);
80 DBusConnection* _dbus_connection_new_for_transport (DBusTransport *transport);
81 void _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
82 DBusPendingCall *pending,
83 unsigned int flags,
84 int timeout_milliseconds);
85 void _dbus_connection_close_possibly_shared (DBusConnection *connection);
86 void _dbus_connection_close_if_only_one_ref (DBusConnection *connection);
87
88 DBusPendingCall* _dbus_pending_call_new (DBusConnection *connection,
89 int timeout_milliseconds,
90 DBusTimeoutHandler timeout_handler);
91 void _dbus_pending_call_notify (DBusPendingCall *pending);
92 void _dbus_connection_remove_pending_call (DBusConnection *connection,
93 DBusPendingCall *pending);
94 void _dbus_connection_block_pending_call (DBusPendingCall *pending);
95 void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
96 DBusMessage *message);
97 dbus_bool_t _dbus_connection_send_and_unlock (DBusConnection *connection,
98 DBusMessage *message,
99 dbus_uint32_t *client_serial);
100
101 void _dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
102 DBusList *link);
103 DBUS_PRIVATE_EXPORT
104 void _dbus_connection_test_get_locks (DBusConnection *conn,
105 DBusMutex **mutex_loc,
106 DBusMutex **dispatch_mutex_loc,
107 DBusMutex **io_path_mutex_loc,
108 DBusCondVar **dispatch_cond_loc,
109 DBusCondVar **io_path_cond_loc);
110 DBUS_PRIVATE_EXPORT
111 int _dbus_connection_get_pending_fds_count (DBusConnection *connection);
112 DBUS_PRIVATE_EXPORT
113 void _dbus_connection_set_pending_fds_function (DBusConnection *connection,
114 DBusPendingFdsChangeFunction callback,
115 void *data);
116
117 DBUS_PRIVATE_EXPORT
118 dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection,
119 char **label_p);
120
121 /* if DBUS_ENABLE_STATS */
122 DBUS_PRIVATE_EXPORT
123 void _dbus_connection_get_stats (DBusConnection *connection,
124 dbus_uint32_t *in_messages,
125 dbus_uint32_t *in_bytes,
126 dbus_uint32_t *in_fds,
127 dbus_uint32_t *in_peak_bytes,
128 dbus_uint32_t *in_peak_fds,
129 dbus_uint32_t *out_messages,
130 dbus_uint32_t *out_bytes,
131 dbus_uint32_t *out_fds,
132 dbus_uint32_t *out_peak_bytes,
133 dbus_uint32_t *out_peak_fds);
134
135
136 /* if DBUS_ENABLE_EMBEDDED_TESTS */
137 const char* _dbus_connection_get_address (DBusConnection *connection);
138
139 /* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
140 * silly for one function
141 */
147 void _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection);
148
152 DBUS_END_DECLS
153
154 #endif /* DBUS_CONNECTION_INTERNAL_H */
dbus_uint32_t
unsigned int dbus_uint32_t
A 32-bit unsigned integer on all platforms.
Definition: dbus-arch-deps.h:43
DBusTimeout
Internals of DBusTimeout.
Definition: dbus-timeout.c:40
_dbus_connection_toggle_watch_unlocked
void _dbus_connection_toggle_watch_unlocked(DBusConnection *connection, DBusWatch *watch, dbus_bool_t enabled)
Toggles a watch and notifies app via connection's DBusWatchToggledFunction if available.
Definition: dbus-connection.c:781
DBusWatch
Implementation of DBusWatch.
Definition: dbus-watch.c:40
_dbus_connection_add_timeout_unlocked
dbus_bool_t _dbus_connection_add_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout)
Adds a timeout using the connection's DBusAddTimeoutFunction if available.
Definition: dbus-connection.c:867
_dbus_connection_queue_synthesized_message_link
void _dbus_connection_queue_synthesized_message_link(DBusConnection *connection, DBusList *link)
Adds a link + message to the incoming message queue.
Definition: dbus-connection.c:545
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
_dbus_connection_lock
DBUS_PRIVATE_EXPORT void _dbus_connection_lock(DBusConnection *connection)
Acquires the connection lock.
Definition: dbus-connection.c:388
_dbus_connection_close_if_only_one_ref
void _dbus_connection_close_if_only_one_ref(DBusConnection *connection)
Used internally to handle the semantics of dbus_server_set_new_connection_function().
Definition: dbus-connection.c:2146
DBusPendingCall
Implementation details of DBusPendingCall - all fields are private.
Definition: dbus-pending-call.c:62
DBusConnection
Implementation details of DBusConnection.
Definition: dbus-connection.c:256
DBusMutex
struct DBusMutex DBusMutex
An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...
Definition: dbus-threads.h:41
_dbus_connection_get_message_to_send
DBusMessage * _dbus_connection_get_message_to_send(DBusConnection *connection)
Gets the next outgoing message.
Definition: dbus-connection.c:609
_dbus_connection_block_pending_call
void _dbus_connection_block_pending_call(DBusPendingCall *pending)
Blocks until a pending call times out or gets a reply.
Definition: dbus-connection.c:2380
_dbus_connection_get_pending_fds_count
DBUS_PRIVATE_EXPORT int _dbus_connection_get_pending_fds_count(DBusConnection *connection)
Return how many file descriptors are pending in the loader.
Definition: dbus-connection.c:2561
DBusMessage
Internals of DBusMessage.
Definition: dbus-message-private.h:99
_dbus_connection_remove_watch_unlocked
void _dbus_connection_remove_watch_unlocked(DBusConnection *connection, DBusWatch *watch)
Removes a watch using the connection's DBusRemoveWatchFunction if available.
Definition: dbus-connection.c:761
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:35
_dbus_connection_has_messages_to_send_unlocked
dbus_bool_t _dbus_connection_has_messages_to_send_unlocked(DBusConnection *connection)
Checks whether there are messages in the outgoing message queue.
Definition: dbus-connection.c:572
_dbus_connection_unref_unlocked
DBUS_PRIVATE_EXPORT void _dbus_connection_unref_unlocked(DBusConnection *connection)
Decrements the reference count of a DBusConnection.
Definition: dbus-connection.c:1442
_dbus_connection_handle_watch
dbus_bool_t _dbus_connection_handle_watch(DBusWatch *watch, unsigned int condition, void *data)
A callback for use with dbus_watch_new() to create a DBusWatch.
Definition: dbus-connection.c:1486
_dbus_bus_notify_shared_connection_disconnected_unlocked
void _dbus_bus_notify_shared_connection_disconnected_unlocked(DBusConnection *connection)
Internal function that checks to see if this is a shared connection owned by the bus and if it is unr...
Definition: dbus-bus.c:387
_dbus_connection_add_watch_unlocked
dbus_bool_t _dbus_connection_add_watch_unlocked(DBusConnection *connection, DBusWatch *watch)
Adds a watch using the connection's DBusAddWatchFunction if available.
Definition: dbus-connection.c:743
_dbus_connection_send_and_unlock
dbus_bool_t _dbus_connection_send_and_unlock(DBusConnection *connection, DBusMessage *message, dbus_uint32_t *client_serial)
Like dbus_connection_send(), but assumes the connection is already locked on function entry,...
Definition: dbus-connection.c:2098
_dbus_connection_message_sent_unlocked
void _dbus_connection_message_sent_unlocked(DBusConnection *connection, DBusMessage *message)
Notifies the connection that a message has been sent, so the message can be removed from the outgoing...
Definition: dbus-connection.c:625
_dbus_connection_new_for_transport
DBusConnection * _dbus_connection_new_for_transport(DBusTransport *transport)
Creates a new connection for the given transport.
Definition: dbus-connection.c:1249
_dbus_connection_set_pending_fds_function
DBUS_PRIVATE_EXPORT void _dbus_connection_set_pending_fds_function(DBusConnection *connection, DBusPendingFdsChangeFunction callback, void *data)
Register a function to be called whenever the number of pending file descriptors in the loader change...
Definition: dbus-connection.c:2574
DBusTransport
Object representing a transport such as a socket.
Definition: dbus-transport-protected.h:80
DBusList
A node in a linked list.
Definition: dbus-list.h:34
_dbus_connection_remove_timeout_unlocked
void _dbus_connection_remove_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout)
Removes a timeout using the connection's DBusRemoveTimeoutFunction if available.
Definition: dbus-connection.c:885
DBusCondVar
Definition: dbus-sysdeps-pthread.c:57
_dbus_connection_queue_received_message_link
void _dbus_connection_queue_received_message_link(DBusConnection *connection, DBusList *link)
Adds a message-containing list link to the incoming message queue, taking ownership of the link and t...
Definition: dbus-connection.c:480
_dbus_connection_close_possibly_shared
void _dbus_connection_close_possibly_shared(DBusConnection *connection)
Closes a shared OR private connection, while dbus_connection_close() can only be used on private conn...
Definition: dbus-connection.c:1948
_dbus_connection_remove_pending_call
void _dbus_connection_remove_pending_call(DBusConnection *connection, DBusPendingCall *pending)
Removes a pending call from the connection, such that the pending reply will be ignored.
Definition: dbus-connection.c:1044
_dbus_connection_ref_unlocked
DBUS_PRIVATE_EXPORT DBusConnection * _dbus_connection_ref_unlocked(DBusConnection *connection)
Increments the reference count of a DBusConnection.
Definition: dbus-connection.c:1419
_dbus_connection_do_iteration_unlocked
void _dbus_connection_do_iteration_unlocked(DBusConnection *connection, DBusPendingCall *pending, unsigned int flags, int timeout_milliseconds)
Queues incoming messages and sends outgoing messages for this connection, optionally blocking in the ...
Definition: dbus-connection.c:1198
_dbus_connection_unlock
DBUS_PRIVATE_EXPORT void _dbus_connection_unlock(DBusConnection *connection)
Releases the connection lock.
Definition: dbus-connection.c:399
_dbus_connection_toggle_timeout_unlocked
void _dbus_connection_toggle_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout, dbus_bool_t enabled)
Toggles a timeout and notifies app via connection's DBusTimeoutToggledFunction if available.
Definition: dbus-connection.c:905
DBusTimeoutHandler
dbus_bool_t(* DBusTimeoutHandler)(void *data)
function to run when the timeout is handled
Definition: dbus-timeout.h:41
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.