2003-04-10 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / bus / services.h
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* services.h  Service management
3  *
4  * Copyright (C) 2003  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
24 #ifndef BUS_SERVICES_H
25 #define BUS_SERVICES_H
26
27 #include <dbus/dbus.h>
28 #include <dbus/dbus-string.h>
29 #include "connection.h"
30 #include "bus.h"
31
32 typedef void (* BusServiceForeachFunction) (BusService       *service,
33                                             void             *data);
34
35 BusRegistry* bus_registry_new             (BusContext                  *context);
36 void         bus_registry_ref             (BusRegistry                 *registry);
37 void         bus_registry_unref           (BusRegistry                 *registry);
38 BusService*  bus_registry_lookup          (BusRegistry                 *registry,
39                                            const DBusString            *service_name);
40 BusService*  bus_registry_ensure          (BusRegistry                 *registry,
41                                            const DBusString            *service_name,
42                                            DBusConnection              *owner_if_created,
43                                            BusTransaction              *transaction,
44                                            DBusError                   *error);
45 void         bus_registry_foreach         (BusRegistry                 *registry,
46                                            BusServiceForeachFunction    function,
47                                            void                        *data);
48 dbus_bool_t  bus_registry_list_services   (BusRegistry                 *registry,
49                                            char                      ***listp,
50                                            int                         *array_len);
51 dbus_bool_t  bus_registry_acquire_service (BusRegistry                 *registry,
52                                            DBusConnection              *connection,
53                                            const DBusString            *service_name,
54                                            dbus_uint32_t                flags,
55                                            dbus_uint32_t               *result,
56                                            BusTransaction              *transaction,
57                                            DBusError                   *error);
58
59 void            bus_service_ref                      (BusService     *service);
60 void            bus_service_unref                    (BusService     *service);
61 dbus_bool_t     bus_service_add_owner                (BusService     *service,
62                                                       DBusConnection *owner,
63                                                       BusTransaction *transaction,
64                                                       DBusError      *error);
65 dbus_bool_t     bus_service_remove_owner             (BusService     *service,
66                                                       DBusConnection *owner,
67                                                       BusTransaction *transaction,
68                                                       DBusError      *error);
69 dbus_bool_t     bus_service_has_owner                (BusService     *service,
70                                                       DBusConnection *owner);
71 DBusConnection* bus_service_get_primary_owner        (BusService     *service);
72 void            bus_service_set_prohibit_replacement (BusService     *service,
73                                                       dbus_bool_t     prohibit_replacement);
74 dbus_bool_t     bus_service_get_prohibit_replacement (BusService     *service);
75 const char*     bus_service_get_name                 (BusService     *service);
76
77
78 #endif /* BUS_SERVICES_H */