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