8c2344a455fb5ea4f836ff9fbbfc06012e36ac95
[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
30 /* Each service can have multiple owners; one owner is the "real
31  * owner" and the others are queued up. For example, if I have
32  * multiple text editors open, one might own the TextEditor service;
33  * if I close that one, the next in line will become the owner of it.
34  */
35
36 typedef struct BusService BusService;
37
38 typedef void (* BusServiceForeachFunction) (BusService       *service,
39                                             void             *data);
40
41 BusService*     bus_service_lookup            (const DBusString          *service_name,
42                                                dbus_bool_t                create_if_not_found);
43 void            bus_service_free              (BusService                *service);
44 dbus_bool_t     bus_service_add_owner         (BusService                *service,
45                                                DBusConnection            *owner);
46 void            bus_service_remove_owner      (BusService                *service,
47                                                DBusConnection            *owner);
48 DBusConnection* bus_service_get_primary_owner (BusService                *service);
49 const char*     bus_service_get_name          (BusService                *service);
50 void            bus_service_foreach           (BusServiceForeachFunction  function,
51                                                void                      *data);
52
53 #endif /* BUS_SERVICES_H */