1 | /** @file
|
---|
2 | *
|
---|
3 | * Module to dynamically load libdbus and load all symbols
|
---|
4 | * which are needed by VirtualBox.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2008 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * The contents of this file may alternatively be used under the terms
|
---|
19 | * of the Common Development and Distribution License Version 1.0
|
---|
20 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
21 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
22 | * CDDL are applicable instead of those of the GPL.
|
---|
23 | *
|
---|
24 | * You may elect to license modified versions of this file under the
|
---|
25 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
26 | *
|
---|
27 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
28 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
29 | * additional information or have any questions.
|
---|
30 | */
|
---|
31 |
|
---|
32 | #ifndef ___VBox_DBus_h
|
---|
33 | #define ___VBox_DBus_h
|
---|
34 |
|
---|
35 | #include <iprt/types.h>
|
---|
36 | #include <iprt/stdarg.h>
|
---|
37 |
|
---|
38 | #define VBOX_DBUS_1_3_LIB "libdbus-1.so.3"
|
---|
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_SESSON, 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 | /* Primitive types */
|
---|
87 | #define DBUS_TYPE_INVALID ((int) '\0')
|
---|
88 | #define DBUS_TYPE_INT32 ((int) 'i')
|
---|
89 | #define DBUS_TYPE_UINT32 ((int) 'u')
|
---|
90 | #define DBUS_TYPE_STRING ((int) 's')
|
---|
91 | #define DBUS_TYPE_STRING_AS_STRING "s"
|
---|
92 |
|
---|
93 | /* Compound types */
|
---|
94 | #define DBUS_TYPE_ARRAY ((int) 'a')
|
---|
95 | #define DBUS_TYPE_ARRAY_AS_STRING "a"
|
---|
96 | #define DBUS_TYPE_DICT_ENTRY ((int) 'e')
|
---|
97 | #define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
|
---|
98 |
|
---|
99 | typedef enum
|
---|
100 | {
|
---|
101 | DBUS_HANDLER_RESULT_HANDLED,
|
---|
102 | DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
|
---|
103 | DBUS_HANDLER_RESULT_NEED_MEMORY
|
---|
104 | } DBusHandlerResult;
|
---|
105 |
|
---|
106 | typedef DBusHandlerResult (*DBusHandleMessageFunction) (DBusConnection *,
|
---|
107 | DBusMessage *, void *);
|
---|
108 | typedef void (*DBusFreeFunction) (void *);
|
---|
109 |
|
---|
110 | /* Declarations of the functions that we need from libdbus-1 */
|
---|
111 | #define VBOX_PROXY_STUB(function, rettype, signature, shortsig) \
|
---|
112 | RTR3DECL(rettype) ( function ) signature ;
|
---|
113 |
|
---|
114 | #include <VBox/dbus-calls.h>
|
---|
115 |
|
---|
116 | #undef VBOX_PROXY_STUB
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * Try to dynamically load the DBus library. This function should be called
|
---|
120 | * before attempting to use any of the DBus functions. It is safe to call this
|
---|
121 | * function multiple times.
|
---|
122 | *
|
---|
123 | * @returns iprt status code
|
---|
124 | */
|
---|
125 | RTR3DECL(int) RTDBusLoadLib(void);
|
---|
126 |
|
---|
127 | #endif /* ___VBox_DBus_h not defined */
|
---|
128 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|
129 |
|
---|