1/****************************************************************************
2**
3** Copyright (C) 2016 Intel Corporation.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtDBus module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef DBUS_MINIMAL_P_H
41#define DBUS_MINIMAL_P_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists for the convenience
48// of other Qt classes. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54extern "C" {
55
56// Equivalent to dbus-arch-deps.h (generated from dbus-arch-deps.h.in)
57typedef qint64 dbus_int64_t;
58typedef quint64 dbus_uint64_t;
59typedef qint32 dbus_int32_t;
60typedef quint32 dbus_uint32_t;
61typedef qint16 dbus_int16_t;
62typedef quint16 dbus_uint16_t;
63
64// simulate minimum version we support
65#define DBUS_MAJOR_VERSION 1
66#define DBUS_MINOR_VERSION 2
67#define DBUS_VERSION ((1 << 16) | (2 << 8))
68
69// forward declaration to opaque types we use
70struct DBusConnection;
71struct DBusMessage;
72struct DBusPendingCall;
73struct DBusServer;
74struct DBusTimeout;
75struct DBusWatch;
76
77// This file contains constants and typedefs from libdbus-1 headers,
78// which carry the following copyright:
79/*
80 * Copyright (C) 2002, 2003 CodeFactory AB
81 * Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
82 *
83 * Licensed under the Academic Free License version 2.1
84 *
85 * This program is free software; you can redistribute it and/or modify
86 * it under the terms of the GNU General Public License as published by
87 * the Free Software Foundation; either version 2 of the License, or
88 * (at your option) any later version.
89 *
90 * This program is distributed in the hope that it will be useful,
91 * but WITHOUT ANY WARRANTY; without even the implied warranty of
92 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 * GNU General Public License for more details.
94 *
95 * You should have received a copy of the GNU General Public License
96 * along with this program; if not, write to the Free Software
97 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
98 *
99 */
100
101/* dbus-types.h */
102typedef dbus_uint32_t dbus_unichar_t;
103typedef dbus_uint32_t dbus_bool_t;
104
105/* dbus-shared.h */
106typedef enum
107{
108 DBUS_BUS_SESSION, /**< The login session bus */
109 DBUS_BUS_SYSTEM, /**< The systemwide bus */
110 DBUS_BUS_STARTER /**< The bus that started us, if any */
111} DBusBusType;
112
113typedef enum
114{
115 DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
116 DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
117 DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
118} DBusHandlerResult;
119
120#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
121#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
122#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
123#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
124#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
125#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
126#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
127
128#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
129#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
130#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */
131
132#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */
133#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */
134#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */
135#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */
136
137#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */
138#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */
139#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */
140
141/* dbus-memory.h */
142typedef void (* DBusFreeFunction) (void *memory);
143
144/* dbus-connection.h */
145typedef enum
146{
147 DBUS_WATCH_READABLE = 1 << 0, /**< As in POLLIN */
148 DBUS_WATCH_WRITABLE = 1 << 1, /**< As in POLLOUT */
149 DBUS_WATCH_ERROR = 1 << 2, /**< As in POLLERR (can't watch for
150 * this, but can be present in
151 * current state passed to
152 * dbus_watch_handle()).
153 */
154 DBUS_WATCH_HANGUP = 1 << 3 /**< As in POLLHUP (can't watch for
155 * it, but can be present in current
156 * state passed to
157 * dbus_watch_handle()).
158 */
159 /* Internal to libdbus, there is also _DBUS_WATCH_NVAL in dbus-watch.h */
160} DBusWatchFlags;
161
162typedef enum
163{
164 DBUS_DISPATCH_DATA_REMAINS, /**< There is more data to potentially convert to messages. */
165 DBUS_DISPATCH_COMPLETE, /**< All currently available data has been processed. */
166 DBUS_DISPATCH_NEED_MEMORY /**< More memory is needed to continue. */
167} DBusDispatchStatus;
168
169typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
170 void *data);
171typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
172 void *data);
173typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
174 void *data);
175typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
176 void *data);
177typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
178 void *data);
179typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
180 void *data);
181typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
182 DBusDispatchStatus new_status,
183 void *data);
184typedef void (* DBusWakeupMainFunction) (void *data);
185typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
186 void *user_data);
187typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
188 DBusMessage *message,
189 void *user_data);
190
191/* dbus-errors.h */
192struct DBusError
193{
194 const char *name; /**< public error name field */
195 const char *message; /**< public error message field */
196
197 unsigned int dummy1 : 1; /**< placeholder */
198 unsigned int dummy2 : 1; /**< placeholder */
199 unsigned int dummy3 : 1; /**< placeholder */
200 unsigned int dummy4 : 1; /**< placeholder */
201 unsigned int dummy5 : 1; /**< placeholder */
202
203 void *padding1; /**< placeholder */
204};
205
206/* dbus-message.h */
207struct DBusMessageIter
208{
209 void *dummy1; /**< Don't use this */
210 void *dummy2; /**< Don't use this */
211 dbus_uint32_t dummy3; /**< Don't use this */
212 int dummy4; /**< Don't use this */
213 int dummy5; /**< Don't use this */
214 int dummy6; /**< Don't use this */
215 int dummy7; /**< Don't use this */
216 int dummy8; /**< Don't use this */
217 int dummy9; /**< Don't use this */
218 int dummy10; /**< Don't use this */
219 int dummy11; /**< Don't use this */
220 int pad1; /**< Don't use this */
221 void *pad2; /**< Don't use this */ /* Was int; changed to void* at 1.10.8 */
222 void *pad3; /**< Don't use this */
223};
224
225/* dbus-protocol.h */
226#define DBUS_TYPE_INVALID ((int) '\0')
227#define DBUS_TYPE_INVALID_AS_STRING "\0"
228#define DBUS_TYPE_BYTE ((int) 'y')
229#define DBUS_TYPE_BYTE_AS_STRING "y"
230#define DBUS_TYPE_BOOLEAN ((int) 'b')
231#define DBUS_TYPE_BOOLEAN_AS_STRING "b"
232#define DBUS_TYPE_INT16 ((int) 'n')
233#define DBUS_TYPE_INT16_AS_STRING "n"
234#define DBUS_TYPE_UINT16 ((int) 'q')
235#define DBUS_TYPE_UINT16_AS_STRING "q"
236#define DBUS_TYPE_INT32 ((int) 'i')
237#define DBUS_TYPE_INT32_AS_STRING "i"
238#define DBUS_TYPE_UINT32 ((int) 'u')
239#define DBUS_TYPE_UINT32_AS_STRING "u"
240#define DBUS_TYPE_INT64 ((int) 'x')
241#define DBUS_TYPE_INT64_AS_STRING "x"
242#define DBUS_TYPE_UINT64 ((int) 't')
243#define DBUS_TYPE_UINT64_AS_STRING "t"
244#define DBUS_TYPE_DOUBLE ((int) 'd')
245#define DBUS_TYPE_DOUBLE_AS_STRING "d"
246#define DBUS_TYPE_STRING ((int) 's')
247#define DBUS_TYPE_STRING_AS_STRING "s"
248#define DBUS_TYPE_OBJECT_PATH ((int) 'o')
249#define DBUS_TYPE_OBJECT_PATH_AS_STRING "o"
250#define DBUS_TYPE_SIGNATURE ((int) 'g')
251#define DBUS_TYPE_SIGNATURE_AS_STRING "g"
252#define DBUS_TYPE_UNIX_FD ((int) 'h')
253#define DBUS_TYPE_UNIX_FD_AS_STRING "h"
254
255#define DBUS_TYPE_ARRAY ((int) 'a')
256#define DBUS_TYPE_ARRAY_AS_STRING "a"
257#define DBUS_TYPE_VARIANT ((int) 'v')
258#define DBUS_TYPE_VARIANT_AS_STRING "v"
259
260#define DBUS_TYPE_STRUCT ((int) 'r')
261#define DBUS_TYPE_STRUCT_AS_STRING "r"
262#define DBUS_TYPE_DICT_ENTRY ((int) 'e')
263#define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
264
265#define DBUS_STRUCT_BEGIN_CHAR ((int) '(')
266#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING "("
267#define DBUS_STRUCT_END_CHAR ((int) ')')
268#define DBUS_STRUCT_END_CHAR_AS_STRING ")"
269#define DBUS_DICT_ENTRY_BEGIN_CHAR ((int) '{')
270#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING "{"
271#define DBUS_DICT_ENTRY_END_CHAR ((int) '}')
272#define DBUS_DICT_ENTRY_END_CHAR_AS_STRING "}"
273
274#define DBUS_MAXIMUM_NAME_LENGTH 255
275
276#define DBUS_MESSAGE_TYPE_INVALID 0
277#define DBUS_MESSAGE_TYPE_METHOD_CALL 1
278#define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
279#define DBUS_MESSAGE_TYPE_ERROR 3
280#define DBUS_MESSAGE_TYPE_SIGNAL 4
281
282#define DBUS_INTROSPECT_1_0_XML_NAMESPACE "http://www.freedesktop.org/standards/dbus"
283#define DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
284#define DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
285#define DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<!DOCTYPE node PUBLIC \"" DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "\"\n\"" DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "\">\n"
286
287/* dbus-server.h */
288typedef void (* DBusNewConnectionFunction) (DBusServer *server,
289 DBusConnection *new_connection,
290 void *data);
291
292} // extern "C"
293
294#endif // DBUS_MINIMAL_P_H
295
296