(root)/
glib-2.79.0/
gio/
gdbusprivate.h
       1  /* GDBus - GLib D-Bus Library
       2   *
       3   * Copyright (C) 2008-2010 Red Hat, Inc.
       4   *
       5   * SPDX-License-Identifier: LGPL-2.1-or-later
       6   *
       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.
      11   *
      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.
      16   *
      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/>.
      19   *
      20   * Author: David Zeuthen <davidz@redhat.com>
      21   */
      22  
      23  #ifndef __G_DBUS_PRIVATE_H__
      24  #define __G_DBUS_PRIVATE_H__
      25  
      26  #include <gio/giotypes.h>
      27  
      28  G_BEGIN_DECLS
      29  
      30  /* ---------------------------------------------------------------------------------------------------- */
      31  
      32  typedef struct GDBusWorker GDBusWorker;
      33  
      34  typedef void (*GDBusWorkerMessageReceivedCallback) (GDBusWorker   *worker,
      35                                                      GDBusMessage  *message,
      36                                                      gpointer       user_data);
      37  
      38  typedef GDBusMessage *(*GDBusWorkerMessageAboutToBeSentCallback) (GDBusWorker   *worker,
      39                                                                    GDBusMessage  *message,
      40                                                                    gpointer       user_data);
      41  
      42  typedef void (*GDBusWorkerDisconnectedCallback)    (GDBusWorker   *worker,
      43                                                      gboolean       remote_peer_vanished,
      44                                                      GError        *error,
      45                                                      gpointer       user_data);
      46  
      47  /* This function may be called from any thread - callbacks will be in the shared private message thread
      48   * and must not block.
      49   */
      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,
      56                                            gpointer                            user_data);
      57  
      58  /* can be called from any thread - steals blob */
      59  void         _g_dbus_worker_send_message (GDBusWorker    *worker,
      60                                            GDBusMessage   *message,
      61                                            gchar          *blob,
      62                                            gsize           blob_len);
      63  
      64  /* can be called from any thread */
      65  void         _g_dbus_worker_stop         (GDBusWorker    *worker);
      66  
      67  /* can be called from any thread */
      68  void         _g_dbus_worker_unfreeze     (GDBusWorker    *worker);
      69  
      70  /* can be called from any thread (except the worker thread) */
      71  gboolean     _g_dbus_worker_flush_sync   (GDBusWorker    *worker,
      72                                            GCancellable   *cancellable,
      73                                            GError        **error);
      74  
      75  /* can be called from any thread */
      76  void         _g_dbus_worker_close        (GDBusWorker         *worker,
      77                                            GTask               *task);
      78  
      79  /* ---------------------------------------------------------------------------------------------------- */
      80  
      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);
      93  
      94  void     _g_dbus_debug_print_lock (void);
      95  void     _g_dbus_debug_print_unlock (void);
      96  
      97  gboolean _g_dbus_address_parse_entry (const gchar  *address_entry,
      98                                        gchar       **out_transport_name,
      99                                        GHashTable  **out_key_value_pairs,
     100                                        GError      **error);
     101  
     102  GVariantType * _g_dbus_compute_complete_signature (GDBusArgInfo **args);
     103  
     104  gchar *_g_dbus_hexdump (const gchar *data, gsize len, guint indent);
     105  
     106  /* ---------------------------------------------------------------------------------------------------- */
     107  
     108  #ifdef G_OS_WIN32
     109  gchar *_g_dbus_win32_get_user_sid (void);
     110  
     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.
     117   */
     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);
     121  #endif
     122  
     123  gchar *_g_dbus_get_machine_id (GError **error);
     124  
     125  gchar *_g_dbus_enum_to_string (GType enum_type, gint value);
     126  
     127  /* ---------------------------------------------------------------------------------------------------- */
     128  
     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,
     138                                                        gpointer                 user_data);
     139  
     140  /* ---------------------------------------------------------------------------------------------------- */
     141  
     142  gboolean _g_signal_accumulator_false_handled (GSignalInvocationHint *ihint,
     143                                                GValue                *return_accu,
     144                                                const GValue          *handler_return,
     145                                                gpointer               dummy);
     146  
     147  gboolean _g_dbus_object_skeleton_has_authorize_method_handlers (GDBusObjectSkeleton *object);
     148  
     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);
     153  
     154  gchar *_g_dbus_hexencode (const gchar *str,
     155                            gsize        str_len);
     156  
     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);
     160  
     161  G_END_DECLS
     162  
     163  #endif /* __G_DBUS_PRIVATE_H__ */