sl@0: /* -*- mode: C; c-file-style: "gnu" -*- */
sl@0: /* dbus-gutils.h Utils shared between convenience lib and installed lib
sl@0:  *
sl@0:  * Copyright (C) 2003  Red Hat, Inc.
sl@0:  *
sl@0:  * Licensed under the Academic Free License version 2.1
sl@0:  *
sl@0:  * This program is free software; you can redistribute it and/or modify
sl@0:  * it under the terms of the GNU General Public License as published by
sl@0:  * the Free Software Foundation; either version 2 of the License, or
sl@0:  * (at your option) any later version.
sl@0:  *
sl@0:  * This program is distributed in the hope that it will be useful,
sl@0:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
sl@0:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
sl@0:  * GNU General Public License for more details.
sl@0:  *
sl@0:  * You should have received a copy of the GNU General Public License
sl@0:  * along with this program; if not, write to the Free Software
sl@0:  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
sl@0:  *
sl@0:  */
sl@0: 
sl@0: #ifndef DBUS_GLIB_UTILS_H
sl@0: #define DBUS_GLIB_UTILS_H
sl@0: 
sl@0: #ifndef DOXYGEN_SHOULD_SKIP_THIS
sl@0: 
sl@0: #include <dbus/dbus.h>
sl@0: #include <glib-object.h>
sl@0: 
sl@0: G_BEGIN_DECLS
sl@0: 
sl@0: char      **_dbus_gutils_split_path     (const char *path);
sl@0: 
sl@0: char       *_dbus_gutils_wincaps_to_uscore (const char *uscore);
sl@0: 
sl@0: /* These munge the pointer to enforce that a plain cast won't work,
sl@0:  * accessor functions must be used; i.e. to ensure the ABI
sl@0:  * reflects our encapsulation.
sl@0:  */
sl@0: #define _DBUS_POINTER_SHIFT(p)   ((void*) (((char*)p) + sizeof (void*)))
sl@0: #define _DBUS_POINTER_UNSHIFT(p) ((void*) (((char*)p) - sizeof (void*)))
sl@0: 
sl@0: #define DBUS_CONNECTION_FROM_G_CONNECTION(x)     ((DBusConnection*) _DBUS_POINTER_UNSHIFT(x))
sl@0: #define DBUS_MESSAGE_FROM_G_MESSAGE(x)           ((DBusMessage*) _DBUS_POINTER_UNSHIFT(x))
sl@0: #define DBUS_PENDING_CALL_FROM_G_PENDING_CALL(x) ((DBusPendingCall*) _DBUS_POINTER_UNSHIFT(x))
sl@0: 
sl@0: #define DBUS_G_CONNECTION_FROM_CONNECTION(x)     ((DBusGConnection*) _DBUS_POINTER_SHIFT(x))
sl@0: #define DBUS_G_MESSAGE_FROM_MESSAGE(x)           ((DBusGMessage*) _DBUS_POINTER_SHIFT(x))
sl@0: #define DBUS_G_PENDING_CALL_FROM_PENDING_CALL(x) ((DBusGPendingCall*) _DBUS_POINTER_SHIFT(x))
sl@0: 
sl@0: G_END_DECLS
sl@0: 
sl@0: #endif /* DBUS_GLIB_UTILS_H */
sl@0: 
sl@0: #endif /* DOXYGEN_SHOULD_SKIP_THIS */