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-2012 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_dbus_h
|
---|
28 | #define ___VBox_dbus_h
|
---|
29 |
|
---|
30 | #include <iprt/types.h>
|
---|
31 | #include <iprt/stdarg.h>
|
---|
32 |
|
---|
33 | #ifndef __cplusplus
|
---|
34 | # error "This header requires C++ to avoid name clashes."
|
---|
35 | #endif
|
---|
36 |
|
---|
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 | };
|
---|
50 | typedef struct DBusError DBusError;
|
---|
51 |
|
---|
52 | struct DBusConnection;
|
---|
53 | typedef struct DBusConnection DBusConnection;
|
---|
54 |
|
---|
55 | typedef uint32_t dbus_bool_t;
|
---|
56 | typedef uint32_t dbus_uint32_t;
|
---|
57 | typedef enum { DBUS_BUS_SESSION, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
|
---|
58 |
|
---|
59 | struct DBusMessage;
|
---|
60 | typedef struct DBusMessage DBusMessage;
|
---|
61 |
|
---|
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 |
|
---|
81 | #define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
|
---|
82 |
|
---|
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. */
|
---|
91 | #define DBUS_TYPE_INVALID ((int) '\0')
|
---|
92 | #define DBUS_TYPE_BOOLEAN ((int) 'b')
|
---|
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 |
|
---|
98 | /* Compound types. */
|
---|
99 | #define DBUS_TYPE_OBJECT_PATH ((int) 'o')
|
---|
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 |
|
---|
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 |
|
---|
112 | typedef DBusHandlerResult (* DBusHandleMessageFunction)(DBusConnection *,
|
---|
113 | DBusMessage *, void *);
|
---|
114 | typedef void (* DBusFreeFunction) (void *);
|
---|
115 |
|
---|
116 | /* Declarations of the functions that we need from libdbus-1 */
|
---|
117 | #define VBOX_DBUS_GENERATE_HEADER
|
---|
118 |
|
---|
119 | #include <VBox/dbus-calls.h>
|
---|
120 |
|
---|
121 | #undef VBOX_DBUS_GENERATE_HEADER
|
---|
122 |
|
---|
123 | #endif /* ___VBox_DBus_h not defined */
|
---|
124 |
|
---|