1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-gutils.h Utils shared between convenience lib and installed lib
4 * Copyright (C) 2003 Red Hat, Inc.
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef DBUS_GLIB_UTILS_H
25 #define DBUS_GLIB_UTILS_H
27 #include <dbus/dbus.h>
28 #include <glib-object.h>
32 char **_dbus_gutils_split_path (const char *path);
34 char *_dbus_gutils_wincaps_to_uscore (const char *uscore);
36 /* These munge the pointer to enforce that a plain cast won't work,
37 * accessor functions must be used; i.e. to ensure the ABI
38 * reflects our encapsulation.
40 #define _DBUS_POINTER_SHIFT(p) ((void*) (((char*)p) + sizeof (void*)))
41 #define _DBUS_POINTER_UNSHIFT(p) ((void*) (((char*)p) - sizeof (void*)))
43 #define DBUS_CONNECTION_FROM_G_CONNECTION(x) ((DBusConnection*) _DBUS_POINTER_UNSHIFT(x))
44 #define DBUS_MESSAGE_FROM_G_MESSAGE(x) ((DBusMessage*) _DBUS_POINTER_UNSHIFT(x))
45 #define DBUS_PENDING_CALL_FROM_G_PENDING_CALL(x) ((DBusPendingCall*) _DBUS_POINTER_UNSHIFT(x))
47 #define DBUS_G_CONNECTION_FROM_CONNECTION(x) ((DBusGConnection*) _DBUS_POINTER_SHIFT(x))
48 #define DBUS_G_MESSAGE_FROM_MESSAGE(x) ((DBusGMessage*) _DBUS_POINTER_SHIFT(x))
49 #define DBUS_G_PENDING_CALL_FROM_PENDING_CALL(x) ((DBusGPendingCall*) _DBUS_POINTER_SHIFT(x))
53 #endif /* DBUS_GLIB_UTILS_H */