virdbus.h 2.4 KB
Newer Older
1 2 3
/*
 * virdbus.h: helper for using DBus
 *
4
 * Copyright (C) 2012-2013 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library.  If not, see
O
Osier Yang 已提交
18
 * <http://www.gnu.org/licenses/>.
19 20 21 22 23 24
 *
 */

#ifndef __VIR_DBUS_H__
# define __VIR_DBUS_H__

25
# ifdef WITH_DBUS
26
#  undef interface /* Work around namespace pollution in mingw's rpc.h */
27 28 29
#  include <dbus/dbus.h>
# else
#  define DBusConnection void
30
#  define DBusMessage void
31 32 33
# endif
# include "internal.h"

34 35
# include <stdarg.h>

36 37
void virDBusSetSharedBus(bool shared);

38
DBusConnection *virDBusGetSystemBus(void);
39
bool virDBusHasSystemBus(void);
40
void virDBusCloseSystemBus(void);
41
DBusConnection *virDBusGetSessionBus(void);
42

43 44 45 46 47 48 49 50 51 52 53 54 55 56
int virDBusCreateMethod(DBusMessage **call,
                        const char *destination,
                        const char *path,
                        const char *iface,
                        const char *member,
                        const char *types, ...);
int virDBusCreateMethodV(DBusMessage **call,
                         const char *destination,
                         const char *path,
                         const char *iface,
                         const char *member,
                         const char *types,
                         va_list args);

57 58 59 60
int virDBusCallMethod(DBusConnection *conn,
                      DBusMessage **reply,
                      const char *destination,
                      const char *path,
61
                      const char *iface,
62 63
                      const char *member,
                      const char *types, ...);
64 65 66
int virDBusCall(DBusConnection *conn,
                DBusMessage *call,
                DBusMessage **reply);
67 68 69
int virDBusMessageRead(DBusMessage *msg,
                       const char *types, ...);

70
int virDBusIsServiceEnabled(const char *name);
71
int virDBusIsServiceRegistered(const char *name);
72
#endif /* __VIR_DBUS_H__ */