1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* services.h Service management
4 * Copyright (C) 2003 Red Hat, Inc.
6 * Licensed under the Academic Free License version 1.2
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef BUS_SERVICES_H
25 #define BUS_SERVICES_H
27 #include <dbus/dbus.h>
28 #include <dbus/dbus-string.h>
29 #include "connection.h"
31 /* forward decl that probably shouldn't be in this file */
32 typedef struct BusTransaction BusTransaction;
34 /* Each service can have multiple owners; one owner is the "real
35 * owner" and the others are queued up. For example, if I have
36 * multiple text editors open, one might own the TextEditor service;
37 * if I close that one, the next in line will become the owner of it.
40 typedef struct BusService BusService;
42 typedef void (* BusServiceForeachFunction) (BusService *service,
45 BusService* bus_service_lookup (const DBusString *service_name);
46 BusService* bus_service_ensure (const DBusString *service_name,
47 DBusConnection *owner_if_created,
48 BusTransaction *transaction,
50 dbus_bool_t bus_service_add_owner (BusService *service,
51 DBusConnection *owner,
52 BusTransaction *transaction,
54 dbus_bool_t bus_service_remove_owner (BusService *service,
55 DBusConnection *owner,
56 BusTransaction *transaction,
58 dbus_bool_t bus_service_has_owner (BusService *service,
59 DBusConnection *owner);
60 DBusConnection* bus_service_get_primary_owner (BusService *service);
61 void bus_service_set_prohibit_replacement (BusService *service,
62 dbus_bool_t prohibit_replacement);
63 dbus_bool_t bus_service_get_prohibit_replacement (BusService *service);
64 const char* bus_service_get_name (BusService *service);
65 void bus_service_foreach (BusServiceForeachFunction function,
69 char **bus_services_list (int *array_len);
71 #endif /* BUS_SERVICES_H */