| 1 | /* |
| 2 | * Copyright (C) 2019 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU Lesser General Public License, version 2.1 only, |
| 6 | * as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This library is distributed in the hope that it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
| 11 | * for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this library; if not, write to the Free Software Foundation, |
| 15 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | */ |
| 17 | |
| 18 | #ifndef LTTNG_CONDITION_EVENT_RULE_H |
| 19 | #define LTTNG_CONDITION_EVENT_RULE_H |
| 20 | |
| 21 | #include <lttng/event-rule/event-rule.h> |
| 22 | #include <lttng/condition/condition.h> |
| 23 | #include <lttng/condition/evaluation.h> |
| 24 | |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | |
| 29 | /* |
| 30 | * TODO: overall desciption of an event rule condition. |
| 31 | */ |
| 32 | |
| 33 | /* |
| 34 | * Create a newly allocated event rule condition. |
| 35 | * |
| 36 | * Rule will be copied internally. |
| 37 | * |
| 38 | * Returns a new condition on success, NULL on failure. This condition must be |
| 39 | * destroyed using lttng_condition_destroy(). |
| 40 | */ |
| 41 | extern struct lttng_condition *lttng_condition_event_rule_create( |
| 42 | struct lttng_event_rule *rule); |
| 43 | |
| 44 | /* |
| 45 | * Get the rule property of a event rule condition. |
| 46 | * |
| 47 | * The caller does not assume the ownership of the returned rule. The |
| 48 | * rule shall only be used for the duration of the condition's |
| 49 | * lifetime. |
| 50 | * |
| 51 | * Returns LTTNG_CONDITION_STATUS_OK and a pointer to the condition's rule |
| 52 | * on success, LTTNG_CONDITION_STATUS_INVALID if an invalid |
| 53 | * parameter is passed. */ |
| 54 | extern enum lttng_condition_status lttng_condition_event_rule_get_rule( |
| 55 | const struct lttng_condition *condition, const struct lttng_event_rule **rule); |
| 56 | |
| 57 | /** |
| 58 | * lttng_evaluation_event_rule_hit are specialised lttng_evaluations which |
| 59 | * allow users to query a number of properties resulting from the evaluation |
| 60 | * of a condition which evaluated to true. |
| 61 | * |
| 62 | * The evaluation of a event rule hit yields two different results: |
| 63 | * TEMPORARY - The name of the triggers associated with the condition. |
| 64 | * TODO - The captured event payload if any |
| 65 | */ |
| 66 | |
| 67 | /* |
| 68 | * Get the trigger name property of a event rule hit evaluation. |
| 69 | * |
| 70 | * Returns LTTNG_EVALUATION_STATUS_OK on success and a trigger name |
| 71 | * or LTTNG_EVALUATION_STATUS_INVALID if |
| 72 | * an invalid parameter is passed. |
| 73 | */ |
| 74 | extern enum lttng_evaluation_status |
| 75 | lttng_evaluation_event_rule_get_trigger_name( |
| 76 | const struct lttng_evaluation *evaluation, |
| 77 | const char **name); |
| 78 | |
| 79 | #ifdef __cplusplus |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | #endif /* LTTNG_CONDITION_EVENT_RULE_H */ |