ofdbus/dbus-glib/dbus/dbus-gutils.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /* -*- mode: C; c-file-style: "gnu" -*- */
       
     2 /* dbus-gutils.h Utils shared between convenience lib and installed lib
       
     3  *
       
     4  * Copyright (C) 2003  Red Hat, Inc.
       
     5  *
       
     6  * Licensed under the Academic Free License version 2.1
       
     7  *
       
     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.
       
    12  *
       
    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.
       
    17  *
       
    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    21  *
       
    22  */
       
    23 
       
    24 #ifndef DBUS_GLIB_UTILS_H
       
    25 #define DBUS_GLIB_UTILS_H
       
    26 
       
    27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
       
    28 
       
    29 #include <dbus/dbus.h>
       
    30 #include <glib-object.h>
       
    31 
       
    32 G_BEGIN_DECLS
       
    33 
       
    34 char      **_dbus_gutils_split_path     (const char *path);
       
    35 
       
    36 char       *_dbus_gutils_wincaps_to_uscore (const char *uscore);
       
    37 
       
    38 /* These munge the pointer to enforce that a plain cast won't work,
       
    39  * accessor functions must be used; i.e. to ensure the ABI
       
    40  * reflects our encapsulation.
       
    41  */
       
    42 #define _DBUS_POINTER_SHIFT(p)   ((void*) (((char*)p) + sizeof (void*)))
       
    43 #define _DBUS_POINTER_UNSHIFT(p) ((void*) (((char*)p) - sizeof (void*)))
       
    44 
       
    45 #define DBUS_CONNECTION_FROM_G_CONNECTION(x)     ((DBusConnection*) _DBUS_POINTER_UNSHIFT(x))
       
    46 #define DBUS_MESSAGE_FROM_G_MESSAGE(x)           ((DBusMessage*) _DBUS_POINTER_UNSHIFT(x))
       
    47 #define DBUS_PENDING_CALL_FROM_G_PENDING_CALL(x) ((DBusPendingCall*) _DBUS_POINTER_UNSHIFT(x))
       
    48 
       
    49 #define DBUS_G_CONNECTION_FROM_CONNECTION(x)     ((DBusGConnection*) _DBUS_POINTER_SHIFT(x))
       
    50 #define DBUS_G_MESSAGE_FROM_MESSAGE(x)           ((DBusGMessage*) _DBUS_POINTER_SHIFT(x))
       
    51 #define DBUS_G_PENDING_CALL_FROM_PENDING_CALL(x) ((DBusGPendingCall*) _DBUS_POINTER_SHIFT(x))
       
    52 
       
    53 G_END_DECLS
       
    54 
       
    55 #endif /* DBUS_GLIB_UTILS_H */
       
    56 
       
    57 #endif /* DOXYGEN_SHOULD_SKIP_THIS */