X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fgraph%2Fconnection-internal.h;h=13e7d9ee65ad95aa0460819131a9e0dfb3b83347;hb=73d5c1adb1411e16c9c613c38a4c74a29ee608ae;hp=2a85296831089a06e3f46bc1d4326b5efbca7abd;hpb=bd7cc15bddddb727ea02fb44bde2d9f15cd82847;p=babeltrace.git diff --git a/include/babeltrace/graph/connection-internal.h b/include/babeltrace/graph/connection-internal.h index 2a852968..13e7d9ee 100644 --- a/include/babeltrace/graph/connection-internal.h +++ b/include/babeltrace/graph/connection-internal.h @@ -28,6 +28,7 @@ */ #include +#include #include #include @@ -82,4 +83,35 @@ BT_HIDDEN void bt_connection_remove_iterator(struct bt_connection *conn, struct bt_notification_iterator *iterator); +static inline +enum bt_connection_status +bt_connection_status_from_notification_iterator_status( + enum bt_notification_iterator_status iter_status) +{ + switch (iter_status) { + case BT_NOTIFICATION_ITERATOR_STATUS_CANCELED: + return BT_CONNECTION_STATUS_ERROR; + case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: + return BT_CONNECTION_STATUS_ERROR; + case BT_NOTIFICATION_ITERATOR_STATUS_END: + return BT_CONNECTION_STATUS_ERROR; + case BT_NOTIFICATION_ITERATOR_STATUS_OK: + return BT_CONNECTION_STATUS_OK; + case BT_NOTIFICATION_ITERATOR_STATUS_INVALID: + return BT_CONNECTION_STATUS_INVALID; + case BT_NOTIFICATION_ITERATOR_STATUS_ERROR: + return BT_CONNECTION_STATUS_ERROR; + case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM: + return BT_CONNECTION_STATUS_NOMEM; + case BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED: + return BT_CONNECTION_STATUS_ERROR; + default: +#ifdef BT_LOGF + BT_LOGF("Unknown notification iterator status: status=%d", + iter_status); +#endif + abort(); + } +} + #endif /* BABELTRACE_COMPONENT_CONNECTION_INTERNAL_H */