_dbus_bindings: split out conn, conn-methods into separate translation units
[dbus-python-phuang.git] / _dbus_bindings / dbus_bindings-internal.h
blobbabd2b3996a477a2b534d8859d9a77c6ae37ed3a
1 /* _dbus_bindings internal API. For use within _dbus_bindings only.
3 * Copyright (C) 2006 Collabora Ltd. <http://www.collabora.co.uk/>
5 * Licensed under the Academic Free License version 2.1
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef DBUS_BINDINGS_INTERNAL_H
26 #define DBUS_BINDINGS_INTERNAL_H
28 #include <Python.h>
29 #define INSIDE_DBUS_BINDINGS
30 #include "dbus_bindings.h"
32 /* no need for extern "C", this is only for internal use */
34 /* on/off switch for debugging support (see below) */
35 #undef USING_DBG
36 /* #define USING_DBG */
38 /* conn.c */
39 extern PyTypeObject DBusPyConnectionType;
40 #define DBusPyConnection_Check(o) PyObject_TypeCheck(o, &DBusPyConnectionType)
41 extern PyObject *DBusPyConnection_NewConsumingDBusConnection(PyTypeObject *,
42 DBusConnection *,
43 PyObject *);
44 extern dbus_bool_t dbus_py_init_conn_types(void);
45 extern dbus_bool_t dbus_py_insert_conn_types(PyObject *this_module);
47 /* exceptions.c */
48 extern PyObject *DBusPyException;
49 extern PyObject *DBusPyException_ConsumeError(DBusError *error);
51 /* generic */
52 extern void dbus_py_take_gil_and_xdecref(PyObject *);
54 /* message.c */
55 extern DBusMessage *DBusPyMessage_BorrowDBusMessage(PyObject *msg);
56 extern PyObject *DBusPyMessage_ConsumeDBusMessage(DBusMessage *);
58 /* pending-call.c */
59 extern PyObject *DBusPyPendingCall_ConsumeDBusPendingCall(DBusPendingCall *,
60 PyObject *);
62 /* mainloop.c */
63 extern dbus_bool_t dbus_py_set_up_connection(PyObject *conn,
64 PyObject *mainloop);
65 extern PyObject *dbus_py_get_default_main_loop(void);
67 /* validation.c */
68 dbus_bool_t dbus_py_validate_bus_name(const char *name,
69 dbus_bool_t may_be_unique,
70 dbus_bool_t may_be_not_unique);
71 dbus_bool_t dbus_py_validate_member_name(const char *name);
72 dbus_bool_t dbus_py_validate_interface_name(const char *name);
73 dbus_bool_t dbus_py_validate_object_path(const char *path);
74 #define dbus_py_validate_error_name dbus_py_validate_interface_name
76 /* debugging support */
77 #ifdef USING_DBG
79 # include <sys/types.h>
80 # include <unistd.h>
82 void _dbus_py_dbg_exc(void);
83 void _dbus_py_dbg_dump_message(DBusMessage *);
85 # define DBG(format, ...) fprintf(stderr, "DEBUG: " format "\n",\
86 __VA_ARGS__)
87 # define DBG_EXC(format, ...) do {DBG(format, __VA_ARGS__); \
88 _dbus_py_dbg_exc();} while (0)
89 # define DBG_DUMP_MESSAGE(x) _dbg_dump_message(x)
91 #else /* !defined(USING_DBG) */
93 # define DBG(format, ...) do {} while (0)
94 # define DBG_EXC(format, ...) do {} while (0)
95 # define DBG_DUMP_MESSAGE(x) do {} while(0)
97 #endif /* !defined(USING_DBG) */
99 /* General-purpose Python glue */
101 #define DEFERRED_ADDRESS(ADDR) 0
103 #if defined(__GNUC__)
104 # if __GNUC__ >= 3
105 # define UNUSED __attribute__((__unused__))
106 # else
107 # define UNUSED /*nothing*/
108 # endif
109 #else
110 # define UNUSED /*nothing*/
111 #endif
113 #endif