Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:13

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