+ typedef enum bt_self_component_status (*method_t)(
+ void *, void *, const void *);
+
+ enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ method_t method = NULL;
+
+ BT_ASSERT(comp);
+ BT_ASSERT(self_port);
+ BT_ASSERT(other_port);
+
+ switch (comp->class->type) {
+ case BT_COMPONENT_CLASS_TYPE_SOURCE:
+ {
+ struct bt_component_class_source *src_cc = (void *) comp->class;
+
+ switch (self_port->type) {
+ case BT_PORT_TYPE_OUTPUT:
+ method = (method_t) src_cc->methods.output_port_connected;
+ break;
+ default:
+ abort();
+ }
+
+ break;
+ }
+ case BT_COMPONENT_CLASS_TYPE_FILTER:
+ {
+ struct bt_component_class_filter *flt_cc = (void *) comp->class;
+
+ switch (self_port->type) {
+ case BT_PORT_TYPE_INPUT:
+ method = (method_t) flt_cc->methods.input_port_connected;
+ break;
+ case BT_PORT_TYPE_OUTPUT:
+ method = (method_t) flt_cc->methods.output_port_connected;
+ break;
+ default:
+ abort();
+ }
+
+ break;
+ }
+ case BT_COMPONENT_CLASS_TYPE_SINK:
+ {
+ struct bt_component_class_sink *sink_cc = (void *) comp->class;
+
+ switch (self_port->type) {
+ case BT_PORT_TYPE_INPUT:
+ method = (method_t) sink_cc->methods.input_port_connected;
+ break;
+ default:
+ abort();
+ }