1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-server.h DBusServer object
4 * Copyright (C) 2002, 2003 Red Hat Inc.
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
24 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
30 #include <dbus/dbus-errors.h>
31 #include <dbus/dbus-macros.h>
32 #include <dbus/dbus-message.h>
33 #include <dbus/dbus-connection.h>
34 #include <dbus/dbus-protocol.h>
39 * @addtogroup DBusServer
43 typedef struct DBusServer DBusServer;
45 /** Called when a new connection to the server is available. Must reference and save the new
46 * connection, or close the new connection. Set with dbus_server_set_new_connection_function().
48 typedef void (* DBusNewConnectionFunction) (DBusServer *server,
49 DBusConnection *new_connection,
53 DBusServer* dbus_server_listen (const char *address,
56 DBusServer* dbus_server_ref (DBusServer *server);
58 void dbus_server_unref (DBusServer *server);
60 void dbus_server_disconnect (DBusServer *server);
62 dbus_bool_t dbus_server_get_is_connected (DBusServer *server);
64 char* dbus_server_get_address (DBusServer *server);
66 char* dbus_server_get_id (DBusServer *server);
68 void dbus_server_set_new_connection_function (DBusServer *server,
69 DBusNewConnectionFunction function,
71 DBusFreeFunction free_data_function);
73 dbus_bool_t dbus_server_set_watch_functions (DBusServer *server,
74 DBusAddWatchFunction add_function,
75 DBusRemoveWatchFunction remove_function,
76 DBusWatchToggledFunction toggled_function,
78 DBusFreeFunction free_data_function);
80 dbus_bool_t dbus_server_set_timeout_functions (DBusServer *server,
81 DBusAddTimeoutFunction add_function,
82 DBusRemoveTimeoutFunction remove_function,
83 DBusTimeoutToggledFunction toggled_function,
85 DBusFreeFunction free_data_function);
87 dbus_bool_t dbus_server_set_auth_mechanisms (DBusServer *server,
88 const char **mechanisms);
91 dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t *slot_p);
93 void dbus_server_free_data_slot (dbus_int32_t *slot_p);
95 dbus_bool_t dbus_server_set_data (DBusServer *server,
98 DBusFreeFunction free_data_func);
100 void* dbus_server_get_data (DBusServer *server,
104 * Clear a variable or struct member that contains a #DBusServer.
105 * If it does not contain #NULL, the server that was previously
106 * there is unreferenced with dbus_server_unref().
108 * This is very similar to dbus_clear_connection(): see that function
111 * @param pointer_to_server A pointer to a variable or struct member.
112 * pointer_to_server must not be #NULL, but *pointer_to_server
116 dbus_clear_server (DBusServer **pointer_to_server)
118 _dbus_clear_pointer_impl (DBusServer, pointer_to_server, dbus_server_unref);
125 #endif /* DBUS_SERVER_H */