And these.
[platform/upstream/dbus.git] / dbus / dbus-server.h
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-server.h DBusServer object
3  *
4  * Copyright (C) 2002  Red Hat Inc.
5  *
6  * Licensed under the Academic Free License version 1.2
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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
34 DBUS_BEGIN_DECLS;
35
36 typedef struct DBusServer DBusServer;
37
38 typedef void (* DBusNewConnectionFunction) (DBusServer     *server,
39                                             DBusConnection *new_connection,
40                                             void           *data);
41
42 DBusServer* dbus_server_listen           (const char     *address,
43                                           DBusResultCode *result);
44 void        dbus_server_ref              (DBusServer     *server);
45 void        dbus_server_unref            (DBusServer     *server);
46 void        dbus_server_disconnect       (DBusServer     *server);
47 dbus_bool_t dbus_server_get_is_connected (DBusServer     *server);
48
49 void dbus_server_set_new_connection_function (DBusServer                *server,
50                                               DBusNewConnectionFunction  function,
51                                               void                      *data,
52                                               DBusFreeFunction           free_data_function);
53 void dbus_server_set_watch_functions         (DBusServer                *server,
54                                               DBusAddWatchFunction       add_function,
55                                               DBusRemoveWatchFunction    remove_function,
56                                               void                      *data,
57                                               DBusFreeFunction           free_data_function);
58 void dbus_server_set_timeout_functions       (DBusServer                *server,
59                                               DBusAddTimeoutFunction     add_function,
60                                               DBusRemoveTimeoutFunction  remove_function,
61                                               void                      *data,
62                                               DBusFreeFunction           free_data_function);
63 void dbus_server_handle_watch                (DBusServer                *server,
64                                               DBusWatch                 *watch,
65                                               unsigned int               condition);
66
67
68 void dbus_server_set_max_connections         (DBusServer                *server,
69                                               int                        max_connections);
70 int  dbus_server_get_max_connections         (DBusServer                *server);
71
72 int  dbus_server_get_n_connections           (DBusServer                *server);
73
74 DBUS_END_DECLS;
75
76 #endif /* DBUS_SERVER_H */