dbus-connection-internal.h
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-connection-internal.h DBusConnection internal interfaces
*
* Copyright (C) 2002 Red Hat Inc.
*
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
*
* Licensed under the Academic Free License version 2.1
*
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_CONNECTION_INTERNAL_H
#define DBUS_CONNECTION_INTERNAL_H
#include <dbus/dbus-internals.h>
#include <dbus/dbus-connection.h>
#include <dbus/dbus-credentials.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-transport.h>
#include <dbus/dbus-resources.h>
#include <dbus/dbus-list.h>
#include <dbus/dbus-timeout.h>
#include <dbus/dbus-dataslot.h>
DBUS_BEGIN_DECLS
typedef enum
{
DBUS_ITERATION_DO_WRITING = 1 << 0,
DBUS_ITERATION_DO_READING = 1 << 1,
DBUS_ITERATION_BLOCK = 1 << 2
} DBusIterationFlags;
#define _DBUS_DEFAULT_TIMEOUT_VALUE (25 * 1000)
typedef void (* DBusPendingFdsChangeFunction) (void *data);
DBUS_PRIVATE_EXPORT
void _dbus_connection_lock (DBusConnection *connection);
DBUS_PRIVATE_EXPORT
void _dbus_connection_unlock (DBusConnection *connection);
DBUS_PRIVATE_EXPORT
DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection);
DBUS_PRIVATE_EXPORT
void _dbus_connection_unref_unlocked (DBusConnection *connection);
DBUS_PRIVATE_EXPORT
dbus_uint32_t _dbus_connection_get_next_client_serial (DBusConnection *connection);
void _dbus_connection_queue_received_message_link (DBusConnection *connection,
DBusList *link);
dbus_bool_t _dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection);
DBusMessage* _dbus_connection_get_message_to_send (DBusConnection *connection);
void _dbus_connection_message_sent_unlocked (DBusConnection *connection,
DBusMessage *message);
dbus_bool_t _dbus_connection_add_watch_unlocked (DBusConnection *connection,
DBusWatch *watch);
void _dbus_connection_remove_watch_unlocked (DBusConnection *connection,
DBusWatch *watch);
void _dbus_connection_toggle_watch_unlocked (DBusConnection *connection,
DBusWatch *watch,
dbus_bool_t enabled);
dbus_bool_t _dbus_connection_handle_watch (DBusWatch *watch,
unsigned int condition,
void *data);
dbus_bool_t _dbus_connection_add_timeout_unlocked (DBusConnection *connection,
DBusTimeout *timeout);
void _dbus_connection_remove_timeout_unlocked (DBusConnection *connection,
DBusTimeout *timeout);
void _dbus_connection_toggle_timeout_unlocked (DBusConnection *connection,
DBusTimeout *timeout,
dbus_bool_t enabled);
DBusConnection* _dbus_connection_new_for_transport (DBusTransport *transport);
void _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
DBusPendingCall *pending,
unsigned int flags,
int timeout_milliseconds);
void _dbus_connection_close_possibly_shared (DBusConnection *connection);
void _dbus_connection_close_if_only_one_ref (DBusConnection *connection);
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);
void _dbus_connection_block_pending_call (DBusPendingCall *pending);
void _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
DBusMessage *message);
dbus_bool_t _dbus_connection_send_and_unlock (DBusConnection *connection,
DBusMessage *message,
dbus_uint32_t *client_serial);
void _dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
DBusList *link);
DBUS_PRIVATE_EXPORT
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);
DBUS_PRIVATE_EXPORT
int _dbus_connection_get_pending_fds_count (DBusConnection *connection);
DBUS_PRIVATE_EXPORT
void _dbus_connection_set_pending_fds_function (DBusConnection *connection,
DBusPendingFdsChangeFunction callback,
void *data);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection,
char **label_p);
DBUS_PRIVATE_EXPORT
DBusCredentials *_dbus_connection_get_credentials (DBusConnection *connection);
/* if DBUS_ENABLE_STATS */
DBUS_PRIVATE_EXPORT
void _dbus_connection_get_stats (DBusConnection *connection,
dbus_uint32_t *in_messages,
dbus_uint32_t *in_bytes,
dbus_uint32_t *in_fds,
dbus_uint32_t *in_peak_bytes,
dbus_uint32_t *in_peak_fds,
dbus_uint32_t *out_messages,
dbus_uint32_t *out_bytes,
dbus_uint32_t *out_fds,
dbus_uint32_t *out_peak_bytes,
dbus_uint32_t *out_peak_fds);
DBUS_EMBEDDED_TESTS_EXPORT
const char* _dbus_connection_get_address (DBusConnection *connection);
/* This _dbus_bus_* stuff doesn't really belong here, but dbus-bus-internal.h seems
* silly for one function
*/
void _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connection);
DBUS_END_DECLS
#endif /* DBUS_CONNECTION_INTERNAL_H */
_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:390
_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:1500
_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:909
_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:1202
_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:2112
_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:1253
_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:576
_dbus_connection_unlock
DBUS_PRIVATE_EXPORT void _dbus_connection_unlock(DBusConnection *connection)
Releases the connection lock.
Definition dbus-connection.c:403
_dbus_connection_lock
DBUS_PRIVATE_EXPORT void _dbus_connection_lock(DBusConnection *connection)
Acquires the connection lock.
Definition dbus-connection.c:392
_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:765
_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:871
_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:785
_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:747
_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:1048
_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:2160
_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:1447
_dbus_connection_get_message_to_send
DBusMessage * _dbus_connection_get_message_to_send(DBusConnection *connection)
Gets the next outgoing message.
Definition dbus-connection.c:613
_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:629
_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:889
_dbus_connection_get_next_client_serial
DBUS_PRIVATE_EXPORT dbus_uint32_t _dbus_connection_get_next_client_serial(DBusConnection *connection)
Allocate and return the next non-zero serial number for outgoing messages.
Definition dbus-connection.c:1474
_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:484
_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:2577
_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:2590
_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:2394
_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:549
_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:1962
_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:1424
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
Definition dbus-macros.h:36
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.
Definition dbus-macros.h:37
DBusMutex
struct DBusMutex DBusMutex
An opaque mutex type provided by the DBusThreadFunctions implementation installed by dbus_threads_ini...
Definition dbus-threads.h:43
DBusTimeoutHandler
dbus_bool_t(* DBusTimeoutHandler)(void *data)
function to run when the timeout is handled
Definition dbus-timeout.h:43
dbus_uint32_t
unsigned int dbus_uint32_t
A 32-bit unsigned integer on all platforms.
Definition dbus-arch-deps.h:45
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition dbus-types.h:37
DBusCondVar
Definition dbus-sysdeps-pthread.c:59
DBusConnection
Implementation details of DBusConnection.
Definition dbus-connection.c:259
DBusCredentials
Definition dbus-credentials.c:60
DBusList
A node in a linked list.
Definition dbus-list.h:37
DBusMessage
Internals of DBusMessage.
Definition dbus-message-private.h:102
DBusPendingCall
Implementation details of DBusPendingCall - all fields are private.
Definition dbus-pending-call.c:65
DBusTimeout
Internals of DBusTimeout.
Definition dbus-timeout.c:43
DBusTransport
Object representing a transport such as a socket.
Definition dbus-transport-protected.h:83
DBusWatch
Implementation of DBusWatch.
Definition dbus-watch.c:43