[23860] | 1 | /** @file
|
---|
[36567] | 2 | * Module to dynamically load libdbus and load all symbols which are needed by
|
---|
| 3 | * VirtualBox.
|
---|
[23860] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[44529] | 7 | * Copyright (C) 2008-2012 Oracle Corporation
|
---|
[23860] | 8 | *
|
---|
| 9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
| 12 | * General Public License (GPL) as published by the Free Software
|
---|
| 13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
| 16 | *
|
---|
[24409] | 17 | * The contents of this file may alternatively be used under the terms
|
---|
| 18 | * of the Common Development and Distribution License Version 1.0
|
---|
| 19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
| 20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
| 21 | * CDDL are applicable instead of those of the GPL.
|
---|
| 22 | *
|
---|
| 23 | * You may elect to license modified versions of this file under the
|
---|
| 24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[23860] | 25 | */
|
---|
| 26 |
|
---|
[36567] | 27 | #ifndef ___VBox_dbus_h
|
---|
| 28 | #define ___VBox_dbus_h
|
---|
[23860] | 29 |
|
---|
[25477] | 30 | #include <iprt/types.h>
|
---|
| 31 | #include <iprt/stdarg.h>
|
---|
[23860] | 32 |
|
---|
[36567] | 33 | #ifndef __cplusplus
|
---|
| 34 | # error "This header requires C++ to avoid name clashes."
|
---|
| 35 | #endif
|
---|
| 36 |
|
---|
[23860] | 37 | /** Types and defines from the dbus header files which we need. These are
|
---|
| 38 | * taken more or less verbatim from the DBus public interface header files. */
|
---|
| 39 | struct DBusError
|
---|
| 40 | {
|
---|
| 41 | const char *name;
|
---|
| 42 | const char *message;
|
---|
| 43 | unsigned int dummy1 : 1;
|
---|
| 44 | unsigned int dummy2 : 1;
|
---|
| 45 | unsigned int dummy3 : 1;
|
---|
| 46 | unsigned int dummy4 : 1;
|
---|
| 47 | unsigned int dummy5 : 1;
|
---|
| 48 | void *padding1;
|
---|
| 49 | };
|
---|
[25477] | 50 | typedef struct DBusError DBusError;
|
---|
| 51 |
|
---|
[23860] | 52 | struct DBusConnection;
|
---|
| 53 | typedef struct DBusConnection DBusConnection;
|
---|
[25477] | 54 |
|
---|
[23860] | 55 | typedef uint32_t dbus_bool_t;
|
---|
| 56 | typedef uint32_t dbus_uint32_t;
|
---|
| 57 | typedef enum { DBUS_BUS_SESSON, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
|
---|
[25477] | 58 |
|
---|
[23860] | 59 | struct DBusMessage;
|
---|
| 60 | typedef struct DBusMessage DBusMessage;
|
---|
[25477] | 61 |
|
---|
[23860] | 62 | struct DBusMessageIter
|
---|
| 63 | {
|
---|
| 64 | void *dummy1;
|
---|
| 65 | void *dummy2;
|
---|
| 66 | dbus_uint32_t dummy3;
|
---|
| 67 | int dummy4;
|
---|
| 68 | int dummy5;
|
---|
| 69 | int dummy6;
|
---|
| 70 | int dummy7;
|
---|
| 71 | int dummy8;
|
---|
| 72 | int dummy9;
|
---|
| 73 | int dummy10;
|
---|
| 74 | int dummy11;
|
---|
| 75 | int pad1;
|
---|
| 76 | int pad2;
|
---|
| 77 | void *pad3;
|
---|
| 78 | };
|
---|
| 79 | typedef struct DBusMessageIter DBusMessageIter;
|
---|
| 80 |
|
---|
[23864] | 81 | #define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
|
---|
[23860] | 82 |
|
---|
[43790] | 83 | /* Message types. */
|
---|
| 84 | #define DBUS_MESSAGE_TYPE_INVALID 0
|
---|
| 85 | #define DBUS_MESSAGE_TYPE_METHOD_CALL 1
|
---|
| 86 | #define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
|
---|
| 87 | #define DBUS_MESSAGE_TYPE_ERROR 3
|
---|
| 88 | #define DBUS_MESSAGE_TYPE_SIGNAL 4
|
---|
| 89 |
|
---|
| 90 | /* Primitive types. */
|
---|
[23864] | 91 | #define DBUS_TYPE_INVALID ((int) '\0')
|
---|
[44047] | 92 | #define DBUS_TYPE_BOOLEAN ((int) 'b')
|
---|
[23864] | 93 | #define DBUS_TYPE_INT32 ((int) 'i')
|
---|
| 94 | #define DBUS_TYPE_UINT32 ((int) 'u')
|
---|
| 95 | #define DBUS_TYPE_STRING ((int) 's')
|
---|
| 96 | #define DBUS_TYPE_STRING_AS_STRING "s"
|
---|
| 97 |
|
---|
[43790] | 98 | /* Compound types. */
|
---|
| 99 | #define DBUS_TYPE_OBJECT_PATH ((int) 'o')
|
---|
[23864] | 100 | #define DBUS_TYPE_ARRAY ((int) 'a')
|
---|
| 101 | #define DBUS_TYPE_ARRAY_AS_STRING "a"
|
---|
| 102 | #define DBUS_TYPE_DICT_ENTRY ((int) 'e')
|
---|
| 103 | #define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
|
---|
| 104 |
|
---|
[23860] | 105 | typedef enum
|
---|
| 106 | {
|
---|
| 107 | DBUS_HANDLER_RESULT_HANDLED,
|
---|
| 108 | DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
|
---|
| 109 | DBUS_HANDLER_RESULT_NEED_MEMORY
|
---|
| 110 | } DBusHandlerResult;
|
---|
| 111 |
|
---|
[36567] | 112 | typedef DBusHandlerResult (* DBusHandleMessageFunction)(DBusConnection *,
|
---|
[23860] | 113 | DBusMessage *, void *);
|
---|
[36567] | 114 | typedef void (* DBusFreeFunction) (void *);
|
---|
[23860] | 115 |
|
---|
| 116 | /* Declarations of the functions that we need from libdbus-1 */
|
---|
[28357] | 117 | #define VBOX_DBUS_GENERATE_HEADER
|
---|
[36567] | 118 |
|
---|
[23860] | 119 | #include <VBox/dbus-calls.h>
|
---|
[36567] | 120 |
|
---|
[28357] | 121 | #undef VBOX_DBUS_GENERATE_HEADER
|
---|
[23860] | 122 |
|
---|
[23864] | 123 | #endif /* ___VBox_DBus_h not defined */
|
---|
[23860] | 124 |
|
---|