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
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) */
36 /* #define USING_DBG */
38 #define DEFINE_CHECK(type) \
39 static inline int type##_Check (PyObject *o) \
41 return (PyObject_TypeCheck (o, &type##_Type)); \
45 extern PyTypeObject DBusPyConnection_Type
;
46 DEFINE_CHECK(DBusPyConnection
)
47 extern PyObject
*DBusPyConnection_NewConsumingDBusConnection(PyTypeObject
*,
50 extern dbus_bool_t
dbus_py_init_conn_types(void);
51 extern dbus_bool_t
dbus_py_insert_conn_types(PyObject
*this_module
);
54 extern dbus_bool_t
dbus_py_init_bus_types(void);
55 extern dbus_bool_t
dbus_py_insert_bus_types(PyObject
*this_module
);
58 extern PyObject
*DBusPyException
;
59 extern PyObject
*DBusPyException_ConsumeError(DBusError
*error
);
60 extern dbus_bool_t
dbus_py_init_exception_types(void);
61 extern dbus_bool_t
dbus_py_insert_exception_types(PyObject
*this_module
);
64 extern PyTypeObject DBusPyBoolean_Type
;
65 DEFINE_CHECK(DBusPyBoolean
)
66 extern PyTypeObject DBusPyObjectPath_Type
, DBusPySignature_Type
;
67 DEFINE_CHECK(DBusPyObjectPath
)
68 DEFINE_CHECK(DBusPySignature
)
69 extern PyTypeObject DBusPyArray_Type
, DBusPyDict_Type
, DBusPyStruct_Type
;
70 DEFINE_CHECK(DBusPyArray
)
71 DEFINE_CHECK(DBusPyDict
)
72 DEFINE_CHECK(DBusPyStruct
)
73 extern PyTypeObject DBusPyByte_Type
, DBusPyByteArray_Type
;
74 DEFINE_CHECK(DBusPyByteArray
)
75 DEFINE_CHECK(DBusPyByte
)
76 extern PyTypeObject DBusPyUTF8String_Type
, DBusPyString_Type
;
77 DEFINE_CHECK(DBusPyUTF8String
)
78 DEFINE_CHECK(DBusPyString
)
79 extern PyTypeObject DBusPyDouble_Type
;
80 DEFINE_CHECK(DBusPyDouble
)
81 extern PyTypeObject DBusPyInt16_Type
, DBusPyUInt16_Type
;
82 DEFINE_CHECK(DBusPyInt16
)
83 DEFINE_CHECK(DBusPyUInt16
)
84 extern PyTypeObject DBusPyInt32_Type
, DBusPyUInt32_Type
;
85 DEFINE_CHECK(DBusPyInt32
)
86 DEFINE_CHECK(DBusPyUInt32
)
87 extern PyTypeObject DBusPyInt64_Type
, DBusPyUInt64_Type
;
88 DEFINE_CHECK(DBusPyInt64
)
89 DEFINE_CHECK(DBusPyUInt64
)
92 extern void dbus_py_take_gil_and_xdecref(PyObject
*);
93 extern PyObject
*dbus_py_empty_tuple
;
96 extern DBusMessage
*DBusPyMessage_BorrowDBusMessage(PyObject
*msg
);
97 extern PyObject
*DBusPyMessage_ConsumeDBusMessage(DBusMessage
*);
98 extern dbus_bool_t
dbus_py_init_message_types(void);
99 extern dbus_bool_t
dbus_py_insert_message_types(PyObject
*this_module
);
102 extern PyObject
*DBusPyPendingCall_ConsumeDBusPendingCall(DBusPendingCall
*,
104 extern dbus_bool_t
dbus_py_init_pending_call(void);
105 extern dbus_bool_t
dbus_py_insert_pending_call(PyObject
*this_module
);
108 extern dbus_bool_t
dbus_py_set_up_connection(PyObject
*conn
,
110 extern PyObject
*dbus_py_get_default_main_loop(void);
113 dbus_bool_t
dbus_py_validate_bus_name(const char *name
,
114 dbus_bool_t may_be_unique
,
115 dbus_bool_t may_be_not_unique
);
116 dbus_bool_t
dbus_py_validate_member_name(const char *name
);
117 dbus_bool_t
dbus_py_validate_interface_name(const char *name
);
118 dbus_bool_t
dbus_py_validate_object_path(const char *path
);
119 #define dbus_py_validate_error_name dbus_py_validate_interface_name
121 /* debugging support */
124 # include <sys/types.h>
127 void _dbus_py_dbg_exc(void);
128 void _dbus_py_dbg_dump_message(DBusMessage
*);
130 # define DBG(format, ...) fprintf(stderr, "DEBUG: " format "\n",\
132 # define DBG_EXC(format, ...) do {DBG(format, __VA_ARGS__); \
133 _dbus_py_dbg_exc();} while (0)
134 # define DBG_DUMP_MESSAGE(x) _dbg_dump_message(x)
136 #else /* !defined(USING_DBG) */
138 # define DBG(format, ...) do {} while (0)
139 # define DBG_EXC(format, ...) do {} while (0)
140 # define DBG_DUMP_MESSAGE(x) do {} while(0)
142 #endif /* !defined(USING_DBG) */
144 /* General-purpose Python glue */
146 #define DEFERRED_ADDRESS(ADDR) 0
148 #if defined(__GNUC__)
150 # define UNUSED __attribute__((__unused__))
152 # define UNUSED /*nothing*/
155 # define UNUSED /*nothing*/