lib: Make bt_value_null a const pointer
[babeltrace.git] / bindings / python / bt2 / bt2 / native_btconnection.i
1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 /* Type */
26 struct bt_connection;
27 struct bt_private_connection;
28
29 /* Status */
30 enum bt_connection_status {
31 BT_CONNECTION_STATUS_GRAPH_IS_CANCELED = 125,
32 BT_CONNECTION_STATUS_OK = 0,
33 BT_CONNECTION_STATUS_INVALID = -22,
34 BT_CONNECTION_STATUS_ERROR = -1,
35 BT_CONNECTION_STATUS_NOMEM = -12,
36 BT_CONNECTION_STATUS_IS_ENDED = 104,
37 };
38
39 /* Functions (public) */
40 struct bt_port *bt_connection_get_downstream_port(
41 struct bt_connection *connection);
42 struct bt_port *bt_connection_get_upstream_port(
43 struct bt_connection *connection);
44 int bt_connection_is_ended(struct bt_connection *connection);
45
46 /* Functions (private) */
47 struct bt_connection *bt_connection_from_private(
48 struct bt_private_connection *private_connection);
49
50 /* Helper functions for Python */
51 %typemap(out) struct bt_py3_create_notif_iter_ret {
52 $result = PyTuple_New(2);
53 PyObject *py_notif_iter_ptr = SWIG_NewPointerObj(
54 SWIG_as_voidptr($1.notif_iter),
55 SWIGTYPE_p_bt_notification_iterator, 0);
56 PyObject *py_status = SWIG_From_long_SS_long($1.status);
57 PyTuple_SET_ITEM($result, 0, py_status);
58 PyTuple_SET_ITEM($result, 1, py_notif_iter_ptr);
59 }
60
61 %{
62 struct bt_py3_create_notif_iter_ret {
63 enum bt_connection_status status;
64 struct bt_notification_iterator *notif_iter;
65 };
66
67 static struct bt_py3_create_notif_iter_ret bt_py3_create_priv_conn_notif_iter(
68 unsigned long long priv_conn_addr, PyObject *py_notif_types)
69 {
70 struct bt_private_connection *priv_conn;
71 enum bt_notification_type *notification_types = NULL;
72 struct bt_py3_create_notif_iter_ret ret;
73
74 priv_conn = (void *) priv_conn_addr;
75 BT_ASSERT(!PyErr_Occurred());
76 BT_ASSERT(priv_conn);
77
78 notification_types = bt_py3_notif_types_from_py_list(py_notif_types);
79 ret.status = bt_private_connection_create_notification_iterator(
80 priv_conn, notification_types, &ret.notif_iter);
81 g_free(notification_types);
82
83 return ret;
84 }
85 %}
86
87 struct bt_py3_create_notif_iter_ret bt_py3_create_priv_conn_notif_iter(
88 unsigned long long priv_conn_addr, PyObject *notif_types);
This page took 0.031088 seconds and 4 git commands to generate.