Bug Summary

File:build/temp.linux-x86_64-3.8/../../dbus_bindings/conn-methods.c
Warning:line 756, column 13
PyObject ownership leak with reference count of 1

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name conn-methods.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-output=html -analyzer-checker=python -analyzer-disable-checker=deadcode -analyzer-config prune-paths=true,suppress-c++-stdlib=true,suppress-inlined-defensive-checks=false,suppress-null-return-paths=false,crosscheck-with-z3=true,model-path=/opt/pyrefcon/lib/pyrefcon/models/models -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=/tmp/pyrefcon/dbus-python/csa-scan,ctu-index-name=/tmp/pyrefcon/dbus-python/csa-scan/externalDefMap.txt,ctu-invocation-list=/tmp/pyrefcon/dbus-python/csa-scan/invocations.yaml,display-ctu-progress=false -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -relaxed-aliasing -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/tmp/pyrefcon/dbus-python/build/temp.linux-x86_64-3.8 -resource-dir /opt/pyrefcon/lib/clang/13.0.0 -include config.h -isystem /opt/pyrefcon/lib/pyrefcon/models/python3.8 -D HAVE_CONFIG_H -I . -I /tmp/pyrefcon/dbus-python -I /tmp/pyrefcon/dbus-python/include -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -D PIC -internal-isystem /opt/pyrefcon/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wdeprecated-declarations -Wno-declaration-after-statement -Wno-duplicated-branches -Wno-inline -Wno-redundant-decls -Wno-switch-default -Wno-write-strings -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wimplicit-function-declaration -Wold-style-definition -Wjump-misses-init -Wall -Wextra -Wundef -Wpointer-arith -Wmissing-declarations -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wswitch-enum -Wduplicated-cond -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion -Wno-error=declaration-after-statement -Wno-error=duplicated-branches -Wno-error=inline -Wno-error=redundant-decls -Wno-error=switch-default -Wno-error=write-strings -Wno-error=unused-parameter -Wno-error=missing-field-initializers -fdebug-compilation-dir=/tmp/pyrefcon/dbus-python/build/temp.linux-x86_64-3.8 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/pyrefcon/dbus-python/csa-scan/reports -x c ../../dbus_bindings/conn-methods.c

../../dbus_bindings/conn-methods.c

