Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:12:31

0001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
0002 /* dbus-server.h DBusServer object
0003  *
0004  * Copyright (C) 2002, 2003  Red Hat Inc.
0005  *
0006  * SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
0007  *
0008  * Licensed under the Academic Free License version 2.1
0009  *
0010  * This program is free software; you can redistribute it and/or modify
0011  * it under the terms of the GNU General Public License as published by
0012  * the Free Software Foundation; either version 2 of the License, or
0013  * (at your option) any later version.
0014  *
0015  * This program is distributed in the hope that it will be useful,
0016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  * GNU General Public License for more details.
0019  *
0020  * You should have received a copy of the GNU General Public License
0021  * along with this program; if not, write to the Free Software
0022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0023  *
0024  */
0025 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
0026 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
0027 #endif
0028 
0029 #ifndef DBUS_SERVER_H
0030 #define DBUS_SERVER_H
0031 
0032 #include <dbus/dbus-errors.h>
0033 #include <dbus/dbus-macros.h>
0034 #include <dbus/dbus-message.h>
0035 #include <dbus/dbus-connection.h>
0036 #include <dbus/dbus-protocol.h>
0037 
0038 DBUS_BEGIN_DECLS
0039 
0040 /**
0041  * @addtogroup DBusServer
0042  * @{
0043  */
0044 
0045 typedef struct DBusServer DBusServer;
0046 
0047 /** Called when a new connection to the server is available. Must reference and save the new
0048  * connection, or close the new connection. Set with dbus_server_set_new_connection_function().
0049  */
0050 typedef void (* DBusNewConnectionFunction) (DBusServer     *server,
0051                                             DBusConnection *new_connection,
0052                                             void           *data);
0053 
0054 DBUS_EXPORT
0055 DBusServer* dbus_server_listen           (const char     *address,
0056                                           DBusError      *error);
0057 DBUS_EXPORT
0058 DBusServer* dbus_server_ref              (DBusServer     *server);
0059 DBUS_EXPORT
0060 void        dbus_server_unref            (DBusServer     *server);
0061 DBUS_EXPORT
0062 void        dbus_server_disconnect       (DBusServer     *server);
0063 DBUS_EXPORT
0064 dbus_bool_t dbus_server_get_is_connected (DBusServer     *server);
0065 DBUS_EXPORT
0066 char*       dbus_server_get_address      (DBusServer     *server);
0067 DBUS_EXPORT
0068 char*       dbus_server_get_id           (DBusServer     *server);
0069 DBUS_EXPORT
0070 void        dbus_server_set_new_connection_function (DBusServer                *server,
0071                                                      DBusNewConnectionFunction  function,
0072                                                      void                      *data,
0073                                                      DBusFreeFunction           free_data_function);
0074 DBUS_EXPORT
0075 dbus_bool_t dbus_server_set_watch_functions         (DBusServer                *server,
0076                                                      DBusAddWatchFunction       add_function,
0077                                                      DBusRemoveWatchFunction    remove_function,
0078                                                      DBusWatchToggledFunction   toggled_function,
0079                                                      void                      *data,
0080                                                      DBusFreeFunction           free_data_function);
0081 DBUS_EXPORT
0082 dbus_bool_t dbus_server_set_timeout_functions       (DBusServer                *server,
0083                                                      DBusAddTimeoutFunction     add_function,
0084                                                      DBusRemoveTimeoutFunction  remove_function,
0085                                                      DBusTimeoutToggledFunction toggled_function,
0086                                                      void                      *data,
0087                                                      DBusFreeFunction           free_data_function);
0088 DBUS_EXPORT
0089 dbus_bool_t dbus_server_set_auth_mechanisms         (DBusServer                *server,
0090                                                      const char               **mechanisms);
0091 
0092 DBUS_EXPORT
0093 dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t     *slot_p);
0094 DBUS_EXPORT
0095 void        dbus_server_free_data_slot     (dbus_int32_t     *slot_p);
0096 DBUS_EXPORT
0097 dbus_bool_t dbus_server_set_data           (DBusServer       *server,
0098                                             int               slot,
0099                                             void             *data,
0100                                             DBusFreeFunction  free_data_func);
0101 DBUS_EXPORT
0102 void*       dbus_server_get_data           (DBusServer       *server,
0103                                             int               slot);
0104 
0105 /**
0106  * Clear a variable or struct member that contains a #DBusServer.
0107  * If it does not contain #NULL, the server that was previously
0108  * there is unreferenced with dbus_server_unref().
0109  *
0110  * This is very similar to dbus_clear_connection(): see that function
0111  * for more details.
0112  *
0113  * @param pointer_to_server A pointer to a variable or struct member.
0114  * pointer_to_server must not be #NULL, but *pointer_to_server
0115  * may be #NULL.
0116  */
0117 static inline void
0118 dbus_clear_server (DBusServer **pointer_to_server)
0119 {
0120   _dbus_clear_pointer_impl (DBusServer, pointer_to_server, dbus_server_unref);
0121 }
0122 
0123 /** @} */
0124 
0125 DBUS_END_DECLS
0126 
0127 #endif /* DBUS_SERVER_H */