D-Bus  1.13.7
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-credentials.h>
29 #include <dbus/dbus-message.h>
30 #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 
37 
38 typedef enum
39 {
40  DBUS_ITERATION_DO_WRITING = 1 << 0,
41  DBUS_ITERATION_DO_READING = 1 << 1,
42  DBUS_ITERATION_BLOCK = 1 << 2
43 } DBusIterationFlags;
44 
46 #define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
47 
48 typedef void (* DBusPendingFdsChangeFunction) (void *data);
49 
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
56 DBUS_PRIVATE_EXPORT
59  DBusList *link);
63  DBusMessage *message);
65  DBusWatch *watch);
67  DBusWatch *watch);
69  DBusWatch *watch,
70  dbus_bool_t enabled);
72  unsigned int condition,
73  void *data);
75  DBusTimeout *timeout);
77  DBusTimeout *timeout);
79  DBusTimeout *timeout,
80  dbus_bool_t enabled);
83  DBusPendingCall *pending,
84  unsigned int flags,
85  int timeout_milliseconds);
88 
89 DBusPendingCall* _dbus_pending_call_new (DBusConnection *connection,
90  int timeout_milliseconds,
91  DBusTimeoutHandler timeout_handler);
92 void _dbus_pending_call_notify (DBusPendingCall *pending);
94  DBusPendingCall *pending);
96 void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
97  DBusMessage *message);
99  DBusMessage *message,
100  dbus_uint32_t *client_serial);
101 
103  DBusList *link);
104 DBUS_PRIVATE_EXPORT
105 void _dbus_connection_test_get_locks (DBusConnection *conn,
106  DBusMutex **mutex_loc,
107  DBusMutex **dispatch_mutex_loc,
108  DBusMutex **io_path_mutex_loc,
109  DBusCondVar **dispatch_cond_loc,
110  DBusCondVar **io_path_cond_loc);
111 DBUS_PRIVATE_EXPORT
113 DBUS_PRIVATE_EXPORT
115  DBusPendingFdsChangeFunction callback,
116  void *data);
117 
118 DBUS_PRIVATE_EXPORT
119 dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection,
120  char **label_p);
121 DBUS_PRIVATE_EXPORT
122 DBusCredentials *_dbus_connection_get_credentials (DBusConnection *connection);
123 
124 /* if DBUS_ENABLE_STATS */
125 DBUS_PRIVATE_EXPORT
126 void _dbus_connection_get_stats (DBusConnection *connection,
127  dbus_uint32_t *in_messages,
128  dbus_uint32_t *in_bytes,
129  dbus_uint32_t *in_fds,
130  dbus_uint32_t *in_peak_bytes,
131  dbus_uint32_t *in_peak_fds,
132  dbus_uint32_t *out_messages,
133  dbus_uint32_t *out_bytes,
134  dbus_uint32_t *out_fds,
135  dbus_uint32_t *out_peak_bytes,
136  dbus_uint32_t *out_peak_fds);
137 
138 
139 /* if DBUS_ENABLE_EMBEDDED_TESTS */
140 const char* _dbus_connection_get_address (DBusConnection *connection);
141 
142 /* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
143  * silly for one function
144  */
151 
156 
157 #endif /* DBUS_CONNECTION_INTERNAL_H */
Internals of DBusTimeout.
Definition: dbus-timeout.c:40
void _dbus_connection_toggle_watch_unlocked(DBusConnection *connection, DBusWatch *watch, dbus_bool_t enabled)
Toggles a watch and notifies app via connection&#39;s DBusWatchToggledFunction if available.
Implementation of DBusWatch.
Definition: dbus-watch.c:40
dbus_bool_t _dbus_connection_add_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout)
Adds a timeout using the connection&#39;s DBusAddTimeoutFunction if available.
void _dbus_connection_queue_synthesized_message_link(DBusConnection *connection, DBusList *link)
Adds a link + message to the incoming message queue.
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
DBUS_PRIVATE_EXPORT void _dbus_connection_lock(DBusConnection *connection)
Acquires the connection lock.
void _dbus_connection_close_if_only_one_ref(DBusConnection *connection)
Used internally to handle the semantics of dbus_server_set_new_connection_function().
Implementation details of DBusPendingCall - all fields are private.
Implementation details of DBusConnection.
struct DBusMutex DBusMutex
An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...
Definition: dbus-threads.h:41
DBusMessage * _dbus_connection_get_message_to_send(DBusConnection *connection)
Gets the next outgoing message.
void _dbus_connection_block_pending_call(DBusPendingCall *pending)
Blocks until a pending call times out or gets a reply.
DBUS_PRIVATE_EXPORT int _dbus_connection_get_pending_fds_count(DBusConnection *connection)
Return how many file descriptors are pending in the loader.
Internals of DBusMessage.
void _dbus_connection_remove_watch_unlocked(DBusConnection *connection, DBusWatch *watch)
Removes a watch using the connection&#39;s DBusRemoveWatchFunction if available.
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:35
dbus_bool_t _dbus_connection_has_messages_to_send_unlocked(DBusConnection *connection)
Checks whether there are messages in the outgoing message queue.
DBUS_PRIVATE_EXPORT void _dbus_connection_unref_unlocked(DBusConnection *connection)
Decrements the reference count of a DBusConnection.
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.
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_bool_t _dbus_connection_add_watch_unlocked(DBusConnection *connection, DBusWatch *watch)
Adds a watch using the connection&#39;s DBusAddWatchFunction if available.
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...
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...
DBusConnection * _dbus_connection_new_for_transport(DBusTransport *transport)
Creates a new connection for the given transport.
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...
Object representing a transport such as a socket.
A node in a linked list.
Definition: dbus-list.h:34
void _dbus_connection_remove_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout)
Removes a timeout using the connection&#39;s DBusRemoveTimeoutFunction if available.
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...
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...
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.
DBUS_PRIVATE_EXPORT DBusConnection * _dbus_connection_ref_unlocked(DBusConnection *connection)
Increments the reference count of a DBusConnection.
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 ...
DBUS_PRIVATE_EXPORT void _dbus_connection_unlock(DBusConnection *connection)
Releases the connection lock.
void _dbus_connection_toggle_timeout_unlocked(DBusConnection *connection, DBusTimeout *timeout, dbus_bool_t enabled)
Toggles a timeout and notifies app via connection&#39;s DBusTimeoutToggledFunction if available...
dbus_bool_t(* DBusTimeoutHandler)(void *data)
function to run when the timeout is handled
Definition: dbus-timeout.h:41
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.