1/* Implementation of normal Python-accessible methods on the _dbus_bindings
2 * Connection type; separated out to keep the file size manageable.
3 *
4 * Copyright (C) 2006 Collabora Ltd. <http://www.collabora.co.uk/>
5 *
6 * SPDX-License-Identifier: MIT
7 *
8 * Permission is hereby granted, free of charge, to any person
9 * obtaining a copy of this software and associated documentation
10 * files (the "Software"), to deal in the Software without
11 * restriction, including without limitation the rights to use, copy,
12 * modify, merge, publish, distribute, sublicense, and/or sell copies
13 * of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 */
28
29#include "dbus_bindings-internal.h"
30
31#include "conn-internal.h"
32
33static void
34_object_path_unregister(DBusConnection *conn, void *user_data)
35{
36 PyGILState_STATE gil = PyGILState_Ensure();
37 PyObject *tuple = NULL((void*)0);
38 Connection *conn_obj = NULL((void*)0);
39 PyObject *callable;
40
41 conn_obj = (Connection *)DBusPyConnection_ExistingFromDBusConnection(conn);
42 if (!conn_obj) goto out;
43 TRACE(conn_obj)do {} while (0);
44
45 DBG("Connection at %p unregistering object path %s",do {} while (0)
46 conn_obj, PyBytes_AS_STRING((PyObject *)user_data))do {} while (0);
47 tuple = DBusPyConnection_GetObjectPathHandlers(
48 (PyObject *)conn_obj, (PyObject *)user_data);
49 if (!tuple) goto out;
50 if (tuple == Py_None(&_Py_NoneStruct)) goto out;
51
52 DBG("%s", "... yes we have handlers for that object path")do {} while (0);
53
54 /* 0'th item is the unregisterer (if that's a word) */
55 callable = PyTuple_GetItem(tuple, 0);
56 if (callable && callable != Py_None(&_Py_NoneStruct)) {
57 DBG("%s", "... and we even have an unregisterer")do {} while (0);
58 /* any return from the unregisterer is ignored */
59 Py_XDECREF(PyObject_CallFunctionObjArgs(callable, conn_obj, NULL))_Py_XDECREF(((PyObject*)(PyObject_CallFunctionObjArgs(callable
, conn_obj, ((void*)0)))))
;
60 }
61out:
62 Py_CLEAR(conn_obj)do { PyObject *_py_tmp = ((PyObject*)(conn_obj)); if (_py_tmp
!= ((void*)0)) { (conn_obj) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
63 Py_CLEAR(tuple)do { PyObject *_py_tmp = ((PyObject*)(tuple)); if (_py_tmp !=
((void*)0)) { (tuple) = ((void*)0); _Py_DECREF(((PyObject*)(
_py_tmp))); } } while (0)
;
64 /* the user_data (a Python str) is no longer ref'd by the DBusConnection */
65 Py_CLEAR(user_data)do { PyObject *_py_tmp = ((PyObject*)(user_data)); if (_py_tmp
!= ((void*)0)) { (user_data) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
66 if (PyErr_Occurred()) {
67 PyErr_Print();
68 }
69 PyGILState_Release(gil);
70}
71
72static DBusHandlerResult
73_object_path_message(DBusConnection *conn, DBusMessage *message,
74 void *user_data)
75{
76 DBusHandlerResult ret;
77 PyGILState_STATE gil = PyGILState_Ensure();
78 Connection *conn_obj = NULL((void*)0);
79 PyObject *tuple = NULL((void*)0);
80 PyObject *msg_obj;
81 PyObject *callable; /* borrowed */
82
83 dbus_message_ref(message);
84 msg_obj = DBusPyMessage_ConsumeDBusMessage(message);
85 if (!msg_obj) {
86 ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
87 goto out;
88 }
89
90 conn_obj = (Connection *)DBusPyConnection_ExistingFromDBusConnection(conn);
91 if (!conn_obj) {
92 ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
93 goto out;
94 }
95 TRACE(conn_obj)do {} while (0);
96
97 DBG("Connection at %p messaging object path %s",do {} while (0)
98 conn_obj, PyBytes_AS_STRING((PyObject *)user_data))do {} while (0);
99 DBG_DUMP_MESSAGE(message)do {} while (0);
100 tuple = DBusPyConnection_GetObjectPathHandlers(
101 (PyObject *)conn_obj, (PyObject *)user_data);
102 if (!tuple || tuple == Py_None(&_Py_NoneStruct)) {
103 ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
104 goto out;
105 }
106
107 DBG("%s", "... yes we have handlers for that object path")do {} while (0);
108
109 /* 1st item (0-based) is the message callback */
110 callable = PyTuple_GetItem(tuple, 1);
111 if (!callable) {
112 DBG("%s", "... error getting message handler from tuple")do {} while (0);
113 ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
114 }
115 else if (callable == Py_None(&_Py_NoneStruct)) {
116 /* there was actually no handler after all */
117 DBG("%s", "... but those handlers don't do messages")do {} while (0);
118 ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
119 }
120 else {
121 DBG("%s", "... and we have a message handler for that object path")do {} while (0);
122 ret = DBusPyConnection_HandleMessage(conn_obj, msg_obj, callable);
123 }
124
125out:
126 Py_CLEAR(msg_obj)do { PyObject *_py_tmp = ((PyObject*)(msg_obj)); if (_py_tmp !=
((void*)0)) { (msg_obj) = ((void*)0); _Py_DECREF(((PyObject*
)(_py_tmp))); } } while (0)
;
127 Py_CLEAR(conn_obj)do { PyObject *_py_tmp = ((PyObject*)(conn_obj)); if (_py_tmp
!= ((void*)0)) { (conn_obj) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
128 Py_CLEAR(tuple)do { PyObject *_py_tmp = ((PyObject*)(tuple)); if (_py_tmp !=
((void*)0)) { (tuple) = ((void*)0); _Py_DECREF(((PyObject*)(
_py_tmp))); } } while (0)
;
129 if (PyErr_Occurred()) {
130 PyErr_Print();
131 }
132 PyGILState_Release(gil);
133 return ret;
134}
135
136static const DBusObjectPathVTable _object_path_vtable = {
137 _object_path_unregister,
138 _object_path_message,
139};
140
141static DBusHandlerResult
142_filter_message(DBusConnection *conn, DBusMessage *message, void *user_data)
143{
144 DBusHandlerResult ret;
145 PyGILState_STATE gil = PyGILState_Ensure();
146 Connection *conn_obj = NULL((void*)0);
147 PyObject *callable = NULL((void*)0);
148 PyObject *msg_obj;
149#ifndef DBUS_PYTHON_DISABLE_CHECKS
150 Py_ssize_t i, size;
151#endif
152
153 dbus_message_ref(message);
154 msg_obj = DBusPyMessage_ConsumeDBusMessage(message);
155 if (!msg_obj) {
156 DBG("%s", "OOM while trying to construct Message")do {} while (0);
157 ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
158 goto out;
159 }
160
161 conn_obj = (Connection *)DBusPyConnection_ExistingFromDBusConnection(conn);
162 if (!conn_obj) {
163 DBG("%s", "failed to traverse DBusConnection -> Connection weakref")do {} while (0);
164 ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
165 goto out;
166 }
167 TRACE(conn_obj)do {} while (0);
168
169 /* The user_data is a pointer to a Python object. To avoid
170 * cross-library reference cycles, the DBusConnection isn't allowed
171 * to reference it. However, as long as the Connection is still
172 * alive, its ->filters list owns a reference to the same Python
173 * object, so the object should also still be alive.
174 *
175 * To ensure that this works, be careful whenever manipulating the
176 * filters list! (always put things in the list *before* giving
177 * them to libdbus, etc.)
178 */
179#ifdef DBUS_PYTHON_DISABLE_CHECKS
180 callable = (PyObject *)user_data;
181#else
182 size = PyList_GET_SIZE(conn_obj->filters)((((PyVarObject*)(conn_obj->filters))->ob_size));
183 for (i = 0; i < size; i++) {
184 callable = PyList_GET_ITEM(conn_obj->filters, i)(((PyListObject *)(conn_obj->filters))->ob_item[i]);
185 if (callable == user_data) {
186 Py_INCREF(callable)_Py_INCREF(((PyObject*)(callable)));
187 break;
188 }
189 else {
190 callable = NULL((void*)0);
191 }
192 }
193
194 if (!callable) {
195 DBG("... filter %p has vanished from ->filters, so not calling it",do {} while (0)
196 user_data)do {} while (0);
197 ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
198 goto out;
199 }
200#endif
201
202 ret = DBusPyConnection_HandleMessage(conn_obj, msg_obj, callable);
203out:
204 Py_CLEAR(msg_obj)do { PyObject *_py_tmp = ((PyObject*)(msg_obj)); if (_py_tmp !=
((void*)0)) { (msg_obj) = ((void*)0); _Py_DECREF(((PyObject*
)(_py_tmp))); } } while (0)
;
205 Py_CLEAR(conn_obj)do { PyObject *_py_tmp = ((PyObject*)(conn_obj)); if (_py_tmp
!= ((void*)0)) { (conn_obj) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
206 Py_CLEAR(callable)do { PyObject *_py_tmp = ((PyObject*)(callable)); if (_py_tmp
!= ((void*)0)) { (callable) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
207 PyGILState_Release(gil);
208 return ret;
209}
210
211PyDoc_STRVAR(Connection__require_main_loop__doc__,static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
212"_require_main_loop()\n\n"static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
213"Raise an exception if this Connection is not bound to any main loop -\n"static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
214"in this state, asynchronous calls, receiving signals and exporting objects\n"static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
215"will not work.\n"static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
216"\n"static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
217"`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
218"using that, you presumably know what you're doing.\n")static const char Connection__require_main_loop__doc__[] = "_require_main_loop()\n\n"
"Raise an exception if this Connection is not bound to any main loop -\n"
"in this state, asynchronous calls, receiving signals and exporting objects\n"
"will not work.\n""\n""`dbus.mainloop.NULL_MAIN_LOOP` is treated like a valid main loop - if you're\n"
"using that, you presumably know what you're doing.\n"
;
219static PyObject *
220Connection__require_main_loop (Connection *self, PyObject *args UNUSED__attribute__((__unused__)))
221{
222 if (!self->has_mainloop) {
223 PyErr_SetString(PyExc_RuntimeError,
224 "To make asynchronous calls, receive signals or "
225 "export objects, D-Bus connections must be attached "
226 "to a main loop by passing mainloop=... to the "
227 "constructor or calling "
228 "dbus.set_default_main_loop(...)");
229 return NULL((void*)0);
230 }
231 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
232}
233
234PyDoc_STRVAR(Connection_close__doc__,static const char Connection_close__doc__[] = "close()\n\n""Close the connection."
235"close()\n\n"static const char Connection_close__doc__[] = "close()\n\n""Close the connection."
236"Close the connection.")static const char Connection_close__doc__[] = "close()\n\n""Close the connection.";
237static PyObject *
238Connection_close (Connection *self, PyObject *args UNUSED__attribute__((__unused__)))
239{
240 TRACE(self)do {} while (0);
241 /* Because the user explicitly asked to close the connection, we'll even
242 let them close shared connections. */
243 if (self->conn) {
244 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
245 dbus_connection_close(self->conn);
246 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
247 }
248 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
249}
250
251PyDoc_STRVAR(Connection_get_is_connected__doc__,static const char Connection_get_is_connected__doc__[] = "get_is_connected() -> bool\n\n"
"Return true if this Connection is connected.\n"
252"get_is_connected() -> bool\n\n"static const char Connection_get_is_connected__doc__[] = "get_is_connected() -> bool\n\n"
"Return true if this Connection is connected.\n"
253"Return true if this Connection is connected.\n")static const char Connection_get_is_connected__doc__[] = "get_is_connected() -> bool\n\n"
"Return true if this Connection is connected.\n"
;
254static PyObject *
255Connection_get_is_connected (Connection *self, PyObject *args UNUSED__attribute__((__unused__)))
256{
257 dbus_bool_t ret;
258
259 TRACE(self)do {} while (0);
260 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
261 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
262 ret = dbus_connection_get_is_connected(self->conn);
263 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
264 return PyBool_FromLong(ret);
265}
266
267PyDoc_STRVAR(Connection_get_is_authenticated__doc__,static const char Connection_get_is_authenticated__doc__[] = "get_is_authenticated() -> bool\n\n"
"Return true if this Connection was ever authenticated.\n"
268"get_is_authenticated() -> bool\n\n"static const char Connection_get_is_authenticated__doc__[] = "get_is_authenticated() -> bool\n\n"
"Return true if this Connection was ever authenticated.\n"
269"Return true if this Connection was ever authenticated.\n")static const char Connection_get_is_authenticated__doc__[] = "get_is_authenticated() -> bool\n\n"
"Return true if this Connection was ever authenticated.\n"
;
270static PyObject *
271Connection_get_is_authenticated (Connection *self, PyObject *args UNUSED__attribute__((__unused__)))
272{
273 dbus_bool_t ret;
274
275 TRACE(self)do {} while (0);
276 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
277 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
278 ret = dbus_connection_get_is_authenticated(self->conn);
279 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
280 return PyBool_FromLong(ret);
281}
282
283PyDoc_STRVAR(Connection_set_exit_on_disconnect__doc__,static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
284"set_exit_on_disconnect(bool)\n\n"static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
285"Set whether the C function ``_exit`` will be called when this Connection\n"static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
286"becomes disconnected. This will cause the program to exit without calling\n"static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
287"any cleanup code or exit handlers.\n"static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
288"\n"static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
289"The default is for this feature to be disabled for Connections and enabled\n"static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
290"for Buses.\n")static const char Connection_set_exit_on_disconnect__doc__[] =
"set_exit_on_disconnect(bool)\n\n""Set whether the C function ``_exit`` will be called when this Connection\n"
"becomes disconnected. This will cause the program to exit without calling\n"
"any cleanup code or exit handlers.\n""\n""The default is for this feature to be disabled for Connections and enabled\n"
"for Buses.\n"
;
291static PyObject *
292Connection_set_exit_on_disconnect (Connection *self, PyObject *args)
293{
294 int exit_on_disconnect;
295
296 TRACE(self)do {} while (0);
297 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
298 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "i:set_exit_on_disconnect",
299 &exit_on_disconnect)) {
300 return NULL((void*)0);
301 }
302 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
303 dbus_connection_set_exit_on_disconnect(self->conn,
304 exit_on_disconnect ? 1 : 0);
305 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
306 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
307}
308
309PyDoc_STRVAR(Connection_send_message__doc__,static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
310"send_message(msg) -> long\n\n"static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
311"Queue the given message for sending, and return the message serial number.\n"static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
312"\n"static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
313":Parameters:\n"static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
314" `msg` : dbus.lowlevel.Message\n"static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
315" The message to be sent.\n"static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
316)static const char Connection_send_message__doc__[] = "send_message(msg) -> long\n\n"
"Queue the given message for sending, and return the message serial number.\n"
"\n"":Parameters:\n"" `msg` : dbus.lowlevel.Message\n"" The message to be sent.\n"
;
317static PyObject *
318Connection_send_message(Connection *self, PyObject *args)
319{
320 dbus_bool_t ok;
321 PyObject *obj;
322 DBusMessage *msg;
323 dbus_uint32_t serial;
324
325 TRACE(self)do {} while (0);
326 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
327 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "O", &obj)) return NULL((void*)0);
328
329 msg = DBusPyMessage_BorrowDBusMessage(obj);
330 if (!msg) return NULL((void*)0);
331
332 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
333 ok = dbus_connection_send(self->conn, msg, &serial);
334 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
335
336 if (!ok) {
337 return PyErr_NoMemory();
338 }
339
340 return PyLong_FromUnsignedLong(serial);
341}
342
343PyDoc_STRVAR(Connection_set_allow_anonymous__doc__,static const char Connection_set_allow_anonymous__doc__[] = "set_allow_anonymous(bool)\n\n"
"Allows anonymous clients. Call this on the server side of a connection in a on_connection_added callback"
344"set_allow_anonymous(bool)\n\n"static const char Connection_set_allow_anonymous__doc__[] = "set_allow_anonymous(bool)\n\n"
"Allows anonymous clients. Call this on the server side of a connection in a on_connection_added callback"
345"Allows anonymous clients. Call this on the server side of a connection in a on_connection_added callback"static const char Connection_set_allow_anonymous__doc__[] = "set_allow_anonymous(bool)\n\n"
"Allows anonymous clients. Call this on the server side of a connection in a on_connection_added callback"
346)static const char Connection_set_allow_anonymous__doc__[] = "set_allow_anonymous(bool)\n\n"
"Allows anonymous clients. Call this on the server side of a connection in a on_connection_added callback"
;
347static PyObject *
348Connection_set_allow_anonymous(Connection *self, PyObject *args)
349{
350 dbus_bool_t t;
351
352 TRACE(self)do {} while (0);
353 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
354 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "i", &t)) {
355 return NULL((void*)0);
356 }
357
358 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
359 dbus_connection_set_allow_anonymous(self->conn, t ? 1 : 0);
360 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
361 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
362}
363
364/* The timeout is in seconds here, since that's conventional in Python. */
365PyDoc_STRVAR(Connection_send_message_with_reply__doc__,static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
366"send_message_with_reply(msg, reply_handler, timeout_s=-1, "static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
367"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
368"Queue the message for sending; expect a reply via the returned PendingCall,\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
369"which can also be used to cancel the pending call.\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
370"\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
371":Parameters:\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
372" `msg` : dbus.lowlevel.Message\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
373" The message to be sent\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
374" `reply_handler` : callable\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
375" Asynchronous reply handler: will be called with one positional\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
376" parameter, a Message instance representing the reply.\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
377" `timeout_s` : float\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
378" If the reply takes more than this many seconds, a timeout error\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
379" will be created locally and raised instead. If this timeout is\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
380" negative (default), a sane default (supplied by libdbus) is used.\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
381" `require_main_loop` : bool\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
382" If True, raise RuntimeError if this Connection does not have a main\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
383" loop configured. If False (default) and there is no main loop, you are\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
384" responsible for calling block() on the PendingCall.\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
385"\n"static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
386)static const char Connection_send_message_with_reply__doc__[]
= "send_message_with_reply(msg, reply_handler, timeout_s=-1, "
"require_main_loop=False) -> dbus.lowlevel.PendingCall\n\n"
"Queue the message for sending; expect a reply via the returned PendingCall,\n"
"which can also be used to cancel the pending call.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `reply_handler` : callable\n"" Asynchronous reply handler: will be called with one positional\n"
" parameter, a Message instance representing the reply.\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
" `require_main_loop` : bool\n"" If True, raise RuntimeError if this Connection does not have a main\n"
" loop configured. If False (default) and there is no main loop, you are\n"
" responsible for calling block() on the PendingCall.\n"
"\n"
;
387static PyObject *
388Connection_send_message_with_reply(Connection *self, PyObject *args, PyObject *kw)
389{
390 dbus_bool_t ok;
391 double timeout_s = -1.0;
392 int timeout_ms;
393 PyObject *obj, *callable;
394 DBusMessage *msg;
395 DBusPendingCall *pending;
396 int require_main_loop = 0;
397 static char *argnames[] = {"msg", "reply_handler", "timeout_s",
398 "require_main_loop", NULL((void*)0)};
399
400 TRACE(self)do {} while (0);
401 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
402 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kw,
403 "OO|di:send_message_with_reply",
404 argnames,
405 &obj, &callable, &timeout_s,
406 &require_main_loop)) {
407 return NULL((void*)0);
408 }
409 if (require_main_loop && !Connection__require_main_loop(self, NULL((void*)0))) {
410 return NULL((void*)0);
411 }
412
413 msg = DBusPyMessage_BorrowDBusMessage(obj);
414 if (!msg) return NULL((void*)0);
415
416 if (timeout_s < 0) {
417 timeout_ms = -1;
418 }
419 else {
420 if (timeout_s > ((double)INT_MAX2147483647) / 1000.0) {
421 PyErr_SetString(PyExc_ValueError, "Timeout too long");
422 return NULL((void*)0);
423 }
424 timeout_ms = (int)(timeout_s * 1000.0);
425 }
426
427 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
428 ok = dbus_connection_send_with_reply(self->conn, msg, &pending,
429 timeout_ms);
430 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
431
432 if (!ok) {
433 return PyErr_NoMemory();
434 }
435
436 if (!pending) {
437 /* connection is disconnected (doesn't return FALSE!) */
438 return DBusPyException_SetString ("Connection is disconnected - "
439 "unable to make method call");
440 }
441
442 return DBusPyPendingCall_ConsumeDBusPendingCall(pending, callable);
443}
444
445/* Again, the timeout is in seconds, since that's conventional in Python. */
446PyDoc_STRVAR(Connection_send_message_with_reply_and_block__doc__,static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
447"send_message_with_reply_and_block(msg, timeout_s=-1)"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
448" -> dbus.lowlevel.Message\n\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
449"Send the message and block while waiting for a reply.\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
450"\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
451"This does not re-enter the main loop, so it can lead to a deadlock, if\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
452"the called method tries to make a synchronous call to a method in this\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
453"application. As such, it's probably a bad idea.\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
454"\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
455":Parameters:\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
456" `msg` : dbus.lowlevel.Message\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
457" The message to be sent\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
458" `timeout_s` : float\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
459" If the reply takes more than this many seconds, a timeout error\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
460" will be created locally and raised instead. If this timeout is\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
461" negative (default), a sane default (supplied by libdbus) is used.\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
462":Returns:\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
463" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
464":Raises dbus.DBusException:\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
465" On error (including if the reply arrives but is an\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
466" error message)\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
467"\n"static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
468)static const char Connection_send_message_with_reply_and_block__doc__
[] = "send_message_with_reply_and_block(msg, timeout_s=-1)"" -> dbus.lowlevel.Message\n\n"
"Send the message and block while waiting for a reply.\n""\n"
"This does not re-enter the main loop, so it can lead to a deadlock, if\n"
"the called method tries to make a synchronous call to a method in this\n"
"application. As such, it's probably a bad idea.\n""\n"":Parameters:\n"
" `msg` : dbus.lowlevel.Message\n"" The message to be sent\n"
" `timeout_s` : float\n"" If the reply takes more than this many seconds, a timeout error\n"
" will be created locally and raised instead. If this timeout is\n"
" negative (default), a sane default (supplied by libdbus) is used.\n"
":Returns:\n"" A `dbus.lowlevel.Message` instance (probably a `dbus.lowlevel.MethodReturnMessage`) on success\n"
":Raises dbus.DBusException:\n"" On error (including if the reply arrives but is an\n"
" error message)\n""\n"
;
469static PyObject *
470Connection_send_message_with_reply_and_block(Connection *self, PyObject *args)
471{
472 double timeout_s = -1.0;
473 int timeout_ms;
474 PyObject *obj;
475 DBusMessage *msg, *reply;
476 DBusError error;
477
478 TRACE(self)do {} while (0);
479 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
480 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "O|d:send_message_with_reply_and_block", &obj,
481 &timeout_s)) {
482 return NULL((void*)0);
483 }
484
485 msg = DBusPyMessage_BorrowDBusMessage(obj);
486 if (!msg) return NULL((void*)0);
487
488 if (timeout_s < 0) {
489 timeout_ms = -1;
490 }
491 else {
492 if (timeout_s > ((double)INT_MAX2147483647) / 1000.0) {
493 PyErr_SetString(PyExc_ValueError, "Timeout too long");
494 return NULL((void*)0);
495 }
496 timeout_ms = (int)(timeout_s * 1000.0);
497 }
498
499 dbus_error_init(&error);
500 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
501 reply = dbus_connection_send_with_reply_and_block(self->conn, msg,
502 timeout_ms, &error);
503 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
504
505 /* FIXME: if we instead used send_with_reply and blocked on the resulting
506 * PendingCall, then we could get all args from the error, not just
507 * the first */
508 if (!reply) {
509 return DBusPyException_ConsumeError(&error);
510 }
511 return DBusPyMessage_ConsumeDBusMessage(reply);
512}
513
514PyDoc_STRVAR(Connection_flush__doc__,static const char Connection_flush__doc__[] = "flush()\n\n""Block until the outgoing message queue is empty.\n"
515"flush()\n\n"static const char Connection_flush__doc__[] = "flush()\n\n""Block until the outgoing message queue is empty.\n"
516"Block until the outgoing message queue is empty.\n")static const char Connection_flush__doc__[] = "flush()\n\n""Block until the outgoing message queue is empty.\n";
517static PyObject *
518Connection_flush (Connection *self, PyObject *args UNUSED__attribute__((__unused__)))
519{
520 TRACE(self)do {} while (0);
521 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
522 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
523 dbus_connection_flush (self->conn);
524 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
525 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
526}
527
528/* Unsupported:
529 * dbus_connection_preallocate_send
530 * dbus_connection_free_preallocated_send
531 * dbus_connection_send_preallocated
532 * dbus_connection_borrow_message
533 * dbus_connection_return_message
534 * dbus_connection_steal_borrowed_message
535 * dbus_connection_pop_message
536 */
537
538/* Non-main-loop handling not yet implemented: */
539 /* dbus_connection_read_write_dispatch */
540 /* dbus_connection_read_write */
541
542/* Main loop handling not yet implemented: */
543 /* dbus_connection_get_dispatch_status */
544 /* dbus_connection_dispatch */
545 /* dbus_connection_set_watch_functions */
546 /* dbus_connection_set_timeout_functions */
547 /* dbus_connection_set_wakeup_main_function */
548 /* dbus_connection_set_dispatch_status_function */
549
550/* Normally in Python this would be called fileno(), but I don't want to
551 * encourage people to select() on it */
552PyDoc_STRVAR(Connection_get_unix_fd__doc__,static const char Connection_get_unix_fd__doc__[] = "get_unix_fd() -> int or None\n\n"
"Get the connection's UNIX file descriptor, if any.\n\n""This can be used for SELinux access control checks with ``getpeercon()``\n"
"for example. **Do not** read or write to the file descriptor, or try to\n"
"``select()`` on it.\n"
553"get_unix_fd() -> int or None\n\n"static const char Connection_get_unix_fd__doc__[] = "get_unix_fd() -> int or None\n\n"
"Get the connection's UNIX file descriptor, if any.\n\n""This can be used for SELinux access control checks with ``getpeercon()``\n"
"for example. **Do not** read or write to the file descriptor, or try to\n"
"``select()`` on it.\n"
554"Get the connection's UNIX file descriptor, if any.\n\n"static const char Connection_get_unix_fd__doc__[] = "get_unix_fd() -> int or None\n\n"
"Get the connection's UNIX file descriptor, if any.\n\n""This can be used for SELinux access control checks with ``getpeercon()``\n"
"for example. **Do not** read or write to the file descriptor, or try to\n"
"``select()`` on it.\n"
555"This can be used for SELinux access control checks with ``getpeercon()``\n"static const char Connection_get_unix_fd__doc__[] = "get_unix_fd() -> int or None\n\n"
"Get the connection's UNIX file descriptor, if any.\n\n""This can be used for SELinux access control checks with ``getpeercon()``\n"
"for example. **Do not** read or write to the file descriptor, or try to\n"
"``select()`` on it.\n"
556"for example. **Do not** read or write to the file descriptor, or try to\n"static const char Connection_get_unix_fd__doc__[] = "get_unix_fd() -> int or None\n\n"
"Get the connection's UNIX file descriptor, if any.\n\n""This can be used for SELinux access control checks with ``getpeercon()``\n"
"for example. **Do not** read or write to the file descriptor, or try to\n"
"``select()`` on it.\n"
557"``select()`` on it.\n")static const char Connection_get_unix_fd__doc__[] = "get_unix_fd() -> int or None\n\n"
"Get the connection's UNIX file descriptor, if any.\n\n""This can be used for SELinux access control checks with ``getpeercon()``\n"
"for example. **Do not** read or write to the file descriptor, or try to\n"
"``select()`` on it.\n"
;
558static PyObject *
559Connection_get_unix_fd (Connection *self, PyObject *unused UNUSED__attribute__((__unused__)))
560{
561 int fd;
562 dbus_bool_t ok;
563
564 TRACE(self)do {} while (0);
565 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
566 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
567 ok = dbus_connection_get_unix_fd (self->conn, &fd);
568 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
569 if (!ok) Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
570 return PyLong_FromLong(fd);
571}
572
573PyDoc_STRVAR(Connection_get_peer_unix_user__doc__,static const char Connection_get_peer_unix_user__doc__[] = "get_peer_unix_user() -> long or None\n\n"
"Get the UNIX user ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
574"get_peer_unix_user() -> long or None\n\n"static const char Connection_get_peer_unix_user__doc__[] = "get_peer_unix_user() -> long or None\n\n"
"Get the UNIX user ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
575"Get the UNIX user ID at the other end of the connection, if it has been\n"static const char Connection_get_peer_unix_user__doc__[] = "get_peer_unix_user() -> long or None\n\n"
"Get the UNIX user ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
576"authenticated. Return None if this is a non-UNIX platform or the\n"static const char Connection_get_peer_unix_user__doc__[] = "get_peer_unix_user() -> long or None\n\n"
"Get the UNIX user ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
577"connection has not been authenticated.\n")static const char Connection_get_peer_unix_user__doc__[] = "get_peer_unix_user() -> long or None\n\n"
"Get the UNIX user ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
;
578static PyObject *
579Connection_get_peer_unix_user (Connection *self, PyObject *unused UNUSED__attribute__((__unused__)))
580{
581 unsigned long uid;
582 dbus_bool_t ok;
583
584 TRACE(self)do {} while (0);
585 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
586 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
587 ok = dbus_connection_get_unix_user (self->conn, &uid);
588 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
589 if (!ok) Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
590 return PyLong_FromUnsignedLong (uid);
591}
592
593PyDoc_STRVAR(Connection_get_peer_unix_process_id__doc__,static const char Connection_get_peer_unix_process_id__doc__[
] = "get_peer_unix_process_id() -> long or None\n\n""Get the UNIX process ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
594"get_peer_unix_process_id() -> long or None\n\n"static const char Connection_get_peer_unix_process_id__doc__[
] = "get_peer_unix_process_id() -> long or None\n\n""Get the UNIX process ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
595"Get the UNIX process ID at the other end of the connection, if it has been\n"static const char Connection_get_peer_unix_process_id__doc__[
] = "get_peer_unix_process_id() -> long or None\n\n""Get the UNIX process ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
596"authenticated. Return None if this is a non-UNIX platform or the\n"static const char Connection_get_peer_unix_process_id__doc__[
] = "get_peer_unix_process_id() -> long or None\n\n""Get the UNIX process ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
597"connection has not been authenticated.\n")static const char Connection_get_peer_unix_process_id__doc__[
] = "get_peer_unix_process_id() -> long or None\n\n""Get the UNIX process ID at the other end of the connection, if it has been\n"
"authenticated. Return None if this is a non-UNIX platform or the\n"
"connection has not been authenticated.\n"
;
598static PyObject *
599Connection_get_peer_unix_process_id (Connection *self, PyObject *unused UNUSED__attribute__((__unused__)))
600{
601 unsigned long pid;
602 dbus_bool_t ok;
603
604 TRACE(self)do {} while (0);
605 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
606 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
607 ok = dbus_connection_get_unix_process_id (self->conn, &pid);
608 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
609 if (!ok) Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
610 return PyLong_FromUnsignedLong (pid);
611}
612
613/* TODO: wrap dbus_connection_set_unix_user_function Pythonically */
614
615PyDoc_STRVAR(Connection_add_message_filter__doc__,static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
616"add_message_filter(callable)\n\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
617"Add the given message filter to the internal list.\n\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
618"Filters are handlers that are run on all incoming messages, prior to the\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
619"objects registered to handle object paths.\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
620"\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
621"Filters are run in the order that they were added. The same handler can\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
622"be added as a filter more than once, in which case it will be run more\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
623"than once. Filters added during a filter callback won't be run on the\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
624"message being processed.\n"static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
625)static const char Connection_add_message_filter__doc__[] = "add_message_filter(callable)\n\n"
"Add the given message filter to the internal list.\n\n""Filters are handlers that are run on all incoming messages, prior to the\n"
"objects registered to handle object paths.\n""\n""Filters are run in the order that they were added. The same handler can\n"
"be added as a filter more than once, in which case it will be run more\n"
"than once. Filters added during a filter callback won't be run on the\n"
"message being processed.\n"
;
626static PyObject *
627Connection_add_message_filter(Connection *self, PyObject *callable)
628{
629 dbus_bool_t ok;
630
631 TRACE(self)do {} while (0);
632 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
633 /* The callable must be referenced by ->filters *before* it is
634 * given to libdbus, which does not own a reference to it.
635 */
636 if (PyList_Append(self->filters, callable) < 0) {
637 return NULL((void*)0);
638 }
639
640 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
641 ok = dbus_connection_add_filter(self->conn, _filter_message, callable,
642 NULL((void*)0));
643 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
644
645 if (!ok) {
646 Py_XDECREF(PyObject_CallMethod(self->filters, "remove", "(O)",_Py_XDECREF(((PyObject*)(_PyObject_CallMethod_SizeT(self->
filters, "remove", "(O)", callable))))
647 callable))_Py_XDECREF(((PyObject*)(_PyObject_CallMethod_SizeT(self->
filters, "remove", "(O)", callable))))
;
648 PyErr_NoMemory();
649 return NULL((void*)0);
650 }
651 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
652}
653
654PyDoc_STRVAR(Connection_remove_message_filter__doc__,static const char Connection_remove_message_filter__doc__[] =
"remove_message_filter(callable)\n\n""Remove the given message filter (see `add_message_filter` for details).\n"
"\n"":Raises LookupError:\n"" The given callable is not among the registered filters\n"
655"remove_message_filter(callable)\n\n"static const char Connection_remove_message_filter__doc__[] =
"remove_message_filter(callable)\n\n""Remove the given message filter (see `add_message_filter` for details).\n"
"\n"":Raises LookupError:\n"" The given callable is not among the registered filters\n"
656"Remove the given message filter (see `add_message_filter` for details).\n"static const char Connection_remove_message_filter__doc__[] =
"remove_message_filter(callable)\n\n""Remove the given message filter (see `add_message_filter` for details).\n"
"\n"":Raises LookupError:\n"" The given callable is not among the registered filters\n"
657"\n"static const char Connection_remove_message_filter__doc__[] =
"remove_message_filter(callable)\n\n""Remove the given message filter (see `add_message_filter` for details).\n"
"\n"":Raises LookupError:\n"" The given callable is not among the registered filters\n"
658":Raises LookupError:\n"static const char Connection_remove_message_filter__doc__[] =
"remove_message_filter(callable)\n\n""Remove the given message filter (see `add_message_filter` for details).\n"
"\n"":Raises LookupError:\n"" The given callable is not among the registered filters\n"
659" The given callable is not among the registered filters\n")static const char Connection_remove_message_filter__doc__[] =
"remove_message_filter(callable)\n\n""Remove the given message filter (see `add_message_filter` for details).\n"
"\n"":Raises LookupError:\n"" The given callable is not among the registered filters\n"
;
660static PyObject *
661Connection_remove_message_filter(Connection *self, PyObject *callable)
662{
663 PyObject *obj;
664
665 TRACE(self)do {} while (0);
666 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
667 /* It's safe to do this before removing it from libdbus, because
668 * the presence of callable in our arguments means we have a ref
669 * to it. */
670 obj = PyObject_CallMethod_PyObject_CallMethod_SizeT(self->filters, "remove", "(O)", callable);
671 if (!obj) return NULL((void*)0);
672 Py_CLEAR(obj)do { PyObject *_py_tmp = ((PyObject*)(obj)); if (_py_tmp != (
(void*)0)) { (obj) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
673
674 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
675 dbus_connection_remove_filter(self->conn, _filter_message, callable);
676 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
677
678 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
679}
680
681PyDoc_STRVAR(Connection__register_object_path__doc__,static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
682"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
683"\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
684"Register a callback to be called when messages arrive at the given\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
685"object-path. Used to export objects' methods on the bus in a low-level\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
686"way. For the high-level interface to this functionality (usually\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
687"recommended) see the `dbus.service.Object` base class.\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
688"\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
689":Parameters:\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
690" `path` : str\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
691" Object path to be acted on\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
692" `on_message` : callable\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
693" Called when a message arrives at the given object-path, with\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
694" two positional parameters: the first is this Connection,\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
695" the second is the incoming `dbus.lowlevel.Message`.\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
696" `on_unregister` : callable or None\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
697" If not None, called when the callback is unregistered.\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
698" `fallback` : bool\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
699" If True (the default is False), when a message arrives for a\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
700" 'subdirectory' of the given path and there is no more specific\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
701" handler, use this handler. Normally this handler is only run if\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
702" the paths match exactly.\n"static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
703)static const char Connection__register_object_path__doc__[] =
"register_object_path(path, on_message, on_unregister=None, fallback=False)\n"
"\n""Register a callback to be called when messages arrive at the given\n"
"object-path. Used to export objects' methods on the bus in a low-level\n"
"way. For the high-level interface to this functionality (usually\n"
"recommended) see the `dbus.service.Object` base class.\n""\n"
":Parameters:\n"" `path` : str\n"" Object path to be acted on\n"
" `on_message` : callable\n"" Called when a message arrives at the given object-path, with\n"
" two positional parameters: the first is this Connection,\n"
" the second is the incoming `dbus.lowlevel.Message`.\n"
" `on_unregister` : callable or None\n"" If not None, called when the callback is unregistered.\n"
" `fallback` : bool\n"" If True (the default is False), when a message arrives for a\n"
" 'subdirectory' of the given path and there is no more specific\n"
" handler, use this handler. Normally this handler is only run if\n"
" the paths match exactly.\n"
;
704static PyObject *
705Connection__register_object_path(Connection *self, PyObject *args,
706 PyObject *kwargs)
707{
708 dbus_bool_t ok;
709 int fallback = 0;
710 char *path_bytes;
711 PyObject *callbacks, *path, *tuple, *on_message, *on_unregister = Py_None(&_Py_NoneStruct);
712 static char *argnames[] = {"path", "on_message", "on_unregister",
713 "fallback", NULL((void*)0)};
714
715 TRACE(self)do {} while (0);
1
Loop condition is false. Exiting loop
716 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
2
Assuming field 'conn' is non-null
3
Taking false branch
4
Loop condition is false. Exiting loop
717 if (!Connection__require_main_loop(self, NULL((void*)0))) {
5
Taking false branch
718 return NULL((void*)0);
719 }
720 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs,
6
Assuming the condition is false
7
Taking false branch
721 "OO|Oi:_register_object_path",
722 argnames,
723 &path,
724 &on_message, &on_unregister,
725 &fallback)) return NULL((void*)0);
726
727 /* Take a reference to path, which we give away to libdbus in a moment.
728
729 Also, path needs to be a string (not a subclass which could do something
730 mad) to preserve the desirable property that the DBusConnection can
731 never strongly reference the Connection, even indirectly.
732 */
733 if (PyBytes_CheckExact(path)((((PyObject*)(path))->ob_type) == &PyBytes_Type)) {
8
Assuming the condition is false
9
Taking false branch
734 Py_INCREF(path)_Py_INCREF(((PyObject*)(path)));
735 }
736 else if (PyUnicode_Check(path)((((((PyObject*)(path))->ob_type))->tp_flags & ((1UL
<< 28))) != 0)
) {
10
Assuming the condition is false
11
Taking false branch
737 path = PyUnicode_AsUTF8String(path);
738 if (!path) return NULL((void*)0);
739 }
740 else if (PyBytes_Check(path)((((((PyObject*)(path))->ob_type))->tp_flags & ((1UL
<< 27))) != 0)
) {
12
Assuming the condition is true
13
Taking true branch
741 path = PyBytes_FromString(PyBytes_AS_STRING(path)((((PyBytesObject *)(path))->ob_sval)));
742 if (!path) return NULL((void*)0);
14
Assuming 'path' is non-null
15
Taking false branch
743 }
744 else {
745 PyErr_SetString(PyExc_TypeError,
746 "path must be a str, bytes, or unicode object");
747 return NULL((void*)0);
748 }
749
750 path_bytes = PyBytes_AS_STRING(path)((((PyBytesObject *)(path))->ob_sval));
751 if (!dbus_py_validate_object_path(path_bytes)) {
16
Assuming the condition is false
17
Taking false branch
752 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
753 return NULL((void*)0);
754 }
755
756 tuple = Py_BuildValue_Py_BuildValue_SizeT("(OO)", on_unregister, on_message);
18
Calling '_Py_BuildValue_SizeT'
20
Returning from '_Py_BuildValue_SizeT'
32
PyObject ownership leak with reference count of 1
757 if (!tuple) {
21
Assuming 'tuple' is non-null
22
Taking false branch
758 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
759 return NULL((void*)0);
760 }
761
762 /* Guard against registering a handler that already exists. */
763 callbacks = PyDict_GetItem(self->object_paths, path);
764 if (callbacks && callbacks != Py_None(&_Py_NoneStruct)) {
23
Assuming 'callbacks' is null
765 PyErr_Format(PyExc_KeyError, "Can't register the object-path "
766 "handler for '%s': there is already a handler",
767 path_bytes);
768 Py_CLEAR(tuple)do { PyObject *_py_tmp = ((PyObject*)(tuple)); if (_py_tmp !=
((void*)0)) { (tuple) = ((void*)0); _Py_DECREF(((PyObject*)(
_py_tmp))); } } while (0)
;
769 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
770 return NULL((void*)0);
771 }
772
773 /* Pre-allocate a slot in the dictionary, so we know we'll be able
774 * to replace it with the callbacks without OOM.
775 * This ensures we can keep libdbus' opinion of whether those
776 * paths are handled in sync with our own. */
777 if (PyDict_SetItem(self->object_paths, path, Py_None(&_Py_NoneStruct)) < 0) {
24
Assuming the condition is false
25
Taking false branch
778 Py_CLEAR(tuple)do { PyObject *_py_tmp = ((PyObject*)(tuple)); if (_py_tmp !=
((void*)0)) { (tuple) = ((void*)0); _Py_DECREF(((PyObject*)(
_py_tmp))); } } while (0)
;
779 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
780 return NULL((void*)0);
781 }
782
783 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
784 if (fallback) {
26
Assuming 'fallback' is 0
27
Taking false branch
785 ok = dbus_connection_register_fallback(self->conn,
786 path_bytes,
787 &_object_path_vtable,
788 path);
789 }
790 else {
791 ok = dbus_connection_register_object_path(self->conn,
792 path_bytes,
793 &_object_path_vtable,
794 path);
795 }
796 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
797
798 if (ok) {
28
Assuming 'ok' is not equal to 0
29
Taking true branch
799 if (PyDict_SetItem(self->object_paths, path, tuple) < 0) {
30
Assuming the condition is true
31
Taking true branch
800 /* That shouldn't have happened, we already allocated enough
801 memory for it. Oh well, try to undo the registration to keep
802 things in sync. If this fails too, we've leaked a bit of
803 memory in libdbus, but tbh we should never get here anyway. */
804 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
805 ok = dbus_connection_unregister_object_path(self->conn,
806 path_bytes);
807 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
808 return NULL((void*)0);
809 }
810 /* don't DECREF path: libdbus owns a ref now */
811 Py_CLEAR(tuple)do { PyObject *_py_tmp = ((PyObject*)(tuple)); if (_py_tmp !=
((void*)0)) { (tuple) = ((void*)0); _Py_DECREF(((PyObject*)(
_py_tmp))); } } while (0)
;
812 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
813 }
814 else {
815 /* Oops, OOM. Tidy up, if we can, ignoring any error. */
816 PyDict_DelItem(self->object_paths, path);
817 PyErr_Clear();
818 Py_CLEAR(tuple)do { PyObject *_py_tmp = ((PyObject*)(tuple)); if (_py_tmp !=
((void*)0)) { (tuple) = ((void*)0); _Py_DECREF(((PyObject*)(
_py_tmp))); } } while (0)
;
819 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
820 PyErr_NoMemory();
821 return NULL((void*)0);
822 }
823}
824
825PyDoc_STRVAR(Connection__unregister_object_path__doc__,static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
826"unregister_object_path(path)\n\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
827"Remove a previously registered handler for the given object path.\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
828"\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
829":Parameters:\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
830" `path` : str\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
831" The object path whose handler is to be removed\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
832":Raises KeyError: if there is no handler registered for exactly that\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
833" object path.\n"static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
834)static const char Connection__unregister_object_path__doc__[]
= "unregister_object_path(path)\n\n""Remove a previously registered handler for the given object path.\n"
"\n"":Parameters:\n"" `path` : str\n"" The object path whose handler is to be removed\n"
":Raises KeyError: if there is no handler registered for exactly that\n"
" object path.\n"
;
835static PyObject *
836Connection__unregister_object_path(Connection *self, PyObject *args,
837 PyObject *kwargs)
838{
839 dbus_bool_t ok;
840 char *path_bytes;
841 PyObject *path;
842 PyObject *callbacks;
843 static char *argnames[] = {"path", NULL((void*)0)};
844
845 TRACE(self)do {} while (0);
846 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
847 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs,
848 "O:_unregister_object_path",
849 argnames, &path)) return NULL((void*)0);
850
851 /* Take a ref to the path. Same comments as for _register_object_path. */
852 if (PyBytes_CheckExact(path)((((PyObject*)(path))->ob_type) == &PyBytes_Type)) {
853 Py_INCREF(path)_Py_INCREF(((PyObject*)(path)));
854 }
855 else if (PyUnicode_Check(path)((((((PyObject*)(path))->ob_type))->tp_flags & ((1UL
<< 28))) != 0)
) {
856 path = PyUnicode_AsUTF8String(path);
857 if (!path) return NULL((void*)0);
858 }
859 else if (PyBytes_Check(path)((((((PyObject*)(path))->ob_type))->tp_flags & ((1UL
<< 27))) != 0)
) {
860 path = PyBytes_FromString(PyBytes_AS_STRING(path)((((PyBytesObject *)(path))->ob_sval)));
861 if (!path) return NULL((void*)0);
862 }
863 else {
864 PyErr_SetString(PyExc_TypeError,
865 "path must be a str, bytes, or unicode object");
866 return NULL((void*)0);
867 }
868
869 path_bytes = PyBytes_AS_STRING(path)((((PyBytesObject *)(path))->ob_sval));
870
871 /* Guard against unregistering a handler that doesn't, in fact, exist,
872 or whose unregistration is already in progress. */
873 callbacks = PyDict_GetItem(self->object_paths, path);
874 if (!callbacks || callbacks == Py_None(&_Py_NoneStruct)) {
875 PyErr_Format(PyExc_KeyError, "Can't unregister the object-path "
876 "handler for '%s': there is no such handler",
877 path_bytes);
878 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
879 return NULL((void*)0);
880 }
881
882 /* Hang on to a reference to the callbacks for the moment. */
883 Py_INCREF(callbacks)_Py_INCREF(((PyObject*)(callbacks)));
884
885 /* Get rid of the object-path while we still have the GIL, to
886 guard against unregistering twice from different threads (which
887 causes undefined behaviour in libdbus).
888
889 Because deletion would make it possible for the re-insertion below
890 to fail, we instead set the handler to None as a placeholder.
891 */
892 if (PyDict_SetItem(self->object_paths, path, Py_None(&_Py_NoneStruct)) < 0) {
893 /* If that failed, there's no need to be paranoid as below - the
894 callbacks are still set, so we failed, but at least everything
895 is in sync. */
896 Py_CLEAR(callbacks)do { PyObject *_py_tmp = ((PyObject*)(callbacks)); if (_py_tmp
!= ((void*)0)) { (callbacks) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
897 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
898 return NULL((void*)0);
899 }
900
901 /* BEGIN PARANOIA
902 This is something of a critical section - the dict of object-paths
903 and libdbus' internal structures are out of sync for a bit. We have
904 to be able to cope with that.
905
906 It's really annoying that dbus_connection_unregister_object_path
907 can fail, *and* has undefined behaviour if the object path has
908 already been unregistered. Either/or would be fine.
909 */
910
911 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
912 ok = dbus_connection_unregister_object_path(self->conn, path_bytes);
913 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
914
915 if (ok) {
916 Py_CLEAR(callbacks)do { PyObject *_py_tmp = ((PyObject*)(callbacks)); if (_py_tmp
!= ((void*)0)) { (callbacks) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
917 PyDict_DelItem(self->object_paths, path);
918 /* END PARANOIA on successful code path */
919 /* The above can't fail unless by some strange trickery the key is no
920 longer present. Ignore any errors. */
921 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
922 PyErr_Clear();
923 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
924 }
925 else {
926 /* Oops, OOM. Put the callbacks back in the dict so
927 * we'll have another go if/when the user frees some memory
928 * and tries calling this method again. */
929 PyDict_SetItem(self->object_paths, path, callbacks);
930 /* END PARANOIA on failing code path */
931 /* If the SetItem failed, there's nothing we can do about it - but
932 since we know it's an existing entry, it shouldn't be able to fail
933 anyway. */
934 Py_CLEAR(path)do { PyObject *_py_tmp = ((PyObject*)(path)); if (_py_tmp != (
(void*)0)) { (path) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
935 Py_CLEAR(callbacks)do { PyObject *_py_tmp = ((PyObject*)(callbacks)); if (_py_tmp
!= ((void*)0)) { (callbacks) = ((void*)0); _Py_DECREF(((PyObject
*)(_py_tmp))); } } while (0)
;
936 return PyErr_NoMemory();
937 }
938}
939
940PyDoc_STRVAR(Connection_list_exported_child_objects__doc__,static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
941"list_exported_child_objects(path: str) -> list of str\n\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
942"Return a list of the names of objects exported on this Connection as\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
943"direct children of the given object path.\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
944"\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
945"Each name returned may be converted to a valid object path using\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
946"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
947"For the purposes of this function, every parent or ancestor of an exported\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
948"object is considered to be an exported object, even if it's only an object\n"static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
949"synthesized by the library to support introspection.\n")static const char Connection_list_exported_child_objects__doc__
[] = "list_exported_child_objects(path: str) -> list of str\n\n"
"Return a list of the names of objects exported on this Connection as\n"
"direct children of the given object path.\n""\n""Each name returned may be converted to a valid object path using\n"
"``dbus.ObjectPath('%s%s%s' % (path, (path != '/' and '/' or ''), name))``.\n"
"For the purposes of this function, every parent or ancestor of an exported\n"
"object is considered to be an exported object, even if it's only an object\n"
"synthesized by the library to support introspection.\n"
;
950static PyObject *
951Connection_list_exported_child_objects (Connection *self, PyObject *args,
952 PyObject *kwargs)
953{
954 const char *path;
955 char **kids, **kid_ptr;
956 dbus_bool_t ok;
957 PyObject *ret;
958 static char *argnames[] = {"path", NULL((void*)0)};
959
960 DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn)do { if (!(self->conn)) { _dbus_py_assertion_failed("self->conn"
); return ((void*)0); } } while (0)
;
961 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs, "s", argnames, &path)) {
962 return NULL((void*)0);
963 }
964
965 if (!dbus_py_validate_object_path(path)) {
966 return NULL((void*)0);
967 }
968
969 Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread();
970 ok = dbus_connection_list_registered(self->conn, path, &kids);
971 Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); }
972
973 if (!ok) {
974 return PyErr_NoMemory();
975 }
976
977 ret = PyList_New(0);
978 if (!ret) {
979 return NULL((void*)0);
980 }
981 for (kid_ptr = kids; *kid_ptr; kid_ptr++) {
982 PyObject *tmp = PyUnicode_FromString(*kid_ptr);
983
984 if (!tmp) {
985 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
986 return NULL((void*)0);
987 }
988 if (PyList_Append(ret, tmp) < 0) {
989 Py_CLEAR(tmp)do { PyObject *_py_tmp = ((PyObject*)(tmp)); if (_py_tmp != (
(void*)0)) { (tmp) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
990 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
991 return NULL((void*)0);
992 }
993 Py_CLEAR(tmp)do { PyObject *_py_tmp = ((PyObject*)(tmp)); if (_py_tmp != (
(void*)0)) { (tmp) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
994 }
995
996 dbus_free_string_array(kids);
997
998 return ret;
999}
1000
1001 /* dbus_connection_get_object_path_data - not useful to Python,
1002 * the object path data is just a PyBytes containing the path */
1003 /* dbus_connection_list_registered could be useful, though */
1004
1005/* dbus_connection_set_change_sigpipe - sets global state */
1006
1007/* Maxima. Does Python code ever need to manipulate these?
1008 * OTOH they're easy to wrap */
1009 /* dbus_connection_set_max_message_size */
1010 /* dbus_connection_get_max_message_size */
1011 /* dbus_connection_set_max_received_size */
1012 /* dbus_connection_get_max_received_size */
1013
1014/* dbus_connection_get_outgoing_size - almost certainly unneeded */
1015
1016PyDoc_STRVAR(new_for_bus__doc__,static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
1017"Connection._new_for_bus([address: str or int]) -> Connection\n"static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
1018"\n"static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
1019"If the address is an int it must be one of the constants BUS_SESSION,\n"static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
1020"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
1021"The default is BUS_SESSION.\n"static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
1022)static const char new_for_bus__doc__[] = "Connection._new_for_bus([address: str or int]) -> Connection\n"
"\n""If the address is an int it must be one of the constants BUS_SESSION,\n"
"BUS_SYSTEM, BUS_STARTER; if a string, it must be a D-Bus address.\n"
"The default is BUS_SESSION.\n"
;
1023
1024PyDoc_STRVAR(get_unique_name__doc__,static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
1025"get_unique_name() -> str\n\n"static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
1026"Return this application's unique name on this bus.\n"static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
1027"\n"static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
1028":Raises DBusException: if the connection has no unique name yet\n"static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
1029" (for Bus objects this can't happen, for peer-to-peer connections\n"static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
1030" this means you haven't called `set_unique_name`)\n")static const char get_unique_name__doc__[] = "get_unique_name() -> str\n\n"
"Return this application's unique name on this bus.\n""\n"":Raises DBusException: if the connection has no unique name yet\n"
" (for Bus objects this can't happen, for peer-to-peer connections\n"
" this means you haven't called `set_unique_name`)\n"
;
1031
1032PyDoc_STRVAR(set_unique_name__doc__,static const char set_unique_name__doc__[] = "set_unique_name(str)\n\n"
"Set this application's unique name on this bus. Raise ValueError if it has\n"
"already been set.\n"
1033"set_unique_name(str)\n\n"static const char set_unique_name__doc__[] = "set_unique_name(str)\n\n"
"Set this application's unique name on this bus. Raise ValueError if it has\n"
"already been set.\n"
1034"Set this application's unique name on this bus. Raise ValueError if it has\n"static const char set_unique_name__doc__[] = "set_unique_name(str)\n\n"
"Set this application's unique name on this bus. Raise ValueError if it has\n"
"already been set.\n"
1035"already been set.\n")static const char set_unique_name__doc__[] = "set_unique_name(str)\n\n"
"Set this application's unique name on this bus. Raise ValueError if it has\n"
"already been set.\n"
;
1036
1037struct PyMethodDef DBusPyConnection_tp_methods[] = {
1038#define ENTRY(name, flags) {\
1039 #name, (PyCFunction) (void (*)(void)) Connection_##name, \
1040 flags, Connection_##name##__doc__ \
1041}
1042 ENTRY(_require_main_loop, METH_NOARGS0x0004),
1043 ENTRY(close, METH_NOARGS0x0004),
1044 ENTRY(flush, METH_NOARGS0x0004),
1045 ENTRY(get_is_connected, METH_NOARGS0x0004),
1046 ENTRY(get_is_authenticated, METH_NOARGS0x0004),
1047 ENTRY(set_exit_on_disconnect, METH_VARARGS0x0001),
1048 ENTRY(get_unix_fd, METH_NOARGS0x0004),
1049 ENTRY(get_peer_unix_user, METH_NOARGS0x0004),
1050 ENTRY(get_peer_unix_process_id, METH_NOARGS0x0004),
1051 ENTRY(add_message_filter, METH_O0x0008),
1052 ENTRY(_register_object_path, METH_VARARGS0x0001|METH_KEYWORDS0x0002),
1053 ENTRY(remove_message_filter, METH_O0x0008),
1054 ENTRY(send_message, METH_VARARGS0x0001),
1055 ENTRY(send_message_with_reply, METH_VARARGS0x0001|METH_KEYWORDS0x0002),
1056 ENTRY(send_message_with_reply_and_block, METH_VARARGS0x0001),
1057 ENTRY(_unregister_object_path, METH_VARARGS0x0001|METH_KEYWORDS0x0002),
1058 ENTRY(list_exported_child_objects, METH_VARARGS0x0001|METH_KEYWORDS0x0002),
1059 {"_new_for_bus", (PyCFunction) (void (*)(void)) DBusPyConnection_NewForBus,
1060 METH_CLASS0x0010|METH_VARARGS0x0001|METH_KEYWORDS0x0002,
1061 new_for_bus__doc__},
1062 {"get_unique_name", (PyCFunction) (void (*)(void)) DBusPyConnection_GetUniqueName,
1063 METH_NOARGS0x0004,
1064 get_unique_name__doc__},
1065 {"set_unique_name", (PyCFunction) (void (*)(void)) DBusPyConnection_SetUniqueName,
1066 METH_VARARGS0x0001,
1067 set_unique_name__doc__},
1068 ENTRY(set_allow_anonymous, METH_VARARGS0x0001),
1069 {NULL((void*)0)},
1070#undef ENTRY
1071};
1072
1073/* vim:set ft=c cino< sw=4 sts=4 et: */

/opt/pyrefcon/lib/pyrefcon/models/models/_Py_BuildValue_SizeT.model

1#ifndef _Py_BuildValue_SizeT
2struct _object;
3typedef struct _object PyObject;
4PyObject* clang_analyzer_PyObject_New_Reference();
5PyObject* _Py_BuildValue_SizeT(const char *format, ...) {
6 return clang_analyzer_PyObject_New_Reference();
19
Setting reference count to 1
7}
8#else
9#warning "API _Py_BuildValue_SizeT is defined as a macro."
10#endif