1/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2/* dbus-server.h DBusServer object
3 *
4 * Copyright (C) 2002, 2003  Red Hat Inc.
5 *
6 * Licensed under the Academic Free License version 2.1
7 *
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.
12 *
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.
17 *
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
21 *
22 */
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."
25#endif
26
27#ifndef DBUS_SERVER_H
28#define DBUS_SERVER_H
29
30#include <dbus/dbus-errors.h>
31#include <dbus/dbus-message.h>
32#include <dbus/dbus-connection.h>
33#include <dbus/dbus-protocol.h>
34
35DBUS_BEGIN_DECLS
36
37/**
38 * @addtogroup DBusServer
39 * @{
40 */
41
42typedef struct DBusServer DBusServer;
43
44/** Called when a new connection to the server is available. Must reference and save the new
45 * connection, or close the new connection. Set with dbus_server_set_new_connection_function().
46 */
47typedef void (* DBusNewConnectionFunction) (DBusServer     *server,
48                                            DBusConnection *new_connection,
49                                            void           *data);
50
51DBUS_EXPORT
52DBusServer* dbus_server_listen           (const char     *address,
53                                          DBusError      *error);
54DBUS_EXPORT
55DBusServer* dbus_server_ref              (DBusServer     *server);
56DBUS_EXPORT
57void        dbus_server_unref            (DBusServer     *server);
58DBUS_EXPORT
59void        dbus_server_disconnect       (DBusServer     *server);
60DBUS_EXPORT
61dbus_bool_t dbus_server_get_is_connected (DBusServer     *server);
62DBUS_EXPORT
63char*       dbus_server_get_address      (DBusServer     *server);
64DBUS_EXPORT
65char*       dbus_server_get_id           (DBusServer     *server);
66DBUS_EXPORT
67void        dbus_server_set_new_connection_function (DBusServer                *server,
68                                                     DBusNewConnectionFunction  function,
69                                                     void                      *data,
70                                                     DBusFreeFunction           free_data_function);
71DBUS_EXPORT
72dbus_bool_t dbus_server_set_watch_functions         (DBusServer                *server,
73                                                     DBusAddWatchFunction       add_function,
74                                                     DBusRemoveWatchFunction    remove_function,
75                                                     DBusWatchToggledFunction   toggled_function,
76                                                     void                      *data,
77                                                     DBusFreeFunction           free_data_function);
78DBUS_EXPORT
79dbus_bool_t dbus_server_set_timeout_functions       (DBusServer                *server,
80                                                     DBusAddTimeoutFunction     add_function,
81                                                     DBusRemoveTimeoutFunction  remove_function,
82                                                     DBusTimeoutToggledFunction toggled_function,
83                                                     void                      *data,
84                                                     DBusFreeFunction           free_data_function);
85DBUS_EXPORT
86dbus_bool_t dbus_server_set_auth_mechanisms         (DBusServer                *server,
87                                                     const char               **mechanisms);
88
89DBUS_EXPORT
90dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t     *slot_p);
91DBUS_EXPORT
92void        dbus_server_free_data_slot     (dbus_int32_t     *slot_p);
93DBUS_EXPORT
94dbus_bool_t dbus_server_set_data           (DBusServer       *server,
95                                            int               slot,
96                                            void             *data,
97                                            DBusFreeFunction  free_data_func);
98DBUS_EXPORT
99void*       dbus_server_get_data           (DBusServer       *server,
100                                            int               slot);
101
102/** @} */
103
104DBUS_END_DECLS
105
106#endif /* DBUS_SERVER_H */
107