bindings/python/bt2: Make the bt2 Python bindings build
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 22 Apr 2019 15:17:23 +0000 (11:17 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
This patch is just a little bit more than the bare minimum to make the
Python bindings build (that is, configure with --enable-python-bindings
and build).  It consists of sync'ing the .i SWIG interface definition
files with the corresponding headers.  It's possible that the interfaces
are incomplete, in which case they'll be adjusted in the a later pass.
For example, output parameters are currently not named in a way that
match the type maps.

For simplicity, I have included at the same time some other changes to
the .i files, such as adjusting the typemap definitions (in
native_bt.i).  The helper functions (such as at the bottom of
native_bt_componentclass.i) are also changed to the "final" form they
have on my development branch.  Even though these are not immediatly used,
they need to be changed for the bindings to build.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I87a438a692690639f956b214f878df65885ed78c

50 files changed:
bindings/python/bt2/Makefile.am
bindings/python/bt2/bt2/native_bt.i
bindings/python/bt2/bt2/native_bt_clock_class.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_clock_snapshot.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_component.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_component_class.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_connection.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_event.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_event_class.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_field.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_field_class.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_field_path.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_graph.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_logging.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_message.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_notifier.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_packet.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_plugin.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_port.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_query_exec.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_stream.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_stream_class.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_trace.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_trace_class.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_value.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_bt_version.i [new file with mode: 0644]
bindings/python/bt2/bt2/native_btccpriomap.i [deleted file]
bindings/python/bt2/bt2/native_btclockclass.i [deleted file]
bindings/python/bt2/bt2/native_btcomponent.i [deleted file]
bindings/python/bt2/bt2/native_btcomponentclass.i [deleted file]
bindings/python/bt2/bt2/native_btconnection.i [deleted file]
bindings/python/bt2/bt2/native_btctfwriter.i [deleted file]
bindings/python/bt2/bt2/native_btevent.i [deleted file]
bindings/python/bt2/bt2/native_bteventclass.i [deleted file]
bindings/python/bt2/bt2/native_btfields.i [deleted file]
bindings/python/bt2/bt2/native_btft.i [deleted file]
bindings/python/bt2/bt2/native_btgraph.i [deleted file]
bindings/python/bt2/bt2/native_btlogging.i [deleted file]
bindings/python/bt2/bt2/native_btnotification.i [deleted file]
bindings/python/bt2/bt2/native_btnotifiter.i [deleted file]
bindings/python/bt2/bt2/native_btpacket.i [deleted file]
bindings/python/bt2/bt2/native_btplugin.i [deleted file]
bindings/python/bt2/bt2/native_btport.i [deleted file]
bindings/python/bt2/bt2/native_btqueryexec.i [deleted file]
bindings/python/bt2/bt2/native_btref.i [deleted file]
bindings/python/bt2/bt2/native_btstream.i [deleted file]
bindings/python/bt2/bt2/native_btstreamclass.i [deleted file]
bindings/python/bt2/bt2/native_bttrace.i [deleted file]
bindings/python/bt2/bt2/native_btvalues.i [deleted file]
bindings/python/bt2/bt2/native_btversion.i [deleted file]

index 96f3ccae45d3f86dff514d9a93a4f41a86bd7cb0..5b1a9bbf071639f33c1cfa294e534f119c3a8a3b 100644 (file)
@@ -8,31 +8,31 @@ INSTALLED_FILES=$(builddir)/installed_files.txt
 STATIC_BINDINGS_DEPS =                                 \
        bt2/logging.c                                   \
        bt2/logging.h                                   \
-       bt2/native_btccpriomap.i                        \
-       bt2/native_btclockclass.i                       \
-       bt2/native_btcomponentclass.i                   \
-       bt2/native_btcomponent.i                        \
-       bt2/native_btconnection.i                       \
-       bt2/native_btctfwriter.i                        \
-       bt2/native_bteventclass.i                       \
-       bt2/native_btevent.i                            \
-       bt2/native_btfields.i                           \
-       bt2/native_btft.i                               \
-       bt2/native_btgraph.i                            \
+       bt2/native_bt_clock_class.i                     \
+       bt2/native_bt_clock_snapshot.i                  \
+       bt2/native_bt_component_class.i                 \
+       bt2/native_bt_component.i                       \
+       bt2/native_bt_connection.i                      \
+       bt2/native_bt_event_class.i                     \
+       bt2/native_bt_event.i                           \
+       bt2/native_bt_field_class.i                     \
+       bt2/native_bt_field_path.i                      \
+       bt2/native_bt_field.i                           \
+       bt2/native_bt_graph.i                           \
        bt2/native_bt.i                                 \
-       bt2/native_btlogging.i                          \
-       bt2/native_btnotification.i                     \
-       bt2/native_btnotifiter.i                        \
-       bt2/native_btpacket.i                           \
-       bt2/native_btplugin.i                           \
-       bt2/native_btport.i                             \
-       bt2/native_btqueryexec.i                        \
-       bt2/native_btref.i                              \
-       bt2/native_btstreamclass.i                      \
-       bt2/native_btstream.i                           \
-       bt2/native_bttrace.i                            \
-       bt2/native_btvalues.i                           \
-       bt2/native_btversion.i                          \
+       bt2/native_bt_logging.i                         \
+       bt2/native_bt_message.i                         \
+       bt2/native_bt_notifier.i                        \
+       bt2/native_bt_packet.i                          \
+       bt2/native_bt_plugin.i                          \
+       bt2/native_bt_port.i                            \
+       bt2/native_bt_query_exec.i                      \
+       bt2/native_bt_stream_class.i                    \
+       bt2/native_bt_stream.i                          \
+       bt2/native_bt_trace_class.i                     \
+       bt2/native_bt_trace.i                           \
+       bt2/native_bt_value.i                           \
+       bt2/native_bt_version.i                         \
        bt2/clock_class_priority_map.py                 \
        bt2/clock_class.py                              \
        bt2/clock_value.py                              \
index 7ac34206b351d6c4204b04997c81a960b3f5c692..b1e2d27df70382341801768cd98dc0ab918401d8 100644 (file)
 #include "logging.h"
 
 #include <babeltrace/babeltrace.h>
+#include <babeltrace/property.h>
 #include <babeltrace/assert-internal.h>
 
-typedef const unsigned char *BTUUID;
+typedef const uint8_t *bt_uuid;
 %}
 
 typedef int bt_bool;
@@ -43,16 +44,20 @@ typedef int bt_bool;
 /* For uint*_t/int*_t */
 %include "stdint.i"
 
-/* Remove `bt_` and `BT_` prefixes from function names and enumeration items */
+/*
+ * Remove `bt_` and `BT_` prefixes from function names, global variables and
+ * enumeration items
+ */
 %rename("%(strip:[bt_])s", %$isfunction) "";
+%rename("%(strip:[bt_])s", %$isvariable) "";
 %rename("%(strip:[BT_])s", %$isenumitem) "";
 
 /* Output argument typemap for string output (always appends) */
-%typemap(in, numinputs=0) const char **BTOUTSTR (char *temp_value = NULL) {
+%typemap(in, numinputs=0) (const char **OUT) (char *temp_value) {
        $1 = &temp_value;
 }
 
-%typemap(argout) const char **BTOUTSTR {
+%typemap(argout) (const char **OUT) {
        if (*$1) {
                /* SWIG_Python_AppendOutput() steals the created object */
                $result = SWIG_Python_AppendOutput($result, SWIG_Python_str_FromChar(*$1));
@@ -63,31 +68,17 @@ typedef int bt_bool;
        }
 }
 
-/* Output argument typemap for field type output (always appends) */
-%typemap(in, numinputs=0) struct bt_field_type **BTOUTFT (struct bt_field_type *temp_ft = NULL) {
-       $1 = &temp_ft;
-}
-
-%typemap(argout) struct bt_field_type **BTOUTFT {
-       if (*$1) {
-               /* SWIG_Python_AppendOutput() steals the created object */
-               $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_field_type, 0));
-       } else {
-               /* SWIG_Python_AppendOutput() steals Py_None */
-               Py_INCREF(Py_None);
-               $result = SWIG_Python_AppendOutput($result, Py_None);
-       }
-}
-
-/* Output argument typemap for component output (always appends) */
-%typemap(in, numinputs=0) struct bt_component **BTOUTCOMP (struct bt_component *temp_comp = NULL) {
-       $1 = &temp_comp;
+/* Output argument typemap for value output (always appends) */
+%typemap(in, numinputs=0) (bt_value **OUT) (struct bt_value *temp_value = NULL) {
+       $1 = &temp_value;
 }
 
-%typemap(argout) struct bt_component **BTOUTCOMP {
+%typemap(argout) (bt_value **OUT) {
        if (*$1) {
                /* SWIG_Python_AppendOutput() steals the created object */
-               $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_component, 0));
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_value, 0));
        } else {
                /* SWIG_Python_AppendOutput() steals Py_None */
                Py_INCREF(Py_None);
@@ -95,79 +86,50 @@ typedef int bt_bool;
        }
 }
 
-/* Output argument typemap for connection output (always appends) */
-%typemap(in, numinputs=0) struct bt_connection **BTOUTCONN (struct bt_connection *temp_conn = NULL) {
-       $1 = &temp_conn;
-}
-
-%typemap(argout) struct bt_connection **BTOUTCONN {
-       if (*$1) {
-               /* SWIG_Python_AppendOutput() steals the created object */
-               $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_connection, 0));
-       } else {
-               /* SWIG_Python_AppendOutput() steals Py_None */
-               Py_INCREF(Py_None);
-               $result = SWIG_Python_AppendOutput($result, Py_None);
-       }
+/* Output argument typemap for initialized uint64_t output parameter (always appends) */
+%typemap(in, numinputs=0) (uint64_t *OUT) (uint64_t temp) {
+       $1 = &temp;
 }
 
-/* Output argument typemap for private port output (always appends) */
-%typemap(in, numinputs=0) struct bt_private_port **BTOUTPRIVPORT (struct bt_private_port *temp_priv_port = NULL) {
-       $1 = &temp_priv_port;
+%typemap(argout) uint64_t *OUT {
+       $result = SWIG_Python_AppendOutput(resultobj,
+                       SWIG_From_unsigned_SS_long_SS_long((*$1)));
 }
 
-%typemap(argout) struct bt_private_port **BTOUTPRIVPORT {
-       if (*$1) {
-               /* SWIG_Python_AppendOutput() steals the created object */
-               $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_private_port, 0));
-       } else {
-               /* SWIG_Python_AppendOutput() steals Py_None */
-               Py_INCREF(Py_None);
-               $result = SWIG_Python_AppendOutput($result, Py_None);
-       }
-}
-
-/* Output argument typemap for value output (always appends) */
-%typemap(in, numinputs=0) struct bt_value **BTOUTVALUE (struct bt_value *temp_value = NULL) {
-       $1 = &temp_value;
+/* Output argument typemap for initialized int64_t output parameter (always appends) */
+%typemap(in, numinputs=0) (int64_t *OUT) (int64_t temp) {
+       $1 = &temp;
 }
 
-%typemap(argout) struct bt_value **BTOUTVALUE {
-       if (*$1) {
-               /* SWIG_Python_AppendOutput() steals the created object */
-               $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_value, 0));
-       } else {
-               /* SWIG_Python_AppendOutput() steals Py_None */
-               Py_INCREF(Py_None);
-               $result = SWIG_Python_AppendOutput($result, Py_None);
-       }
+%typemap(argout) (int64_t *OUT) {
+       $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_long_SS_long((*$1)));
 }
 
-/* Output argument typemap for initialized uint64_t output parameter (always appends) */
-%typemap(in, numinputs=0) uint64_t *OUTPUTINIT (uint64_t temp = -1ULL) {
+/* Output argument typemap for initialized unsigned int output parameter (always appends) */
+%typemap(in, numinputs=0) (unsigned int *OUT) (unsigned int temp) {
        $1 = &temp;
 }
 
-%typemap(argout) uint64_t *OUTPUTINIT {
-       $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_unsigned_SS_long_SS_long((*$1)));
+%typemap(argout) (unsigned int *OUT) {
+       $result = SWIG_Python_AppendOutput(resultobj,
+                       SWIG_From_unsigned_SS_long_SS_long((uint64_t) (*$1)));
 }
-
-/* Output argument typemap for initialized unsigned int output parameter (always appends) */
-%typemap(in, numinputs=0) unsigned int *OUTPUTINIT (unsigned int temp = -1) {
+/* Output argument typemap for initialized double output parameter (always appends) */
+%typemap(in, numinputs=0) (double *OUT) (double temp) {
        $1 = &temp;
 }
 
-%typemap(argout) unsigned int *OUTPUTINIT {
-       $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_unsigned_SS_long_SS_long((uint64_t) (*$1)));
+%typemap(argout) (double *OUT) {
+       $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*$1)));
 }
 
 /* Input argument typemap for UUID bytes */
-%typemap(in) BTUUID {
+%typemap(in) bt_uuid {
        $1 = (unsigned char *) PyBytes_AsString($input);
 }
 
 /* Output argument typemap for UUID bytes */
-%typemap(out) BTUUID {
+%typemap(out) bt_uuid {
        if (!$1) {
                Py_INCREF(Py_None);
                $result = Py_None;
@@ -176,6 +138,22 @@ typedef int bt_bool;
        }
 }
 
+/* Input argument typemap for bt_bool */
+%typemap(in) bt_bool {
+       $1 = PyObject_IsTrue($input);
+}
+
+/* Output argument typemap for bt_bool */
+%typemap(out) bt_bool {
+       if ($1 > 0) {
+               $result = Py_True;
+       } else {
+               $result = Py_False;
+       }
+       Py_INCREF($result);
+       return $result;
+}
+
 /*
  * Input and output argument typemaps for raw Python objects (direct).
  *
@@ -193,65 +171,35 @@ typedef int bt_bool;
        $result = $1;
 }
 
-%{
-static enum bt_notification_type *bt_py3_notif_types_from_py_list(
-               PyObject *py_notif_types)
-{
-       enum bt_notification_type *notification_types = NULL;
-       size_t i;
-
-       BT_ASSERT(!PyErr_Occurred());
+/* From property.h */
 
-       if (py_notif_types == Py_None) {
-               goto end;
-       }
-
-       BT_ASSERT(PyList_Check(py_notif_types));
-       notification_types = g_new0(enum bt_notification_type,
-               PyList_Size(py_notif_types) + 1);
-       BT_ASSERT(notification_types);
-       notification_types[PyList_Size(py_notif_types)] =
-               BT_NOTIFICATION_TYPE_SENTINEL;
-
-       for (i = 0; i < PyList_Size(py_notif_types); i++) {
-               PyObject *item = PyList_GetItem(py_notif_types, i);
-               long value;
-               int overflow;
-
-               BT_ASSERT(item);
-               BT_ASSERT(PyLong_Check(item));
-               value = PyLong_AsLongAndOverflow(item, &overflow);
-               BT_ASSERT(overflow == 0);
-               notification_types[i] = value;
-       }
-
-end:
-       return notification_types;
-}
-%}
+typedef enum bt_property_availability {
+       BT_PROPERTY_AVAILABILITY_AVAILABLE,
+       BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE,
+} bt_property_availability;
 
 /* Per-module interface files */
