1 | /** @file
|
---|
2 | * Module to dynamically load libdbus and load all symbols which are needed by
|
---|
3 | * VirtualBox.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
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 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
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
|
---|
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.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef VBOX_INCLUDED_dbus_h
|
---|
38 | #define VBOX_INCLUDED_dbus_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <iprt/types.h>
|
---|
44 | #include <iprt/stdarg.h>
|
---|
45 |
|
---|
46 | #ifndef __cplusplus
|
---|
47 | # error "This header requires C++ to avoid name clashes."
|
---|
48 | #endif
|
---|
49 |
|
---|
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 | };
|
---|
63 | typedef struct DBusError DBusError;
|
---|
64 |
|
---|
65 | struct DBusConnection;
|
---|
66 | typedef struct DBusConnection DBusConnection;
|
---|
67 |
|
---|
68 | typedef uint32_t dbus_bool_t;
|
---|
69 | typedef uint32_t dbus_uint32_t;
|
---|
70 | typedef enum { DBUS_BUS_SESSION, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
|
---|
71 |
|
---|
72 | struct DBusMessage;
|
---|
73 | typedef struct DBusMessage DBusMessage;
|
---|
74 |
|
---|
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 |
|
---|
94 | #define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
|
---|
95 |
|
---|
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. */
|
---|
104 | #define DBUS_TYPE_INVALID ((int) '\0')
|
---|
105 | #define DBUS_TYPE_BOOLEAN ((int) 'b')
|
---|
106 | #define DBUS_TYPE_INT32 ((int) 'i')
|
---|
107 | #define DBUS_TYPE_UINT32 ((int) 'u')
|
---|
108 | #define DBUS_TYPE_DOUBLE ((int) 'd')
|
---|
109 | #define DBUS_TYPE_STRING ((int) 's')
|
---|
110 | #define DBUS_TYPE_STRING_AS_STRING "s"
|
---|
111 |
|
---|
112 | /* Compound types. */
|
---|
113 | #define DBUS_TYPE_OBJECT_PATH ((int) 'o')
|
---|
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"
|
---|
118 | #define DBUS_TYPE_STRUCT ((int) 'r')
|
---|
119 |
|
---|
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 |
|
---|
127 | typedef DBusHandlerResult (* DBusHandleMessageFunction)(DBusConnection *,
|
---|
128 | DBusMessage *, void *);
|
---|
129 | typedef void (* DBusFreeFunction) (void *);
|
---|
130 |
|
---|
131 | /* Declarations of the functions that we need from libdbus-1 */
|
---|
132 | #define VBOX_DBUS_GENERATE_HEADER
|
---|
133 |
|
---|
134 | #include <VBox/dbus-calls.h>
|
---|
135 |
|
---|
136 | #undef VBOX_DBUS_GENERATE_HEADER
|
---|
137 |
|
---|
138 | #endif /* !VBOX_INCLUDED_dbus_h */
|
---|
139 |
|
---|