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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef ____H_VBOX_DBUS
|
---|
24 | #define ____H_VBOX_DBUS
|
---|
25 |
|
---|
26 | #include <stdint.h>
|
---|
27 |
|
---|
28 | #define VBOX_DBUS_1_2_LIB "libdbus-1.so.2" /* This should be compatible */
|
---|
29 | #define VBOX_DBUS_1_3_LIB "libdbus-1.so.3"
|
---|
30 |
|
---|
31 | /** Types and defines from the dbus header files which we need. These are
|
---|
32 | * taken more or less verbatim from the DBus public interface header files. */
|
---|
33 | struct DBusError
|
---|
34 | {
|
---|
35 | const char *name;
|
---|
36 | const char *message;
|
---|
37 | unsigned int dummy1 : 1;
|
---|
38 | unsigned int dummy2 : 1;
|
---|
39 | unsigned int dummy3 : 1;
|
---|
40 | unsigned int dummy4 : 1;
|
---|
41 | unsigned int dummy5 : 1;
|
---|
42 | void *padding1;
|
---|
43 | };
|
---|
44 | struct DBusConnection;
|
---|
45 | typedef struct DBusConnection DBusConnection;
|
---|
46 | typedef uint32_t dbus_bool_t;
|
---|
47 | typedef uint32_t dbus_uint32_t;
|
---|
48 | typedef enum { DBUS_BUS_SESSON, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
|
---|
49 | struct DBusMessage;
|
---|
50 | typedef struct DBusMessage DBusMessage;
|
---|
51 | struct DBusMessageIter
|
---|
52 | {
|
---|
53 | void *dummy1;
|
---|
54 | void *dummy2;
|
---|
55 | dbus_uint32_t dummy3;
|
---|
56 | int dummy4;
|
---|
57 | int dummy5;
|
---|
58 | int dummy6;
|
---|
59 | int dummy7;
|
---|
60 | int dummy8;
|
---|
61 | int dummy9;
|
---|
62 | int dummy10;
|
---|
63 | int dummy11;
|
---|
64 | int pad1;
|
---|
65 | int pad2;
|
---|
66 | void *pad3;
|
---|
67 | };
|
---|
68 | typedef struct DBusMessageIter DBusMessageIter;
|
---|
69 |
|
---|
70 | #define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
|
---|
71 | #define DBUS_TYPE_INVALID ((int) '\0')
|
---|
72 | #define DBUS_TYPE_STRING ((int) 's')
|
---|
73 | #define DBUS_TYPE_ARRAY ((int) 'a')
|
---|
74 | #define DBUS_TYPE_DICT_ENTRY ((int) 'e')
|
---|
75 |
|
---|
76 | typedef enum
|
---|
77 | {
|
---|
78 | DBUS_HANDLER_RESULT_HANDLED,
|
---|
79 | DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
|
---|
80 | DBUS_HANDLER_RESULT_NEED_MEMORY
|
---|
81 | } DBusHandlerResult;
|
---|
82 |
|
---|
83 | typedef DBusHandlerResult (*DBusHandleMessageFunction) (DBusConnection *,
|
---|
84 | DBusMessage *, void *);
|
---|
85 | typedef void (*DBusFreeFunction) (void *);
|
---|
86 |
|
---|
87 | /* Declarations of the functions that we need from libdbus-1 */
|
---|
88 | #define VBOX_PROXY_STUB(function, rettype, signature, shortsig) \
|
---|
89 | extern rettype ( function ) signature ;
|
---|
90 |
|
---|
91 | #include "vbox-dbus-internal.h"
|
---|
92 |
|
---|
93 | #undef VBOX_PROXY_STUB
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Try to dynamically load the DBus library. This function should be called
|
---|
97 | * before attempting to use any of the DBus functions. It is safe to call this
|
---|
98 | * function multiple times.
|
---|
99 | *
|
---|
100 | * @returns iprt status code
|
---|
101 | */
|
---|
102 | extern int VBoxLoadDBusLib(void);
|
---|
103 |
|
---|
104 | #endif /* ____H_VBOX_DBUS not defined */
|
---|
105 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|
106 |
|
---|