-%include "native_btccpriomap.i"
-%include "native_btclockclass.i"
-%include "native_btcomponent.i"
-%include "native_btcomponentclass.i"
-%include "native_btconnection.i"
-%include "native_btctfwriter.i"
-%include "native_btevent.i"
-%include "native_bteventclass.i"
-%include "native_btfields.i"
-%include "native_btft.i"
-%include "native_btgraph.i"
-%include "native_btlogging.i"
-%include "native_btnotification.i"
-%include "native_btnotifiter.i"
-%include "native_btpacket.i"
-%include "native_btplugin.i"
-%include "native_btport.i"
-%include "native_btqueryexec.i"
-%include "native_btref.i"
-%include "native_btstream.i"
-%include "native_btstreamclass.i"
-%include "native_bttrace.i"
-%include "native_btvalues.i"
-%include "native_btversion.i"
+%include "native_bt_clock_class.i"
+%include "native_bt_clock_snapshot.i"
+%include "native_bt_component.i"
+%include "native_bt_component_class.i"
+%include "native_bt_connection.i"
+%include "native_bt_event.i"
+%include "native_bt_event_class.i"
+%include "native_bt_field.i"
+%include "native_bt_field_class.i"
+%include "native_bt_field_path.i"
+%include "native_bt_graph.i"
+%include "native_bt_logging.i"
+%include "native_bt_message.i"
+%include "native_bt_notifier.i"
+%include "native_bt_packet.i"
+%include "native_bt_plugin.i"
+%include "native_bt_port.i"
+%include "native_bt_query_exec.i"
+%include "native_bt_stream.i"
+%include "native_bt_stream_class.i"
+%include "native_bt_trace.i"
+%include "native_bt_trace_class.i"
+%include "native_bt_value.i"
+%include "native_bt_version.i"
diff --git a/bindings/python/bt2/bt2/native_bt_clock_class.i b/bindings/python/bt2/bt2/native_bt_clock_class.i
new file mode 100644 (file)
index 0000000..bf8ea43
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From clock-class-const.h */
+
+typedef enum bt_clock_class_status {
+       BT_CLOCK_CLASS_STATUS_OK = 0,
+       BT_CLOCK_CLASS_STATUS_NOMEM = -12,
+       BT_CLOCK_CLASS_STATUS_OVERFLOW = -75,
+} bt_clock_class_status;
+
+extern const char *bt_clock_class_get_name(
+               const bt_clock_class *clock_class);
+
+extern const char *bt_clock_class_get_description(
+               const bt_clock_class *clock_class);
+
+extern uint64_t bt_clock_class_get_frequency(
+               const bt_clock_class *clock_class);
+
+extern uint64_t bt_clock_class_get_precision(
+               const bt_clock_class *clock_class);
+
+extern void bt_clock_class_get_offset(const bt_clock_class *clock_class,
+               int64_t *OUT, uint64_t *OUT);
+
+extern bt_bool bt_clock_class_origin_is_unix_epoch(
+               const bt_clock_class *clock_class);
+
+extern bt_uuid bt_clock_class_get_uuid(
+               const bt_clock_class *clock_class);
+
+extern bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin(
+               const bt_clock_class *clock_class,
+               uint64_t cycles, int64_t *OUT);
+
+extern void bt_clock_class_get_ref(const bt_clock_class *clock_class);
+
+extern void bt_clock_class_put_ref(const bt_clock_class *clock_class);
+
+/* From clock-class.h */
+
+extern bt_clock_class *bt_clock_class_create(bt_self_component *self_comp);
+
+extern bt_clock_class_status bt_clock_class_set_name(
+               bt_clock_class *clock_class, const char *name);
+
+extern bt_clock_class_status bt_clock_class_set_description(
+               bt_clock_class *clock_class, const char *description);
+
+extern void bt_clock_class_set_frequency(bt_clock_class *clock_class,
+               uint64_t freq);
+
+extern void bt_clock_class_set_precision(bt_clock_class *clock_class,
+               uint64_t precision);
+
+extern void bt_clock_class_set_offset(bt_clock_class *clock_class,
+               int64_t seconds, uint64_t cycles);
+
+extern void bt_clock_class_set_origin_is_unix_epoch(bt_clock_class *clock_class,
+               bt_bool origin_is_unix_epoch);
+
+extern void bt_clock_class_set_uuid(bt_clock_class *clock_class,
+               bt_uuid uuid);
diff --git a/bindings/python/bt2/bt2/native_bt_clock_snapshot.i b/bindings/python/bt2/bt2/native_bt_clock_snapshot.i
new file mode 100644 (file)
index 0000000..44748cc
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From clock-snapshot-const.h */
+
+typedef enum bt_clock_snapshot_state {
+       BT_CLOCK_SNAPSHOT_STATE_KNOWN,
+       BT_CLOCK_SNAPSHOT_STATE_UNKNOWN,
+} bt_clock_snapshot_state;
+
+typedef enum bt_clock_snapshot_status {
+       BT_CLOCK_SNAPSHOT_STATUS_OK = 0,
+       BT_CLOCK_SNAPSHOT_STATUS_OVERFLOW = -75,
+} bt_clock_snapshot_status;
+
+extern const bt_clock_class *bt_clock_snapshot_borrow_clock_class_const(
+               const bt_clock_snapshot *clock_snapshot);
+
+extern uint64_t bt_clock_snapshot_get_value(
+               const bt_clock_snapshot *clock_snapshot);
+
+extern bt_clock_snapshot_status bt_clock_snapshot_get_ns_from_origin(
+               const bt_clock_snapshot *clock_snapshot,
+               int64_t *OUT);
diff --git a/bindings/python/bt2/bt2/native_bt_component.i b/bindings/python/bt2/bt2/native_bt_component.i
new file mode 100644 (file)
index 0000000..012b194
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* Output argument typemap for self port output (always appends) */
+%typemap(in, numinputs=0)
+       (bt_self_component_port_input **OUT)
+       (bt_self_component_port_input *temp_self_port = NULL) {
+       $1 = &temp_self_port;
+}
+
+%typemap(argout) bt_self_component_port_input **OUT {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_self_component_port_input, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* Output argument typemap for self port output (always appends) */
+%typemap(in, numinputs=0)
+       (bt_self_component_port_output **OUT)
+       (bt_self_component_port_output *temp_self_port = NULL) {
+       $1 = &temp_self_port;
+}
+
+%typemap(argout) (bt_self_component_port_output **OUT) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_self_component_port_output, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* From component-const.h */
+
+extern const char *bt_component_get_name(const bt_component *component);
+
+extern const bt_component_class *bt_component_borrow_class_const(
+               const bt_component *component);
+
+extern bt_component_class_type bt_component_get_class_type(
+               const bt_component *component);
+
+bt_bool bt_component_is_source(const bt_component *component);
+
+bt_bool bt_component_is_filter(const bt_component *component);
+
+bt_bool bt_component_is_sink(const bt_component *component);
+
+extern bt_bool bt_component_graph_is_canceled(
+               const bt_component *component);
+
+extern void bt_component_get_ref(const bt_component *component);
+
+extern void bt_component_put_ref(const bt_component *component);
+
+/* From component-source-const.h */
+
+const bt_component *bt_component_source_as_component_const(
+               const bt_component_source *component);
+
+extern uint64_t bt_component_source_get_output_port_count(
+               const bt_component_source *component);
+
+extern const bt_port_output *
+bt_component_source_borrow_output_port_by_name_const(
+               const bt_component_source *component, const char *name);
+
+extern const bt_port_output *
+bt_component_source_borrow_output_port_by_index_const(
+               const bt_component_source *component, uint64_t index);
+
+extern void bt_component_source_get_ref(
+               const bt_component_source *component_source);
+
+extern void bt_component_source_put_ref(
+               const bt_component_source *component_source);
+
+/* From component-filter-const.h */
+
+const bt_component *bt_component_filter_as_component_const(
+               const bt_component_filter *component);
+
+extern uint64_t bt_component_filter_get_input_port_count(
+               const bt_component_filter *component);
+
+extern const bt_port_input *
+bt_component_filter_borrow_input_port_by_name_const(
+               const bt_component_filter *component, const char *name);
+
+extern const bt_port_input *
+bt_component_filter_borrow_input_port_by_index_const(
+               const bt_component_filter *component, uint64_t index);
+
+extern uint64_t bt_component_filter_get_output_port_count(
+               const bt_component_filter *component);
+
+extern const bt_port_output *
+bt_component_filter_borrow_output_port_by_name_const(
+               const bt_component_filter *component, const char *name);
+
+extern const bt_port_output *
+bt_component_filter_borrow_output_port_by_index_const(
+               const bt_component_filter *component, uint64_t index);
+
+extern void bt_component_filter_get_ref(
+               const bt_component_filter *component_filter);
+
+extern void bt_component_filter_put_ref(
+               const bt_component_filter *component_filter);
+
+/* From component-sink-const.h */
+
+const bt_component *bt_component_sink_as_component_const(
+               const bt_component_sink *component);
+
+extern uint64_t bt_component_sink_get_input_port_count(
+               const bt_component_sink *component);
+
+extern const bt_port_input *
+bt_component_sink_borrow_input_port_by_name_const(
+               const bt_component_sink *component, const char *name);
+
+extern const bt_port_input *
+bt_component_sink_borrow_input_port_by_index_const(
+               const bt_component_sink *component, uint64_t index);
+
+extern void bt_component_sink_get_ref(
+               const bt_component_sink *component_sink);
+
+extern void bt_component_sink_put_ref(
+               const bt_component_sink *component_sink);
+
+/* From self-component.h */
+
+typedef enum bt_self_component_status {
+       BT_SELF_COMPONENT_STATUS_OK = 0,
+       BT_SELF_COMPONENT_STATUS_END = 1,
+       BT_SELF_COMPONENT_STATUS_AGAIN = 11,
+       BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION = 111,
+       BT_SELF_COMPONENT_STATUS_ERROR = -1,
+       BT_SELF_COMPONENT_STATUS_NOMEM = -12,
+} bt_self_component_status;
+
+const bt_component *bt_self_component_as_component(
+               bt_self_component *self_component);
+
+extern void *bt_self_component_get_data(
+               const bt_self_component *self_component);
+
+extern void bt_self_component_set_data(
+               bt_self_component *self_component, void *data);
+
+/* From self-component-source.h */
+
+bt_self_component *bt_self_component_source_as_self_component(
+               bt_self_component_source *self_comp_source);
+
+const bt_component_source *
+bt_self_component_source_as_component_source(
+               bt_self_component_source *self_comp_source);
+
+extern bt_self_component_port_output *
+bt_self_component_source_borrow_output_port_by_name(
+               bt_self_component_source *self_component,
+               const char *name);
+
+extern bt_self_component_port_output *
+bt_self_component_source_borrow_output_port_by_index(
+               bt_self_component_source *self_component,
+               uint64_t index);
+
+extern bt_self_component_status
+bt_self_component_source_add_output_port(
+               bt_self_component_source *self_component,
+               const char *name, void *user_data,
+               bt_self_component_port_output **OUT);
+
+/* From self-component-filter.h */
+
+bt_self_component *bt_self_component_filter_as_self_component(
+               bt_self_component_filter *self_comp_filter);
+
+const bt_component_filter *
+bt_self_component_filter_as_component_filter(
+               bt_self_component_filter *self_comp_filter);
+
+extern bt_self_component_port_output *
+bt_self_component_filter_borrow_output_port_by_name(
+               bt_self_component_filter *self_component,
+               const char *name);
+
+extern bt_self_component_port_output *
+bt_self_component_filter_borrow_output_port_by_index(
+               bt_self_component_filter *self_component,
+               uint64_t index);
+
+extern bt_self_component_status
+bt_self_component_filter_add_output_port(
+               bt_self_component_filter *self_component,
+               const char *name, void *data,
+               bt_self_component_port_output **OUT);
+
+extern bt_self_component_port_input *
+bt_self_component_filter_borrow_input_port_by_name(
+               bt_self_component_filter *self_component,
+               const char *name);
+
+extern bt_self_component_port_input *
+bt_self_component_filter_borrow_input_port_by_index(
+               bt_self_component_filter *self_component,
+               uint64_t index);
+
+extern bt_self_component_status
+bt_self_component_filter_add_input_port(
+               bt_self_component_filter *self_component,
+               const char *name, void *data,
+               bt_self_component_port_input **OUT);
+
+/* From self-component-sink.h */
+
+bt_self_component *bt_self_component_sink_as_self_component(
+               bt_self_component_sink *self_comp_sink);
+
+const bt_component_sink *
+bt_self_component_sink_as_component_sink(
+               bt_self_component_sink *self_comp_sink);
+
+extern bt_self_component_port_input *
+bt_self_component_sink_borrow_input_port_by_name(
+               bt_self_component_sink *self_component,
+               const char *name);
+
+extern bt_self_component_port_input *
+bt_self_component_sink_borrow_input_port_by_index(
+               bt_self_component_sink *self_component, uint64_t index);
+
+extern bt_self_component_status
+bt_self_component_sink_add_input_port(
+               bt_self_component_sink *self_component,
+               const char *name, void *user_data,
+               bt_self_component_port_input **OUT);
diff --git a/bindings/python/bt2/bt2/native_bt_component_class.i b/bindings/python/bt2/bt2/native_bt_component_class.i
new file mode 100644 (file)
index 0000000..b9c7b13
--- /dev/null
@@ -0,0 +1,1752 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From component-class-const.h */
+
+typedef enum bt_component_class_status {
+       BT_COMPONENT_CLASS_STATUS_OK = 0,
+       BT_COMPONENT_CLASS_STATUS_NOMEM = -12,
+} bt_component_class_status;
+
+typedef enum bt_component_class_type {
+       BT_COMPONENT_CLASS_TYPE_SOURCE = 0,
+       BT_COMPONENT_CLASS_TYPE_FILTER = 1,
+       BT_COMPONENT_CLASS_TYPE_SINK = 2,
+} bt_component_class_type;
+
+extern const char *bt_component_class_get_name(
+               const bt_component_class *component_class);
+
+extern const char *bt_component_class_get_description(
+               const bt_component_class *component_class);
+
+extern const char *bt_component_class_get_help(
+               const bt_component_class *component_class);
+
+extern bt_component_class_type bt_component_class_get_type(
+               const bt_component_class *component_class);
+
+bt_bool bt_component_class_is_source(
+               const bt_component_class *component_class);
+
+bt_bool bt_component_class_is_filter(
+               const bt_component_class *component_class);
+
+bt_bool bt_component_class_is_sink(
+               const bt_component_class *component_class);
+
+extern void bt_component_class_get_ref(
+               const bt_component_class *component_class);
+
+extern void bt_component_class_put_ref(
+               const bt_component_class *component_class);
+
+/* From component-class-source-const.h */
+
+const bt_component_class *
+bt_component_class_source_as_component_class_const(
+               const bt_component_class_source *comp_cls_source);
+
+extern void bt_component_class_source_get_ref(
+               const bt_component_class_source *component_class_source);
+
+extern void bt_component_class_source_put_ref(
+               const bt_component_class_source *component_class_source);
+
+/* From component-class-source.h */
+
+typedef bt_self_component_status
+(*bt_component_class_source_init_method)(
+               bt_self_component_source *self_component,
+               const bt_value *params, void *init_method_data);
+
+typedef void (*bt_component_class_source_finalize_method)(
+               bt_self_component_source *self_component);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_source_message_iterator_init_method)(
+               bt_self_message_iterator *message_iterator,
+               bt_self_component_source *self_component,
+               bt_self_component_port_output *port);
+
+typedef void
+(*bt_component_class_source_message_iterator_finalize_method)(
+               bt_self_message_iterator *message_iterator);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_source_message_iterator_next_method)(
+               bt_self_message_iterator *message_iterator,
+               bt_message_array_const msgs, uint64_t capacity,
+               uint64_t *count);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_source_message_iterator_seek_ns_from_origin_method)(
+               bt_self_message_iterator *message_iterator,
+               int64_t ns_from_origin);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_source_message_iterator_seek_beginning_method)(
+               bt_self_message_iterator *message_iterator);
+
+typedef bt_bool
+(*bt_component_class_source_message_iterator_can_seek_ns_from_origin_method)(
+               bt_self_message_iterator *message_iterator,
+               int64_t ns_from_origin);
+
+typedef bt_bool
+(*bt_component_class_source_message_iterator_can_seek_beginning_method)(
+               bt_self_message_iterator *message_iterator);
+
+typedef bt_query_status (*bt_component_class_source_query_method)(
+               bt_self_component_class_source *comp_class,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result);
+
+typedef bt_self_component_status
+(*bt_component_class_source_accept_output_port_connection_method)(
+               bt_self_component_source *self_component,
+               bt_self_component_port_output *self_port,
+               const bt_port_input *other_port);
+
+typedef bt_self_component_status
+(*bt_component_class_source_output_port_connected_method)(
+               bt_self_component_source *self_component,
+               bt_self_component_port_output *self_port,
+               const bt_port_input *other_port);
+
+bt_component_class *bt_component_class_source_as_component_class(
+               bt_component_class_source *comp_cls_source);
+
+extern
+bt_component_class_source *bt_component_class_source_create(
+               const char *name,
+               bt_component_class_source_message_iterator_next_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_init_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_init_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_finalize_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_finalize_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_accept_output_port_connection_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_accept_output_port_connection_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_output_port_connected_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_output_port_connected_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_query_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_query_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_message_iterator_init_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_message_iterator_init_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_message_iterator_finalize_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_message_iterator_finalize_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_message_iterator_seek_ns_from_origin_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_message_iterator_seek_ns_from_origin_method method);
+
+extern bt_component_class_status
+bt_component_class_source_set_message_iterator_seek_beginning_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_message_iterator_seek_beginning_method method);
+
+extern bt_bool
+bt_component_class_source_set_message_iterator_can_seek_ns_from_origin_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_message_iterator_can_seek_ns_from_origin_method method);
+
+extern bt_bool
+bt_component_class_source_set_message_iterator_can_seek_beginning_method(
+               bt_component_class_source *comp_class,
+               bt_component_class_source_message_iterator_can_seek_beginning_method method);
+
+/* From component-class-filter-const.h */
+
+const bt_component_class *
+bt_component_class_filter_as_component_class_const(
+               const bt_component_class_filter *comp_cls_filter);
+
+extern void bt_component_class_filter_get_ref(
+               const bt_component_class_filter *component_class_filter);
+
+extern void bt_component_class_filter_put_ref(
+               const bt_component_class_filter *component_class_filter);
+
+/* From component-class-filter.h */
+
+typedef bt_self_component_status
+(*bt_component_class_filter_init_method)(
+               bt_self_component_filter *self_component,
+               const bt_value *params, void *init_method_data);
+
+typedef void (*bt_component_class_filter_finalize_method)(
+               bt_self_component_filter *self_component);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_filter_message_iterator_init_method)(
+               bt_self_message_iterator *message_iterator,
+               bt_self_component_filter *self_component,
+               bt_self_component_port_output *port);
+
+typedef void
+(*bt_component_class_filter_message_iterator_finalize_method)(
+               bt_self_message_iterator *message_iterator);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_filter_message_iterator_next_method)(
+               bt_self_message_iterator *message_iterator,
+               bt_message_array_const msgs, uint64_t capacity,
+               uint64_t *count);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_filter_message_iterator_seek_ns_from_origin_method)(
+               bt_self_message_iterator *message_iterator,
+               int64_t ns_from_origin);
+
+typedef bt_self_message_iterator_status
+(*bt_component_class_filter_message_iterator_seek_beginning_method)(
+               bt_self_message_iterator *message_iterator);
+
+typedef bt_bool
+(*bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method)(
+               bt_self_message_iterator *message_iterator,
+               int64_t ns_from_origin);
+
+typedef bt_bool
+(*bt_component_class_filter_message_iterator_can_seek_beginning_method)(
+               bt_self_message_iterator *message_iterator);
+
+typedef bt_query_status
+(*bt_component_class_filter_query_method)(
+               bt_self_component_class_filter *comp_class,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result);
+
+typedef bt_self_component_status
+(*bt_component_class_filter_accept_input_port_connection_method)(
+               bt_self_component_filter *self_component,
+               bt_self_component_port_input *self_port,
+               const bt_port_output *other_port);
+
+typedef bt_self_component_status
+(*bt_component_class_filter_accept_output_port_connection_method)(
+               bt_self_component_filter *self_component,
+               bt_self_component_port_output *self_port,
+               const bt_port_input *other_port);
+
+typedef bt_self_component_status
+(*bt_component_class_filter_input_port_connected_method)(
+               bt_self_component_filter *self_component,
+               bt_self_component_port_input *self_port,
+               const bt_port_output *other_port);
+
+typedef bt_self_component_status
+(*bt_component_class_filter_output_port_connected_method)(
+               bt_self_component_filter *self_component,
+               bt_self_component_port_output *self_port,
+               const bt_port_input *other_port);
+
+bt_component_class *bt_component_class_filter_as_component_class(
+               bt_component_class_filter *comp_cls_filter);
+
+extern
+bt_component_class_filter *bt_component_class_filter_create(
+               const char *name,
+               bt_component_class_filter_message_iterator_next_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_init_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_init_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_finalize_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_finalize_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_accept_input_port_connection_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_accept_input_port_connection_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_accept_output_port_connection_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_accept_output_port_connection_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_input_port_connected_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_input_port_connected_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_output_port_connected_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_output_port_connected_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_query_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_query_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_message_iterator_init_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_message_iterator_init_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_message_iterator_finalize_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_message_iterator_finalize_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_message_iterator_seek_ns_from_origin_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_message_iterator_seek_ns_from_origin_method method);
+
+extern bt_component_class_status
+bt_component_class_filter_set_message_iterator_seek_beginning_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_message_iterator_seek_beginning_method method);
+
+extern bt_bool
+bt_component_class_filter_set_message_iterator_can_seek_ns_from_origin_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method method);
+
+extern bt_bool
+bt_component_class_filter_set_message_iterator_can_seek_beginning_method(
+               bt_component_class_filter *comp_class,
+               bt_component_class_filter_message_iterator_can_seek_beginning_method method);
+
+/* From component-class-sink-const.h */
+
+const bt_component_class *
+bt_component_class_sink_as_component_class_const(
+               const bt_component_class_sink *comp_cls_sink);
+
+extern void bt_component_class_sink_get_ref(
+               const bt_component_class_sink *component_class_sink);
+
+extern void bt_component_class_sink_put_ref(
+               const bt_component_class_sink *component_class_sink);
+
+/* From component-class-sink.h */
+
+typedef bt_self_component_status (*bt_component_class_sink_init_method)(
+               bt_self_component_sink *self_component,
+               const bt_value *params, void *init_method_data);
+
+typedef void (*bt_component_class_sink_finalize_method)(
+               bt_self_component_sink *self_component);
+
+typedef bt_query_status
+(*bt_component_class_sink_query_method)(
+               bt_self_component_class_sink *comp_class,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result);
+
+typedef bt_self_component_status
+(*bt_component_class_sink_accept_input_port_connection_method)(
+               bt_self_component_sink *self_component,
+               bt_self_component_port_input *self_port,
+               const bt_port_output *other_port);
+
+typedef bt_self_component_status
+(*bt_component_class_sink_input_port_connected_method)(
+               bt_self_component_sink *self_component,
+               bt_self_component_port_input *self_port,
+               const bt_port_output *other_port);
+
+typedef bt_self_component_status
+(*bt_component_class_sink_graph_is_configured_method)(
+               bt_self_component_sink *self_component);
+
+typedef bt_self_component_status (*bt_component_class_sink_consume_method)(
+       bt_self_component_sink *self_component);
+
+bt_component_class *bt_component_class_sink_as_component_class(
+               bt_component_class_sink *comp_cls_sink);
+
+extern
+bt_component_class_sink *bt_component_class_sink_create(
+               const char *name,
+               bt_component_class_sink_consume_method method);
+
+extern bt_component_class_status bt_component_class_sink_set_init_method(
+               bt_component_class_sink *comp_class,
+               bt_component_class_sink_init_method method);
+
+extern bt_component_class_status bt_component_class_sink_set_finalize_method(
+               bt_component_class_sink *comp_class,
+               bt_component_class_sink_finalize_method method);
+
+extern bt_component_class_status
+bt_component_class_sink_set_accept_input_port_connection_method(
+               bt_component_class_sink *comp_class,
+               bt_component_class_sink_accept_input_port_connection_method method);
+
+extern bt_component_class_status
+bt_component_class_sink_set_input_port_connected_method(
+               bt_component_class_sink *comp_class,
+               bt_component_class_sink_input_port_connected_method method);
+
+extern bt_component_class_status
+bt_component_class_sink_set_graph_is_configured_method(
+               bt_component_class_sink *comp_class,
+               bt_component_class_sink_graph_is_configured_method method);
+
+extern bt_component_class_status bt_component_class_sink_set_query_method(
+               bt_component_class_sink *comp_class,
+               bt_component_class_sink_query_method method);
+
+/* From self-component-class-source.h */
+
+const bt_component_class_source *
+bt_self_component_class_source_as_component_class_source(
+               bt_self_component_class_source *self_comp_cls_source);
+
+/* From self-component-class-filter.h */
+
+const bt_component_class_filter *
+bt_self_component_class_filter_as_component_class_filter(
+               bt_self_component_class_filter *self_comp_cls_filter);
+
+/* From self-component-class-sink.h */
+
+const bt_component_class_sink *
+bt_self_component_class_sink_as_component_class_sink(
+               bt_self_component_class_sink *self_comp_cls_sink);
+
+%{
+/*
+ * This hash table associates a BT component class object address to a
+ * user-defined Python class (PyObject *). The keys and values are NOT
+ * owned by this hash table. The Python class objects are owned by the
+ * Python module, which should not be unloaded until it is not possible
+ * to create a user Python component anyway.
+ *
+ * This hash table is written to when a user-defined Python component
+ * class is created by one of the bt_py3_component_class_*_create()
+ * functions.
+ *
+ * This function is read from when a user calls bt_component_create()
+ * with a component class pointer created by one of the functions above.
+ * In this case, the original Python class needs to be found to
+ * instantiate it and associate the created Python component object with
+ * a BT component object instance.
+ */
+
+static GHashTable *bt_cc_ptr_to_py_cls;
+
+static void register_cc_ptr_to_py_cls(struct bt_component_class *bt_cc,
+               PyObject *py_cls)
+{
+       if (!bt_cc_ptr_to_py_cls) {
+               /*
+                * Lazy-initializing this GHashTable because GLib
+                * might not be initialized yet and it needs to be
+                * before we call g_hash_table_new()
+                */
+               BT_LOGD_STR("Creating native component class to Python component class hash table.");
+               bt_cc_ptr_to_py_cls = g_hash_table_new(g_direct_hash, g_direct_equal);
+               BT_ASSERT(bt_cc_ptr_to_py_cls);
+       }
+
+       g_hash_table_insert(bt_cc_ptr_to_py_cls, (gpointer) bt_cc,
+               (gpointer) py_cls);
+}
+
+static PyObject *lookup_cc_ptr_to_py_cls(const bt_component_class *bt_cc)
+{
+       if (!bt_cc_ptr_to_py_cls) {
+               BT_LOGW("Cannot look up Python component class because hash table is NULL: "
+                       "comp-cls-addr=%p", bt_cc);
+               return NULL;
+       }
+
+       return (PyObject *) g_hash_table_lookup(bt_cc_ptr_to_py_cls,
+               (gconstpointer) bt_cc);
+}
+
+
+/*
+ * Useful Python objects.
+ */
+
+static PyObject *py_mod_bt2 = NULL;
+static PyObject *py_mod_bt2_exc_error_type = NULL;
+static PyObject *py_mod_bt2_exc_try_again_type = NULL;
+static PyObject *py_mod_bt2_exc_stop_type = NULL;
+static PyObject *py_mod_bt2_exc_port_connection_refused_type = NULL;
+static PyObject *py_mod_bt2_exc_notif_iter_canceled_type = NULL;
+static PyObject *py_mod_bt2_exc_invalid_query_object_type = NULL;
+static PyObject *py_mod_bt2_exc_invalid_query_params_type = NULL;
+
+static void bt_py3_cc_init_from_bt2(void)
+{
+       /*
+        * This is called once the bt2 package is loaded.
+        *
+        * Those modules and functions are needed while the package is
+        * used. Loading them here is safe because we know the bt2
+        * package is imported, and we know that the user cannot use the
+        * code here without importing bt2 first.
+        */
+       py_mod_bt2 = PyImport_ImportModule("bt2");
+       BT_ASSERT(py_mod_bt2);
+       py_mod_bt2_exc_error_type =
+               PyObject_GetAttrString(py_mod_bt2, "Error");
+       BT_ASSERT(py_mod_bt2_exc_error_type);
+       py_mod_bt2_exc_try_again_type =
+               PyObject_GetAttrString(py_mod_bt2, "TryAgain");
+       BT_ASSERT(py_mod_bt2_exc_try_again_type);
+       py_mod_bt2_exc_stop_type =
+               PyObject_GetAttrString(py_mod_bt2, "Stop");
+       BT_ASSERT(py_mod_bt2_exc_stop_type);
+       py_mod_bt2_exc_port_connection_refused_type =
+               PyObject_GetAttrString(py_mod_bt2, "PortConnectionRefused");
+       BT_ASSERT(py_mod_bt2_exc_port_connection_refused_type);
+       py_mod_bt2_exc_invalid_query_object_type =
+               PyObject_GetAttrString(py_mod_bt2, "InvalidQueryObject");
+       BT_ASSERT(py_mod_bt2_exc_invalid_query_object_type);
+       py_mod_bt2_exc_invalid_query_params_type =
+               PyObject_GetAttrString(py_mod_bt2, "InvalidQueryParams");
+       BT_ASSERT(py_mod_bt2_exc_invalid_query_params_type);
+}
+
+static void bt_py3_cc_exit_handler(void)
+{
+       /*
+        * This is an exit handler (set by the bt2 package).
+        *
+        * We only give back the references that we took in
+        * bt_py3_cc_init_from_bt2() here. The global variables continue
+        * to exist for the code of this file, but they are now borrowed
+        * references. If this code is executed, it means that somehow
+        * the modules are still loaded, so it should be safe to use
+        * them even without a strong reference.
+        *
+        * We cannot do this in the library's destructor because it
+        * gets executed once Python is already finalized.
+        */
+       Py_XDECREF(py_mod_bt2);
+       Py_XDECREF(py_mod_bt2_exc_error_type);
+       Py_XDECREF(py_mod_bt2_exc_try_again_type);
+       Py_XDECREF(py_mod_bt2_exc_stop_type);
+       Py_XDECREF(py_mod_bt2_exc_port_connection_refused_type);
+       Py_XDECREF(py_mod_bt2_exc_notif_iter_canceled_type);
+       Py_XDECREF(py_mod_bt2_exc_invalid_query_object_type);
+       Py_XDECREF(py_mod_bt2_exc_invalid_query_params_type);
+}
+
+
+/* Library destructor */
+
+__attribute__((destructor))
+static void bt_py3_native_comp_class_dtor(void) {
+       /* Destroy component class association hash table */
+       if (bt_cc_ptr_to_py_cls) {
+               BT_LOGD_STR("Destroying native component class to Python component class hash table.");
+               g_hash_table_destroy(bt_cc_ptr_to_py_cls);
+       }
+}
+
+
+// TODO: maybe we can wrap code in the Python methods (e.g. _query_from_native)
+// in a try catch and print the error there instead, it would be simpler.
+static
+void bt2_py_loge_exception(void)
+{
+       PyObject *type = NULL;
+       PyObject *value = NULL;
+       PyObject *traceback = NULL;
+       PyObject *traceback_module = NULL;
+       PyObject *format_exception_func = NULL;
+       PyObject *exc_str_list = NULL;
+       GString *msg_buf = NULL;
+       Py_ssize_t i;
+
+       BT_ASSERT(PyErr_Occurred() != NULL);
+
+       PyErr_Fetch(&type, &value, &traceback);
+
+       BT_ASSERT(type != NULL);
+
+       /*
+       * traceback can be NULL, when we fail to call a Python function from the
+       * native code (there is not Python stack at that point).  E.g.:
+       *
+       *   TypeError: _accept_port_connection_from_native() takes 3 positional arguments but 4 were given
+       */
+
+
+       /* Make sure `value` is what we expected - an instance of `type`. */
+       PyErr_NormalizeException(&type, &value, &traceback);
+
+       traceback_module = PyImport_ImportModule("traceback");
+       if (!traceback_module) {
+               BT_LOGE_STR("Failed to log Python exception (could not import traceback module).");
+               goto end;
+       }
+
+       format_exception_func = PyObject_GetAttrString(traceback_module,
+               traceback ? "format_exception" : "format_exception_only");
+       if (!format_exception_func) {
+               BT_LOGE_STR("Failed to log Python exception (could not find format_exception).");
+               goto end;
+       }
+
+       if (!PyCallable_Check(format_exception_func)) {
+               BT_LOGE_STR("Failed to log Python exception (format_exception is not callable).");
+               goto end;
+       }
+
+       exc_str_list = PyObject_CallFunctionObjArgs(format_exception_func, type, value, traceback, NULL);
+       if (!exc_str_list) {
+               PyErr_Print();
+               BT_LOGE_STR("Failed to log Python exception (call to format_exception failed).");
+               goto end;
+       }
+
+       msg_buf = g_string_new(NULL);
+
+       for (i = 0; i < PyList_Size(exc_str_list); i++) {
+               PyObject *exc_str = PyList_GetItem(exc_str_list, i);
+               const char *str = PyUnicode_AsUTF8(exc_str);
+               if (!str) {
+                       BT_LOGE_STR("Failed to log Python exception (failed to convert exception to string).");
+                       goto end;
+               }
+
+               g_string_append(msg_buf, str);
+       }
+
+       BT_LOGE_STR(msg_buf->str);
+
+end:
+       if (msg_buf) {
+               g_string_free(msg_buf, TRUE);
+       }
+       Py_XDECREF(exc_str_list);
+       Py_XDECREF(format_exception_func);
+       Py_XDECREF(traceback_module);
+
+       /* PyErr_Restore takes our references. */
+       PyErr_Restore(type, value, traceback);
+}
+
+static bt_self_component_status bt_py3_exc_to_self_component_status(void)
+{
+       bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+       PyObject *exc = PyErr_Occurred();
+
+       if (!exc) {
+               goto end;
+       }
+
+       if (PyErr_GivenExceptionMatches(exc,
+                       py_mod_bt2_exc_try_again_type)) {
+               status = BT_SELF_COMPONENT_STATUS_AGAIN;
+       } else if (PyErr_GivenExceptionMatches(exc,
+                       py_mod_bt2_exc_stop_type)) {
+               status = BT_SELF_COMPONENT_STATUS_END;
+       } else if (PyErr_GivenExceptionMatches(exc,
+                       py_mod_bt2_exc_port_connection_refused_type)) {
+               status = BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION;
+       } else {
+               bt2_py_loge_exception();
+               status = BT_SELF_COMPONENT_STATUS_ERROR;
+       }
+
+end:
+       PyErr_Clear();
+       return status;
+}
+
+/* Component class proxy methods (delegate to the attached Python object) */
+
+static bt_self_message_iterator_status
+bt_py3_exc_to_self_message_iterator_status(void)
+{
+       enum bt_self_message_iterator_status status =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+       PyObject *exc = PyErr_Occurred();
+
+       if (!exc) {
+               goto end;
+       }
+
+       if (PyErr_GivenExceptionMatches(exc, py_mod_bt2_exc_stop_type)) {
+               status = BT_MESSAGE_ITERATOR_STATUS_END;
+       } else if (PyErr_GivenExceptionMatches(exc, py_mod_bt2_exc_try_again_type)) {
+               status = BT_MESSAGE_ITERATOR_STATUS_AGAIN;
+       } else {
+               bt2_py_loge_exception();
+               status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
+       }
+
+end:
+       PyErr_Clear();
+       return status;
+}
+
+static enum bt_query_status bt_py3_exc_to_query_status(void)
+{
+       enum bt_query_status status = BT_QUERY_STATUS_OK;
+       PyObject *exc = PyErr_Occurred();
+
+       if (!exc) {
+               goto end;
+       }
+
+       if (PyErr_GivenExceptionMatches(exc,
+                       py_mod_bt2_exc_invalid_query_object_type)) {
+               status = BT_QUERY_STATUS_INVALID_OBJECT;
+       } else if (PyErr_GivenExceptionMatches(exc,
+                       py_mod_bt2_exc_invalid_query_params_type)) {
+               status = BT_QUERY_STATUS_INVALID_PARAMS;
+       } else if (PyErr_GivenExceptionMatches(exc,
+                       py_mod_bt2_exc_try_again_type)) {
+               status = BT_QUERY_STATUS_AGAIN;
+       } else {
+               bt2_py_loge_exception();
+               status = BT_QUERY_STATUS_ERROR;
+       }
+
+end:
+       PyErr_Clear();
+       return status;
+}
+
+static bt_self_component_status
+bt_py3_component_class_init(
+               bt_self_component *self_component,
+               void *self_component_v,
+               swig_type_info *self_comp_cls_type_swig_type,
+               const bt_value *params,
+               void *init_method_data)
+{
+       const bt_component *component = bt_self_component_as_component(self_component);
+       const bt_component_class *component_class = bt_component_borrow_class_const(component);
+       bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+       PyObject *py_cls = NULL;
+       PyObject *py_comp = NULL;
+       PyObject *py_params_ptr = NULL;
+       PyObject *py_comp_ptr = NULL;
+
+       (void) init_method_data;
+
+       BT_ASSERT(self_component);
+       BT_ASSERT(self_component_v);
+       BT_ASSERT(self_comp_cls_type_swig_type);
+
+       /*
+        * Get the user-defined Python class which created this
+        * component's class in the first place (borrowed
+        * reference).
+        */
+       py_cls = lookup_cc_ptr_to_py_cls(component_class);
+       if (!py_cls) {
+               BT_LOGE("Cannot find Python class associated to native component class: "
+                       "comp-cls-addr=%p", component_class);
+               goto error;
+       }
+
+       /* Parameters pointer -> SWIG pointer Python object */
+       py_params_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(params),
+               SWIGTYPE_p_bt_value, 0);
+       if (!py_params_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       py_comp_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_v),
+               self_comp_cls_type_swig_type, 0);
+       if (!py_comp_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       /*
+        * Do the equivalent of this:
+        *
+        *     py_comp = py_cls._init_from_native(py_comp_ptr, py_params_ptr)
+        *
+        * _UserComponentType._init_from_native() calls the Python
+        * component object's __init__() function.
+        */
+       py_comp = PyObject_CallMethod(py_cls,
+               "_init_from_native", "(OO)", py_comp_ptr, py_params_ptr);
+       if (!py_comp) {
+               bt2_py_loge_exception();
+               BT_LOGE("Failed to call Python class's _init_from_native() method: "
+                       "py-cls-addr=%p", py_cls);
+
+               goto error;
+       }
+
+       /*
+        * Our user Python component object is now fully created and
+        * initialized by the user. Since we just created it, this
+        * native component is its only (persistent) owner.
+        */
+       bt_self_component_set_data(self_component, py_comp);
+       py_comp = NULL;
+       goto end;
+
+error:
+       status = BT_SELF_COMPONENT_STATUS_ERROR;
+
+       /*
+        * Clear any exception: we're returning a bad status anyway. If
+        * this call originated from Python (creation from a plugin's
+        * component class, for example), then the user gets an
+        * appropriate creation error.
+        */
+       PyErr_Clear();
+
+end:
+       Py_XDECREF(py_comp);
+       Py_XDECREF(py_params_ptr);
+       Py_XDECREF(py_comp_ptr);
+       return status;
+}
+
+/*
+ * Method of bt_component_class_source to initialize a bt_self_component_source
+ * of that class.
+ */
+
+static bt_self_component_status
+bt_py3_component_class_source_init(bt_self_component_source *self_component_source,
+               const bt_value *params, void *init_method_data)
+{
+       bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
+       return bt_py3_component_class_init(
+               self_component,
+               self_component_source,
+               SWIGTYPE_p_bt_self_component_source,
+               params, init_method_data);
+}
+
+static bt_self_component_status
+bt_py3_component_class_filter_init(bt_self_component_filter *self_component_filter,
+               const bt_value *params, void *init_method_data)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+       return bt_py3_component_class_init(
+               self_component,
+               self_component_filter,
+               SWIGTYPE_p_bt_self_component_filter,
+               params, init_method_data);
+}
+
+static bt_self_component_status
+bt_py3_component_class_sink_init(bt_self_component_sink *self_component_sink,
+               const bt_value *params, void *init_method_data)
+{
+       bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
+       return bt_py3_component_class_init(
+               self_component,
+               self_component_sink,
+               SWIGTYPE_p_bt_self_component_sink,
+               params, init_method_data);
+}
+
+static void bt_py3_component_class_finalize(bt_self_component *self_component)
+{
+       PyObject *py_comp = bt_self_component_get_data(self_component);
+       BT_ASSERT(py_comp);
+
+       /* Call user's _finalize() method */
+       PyObject *py_method_result = PyObject_CallMethod(py_comp,
+               "_finalize", NULL);
+
+       if (PyErr_Occurred()) {
+               BT_LOGW("User's _finalize() method raised an exception: ignoring.");
+       }
+
+       /*
+        * Ignore any exception raised by the _finalize() method because
+        * it won't change anything at this point: the component is
+        * being destroyed anyway.
+        */
+       PyErr_Clear();
+       Py_XDECREF(py_method_result);
+       Py_DECREF(py_comp);
+}
+
+static void
+bt_py3_component_class_source_finalize(bt_self_component_source *self_component_source)
+{
+       bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
+       bt_py3_component_class_finalize(self_component);
+}
+
+static void
+bt_py3_component_class_filter_finalize(bt_self_component_filter *self_component_filter)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+       bt_py3_component_class_finalize(self_component);
+}
+
+static void
+bt_py3_component_class_sink_finalize(bt_self_component_sink *self_component_sink)
+{
+       bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
+       bt_py3_component_class_finalize(self_component);
+}
+
+static bt_self_component_status
+bt_py3_component_class_accept_port_connection(
+               bt_self_component *self_component,
+               bt_self_component_port *self_component_port,
+               bt_port_type self_component_port_type,
+               const bt_port *other_port)
+{
+       enum bt_self_component_status status;
+       PyObject *py_comp = NULL;
+       PyObject *py_self_port_ptr = NULL;
+       PyObject *py_other_port_ptr = NULL;
+       PyObject *py_method_result = NULL;
+
+       py_comp = bt_self_component_get_data(self_component);
+       BT_ASSERT(py_comp);
+
+       swig_type_info *self_component_port_swig_type = NULL;
+       swig_type_info *other_port_swig_type = NULL;
+       switch (self_component_port_type) {
+       case BT_PORT_TYPE_INPUT:
+               self_component_port_swig_type = SWIGTYPE_p_bt_self_component_port_input;
+               other_port_swig_type = SWIGTYPE_p_bt_port_output;
+               break;
+       case BT_PORT_TYPE_OUTPUT:
+               self_component_port_swig_type = SWIGTYPE_p_bt_self_component_port_output;
+               other_port_swig_type = SWIGTYPE_p_bt_port_input;
+               break;
+       }
+       BT_ASSERT(self_component_port_swig_type != NULL);
+       BT_ASSERT(other_port_swig_type != NULL);
+
+       py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port),
+               self_component_port_swig_type, 0);
+       if (!py_self_port_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       py_other_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(other_port),
+               other_port_swig_type, 0);
+       if (!py_other_port_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       py_method_result = PyObject_CallMethod(py_comp,
+               "_accept_port_connection_from_native", "(OiO)", py_self_port_ptr,
+               self_component_port_type, py_other_port_ptr);
+
+       status = bt_py3_exc_to_self_component_status();
+       if (!py_method_result && status == BT_SELF_COMPONENT_STATUS_OK) {
+               /* Pretty sure this should never happen, but just in case */
+               BT_LOGE("User's _accept_port_connection() method failed without raising an exception: "
+                       "status=%d", status);
+               goto error;
+       }
+
+       if (status == BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION) {
+               /*
+                * Looks like the user method raised
+                * PortConnectionRefused: accept this like if it
+                * returned False.
+                */
+               goto end;
+       } else if (status != BT_SELF_COMPONENT_STATUS_OK) {
+               BT_LOGE("User's _accept_port_connection() raised an unexpected exception: "
+                       "status=%d", status);
+               goto error;
+       }
+
+       BT_ASSERT(PyBool_Check(py_method_result));
+
+       if (py_method_result == Py_True) {
+               status = BT_SELF_COMPONENT_STATUS_OK;
+       } else {
+               status = BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION;
+       }
+
+       goto end;
+
+error:
+       status = BT_SELF_COMPONENT_STATUS_ERROR;
+
+       /*
+        * Clear any exception: we're returning a bad status anyway. If
+        * this call originated from Python, then the user gets an
+        * appropriate error.
+        */
+       PyErr_Clear();
+
+end:
+       Py_XDECREF(py_self_port_ptr);
+       Py_XDECREF(py_other_port_ptr);
+       Py_XDECREF(py_method_result);
+       return status;
+}
+
+static bt_self_component_status
+bt_py3_component_class_source_accept_output_port_connection(bt_self_component_source *self_component_source,
+        bt_self_component_port_output *self_component_port_output,
+        const bt_port_input *other_port_input)
+{
+       bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
+       bt_self_component_port *self_component_port = bt_self_component_port_output_as_self_component_port(self_component_port_output);
+       const bt_port *other_port = bt_port_input_as_port_const(other_port_input);
+       return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_OUTPUT, other_port);
+}
+
+static bt_self_component_status
+bt_py3_component_class_filter_accept_input_port_connection(bt_self_component_filter *self_component_filter,
+               bt_self_component_port_input *self_component_port_input,
+               const bt_port_output *other_port_output)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+       bt_self_component_port *self_component_port = bt_self_component_port_input_as_self_component_port(self_component_port_input);
+       const bt_port *other_port = bt_port_output_as_port_const(other_port_output);
+       return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_INPUT, other_port);
+}
+
+static bt_self_component_status
+bt_py3_component_class_filter_accept_output_port_connection(bt_self_component_filter *self_component_filter,
+               bt_self_component_port_output *self_component_port_output,
+               const bt_port_input *other_port_input)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+       bt_self_component_port *self_component_port = bt_self_component_port_output_as_self_component_port(self_component_port_output);
+       const bt_port *other_port = bt_port_input_as_port_const(other_port_input);
+       return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_OUTPUT, other_port);
+}
+
+static bt_self_component_status
+bt_py3_component_class_sink_accept_input_port_connection(bt_self_component_sink *self_component_sink,
+               bt_self_component_port_input *self_component_port_input,
+               const bt_port_output *other_port_output)
+{
+       bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
+       bt_self_component_port *self_component_port = bt_self_component_port_input_as_self_component_port(self_component_port_input);
+       const bt_port *other_port = bt_port_output_as_port_const(other_port_output);
+       return bt_py3_component_class_accept_port_connection(self_component, self_component_port, BT_PORT_TYPE_INPUT, other_port);
+}
+
+static bt_self_component_status
+bt_py3_component_class_port_connected(
+               bt_self_component *self_component,
+               void *self_component_port,
+               swig_type_info *self_component_port_swig_type,
+               bt_port_type self_component_port_type,
+               const void *other_port,
+               swig_type_info *other_port_swig_type)
+{
+       bt_self_component_status status;
+       PyObject *py_comp = NULL;
+       PyObject *py_self_port_ptr = NULL;
+       PyObject *py_other_port_ptr = NULL;
+       PyObject *py_method_result = NULL;
+
+       py_comp = bt_self_component_get_data(self_component);
+       BT_ASSERT(py_comp);
+
+       py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port),
+               self_component_port_swig_type, 0);
+       if (!py_self_port_ptr) {
+               BT_LOGF_STR("Failed to create a SWIG pointer object.");
+               status = BT_SELF_COMPONENT_STATUS_NOMEM;
+               goto end;
+       }
+
+       py_other_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(other_port),
+               other_port_swig_type, 0);
+       if (!py_other_port_ptr) {
+               BT_LOGF_STR("Failed to create a SWIG pointer object.");
+               status = BT_SELF_COMPONENT_STATUS_NOMEM;
+               goto end;       }
+
+       py_method_result = PyObject_CallMethod(py_comp,
+               "_port_connected_from_native", "(OiO)", py_self_port_ptr,
+               self_component_port_type, py_other_port_ptr);
+
+       BT_ASSERT(!py_method_result || py_method_result == Py_None);
+
+       status = bt_py3_exc_to_self_component_status();
+
+end:
+       Py_XDECREF(py_self_port_ptr);
+       Py_XDECREF(py_other_port_ptr);
+       Py_XDECREF(py_method_result);
+
+       return status;
+}
+
+static bt_self_component_status
+bt_py3_component_class_source_output_port_connected(
+               bt_self_component_source *self_component_source,
+               bt_self_component_port_output *self_component_port_output,
+               const bt_port_input *other_port_input)
+{
+       bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
+
+       return bt_py3_component_class_port_connected(
+               self_component,
+               self_component_port_output,
+               SWIGTYPE_p_bt_self_component_port_output,
+               BT_PORT_TYPE_OUTPUT,
+               other_port_input,
+               SWIGTYPE_p_bt_port_input);
+}
+
+static bt_self_component_status
+bt_py3_component_class_filter_input_port_connected(
+               bt_self_component_filter *self_component_filter,
+               bt_self_component_port_input *self_component_port_input,
+               const bt_port_output *other_port_output)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+
+       return bt_py3_component_class_port_connected(
+               self_component,
+               self_component_port_input,
+               SWIGTYPE_p_bt_self_component_port_input,
+               BT_PORT_TYPE_INPUT,
+               other_port_output,
+               SWIGTYPE_p_bt_port_output);
+}
+
+static bt_self_component_status
+bt_py3_component_class_filter_output_port_connected(
+               bt_self_component_filter *self_component_filter,
+               bt_self_component_port_output *self_component_port_output,
+               const bt_port_input *other_port_input)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+
+       return bt_py3_component_class_port_connected(
+               self_component,
+               self_component_port_output,
+               SWIGTYPE_p_bt_self_component_port_output,
+               BT_PORT_TYPE_OUTPUT,
+               other_port_input,
+               SWIGTYPE_p_bt_port_input);
+}
+
+static bt_self_component_status
+bt_py3_component_class_sink_input_port_connected(
+               bt_self_component_sink *self_component_sink,
+               bt_self_component_port_input *self_component_port_input,
+               const bt_port_output *other_port_output)
+{
+       bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
+
+       return bt_py3_component_class_port_connected(
+               self_component,
+               self_component_port_input,
+               SWIGTYPE_p_bt_self_component_port_input,
+               BT_PORT_TYPE_INPUT,
+               other_port_output,
+               SWIGTYPE_p_bt_port_output);
+}
+
+static bt_self_component_status
+bt_py3_component_class_sink_graph_is_configured(bt_self_component_sink *self_component_sink)
+{
+       PyObject *py_comp = NULL;
+       PyObject *py_method_result = NULL;
+       bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+       bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
+
+       py_comp = bt_self_component_get_data(self_component);
+       py_method_result = PyObject_CallMethod(py_comp,
+               "_graph_is_configured_from_native", NULL);
+
+       BT_ASSERT(!py_method_result || py_method_result == Py_None);
+
+       status = bt_py3_exc_to_self_component_status();
+
+       Py_XDECREF(py_method_result);
+
+       return status;
+}
+
+static bt_query_status
+bt_py3_component_class_query(
+               const bt_component_class *component_class,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result)
+{
+       PyObject *py_cls = NULL;
+       PyObject *py_params_ptr = NULL;
+       PyObject *py_query_exec_ptr = NULL;
+       PyObject *py_query_func = NULL;
+       PyObject *py_object = NULL;
+       PyObject *py_results_addr = NULL;
+       bt_query_status status = BT_QUERY_STATUS_OK;
+
+       py_cls = lookup_cc_ptr_to_py_cls(component_class);
+       if (!py_cls) {
+               BT_LOGE("Cannot find Python class associated to native component class: "
+                       "comp-cls-addr=%p", component_class);
+               goto error;
+       }
+
+       py_params_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(params),
+               SWIGTYPE_p_bt_value, 0);
+       if (!py_params_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       py_query_exec_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(query_executor),
+               SWIGTYPE_p_bt_query_executor, 0);
+       if (!py_query_exec_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       py_object = SWIG_FromCharPtr(object);
+       if (!py_object) {
+               BT_LOGE_STR("Failed to create a Python string.");
+               goto error;
+       }
+
+       py_results_addr = PyObject_CallMethod(py_cls,
+               "_query_from_native", "(OOO)", py_query_exec_ptr,
+               py_object, py_params_ptr);
+
+       if (!py_results_addr) {
+               BT_LOGE("Failed to call Python class's _query_from_native() method: "
+                       "py-cls-addr=%p", py_cls);
+               status = bt_py3_exc_to_query_status();
+               goto end;
+       }
+
+       /*
+        * The returned object, on success, is an integer object
+        * (PyLong) containing the address of a BT value object (new
+        * reference).
+        */
+       *result = (void *) PyLong_AsUnsignedLongLong(py_results_addr);
+       BT_ASSERT(!PyErr_Occurred());
+       BT_ASSERT(*result);
+       goto end;
+
+error:
+       PyErr_Clear();
+       status = BT_QUERY_STATUS_ERROR;
+
+end:
+       Py_XDECREF(py_params_ptr);
+       Py_XDECREF(py_query_exec_ptr);
+       Py_XDECREF(py_query_func);
+       Py_XDECREF(py_object);
+       Py_XDECREF(py_results_addr);
+       return status;
+}
+
+static bt_query_status
+bt_py3_component_class_source_query(
+               bt_self_component_class_source *self_component_class_source,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result)
+{
+       const bt_component_class_source *component_class_source = bt_self_component_class_source_as_component_class_source(self_component_class_source);
+       const bt_component_class *component_class = bt_component_class_source_as_component_class_const(component_class_source);
+       return bt_py3_component_class_query(component_class, query_executor, object, params, result);
+}
+
+static bt_query_status
+bt_py3_component_class_filter_query(
+               bt_self_component_class_filter *self_component_class_filter,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result)
+{
+       const bt_component_class_filter *component_class_filter = bt_self_component_class_filter_as_component_class_filter(self_component_class_filter);
+       const bt_component_class *component_class = bt_component_class_filter_as_component_class_const(component_class_filter);
+       return bt_py3_component_class_query(component_class, query_executor, object, params, result);
+}
+
+static bt_query_status
+bt_py3_component_class_sink_query(
+               bt_self_component_class_sink *self_component_class_sink,
+               const bt_query_executor *query_executor,
+               const char *object, const bt_value *params,
+               const bt_value **result)
+{
+       const bt_component_class_sink *component_class_sink = bt_self_component_class_sink_as_component_class_sink(self_component_class_sink);
+       const bt_component_class *component_class = bt_component_class_sink_as_component_class_const(component_class_sink);
+       return bt_py3_component_class_query(component_class, query_executor, object, params, result);
+}
+
+static bt_self_message_iterator_status
+bt_py3_component_class_message_iterator_init(
+               bt_self_message_iterator *self_message_iterator,
+               bt_self_component *self_component,
+               bt_self_component_port_output *self_component_port_output)
+{
+       bt_self_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
+       PyObject *py_comp_cls = NULL;
+       PyObject *py_iter_cls = NULL;
+       PyObject *py_iter_ptr = NULL;
+       PyObject *py_init_method_result = NULL;
+       PyObject *py_iter = NULL;
+       PyObject *py_comp;
+
+       py_comp = bt_self_component_get_data(self_component);
+
+       /* Find user's Python notification iterator class */
+       py_comp_cls = PyObject_GetAttrString(py_comp, "__class__");
+       if (!py_comp_cls) {
+               BT_LOGE_STR("Cannot get Python object's `__class__` attribute.");
+               goto error;
+       }
+
+       py_iter_cls = PyObject_GetAttrString(py_comp_cls, "_iter_cls");
+       if (!py_iter_cls) {
+               BT_LOGE_STR("Cannot get Python class's `_iter_cls` attribute.");
+               goto error;
+       }
+
+       py_iter_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_message_iterator),
+               SWIGTYPE_p_bt_self_message_iterator, 0);
+       if (!py_iter_ptr) {
+               BT_LOGE_STR("Failed to create a SWIG pointer object.");
+               goto error;
+       }
+
+       /*
+        * Create object with borrowed native notification iterator
+        * reference:
+        *
+        *     py_iter = py_iter_cls.__new__(py_iter_cls, py_iter_ptr)
+        */
+       py_iter = PyObject_CallMethod(py_iter_cls, "__new__",
+               "(OO)", py_iter_cls, py_iter_ptr);
+       if (!py_iter) {
+               BT_LOGE("Failed to call Python class's __new__() method: "
+                       "py-cls-addr=%p", py_iter_cls);
+               bt2_py_loge_exception();
+               goto error;
+       }
+
+       /*
+        * Initialize object:
+        *
+        *     py_iter.__init__()
+        *
+        * At this point, py_iter._ptr is set, so this initialization
+        * function has access to self._component (which gives it the
+        * user Python component object from which the iterator was
+        * created).
+        */
+       py_init_method_result = PyObject_CallMethod(py_iter, "__init__", NULL);
+       if (!py_init_method_result) {
+               BT_LOGE_STR("User's __init__() method failed.");
+               bt2_py_loge_exception();
+               goto error;
+       }
+
+       /*
+        * Since the Python code can never instantiate a user-defined
+        * notification iterator class, the native notification iterator
+        * object does NOT belong to a user Python notification iterator
+        * object (borrowed reference). However this Python object is
+        * owned by this native notification iterator object.
+        *
+        * In the Python world, the lifetime of the native notification
+        * iterator is managed by a _GenericNotificationIterator
+        * instance:
+        *
+        *     _GenericNotificationIterator instance:
+        *         owns a native bt_notification_iterator object (iter)
+        *             owns a _UserMessageIterator instance (py_iter)
+        *                 self._ptr is a borrowed reference to the
+        *                 native bt_private_connection_private_notification_iterator
+        *                 object (iter)
+        */
+       bt_self_message_iterator_set_data(self_message_iterator, py_iter);
+       py_iter = NULL;
+       goto end;
+
+error:
+       status = bt_py3_exc_to_self_message_iterator_status();
+       if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+               /*
+                * Looks like there wasn't any exception from the Python
+                * side, but we're still in an error state here.
+                */
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+       }
+
+       /*
+        * Clear any exception: we're returning a bad status anyway. If
+        * this call originated from Python, then the user gets an
+        * appropriate creation error.
+        */
+       PyErr_Clear();
+
+end:
+       Py_XDECREF(py_comp_cls);
+       Py_XDECREF(py_iter_cls);
+       Py_XDECREF(py_iter_ptr);
+       Py_XDECREF(py_init_method_result);
+       Py_XDECREF(py_iter);
+       return status;
+}
+
+static bt_self_message_iterator_status
+bt_py3_component_class_source_message_iterator_init(
+               bt_self_message_iterator *self_message_iterator,
+               bt_self_component_source *self_component_source,
+               bt_self_component_port_output *self_component_port_output)
+{
+       bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
+       return bt_py3_component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
+}
+
+static bt_self_message_iterator_status
+bt_py3_component_class_filter_message_iterator_init(
+               bt_self_message_iterator *self_message_iterator,
+               bt_self_component_filter *self_component_filter,
+               bt_self_component_port_output *self_component_port_output)
+{
+       bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
+       return bt_py3_component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
+}
+
+static void
+bt_py3_component_class_message_iterator_finalize(
+               bt_self_message_iterator *message_iterator)
+{
+       PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator);
+       PyObject *py_method_result = NULL;
+
+       BT_ASSERT(py_message_iter);
+
+       /* Call user's _finalize() method */
+       py_method_result = PyObject_CallMethod(py_message_iter,
+               "_finalize", NULL);
+
+       if (PyErr_Occurred()) {
+               BT_LOGW("User's _finalize() method raised an exception: ignoring.");
+       }
+
+       /*
+        * Ignore any exception raised by the _finalize() method because
+        * it won't change anything at this point: the component is
+        * being destroyed anyway.
+        */
+       PyErr_Clear();
+       Py_XDECREF(py_method_result);
+       Py_DECREF(py_message_iter);
+}
+
+/* Valid for both sources and filters. */
+
+static bt_self_message_iterator_status
+bt_py3_component_class_message_iterator_next(
+                       bt_self_message_iterator *message_iterator,
+                       bt_message_array_const msgs, uint64_t capacity,
+                       uint64_t *count)
+{
+       bt_self_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
+       PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator);
+       PyObject *py_method_result = NULL;
+
+       BT_ASSERT(py_message_iter);
+       py_method_result = PyObject_CallMethod(py_message_iter,
+               "_next_from_native", NULL);
+       if (!py_method_result) {
+               status = bt_py3_exc_to_self_message_iterator_status();
+               BT_ASSERT(status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK);
+               goto end;
+       }
+
+       /*
+        * The returned object, on success, is an integer object
+        * (PyLong) containing the address of a native notification
+        * object (which is now ours).
+        */
+       msgs[0] =
+               (const bt_message *) PyLong_AsUnsignedLongLong(
+                       py_method_result);
+       *count = 1;
+
+       /* Clear potential overflow error; should never happen */
+       BT_ASSERT(!PyErr_Occurred());
+       goto end;
+
+end:
+       Py_XDECREF(py_method_result);
+       return status;
+}
+
+static bt_self_component_status
+bt_py3_component_class_sink_consume(bt_self_component_sink *self_component_sink)
+{
+       bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
+       PyObject *py_comp = bt_self_component_get_data(self_component);
+       PyObject *py_method_result = NULL;
+       bt_self_component_status status;
+
+       BT_ASSERT(py_comp);
+       py_method_result = PyObject_CallMethod(py_comp,
+               "_consume", NULL);
+
+       status = bt_py3_exc_to_self_component_status();
+       if (!py_method_result && status == BT_SELF_COMPONENT_STATUS_OK) {
+               /* Pretty sure this should never happen, but just in case */
+               BT_LOGE("User's _consume() method failed without raising an exception: "
+                       "status=%d", status);
+               status = BT_SELF_COMPONENT_STATUS_ERROR;
+       }
+
+       Py_XDECREF(py_method_result);
+       return status;
+}
+
+static
+int bt_py3_component_class_set_help_and_desc(
+               bt_component_class *component_class,
+               const char *description, const char *help)
+{
+       int ret;
+
+       if (description) {
+               ret = bt_component_class_set_description(component_class, description);
+               if (ret) {
+                       BT_LOGE("Cannot set component class's description: "
+                               "comp-cls-addr=%p", component_class);
+                       goto end;
+               }
+       }
+
+       if (help) {
+               ret = bt_component_class_set_help(component_class, help);
+               if (ret) {
+                       BT_LOGE("Cannot set component class's help text: "
+                               "comp-cls-addr=%p", component_class);
+                       goto end;
+               }
+       }
+
+       ret = 0;
+
+end:
+       return ret;
+}
+
+static
+bt_component_class_source *bt_py3_component_class_source_create(
+               PyObject *py_cls, const char *name, const char *description,
+               const char *help)
+{
+       bt_component_class_source *component_class_source;
+       bt_component_class *component_class;
+       int ret;
+
+       BT_ASSERT(py_cls);
+
+       component_class_source = bt_component_class_source_create(name,
+               bt_py3_component_class_message_iterator_next);
+       if (!component_class_source) {
+               BT_LOGE_STR("Cannot create source component class.");
+               goto end;
+       }
+
+       component_class = bt_component_class_source_as_component_class(component_class_source);
+
+       if (bt_py3_component_class_set_help_and_desc(component_class, description, help)) {
+               goto end;
+       }
+
+       ret = bt_component_class_source_set_init_method(component_class_source, bt_py3_component_class_source_init);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_source_set_finalize_method (component_class_source, bt_py3_component_class_source_finalize);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_source_set_accept_output_port_connection_method(component_class_source,
+               bt_py3_component_class_source_accept_output_port_connection);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_source_set_output_port_connected_method(component_class_source,
+               bt_py3_component_class_source_output_port_connected);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_source_set_query_method(component_class_source, bt_py3_component_class_source_query);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_source_set_message_iterator_init_method(
+               component_class_source, bt_py3_component_class_source_message_iterator_init);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_source_set_message_iterator_finalize_method(
+               component_class_source, bt_py3_component_class_message_iterator_finalize);
+       BT_ASSERT(ret == 0);
+
+       register_cc_ptr_to_py_cls(component_class, py_cls);
+
+end:
+       return component_class_source;
+}
+
+static
+bt_component_class_filter *bt_py3_component_class_filter_create(
+               PyObject *py_cls, const char *name, const char *description,
+               const char *help)
+{
+       bt_component_class *component_class;
+       bt_component_class_filter *component_class_filter;
+       int ret;
+
+       BT_ASSERT(py_cls);
+
+       component_class_filter = bt_component_class_filter_create(name,
+               bt_py3_component_class_message_iterator_next);
+       if (!component_class_filter) {
+               BT_LOGE_STR("Cannot create filter component class.");
+               goto end;
+       }
+
+       component_class = bt_component_class_filter_as_component_class(component_class_filter);
+
+       if (bt_py3_component_class_set_help_and_desc(component_class, description, help)) {
+               goto end;
+       }
+
+       ret = bt_component_class_filter_set_init_method(component_class_filter, bt_py3_component_class_filter_init);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_finalize_method (component_class_filter, bt_py3_component_class_filter_finalize);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_accept_input_port_connection_method(component_class_filter,
+               bt_py3_component_class_filter_accept_input_port_connection);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_accept_output_port_connection_method(component_class_filter,
+               bt_py3_component_class_filter_accept_output_port_connection);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_input_port_connected_method(component_class_filter,
+               bt_py3_component_class_filter_input_port_connected);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_output_port_connected_method(component_class_filter,
+               bt_py3_component_class_filter_output_port_connected);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_query_method(component_class_filter, bt_py3_component_class_filter_query);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_message_iterator_init_method(
+               component_class_filter, bt_py3_component_class_filter_message_iterator_init);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_filter_set_message_iterator_finalize_method(
+               component_class_filter, bt_py3_component_class_message_iterator_finalize);
+       BT_ASSERT(ret == 0);
+
+       register_cc_ptr_to_py_cls(component_class, py_cls);
+
+end:
+       return component_class_filter;
+}
+
+static
+bt_component_class_sink *bt_py3_component_class_sink_create(
+               PyObject *py_cls, const char *name, const char *description,
+               const char *help)
+{
+       bt_component_class_sink *component_class_sink;
+       bt_component_class *component_class;
+       int ret;
+
+       BT_ASSERT(py_cls);
+
+       component_class_sink = bt_component_class_sink_create(name, bt_py3_component_class_sink_consume);
+
+       if (!component_class_sink) {
+               BT_LOGE_STR("Cannot create sink component class.");
+               goto end;
+       }
+
+       component_class = bt_component_class_sink_as_component_class(component_class_sink);
+
+       if (bt_py3_component_class_set_help_and_desc(component_class, description, help)) {
+               goto end;
+       }
+
+       ret = bt_component_class_sink_set_init_method(component_class_sink, bt_py3_component_class_sink_init);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_sink_set_finalize_method(component_class_sink, bt_py3_component_class_sink_finalize);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_sink_set_accept_input_port_connection_method(component_class_sink,
+               bt_py3_component_class_sink_accept_input_port_connection);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_sink_set_input_port_connected_method(component_class_sink,
+               bt_py3_component_class_sink_input_port_connected);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_sink_set_graph_is_configured_method(component_class_sink,
+               bt_py3_component_class_sink_graph_is_configured);
+       BT_ASSERT(ret == 0);
+       ret = bt_component_class_sink_set_query_method(component_class_sink, bt_py3_component_class_sink_query);
+       BT_ASSERT(ret == 0);
+
+       register_cc_ptr_to_py_cls(component_class, py_cls);
+
+end:
+       return component_class_sink;
+}
+%}
+
+struct bt_component_class_source *bt_py3_component_class_source_create(
+               PyObject *py_cls, const char *name, const char *description,
+               const char *help);
+struct bt_component_class_filter *bt_py3_component_class_filter_create(
+               PyObject *py_cls, const char *name, const char *description,
+               const char *help);
+struct bt_component_class_sink *bt_py3_component_class_sink_create(
+               PyObject *py_cls, const char *name, const char *description,
+               const char *help);
+void bt_py3_cc_init_from_bt2(void);
+void bt_py3_cc_exit_handler(void);
diff --git a/bindings/python/bt2/bt2/native_bt_connection.i b/bindings/python/bt2/bt2/native_bt_connection.i
new file mode 100644 (file)
index 0000000..dbdb04a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From connection-const.h */
+
+extern const bt_port_input *bt_connection_borrow_downstream_port_const(
+               const bt_connection *connection);
+
+extern const bt_port_output *bt_connection_borrow_upstream_port_const(
+               const bt_connection *connection);
+
+extern void bt_connection_get_ref(const bt_connection *connection);
+
+extern void bt_connection_put_ref(const bt_connection *connection);
diff --git a/bindings/python/bt2/bt2/native_bt_event.i b/bindings/python/bt2/bt2/native_bt_event.i
new file mode 100644 (file)
index 0000000..82ddbfa
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From event-const.h */
+
+typedef enum bt_event_status {
+       BT_EVENT_STATUS_OK = 0,
+       BT_EVENT_STATUS_NOMEM = -12,
+} bt_event_status;
+
+extern const bt_event_class *bt_event_borrow_class_const(
+               const bt_event *event);
+
+extern const bt_packet *bt_event_borrow_packet_const(
+               const bt_event *event);
+
+extern const bt_stream *bt_event_borrow_stream_const(
+               const bt_event *event);
+
+extern const bt_field *bt_event_borrow_common_context_field_const(
+               const bt_event *event);
+
+extern const bt_field *bt_event_borrow_specific_context_field_const(
+               const bt_event *event);
+
+extern const bt_field *bt_event_borrow_payload_field_const(
+               const bt_event *event);
+
+/* From event.h */
+
+extern bt_event_class *bt_event_borrow_class(bt_event *event);
+
+extern bt_packet *bt_event_borrow_packet(bt_event *event);
+
+extern bt_stream *bt_event_borrow_stream(bt_event *event);
+
+extern bt_field *
+bt_event_borrow_common_context_field(bt_event *event);
+
+extern bt_field *
+bt_event_borrow_specific_context_field(bt_event *event);
+
+extern bt_field *bt_event_borrow_payload_field(bt_event *event);
diff --git a/bindings/python/bt2/bt2/native_bt_event_class.i b/bindings/python/bt2/bt2/native_bt_event_class.i
new file mode 100644 (file)
index 0000000..cac0c41
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* Output argument typemap for initialized event class log level output
+ * parameter (always appends).
+ */
+%typemap(in, numinputs=0)
+       (bt_event_class_log_level *OUT)
+       (bt_event_class_log_level temp = -1) {
+       $1 = &temp;
+}
+
+%typemap(argout) bt_event_class_log_level *OUT {
+       /* SWIG_Python_AppendOutput() steals the created object */
+       $result = SWIG_Python_AppendOutput($result, SWIG_From_int(*$1));
+}
+
+/* From event-class-const.h */
+
+typedef enum bt_event_class_status {
+       BT_EVENT_CLASS_STATUS_OK = 0,
+       BT_EVENT_CLASS_STATUS_NOMEM = -12,
+} bt_event_class_status;
+
+typedef enum bt_event_class_log_level {
+       BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY,
+       BT_EVENT_CLASS_LOG_LEVEL_ALERT,
+       BT_EVENT_CLASS_LOG_LEVEL_CRITICAL,
+       BT_EVENT_CLASS_LOG_LEVEL_ERROR,
+       BT_EVENT_CLASS_LOG_LEVEL_WARNING,
+       BT_EVENT_CLASS_LOG_LEVEL_NOTICE,
+       BT_EVENT_CLASS_LOG_LEVEL_INFO,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE,
+       BT_EVENT_CLASS_LOG_LEVEL_DEBUG,
+} bt_event_class_log_level;
+
+extern const bt_stream_class *bt_event_class_borrow_stream_class_const(
+               const bt_event_class *event_class);
+
+extern const char *bt_event_class_get_name(const bt_event_class *event_class);
+
+extern uint64_t bt_event_class_get_id(const bt_event_class *event_class);
+
+extern bt_property_availability bt_event_class_get_log_level(
+               const bt_event_class *event_class,
+               bt_event_class_log_level *OUT);
+
+extern const char *bt_event_class_get_emf_uri(
+               const bt_event_class *event_class);
+
+extern const bt_field_class *
+bt_event_class_borrow_specific_context_field_class_const(
+               const bt_event_class *event_class);
+
+extern const bt_field_class *bt_event_class_borrow_payload_field_class_const(
+               const bt_event_class *event_class);
+
+extern void bt_event_class_get_ref(const bt_event_class *event_class);
+
+extern void bt_event_class_put_ref(const bt_event_class *event_class);
+
+/* From event-class.h */
+
+extern bt_event_class *bt_event_class_create(
+               bt_stream_class *stream_class);
+
+extern bt_event_class *bt_event_class_create_with_id(
+               bt_stream_class *stream_class, uint64_t id);
+
+extern bt_stream_class *bt_event_class_borrow_stream_class(
+               bt_event_class *event_class);
+
+extern bt_event_class_status bt_event_class_set_name(
+               bt_event_class *event_class, const char *name);
+
+extern void bt_event_class_set_log_level(bt_event_class *event_class,
+               bt_event_class_log_level log_level);
+
+extern bt_event_class_status bt_event_class_set_emf_uri(
+               bt_event_class *event_class, const char *emf_uri);
+
+extern bt_event_class_status
+bt_event_class_set_specific_context_field_class(bt_event_class *event_class,
+               bt_field_class *field_class);
+
+extern bt_field_class *
+bt_event_class_borrow_specific_context_field_class(bt_event_class *event_class);
+
+extern bt_event_class_status bt_event_class_set_payload_field_class(
+               bt_event_class *event_class,
+               bt_field_class *field_class);
+
+extern bt_field_class *bt_event_class_borrow_payload_field_class(
+               bt_event_class *event_class);
diff --git a/bindings/python/bt2/bt2/native_bt_field.i b/bindings/python/bt2/bt2/native_bt_field.i
new file mode 100644 (file)
index 0000000..1a7c2cd
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From field-const.h */
+
+typedef enum bt_field_status {
+       BT_FIELD_STATUS_OK = 0,
+       BT_FIELD_STATUS_NOMEM = -12,
+} bt_field_status;
+
+extern const bt_field_class *bt_field_borrow_class_const(
+               const bt_field *field);
+
+extern bt_field_class_type bt_field_get_class_type(
+               const bt_field *field);
+
+extern int64_t bt_field_signed_integer_get_value(const bt_field *field);
+
+extern uint64_t bt_field_unsigned_integer_get_value(
+               const bt_field *field);
+
+extern double bt_field_real_get_value(const bt_field *field);
+
+extern bt_field_status bt_field_unsigned_enumeration_get_mapping_labels(
+               const bt_field *field,
+               bt_field_class_enumeration_mapping_label_array *label_array,
+               uint64_t *count);
+
+extern bt_field_status bt_field_signed_enumeration_get_mapping_labels(
+               const bt_field *field,
+               bt_field_class_enumeration_mapping_label_array *label_array,
+               uint64_t *count);
+
+extern const char *bt_field_string_get_value(const bt_field *field);
+
+extern uint64_t bt_field_string_get_length(const bt_field *field);
+
+extern const bt_field *
+bt_field_structure_borrow_member_field_by_index_const(
+               const bt_field *field, uint64_t index);
+
+extern const bt_field *
+bt_field_structure_borrow_member_field_by_name_const(
+               const bt_field *field, const char *name);
+
+extern uint64_t bt_field_array_get_length(const bt_field *field);
+
+extern const bt_field *
+bt_field_array_borrow_element_field_by_index_const(
+               const bt_field *field, uint64_t index);
+
+extern uint64_t bt_field_variant_get_selected_option_field_index(
+               const bt_field *field);
+
+extern const bt_field *
+bt_field_variant_borrow_selected_option_field_const(
+               const bt_field *field);
+
+/* From field.h */
+
+extern void bt_field_signed_integer_set_value(bt_field *field,
+               int64_t value);
+
+extern void bt_field_unsigned_integer_set_value(bt_field *field,
+               uint64_t value);
+
+extern void bt_field_real_set_value(bt_field *field, double value);
+
+extern bt_field_status bt_field_string_set_value(bt_field *field,
+               const char *value);
+
+extern bt_field_status bt_field_string_append(bt_field *field,
+               const char *value);
+
+extern bt_field_status bt_field_string_append_with_length(bt_field *field,
+               const char *value, uint64_t length);
+
+extern bt_field_status bt_field_string_clear(bt_field *field);
+
+extern bt_field *bt_field_structure_borrow_member_field_by_index(
+               bt_field *field, uint64_t index);
+
+extern bt_field *bt_field_structure_borrow_member_field_by_name(
+               bt_field *field, const char *name);
+
+extern bt_field *bt_field_array_borrow_element_field_by_index(
+               bt_field *field, uint64_t index);
+
+extern bt_field_status bt_field_dynamic_array_set_length(bt_field *field,
+               uint64_t length);
+
+extern bt_field_status bt_field_variant_select_option_field(
+               bt_field *field, uint64_t index);
+
+extern bt_field *bt_field_variant_borrow_selected_option_field(
+               bt_field *field);
diff --git a/bindings/python/bt2/bt2/native_bt_field_class.i b/bindings/python/bt2/bt2/native_bt_field_class.i
new file mode 100644 (file)
index 0000000..a7ae445
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+%typemap(in, numinputs=0)
+       (bt_field_class_enumeration_mapping_label_array *LABELARRAY, uint64_t *LABELCOUNT)
+       (bt_field_class_enumeration_mapping_label_array temp_array, uint64_t temp_label_count = 0) {
+       $1 = &temp_array;
+       $2 = &temp_label_count;
+}
+
+%typemap(argout)
+       (bt_field_class_enumeration_mapping_label_array *LABELARRAY, uint64_t *LABELCOUNT) {
+       if (*$1) {
+               PyObject *py_label_list = PyList_New(*$2);
+               for (int i = 0; i < *$2; i++) {
+                       PyList_SET_ITEM(py_label_list, i, PyUnicode_FromString((*$1)[i]));
+               }
+
+               $result = SWIG_Python_AppendOutput($result, py_label_list);
+       } else {
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* Output argument typemap for value output (always appends) */
+%typemap(in, numinputs=0)
+       (const bt_field_class_signed_enumeration_mapping_ranges **ENUM_RANGE_MAPPING)
+       (bt_field_class_signed_enumeration_mapping_ranges *temp_value = NULL) {
+       $1 = &temp_value;
+}
+
+%typemap(argout)
+       (const bt_field_class_signed_enumeration_mapping_ranges **ENUM_RANGE_MAPPING) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_field_class_signed_enumeration_mapping_ranges, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* Output argument typemap for value output (always appends) */
+%typemap(in, numinputs=0)
+       (const bt_field_class_unsigned_enumeration_mapping_ranges **ENUM_RANGE_MAPPING)
+       (bt_field_class_unsigned_enumeration_mapping_ranges *temp_value = NULL) {
+       $1 = &temp_value;
+}
+
+%typemap(argout)
+       (const bt_field_class_unsigned_enumeration_mapping_ranges **ENUM_RANGE_MAPPING ) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_field_class_unsigned_enumeration_mapping_ranges, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* From field-class-const.h */
+
+typedef enum bt_field_class_status {
+       BT_FIELD_CLASS_STATUS_OK = 0,
+       BT_FIELD_CLASS_STATUS_NOMEM = -12,
+} bt_field_class_status;
+
+typedef enum bt_field_class_type {
+       BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER,
+       BT_FIELD_CLASS_TYPE_SIGNED_INTEGER,
+       BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
+       BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
+       BT_FIELD_CLASS_TYPE_REAL,
+       BT_FIELD_CLASS_TYPE_STRING,
+       BT_FIELD_CLASS_TYPE_STRUCTURE,
+       BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
+       BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
+       BT_FIELD_CLASS_TYPE_VARIANT,
+} bt_field_class_type;
+
+typedef enum bt_field_class_integer_preferred_display_base {
+       BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY,
+       BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL,
+       BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
+       BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL,
+} bt_field_class_integer_preferred_display_base;
+
+extern bt_field_class_type bt_field_class_get_type(
+               const bt_field_class *field_class);
+
+extern uint64_t bt_field_class_integer_get_field_value_range(
+               const bt_field_class *field_class);
+
+extern bt_field_class_integer_preferred_display_base
+bt_field_class_integer_get_preferred_display_base(
+               const bt_field_class *field_class);
+
+extern bt_bool bt_field_class_real_is_single_precision(
+               const bt_field_class *field_class);
+
+extern uint64_t bt_field_class_enumeration_get_mapping_count(
+               const bt_field_class *field_class);
+
+extern void bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const(
+               const bt_field_class *field_class, uint64_t index,
+               const char **OUT,
+               const bt_field_class_unsigned_enumeration_mapping_ranges **ENUM_RANGE_MAPPING);
+
+extern void bt_field_class_signed_enumeration_borrow_mapping_by_index_const(
+               const bt_field_class *field_class, uint64_t index,
+               const char **OUT,
+               const bt_field_class_signed_enumeration_mapping_ranges **ENUM_RANGE_MAPPING);
+
+extern uint64_t
+bt_field_class_unsigned_enumeration_mapping_ranges_get_range_count(
+               const bt_field_class_unsigned_enumeration_mapping_ranges *ranges);
+
+extern uint64_t
+bt_field_class_signed_enumeration_mapping_ranges_get_range_count(
+               const bt_field_class_signed_enumeration_mapping_ranges *ranges);
+
+extern void
+bt_field_class_unsigned_enumeration_mapping_ranges_get_range_by_index(
+               const bt_field_class_unsigned_enumeration_mapping_ranges *ranges,
+               uint64_t index, uint64_t *OUT, uint64_t *OUT);
+
+extern void
+bt_field_class_signed_enumeration_mapping_ranges_get_range_by_index(
+               const bt_field_class_signed_enumeration_mapping_ranges *ranges,
+               uint64_t index, int64_t *OUT, int64_t *OUT);
+
+extern bt_field_class_status
+bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
+               const bt_field_class *field_class, uint64_t value,
+               bt_field_class_enumeration_mapping_label_array *LABELARRAY,
+               uint64_t *LABELCOUNT);
+
+extern bt_field_class_status
+bt_field_class_signed_enumeration_get_mapping_labels_by_value(
+               const bt_field_class *field_class, int64_t value,
+               bt_field_class_enumeration_mapping_label_array *LABELARRAY,
+               uint64_t *LABELCOUNT);
+
+extern uint64_t bt_field_class_structure_get_member_count(
+               const bt_field_class *field_class);
+
+extern const bt_field_class_structure_member *
+bt_field_class_structure_borrow_member_by_index_const(
+               const bt_field_class *field_class, uint64_t index);
+
+extern const bt_field_class_structure_member *
+bt_field_class_structure_borrow_member_by_name_const(
+               const bt_field_class *field_class, const char *name);
+
+extern const char *bt_field_class_structure_member_get_name(
+               const bt_field_class_structure_member *member);
+
+extern const bt_field_class *
+bt_field_class_structure_member_borrow_field_class_const(
+               const bt_field_class_structure_member *member);
+
+extern const bt_field_class *
+bt_field_class_array_borrow_element_field_class_const(
+               const bt_field_class *field_class);
+
+extern uint64_t bt_field_class_static_array_get_length(
+               const bt_field_class *field_class);
+
+extern const bt_field_path *
+bt_field_class_dynamic_array_borrow_length_field_path_const(
+               const bt_field_class *field_class);
+
+extern const bt_field_path *
+bt_field_class_variant_borrow_selector_field_path_const(
+               const bt_field_class *field_class);
+
+extern uint64_t bt_field_class_variant_get_option_count(
+               const bt_field_class *field_class);
+
+extern const bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_index_const(
+               const bt_field_class *field_class, uint64_t index);
+
+extern const bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_name_const(
+               const bt_field_class *field_class, const char *name);
+
+extern const char *bt_field_class_variant_option_get_name(
+               const bt_field_class_variant_option *option);
+
+extern const bt_field_class *
+bt_field_class_variant_option_borrow_field_class_const(
+               const bt_field_class_variant_option *option);
+
+extern void bt_field_class_get_ref(const bt_field_class *field_class);
+
+extern void bt_field_class_put_ref(const bt_field_class *field_class);
+
+/* From field-class.h */
+
+extern bt_field_class *bt_field_class_unsigned_integer_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class *bt_field_class_signed_integer_create(
+               bt_trace_class *trace_class);
+
+extern void bt_field_class_integer_set_field_value_range(
+               bt_field_class *field_class, uint64_t size);
+
+extern void bt_field_class_integer_set_preferred_display_base(
+               bt_field_class *field_class,
+               bt_field_class_integer_preferred_display_base base);
+
+extern bt_field_class *bt_field_class_real_create(bt_trace_class *trace_class);
+
+extern void bt_field_class_real_set_is_single_precision(
+               bt_field_class *field_class,
+               bt_bool is_single_precision);
+
+extern bt_field_class *bt_field_class_unsigned_enumeration_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class *bt_field_class_signed_enumeration_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
+               bt_field_class *field_class, const char *label,
+               uint64_t range_lower, uint64_t range_upper);
+
+extern bt_field_class_status bt_field_class_signed_enumeration_map_range(
+               bt_field_class *field_class, const char *label,
+               int64_t range_lower, int64_t range_upper);
+
+extern bt_field_class *bt_field_class_string_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class *bt_field_class_structure_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class_status bt_field_class_structure_append_member(
+               bt_field_class *struct_field_class,
+               const char *name, bt_field_class *field_class);
+
+extern bt_field_class_structure_member *
+bt_field_class_structure_borrow_member_by_index(
+               bt_field_class *field_class, uint64_t index);
+
+extern bt_field_class_structure_member *
+bt_field_class_structure_borrow_member_by_name(
+               bt_field_class *field_class, const char *name);
+
+extern bt_field_class *bt_field_class_static_array_create(
+               bt_trace_class *trace_class,
+               bt_field_class *elem_field_class, uint64_t length);
+
+extern bt_field_class *bt_field_class_dynamic_array_create(
+               bt_trace_class *trace_class,
+               bt_field_class *elem_field_class);
+
+extern bt_field_class *bt_field_class_array_borrow_element_field_class(
+               bt_field_class *field_class);
+
+extern bt_field_class_status
+bt_field_class_dynamic_array_set_length_field_class(
+               bt_field_class *field_class,
+               bt_field_class *length_field_class);
+
+extern bt_field_class *bt_field_class_variant_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class_status
+bt_field_class_variant_set_selector_field_class(bt_field_class *field_class,
+               bt_field_class *selector_field_class);
+
+extern bt_field_class_status bt_field_class_variant_append_option(
+               bt_field_class *var_field_class,
+               const char *name, bt_field_class *field_class);
+
+extern bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_index(
+               bt_field_class *field_class, uint64_t index);
+
+extern bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_name(
+               bt_field_class *field_class, char *name);
+
+extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
+               bt_field_class_variant_option *option);
diff --git a/bindings/python/bt2/bt2/native_bt_field_path.i b/bindings/python/bt2/bt2/native_bt_field_path.i
new file mode 100644 (file)
index 0000000..5369f44
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From field-path-const.h */
+
+typedef enum bt_field_path_item_type {
+       BT_FIELD_PATH_ITEM_TYPE_INDEX,
+       BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT,
+} bt_field_path_item_type;
+
+typedef enum bt_scope {
+       BT_SCOPE_PACKET_CONTEXT,
+       BT_SCOPE_EVENT_COMMON_CONTEXT,
+       BT_SCOPE_EVENT_SPECIFIC_CONTEXT,
+       BT_SCOPE_EVENT_PAYLOAD,
+} bt_scope;
+
+extern bt_scope bt_field_path_get_root_scope(
+               const bt_field_path *field_path);
+
+extern uint64_t bt_field_path_get_item_count(
+               const bt_field_path *field_path);
+
+extern const bt_field_path_item *bt_field_path_borrow_item_by_index_const(
+               const bt_field_path *field_path, uint64_t index);
+
+extern bt_field_path_item_type bt_field_path_item_get_type(
+               const bt_field_path_item *field_path_item);
+
+extern uint64_t bt_field_path_item_index_get_index(
+               const bt_field_path_item *field_path_item);
+
+extern void bt_field_path_get_ref(const bt_field_path *field_path);
+
+extern void bt_field_path_put_ref(const bt_field_path *field_path);
diff --git a/bindings/python/bt2/bt2/native_bt_graph.i b/bindings/python/bt2/bt2/native_bt_graph.i
new file mode 100644 (file)
index 0000000..c898c78
--- /dev/null
@@ -0,0 +1,642 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* Output argument typemap for connection output (always appends) */
+%typemap(in, numinputs=0)
+       (const bt_connection **BTOUTCONN)
+       (bt_connection *temp_conn = NULL) {
+       $1 = &temp_conn;
+}
+
+%typemap(argout)
+       (const bt_connection **BTOUTCONN) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_connection, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* Output argument typemap for component output (always appends) */
+%typemap(in, numinputs=0)
+       (const bt_component_source **OUT)
+       (bt_component_source *temp_comp = NULL) {
+       $1 = &temp_comp;
+}
+
+%typemap(in, numinputs=0)
+       (const bt_component_filter **OUT)
+       (bt_component_filter *temp_comp = NULL) {
+       $1 = &temp_comp;
+}
+
+%typemap(in, numinputs=0)
+       (const bt_component_sink **OUT)
+       (bt_component_sink *temp_comp = NULL) {
+       $1 = &temp_comp;
+}
+
+%typemap(argout) (const bt_component_source **OUT) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_component_source, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+%typemap(argout) (const bt_component_filter **OUT) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_component_filter, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+%typemap(argout) (const bt_component_sink **OUT) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_component_sink, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* From graph-const.h */
+
+typedef enum bt_graph_status {
+       BT_GRAPH_STATUS_OK = 0,
+       BT_GRAPH_STATUS_END = 1,
+       BT_GRAPH_STATUS_AGAIN = 11,
+       BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111,
+       BT_GRAPH_STATUS_CANCELED = 125,
+       BT_GRAPH_STATUS_ERROR = -1,
+       BT_GRAPH_STATUS_NOMEM = -12,
+} bt_graph_status;
+
+extern bt_bool bt_graph_is_canceled(const bt_graph *graph);
+
+extern void bt_graph_get_ref(const bt_graph *graph);
+
+extern void bt_graph_put_ref(const bt_graph *graph);
+
+/* From graph.h */
+
+typedef void (*bt_graph_filter_component_input_port_added_listener_func)(
+               const bt_component_filter *component,
+               const bt_port_input *port, void *data);
+
+typedef void (*bt_graph_sink_component_input_port_added_listener_func)(
+               const bt_component_sink *component,
+               const bt_port_input *port, void *data);
+
+typedef void (*bt_graph_source_component_output_port_added_listener_func)(
+               const bt_component_source *component,
+               const bt_port_output *port, void *data);
+
+typedef void (*bt_graph_filter_component_output_port_added_listener_func)(
+               const bt_component_filter *component,
+               const bt_port_output *port, void *data);
+
+typedef void (*bt_graph_source_filter_component_ports_connected_listener_func)(
+               const bt_component_source *source_component,
+               const bt_component_filter *filter_component,
+               const bt_port_output *upstream_port,
+               const bt_port_input *downstream_port, void *data);
+
+typedef void (*bt_graph_source_sink_component_ports_connected_listener_func)(
+               const bt_component_source *source_component,
+               const bt_component_sink *sink_component,
+               const bt_port_output *upstream_port,
+               const bt_port_input *downstream_port, void *data);
+
+typedef void (*bt_graph_filter_filter_component_ports_connected_listener_func)(
+               const bt_component_filter *filter_component_upstream,
+               const bt_component_filter *filter_component_downstream,
+               const bt_port_output *upstream_port,
+               const bt_port_input *downstream_port,
+               void *data);
+
+typedef void (*bt_graph_filter_sink_component_ports_connected_listener_func)(
+               const bt_component_filter *filter_component,
+               const bt_component_sink *sink_component,
+               const bt_port_output *upstream_port,
+               const bt_port_input *downstream_port, void *data);
+
+typedef void (* bt_graph_listener_removed_func)(void *data);
+
+extern bt_graph *bt_graph_create(void);
+
+extern bt_graph_status bt_graph_add_source_component(bt_graph *graph,
+               const bt_component_class_source *component_class,
+               const char *name, const bt_value *params,
+               const bt_component_source **OUT);
+
+extern bt_graph_status bt_graph_add_source_component_with_init_method_data(
+               bt_graph *graph,
+               const bt_component_class_source *component_class,
+               const char *name, const bt_value *params,
+               void *init_method_data,
+               const bt_component_source **OUT);
+
+extern bt_graph_status bt_graph_add_filter_component(bt_graph *graph,
+               const bt_component_class_filter *component_class,
+               const char *name, const bt_value *params,
+               const bt_component_filter **OUT);
+
+extern bt_graph_status bt_graph_add_filter_component_with_init_method_data(
+               bt_graph *graph,
+               const bt_component_class_filter *component_class,
+               const char *name, const bt_value *params,
+               void *init_method_data,
+               const bt_component_filter **OUT);
+
+extern bt_graph_status bt_graph_add_sink_component(
+               bt_graph *graph, const bt_component_class_sink *component_class,
+               const char *name, const bt_value *params,
+               const bt_component_sink **OUT);
+
+extern bt_graph_status bt_graph_add_sink_component_with_init_method_data(
+               bt_graph *graph, const bt_component_class_sink *component_class,
+               const char *name, const bt_value *params,
+               void *init_method_data,
+               const bt_component_sink **OUT);
+
+extern bt_graph_status bt_graph_connect_ports(bt_graph *graph,
+               const bt_port_output *upstream,
+               const bt_port_input *downstream,
+               const bt_connection **BTOUTCONN);
+
+extern bt_graph_status bt_graph_run(bt_graph *graph);
+
+extern bt_graph_status bt_graph_consume(bt_graph *graph);
+
+extern bt_graph_status bt_graph_add_filter_component_input_port_added_listener(
+               bt_graph *graph,
+               bt_graph_filter_component_input_port_added_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status bt_graph_add_sink_component_input_port_added_listener(
+               bt_graph *graph,
+               bt_graph_sink_component_input_port_added_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status bt_graph_add_source_component_output_port_added_listener(
+               bt_graph *graph,
+               bt_graph_source_component_output_port_added_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status bt_graph_add_filter_component_output_port_added_listener(
+               bt_graph *graph,
+               bt_graph_filter_component_output_port_added_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status
+bt_graph_add_source_filter_component_ports_connected_listener(
+               bt_graph *graph,
+               bt_graph_source_filter_component_ports_connected_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status
+bt_graph_add_filter_filter_component_ports_connected_listener(
+               bt_graph *graph,
+               bt_graph_filter_filter_component_ports_connected_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status
+bt_graph_add_source_sink_component_ports_connected_listener(
+               bt_graph *graph,
+               bt_graph_source_sink_component_ports_connected_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status
+bt_graph_add_filter_sink_component_ports_connected_listener(
+               bt_graph *graph,
+               bt_graph_filter_sink_component_ports_connected_listener_func listener,
+               bt_graph_listener_removed_func listener_removed, void *data,
+               int *listener_id);
+
+extern bt_graph_status bt_graph_cancel(bt_graph *graph);
+
+/* Helper functions for Python */
+
+%{
+
+static void graph_listener_removed(void *py_callable)
+{
+       BT_ASSERT(py_callable);
+       Py_DECREF(py_callable);
+}
+
+static void
+port_added_listener(
+       const void *component,
+       swig_type_info *component_swig_type,
+       bt_component_class_type component_class_type,   
+       const void *port,
+       swig_type_info *port_swig_type,
+       bt_port_type port_type,
+       void *py_callable)
+{
+       PyObject *py_component_ptr = NULL;
+       PyObject *py_port_ptr = NULL;
+       PyObject *py_res = NULL;
+
+       py_component_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(component), component_swig_type, 0);
+       if (!py_component_ptr) {
+               BT_LOGF_STR("Failed to create component SWIG pointer object.");
+               goto end;
+       }
+
+       py_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(port), port_swig_type, 0);
+       if (!py_port_ptr) {
+               BT_LOGF_STR("Failed to create port SWIG pointer object.");
+               goto end;
+       }
+
+       py_res = PyObject_CallFunction(py_callable, "(OiOi)",
+               py_component_ptr, component_class_type, py_port_ptr, port_type);
+       if (!py_res) {
+               bt2_py_loge_exception();
+               PyErr_Clear();
+       } else {
+               BT_ASSERT(py_res == Py_None);
+       }
+
+end:
+       Py_XDECREF(py_res);
+       Py_XDECREF(py_port_ptr);
+       Py_XDECREF(py_component_ptr);
+}
+
+static void
+source_component_output_port_added_listener(const bt_component_source *component_source,
+                                           const bt_port_output *port_output, void *py_callable)
+{
+       port_added_listener(
+               component_source, SWIGTYPE_p_bt_component_source, BT_COMPONENT_CLASS_TYPE_SOURCE,
+               port_output, SWIGTYPE_p_bt_port_output, BT_PORT_TYPE_OUTPUT, py_callable);
+}
+
+static void
+filter_component_input_port_added_listener(const bt_component_filter *component_filter,
+                                          const bt_port_input *port_input, void *py_callable)
+{
+       port_added_listener(
+               component_filter, SWIGTYPE_p_bt_component_filter, BT_COMPONENT_CLASS_TYPE_FILTER,
+               port_input, SWIGTYPE_p_bt_port_input, BT_PORT_TYPE_INPUT, py_callable);
+}
+
+static void
+filter_component_output_port_added_listener(const bt_component_filter *component_filter,
+                                           const bt_port_output *port_output, void *py_callable)
+{
+       port_added_listener(
+               component_filter, SWIGTYPE_p_bt_component_filter, BT_COMPONENT_CLASS_TYPE_FILTER,
+               port_output, SWIGTYPE_p_bt_port_output, BT_PORT_TYPE_OUTPUT, py_callable);
+}
+
+static void
+sink_component_input_port_added_listener(const bt_component_sink *component_sink,
+                                        const bt_port_input *port_input, void *py_callable)
+{
+       port_added_listener(
+               component_sink, SWIGTYPE_p_bt_component_sink, BT_COMPONENT_CLASS_TYPE_SINK,
+               port_input, SWIGTYPE_p_bt_port_input, BT_PORT_TYPE_INPUT, py_callable);
+}
+
+static PyObject *
+bt_py3_graph_add_port_added_listener(struct bt_graph *graph,
+                                    PyObject *py_callable)
+{
+       PyObject *py_listener_ids = NULL;
+       PyObject *py_listener_id = NULL;
+       int listener_id;
+       bt_graph_status status;
+
+       BT_ASSERT(graph);
+       BT_ASSERT(py_callable);
+
+       /*
+        * Behind the scene, we will be registering 4 different listeners and
+        * return all of their ids.
+        */
+       py_listener_ids = PyTuple_New(4);
+       if (!py_listener_ids) {
+               goto error;
+       }
+
+       /* source output port */
+       status = bt_graph_add_source_component_output_port_added_listener(
+               graph, source_component_output_port_added_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 0, py_listener_id);
+       py_listener_id = NULL;
+
+       /* filter input port */
+       status = bt_graph_add_filter_component_input_port_added_listener(
+               graph, filter_component_input_port_added_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 1, py_listener_id);
+       py_listener_id = NULL;
+
+       /* filter output port */
+       status = bt_graph_add_filter_component_output_port_added_listener(
+               graph, filter_component_output_port_added_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 2, py_listener_id);
+       py_listener_id = NULL;
+
+       /* sink input port */
+       status = bt_graph_add_sink_component_input_port_added_listener(
+               graph, sink_component_input_port_added_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+
+       PyTuple_SET_ITEM(py_listener_ids, 3, py_listener_id);
+       py_listener_id = NULL;
+
+       Py_INCREF(py_callable);
+       Py_INCREF(py_callable);
+       Py_INCREF(py_callable);
+       Py_INCREF(py_callable);
+
+       goto end;
+
+error:
+       Py_XDECREF(py_listener_ids);
+       py_listener_ids = Py_None;
+       Py_INCREF(py_listener_ids);
+
+end:
+
+       Py_XDECREF(py_listener_id);
+       return py_listener_ids;
+}
+
+static void
+ports_connected_listener(const bt_port_output *upstream_port,
+                        const bt_port_input *downstream_port,
+                        void *py_callable)
+{
+       PyObject *py_upstream_port_ptr = NULL;
+       PyObject *py_downstream_port_ptr = NULL;
+       PyObject *py_res = NULL;
+
+       py_upstream_port_ptr = SWIG_NewPointerObj(
+               SWIG_as_voidptr(upstream_port), SWIGTYPE_p_bt_port_output, 0);
+       if (!py_upstream_port_ptr) {
+               BT_LOGF_STR("Failed to create a SWIG pointer object.");
+               abort();
+       }
+
+       py_downstream_port_ptr = SWIG_NewPointerObj(
+               SWIG_as_voidptr(downstream_port), SWIGTYPE_p_bt_port_input, 0);
+       if (!py_downstream_port_ptr) {
+               BT_LOGF_STR("Failed to create a SWIG pointer object.");
+               abort();
+       }
+
+       py_res = PyObject_CallFunction(py_callable, "(OO)",
+               py_upstream_port_ptr, py_downstream_port_ptr);
+       if (!py_res) {
+               bt2_py_loge_exception();
+               PyErr_Clear();
+       } else {
+               BT_ASSERT(py_res == Py_None);
+       }
+
+       Py_DECREF(py_upstream_port_ptr);
+       Py_DECREF(py_downstream_port_ptr);
+       Py_XDECREF(py_res);
+}
+
+static void
+source_filter_component_ports_connected_listener(
+       const bt_component_source *source_component,
+       const bt_component_filter *filter_component,
+       const bt_port_output *upstream_port,
+       const bt_port_input *downstream_port, void *py_callable)
+{
+       ports_connected_listener(upstream_port, downstream_port, py_callable);
+}
+
+static void
+source_sink_component_ports_connected_listener(
+       const bt_component_source *source_component,
+       const bt_component_sink *sink_component,
+       const bt_port_output *upstream_port,
+       const bt_port_input *downstream_port, void *py_callable)
+{
+       ports_connected_listener(upstream_port, downstream_port, py_callable);
+}
+
+static void
+filter_filter_component_ports_connected_listener(
+       const bt_component_filter *filter_component_left,
+       const bt_component_filter *filter_component_right,
+       const bt_port_output *upstream_port,
+       const bt_port_input *downstream_port, void *py_callable)
+{
+       ports_connected_listener(upstream_port, downstream_port, py_callable);
+}
+
+static void
+filter_sink_component_ports_connected_listener(
+       const bt_component_filter *filter_component,
+       const bt_component_sink *sink_component,
+       const bt_port_output *upstream_port,
+       const bt_port_input *downstream_port, void *py_callable)
+{
+       ports_connected_listener(upstream_port, downstream_port, py_callable);
+}
+
+
+static PyObject*
+bt_py3_graph_add_ports_connected_listener(struct bt_graph *graph,
+       PyObject *py_callable)
+{
+       PyObject *py_listener_ids = NULL;
+       PyObject *py_listener_id = NULL;
+       int listener_id;
+       bt_graph_status status;
+
+       BT_ASSERT(graph);
+       BT_ASSERT(py_callable);
+
+       /* Behind the scene, we will be registering 4 different listeners and
+        * return all of their ids. */
+       py_listener_ids = PyTuple_New(4);
+       if (!py_listener_ids) {
+               goto error;
+       }
+
+       /* source -> filter connection */
+       status = bt_graph_add_source_filter_component_ports_connected_listener(
+               graph, source_filter_component_ports_connected_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 0, py_listener_id);
+       py_listener_id = NULL;
+
+       /* source -> sink connection */
+       status = bt_graph_add_source_sink_component_ports_connected_listener(
+               graph, source_sink_component_ports_connected_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 1, py_listener_id);
+       py_listener_id = NULL;
+
+       /* filter -> filter connection */
+       status = bt_graph_add_filter_filter_component_ports_connected_listener(
+               graph, filter_filter_component_ports_connected_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 2, py_listener_id);
+       py_listener_id = NULL;
+
+       /* filter -> sink connection */
+       status = bt_graph_add_filter_sink_component_ports_connected_listener(
+               graph, filter_sink_component_ports_connected_listener,
+               graph_listener_removed, py_callable, &listener_id);
+       if (status != BT_GRAPH_STATUS_OK) {
+               goto error;
+       }
+
+       py_listener_id = PyLong_FromLong(listener_id);
+       if (!py_listener_id) {
+               goto error;
+       }
+
+       PyTuple_SET_ITEM(py_listener_ids, 3, py_listener_id);
+       py_listener_id = NULL;
+
+       Py_INCREF(py_callable);
+       Py_INCREF(py_callable);
+       Py_INCREF(py_callable);
+       Py_INCREF(py_callable);
+
+       goto end;
+
+error:
+       Py_XDECREF(py_listener_ids);
+       py_listener_ids = Py_None;
+       Py_INCREF(py_listener_ids);
+
+end:
+
+       Py_XDECREF(py_listener_id);
+       return py_listener_ids;
+}
+
+%}
+
+PyObject *bt_py3_graph_add_port_added_listener(struct bt_graph *graph,
+               PyObject *py_callable);
+PyObject *bt_py3_graph_add_ports_connected_listener(struct bt_graph *graph,
+               PyObject *py_callable);
diff --git a/bindings/python/bt2/bt2/native_bt_logging.i b/bindings/python/bt2/bt2/native_bt_logging.i
new file mode 100644 (file)
index 0000000..0406a2a
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+%{
+#include <babeltrace/logging.h>
+%}
+
+/* Log levels */
+enum bt_logging_level {
+       BT_LOGGING_LEVEL_VERBOSE = 1,
+       BT_LOGGING_LEVEL_DEBUG = 2,
+       BT_LOGGING_LEVEL_INFO = 3,
+       BT_LOGGING_LEVEL_WARN = 4,
+       BT_LOGGING_LEVEL_ERROR = 5,
+       BT_LOGGING_LEVEL_FATAL = 6,
+       BT_LOGGING_LEVEL_NONE = 0xff,
+};
+
+/* Logging functions */
+enum bt_logging_level bt_logging_get_minimal_level(void);
+enum bt_logging_level bt_logging_get_global_level(void);
+void bt_logging_set_global_level(enum bt_logging_level log_level);
diff --git a/bindings/python/bt2/bt2/native_bt_message.i b/bindings/python/bt2/bt2/native_bt_message.i
new file mode 100644 (file)
index 0000000..07c7678
--- /dev/null
@@ -0,0 +1,337 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+
+/* Output argument typemap for clock value output (always appends) */
+%typemap(in, numinputs=0)
+       (const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT)
+       (bt_clock_snapshot *temp_clock_snapshot = NULL) {
+       $1 = &temp_clock_snapshot;
+}
+
+%typemap(argout)
+       (const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT) {
+       if (*$1) {
+               /* SWIG_Python_AppendOutput() steals the created object */
+               $result = SWIG_Python_AppendOutput($result,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
+                                       SWIGTYPE_p_bt_clock_snapshot, 0));
+       } else {
+               /* SWIG_Python_AppendOutput() steals Py_None */
+               Py_INCREF(Py_None);
+               $result = SWIG_Python_AppendOutput($result, Py_None);
+       }
+}
+
+/* From message-const.h */
+
+typedef enum bt_message_type {
+       BT_MESSAGE_TYPE_EVENT = 0,
+       BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY = 1,
+       BT_MESSAGE_TYPE_STREAM_BEGINNING = 2,
+       BT_MESSAGE_TYPE_STREAM_END = 3,
+       BT_MESSAGE_TYPE_PACKET_BEGINNING = 4,
+       BT_MESSAGE_TYPE_PACKET_END = 5,
+       BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING = 6,
+       BT_MESSAGE_TYPE_STREAM_ACTIVITY_END = 7,
+       BT_MESSAGE_TYPE_DISCARDED_EVENTS = 8,
+       BT_MESSAGE_TYPE_DISCARDED_PACKETS = 9,
+} bt_message_type;
+
+extern bt_message_type bt_message_get_type(const bt_message *message);
+
+extern void bt_message_get_ref(const bt_message *message);
+
+extern void bt_message_put_ref(const bt_message *message);
+
+/* From message-event-const.h */
+
+extern const bt_event *bt_message_event_borrow_event_const(
+               const bt_message *message);
+
+extern bt_clock_snapshot_state
+bt_message_event_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_event_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+/* From message-event.h */
+
+extern
+bt_message *bt_message_event_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_event_class *event_class,
+               const bt_packet *packet);
+
+extern
+bt_message *bt_message_event_create_with_default_clock_snapshot(
+               bt_self_message_iterator *message_iterator,
+               const bt_event_class *event_class,
+               const bt_packet *packet, uint64_t raw_clock_value);
+
+extern bt_event *bt_message_event_borrow_event(
+               bt_message *message);
+
+/* From message-message-iterator-inactivity-const.h */
+
+extern bt_clock_snapshot_state
+bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+/* From message-message-iterator-inactivity.h */
+
+extern
+bt_message *bt_message_message_iterator_inactivity_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_clock_class *default_clock_class, uint64_t raw_value);
+
+/* From message-stream-beginning-const.h */
+
+extern const bt_stream *bt_message_stream_beginning_borrow_stream_const(
+               const bt_message *message);
+
+/* From message-stream-beginning.h */
+
+extern
+bt_message *bt_message_stream_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream);
+
+extern bt_stream *bt_message_stream_beginning_borrow_stream(
+               bt_message *message);
+
+/* From message-stream-end-const.h */
+
+extern const bt_stream *bt_message_stream_end_borrow_stream_const(
+               const bt_message *message);
+
+/* From message-stream-end.h */
+
+extern
+bt_message *bt_message_stream_end_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream);
+
+extern bt_stream *bt_message_stream_end_borrow_stream(
+               bt_message *message);
+
+/* From message-packet-beginning-const.h */
+
+extern const bt_packet *bt_message_packet_beginning_borrow_packet_const(
+               const bt_message *message);
+
+extern bt_clock_snapshot_state
+bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+/* From message-packet-beginning.h */
+
+extern
+bt_message *bt_message_packet_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_packet *packet);
+
+extern
+bt_message *bt_message_packet_beginning_create_with_default_clock_snapshot(
+               bt_self_message_iterator *message_iterator,
+               const bt_packet *packet, uint64_t raw_value);
+
+extern bt_packet *bt_message_packet_beginning_borrow_packet(
+               bt_message *message);
+
+/* From message-packet-end-const.h */
+
+extern const bt_packet *bt_message_packet_end_borrow_packet_const(
+               const bt_message *message);
+
+extern bt_clock_snapshot_state
+bt_message_packet_end_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_packet_end_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+/* From message-packet-end.h */
+
+extern
+bt_message *bt_message_packet_end_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_packet *packet);
+
+extern
+bt_message *bt_message_packet_end_create_with_default_clock_snapshot(
+               bt_self_message_iterator *message_iterator,
+               const bt_packet *packet, uint64_t raw_value);
+
+extern bt_packet *bt_message_packet_end_borrow_packet(
+               bt_message *message);
+
+/* From message-stream-activity-const.h */
+
+typedef enum bt_message_stream_activity_clock_snapshot_state {
+       BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN,
+       BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN,
+       BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE,
+} bt_message_stream_activity_clock_snapshot_state;
+
+/* From message-stream-activity-beginning-const.h */
+
+extern bt_message_stream_activity_clock_snapshot_state
+bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_stream_activity_beginning_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+extern const bt_stream *
+bt_message_stream_activity_beginning_borrow_stream_const(
+               const bt_message *message);
+
+/* From message-stream-activity-beginning.h */
+
+extern bt_message *bt_message_stream_activity_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream);
+
+extern bt_stream *bt_message_stream_activity_beginning_borrow_stream(
+               bt_message *message);
+
+extern void bt_message_stream_activity_beginning_set_default_clock_snapshot_state(
+               bt_message *msg,
+               bt_message_stream_activity_clock_snapshot_state state);
+
+extern void bt_message_stream_activity_beginning_set_default_clock_snapshot(
+               bt_message *msg, uint64_t raw_value);
+
+/* From message-stream-activity-end-const.h */
+
+extern bt_message_stream_activity_clock_snapshot_state
+bt_message_stream_activity_end_borrow_default_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_stream_activity_end_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+extern const bt_stream *
+bt_message_stream_activity_end_borrow_stream_const(
+               const bt_message *message);
+
+/* From message-stream-activity-end.h */
+
+extern bt_message *bt_message_stream_activity_end_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream);
+
+extern void bt_message_stream_activity_end_set_default_clock_snapshot_state(
+               bt_message *msg,
+               bt_message_stream_activity_clock_snapshot_state state);
+
+extern void bt_message_stream_activity_end_set_default_clock_snapshot(
+               bt_message *msg, uint64_t raw_value);
+
+extern bt_stream *bt_message_stream_activity_end_borrow_stream(
+               bt_message *message);
+
+/* From message-discarded-events-const.h */
+
+extern bt_clock_snapshot_state
+bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern bt_clock_snapshot_state
+bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+extern const bt_stream *
+bt_message_discarded_events_borrow_stream_const(const bt_message *message);
+
+extern bt_property_availability bt_message_discarded_events_get_count(
+               const bt_message *message, uint64_t *OUT);
+
+/* From message-discarded-events.h */
+
+extern bt_message *bt_message_discarded_events_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream);
+
+extern bt_message *bt_message_discarded_events_create_with_default_clock_snapshots(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream, uint64_t beginning_raw_value,
+               uint64_t end_raw_value);
+
+extern bt_stream *bt_message_discarded_events_borrow_stream(
+               bt_message *message);
+
+extern void bt_message_discarded_events_set_count(bt_message *message,
+               uint64_t count);
+
+/* From message-discarded-packets-const.h */
+
+extern bt_clock_snapshot_state
+bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern bt_clock_snapshot_state
+bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
+               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+
+extern const bt_clock_class *
+bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
+               const bt_message *msg);
+
+extern const bt_stream *
+bt_message_discarded_packets_borrow_stream_const(const bt_message *message);
+
+extern bt_property_availability bt_message_discarded_packets_get_count(
+               const bt_message *message, uint64_t *OUT);
+
+/* From message-discarded-packets.h */
+
+extern bt_message *bt_message_discarded_packets_create(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream);
+
+extern bt_message *bt_message_discarded_packets_create_with_default_clock_snapshots(
+               bt_self_message_iterator *message_iterator,
+               const bt_stream *stream, uint64_t beginning_raw_value,
+               uint64_t end_raw_value);
+
+extern bt_stream *bt_message_discarded_packets_borrow_stream(
+               bt_message *message);
+
+extern void bt_message_discarded_packets_set_count(bt_message *message,
+               uint64_t count);
diff --git a/bindings/python/bt2/bt2/native_bt_notifier.i b/bindings/python/bt2/bt2/native_bt_notifier.i
new file mode 100644 (file)
index 0000000..b5f5390
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From message-iterator-const.h */
+
+typedef enum bt_message_iterator_status {
+       BT_MESSAGE_ITERATOR_STATUS_OK = 0,
+       BT_MESSAGE_ITERATOR_STATUS_END = 1,
+       BT_MESSAGE_ITERATOR_STATUS_AGAIN = 11,
+       BT_MESSAGE_ITERATOR_STATUS_ERROR = -1,
+       BT_MESSAGE_ITERATOR_STATUS_NOMEM = -12,
+} bt_message_iterator_status;
+
+/* From self-message-iterator.h */
+
+typedef enum bt_self_message_iterator_status {
+       BT_SELF_MESSAGE_ITERATOR_STATUS_OK = BT_MESSAGE_ITERATOR_STATUS_OK,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_END = BT_MESSAGE_ITERATOR_STATUS_END,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN = BT_MESSAGE_ITERATOR_STATUS_AGAIN,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR = BT_MESSAGE_ITERATOR_STATUS_ERROR,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM = BT_MESSAGE_ITERATOR_STATUS_NOMEM,
+} bt_self_message_iterator_status;
+
+extern bt_self_component *
+bt_self_message_iterator_borrow_component(
+               bt_self_message_iterator *message_iterator);
+
+extern bt_self_port_output *
+bt_self_message_iterator_borrow_port(
+               bt_self_message_iterator *message_iterator);
+
+extern void bt_self_message_iterator_set_data(
+               bt_self_message_iterator *message_iterator,
+               void *user_data);
+
+extern void *bt_self_message_iterator_get_data(
+               const bt_self_message_iterator *message_iterator);
+
+/* From self-component-port-input-message-iterator.h */
+
+bt_message_iterator *
+bt_self_component_port_input_message_iterator_as_message_iterator(
+               bt_self_component_port_input_message_iterator *iterator);
+
+extern bt_self_component_port_input_message_iterator *
+bt_self_component_port_input_message_iterator_create(
+               bt_self_component_port_input *input_port);
+
+extern bt_component *
+bt_self_component_port_input_message_iterator_borrow_component(
+               bt_self_component_port_input_message_iterator *iterator);
+
+extern bt_message_iterator_status
+bt_self_component_port_input_message_iterator_next(
+               bt_self_component_port_input_message_iterator *iterator,
+               bt_message_array_const *msgs, uint64_t *count);
+
+extern bt_bool
+bt_self_component_port_input_message_iterator_can_seek_ns_from_origin(
+               bt_self_component_port_input_message_iterator *iterator,
+               int64_t ns_from_origin);
+
+extern bt_bool bt_self_component_port_input_message_iterator_can_seek_beginning(
+               bt_self_component_port_input_message_iterator *iterator);
+
+extern bt_message_iterator_status
+bt_self_component_port_input_message_iterator_seek_ns_from_origin(
+               bt_self_component_port_input_message_iterator *iterator,
+               int64_t ns_from_origin);
+
+extern bt_message_iterator_status
+bt_self_component_port_input_message_iterator_seek_beginning(
+               bt_self_component_port_input_message_iterator *iterator);
+
+extern void bt_self_component_port_input_message_iterator_get_ref(
+               const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator);
+
+extern void bt_self_component_port_input_message_iterator_put_ref(
+               const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator);
+
+/* From port-output-message-iterator.h */
+
+bt_message_iterator *
+bt_port_output_message_iterator_as_message_iterator(
+               bt_port_output_message_iterator *iterator);
+
+extern bt_port_output_message_iterator *
+bt_port_output_message_iterator_create(
+               bt_graph *graph,
+               const bt_port_output *output_port);
+
+extern bt_message_iterator_status
+bt_port_output_message_iterator_next(
+               bt_port_output_message_iterator *iterator,
+               bt_message_array_const *msgs, uint64_t *count);
+
+extern bt_bool bt_port_output_message_iterator_can_seek_ns_from_origin(
+               bt_port_output_message_iterator *iterator,
+               int64_t ns_from_origin);
+
+extern bt_bool bt_port_output_message_iterator_can_seek_beginning(
+               bt_port_output_message_iterator *iterator);
+
+extern bt_message_iterator_status
+bt_port_output_message_iterator_seek_ns_from_origin(
+               bt_port_output_message_iterator *iterator,
+               int64_t ns_from_origin);
+
+extern bt_message_iterator_status
+bt_port_output_message_iterator_seek_beginning(
+               bt_port_output_message_iterator *iterator);
+
+extern void bt_port_output_message_iterator_get_ref(
+               const bt_port_output_message_iterator *port_output_message_iterator);
+
+extern void bt_port_output_message_iterator_put_ref(
+               const bt_port_output_message_iterator *port_output_message_iterator);
+
+/* Helper functions for Python */
+%{
+static PyObject *bt_py3_get_user_component_from_user_msg_iter(
+               bt_self_message_iterator *self_message_iterator)
+{
+       bt_self_component *self_component = bt_self_message_iterator_borrow_component(self_message_iterator);
+       PyObject *py_comp;
+
+       BT_ASSERT(self_component);
+       py_comp = bt_self_component_get_data(self_component);
+       BT_ASSERT(py_comp);
+
+       /* Return new reference */
+       Py_INCREF(py_comp);
+       return py_comp;
+}
+
+static inline
+PyObject *create_pylist_from_messages(bt_message_array_const messages,
+               uint64_t message_count)
+{
+       uint64_t i;
+       PyObject *py_msg_list = PyList_New(message_count);
+       BT_ASSERT(py_msg_list);
+       for (i = 0; i < message_count; i++) {
+               PyList_SET_ITEM(py_msg_list, i,
+                               SWIG_NewPointerObj(SWIG_as_voidptr(messages[i]),
+                                       SWIGTYPE_p_bt_message, 0));
+       }
+
+       return py_msg_list;
+}
+
+static
+PyObject *bt_py3_get_msg_range_common(bt_message_iterator_status status,
+               bt_message_array_const messages, uint64_t message_count)
+{
+       PyObject *py_status;
+       PyObject *py_return_tuple;
+       PyObject *py_msg_list = Py_None;
+       
+       py_status = SWIG_From_long_SS_long(status);
+       if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+               goto end;
+       }
+
+       py_msg_list = create_pylist_from_messages(messages, message_count);
+
+end:
+       py_return_tuple = PyTuple_New(2);
+       BT_ASSERT(py_return_tuple);
+       PyTuple_SET_ITEM(py_return_tuple, 0, py_status);
+       PyTuple_SET_ITEM(py_return_tuple, 1, py_msg_list);
+
+       return py_return_tuple;
+}
+
+static PyObject
+*bt_py3_self_component_port_input_get_msg_range(
+               bt_self_component_port_input_message_iterator *iter)
+{
+       bt_message_array_const messages;
+       uint64_t message_count = 0;
+       bt_message_iterator_status status;
+
+       status = bt_self_component_port_input_message_iterator_next(iter, &messages,
+                               &message_count);
+       
+       return bt_py3_get_msg_range_common(status, messages, message_count);
+}
+
+static PyObject
+*bt_py3_port_output_get_msg_range(
+               bt_port_output_message_iterator *iter)
+{
+       bt_message_array_const messages;
+       uint64_t message_count = 0;
+       bt_message_iterator_status status;
+
+       status =
+               bt_port_output_message_iterator_next(iter, &messages,
+                               &message_count);
+       
+       return bt_py3_get_msg_range_common(status, messages, message_count);
+}
+%}
+
+PyObject *bt_py3_get_user_component_from_user_msg_iter(
+    bt_self_message_iterator *self_message_iterator);
+PyObject *bt_py3_self_component_port_input_get_msg_range(
+               bt_self_component_port_input_message_iterator *iter);
+PyObject *bt_py3_port_output_get_msg_range(
+               bt_port_output_message_iterator *iter);
diff --git a/bindings/python/bt2/bt2/native_bt_packet.i b/bindings/python/bt2/bt2/native_bt_packet.i
new file mode 100644 (file)
index 0000000..b4c9073
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From packet-const.h */
+
+typedef enum bt_packet_status {
+       BT_PACKET_STATUS_OK = 0,
+       BT_PACKET_STATUS_NOMEM = -12,
+} bt_packet_status;
+
+extern const bt_stream *bt_packet_borrow_stream_const(
+               const bt_packet *packet);
+
+extern
+const bt_field *bt_packet_borrow_context_field_const(
+               const bt_packet *packet);
+
+extern void bt_packet_get_ref(const bt_packet *packet);
+
+extern void bt_packet_put_ref(const bt_packet *packet);
+
+/* From packet.h */
+
+extern bt_packet *bt_packet_create(const bt_stream *stream);
+
+extern bt_stream *bt_packet_borrow_stream(bt_packet *packet);
+
+extern
+bt_field *bt_packet_borrow_context_field(bt_packet *packet);
+
+extern
+bt_packet_status bt_packet_move_context_field(bt_packet *packet,
+               bt_packet_context_field *context);
diff --git a/bindings/python/bt2/bt2/native_bt_plugin.i b/bindings/python/bt2/bt2/native_bt_plugin.i
new file mode 100644 (file)
index 0000000..640085b
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From plugin-const.h */
+
+extern const bt_plugin *bt_plugin_find(const char *plugin_name);
+
+extern const bt_plugin_set *bt_plugin_find_all_from_file(
+               const char *path);
+
+extern const bt_plugin_set *bt_plugin_find_all_from_dir(
+               const char *path, bt_bool recurse);
+
+extern const bt_plugin_set *bt_plugin_find_all_from_static(void);
+
+extern const char *bt_plugin_get_name(const bt_plugin *plugin);
+
+extern const char *bt_plugin_get_author(const bt_plugin *plugin);
+
+extern const char *bt_plugin_get_license(const bt_plugin *plugin);
+
+extern const char *bt_plugin_get_description(const bt_plugin *plugin);
+
+extern const char *bt_plugin_get_path(const bt_plugin *plugin);
+
+extern bt_property_availability bt_plugin_get_version(
+               const bt_plugin *plugin, unsigned int *OUT,
+               unsigned int *OUT, unsigned int *OUT, const char **OUT);
+
+extern uint64_t bt_plugin_get_source_component_class_count(
+               const bt_plugin *plugin);
+
+extern uint64_t bt_plugin_get_filter_component_class_count(
+               const bt_plugin *plugin);
+
+extern uint64_t bt_plugin_get_sink_component_class_count(
+               const bt_plugin *plugin);
+
+extern const bt_component_class_source *
+bt_plugin_borrow_source_component_class_by_index_const(
+               const bt_plugin *plugin, uint64_t index);
+
+extern const bt_component_class_filter *
+bt_plugin_borrow_filter_component_class_by_index_const(
+               const bt_plugin *plugin, uint64_t index);
+
+extern const bt_component_class_sink *
+bt_plugin_borrow_sink_component_class_by_index_const(
+               const bt_plugin *plugin, uint64_t index);
+
+extern const bt_component_class_source *
+bt_plugin_borrow_source_component_class_by_name_const(
+               const bt_plugin *plugin, const char *name);
+
+extern const bt_component_class_filter *
+bt_plugin_borrow_filter_component_class_by_name_const(
+               const bt_plugin *plugin, const char *name);
+
+extern const bt_component_class_sink *
+bt_plugin_borrow_sink_component_class_by_name_const(
+               const bt_plugin *plugin, const char *name);
+
+extern void bt_plugin_get_ref(const bt_plugin *plugin);
+
+extern void bt_plugin_put_ref(const bt_plugin *plugin);
+
+/* From plugin-set-const.h */
+
+extern uint64_t bt_plugin_set_get_plugin_count(
+               const bt_plugin_set *plugin_set);
+
+extern const bt_plugin *bt_plugin_set_borrow_plugin_by_index_const(
+               const bt_plugin_set *plugin_set, uint64_t index);
+
+extern void bt_plugin_set_get_ref(const bt_plugin_set *plugin_set);
+
+extern void bt_plugin_set_put_ref(const bt_plugin_set *plugin_set);
diff --git a/bindings/python/bt2/bt2/native_bt_port.i b/bindings/python/bt2/bt2/native_bt_port.i
new file mode 100644 (file)
index 0000000..7285437
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From port-const.h */
+
+typedef enum bt_port_type {
+       BT_PORT_TYPE_INPUT = 0,
+       BT_PORT_TYPE_OUTPUT = 1,
+} bt_port_type;
+
+extern const char *bt_port_get_name(const bt_port *port);
+
+extern bt_port_type bt_port_get_type(const bt_port *port);
+
+extern const bt_connection *bt_port_borrow_connection_const(
+               const bt_port *port);
+
+extern const bt_component *bt_port_borrow_component_const(
+               const bt_port *port);
+
+extern bt_bool bt_port_is_connected(const bt_port *port);
+
+bt_bool bt_port_is_input(const bt_port *port);
+
+bt_bool bt_port_is_output(const bt_port *port);
+
+extern void bt_port_get_ref(const bt_port *port);
+
+extern void bt_port_put_ref(const bt_port *port);
+
+/* From port-output-const.h */
+
+const bt_port *bt_port_output_as_port_const(const bt_port_output *port_output);
+
+extern void bt_port_output_get_ref(const bt_port_output *port_output);
+
+extern void bt_port_output_put_ref(const bt_port_output *port_output);
+
+/* From port-input-const.h */
+
+const bt_port *bt_port_input_as_port_const(const bt_port_input *port_input);
+
+extern void bt_port_input_get_ref(const bt_port_input *port_input);
+
+extern void bt_port_input_put_ref(const bt_port_input *port_input);
+
+/* From self-component-port.h */
+
+typedef enum bt_self_component_port_status {
+       BT_SELF_PORT_STATUS_OK = 0,
+} bt_self_component_port_status;
+
+const bt_port *bt_self_component_port_as_port(
+               bt_self_component_port *self_port);
+
+extern bt_self_component *bt_self_component_port_borrow_component(
+               bt_self_component_port *self_port);
+
+extern void *bt_self_component_port_get_data(
+               const bt_self_component_port *self_port);
+
+/* From self-component-port-output.h */
+
+bt_self_component_port *
+bt_self_component_port_output_as_self_component_port(
+               bt_self_component_port_output *self_component_port);
+
+const bt_port_output *bt_self_component_port_output_as_port_output(
+               bt_self_component_port_output *self_component_port);
+
+/* From self-component-port-input.h */
+
+bt_self_component_port *
+bt_self_component_port_input_as_self_component_port(
+               bt_self_component_port_input *self_component_port);
+
+const bt_port_input *bt_self_component_port_input_as_port_input(
+               const bt_self_component_port_input *self_component_port);
diff --git a/bindings/python/bt2/bt2/native_bt_query_exec.i b/bindings/python/bt2/bt2/native_bt_query_exec.i
new file mode 100644 (file)
index 0000000..2f02ca8
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From query-executor-const.h */
+
+typedef enum bt_query_executor_status {
+       BT_QUERY_EXECUTOR_STATUS_OK = 0,
+       BT_QUERY_EXECUTOR_STATUS_AGAIN = 11,
+       BT_QUERY_EXECUTOR_STATUS_UNSUPPORTED = 95,
+       BT_QUERY_EXECUTOR_STATUS_CANCELED = 125,
+       BT_QUERY_EXECUTOR_STATUS_ERROR = -1,
+       BT_QUERY_EXECUTOR_STATUS_NOMEM = -12,
+       BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT = -23,
+       BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS = -24,
+} bt_query_executor_status;
+
+extern
+bt_bool bt_query_executor_is_canceled(
+               const bt_query_executor *query_executor);
+
+extern void bt_query_executor_get_ref(
+               const bt_query_executor *query_executor);
+
+extern void bt_query_executor_put_ref(
+               const bt_query_executor *query_executor);
+
+/* From query-executor.h */
+
+extern
+bt_query_executor *bt_query_executor_create(void);
+
+extern
+bt_query_executor_status bt_query_executor_query(
+               bt_query_executor *query_executor,
+               const bt_component_class *component_class,
+               const char *object, const bt_value *params,
+               const bt_value **OUT_VALUE);
+
+extern
+bt_query_executor_status bt_query_executor_cancel(
+               bt_query_executor *query_executor);
diff --git a/bindings/python/bt2/bt2/native_bt_stream.i b/bindings/python/bt2/bt2/native_bt_stream.i
new file mode 100644 (file)
index 0000000..394d987
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From stream-const.h */
+
+typedef enum bt_stream_status {
+       BT_STREAM_STATUS_OK = 0,
+       BT_STREAM_STATUS_NOMEM = -12,
+} bt_stream_status;
+
+extern const bt_stream_class *bt_stream_borrow_class_const(
+               const bt_stream *stream);
+
+extern const bt_trace *bt_stream_borrow_trace_const(
+               const bt_stream *stream);
+
+extern const char *bt_stream_get_name(const bt_stream *stream);
+
+extern uint64_t bt_stream_get_id(const bt_stream *stream);
+
+extern void bt_stream_get_ref(const bt_stream *stream);
+
+extern void bt_stream_put_ref(const bt_stream *stream);
+
+/* From stream.h */
+
+extern bt_stream *bt_stream_create(bt_stream_class *stream_class,
+               bt_trace *trace);
+
+extern bt_stream *bt_stream_create_with_id(
+               bt_stream_class *stream_class,
+               bt_trace *trace, uint64_t id);
+
+extern bt_trace *bt_stream_borrow_trace(bt_stream *stream);
+
+extern bt_stream_class *bt_stream_borrow_class(bt_stream *stream);
+
+extern bt_stream_status bt_stream_set_name(bt_stream *stream,
+               const char *name);
diff --git a/bindings/python/bt2/bt2/native_bt_stream_class.i b/bindings/python/bt2/bt2/native_bt_stream_class.i
new file mode 100644 (file)
index 0000000..94c2b50
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From stream-class-const.h */
+
+typedef enum bt_stream_class_status {
+       BT_STREAM_CLASS_STATUS_OK = 0,
+       BT_STREAM_CLASS_STATUS_NOMEM = -12,
+} bt_stream_class_status;
+
+extern const bt_trace_class *bt_stream_class_borrow_trace_class_const(
+               const bt_stream_class *stream_class);
+
+extern const char *bt_stream_class_get_name(
+               const bt_stream_class *stream_class);
+
+extern bt_bool bt_stream_class_assigns_automatic_event_class_id(
+               const bt_stream_class *stream_class);
+
+extern bt_bool bt_stream_class_assigns_automatic_stream_id(
+               const bt_stream_class *stream_class);
+
+extern uint64_t bt_stream_class_get_id(
+               const bt_stream_class *stream_class);
+
+extern const bt_field_class *
+bt_stream_class_borrow_packet_context_field_class_const(
+               const bt_stream_class *stream_class);
+
+extern const bt_field_class *
+bt_stream_class_borrow_event_common_context_field_class_const(
+               const bt_stream_class *stream_class);
+
+extern uint64_t bt_stream_class_get_event_class_count(
+               const bt_stream_class *stream_class);
+
+extern const bt_event_class *
+bt_stream_class_borrow_event_class_by_index_const(
+               const bt_stream_class *stream_class, uint64_t index);
+
+extern const bt_event_class *
+bt_stream_class_borrow_event_class_by_id_const(
+               const bt_stream_class *stream_class, uint64_t id);
+
+extern const bt_clock_class *
+bt_stream_class_borrow_default_clock_class_const(
+               const bt_stream_class *stream_class);
+
+extern bt_bool bt_stream_class_default_clock_is_always_known(
+               const bt_stream_class *stream_class);
+
+extern void bt_stream_class_get_ref(const bt_stream_class *stream_class);
+
+extern void bt_stream_class_put_ref(const bt_stream_class *stream_class);
+
+/* From stream-class-const.h */
+
+extern bt_stream_class *bt_stream_class_create(
+               bt_trace_class *trace_class);
+
+extern bt_stream_class *bt_stream_class_create_with_id(
+               bt_trace_class *trace_class, uint64_t id);
+
+extern bt_trace_class *bt_stream_class_borrow_trace_class(
+               bt_stream_class *stream_class);
+
+extern bt_stream_class_status bt_stream_class_set_name(
+               bt_stream_class *stream_class, const char *name);
+
+extern void bt_stream_class_set_assigns_automatic_event_class_id(
+               bt_stream_class *stream_class, bt_bool value);
+
+extern void bt_stream_class_set_assigns_automatic_stream_id(
+               bt_stream_class *stream_class, bt_bool value);
+
+extern bt_stream_class_status
+bt_stream_class_set_packet_context_field_class(
+               bt_stream_class *stream_class,
+               bt_field_class *field_class);
+
+extern bt_field_class *
+bt_stream_class_borrow_packet_context_field_class(
+               bt_stream_class *stream_class);
+
+extern bt_stream_class_status
+bt_stream_class_set_event_common_context_field_class(
+               bt_stream_class *stream_class,
+               bt_field_class *field_class);
+
+extern bt_field_class *
+bt_stream_class_borrow_event_common_context_field_class(
+               bt_stream_class *stream_class);
+
+extern bt_event_class *
+bt_stream_class_borrow_event_class_by_index(
+               bt_stream_class *stream_class, uint64_t index);
+
+extern bt_event_class *
+bt_stream_class_borrow_event_class_by_id(
+               bt_stream_class *stream_class, uint64_t id);
+
+extern bt_clock_class *bt_stream_class_borrow_default_clock_class(
+               bt_stream_class *stream_class);
+
+extern bt_stream_class_status bt_stream_class_set_default_clock_class(
+               bt_stream_class *stream_class,
+               bt_clock_class *clock_class);
diff --git a/bindings/python/bt2/bt2/native_bt_trace.i b/bindings/python/bt2/bt2/native_bt_trace.i
new file mode 100644 (file)
index 0000000..2d8f538
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From trace-const.h */
+
+typedef enum bt_trace_status {
+       BT_TRACE_STATUS_OK = 0,
+       BT_TRACE_STATUS_NOMEM = -12,
+} bt_trace_status;
+
+typedef void (* bt_trace_destruction_listener_func)(
+               const bt_trace *trace, void *data);
+
+extern const bt_trace_class *bt_trace_borrow_class_const(
+               const bt_trace *trace);
+
+extern const char *bt_trace_get_name(const bt_trace *trace);
+
+extern uint64_t bt_trace_get_stream_count(const bt_trace *trace);
+
+extern const bt_stream *bt_trace_borrow_stream_by_index_const(
+               const bt_trace *trace, uint64_t index);
+
+extern const bt_stream *bt_trace_borrow_stream_by_id_const(
+               const bt_trace *trace, uint64_t id);
+
+extern bt_trace_status bt_trace_add_destruction_listener(
+               const bt_trace *trace,
+               bt_trace_destruction_listener_func listener,
+               void *data, uint64_t *listener_id);
+
+extern bt_trace_status bt_trace_remove_destruction_listener(
+               const bt_trace *trace, uint64_t listener_id);
+
+extern void bt_trace_get_ref(const bt_trace *trace);
+
+extern void bt_trace_put_ref(const bt_trace *trace);
+
+/* From trace.h */
+
+extern bt_trace_class *bt_trace_borrow_class(bt_trace *trace);
+
+extern bt_trace *bt_trace_create(bt_trace_class *trace_class);
+
+extern bt_trace_status bt_trace_set_name(bt_trace *trace,
+               const char *name);
+
+extern bt_stream *bt_trace_borrow_stream_by_index(bt_trace *trace,
+               uint64_t index);
+
+extern bt_stream *bt_trace_borrow_stream_by_id(bt_trace *trace,
+               uint64_t id);
+
+%{
+static void
+trace_destroyed_listener(const bt_trace *trace, void *py_callable)
+{
+       PyObject *py_trace_ptr = NULL;
+       PyObject *py_res = NULL;
+
+       py_trace_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(trace),
+               SWIGTYPE_p_bt_trace, 0);
+       if (!py_trace_ptr) {
+               BT_LOGF_STR("Failed to create a SWIG pointer object.");
+               abort();
+       }
+
+       py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_ptr);
+       if (py_res != NULL) {
+               BT_ASSERT(py_res == Py_None);
+       } else {
+               bt2_py_loge_exception();
+       }
+
+       Py_DECREF(py_trace_ptr);
+       Py_XDECREF(py_res);
+}
+
+uint64_t bt_py3_trace_add_destruction_listener(bt_trace *trace, PyObject *py_callable)
+{
+       uint64_t id = UINT64_C(-1);
+       bt_trace_status status;
+
+       BT_ASSERT(trace);
+       BT_ASSERT(py_callable);
+
+       status = bt_trace_add_destruction_listener(
+               trace, trace_destroyed_listener, py_callable, &id);
+       if (status != BT_TRACE_STATUS_OK) {
+               BT_LOGF_STR("Failed to add trace destruction listener.");
+               abort();
+       }
+
+       Py_INCREF(py_callable);
+
+       return id;
+}
+%}
+
+uint64_t bt_py3_trace_add_destruction_listener(bt_trace *trace,
+       PyObject *py_callable);
diff --git a/bindings/python/bt2/bt2/native_bt_trace_class.i b/bindings/python/bt2/bt2/native_bt_trace_class.i
new file mode 100644 (file)
index 0000000..bd02339
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From trace-class-const.h */
+
+typedef enum bt_trace_class_status {
+       BT_TRACE_CLASS_STATUS_OK = 0,
+       BT_TRACE_CLASS_STATUS_NOMEM = -12,
+} bt_trace_class_status;
+
+typedef void (* bt_trace_class_destruction_listener_func)(
+               const bt_trace_class *trace_class, void *data);
+
+extern bt_bool bt_trace_class_assigns_automatic_stream_class_id(
+               const bt_trace_class *trace_class);
+
+extern const char *bt_trace_class_get_name(
+               const bt_trace_class *trace_class);
+
+extern bt_uuid bt_trace_class_get_uuid(
+               const bt_trace_class *trace_class);
+
+extern uint64_t bt_trace_class_get_environment_entry_count(
+               const bt_trace_class *trace_class);
+
+extern void bt_trace_class_borrow_environment_entry_by_index_const(
+               const bt_trace_class *trace_class, uint64_t index,
+               const char **OUT, const bt_value **OUT_VALUE);
+
+extern const bt_value *
+bt_trace_class_borrow_environment_entry_value_by_name_const(
+               const bt_trace_class *trace_class, const char *name);
+
+extern uint64_t bt_trace_class_get_stream_class_count(
+               const bt_trace_class *trace_class);
+
+extern const bt_stream_class *
+bt_trace_class_borrow_stream_class_by_index_const(
+               const bt_trace_class *trace_class, uint64_t index);
+
+extern const bt_stream_class *bt_trace_class_borrow_stream_class_by_id_const(
+               const bt_trace_class *trace_class, uint64_t id);
+
+extern bt_trace_class_status bt_trace_class_add_destruction_listener(
+        const bt_trace_class *trace_class,
+        bt_trace_class_destruction_listener_func listener,
+        void *data, uint64_t *listener_id);
+
+extern bt_trace_class_status bt_trace_class_remove_destruction_listener(
+        const bt_trace_class *trace_class, uint64_t listener_id);
+
+extern void bt_trace_class_get_ref(const bt_trace_class *trace_class);
+
+extern void bt_trace_class_put_ref(const bt_trace_class *trace_class);
+
+/* From trace-class.h */
+
+extern bt_trace_class *bt_trace_class_create(bt_self_component *self_comp);
+
+extern void bt_trace_class_set_assigns_automatic_stream_class_id(
+               bt_trace_class *trace_class, bt_bool value);
+
+extern bt_trace_class_status bt_trace_class_set_name(
+               bt_trace_class *trace_class, const char *name);
+
+extern void bt_trace_class_set_uuid(bt_trace_class *trace_class,
+               bt_uuid uuid);
+
+extern bt_trace_class_status bt_trace_class_set_environment_entry_integer(
+               bt_trace_class *trace_class,
+               const char *name, int64_t value);
+
+extern bt_trace_class_status bt_trace_class_set_environment_entry_string(
+               bt_trace_class *trace_class,
+               const char *name, const char *value);
+
+extern bt_stream_class *bt_trace_class_borrow_stream_class_by_index(
+               bt_trace_class *trace_class, uint64_t index);
+
+extern bt_stream_class *bt_trace_class_borrow_stream_class_by_id(
+               bt_trace_class *trace_class, uint64_t id);
+
+/* Helper functions for Python */
+%{
+static void
+trace_class_destroyed_listener(const bt_trace_class *trace_class, void *py_callable)
+{
+       PyObject *py_trace_class_ptr = NULL;
+       PyObject *py_res = NULL;
+
+       py_trace_class_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(trace_class),
+               SWIGTYPE_p_bt_trace_class, 0);
+       if (!py_trace_class_ptr) {
+               BT_LOGF_STR("Failed to create a SWIG pointer object.");
+               abort();
+       }
+
+       py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_class_ptr);
+       if (py_res != NULL) {
+               BT_ASSERT(py_res == Py_None);
+       } else {
+               bt2_py_loge_exception();
+       }
+
+       Py_DECREF(py_trace_class_ptr);
+       Py_XDECREF(py_res);
+}
+
+uint64_t bt_py3_trace_class_add_destruction_listener(bt_trace_class *trace_class,
+       PyObject *py_callable)
+{
+       uint64_t id = UINT64_C(-1);
+       bt_trace_class_status status;
+
+       BT_ASSERT(trace_class);
+       BT_ASSERT(py_callable);
+
+       status = bt_trace_class_add_destruction_listener(
+               trace_class, trace_class_destroyed_listener, py_callable, &id);
+       if (status != BT_TRACE_CLASS_STATUS_OK) {
+               BT_LOGF_STR("Failed to add trace class destruction listener.");
+               abort();
+       }
+
+       Py_INCREF(py_callable);
+
+       return id;
+}
+%}
+
+uint64_t bt_py3_trace_class_add_destruction_listener(bt_trace_class *trace_class,
+       PyObject *py_callable);
diff --git a/bindings/python/bt2/bt2/native_bt_value.i b/bindings/python/bt2/bt2/native_bt_value.i
new file mode 100644 (file)
index 0000000..6d1aeff
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* From value-const.h */
+
+typedef enum bt_value_status {
+       /// Operation canceled.
+       BT_VALUE_STATUS_CANCELED        = 125,
+
+       /// Cannot allocate memory.
+       BT_VALUE_STATUS_NOMEM           = -12,
+
+       /// Okay, no error.
+       BT_VALUE_STATUS_OK              = 0,
+} bt_value_status;
+
+typedef enum bt_value_type {
+       /// Null value object.
+       BT_VALUE_TYPE_NULL =            0,
+
+       /// Boolean value object (holds #BT_TRUE or #BT_FALSE).
+       BT_VALUE_TYPE_BOOL =            1,
+
+       /// Integer value object (holds a signed 64-bit integer raw value).
+       BT_VALUE_TYPE_INTEGER =         2,
+
+       /// Floating point number value object (holds a \c double raw value).
+       BT_VALUE_TYPE_REAL =            3,
+
+       /// String value object.
+       BT_VALUE_TYPE_STRING =          4,
+
+       /// Array value object.
+       BT_VALUE_TYPE_ARRAY =           5,
+
+       /// Map value object.
+       BT_VALUE_TYPE_MAP =             6,
+} bt_value_type;
+
+extern bt_value_type bt_value_get_type(const bt_value *object);
+
+bt_bool bt_value_is_null(const bt_value *object);
+
+bt_bool bt_value_is_bool(const bt_value *object);
+
+bt_bool bt_value_is_integer(const bt_value *object);
+
+bt_bool bt_value_is_real(const bt_value *object);
+
+bt_bool bt_value_is_string(const bt_value *object);
+
+bt_bool bt_value_is_array(const bt_value *object);
+
+bt_bool bt_value_is_map(const bt_value *object);
+
+extern bt_value_status bt_value_copy(const bt_value *object,
+               bt_value **OUT);
+
+extern bt_bool bt_value_compare(const bt_value *object_a,
+               const bt_value *object_b);
+
+extern bt_bool bt_value_bool_get(const bt_value *bool_obj);
+
+extern int64_t bt_value_integer_get(const bt_value *integer_obj);
+
+extern double bt_value_real_get(const bt_value *real_obj);
+
+extern const char *bt_value_string_get(const bt_value *string_obj);
+
+extern uint64_t bt_value_array_get_size(const bt_value *array_obj);
+
+bt_bool bt_value_array_is_empty(const bt_value *array_obj);
+
+extern const bt_value *bt_value_array_borrow_element_by_index_const(
+               const bt_value *array_obj, uint64_t index);
+
+extern uint64_t bt_value_map_get_size(const bt_value *map_obj);
+
+bt_bool bt_value_map_is_empty(const bt_value *map_obj);
+
+extern const bt_value *bt_value_map_borrow_entry_value_const(
+               const bt_value *map_obj, const char *key);
+
+typedef bt_bool (* bt_value_map_foreach_entry_const_func)(const char *key,
+               const bt_value *object, void *data);
+
+extern bt_value_status bt_value_map_foreach_entry_const(
+               const bt_value *map_obj,
+               bt_value_map_foreach_entry_const_func func, void *data);
+
+extern bt_bool bt_value_map_has_entry(const bt_value *map_obj,
+               const char *key);
+
+extern bt_value_status bt_value_map_extend(
+               const bt_value *base_map_obj,
+               const bt_value *extension_map_obj,
+               bt_value **extended_map_obj);
+
+extern void bt_value_get_ref(const bt_value *value);
+
+extern void bt_value_put_ref(const bt_value *value);
+
+/* From value.h */
+
+extern bt_value *const bt_value_null;
+
+extern bt_value *bt_value_bool_create(void);
+
+extern bt_value *bt_value_bool_create_init(bt_bool val);
+
+extern void bt_value_bool_set(bt_value *bool_obj, bt_bool val);
+
+extern bt_value *bt_value_integer_create(void);
+
+extern bt_value *bt_value_integer_create_init(
+               int64_t val);
+
+extern void bt_value_integer_set(bt_value *integer_obj, int64_t val);
+
+extern bt_value *bt_value_real_create(void);
+
+extern bt_value *bt_value_real_create_init(double val);
+
+extern void bt_value_real_set(bt_value *real_obj, double val);
+
+extern bt_value *bt_value_string_create(void);
+
+extern bt_value *bt_value_string_create_init(const char *val);
+
+extern bt_value_status bt_value_string_set(bt_value *string_obj,
+               const char *val);
+
+extern bt_value *bt_value_array_create(void);
+
+extern bt_value *bt_value_array_borrow_element_by_index(
+               bt_value *array_obj, uint64_t index);
+
+extern bt_value_status bt_value_array_append_element(
+               bt_value *array_obj,
+               bt_value *element_obj);
+
+extern bt_value_status bt_value_array_append_bool_element(
+               bt_value *array_obj, bt_bool val);
+
+extern bt_value_status bt_value_array_append_integer_element(
+               bt_value *array_obj, int64_t val);
+
+extern bt_value_status bt_value_array_append_real_element(
+               bt_value *array_obj, double val);
+
+extern bt_value_status bt_value_array_append_string_element(
+               bt_value *array_obj, const char *val);
+
+extern bt_value_status bt_value_array_append_empty_array_element(
+               bt_value *array_obj);
+
+extern bt_value_status bt_value_array_append_empty_map_element(
+               bt_value *array_obj);
+
+extern bt_value_status bt_value_array_set_element_by_index(
+               bt_value *array_obj, uint64_t index,
+               bt_value *element_obj);
+
+extern bt_value *bt_value_map_create(void);
+
+extern bt_value *bt_value_map_borrow_entry_value(
+               bt_value *map_obj, const char *key);
+
+typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key,
+               bt_value *object, void *data);
+
+extern bt_value_status bt_value_map_foreach_entry(
+               bt_value *map_obj,
+               bt_value_map_foreach_entry_func func, void *data);
+
+extern bt_value_status bt_value_map_insert_entry(
+               bt_value *map_obj, const char *key,
+               bt_value *element_obj);
+
+extern bt_value_status bt_value_map_insert_bool_entry(
+               bt_value *map_obj, const char *key, bt_bool val);
+
+extern bt_value_status bt_value_map_insert_integer_entry(
+               bt_value *map_obj, const char *key, int64_t val);
+
+extern bt_value_status bt_value_map_insert_real_entry(
+               bt_value *map_obj, const char *key, double val);
+
+extern bt_value_status bt_value_map_insert_string_entry(
+               bt_value *map_obj, const char *key,
+               const char *val);
+
+extern bt_value_status bt_value_map_insert_empty_array_entry(
+               bt_value *map_obj, const char *key);
+
+extern bt_value_status bt_value_map_insert_empty_map_entry(
+               bt_value *map_obj, const char *key);
+
+%{
+struct bt_value_map_get_keys_data {
+       struct bt_value *keys;
+};
+
+static int bt_value_map_get_keys_cb(const char *key, const struct bt_value *object, void *data)
+{
+       enum bt_value_status status;
+       struct bt_value_map_get_keys_data *priv_data = data;
+
+       status = bt_value_array_append_string_element(priv_data->keys, key);
+       if (status != BT_VALUE_STATUS_OK) {
+               return BT_FALSE;
+       }
+
+       return BT_TRUE;
+}
+
+static struct bt_value *bt_value_map_get_keys(const struct bt_value *map_obj)
+{
+       enum bt_value_status status;
+       struct bt_value_map_get_keys_data data;
+
+       data.keys = bt_value_array_create();
+       if (!data.keys) {
+               return NULL;
+       }
+
+       status = bt_value_map_foreach_entry_const(map_obj, bt_value_map_get_keys_cb,
+               &data);
+       if (status != BT_VALUE_STATUS_OK) {
+               goto error;
+       }
+
+       goto end;
+
+error:
+       if (data.keys) {
+               BT_VALUE_PUT_REF_AND_RESET(data.keys);
+       }
+
+end:
+       return data.keys;
+}
+%}
+
+struct bt_value *bt_value_map_get_keys(const struct bt_value *map_obj);
diff --git a/bindings/python/bt2/bt2/native_bt_version.i b/bindings/python/bt2/bt2/native_bt_version.i
new file mode 100644 (file)
index 0000000..3d99e7d
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* Version functions */
+int bt_version_get_major(void);
+int bt_version_get_minor(void);
+int bt_version_get_patch(void);
+const char *bt_version_get_extra(void);
diff --git a/bindings/python/bt2/bt2/native_btccpriomap.i b/bindings/python/bt2/bt2/native_btccpriomap.i
deleted file mode 100644 (file)
index 3fd3b8d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-%{
-#include <babeltrace/graph/clock-class-priority-map.h>
-%}
-
-/* Type */
-struct bt_clock_class_priority_map;
-
-/* Functions */
-struct bt_clock_class_priority_map *bt_clock_class_priority_map_create();
-int64_t bt_clock_class_priority_map_get_clock_class_count(
-               struct bt_clock_class_priority_map *clock_class_priority_map);
-struct bt_clock_class *
-bt_clock_class_priority_map_get_clock_class_by_index(
-               struct bt_clock_class_priority_map *clock_class_priority_map,
-               uint64_t index);
-struct bt_clock_class *
-bt_clock_class_priority_map_get_clock_class_by_name(
-               struct bt_clock_class_priority_map *clock_class_priority_map,
-               const char *name);
-struct bt_clock_class *
-bt_clock_class_priority_map_get_highest_priority_clock_class(
-               struct bt_clock_class_priority_map *clock_class_priority_map);
-int bt_clock_class_priority_map_get_clock_class_priority(
-               struct bt_clock_class_priority_map *clock_class_priority_map,
-               struct bt_clock_class *clock_class, uint64_t *OUTPUTINIT);
-int bt_clock_class_priority_map_add_clock_class(
-               struct bt_clock_class_priority_map *clock_class_priority_map,
-               struct bt_clock_class *clock_class, uint64_t priority);
-struct bt_clock_class_priority_map *bt_clock_class_priority_map_copy(
-               struct bt_clock_class_priority_map *clock_class_priority_map);
diff --git a/bindings/python/bt2/bt2/native_btclockclass.i b/bindings/python/bt2/bt2/native_btclockclass.i
deleted file mode 100644 (file)
index 976bad7..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_clock_class;
-struct bt_clock_value;
-
-/* Clock class functions */
-struct bt_clock_class *bt_clock_class_create(const char *name,
-               uint64_t freq);
-const char *bt_clock_class_get_name(struct bt_clock_class *clock_class);
-int bt_clock_class_set_name(struct bt_clock_class *clock_class, const char *name);
-const char *bt_clock_class_get_description(struct bt_clock_class *clock_class);
-int bt_clock_class_set_description(struct bt_clock_class *clock_class,
-               const char *desc);
-uint64_t bt_clock_class_get_frequency(struct bt_clock_class *clock_class);
-int bt_clock_class_set_frequency(struct bt_clock_class *clock_class,
-               uint64_t freq);
-uint64_t bt_clock_class_get_precision(struct bt_clock_class *clock_class);
-int bt_clock_class_set_precision(struct bt_clock_class *clock_class,
-               uint64_t precision);
-int bt_clock_class_get_offset_s(struct bt_clock_class *clock_class,
-               int64_t *OUTPUT);
-int bt_clock_class_set_offset_s(struct bt_clock_class *clock_class,
-               int64_t offset_s);
-int bt_clock_class_get_offset_cycles(struct bt_clock_class *clock_class,
-               int64_t *OUTPUT);
-int bt_clock_class_set_offset_cycles(struct bt_clock_class *clock_class,
-               int64_t offset);
-int bt_clock_class_is_absolute(struct bt_clock_class *clock_class);
-int bt_clock_class_set_is_absolute(struct bt_clock_class *clock_class,
-               int is_absolute);
-BTUUID bt_clock_class_get_uuid(struct bt_clock_class *clock_class);
-int bt_clock_class_set_uuid(struct bt_clock_class *clock_class,
-               BTUUID uuid);
-
-/* Clock value functions */
-struct bt_clock_value *bt_clock_value_create(
-               struct bt_clock_class *clock_class, uint64_t value);
-int bt_clock_value_get_value(
-               struct bt_clock_value *clock_value, uint64_t *OUTPUT);
-int bt_clock_value_get_value_ns_from_epoch(
-               struct bt_clock_value *clock_value, int64_t *OUTPUT);
-struct bt_clock_class *bt_clock_value_get_class(
-               struct bt_clock_value *clock_value);
diff --git a/bindings/python/bt2/bt2/native_btcomponent.i b/bindings/python/bt2/bt2/native_btcomponent.i
deleted file mode 100644 (file)
index 0e20fb2..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_component;
-
-/* Status */
-enum bt_component_status {
-       BT_COMPONENT_STATUS_OK = 0,
-       BT_COMPONENT_STATUS_END = 1,
-       BT_COMPONENT_STATUS_AGAIN = 11,
-       BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION = 111,
-       BT_COMPONENT_STATUS_ERROR = -1,
-       BT_COMPONENT_STATUS_UNSUPPORTED = -2,
-       BT_COMPONENT_STATUS_INVALID = -22,
-       BT_COMPONENT_STATUS_NOMEM = -12,
-       BT_COMPONENT_STATUS_NOT_FOUND = -19,
-       BT_COMPONENT_STATUS_GRAPH_IS_CANCELED = 125,
-};
-
-/* General functions */
-const char *bt_component_get_name(struct bt_component *component);
-struct bt_component_class *bt_component_get_class(
-               struct bt_component *component);
-enum bt_component_class_type bt_component_get_class_type(
-               struct bt_component *component);
-struct bt_graph *bt_component_get_graph(struct bt_component *component);
-struct bt_component *bt_component_from_private(
-               struct bt_private_component *private_component);
-
-/* Source component functions */
-int64_t bt_component_source_get_output_port_count(
-               struct bt_component *component);
-struct bt_port *bt_component_source_get_output_port_by_name(
-               struct bt_component *component, const char *name);
-struct bt_port *bt_component_source_get_output_port_by_index(
-               struct bt_component *component, uint64_t index);
-
-/* Private source component functions */
-struct bt_private_port *
-bt_private_component_source_get_output_private_port_by_name(
-               struct bt_private_component *private_component,
-               const char *name);
-struct bt_private_port *
-bt_private_component_source_get_output_private_port_by_index(
-               struct bt_private_component *private_component,
-               uint64_t index);
-enum bt_component_status
-bt_private_component_source_add_output_private_port(
-               struct bt_private_component *private_component,
-               const char *name, void *user_data,
-               struct bt_private_port **BTOUTPRIVPORT);
-
-/* Filter component functions */
-int64_t bt_component_filter_get_input_port_count(
-               struct bt_component *component);
-struct bt_port *bt_component_filter_get_input_port_by_name(
-               struct bt_component *component, const char *name);
-struct bt_port *bt_component_filter_get_input_port_by_index(
-               struct bt_component *component, uint64_t index);
-int64_t bt_component_filter_get_output_port_count(
-               struct bt_component *component);
-struct bt_port *bt_component_filter_get_output_port_by_name(
-               struct bt_component *component, const char *name);
-struct bt_port *bt_component_filter_get_output_port_by_index(
-               struct bt_component *component, uint64_t index);
-
-/* Private filter component functions */
-struct bt_private_port *
-bt_private_component_filter_get_output_private_port_by_name(
-               struct bt_private_component *private_component,
-               const char *name);
-struct bt_private_port *
-bt_private_component_filter_get_output_private_port_by_index(
-               struct bt_private_component *private_component, uint64_t index);
-enum bt_component_status
-bt_private_component_filter_add_output_private_port(
-               struct bt_private_component *private_component,
-               const char *name, void *user_data,
-               struct bt_private_port **BTOUTPRIVPORT);
-struct bt_private_port *
-bt_private_component_filter_get_input_private_port_by_name(
-               struct bt_private_component *private_component,
-               const char *name);
-struct bt_private_port *
-bt_private_component_filter_get_input_private_port_by_index(
-               struct bt_private_component *private_component, uint64_t index);
-enum bt_component_status
-bt_private_component_filter_add_input_private_port(
-               struct bt_private_component *private_component,
-               const char *name, void *user_data,
-               struct bt_private_port **BTOUTPRIVPORT);
-
-/* Sink component functions */
-int64_t bt_component_sink_get_input_port_count(
-               struct bt_component *component);
-struct bt_port *bt_component_sink_get_input_port_by_name(
-               struct bt_component *component, const char *name);
-struct bt_port *bt_component_sink_get_input_port_by_index(
-               struct bt_component *component, uint64_t index);
-
-/* Private sink component functions */
-struct bt_private_port *
-bt_private_component_sink_get_input_private_port_by_name(
-               struct bt_private_component *private_component,
-               const char *name);
-struct bt_private_port *
-bt_private_component_sink_get_input_private_port_by_index(
-               struct bt_private_component *private_component, uint64_t index);
-enum bt_component_status
-bt_private_component_sink_add_input_private_port(
-               struct bt_private_component *private_component,
-               const char *name, void *user_data,
-               struct bt_private_port **BTOUTPRIVPORT);
diff --git a/bindings/python/bt2/bt2/native_btcomponentclass.i b/bindings/python/bt2/bt2/native_btcomponentclass.i
deleted file mode 100644 (file)
index 2e29656..0000000
+++ /dev/null
@@ -1,985 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_component_class;
-
-/* Status */
-enum bt_component_class_type {
-       BT_COMPONENT_CLASS_TYPE_UNKNOWN = -1,
-       BT_COMPONENT_CLASS_TYPE_SOURCE = 0,
-       BT_COMPONENT_CLASS_TYPE_SINK = 1,
-       BT_COMPONENT_CLASS_TYPE_FILTER = 2,
-};
-
-/* General functions */
-const char *bt_component_class_get_name(
-               struct bt_component_class *component_class);
-const char *bt_component_class_get_description(
-               struct bt_component_class *component_class);
-const char *bt_component_class_get_help(
-               struct bt_component_class *component_class);
-enum bt_component_class_type bt_component_class_get_type(
-               struct bt_component_class *component_class);
-
-%{
-/*
- * This hash table associates a BT component class object address to a
- * user-defined Python class (PyObject *). The keys and values are NOT
- * owned by this hash table. The Python class objects are owned by the
- * Python module, which should not be unloaded until it is not possible
- * to create a user Python component anyway.
- *
- * This hash table is written to when a user-defined Python component
- * class is created by one of the bt_py3_component_class_*_create()
- * functions.
- *
- * This function is read from when a user calls bt_component_create()
- * with a component class pointer created by one of the functions above.
- * In this case, the original Python class needs to be found to
- * instantiate it and associate the created Python component object with
- * a BT component object instance.
- */
-
-static GHashTable *bt_cc_ptr_to_py_cls;
-
-static void register_cc_ptr_to_py_cls(struct bt_component_class *bt_cc,
-               PyObject *py_cls)
-{
-       if (!bt_cc_ptr_to_py_cls) {
-               /*
-                * Lazy-initializing this GHashTable because GLib
-                * might not be initialized yet and it needs to be
-                * before we call g_hash_table_new()
-                */
-               BT_LOGD_STR("Creating native component class to Python component class hash table.");
-               bt_cc_ptr_to_py_cls = g_hash_table_new(g_direct_hash, g_direct_equal);
-               BT_ASSERT(bt_cc_ptr_to_py_cls);
-       }
-
-       g_hash_table_insert(bt_cc_ptr_to_py_cls, (gpointer) bt_cc,
-               (gpointer) py_cls);
-}
-
-static PyObject *lookup_cc_ptr_to_py_cls(struct bt_component_class *bt_cc)
-{
-       if (!bt_cc_ptr_to_py_cls) {
-               BT_LOGW("Cannot look up Python component class because hash table is NULL: "
-                       "comp-cls-addr=%p", bt_cc);
-               return NULL;
-       }
-
-       return (PyObject *) g_hash_table_lookup(bt_cc_ptr_to_py_cls,
-               (gconstpointer) bt_cc);
-}
-
-
-/*
- * Useful Python objects.
- */
-
-static PyObject *py_mod_bt2 = NULL;
-static PyObject *py_mod_bt2_exc_error_type = NULL;
-static PyObject *py_mod_bt2_exc_unsupported_feature_type = NULL;
-static PyObject *py_mod_bt2_exc_try_again_type = NULL;
-static PyObject *py_mod_bt2_exc_stop_type = NULL;
-static PyObject *py_mod_bt2_exc_port_connection_refused_type = NULL;
-static PyObject *py_mod_bt2_exc_notif_iter_canceled_type = NULL;
-static PyObject *py_mod_bt2_exc_invalid_query_object_type = NULL;
-static PyObject *py_mod_bt2_exc_invalid_query_params_type = NULL;
-
-static void bt_py3_cc_init_from_bt2(void)
-{
-       /*
-        * This is called once the bt2 package is loaded.
-        *
-        * Those modules and functions are needed while the package is
-        * used. Loading them here is safe because we know the bt2
-        * package is imported, and we know that the user cannot use the
-        * code here without importing bt2 first.
-        */
-       py_mod_bt2 = PyImport_ImportModule("bt2");
-       BT_ASSERT(py_mod_bt2);
-       py_mod_bt2_exc_error_type =
-               PyObject_GetAttrString(py_mod_bt2, "Error");
-       BT_ASSERT(py_mod_bt2_exc_error_type);
-       py_mod_bt2_exc_unsupported_feature_type =
-               PyObject_GetAttrString(py_mod_bt2, "UnsupportedFeature");
-       BT_ASSERT(py_mod_bt2_exc_unsupported_feature_type);
-       py_mod_bt2_exc_try_again_type =
-               PyObject_GetAttrString(py_mod_bt2, "TryAgain");
-       BT_ASSERT(py_mod_bt2_exc_try_again_type);
-       py_mod_bt2_exc_stop_type =
-               PyObject_GetAttrString(py_mod_bt2, "Stop");
-       BT_ASSERT(py_mod_bt2_exc_stop_type);
-       py_mod_bt2_exc_port_connection_refused_type =
-               PyObject_GetAttrString(py_mod_bt2, "PortConnectionRefused");
-       BT_ASSERT(py_mod_bt2_exc_port_connection_refused_type);
-       py_mod_bt2_exc_invalid_query_object_type =
-               PyObject_GetAttrString(py_mod_bt2, "InvalidQueryObject");
-       BT_ASSERT(py_mod_bt2_exc_invalid_query_object_type);
-       py_mod_bt2_exc_invalid_query_params_type =
-               PyObject_GetAttrString(py_mod_bt2, "InvalidQueryParams");
-       BT_ASSERT(py_mod_bt2_exc_invalid_query_params_type);
-}
-
-static void bt_py3_cc_exit_handler(void)
-{
-       /*
-        * This is an exit handler (set by the bt2 package).
-        *
-        * We only give back the references that we took in
-        * bt_py3_cc_init_from_bt2() here. The global variables continue
-        * to exist for the code of this file, but they are now borrowed
-        * references. If this code is executed, it means that somehow
-        * the modules are still loaded, so it should be safe to use
-        * them even without a strong reference.
-        *
-        * We cannot do this in the library's destructor because it
-        * gets executed once Python is already finalized.
-        */
-       Py_XDECREF(py_mod_bt2);
-       Py_XDECREF(py_mod_bt2_exc_error_type);
-       Py_XDECREF(py_mod_bt2_exc_unsupported_feature_type);
-       Py_XDECREF(py_mod_bt2_exc_try_again_type);
-       Py_XDECREF(py_mod_bt2_exc_stop_type);
-       Py_XDECREF(py_mod_bt2_exc_port_connection_refused_type);
-       Py_XDECREF(py_mod_bt2_exc_notif_iter_canceled_type);
-       Py_XDECREF(py_mod_bt2_exc_invalid_query_object_type);
-       Py_XDECREF(py_mod_bt2_exc_invalid_query_params_type);
-}
-
-
-/* Library destructor */
-
-__attribute__((destructor))
-static void bt_py3_native_comp_class_dtor(void) {
-       /* Destroy component class association hash table */
-       if (bt_cc_ptr_to_py_cls) {
-               BT_LOGD_STR("Destroying native component class to Python component class hash table.");
-               g_hash_table_destroy(bt_cc_ptr_to_py_cls);
-       }
-}
-
-
-/* Component class proxy methods (delegate to the attached Python object) */
-
-static enum bt_notification_iterator_status bt_py3_exc_to_notif_iter_status(void)
-{
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       PyObject *exc = PyErr_Occurred();
-
-       if (!exc) {
-               goto end;
-       }
-
-       if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_unsupported_feature_type)) {
-               status = BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_stop_type)) {
-               status = BT_NOTIFICATION_ITERATOR_STATUS_END;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_try_again_type)) {
-               status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN;
-       } else {
-               status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
-       }
-
-end:
-       PyErr_Clear();
-       return status;
-}
-
-static enum bt_query_status bt_py3_exc_to_query_status(void)
-{
-       enum bt_query_status status = BT_QUERY_STATUS_OK;
-       PyObject *exc = PyErr_Occurred();
-
-       if (!exc) {
-               goto end;
-       }
-
-       if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_invalid_query_object_type)) {
-               status = BT_QUERY_STATUS_INVALID_OBJECT;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_invalid_query_params_type)) {
-               status = BT_QUERY_STATUS_INVALID_PARAMS;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_try_again_type)) {
-               status = BT_QUERY_STATUS_AGAIN;
-       } else {
-               status = BT_QUERY_STATUS_ERROR;
-       }
-
-end:
-       PyErr_Clear();
-       return status;
-}
-
-static enum bt_component_status bt_py3_exc_to_component_status(void)
-{
-       enum bt_component_status status = BT_COMPONENT_STATUS_OK;
-       PyObject *exc = PyErr_Occurred();
-
-       if (!exc) {
-               goto end;
-       }
-
-       if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_unsupported_feature_type)) {
-               status = BT_COMPONENT_STATUS_UNSUPPORTED;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_try_again_type)) {
-               status = BT_COMPONENT_STATUS_AGAIN;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_stop_type)) {
-               status = BT_COMPONENT_STATUS_END;
-       } else if (PyErr_GivenExceptionMatches(exc,
-                       py_mod_bt2_exc_port_connection_refused_type)) {
-               status = BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION;
-       } else {
-               status = BT_COMPONENT_STATUS_ERROR;
-       }
-
-end:
-       PyErr_Clear();
-       return status;
-}
-
-static enum bt_component_status bt_py3_cc_init(
-               struct bt_private_component *priv_comp,
-               struct bt_value *params, void *init_method_data)
-{
-       struct bt_component *comp =
-               bt_component_from_private(priv_comp);
-       struct bt_component_class *comp_cls = bt_component_get_class(comp);
-       enum bt_component_status status = BT_COMPONENT_STATUS_OK;
-       PyObject *py_cls = NULL;
-       PyObject *py_comp = NULL;
-       PyObject *py_params_ptr = NULL;
-       PyObject *py_comp_ptr = NULL;
-
-       (void) init_method_data;
-       BT_ASSERT(comp);
-       BT_ASSERT(comp_cls);
-
-       /*
-        * Get the user-defined Python class which created this
-        * component's class in the first place (borrowed
-        * reference).
-        */
-       py_cls = lookup_cc_ptr_to_py_cls(comp_cls);
-       if (!py_cls) {
-               BT_LOGE("Cannot find Python class associated to native component class: "
-                       "comp-cls-addr=%p", comp_cls);
-               goto error;
-       }
-
-       /* Parameters pointer -> SWIG pointer Python object */
-       py_params_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(params),
-               SWIGTYPE_p_bt_value, 0);
-       if (!py_params_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       /* Private component pointer -> SWIG pointer Python object */
-       py_comp_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(priv_comp),
-               SWIGTYPE_p_bt_private_component, 0);
-       if (!py_comp_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       /*
-        * Do the equivalent of this:
-        *
-        *     py_comp = py_cls._init_from_native(py_comp_ptr, py_params_ptr)
-        *
-        * _UserComponentType._init_from_native() calls the Python
-        * component object's __init__() function.
-        */
-       py_comp = PyObject_CallMethod(py_cls,
-               "_init_from_native", "(OO)", py_comp_ptr, py_params_ptr);
-       if (!py_comp) {
-               BT_LOGE("Failed to call Python class's _init_from_native() method: "
-                       "py-cls-addr=%p", py_cls);
-               goto error;
-       }
-
-       /*
-        * Our user Python component object is now fully created and
-        * initialized by the user. Since we just created it, this
-        * native component is its only (persistent) owner.
-        */
-       bt_private_component_set_user_data(priv_comp, py_comp);
-       py_comp = NULL;
-       goto end;
-
-error:
-       status = BT_COMPONENT_STATUS_ERROR;
-
-       /*
-        * Clear any exception: we're returning a bad status anyway. If
-        * this call originated from Python (creation from a plugin's
-        * component class, for example), then the user gets an
-        * appropriate creation error.
-        */
-       PyErr_Clear();
-
-end:
-       bt_put(comp_cls);
-       bt_put(comp);
-       Py_XDECREF(py_comp);
-       Py_XDECREF(py_params_ptr);
-       Py_XDECREF(py_comp_ptr);
-       return status;
-}
-
-static void bt_py3_cc_finalize(struct bt_private_component *priv_comp)
-{
-       PyObject *py_comp = bt_private_component_get_user_data(priv_comp);
-       PyObject *py_method_result = NULL;
-
-       BT_ASSERT(py_comp);
-
-       /* Call user's _finalize() method */
-       py_method_result = PyObject_CallMethod(py_comp,
-               "_finalize", NULL);
-
-       if (PyErr_Occurred()) {
-               BT_LOGW("User's _finalize() method raised an exception: ignoring.");
-       }
-
-       /*
-        * Ignore any exception raised by the _finalize() method because
-        * it won't change anything at this point: the component is
-        * being destroyed anyway.
-        */
-       PyErr_Clear();
-       Py_XDECREF(py_method_result);
-       Py_DECREF(py_comp);
-}
-
-static enum bt_component_status bt_py3_cc_accept_port_connection(
-               struct bt_private_component *priv_comp,
-               struct bt_private_port *self_priv_port,
-               struct bt_port *other_port)
-{
-       enum bt_component_status status;
-       PyObject *py_comp = NULL;
-       PyObject *py_self_port_ptr = NULL;
-       PyObject *py_other_port_ptr = NULL;
-       PyObject *py_method_result = NULL;
-
-       py_comp = bt_private_component_get_user_data(priv_comp);
-       BT_ASSERT(py_comp);
-       py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_priv_port),
-               SWIGTYPE_p_bt_private_port, 0);
-       if (!py_self_port_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       py_other_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(other_port),
-               SWIGTYPE_p_bt_port, 0);
-       if (!py_other_port_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       py_method_result = PyObject_CallMethod(py_comp,
-               "_accept_port_connection_from_native", "(OO)", py_self_port_ptr,
-               py_other_port_ptr);
-       status = bt_py3_exc_to_component_status();
-       if (!py_method_result && status == BT_COMPONENT_STATUS_OK) {
-               /* Pretty sure this should never happen, but just in case */
-               BT_LOGE("User's _accept_port_connection() method failed without raising an exception: "
-                       "status=%d", status);
-               goto error;
-       }
-
-       if (status == BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION) {
-               /*
-                * Looks like the user method raised
-                * PortConnectionRefused: accept this like if it
-                * returned False.
-                */
-               goto end;
-       } else if (status != BT_COMPONENT_STATUS_OK) {
-               BT_LOGE("User's _accept_port_connection() raised an unexpected exception: "
-                       "status=%d", status);
-               goto error;
-       }
-
-       BT_ASSERT(PyBool_Check(py_method_result));
-
-       if (py_method_result == Py_True) {
-               status = BT_COMPONENT_STATUS_OK;
-       } else {
-               status = BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION;
-       }
-
-       goto end;
-
-error:
-       status = BT_COMPONENT_STATUS_ERROR;
-
-       /*
-        * Clear any exception: we're returning a bad status anyway. If
-        * this call originated from Python, then the user gets an
-        * appropriate error.
-        */
-       PyErr_Clear();
-
-end:
-       Py_XDECREF(py_self_port_ptr);
-       Py_XDECREF(py_other_port_ptr);
-       Py_XDECREF(py_method_result);
-       return status;
-}
-
-static void bt_py3_cc_port_connected(
-               struct bt_private_component *priv_comp,
-               struct bt_private_port *self_priv_port,
-               struct bt_port *other_port)
-{
-       PyObject *py_comp = NULL;
-       PyObject *py_self_port_ptr = NULL;
-       PyObject *py_other_port_ptr = NULL;
-       PyObject *py_method_result = NULL;
-
-       py_comp = bt_private_component_get_user_data(priv_comp);
-       BT_ASSERT(py_comp);
-       py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_priv_port),
-               SWIGTYPE_p_bt_private_port, 0);
-       if (!py_self_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_other_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(other_port),
-               SWIGTYPE_p_bt_port, 0);
-       if (!py_other_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_method_result = PyObject_CallMethod(py_comp,
-               "_port_connected_from_native", "(OO)", py_self_port_ptr,
-               py_other_port_ptr);
-       BT_ASSERT(py_method_result == Py_None);
-       Py_XDECREF(py_self_port_ptr);
-       Py_XDECREF(py_other_port_ptr);
-       Py_XDECREF(py_method_result);
-}
-
-static void bt_py3_cc_port_disconnected(
-               struct bt_private_component *priv_comp,
-               struct bt_private_port *priv_port)
-{
-       PyObject *py_comp = NULL;
-       PyObject *py_port_ptr = NULL;
-       PyObject *py_method_result = NULL;
-
-       py_comp = bt_private_component_get_user_data(priv_comp);
-       BT_ASSERT(py_comp);
-       py_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(priv_port),
-               SWIGTYPE_p_bt_private_port, 0);
-       if (!py_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_method_result = PyObject_CallMethod(py_comp,
-               "_port_disconnected_from_native", "(O)", py_port_ptr);
-       BT_ASSERT(py_method_result == Py_None);
-       Py_XDECREF(py_port_ptr);
-       Py_XDECREF(py_method_result);
-}
-
-static struct bt_component_class_query_method_return bt_py3_cc_query(
-               struct bt_component_class *comp_cls,
-               struct bt_query_executor *query_exec,
-               const char *object, struct bt_value *params)
-{
-       PyObject *py_cls = NULL;
-       PyObject *py_params_ptr = NULL;
-       PyObject *py_query_exec_ptr = NULL;
-       PyObject *py_query_func = NULL;
-       PyObject *py_object = NULL;
-       PyObject *py_results_addr = NULL;
-       struct bt_component_class_query_method_return ret = {
-               .status = BT_QUERY_STATUS_OK,
-               .result = NULL,
-       };
-
-       py_cls = lookup_cc_ptr_to_py_cls(comp_cls);
-       if (!py_cls) {
-               BT_LOGE("Cannot find Python class associated to native component class: "
-                       "comp-cls-addr=%p", comp_cls);
-               goto error;
-       }
-
-       py_params_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(params),
-               SWIGTYPE_p_bt_value, 0);
-       if (!py_params_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       py_query_exec_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(query_exec),
-               SWIGTYPE_p_bt_query_executor, 0);
-       if (!py_query_exec_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       py_object = SWIG_FromCharPtr(object);
-       if (!py_object) {
-               BT_LOGE_STR("Failed to create a Python string.");
-               goto error;
-       }
-
-       py_results_addr = PyObject_CallMethod(py_cls,
-               "_query_from_native", "(OOO)", py_query_exec_ptr,
-               py_object, py_params_ptr);
-       ret.status = bt_py3_exc_to_query_status();
-       if (!py_results_addr && ret.status == BT_QUERY_STATUS_OK) {
-               /* Pretty sure this should never happen, but just in case */
-               BT_LOGE("_query_from_native() class method failed without raising an exception: "
-                       "status=%d", ret.status);
-               ret.status = BT_QUERY_STATUS_ERROR;
-               goto end;
-       }
-
-       if (ret.status != BT_QUERY_STATUS_OK) {
-               goto end;
-       }
-
-       if (py_results_addr == Py_NotImplemented) {
-               BT_LOGE_STR("User's _query() method is not implemented.");
-               goto error;
-       }
-
-       /*
-        * The returned object, on success, is an integer object
-        * (PyLong) containing the address of a BT value object (new
-        * reference).
-        */
-       ret.result = (void *) PyLong_AsUnsignedLongLong(py_results_addr);
-       BT_ASSERT(!PyErr_Occurred());
-       BT_ASSERT(ret.result);
-       goto end;
-
-error:
-       BT_PUT(ret.result);
-       PyErr_Clear();
-       ret.status = BT_QUERY_STATUS_ERROR;
-       BT_PUT(ret.result);
-
-end:
-       Py_XDECREF(py_params_ptr);
-       Py_XDECREF(py_query_exec_ptr);
-       Py_XDECREF(py_query_func);
-       Py_XDECREF(py_object);
-       Py_XDECREF(py_results_addr);
-       return ret;
-}
-
-static enum bt_notification_iterator_status bt_py3_cc_notification_iterator_init(
-               struct bt_private_connection_private_notification_iterator *priv_notif_iter,
-               struct bt_private_port *priv_port)
-{
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       PyObject *py_comp_cls = NULL;
-       PyObject *py_iter_cls = NULL;
-       PyObject *py_iter_ptr = NULL;
-       PyObject *py_init_method_result = NULL;
-       PyObject *py_iter = NULL;
-       struct bt_private_component *priv_comp =
-               bt_private_connection_private_notification_iterator_get_private_component(
-                       priv_notif_iter);
-       PyObject *py_comp;
-
-       BT_ASSERT(priv_comp);
-       py_comp = bt_private_component_get_user_data(priv_comp);
-
-       /* Find user's Python notification iterator class */
-       py_comp_cls = PyObject_GetAttrString(py_comp, "__class__");
-       if (!py_comp_cls) {
-               BT_LOGE_STR("Cannot get Python object's `__class__` attribute.");
-               goto error;
-       }
-
-       py_iter_cls = PyObject_GetAttrString(py_comp_cls, "_iter_cls");
-       if (!py_iter_cls) {
-               BT_LOGE_STR("Cannot get Python class's `_iter_cls` attribute.");
-               goto error;
-       }
-
-       py_iter_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(priv_notif_iter),
-               SWIGTYPE_p_bt_private_connection_private_notification_iterator, 0);
-       if (!py_iter_ptr) {
-               BT_LOGE_STR("Failed to create a SWIG pointer object.");
-               goto error;
-       }
-
-       /*
-        * Create object with borrowed native notification iterator
-        * reference:
-        *
-        *     py_iter = py_iter_cls.__new__(py_iter_cls, py_iter_ptr)
-        */
-       py_iter = PyObject_CallMethod(py_iter_cls, "__new__",
-               "(OO)", py_iter_cls, py_iter_ptr);
-       if (!py_iter) {
-               BT_LOGE("Failed to call Python class's __new__() method: "
-                       "py-cls-addr=%p", py_iter_cls);
-               goto error;
-       }
-
-       /*
-        * Initialize object:
-        *
-        *     py_iter.__init__()
-        *
-        * At this point, py_iter._ptr is set, so this initialization
-        * function has access to self._component (which gives it the
-        * user Python component object from which the iterator was
-        * created).
-        */
-       py_init_method_result = PyObject_CallMethod(py_iter, "__init__", NULL);
-       if (!py_init_method_result) {
-               BT_LOGE_STR("User's __init__() method failed.");
-               goto error;
-       }
-
-       /*
-        * Since the Python code can never instantiate a user-defined
-        * notification iterator class, the native notification iterator
-        * object does NOT belong to a user Python notification iterator
-        * object (borrowed reference). However this Python object is
-        * owned by this native notification iterator object.
-        *
-        * In the Python world, the lifetime of the native notification
-        * iterator is managed by a _GenericNotificationIterator
-        * instance:
-        *
-        *     _GenericNotificationIterator instance:
-        *         owns a native bt_notification_iterator object (iter)
-        *             owns a _UserNotificationIterator instance (py_iter)
-        *                 self._ptr is a borrowed reference to the
-        *                 native bt_private_connection_private_notification_iterator
-        *                 object (iter)
-        */
-       bt_private_connection_private_notification_iterator_set_user_data(priv_notif_iter,
-               py_iter);
-       py_iter = NULL;
-       goto end;
-
-error:
-       status = bt_py3_exc_to_notif_iter_status();
-       if (status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
-               /*
-                * Looks like there wasn't any exception from the Python
-                * side, but we're still in an error state here.
-                */
-               status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
-       }
-
-       /*
-        * Clear any exception: we're returning a bad status anyway. If
-        * this call originated from Python, then the user gets an
-        * appropriate creation error.
-        */
-       PyErr_Clear();
-
-end:
-       bt_put(priv_comp);
-       Py_XDECREF(py_comp_cls);
-       Py_XDECREF(py_iter_cls);
-       Py_XDECREF(py_iter_ptr);
-       Py_XDECREF(py_init_method_result);
-       Py_XDECREF(py_iter);
-       return status;
-}
-
-static void bt_py3_cc_notification_iterator_finalize(
-               struct bt_private_connection_private_notification_iterator *priv_notif_iter)
-{
-       PyObject *py_notif_iter =
-               bt_private_connection_private_notification_iterator_get_user_data(priv_notif_iter);
-       PyObject *py_method_result = NULL;
-
-       BT_ASSERT(py_notif_iter);
-
-       /* Call user's _finalize() method */
-       py_method_result = PyObject_CallMethod(py_notif_iter,
-               "_finalize", NULL);
-
-       if (PyErr_Occurred()) {
-               BT_LOGW("User's _finalize() method raised an exception: ignoring.");
-       }
-
-       /*
-        * Ignore any exception raised by the _finalize() method because
-        * it won't change anything at this point: the component is
-        * being destroyed anyway.
-        */
-       PyErr_Clear();
-       Py_XDECREF(py_method_result);
-       Py_DECREF(py_notif_iter);
-}
-
-static struct bt_notification_iterator_next_method_return
-bt_py3_cc_notification_iterator_next(
-                       struct bt_private_connection_private_notification_iterator *priv_notif_iter)
-{
-       struct bt_notification_iterator_next_method_return next_ret = {
-               .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
-               .notification = NULL,
-       };
-       PyObject *py_notif_iter =
-               bt_private_connection_private_notification_iterator_get_user_data(priv_notif_iter);
-       PyObject *py_method_result = NULL;
-
-       BT_ASSERT(py_notif_iter);
-       py_method_result = PyObject_CallMethod(py_notif_iter,
-               "_next_from_native", NULL);
-       if (!py_method_result) {
-               next_ret.status = bt_py3_exc_to_notif_iter_status();
-               BT_ASSERT(next_ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK);
-               goto end;
-       }
-
-       /*
-        * The returned object, on success, is an integer object
-        * (PyLong) containing the address of a native notification
-        * object (which is now ours).
-        */
-       next_ret.notification =
-               (struct bt_notification *) PyLong_AsUnsignedLongLong(
-                       py_method_result);
-
-       /* Clear potential overflow error; should never happen */
-       BT_ASSERT(!PyErr_Occurred());
-       BT_ASSERT(next_ret.notification);
-       goto end;
-
-end:
-       Py_XDECREF(py_method_result);
-       return next_ret;
-}
-
-static enum bt_component_status bt_py3_cc_sink_consume(
-               struct bt_private_component *priv_comp)
-{
-       PyObject *py_comp = bt_private_component_get_user_data(priv_comp);
-       PyObject *py_method_result = NULL;
-       enum bt_component_status status;
-
-       BT_ASSERT(py_comp);
-       py_method_result = PyObject_CallMethod(py_comp,
-               "_consume", NULL);
-       status = bt_py3_exc_to_component_status();
-       if (!py_method_result && status == BT_COMPONENT_STATUS_OK) {
-               /* Pretty sure this should never happen, but just in case */
-               BT_LOGE("User's _consume() method failed without raising an exception: "
-                       "status=%d", status);
-               status = BT_COMPONENT_STATUS_ERROR;
-       }
-
-       Py_XDECREF(py_method_result);
-       return status;
-}
-
-
-/* Component class creation functions (called from Python module) */
-
-static int bt_py3_cc_set_optional_attrs_methods(struct bt_component_class *cc,
-               const char *description, const char *help)
-{
-       int ret = 0;
-
-       if (description) {
-               ret = bt_component_class_set_description(cc, description);
-               if (ret) {
-                       BT_LOGE("Cannot set component class's description: "
-                               "comp-cls-addr=%p", cc);
-                       goto end;
-               }
-       }
-
-       if (help) {
-               ret = bt_component_class_set_help(cc, help);
-               if (ret) {
-                       BT_LOGE("Cannot set component class's help text: "
-                               "comp-cls-addr=%p", cc);
-                       goto end;
-               }
-       }
-
-       ret = bt_component_class_set_init_method(cc, bt_py3_cc_init);
-       BT_ASSERT(ret == 0);
-       ret = bt_component_class_set_finalize_method(cc, bt_py3_cc_finalize);
-       BT_ASSERT(ret == 0);
-       ret = bt_component_class_set_accept_port_connection_method(cc,
-               bt_py3_cc_accept_port_connection);
-       BT_ASSERT(ret == 0);
-       ret = bt_component_class_set_port_connected_method(cc,
-               bt_py3_cc_port_connected);
-       BT_ASSERT(ret == 0);
-       ret = bt_component_class_set_port_disconnected_method(cc,
-               bt_py3_cc_port_disconnected);
-       BT_ASSERT(ret == 0);
-       ret = bt_component_class_set_query_method(cc, bt_py3_cc_query);
-       BT_ASSERT(ret == 0);
-
-end:
-       return ret;
-}
-
-static void bt_py3_cc_set_optional_iter_methods(struct bt_component_class *cc,
-               int (*set_notif_iter_init_method)(struct bt_component_class *, bt_component_class_notification_iterator_init_method),
-               int (*set_notif_iter_finalize_method)(struct bt_component_class *, bt_component_class_notification_iterator_finalize_method))
-{
-       int ret __attribute__((unused));
-
-       ret = set_notif_iter_init_method(
-               cc, bt_py3_cc_notification_iterator_init);
-       BT_ASSERT(ret == 0);
-       ret = set_notif_iter_finalize_method(
-               cc, bt_py3_cc_notification_iterator_finalize);
-       BT_ASSERT(ret == 0);
-}
-
-static struct bt_component_class *bt_py3_component_class_source_create(
-               PyObject *py_cls, const char *name, const char *description,
-               const char *help)
-{
-       struct bt_component_class *cc;
-       int ret;
-
-       BT_ASSERT(py_cls);
-       cc = bt_component_class_source_create(name,
-               bt_py3_cc_notification_iterator_next);
-       if (!cc) {
-               BT_LOGE_STR("Cannot create source component class.");
-               goto end;
-       }
-
-       ret = bt_py3_cc_set_optional_attrs_methods(cc, description, help);
-       if (ret) {
-               BT_LOGE_STR("Cannot set source component class's optional attributes and methods.");
-               BT_PUT(cc);
-               goto end;
-       }
-
-       bt_py3_cc_set_optional_iter_methods(cc,
-               bt_component_class_source_set_notification_iterator_init_method,
-               bt_component_class_source_set_notification_iterator_finalize_method);
-       register_cc_ptr_to_py_cls(cc, py_cls);
-       bt_component_class_freeze(cc);
-
-end:
-       return cc;
-}
-
-static struct bt_component_class *bt_py3_component_class_filter_create(
-               PyObject *py_cls, const char *name, const char *description,
-               const char *help)
-{
-       struct bt_component_class *cc;
-       int ret;
-
-       BT_ASSERT(py_cls);
-       cc = bt_component_class_filter_create(name,
-               bt_py3_cc_notification_iterator_next);
-       if (!cc) {
-               BT_LOGE_STR("Cannot create filter component class.");
-               goto end;
-       }
-
-       ret = bt_py3_cc_set_optional_attrs_methods(cc, description, help);
-       if (ret) {
-               BT_LOGE_STR("Cannot set filter component class's optional attributes and methods.");
-               BT_PUT(cc);
-               goto end;
-       }
-
-       bt_py3_cc_set_optional_iter_methods(cc,
-               bt_component_class_filter_set_notification_iterator_init_method,
-               bt_component_class_filter_set_notification_iterator_finalize_method);
-       register_cc_ptr_to_py_cls(cc, py_cls);
-       bt_component_class_freeze(cc);
-
-end:
-       return cc;
-}
-
-static struct bt_component_class *bt_py3_component_class_sink_create(
-               PyObject *py_cls, const char *name, const char *description,
-               const char *help)
-{
-       struct bt_component_class *cc;
-       int ret;
-
-       BT_ASSERT(py_cls);
-       cc = bt_component_class_sink_create(name, bt_py3_cc_sink_consume);
-       if (!cc) {
-               BT_LOGE_STR("Cannot create sink component class.");
-               goto end;
-       }
-
-       ret = bt_py3_cc_set_optional_attrs_methods(cc, description, help);
-       if (ret) {
-               BT_LOGE_STR("Cannot set sink component class's optional attributes and methods.");
-               BT_PUT(cc);
-               goto end;
-       }
-
-       register_cc_ptr_to_py_cls(cc, py_cls);
-       bt_component_class_freeze(cc);
-
-end:
-       return cc;
-}
-%}
-
-struct bt_component_class *bt_py3_component_class_source_create(
-               PyObject *py_cls, const char *name, const char *description,
-               const char *help);
-struct bt_component_class *bt_py3_component_class_filter_create(
-               PyObject *py_cls, const char *name, const char *description,
-               const char *help);
-struct bt_component_class *bt_py3_component_class_sink_create(
-               PyObject *py_cls, const char *name, const char *description,
-               const char *help);
-void bt_py3_cc_init_from_bt2(void);
-void bt_py3_cc_exit_handler(void);
diff --git a/bindings/python/bt2/bt2/native_btconnection.i b/bindings/python/bt2/bt2/native_btconnection.i
deleted file mode 100644 (file)
index 7e6195c..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_connection;
-struct bt_private_connection;
-
-/* Status */
-enum bt_connection_status {
-       BT_CONNECTION_STATUS_GRAPH_IS_CANCELED = 125,
-       BT_CONNECTION_STATUS_OK = 0,
-       BT_CONNECTION_STATUS_INVALID = -22,
-       BT_CONNECTION_STATUS_ERROR = -1,
-       BT_CONNECTION_STATUS_NOMEM = -12,
-       BT_CONNECTION_STATUS_IS_ENDED = 104,
-};
-
-/* Functions (public) */
-struct bt_port *bt_connection_get_downstream_port(
-               struct bt_connection *connection);
-struct bt_port *bt_connection_get_upstream_port(
-               struct bt_connection *connection);
-int bt_connection_is_ended(struct bt_connection *connection);
-
-/* Functions (private) */
-struct bt_connection *bt_connection_from_private(
-               struct bt_private_connection *private_connection);
-
-/* Helper functions for Python */
-%typemap(out) struct bt_py3_create_notif_iter_ret {
-       $result = PyTuple_New(2);
-       PyObject *py_notif_iter_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr($1.notif_iter),
-               SWIGTYPE_p_bt_notification_iterator, 0);
-       PyObject *py_status = SWIG_From_long_SS_long($1.status);
-       PyTuple_SET_ITEM($result, 0, py_status);
-       PyTuple_SET_ITEM($result, 1, py_notif_iter_ptr);
-}
-
-%{
-struct bt_py3_create_notif_iter_ret {
-       enum bt_connection_status status;
-       struct bt_notification_iterator *notif_iter;
-};
-
-static struct bt_py3_create_notif_iter_ret bt_py3_create_priv_conn_notif_iter(
-               unsigned long long priv_conn_addr, PyObject *py_notif_types)
-{
-       struct bt_private_connection *priv_conn;
-       enum bt_notification_type *notification_types = NULL;
-       struct bt_py3_create_notif_iter_ret ret;
-
-       priv_conn = (void *) priv_conn_addr;
-       BT_ASSERT(!PyErr_Occurred());
-       BT_ASSERT(priv_conn);
-
-       notification_types = bt_py3_notif_types_from_py_list(py_notif_types);
-       ret.status = bt_private_connection_create_notification_iterator(
-               priv_conn, notification_types, &ret.notif_iter);
-       g_free(notification_types);
-
-       return ret;
-}
-%}
-
-struct bt_py3_create_notif_iter_ret bt_py3_create_priv_conn_notif_iter(
-               unsigned long long priv_conn_addr, PyObject *notif_types);
diff --git a/bindings/python/bt2/bt2/native_btctfwriter.i b/bindings/python/bt2/bt2/native_btctfwriter.i
deleted file mode 100644 (file)
index ed4f7fb..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_ctf_clock;
-struct bt_ctf_writer;
-
-/* Clock functions */
-struct bt_ctf_clock *bt_ctf_clock_create(const char *name);
-const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock);
-const char *bt_ctf_clock_get_description(struct bt_ctf_clock *clock);
-int bt_ctf_clock_set_description(struct bt_ctf_clock *clock,
-               const char *desc);
-uint64_t bt_ctf_clock_get_frequency(struct bt_ctf_clock *clock);
-int bt_ctf_clock_set_frequency(struct bt_ctf_clock *clock,
-               uint64_t freq);
-uint64_t bt_ctf_clock_get_precision(struct bt_ctf_clock *clock);
-int bt_ctf_clock_set_precision(struct bt_ctf_clock *clock,
-               uint64_t precision);
-int bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock,
-               int64_t *OUTPUT);
-int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock,
-               int64_t offset_s);
-int bt_ctf_clock_get_offset(struct bt_ctf_clock *clock,
-               int64_t *OUTPUT);
-int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock,
-               int64_t offset);
-int bt_ctf_clock_get_is_absolute(struct bt_ctf_clock *clock);
-int bt_ctf_clock_set_is_absolute(struct bt_ctf_clock *clock,
-               int is_absolute);
-BTUUID bt_ctf_clock_get_uuid(struct bt_ctf_clock *clock);
-int bt_ctf_clock_set_uuid(struct bt_ctf_clock *clock,
-               BTUUID uuid);
-int bt_ctf_clock_set_time(struct bt_ctf_clock *clock,
-               int64_t time);
-
-/* Stream functions */
-int bt_stream_get_discarded_events_count(
-               struct bt_stream *stream, uint64_t *OUTPUT);
-void bt_stream_append_discarded_events(struct bt_stream *stream,
-               uint64_t event_count);
-int bt_stream_append_event(struct bt_stream *stream,
-               struct bt_event *event);
-struct bt_field *bt_stream_get_packet_header(
-               struct bt_stream *stream);
-int bt_stream_set_packet_header(
-               struct bt_stream *stream,
-               struct bt_field *packet_header);
-struct bt_field *bt_stream_get_packet_context(
-               struct bt_stream *stream);
-int bt_stream_set_packet_context(
-               struct bt_stream *stream,
-               struct bt_field *packet_context);
-int bt_stream_flush(struct bt_stream *stream);
-int bt_stream_is_writer(struct bt_stream *stream);
-
-/* Stream class functions */
-int bt_stream_class_set_clock(
-               struct bt_stream_class *stream_class,
-               struct bt_ctf_clock *clock);
-struct bt_ctf_clock *bt_stream_class_get_clock(
-               struct bt_stream_class *stream_class);
-
-/* Writer functions */
-struct bt_ctf_writer *bt_ctf_writer_create(const char *path);
-struct bt_trace *bt_ctf_writer_get_trace(
-               struct bt_ctf_writer *writer);
-int bt_ctf_writer_add_clock(struct bt_ctf_writer *writer,
-               struct bt_ctf_clock *clock);
-char *bt_ctf_writer_get_metadata_string(struct bt_ctf_writer *writer);
-void bt_ctf_writer_flush_metadata(struct bt_ctf_writer *writer);
diff --git a/bindings/python/bt2/bt2/native_btevent.i b/bindings/python/bt2/bt2/native_btevent.i
deleted file mode 100644 (file)
index df0f858..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_event;
-
-/* Functions */
-struct bt_event *bt_event_create(
-               struct bt_event_class *event_class);
-struct bt_event_class *bt_event_get_class(
-               struct bt_event *event);
-struct bt_packet *bt_event_get_packet(
-               struct bt_event *event);
-int bt_event_set_packet(struct bt_event *event,
-               struct bt_packet *packet);
-struct bt_stream *bt_event_get_stream(
-               struct bt_event *event);
-struct bt_field *bt_event_get_header(
-               struct bt_event *event);
-int bt_event_set_header(struct bt_event *event,
-               struct bt_field *header);
-struct bt_field *bt_event_get_stream_event_context(
-               struct bt_event *event);
-int bt_event_set_stream_event_context(struct bt_event *event,
-               struct bt_field *context);
-struct bt_field *bt_event_get_event_context(
-               struct bt_event *event);
-int bt_event_set_event_context(struct bt_event *event,
-               struct bt_field *context);
-struct bt_field *bt_event_get_event_payload(
-               struct bt_event *event);
-int bt_event_set_event_payload(struct bt_event *event,
-               struct bt_field *payload);
-struct bt_clock_value *bt_event_get_clock_value(
-               struct bt_event *event,
-               struct bt_clock_class *clock_class);
-int bt_event_set_clock_value(
-               struct bt_event *event,
-               struct bt_clock_value *clock_value);
diff --git a/bindings/python/bt2/bt2/native_bteventclass.i b/bindings/python/bt2/bt2/native_bteventclass.i
deleted file mode 100644 (file)
index 23a3a69..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_event_class;
-
-/* Log levels */
-enum bt_event_class_log_level {
-       BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
-       BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
-       BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
-       BT_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
-       BT_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
-       BT_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
-       BT_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
-       BT_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
-       BT_EVENT_CLASS_LOG_LEVEL_INFO = 6,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
-       BT_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
-};
-
-/* Functions */
-struct bt_event_class *bt_event_class_create(const char *name);
-struct bt_stream_class *bt_event_class_get_stream_class(
-               struct bt_event_class *event_class);
-const char *bt_event_class_get_name(
-               struct bt_event_class *event_class);
-int64_t bt_event_class_get_id(
-               struct bt_event_class *event_class);
-int bt_event_class_set_id(
-               struct bt_event_class *event_class, uint64_t id);
-enum bt_event_class_log_level bt_event_class_get_log_level(
-               struct bt_event_class *event_class);
-int bt_event_class_set_log_level(
-               struct bt_event_class *event_class,
-               enum bt_event_class_log_level log_level);
-const char *bt_event_class_get_emf_uri(
-               struct bt_event_class *event_class);
-int bt_event_class_set_emf_uri(
-               struct bt_event_class *event_class,
-               const char *emf_uri);
-struct bt_field_type *bt_event_class_get_context_type(
-               struct bt_event_class *event_class);
-int bt_event_class_set_context_type(
-               struct bt_event_class *event_class,
-               struct bt_field_type *context_type);
-struct bt_field_type *bt_event_class_get_payload_type(
-               struct bt_event_class *event_class);
-int bt_event_class_set_payload_type(
-               struct bt_event_class *event_class,
-               struct bt_field_type *payload_type);
diff --git a/bindings/python/bt2/bt2/native_btfields.i b/bindings/python/bt2/bt2/native_btfields.i
deleted file mode 100644 (file)
index 051ae66..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_field;
-
-/* Common functions */
-struct bt_field *bt_field_create(
-               struct bt_field_type *type);
-struct bt_field_type *bt_field_get_type(
-               struct bt_field *field);
-struct bt_field *bt_field_copy(struct bt_field *field);
-bt_bool bt_field_is_set(struct bt_field *field);
-int bt_field_reset(struct bt_field *field);
-
-/* Integer field functions */
-int bt_field_signed_integer_get_value(struct bt_field *integer,
-               int64_t *OUTPUT);
-int bt_field_signed_integer_set_value(struct bt_field *integer,
-               int64_t value);
-int bt_field_unsigned_integer_get_value(struct bt_field *integer,
-               uint64_t *OUTPUT);
-int bt_field_unsigned_integer_set_value(struct bt_field *integer,
-               uint64_t value);
-
-/* Floating point number field functions */
-int bt_field_floating_point_get_value(
-               struct bt_field *floating_point, double *OUTPUT);
-int bt_field_floating_point_set_value(
-               struct bt_field *floating_point,
-               double value);
-
-/* Enumeration field functions */
-struct bt_field *bt_field_enumeration_get_container(
-               struct bt_field *enumeration);
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_enumeration_get_mappings(struct bt_field *enum_field);
-
-/* String field functions */
-const char *bt_field_string_get_value(
-               struct bt_field *string_field);
-int bt_field_string_set_value(struct bt_field *string_field,
-               const char *value);
-int bt_field_string_append(struct bt_field *string_field,
-               const char *value);
-int bt_field_string_append_len(
-               struct bt_field *string_field, const char *value,
-               unsigned int length);
-
-/* Structure field functions */
-struct bt_field *bt_field_structure_get_field_by_index(
-               struct bt_field *structure, int index);
-struct bt_field *bt_field_structure_get_field_by_name(
-               struct bt_field *struct_field, const char *name);
-int bt_field_structure_set_field_by_name(struct bt_field *struct_field,
-               const char *name, struct bt_field *field);
-
-/* Array field functions */
-struct bt_field *bt_field_array_get_field(
-               struct bt_field *array, uint64_t index);
-
-/* Sequence field functions */
-struct bt_field *bt_field_sequence_get_length(
-               struct bt_field *sequence);
-int bt_field_sequence_set_length(struct bt_field *sequence,
-               struct bt_field *length_field);
-struct bt_field *bt_field_sequence_get_field(
-               struct bt_field *sequence, uint64_t index);
-
-/* Variant field functions */
-struct bt_field *bt_field_variant_get_field(
-               struct bt_field *variant, struct bt_field *tag);
-struct bt_field *bt_field_variant_get_current_field(
-               struct bt_field *variant);
-struct bt_field *bt_field_variant_get_tag(
-               struct bt_field *variant);
diff --git a/bindings/python/bt2/bt2/native_btft.i b/bindings/python/bt2/bt2/native_btft.i
deleted file mode 100644 (file)
index 3b46e90..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_field_type;
-
-/* Common enumerations */
-enum bt_scope {
-       BT_SCOPE_UNKNOWN                = -1,
-       BT_SCOPE_TRACE_PACKET_HEADER    = 1,
-       BT_SCOPE_STREAM_PACKET_CONTEXT  = 2,
-       BT_SCOPE_STREAM_EVENT_HEADER    = 3,
-       BT_SCOPE_STREAM_EVENT_CONTEXT   = 4,
-       BT_SCOPE_EVENT_CONTEXT          = 5,
-       BT_SCOPE_EVENT_PAYLOAD          = 6,
-       BT_SCOPE_ENV                    = 0,
-       BT_SCOPE_EVENT_FIELDS           = 6,
-};
-
-enum bt_field_type_id {
-       BT_FIELD_TYPE_ID_UNKNOWN        = -1,
-       BT_FIELD_TYPE_ID_INTEGER        = 0,
-       BT_FIELD_TYPE_ID_FLOAT          = 1,
-       BT_FIELD_TYPE_ID_ENUM           = 2,
-       BT_FIELD_TYPE_ID_STRING         = 3,
-       BT_FIELD_TYPE_ID_STRUCT         = 4,
-       BT_FIELD_TYPE_ID_ARRAY          = 6,
-       BT_FIELD_TYPE_ID_SEQUENCE       = 7,
-       BT_FIELD_TYPE_ID_VARIANT        = 5,
-       BT_FIELD_TYPE_ID_NR             = 8,
-};
-
-enum bt_byte_order {
-       BT_BYTE_ORDER_UNKNOWN   = -1,
-       BT_BYTE_ORDER_NATIVE    = 0,
-       BT_BYTE_ORDER_UNSPECIFIED,
-       BT_BYTE_ORDER_LITTLE_ENDIAN,
-       BT_BYTE_ORDER_BIG_ENDIAN,
-       BT_BYTE_ORDER_NETWORK,
-};
-
-/**
-@brief String encoding of a @ft.
-*/
-enum bt_string_encoding {
-       BT_STRING_ENCODING_UNKNOWN      = -1,
-       BT_STRING_ENCODING_NONE,
-       BT_STRING_ENCODING_UTF8,
-       BT_STRING_ENCODING_ASCII,
-};
-
-/* Common functions */
-enum bt_field_type_id bt_field_type_get_type_id(
-               struct bt_field_type *field_type);
-int bt_field_type_get_alignment(
-               struct bt_field_type *field_type);
-int bt_field_type_set_alignment(struct bt_field_type *field_type,
-               unsigned int alignment);
-enum bt_byte_order bt_field_type_get_byte_order(
-               struct bt_field_type *field_type);
-int bt_field_type_set_byte_order(
-               struct bt_field_type *field_type,
-               enum bt_byte_order byte_order);
-int bt_field_type_compare(struct bt_field_type *field_type_a,
-               struct bt_field_type *field_type_b);
-struct bt_field_type *bt_field_type_copy(
-               struct bt_field_type *field_type);
-
-/* Integer field type base enumeration */
-enum bt_integer_base {
-       BT_INTEGER_BASE_UNKNOWN         = -1,
-       BT_INTEGER_BASE_UNSPECIFIED     = 0,
-       BT_INTEGER_BASE_BINARY          = 2,
-       BT_INTEGER_BASE_OCTAL           = 8,
-       BT_INTEGER_BASE_DECIMAL         = 10,
-       BT_INTEGER_BASE_HEXADECIMAL     = 16,
-};
-
-/* Integer field type functions */
-struct bt_field_type *bt_field_type_integer_create(
-               unsigned int size);
-int bt_field_type_integer_get_size(
-               struct bt_field_type *int_field_type);
-int bt_field_type_integer_set_size(
-               struct bt_field_type *int_field_type, unsigned int size);
-int bt_field_type_integer_is_signed(
-               struct bt_field_type *int_field_type);
-int bt_field_type_integer_set_is_signed(
-               struct bt_field_type *int_field_type, int is_signed);
-enum bt_integer_base bt_field_type_integer_get_base(
-               struct bt_field_type *int_field_type);
-int bt_field_type_integer_set_base(
-               struct bt_field_type *int_field_type,
-               enum bt_integer_base base);
-enum bt_string_encoding bt_field_type_integer_get_encoding(
-               struct bt_field_type *int_field_type);
-int bt_field_type_integer_set_encoding(
-               struct bt_field_type *int_field_type,
-               enum bt_string_encoding encoding);
-struct bt_clock_class *bt_field_type_integer_get_mapped_clock_class(
-               struct bt_field_type *int_field_type);
-int bt_field_type_integer_set_mapped_clock_class(
-               struct bt_field_type *int_field_type,
-               struct bt_clock_class *clock_class);
-
-/* Floating point number field type functions */
-struct bt_field_type *bt_field_type_floating_point_create(void);
-int bt_field_type_floating_point_get_exponent_digits(
-               struct bt_field_type *float_field_type);
-int bt_field_type_floating_point_set_exponent_digits(
-               struct bt_field_type *float_field_type,
-               unsigned int exponent_size);
-int bt_field_type_floating_point_get_mantissa_digits(
-               struct bt_field_type *float_field_type);
-int bt_field_type_floating_point_set_mantissa_digits(
-               struct bt_field_type *float_field_type,
-               unsigned int mantissa_sign_size);
-
-/* Enumeration field type functions */
-struct bt_field_type *bt_field_type_enumeration_create(
-               struct bt_field_type *int_field_type);
-struct bt_field_type *bt_field_type_enumeration_get_container_type(
-               struct bt_field_type *enum_field_type);
-int64_t bt_field_type_enumeration_get_mapping_count(
-               struct bt_field_type *enum_field_type);
-int bt_field_type_enumeration_get_mapping_signed(
-               struct bt_field_type *enum_field_type, int index,
-               const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT);
-int bt_field_type_enumeration_get_mapping_unsigned(
-               struct bt_field_type *enum_field_type, int index,
-               const char **BTOUTSTR, uint64_t *OUTPUT,
-               uint64_t *OUTPUT);
-int bt_field_type_enumeration_add_mapping_signed(
-               struct bt_field_type *enum_field_type, const char *name,
-               int64_t range_begin, int64_t range_end);
-int bt_field_type_enumeration_add_mapping_unsigned(
-               struct bt_field_type *enum_field_type, const char *name,
-               uint64_t range_begin, uint64_t range_end);
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_enumeration_find_mappings_by_name(
-               struct bt_field_type *enum_field_type,
-               const char *name);
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_enumeration_find_mappings_by_signed_value(
-               struct bt_field_type *enum_field_type,
-               int64_t value);
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_enumeration_find_mappings_by_unsigned_value(
-               struct bt_field_type *enum_field_type,
-               uint64_t value);
-
-/* Enumeration field type mapping iterator functions */
-int bt_field_type_enumeration_mapping_iterator_get_signed(
-               struct bt_field_type_enumeration_mapping_iterator *iter,
-               const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT);
-int bt_field_type_enumeration_mapping_iterator_get_unsigned(
-               struct bt_field_type_enumeration_mapping_iterator *iter,
-               const char **BTOUTSTR, uint64_t *OUTPUT, uint64_t *OUTPUT);
-int bt_field_type_enumeration_mapping_iterator_next(
-               struct bt_field_type_enumeration_mapping_iterator *iter);
-
-/* String field type functions */
-struct bt_field_type *bt_field_type_string_create(void);
-enum bt_string_encoding bt_field_type_string_get_encoding(
-               struct bt_field_type *string_field_type);
-int bt_field_type_string_set_encoding(
-               struct bt_field_type *string_field_type,
-               enum bt_string_encoding encoding);
-
-/* Structure field type functions */
-struct bt_field_type *bt_field_type_structure_create(void);
-int64_t bt_field_type_structure_get_field_count(
-               struct bt_field_type *struct_field_type);
-int bt_field_type_structure_get_field_by_index(
-               struct bt_field_type *struct_field_type,
-               const char **BTOUTSTR, struct bt_field_type **BTOUTFT,
-               uint64_t index);
-struct bt_field_type *bt_field_type_structure_get_field_type_by_name(
-               struct bt_field_type *struct_field_type,
-               const char *field_name);
-int bt_field_type_structure_add_field(
-               struct bt_field_type *struct_field_type,
-               struct bt_field_type *field_type,
-               const char *field_name);
-
-/* Array field type functions */
-struct bt_field_type *bt_field_type_array_create(
-               struct bt_field_type *element_field_type,
-               unsigned int length);
-struct bt_field_type *bt_field_type_array_get_element_type(
-               struct bt_field_type *array_field_type);
-int64_t bt_field_type_array_get_length(
-               struct bt_field_type *array_field_type);
-
-/* Sequence field type functions */
-struct bt_field_type *bt_field_type_sequence_create(
-               struct bt_field_type *element_field_type,
-               const char *length_name);
-struct bt_field_type *bt_field_type_sequence_get_element_type(
-               struct bt_field_type *sequence_field_type);
-const char *bt_field_type_sequence_get_length_field_name(
-               struct bt_field_type *sequence_field_type);
-struct bt_field_path *bt_field_type_sequence_get_length_field_path(
-               struct bt_field_type *sequence_field_type);
-
-/* Variant field type functions */
-struct bt_field_type *bt_field_type_variant_create(
-               struct bt_field_type *tag_field_type,
-               const char *tag_name);
-struct bt_field_type *bt_field_type_variant_get_tag_type(
-               struct bt_field_type *variant_field_type);
-const char *bt_field_type_variant_get_tag_name(
-               struct bt_field_type *variant_field_type);
-int bt_field_type_variant_set_tag_name(
-               struct bt_field_type *variant_field_type,
-               const char *tag_name);
-struct bt_field_path *bt_field_type_variant_get_tag_field_path(
-               struct bt_field_type *variant_field_type);
-int64_t bt_field_type_variant_get_field_count(
-               struct bt_field_type *variant_field_type);
-int bt_field_type_variant_get_field_by_index(
-               struct bt_field_type *variant_field_type,
-               const char **BTOUTSTR,
-               struct bt_field_type **BTOUTFT, uint64_t index);
-struct bt_field_type *bt_field_type_variant_get_field_type_by_name(
-               struct bt_field_type *variant_field_type,
-               const char *field_name);
-int bt_field_type_variant_add_field(
-               struct bt_field_type *variant_field_type,
-               struct bt_field_type *field_type,
-               const char *field_name);
diff --git a/bindings/python/bt2/bt2/native_btgraph.i b/bindings/python/bt2/bt2/native_btgraph.i
deleted file mode 100644 (file)
index 151c13d..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_graph;
-
-/* Status */
-enum bt_graph_status {
-       BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111,
-       BT_GRAPH_STATUS_CANCELED = 125,
-       BT_GRAPH_STATUS_AGAIN = 11,
-       BT_GRAPH_STATUS_END = 1,
-       BT_GRAPH_STATUS_OK = 0,
-       BT_GRAPH_STATUS_INVALID = -22,
-       BT_GRAPH_STATUS_NO_SINK = -6,
-       BT_GRAPH_STATUS_CANNOT_CONSUME = -2,
-       BT_GRAPH_STATUS_ERROR = -1,
-       BT_GRAPH_STATUS_NOMEM = -12,
-};
-
-/* Functions */
-struct bt_graph *bt_graph_create(void);
-enum bt_graph_status bt_graph_add_component(
-               struct bt_graph *graph,
-               struct bt_component_class *component_class,
-               const char *name, struct bt_value *params,
-               struct bt_component **BTOUTCOMP);
-enum bt_graph_status bt_graph_add_component_with_init_method_data(
-               struct bt_graph *graph,
-               struct bt_component_class *component_class,
-               const char *name, struct bt_value *params,
-               void *init_method_data,
-               struct bt_component **BTOUTCOMP);
-enum bt_graph_status bt_graph_connect_ports(struct bt_graph *graph,
-               struct bt_port *upstream, struct bt_port *downstream,
-               struct bt_connection **BTOUTCONN);
-enum bt_graph_status bt_graph_run(struct bt_graph *graph);
-enum bt_graph_status bt_graph_consume(struct bt_graph *graph);
-enum bt_graph_status bt_graph_cancel(struct bt_graph *graph);
-int bt_graph_is_canceled(struct bt_graph *graph);
-
-/* Helper functions for Python */
-%{
-static void port_added_listener(struct bt_port *port, void *py_callable)
-{
-       PyObject *py_port_ptr = NULL;
-       PyObject *py_res = NULL;
-
-       py_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(port),
-               SWIGTYPE_p_bt_port, 0);
-       if (!py_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_res = PyObject_CallFunction(py_callable, "(O)", py_port_ptr);
-       BT_ASSERT(py_res == Py_None);
-       Py_DECREF(py_port_ptr);
-       Py_DECREF(py_res);
-}
-
-static void port_removed_listener(struct bt_component *component,
-               struct bt_port *port, void *py_callable)
-{
-       PyObject *py_port_ptr = NULL;
-       PyObject *py_res = NULL;
-
-       py_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(port),
-               SWIGTYPE_p_bt_port, 0);
-       if (!py_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_res = PyObject_CallFunction(py_callable, "(O)", py_port_ptr);
-       BT_ASSERT(py_res == Py_None);
-       Py_DECREF(py_port_ptr);
-       Py_DECREF(py_res);
-}
-
-static void ports_connected_listener(struct bt_port *upstream_port,
-               struct bt_port *downstream_port, void *py_callable)
-{
-       PyObject *py_upstream_port_ptr = NULL;
-       PyObject *py_downstream_port_ptr = NULL;
-       PyObject *py_res = NULL;
-
-       py_upstream_port_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(upstream_port), SWIGTYPE_p_bt_port, 0);
-       if (!py_upstream_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_downstream_port_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(downstream_port), SWIGTYPE_p_bt_port, 0);
-       if (!py_downstream_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_res = PyObject_CallFunction(py_callable, "(OO)",
-               py_upstream_port_ptr, py_downstream_port_ptr);
-       BT_ASSERT(py_res == Py_None);
-       Py_DECREF(py_upstream_port_ptr);
-       Py_DECREF(py_downstream_port_ptr);
-       Py_DECREF(py_res);
-}
-
-static void ports_disconnected_listener(
-               struct bt_component *upstream_component,
-               struct bt_component *downstream_component,
-               struct bt_port *upstream_port, struct bt_port *downstream_port,
-               void *py_callable)
-{
-       PyObject *py_upstream_comp_ptr = NULL;
-       PyObject *py_downstream_comp_ptr = NULL;
-       PyObject *py_upstream_port_ptr = NULL;
-       PyObject *py_downstream_port_ptr = NULL;
-       PyObject *py_res = NULL;
-
-       py_upstream_comp_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(upstream_component),
-               SWIGTYPE_p_bt_component, 0);
-       if (!py_upstream_comp_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_downstream_comp_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(downstream_component),
-               SWIGTYPE_p_bt_component, 0);
-       if (!py_downstream_comp_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_upstream_port_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(upstream_port), SWIGTYPE_p_bt_port, 0);
-       if (!py_upstream_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_downstream_port_ptr = SWIG_NewPointerObj(
-               SWIG_as_voidptr(downstream_port), SWIGTYPE_p_bt_port, 0);
-       if (!py_downstream_port_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_res = PyObject_CallFunction(py_callable, "(OOOO)",
-               py_upstream_comp_ptr, py_downstream_comp_ptr,
-               py_upstream_port_ptr, py_downstream_port_ptr);
-       BT_ASSERT(py_res == Py_None);
-       Py_DECREF(py_upstream_comp_ptr);
-       Py_DECREF(py_downstream_comp_ptr);
-       Py_DECREF(py_upstream_port_ptr);
-       Py_DECREF(py_downstream_port_ptr);
-       Py_DECREF(py_res);
-}
-
-static void graph_listener_removed(void *py_callable)
-{
-       BT_ASSERT(py_callable);
-       Py_DECREF(py_callable);
-}
-
-static int bt_py3_graph_add_port_added_listener(struct bt_graph *graph,
-               PyObject *py_callable)
-{
-       int ret = 0;
-
-       BT_ASSERT(graph);
-       BT_ASSERT(py_callable);
-       ret = bt_graph_add_port_added_listener(graph, port_added_listener,
-               graph_listener_removed, py_callable);
-       if (ret >= 0) {
-               Py_INCREF(py_callable);
-       }
-
-       return ret;
-}
-
-static int bt_py3_graph_add_port_removed_listener(struct bt_graph *graph,
-               PyObject *py_callable)
-{
-       int ret = 0;
-
-       BT_ASSERT(graph);
-       BT_ASSERT(py_callable);
-       ret = bt_graph_add_port_removed_listener(graph, port_removed_listener,
-               graph_listener_removed, py_callable);
-       if (ret >= 0) {
-               Py_INCREF(py_callable);
-       }
-
-       return ret;
-}
-
-static int bt_py3_graph_add_ports_connected_listener(struct bt_graph *graph,
-               PyObject *py_callable)
-{
-       int ret = 0;
-
-       BT_ASSERT(graph);
-       BT_ASSERT(py_callable);
-       ret = bt_graph_add_ports_connected_listener(graph,
-               ports_connected_listener, graph_listener_removed, py_callable);
-       if (ret >= 0) {
-               Py_INCREF(py_callable);
-       }
-
-       return ret;
-}
-
-static int bt_py3_graph_add_ports_disconnected_listener(struct bt_graph *graph,
-               PyObject *py_callable)
-{
-       int ret = 0;
-
-       BT_ASSERT(graph);
-       BT_ASSERT(py_callable);
-       ret = bt_graph_add_ports_disconnected_listener(graph,
-               ports_disconnected_listener, graph_listener_removed,
-               py_callable);
-       if (ret >= 0) {
-               Py_INCREF(py_callable);
-       }
-
-       return ret;
-}
-%}
-
-int bt_py3_graph_add_port_added_listener(struct bt_graph *graph,
-               PyObject *py_callable);
-int bt_py3_graph_add_port_removed_listener(struct bt_graph *graph,
-               PyObject *py_callable);
-int bt_py3_graph_add_ports_connected_listener(struct bt_graph *graph,
-               PyObject *py_callable);
-int bt_py3_graph_add_ports_disconnected_listener(struct bt_graph *graph,
-               PyObject *py_callable);
diff --git a/bindings/python/bt2/bt2/native_btlogging.i b/bindings/python/bt2/bt2/native_btlogging.i
deleted file mode 100644 (file)
index 0406a2a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-%{
-#include <babeltrace/logging.h>
-%}
-
-/* Log levels */
-enum bt_logging_level {
-       BT_LOGGING_LEVEL_VERBOSE = 1,
-       BT_LOGGING_LEVEL_DEBUG = 2,
-       BT_LOGGING_LEVEL_INFO = 3,
-       BT_LOGGING_LEVEL_WARN = 4,
-       BT_LOGGING_LEVEL_ERROR = 5,
-       BT_LOGGING_LEVEL_FATAL = 6,
-       BT_LOGGING_LEVEL_NONE = 0xff,
-};
-
-/* Logging functions */
-enum bt_logging_level bt_logging_get_minimal_level(void);
-enum bt_logging_level bt_logging_get_global_level(void);
-void bt_logging_set_global_level(enum bt_logging_level log_level);
diff --git a/bindings/python/bt2/bt2/native_btnotification.i b/bindings/python/bt2/bt2/native_btnotification.i
deleted file mode 100644 (file)
index 5b4843e..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_notification;
-
-/* Notification type */
-enum bt_notification_type {
-       BT_NOTIFICATION_TYPE_SENTINEL = -1000,
-       BT_NOTIFICATION_TYPE_UNKNOWN = -1,
-       BT_NOTIFICATION_TYPE_ALL = -2,
-       BT_NOTIFICATION_TYPE_EVENT = 0,
-       BT_NOTIFICATION_TYPE_INACTIVITY = 1,
-       BT_NOTIFICATION_TYPE_STREAM_BEGIN = 2,
-       BT_NOTIFICATION_TYPE_STREAM_END = 3,
-       BT_NOTIFICATION_TYPE_PACKET_BEGIN = 4,
-       BT_NOTIFICATION_TYPE_PACKET_END = 5,
-       BT_NOTIFICATION_TYPE_DISCARDED_EVENTS = 6,
-       BT_NOTIFICATION_TYPE_DISCARDED_PACKETS = 7,
-};
-
-/* General functions */
-enum bt_notification_type bt_notification_get_type(
-               struct bt_notification *notification);
-
-/* Event notification functions */
-struct bt_notification *bt_notification_event_create(
-               struct bt_event *event,
-               struct bt_clock_class_priority_map *clock_class_priority_map);
-struct bt_event *bt_notification_event_get_event(
-               struct bt_notification *notification);
-struct bt_clock_class_priority_map *
-bt_notification_event_get_clock_class_priority_map(
-               struct bt_notification *notification);
-
-/* Inactivity notification functions */
-struct bt_notification *bt_notification_inactivity_create(
-               struct bt_clock_class_priority_map *clock_class_priority_map);
-struct bt_clock_class_priority_map *
-bt_notification_inactivity_get_clock_class_priority_map(
-               struct bt_notification *notification);
-struct bt_clock_value *bt_notification_inactivity_get_clock_value(
-               struct bt_notification *notification,
-               struct bt_clock_class *clock_class);
-int bt_notification_inactivity_set_clock_value(
-               struct bt_notification *notification,
-               struct bt_clock_value *clock_value);
-
-/* Packet notification functions */
-struct bt_notification *bt_notification_packet_begin_create(
-               struct bt_packet *packet);
-struct bt_notification *bt_notification_packet_end_create(
-               struct bt_packet *packet);
-struct bt_packet *bt_notification_packet_begin_get_packet(
-               struct bt_notification *notification);
-struct bt_packet *bt_notification_packet_end_get_packet(
-               struct bt_notification *notification);
-
-/* Stream notification functions */
-struct bt_notification *bt_notification_stream_begin_create(
-               struct bt_stream *stream);
-struct bt_notification *bt_notification_stream_end_create(
-               struct bt_stream *stream);
-struct bt_stream *bt_notification_stream_begin_get_stream(
-               struct bt_notification *notification);
-struct bt_stream *bt_notification_stream_end_get_stream(
-               struct bt_notification *notification);
-
-/* Discarded packets notification functions */
-struct bt_clock_value *
-bt_notification_discarded_packets_get_begin_clock_value(
-               struct bt_notification *notification);
-struct bt_clock_value *
-bt_notification_discarded_packets_get_end_clock_value(
-               struct bt_notification *notification);
-int64_t bt_notification_discarded_packets_get_count(
-               struct bt_notification *notification);
-struct bt_stream *bt_notification_discarded_packets_get_stream(
-               struct bt_notification *notification);
-
-/* Discarded events notification functions */
-struct bt_clock_value *
-bt_notification_discarded_events_get_begin_clock_value(
-               struct bt_notification *notification);
-struct bt_clock_value *
-bt_notification_discarded_events_get_end_clock_value(
-               struct bt_notification *notification);
-int64_t bt_notification_discarded_events_get_count(
-               struct bt_notification *notification);
-struct bt_stream *bt_notification_discarded_events_get_stream(
-               struct bt_notification *notification);
diff --git a/bindings/python/bt2/bt2/native_btnotifiter.i b/bindings/python/bt2/bt2/native_btnotifiter.i
deleted file mode 100644 (file)
index 320e2e9..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_notification_iterator;
-
-/* Status */
-enum bt_notification_iterator_status {
-       BT_NOTIFICATION_ITERATOR_STATUS_CANCELED = 125,
-       BT_NOTIFICATION_ITERATOR_STATUS_AGAIN = 11,
-       BT_NOTIFICATION_ITERATOR_STATUS_END = 1,
-       BT_NOTIFICATION_ITERATOR_STATUS_OK = 0,
-       BT_NOTIFICATION_ITERATOR_STATUS_INVALID = -22,
-       BT_NOTIFICATION_ITERATOR_STATUS_ERROR = -1,
-       BT_NOTIFICATION_ITERATOR_STATUS_NOMEM = -12,
-       BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED = -2,
-};
-
-/* Functions (base) */
-struct bt_notification *bt_notification_iterator_get_notification(
-               struct bt_notification_iterator *iterator);
-enum bt_notification_iterator_status bt_notification_iterator_next(
-               struct bt_notification_iterator *iterator);
-
-/* Functions (private connection) */
-struct bt_component *bt_private_connection_notification_iterator_get_component(
-               struct bt_notification_iterator *iterator);
-
-/* Functions (output port) */
-struct bt_notification_iterator *bt_output_port_notification_iterator_create(
-               struct bt_port *port, const char *colander_component_name,
-               const enum bt_notification_type *notification_types);
-
-/* Helper functions for Python */
-%{
-static PyObject *bt_py3_get_user_component_from_user_notif_iter(
-               struct bt_private_connection_private_notification_iterator *priv_notif_iter)
-{
-       struct bt_private_component *priv_comp =
-               bt_private_connection_private_notification_iterator_get_private_component(
-                       priv_notif_iter);
-       PyObject *py_comp;
-
-       BT_ASSERT(priv_comp);
-       py_comp = bt_private_component_get_user_data(priv_comp);
-       bt_put(priv_comp);
-       BT_ASSERT(py_comp);
-
-       /* Return new reference */
-       Py_INCREF(py_comp);
-       return py_comp;
-}
-%}
-
-PyObject *bt_py3_get_user_component_from_user_notif_iter(
-               struct bt_private_connection_private_notification_iterator *priv_notif_iter);
diff --git a/bindings/python/bt2/bt2/native_btpacket.i b/bindings/python/bt2/bt2/native_btpacket.i
deleted file mode 100644 (file)
index 4e677ec..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_packet;
-
-/* Functions */
-struct bt_packet *bt_packet_create(
-               struct bt_stream *stream);
-struct bt_stream *bt_packet_get_stream(
-               struct bt_packet *packet);
-struct bt_field *bt_packet_get_header(
-               struct bt_packet *packet);
-int bt_packet_set_header(
-               struct bt_packet *packet, struct bt_field *header);
-struct bt_field *bt_packet_get_context(
-               struct bt_packet *packet);
-int bt_packet_set_context(
-               struct bt_packet *packet, struct bt_field *context);
diff --git a/bindings/python/bt2/bt2/native_btplugin.i b/bindings/python/bt2/bt2/native_btplugin.i
deleted file mode 100644 (file)
index 5df3fcf..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_plugin;
-struct bt_plugin_set;
-
-/* Status */
-enum bt_plugin_status {
-       BT_PLUGIN_STATUS_OK = 0,
-       BT_PLUGIN_STATUS_ERROR = -1,
-       BT_PLUGIN_STATUS_NOMEM = -4,
-};
-
-/* Plugin functions */
-struct bt_plugin *bt_plugin_find(const char *plugin_name);
-struct bt_component_class *bt_plugin_find_component_class(
-               const char *plugin_name, const char *component_class_name,
-               enum bt_component_class_type component_class_type);
-struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path);
-struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path,
-               int recurse);
-struct bt_plugin_set *bt_plugin_create_all_from_static(void);
-const char *bt_plugin_get_name(struct bt_plugin *plugin);
-const char *bt_plugin_get_author(struct bt_plugin *plugin);
-const char *bt_plugin_get_license(struct bt_plugin *plugin);
-const char *bt_plugin_get_description(struct bt_plugin *plugin);
-const char *bt_plugin_get_path(struct bt_plugin *plugin);
-enum bt_plugin_status bt_plugin_get_version(struct bt_plugin *plugin,
-               unsigned int *OUTPUTINIT, unsigned int *OUTPUTINIT,
-               unsigned int *OUTPUTINIT, const char **BTOUTSTR);
-int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin);
-struct bt_component_class *bt_plugin_get_component_class_by_index(
-               struct bt_plugin *plugin, uint64_t index);
-struct bt_component_class *bt_plugin_get_component_class_by_name_and_type(
-               struct bt_plugin *plugin, const char *name,
-               enum bt_component_class_type type);
-
-/* Plugin set functions */
-int64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set);
-struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set,
-               uint64_t index);
diff --git a/bindings/python/bt2/bt2/native_btport.i b/bindings/python/bt2/bt2/native_btport.i
deleted file mode 100644 (file)
index fef7826..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_port;
-struct bt_private_port;
-
-/* Status */
-enum bt_port_status {
-       BT_PORT_STATUS_OK = 0,
-       BT_PORT_STATUS_ERROR = -1,
-       BT_PORT_STATUS_INVALID = -2,
-};
-
-/* Port type */
-enum bt_port_type {
-       BT_PORT_TYPE_INPUT = 0,
-       BT_PORT_TYPE_OUTPUT = 1,
-       BT_PORT_TYPE_UNKOWN = -1,
-};
-
-/* Functions (public) */
-const char *bt_port_get_name(struct bt_port *port);
-enum bt_port_type bt_port_get_type(struct bt_port *port);
-struct bt_connection *bt_port_get_connection(struct bt_port *port);
-struct bt_component *bt_port_get_component(struct bt_port *port);
-enum bt_port_status bt_port_disconnect(struct bt_port *port);
-int bt_port_is_connected(struct bt_port *port);
-
-/* Functions (private) */
-struct bt_port *bt_port_from_private(struct bt_private_port *private_port);
-struct bt_private_connection *bt_private_port_get_private_connection(
-               struct bt_private_port *private_port);
-struct bt_private_component *bt_private_port_get_private_component(
-               struct bt_private_port *private_port);
-enum bt_port_status bt_private_port_remove_from_component(
-               struct bt_private_port *private_port);
-void *bt_private_port_get_user_data(
-               struct bt_private_port *private_port);
-
-%{
-static struct bt_notification_iterator *bt_py3_create_output_port_notif_iter(
-               unsigned long long port_addr, const char *colander_name,
-               PyObject *py_notif_types)
-{
-       struct bt_notification_iterator *notif_iter;
-       struct bt_port *output_port;
-       enum bt_notification_type *notification_types;
-
-       output_port = (void *) port_addr;
-       BT_ASSERT(!PyErr_Occurred());
-       BT_ASSERT(output_port);
-
-       notification_types = bt_py3_notif_types_from_py_list(py_notif_types);
-       notif_iter = bt_output_port_notification_iterator_create(output_port,
-               colander_name, notification_types);
-       g_free(notification_types);
-       return notif_iter;
-}
-%}
-
-struct bt_notification_iterator *bt_py3_create_output_port_notif_iter(
-               unsigned long long port_addr, const char *colander_name,
-               PyObject *py_notif_types);
diff --git a/bindings/python/bt2/bt2/native_btqueryexec.i b/bindings/python/bt2/bt2/native_btqueryexec.i
deleted file mode 100644 (file)
index b6af2a6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Types */
-struct bt_query_executor;
-
-/* Query status */
-enum bt_query_status {
-       BT_QUERY_STATUS_OK = 0,
-       BT_QUERY_STATUS_AGAIN = 11,
-       BT_QUERY_STATUS_EXECUTOR_CANCELED = 125,
-       BT_QUERY_STATUS_ERROR = -1,
-       BT_QUERY_STATUS_INVALID = -22,
-       BT_QUERY_STATUS_INVALID_OBJECT = -23,
-       BT_QUERY_STATUS_INVALID_PARAMS = -24,
-       BT_QUERY_STATUS_NOMEM = -12,
-};
-
-/* Functions */
-struct bt_query_executor *bt_query_executor_create(void);
-enum bt_query_status bt_query_executor_query(
-               struct bt_query_executor *query_executor,
-               struct bt_component_class *component_class,
-               const char *object, struct bt_value *params,
-               struct bt_value **BTOUTVALUE);
-enum bt_query_status bt_query_executor_cancel(
-               struct bt_query_executor *query_executor);
-int bt_query_executor_is_canceled(struct bt_query_executor *query_executor);
diff --git a/bindings/python/bt2/bt2/native_btref.i b/bindings/python/bt2/bt2/native_btref.i
deleted file mode 100644 (file)
index dacf916..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Functions */
-void *bt_get(void *obj);
-void bt_put(void *obj);
diff --git a/bindings/python/bt2/bt2/native_btstream.i b/bindings/python/bt2/bt2/native_btstream.i
deleted file mode 100644 (file)
index 255834c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_stream;
-
-/* Functions */
-struct bt_stream *bt_stream_create(
-               struct bt_stream_class *stream_class,
-               const char *name);
-struct bt_stream *bt_stream_create_with_id(
-               struct bt_stream_class *stream_class,
-               const char *name, uint64_t id);
-const char *bt_stream_get_name(struct bt_stream *stream);
-int64_t bt_stream_get_id(struct bt_stream *stream);
-struct bt_stream_class *bt_stream_get_class(
-               struct bt_stream *stream);
diff --git a/bindings/python/bt2/bt2/native_btstreamclass.i b/bindings/python/bt2/bt2/native_btstreamclass.i
deleted file mode 100644 (file)
index 733563c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_stream_class;
-
-/* Functions */
-struct bt_stream_class *bt_stream_class_create_empty(
-               const char *name);
-struct bt_stream_class *bt_stream_class_create(const char *name);
-struct bt_trace *bt_stream_class_get_trace(
-               struct bt_stream_class *stream_class);
-const char *bt_stream_class_get_name(
-               struct bt_stream_class *stream_class);
-int bt_stream_class_set_name(
-               struct bt_stream_class *stream_class, const char *name);
-int64_t bt_stream_class_get_id(
-               struct bt_stream_class *stream_class);
-int bt_stream_class_set_id(
-               struct bt_stream_class *stream_class, uint64_t id);
-struct bt_field_type *bt_stream_class_get_packet_context_type(
-               struct bt_stream_class *stream_class);
-int bt_stream_class_set_packet_context_type(
-               struct bt_stream_class *stream_class,
-               struct bt_field_type *packet_context_type);
-struct bt_field_type *
-bt_stream_class_get_event_header_type(
-               struct bt_stream_class *stream_class);
-int bt_stream_class_set_event_header_type(
-               struct bt_stream_class *stream_class,
-               struct bt_field_type *event_header_type);
-struct bt_field_type *
-bt_stream_class_get_event_context_type(
-               struct bt_stream_class *stream_class);
-int bt_stream_class_set_event_context_type(
-               struct bt_stream_class *stream_class,
-               struct bt_field_type *event_context_type);
-int64_t bt_stream_class_get_event_class_count(
-               struct bt_stream_class *stream_class);
-struct bt_event_class *bt_stream_class_get_event_class_by_index(
-               struct bt_stream_class *stream_class, uint64_t index);
-struct bt_event_class *bt_stream_class_get_event_class_by_id(
-               struct bt_stream_class *stream_class, uint64_t id);
-int bt_stream_class_add_event_class(
-               struct bt_stream_class *stream_class,
-               struct bt_event_class *event_class);
diff --git a/bindings/python/bt2/bt2/native_bttrace.i b/bindings/python/bt2/bt2/native_bttrace.i
deleted file mode 100644 (file)
index 2e2c123..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Type */
-struct bt_trace;
-
-/* Functions */
-struct bt_trace *bt_trace_create(void);
-const char *bt_trace_get_name(struct bt_trace *trace_class);
-int bt_trace_set_name(struct bt_trace *trace_class,
-               const char *name);
-enum bt_byte_order bt_trace_get_native_byte_order(
-               struct bt_trace *trace_class);
-int bt_trace_set_native_byte_order(struct bt_trace *trace_class,
-               enum bt_byte_order native_byte_order);
-BTUUID bt_trace_get_uuid(
-               struct bt_trace *trace_class);
-int bt_trace_set_uuid(struct bt_trace *trace_class,
-               BTUUID uuid);
-int64_t bt_trace_get_environment_field_count(
-               struct bt_trace *trace_class);
-const char *
-bt_trace_get_environment_field_name_by_index(
-               struct bt_trace *trace_class, uint64_t index);
-struct bt_value *
-bt_trace_get_environment_field_value_by_index(struct bt_trace *trace_class,
-               uint64_t index);
-struct bt_value *
-bt_trace_get_environment_field_value_by_name(
-               struct bt_trace *trace_class, const char *name);
-int bt_trace_set_environment_field(
-               struct bt_trace *trace_class, const char *name,
-               struct bt_value *value);
-struct bt_field_type *bt_trace_get_packet_header_type(
-               struct bt_trace *trace_class);
-int bt_trace_set_packet_header_type(struct bt_trace *trace_class,
-               struct bt_field_type *packet_header_type);
-int64_t bt_trace_get_clock_class_count(
-               struct bt_trace *trace_class);
-struct bt_clock_class *bt_trace_get_clock_class_by_index(
-               struct bt_trace *trace_class, uint64_t index);
-struct bt_clock_class *bt_trace_get_clock_class_by_name(
-               struct bt_trace *trace_class, const char *name);
-int bt_trace_add_clock_class(struct bt_trace *trace_class,
-               struct bt_clock_class *clock_class);
-int64_t bt_trace_get_stream_class_count(
-               struct bt_trace *trace_class);
-struct bt_stream_class *bt_trace_get_stream_class_by_index(
-               struct bt_trace *trace_class, uint64_t index);
-struct bt_stream_class *bt_trace_get_stream_class_by_id(
-               struct bt_trace *trace_class, uint64_t id);
-int bt_trace_add_stream_class(struct bt_trace *trace_class,
-               struct bt_stream_class *stream_class);
-int64_t bt_trace_get_stream_count(struct bt_trace *trace_class);
-struct bt_stream *bt_trace_get_stream_by_index(
-               struct bt_trace *trace_class, uint64_t index);
-int bt_trace_is_static(struct bt_trace *trace_class);
-int bt_trace_set_is_static(struct bt_trace *trace_class);
-
-/* Helper functions for Python */
-%{
-void trace_is_static_listener(struct bt_trace *trace, void *py_callable)
-{
-       PyObject *py_trace_ptr = NULL;
-       PyObject *py_res = NULL;
-
-       py_trace_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(trace),
-               SWIGTYPE_p_bt_trace, 0);
-       if (!py_trace_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_ptr);
-       BT_ASSERT(py_res == Py_None);
-       Py_DECREF(py_trace_ptr);
-       Py_DECREF(py_res);
-}
-
-void trace_listener_removed(struct bt_trace *trace, void *py_callable)
-{
-       BT_ASSERT(py_callable);
-       Py_DECREF(py_callable);
-}
-
-static int bt_py3_trace_add_is_static_listener(unsigned long long trace_addr,
-               PyObject *py_callable)
-{
-       struct bt_trace *trace = (void *) trace_addr;
-       int ret = 0;
-
-       BT_ASSERT(trace);
-       BT_ASSERT(py_callable);
-       ret = bt_trace_add_is_static_listener(trace,
-               trace_is_static_listener, trace_listener_removed, py_callable);
-       if (ret >= 0) {
-               Py_INCREF(py_callable);
-       }
-
-       return ret;
-}
-%}
-
-int bt_py3_trace_add_is_static_listener(unsigned long long trace_addr,
-               PyObject *py_callable);
diff --git a/bindings/python/bt2/bt2/native_btvalues.i b/bindings/python/bt2/bt2/native_btvalues.i
deleted file mode 100644 (file)
index 6563bce..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Remove prefix from `bt_value_null` */
-%rename(value_null) bt_value_null;
-
-/* Type and status */
-struct bt_value;
-
-enum bt_value_type {
-       BT_VALUE_TYPE_UNKNOWN =         -1,
-       BT_VALUE_TYPE_NULL =            0,
-       BT_VALUE_TYPE_BOOL =            1,
-       BT_VALUE_TYPE_INTEGER =         2,
-       BT_VALUE_TYPE_FLOAT =           3,
-       BT_VALUE_TYPE_STRING =          4,
-       BT_VALUE_TYPE_ARRAY =           5,
-       BT_VALUE_TYPE_MAP =             6,
-};
-
-enum bt_value_type bt_value_get_type(const struct bt_value *object);
-
-enum bt_value_status {
-       BT_VALUE_STATUS_FROZEN =        -4,
-       BT_VALUE_STATUS_CANCELLED =     -3,
-       BT_VALUE_STATUS_INVAL =         -22,
-       BT_VALUE_STATUS_ERROR =         -1,
-       BT_VALUE_STATUS_OK =            0,
-};
-
-/* Null value object singleton */
-struct bt_value * const bt_value_null;
-
-/* Common functions */
-enum bt_value_status bt_value_freeze(struct bt_value *object);
-int bt_value_is_frozen(const struct bt_value *object);
-struct bt_value *bt_value_copy(const struct bt_value *object);
-int bt_value_compare(const struct bt_value *object_a,
-               const struct bt_value *object_b);
-
-/* Boolean value object functions */
-struct bt_value *bt_value_bool_create(void);
-struct bt_value *bt_value_bool_create_init(int val);
-enum bt_value_status bt_value_bool_get(
-               const struct bt_value *bool_obj, int *OUTPUT);
-enum bt_value_status bt_value_bool_set(struct bt_value *bool_obj,
-               int val);
-
-/* Integer value object functions */
-struct bt_value *bt_value_integer_create(void);
-struct bt_value *bt_value_integer_create_init(int64_t val);
-enum bt_value_status bt_value_integer_get(
-               const struct bt_value *integer_obj, int64_t *OUTPUT);
-enum bt_value_status bt_value_integer_set(
-               struct bt_value *integer_obj, int64_t val);
-
-/* Floating point number value object functions */
-struct bt_value *bt_value_float_create(void);
-struct bt_value *bt_value_float_create_init(double val);
-enum bt_value_status bt_value_float_get(
-               const struct bt_value *float_obj, double *OUTPUT);
-enum bt_value_status bt_value_float_set(
-               struct bt_value *float_obj, double val);
-
-/* String value object functions */
-struct bt_value *bt_value_string_create(void);
-struct bt_value *bt_value_string_create_init(const char *val);
-enum bt_value_status bt_value_string_set(struct bt_value *string_obj,
-               const char *val);
-enum bt_value_status bt_value_string_get(
-               const struct bt_value *string_obj, const char **BTOUTSTR);
-
-/* Array value object functions */
-struct bt_value *bt_value_array_create(void);
-int bt_value_array_size(const struct bt_value *array_obj);
-struct bt_value *bt_value_array_get(const struct bt_value *array_obj,
-               size_t index);
-enum bt_value_status bt_value_array_append(struct bt_value *array_obj,
-               struct bt_value *element_obj);
-enum bt_value_status bt_value_array_set(struct bt_value *array_obj,
-               size_t index, struct bt_value *element_obj);
-
-/* Map value object functions */
-struct bt_value *bt_value_map_create(void);
-int bt_value_map_size(const struct bt_value *map_obj);
-struct bt_value *bt_value_map_get(const struct bt_value *map_obj,
-               const char *key);
-int bt_value_map_has_key(const struct bt_value *map_obj,
-               const char *key);
-enum bt_value_status bt_value_map_insert(
-               struct bt_value *map_obj, const char *key,
-               struct bt_value *element_obj);
-struct bt_value *bt_value_map_extend(struct bt_value *base_map_obj,
-               struct bt_value *extension_map_obj);
-
-%{
-struct bt_value_map_get_keys_private_data {
-       struct bt_value *keys;
-};
-
-static int bt_value_map_get_keys_private_cb(const char *key,
-               struct bt_value *object, void *data)
-{
-       enum bt_value_status status;
-       struct bt_value_map_get_keys_private_data *priv_data = data;
-
-       status = bt_value_array_append_string(priv_data->keys, key);
-       if (status != BT_VALUE_STATUS_OK) {
-               return BT_FALSE;
-       }
-
-       return BT_TRUE;
-}
-
-static struct bt_value *bt_value_map_get_keys_private(
-               const struct bt_value *map_obj)
-{
-       enum bt_value_status status;
-       struct bt_value_map_get_keys_private_data data;
-
-       data.keys = bt_value_array_create();
-       if (!data.keys) {
-               return NULL;
-       }
-
-       status = bt_value_map_foreach(map_obj, bt_value_map_get_keys_private_cb,
-               &data);
-       if (status != BT_VALUE_STATUS_OK) {
-               goto error;
-       }
-
-       goto end;
-
-error:
-       if (data.keys) {
-               BT_PUT(data.keys);
-       }
-
-end:
-       return data.keys;
-}
-%}
-
-struct bt_value *bt_value_map_get_keys_private(const struct bt_value *map_obj);
diff --git a/bindings/python/bt2/bt2/native_btversion.i b/bindings/python/bt2/bt2/native_btversion.i
deleted file mode 100644 (file)
index 3d99e7d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* Version functions */
-int bt_version_get_major(void);
-int bt_version_get_minor(void);
-int bt_version_get_patch(void);
-const char *bt_version_get_extra(void);
This page took 0.153115 seconds and 4 git commands to generate.