1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * SPDX-License-Identifier: LGPL-2.1-or-later
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 * Author: David Zeuthen <davidz@redhat.com>
23 #ifndef __G_DBUS_PRIVATE_H__
24 #define __G_DBUS_PRIVATE_H__
26 #include <gio/giotypes.h>
30 /* ---------------------------------------------------------------------------------------------------- */
32 typedef struct GDBusWorker GDBusWorker;
34 typedef void (*GDBusWorkerMessageReceivedCallback) (GDBusWorker *worker,
35 GDBusMessage *message,
38 typedef GDBusMessage *(*GDBusWorkerMessageAboutToBeSentCallback) (GDBusWorker *worker,
39 GDBusMessage *message,
42 typedef void (*GDBusWorkerDisconnectedCallback) (GDBusWorker *worker,
43 gboolean remote_peer_vanished,
47 /* This function may be called from any thread - callbacks will be in the shared private message thread
50 GDBusWorker *_g_dbus_worker_new (GIOStream *stream,
51 GDBusCapabilityFlags capabilities,
52 gboolean initially_frozen,
53 GDBusWorkerMessageReceivedCallback message_received_callback,
54 GDBusWorkerMessageAboutToBeSentCallback message_about_to_be_sent_callback,
55 GDBusWorkerDisconnectedCallback disconnected_callback,
58 /* can be called from any thread - steals blob */
59 void _g_dbus_worker_send_message (GDBusWorker *worker,
60 GDBusMessage *message,
64 /* can be called from any thread */
65 void _g_dbus_worker_stop (GDBusWorker *worker);
67 /* can be called from any thread */
68 void _g_dbus_worker_unfreeze (GDBusWorker *worker);
70 /* can be called from any thread (except the worker thread) */
71 gboolean _g_dbus_worker_flush_sync (GDBusWorker *worker,
72 GCancellable *cancellable,
75 /* can be called from any thread */
76 void _g_dbus_worker_close (GDBusWorker *worker,
79 /* ---------------------------------------------------------------------------------------------------- */
81 void _g_dbus_initialize (void);
82 gboolean _g_dbus_debug_authentication (void);
83 gboolean _g_dbus_debug_transport (void);
84 gboolean _g_dbus_debug_message (void);
85 gboolean _g_dbus_debug_payload (void);
86 gboolean _g_dbus_debug_call (void);
87 gboolean _g_dbus_debug_signal (void);
88 gboolean _g_dbus_debug_incoming (void);
89 gboolean _g_dbus_debug_return (void);
90 gboolean _g_dbus_debug_emission (void);
91 gboolean _g_dbus_debug_address (void);
92 gboolean _g_dbus_debug_proxy (void);
94 void _g_dbus_debug_print_lock (void);
95 void _g_dbus_debug_print_unlock (void);
97 gboolean _g_dbus_address_parse_entry (const gchar *address_entry,
98 gchar **out_transport_name,
99 GHashTable **out_key_value_pairs,
102 GVariantType * _g_dbus_compute_complete_signature (GDBusArgInfo **args);
104 gchar *_g_dbus_hexdump (const gchar *data, gsize len, guint indent);
106 /* ---------------------------------------------------------------------------------------------------- */
109 gchar *_g_dbus_win32_get_user_sid (void);
111 #define _GDBUS_ARG_WIN32_RUN_SESSION_BUS "_win32_run_session_bus"
112 /* The g_win32_run_session_bus is exported from libgio dll on win32,
113 * but still is NOT part of API/ABI since it is declared in private header
114 * and used only by tool built from same sources.
115 * Initially this function was introduces for usage with rundll,
116 * so the signature is kept rundll-compatible, though parameters aren't used.
118 _GIO_EXTERN void __stdcall
119 g_win32_run_session_bus (void* hwnd, void* hinst, const char* cmdline, int cmdshow);
120 gchar *_g_dbus_win32_get_session_address_dbus_launch (GError **error);
123 gchar *_g_dbus_get_machine_id (GError **error);
125 gchar *_g_dbus_enum_to_string (GType enum_type, gint value);
127 /* ---------------------------------------------------------------------------------------------------- */
129 GDBusMethodInvocation *_g_dbus_method_invocation_new (const gchar *sender,
130 const gchar *object_path,
131 const gchar *interface_name,
132 const gchar *method_name,
133 const GDBusMethodInfo *method_info,
134 const GDBusPropertyInfo *property_info,
135 GDBusConnection *connection,
136 GDBusMessage *message,
137 GVariant *parameters,
140 /* ---------------------------------------------------------------------------------------------------- */
142 gboolean _g_signal_accumulator_false_handled (GSignalInvocationHint *ihint,
144 const GValue *handler_return,
147 gboolean _g_dbus_object_skeleton_has_authorize_method_handlers (GDBusObjectSkeleton *object);
149 void _g_dbus_object_proxy_add_interface (GDBusObjectProxy *proxy,
150 GDBusProxy *interface_proxy);
151 void _g_dbus_object_proxy_remove_interface (GDBusObjectProxy *proxy,
152 const gchar *interface_name);
154 gchar *_g_dbus_hexencode (const gchar *str,
157 /* Implemented in gdbusconnection.c */
158 GDBusConnection *_g_bus_get_singleton_if_exists (GBusType bus_type);
159 void _g_bus_forget_singleton (GBusType bus_type);
163 #endif /* __G_DBUS_PRIVATE_H__ */