mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-24 16:35:44 +00:00
834c9c9459
Doing DBus method calls using libdbus.so is tedious in the extreme. systemd developers came up with a nice high level API for DBus method calls (sd_bus_call_method). While systemd doesn't use libdbus.so, their API design can easily be ported to libdbus.so. This patch thus introduces methods virDBusCallMethod & virDBusMessageRead, which are based on the code used for sd_bus_call_method and sd_bus_message_read. This code in systemd is under the LGPLv2+, so we're license compatible. This code is probably pretty unintelligible unless you are familiar with the DBus type system. So I added some API docs trying to explain how to use them, as well as test cases to validate that I didn't screw up the adaptation from the original systemd code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
/*
|
|
* virdbuspriv.h: internal APIs for testing DBus code
|
|
*
|
|
* Copyright (C) 2012-2013 Red Hat, Inc.
|
|
*
|
|
* 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
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#ifndef __VIR_DBUS_PRIV_H__
|
|
# define __VIR_DBUS_PRIV_H__
|
|
|
|
# include "virdbus.h"
|
|
|
|
# include <stdarg.h>
|
|
|
|
int virDBusMessageEncodeArgs(DBusMessage* msg,
|
|
const char *types,
|
|
va_list args);
|
|
|
|
int virDBusMessageDecodeArgs(DBusMessage* msg,
|
|
const char *types,
|
|
va_list args);
|
|
|
|
int virDBusMessageEncode(DBusMessage* msg,
|
|
const char *types,
|
|
...);
|
|
|
|
int virDBusMessageDecode(DBusMessage* msg,
|
|
const char *types,
|
|
...);
|
|
|
|
#endif /* __VIR_DBUS_PRIV_H__ */
|