dbus.h revision 5856c5b39318bc766ccd6f823f1349c80a3dcfaa
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync/** @file
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync *
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * Module to dynamically load libdbus and load all symbols
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * which are needed by VirtualBox.
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync */
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync/*
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * Copyright (C) 2008 Sun Microsystems, Inc.
df03c5ed15c9b5bf6d75fedcdf5057d3ffce8577vboxsync *
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
92a27575521748a392dcd1b996fce55b87411a00vboxsync * available from http://www.virtualbox.org. This file is free software;
92a27575521748a392dcd1b996fce55b87411a00vboxsync * you can redistribute it and/or modify it under the terms of the GNU
92a27575521748a392dcd1b996fce55b87411a00vboxsync * General Public License (GPL) as published by the Free Software
92a27575521748a392dcd1b996fce55b87411a00vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
92a27575521748a392dcd1b996fce55b87411a00vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
92a27575521748a392dcd1b996fce55b87411a00vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
92a27575521748a392dcd1b996fce55b87411a00vboxsync *
92a27575521748a392dcd1b996fce55b87411a00vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * additional information or have any questions.
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync */
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#ifndef ____H_VBOX_DBUS
10cdf5733351fdcd857d439ca32189e812f18682vboxsync#define ____H_VBOX_DBUS
10cdf5733351fdcd857d439ca32189e812f18682vboxsync
10cdf5733351fdcd857d439ca32189e812f18682vboxsync#include <stdint.h>
10cdf5733351fdcd857d439ca32189e812f18682vboxsync
10cdf5733351fdcd857d439ca32189e812f18682vboxsync#define VBOX_DBUS_1_3_LIB "libdbus-1.so.3"
10cdf5733351fdcd857d439ca32189e812f18682vboxsync
10cdf5733351fdcd857d439ca32189e812f18682vboxsync/** Types and defines from the dbus header files which we need. These are
10cdf5733351fdcd857d439ca32189e812f18682vboxsync * taken more or less verbatim from the DBus public interface header files. */
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsyncstruct DBusError
10cdf5733351fdcd857d439ca32189e812f18682vboxsync{
10cdf5733351fdcd857d439ca32189e812f18682vboxsync const char *name;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync const char *message;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync unsigned int dummy1 : 1;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync unsigned int dummy2 : 1;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync unsigned int dummy3 : 1;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync unsigned int dummy4 : 1;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync unsigned int dummy5 : 1;
cd9e4940318086a06a68bf301960563dcb72b939vboxsync void *padding1;
cd9e4940318086a06a68bf301960563dcb72b939vboxsync};
cd9e4940318086a06a68bf301960563dcb72b939vboxsyncstruct DBusConnection;
10cdf5733351fdcd857d439ca32189e812f18682vboxsynctypedef struct DBusConnection DBusConnection;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsynctypedef uint32_t dbus_bool_t;
10cdf5733351fdcd857d439ca32189e812f18682vboxsynctypedef uint32_t dbus_uint32_t;
10cdf5733351fdcd857d439ca32189e812f18682vboxsynctypedef enum { DBUS_BUS_SESSON, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
10cdf5733351fdcd857d439ca32189e812f18682vboxsyncstruct DBusMessage;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsynctypedef struct DBusMessage DBusMessage;
10cdf5733351fdcd857d439ca32189e812f18682vboxsyncstruct DBusMessageIter
10cdf5733351fdcd857d439ca32189e812f18682vboxsync{
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync void *dummy1;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync void *dummy2;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync dbus_uint32_t dummy3;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync int dummy4;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy5;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy6;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy7;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy8;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy9;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy10;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int dummy11;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int pad1;
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync int pad2;
cd9e4940318086a06a68bf301960563dcb72b939vboxsync void *pad3;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync};
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsynctypedef struct DBusMessageIter DBusMessageIter;
10cdf5733351fdcd857d439ca32189e812f18682vboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#define DBUS_TYPE_INVALID ((int) '\0')
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#define DBUS_TYPE_STRING ((int) 's')
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#define DBUS_TYPE_ARRAY ((int) 'a')
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#define DBUS_TYPE_DICT_ENTRY ((int) 'e')
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsynctypedef enum
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync{
86abc60770f825f8c2ed4257675b50a08743b687vboxsync DBUS_HANDLER_RESULT_HANDLED,
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync DBUS_HANDLER_RESULT_NEED_MEMORY
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync} DBusHandlerResult;
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync
23ee8310386e73ba6760fa30831a7964713d34b6vboxsynctypedef DBusHandlerResult (*DBusHandleMessageFunction) (DBusConnection *,
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync DBusMessage *, void *);
23ee8310386e73ba6760fa30831a7964713d34b6vboxsynctypedef void (*DBusFreeFunction) (void *);
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync/* Declarations of the functions that we need from libdbus-1 */
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync#define VBOX_PROXY_STUB(function, rettype, signature, shortsig) \
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsyncRTR3DECL(rettype) ( function ) signature ;
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync#include <VBox/dbus-calls.h>
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync#undef VBOX_PROXY_STUB
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync
4a429a59b1a82ce092626ea5f7512466c18f2015vboxsync/**
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * Try to dynamically load the DBus library. This function should be called
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync * before attempting to use any of the DBus functions. It is safe to call this
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync * function multiple times.
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync *
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync * @returns iprt status code
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync */
23ee8310386e73ba6760fa30831a7964713d34b6vboxsyncRTR3DECL(int) RTDBusLoadLib(void);
23ee8310386e73ba6760fa30831a7964713d34b6vboxsync
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync#endif /* ____H_VBOX_DBUS not defined */
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync/* vi: set tabstop=4 shiftwidth=4 expandtab: */
db3dbd0ed7eb69f804a8921fa23a1267ea01f46evboxsync
86abc60770f825f8c2ed4257675b50a08743b687vboxsync