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-2019 Oracle Corporation
|
---|
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 | *
|
---|
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.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef VBOX_INCLUDED_dbus_h
|
---|
28 | #define VBOX_INCLUDED_dbus_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <iprt/types.h>
|
---|
34 | #include <iprt/stdarg.h>
|
---|
35 |
|
---|
36 | #ifndef __cplusplus
|
---|
37 | # error "This header requires C++ to avoid name clashes."
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | /** Types and defines from the dbus header files which we need. These are
|
---|
41 | * taken more or less verbatim from the DBus public interface header files. */
|
---|
42 | struct DBusError
|
---|
43 | {
|
---|
44 | const char *name;
|
---|
45 | const char *message;
|
---|
46 | unsigned int dummy1 : 1;
|
---|
47 | unsigned int dummy2 : 1;
|
---|
48 | unsigned int dummy3 : 1;
|
---|
49 | unsigned int dummy4 : 1;
|
---|
50 | unsigned int dummy5 : 1;
|
---|
51 | void *padding1;
|
---|
52 | };
|
---|
53 | typedef struct DBusError DBusError;
|
---|
54 |
|
---|
55 | struct DBusConnection;
|
---|
56 | typedef struct DBusConnection DBusConnection;
|
---|
57 |
|
---|
58 | typedef uint32_t dbus_bool_t;
|
---|
59 | typedef uint32_t dbus_uint32_t;
|
---|
60 | typedef enum { DBUS_BUS_SESSION, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
|
---|
61 |
|
---|
62 | struct DBusMessage;
|
---|
63 | typedef struct DBusMessage DBusMessage;
|
---|
64 |
|
---|
65 | struct DBusMessageIter
|
---|
66 | {
|
---|
67 | void *dummy1;
|
---|
68 | void *dummy2;
|
---|
69 | dbus_uint32_t dummy3;
|
---|
70 | int dummy4;
|
---|
71 | int dummy5;
|
---|
72 | int dummy6;
|
---|
73 | int dummy7;
|
---|
74 | int dummy8;
|
---|
75 | int dummy9;
|
---|
76 | int dummy10;
|
---|
77 | int dummy11;
|
---|
78 | int pad1;
|
---|
79 | int pad2;
|
---|
80 | void *pad3;
|
---|
81 | };
|
---|
82 | typedef struct DBusMessageIter DBusMessageIter;
|
---|
83 |
|
---|
84 | #define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
|
---|
85 |
|
---|
86 | /* Message types. */
|
---|
87 | #define DBUS_MESSAGE_TYPE_INVALID 0
|
---|
88 | #define DBUS_MESSAGE_TYPE_METHOD_CALL 1
|
---|
89 | #define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
|
---|
90 | #define DBUS_MESSAGE_TYPE_ERROR 3
|
---|
91 | #define DBUS_MESSAGE_TYPE_SIGNAL 4
|
---|
92 |
|
---|
93 | /* Primitive types. */
|
---|
94 | #define DBUS_TYPE_INVALID ((int) '\0')
|
---|
95 | #define DBUS_TYPE_BOOLEAN ((int) 'b')
|
---|
96 | #define DBUS_TYPE_INT32 ((int) 'i')
|
---|
97 | #define DBUS_TYPE_UINT32 ((int) 'u')
|
---|
98 | #define DBUS_TYPE_STRING ((int) 's')
|
---|
99 | #define DBUS_TYPE_STRING_AS_STRING "s"
|
---|
100 |
|
---|
101 | /* Compound types. */
|
---|
102 | #define DBUS_TYPE_OBJECT_PATH ((int) 'o')
|
---|
103 | #define DBUS_TYPE_ARRAY ((int) 'a')
|
---|
104 | #define DBUS_TYPE_ARRAY_AS_STRING "a"
|
---|
105 | #define DBUS_TYPE_DICT_ENTRY ((int) 'e')
|
---|
106 | #define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
|
---|
107 |
|
---|
108 | typedef enum
|
---|
109 | {
|
---|
110 | DBUS_HANDLER_RESULT_HANDLED,
|
---|
111 | DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
|
---|
112 | DBUS_HANDLER_RESULT_NEED_MEMORY
|
---|
113 | } DBusHandlerResult;
|
---|
114 |
|
---|
115 | typedef DBusHandlerResult (* DBusHandleMessageFunction)(DBusConnection *,
|
---|
116 | DBusMessage *, void *);
|
---|
117 | typedef void (* DBusFreeFunction) (void *);
|
---|
118 |
|
---|
119 | /* Declarations of the functions that we need from libdbus-1 */
|
---|
120 | #define VBOX_DBUS_GENERATE_HEADER
|
---|
121 |
|
---|
122 | #include <VBox/dbus-calls.h>
|
---|
123 |
|
---|
124 | #undef VBOX_DBUS_GENERATE_HEADER
|
---|
125 |
|
---|
126 | #endif /* !VBOX_INCLUDED_dbus_h */
|
---|
127 |
|
---|