2012-04-19 14:34:35 +00:00
|
|
|
/*
|
|
|
|
* virdbus.h: helper for using DBus
|
|
|
|
*
|
build: work around mingw header pollution
On Fedora 18, when cross-compiling to mingw with the mingw*-dbus
packages installed, compilation fails with:
CC libvirt_net_rpc_server_la-virnetserver.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0,
from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30,
from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31,
from ../../src/util/virdbus.h:26,
from ../../src/rpc/virnetserver.c:39:
/usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct'
I have reported this as a bug against two packages:
- mingw-headers, for polluting the namespace
https://bugzilla.redhat.com/show_bug.cgi?id=980270
- dbus, for not dealing with the pollution
https://bugzilla.redhat.com/show_bug.cgi?id=980278
At least dbus has agreed that a future version of dbus headers will
do s/interface/iface/, regardless of what happens in mingw. But it
is also easy to workaround in libvirt in the meantime, without having
to wait for either mingw or dbus to upgrade.
* src/util/virdbus.h (includes): Undo mingw's pollution so that
dbus doesn't fail.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-02 12:09:30 +00:00
|
|
|
* Copyright (C) 2012-2013 Red Hat, Inc.
|
2012-04-19 14:34:35 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2012-04-19 14:34:35 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_DBUS_H__
|
|
|
|
# define __VIR_DBUS_H__
|
|
|
|
|
2012-09-20 14:05:39 +00:00
|
|
|
# ifdef WITH_DBUS
|
build: work around mingw header pollution
On Fedora 18, when cross-compiling to mingw with the mingw*-dbus
packages installed, compilation fails with:
CC libvirt_net_rpc_server_la-virnetserver.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0,
from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30,
from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31,
from ../../src/util/virdbus.h:26,
from ../../src/rpc/virnetserver.c:39:
/usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct'
I have reported this as a bug against two packages:
- mingw-headers, for polluting the namespace
https://bugzilla.redhat.com/show_bug.cgi?id=980270
- dbus, for not dealing with the pollution
https://bugzilla.redhat.com/show_bug.cgi?id=980278
At least dbus has agreed that a future version of dbus headers will
do s/interface/iface/, regardless of what happens in mingw. But it
is also easy to workaround in libvirt in the meantime, without having
to wait for either mingw or dbus to upgrade.
* src/util/virdbus.h (includes): Undo mingw's pollution so that
dbus doesn't fail.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-02 12:09:30 +00:00
|
|
|
# undef interface /* Work around namespace pollution in mingw's rpc.h */
|
2012-04-19 14:34:35 +00:00
|
|
|
# include <dbus/dbus.h>
|
|
|
|
# else
|
|
|
|
# define DBusConnection void
|
2013-07-12 10:13:04 +00:00
|
|
|
# define DBusMessage void
|
2015-01-19 12:30:24 +00:00
|
|
|
# define dbus_message_unref(m) do {} while (0)
|
2012-04-19 14:34:35 +00:00
|
|
|
# endif
|
|
|
|
# include "internal.h"
|
|
|
|
|
2014-03-13 15:47:46 +00:00
|
|
|
# include <stdarg.h>
|
|
|
|
|
2013-10-11 14:28:39 +00:00
|
|
|
void virDBusSetSharedBus(bool shared);
|
|
|
|
|
2012-04-19 14:34:35 +00:00
|
|
|
DBusConnection *virDBusGetSystemBus(void);
|
2013-08-19 09:24:04 +00:00
|
|
|
bool virDBusHasSystemBus(void);
|
2013-10-11 14:57:05 +00:00
|
|
|
void virDBusCloseSystemBus(void);
|
2012-10-31 19:03:49 +00:00
|
|
|
DBusConnection *virDBusGetSessionBus(void);
|
2012-04-19 14:34:35 +00:00
|
|
|
|
2014-03-13 15:47:46 +00:00
|
|
|
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);
|
2014-03-19 10:58:42 +00:00
|
|
|
int virDBusCreateReply(DBusMessage **reply,
|
|
|
|
const char *types, ...);
|
|
|
|
int virDBusCreateReplyV(DBusMessage **reply,
|
|
|
|
const char *types,
|
|
|
|
va_list args);
|
2014-03-13 15:47:46 +00:00
|
|
|
|
2013-07-12 10:13:04 +00:00
|
|
|
int virDBusCallMethod(DBusConnection *conn,
|
|
|
|
DBusMessage **reply,
|
2015-01-19 12:30:24 +00:00
|
|
|
virErrorPtr error,
|
2013-07-12 10:13:04 +00:00
|
|
|
const char *destination,
|
|
|
|
const char *path,
|
2013-07-29 15:58:19 +00:00
|
|
|
const char *iface,
|
2013-07-12 10:13:04 +00:00
|
|
|
const char *member,
|
|
|
|
const char *types, ...);
|
|
|
|
int virDBusMessageRead(DBusMessage *msg,
|
|
|
|
const char *types, ...);
|
2014-04-14 17:45:47 +00:00
|
|
|
void virDBusMessageUnref(DBusMessage *msg);
|
2013-07-12 10:13:04 +00:00
|
|
|
|
2013-09-11 03:15:02 +00:00
|
|
|
int virDBusIsServiceEnabled(const char *name);
|
2014-02-27 20:21:57 +00:00
|
|
|
int virDBusIsServiceRegistered(const char *name);
|
2015-01-22 16:50:33 +00:00
|
|
|
|
|
|
|
bool virDBusErrorIsUnknownMethod(virErrorPtr err);
|
2012-04-19 14:34:35 +00:00
|
|
|
#endif /* __VIR_DBUS_H__ */
|