| 1 | /* |
| 2 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_NOTIFICATION_H |
| 9 | #define LTTNG_NOTIFICATION_H |
| 10 | |
| 11 | #include <lttng/lttng-export.h> |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | struct lttng_condition; |
| 18 | struct lttng_evaluation; |
| 19 | struct lttng_notification; |
| 20 | |
| 21 | /* |
| 22 | * Get a notification's condition. |
| 23 | * |
| 24 | * The notification retains the ownership of both the condition and evaluation |
| 25 | * objects. Hence, it is not valid to access those objects after the destruction |
| 26 | * of their associated notification. |
| 27 | * |
| 28 | * The caller should check the condition's type in order to use the appropriate |
| 29 | * specialized functions to access the condition's properties. |
| 30 | * |
| 31 | * Returns an lttng_condition object on success, NULL on error. |
| 32 | */ |
| 33 | LTTNG_EXPORT extern const struct lttng_condition * |
| 34 | lttng_notification_get_condition(struct lttng_notification *notification); |
| 35 | |
| 36 | /* |
| 37 | * Get a notification's condition's evaluation. |
| 38 | * |
| 39 | * The notification retains the ownership of the evaluation object. Hence, it is |
| 40 | * not valid to access that object after the destruction of its associated |
| 41 | * notification. |
| 42 | * |
| 43 | * The caller should check the evaluation's type in order to use the appropriate |
| 44 | * specialized functions to access the evaluation's properties. |
| 45 | * |
| 46 | * Returns an lttng_evaluation object on success, NULL on error. |
| 47 | */ |
| 48 | LTTNG_EXPORT extern const struct lttng_evaluation * |
| 49 | lttng_notification_get_evaluation(struct lttng_notification *notification); |
| 50 | |
| 51 | /* |
| 52 | * Get a notification's origin trigger. |
| 53 | * |
| 54 | * The notification retains the ownership of the trigger object. Hence, it is |
| 55 | * not valid to access that object after the destruction of its associated |
| 56 | * notification. |
| 57 | * |
| 58 | * Returns an lttng_trigger object on success, NULL on error. |
| 59 | */ |
| 60 | LTTNG_EXPORT extern const struct lttng_trigger * |
| 61 | lttng_notification_get_trigger(struct lttng_notification *notification); |
| 62 | |
| 63 | /* |
| 64 | * Destroys (frees) a notification. The notification's condition and evaluation |
| 65 | * are destroyed as a side-effect. |
| 66 | */ |
| 67 | LTTNG_EXPORT extern void lttng_notification_destroy(struct lttng_notification *notification); |
| 68 | |
| 69 | #ifdef __cplusplus |
| 70 | } |
| 71 | #endif |
| 72 | |
| 73 | #endif /* LTTNG_NOTIFICATION_H */ |