| 1 | /* |
| 2 | * error-query-internal.h |
| 3 | * |
| 4 | * Copyright (C) 2021 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.1-only |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | #ifndef LTTNG_ERROR_QUERY_INTERNAL_H |
| 11 | #define LTTNG_ERROR_QUERY_INTERNAL_H |
| 12 | |
| 13 | #include <lttng/lttng.h> |
| 14 | #include <common/macros.h> |
| 15 | #include <common/payload.h> |
| 16 | #include <common/payload-view.h> |
| 17 | |
| 18 | enum lttng_error_query_target_type { |
| 19 | LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER, |
| 20 | LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION, |
| 21 | LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION, |
| 22 | }; |
| 23 | |
| 24 | LTTNG_HIDDEN |
| 25 | enum lttng_error_query_target_type lttng_error_query_get_target_type( |
| 26 | const struct lttng_error_query *query); |
| 27 | |
| 28 | LTTNG_HIDDEN |
| 29 | const struct lttng_trigger *lttng_error_query_trigger_borrow_target( |
| 30 | const struct lttng_error_query *query); |
| 31 | |
| 32 | LTTNG_HIDDEN |
| 33 | const struct lttng_trigger *lttng_error_query_condition_borrow_target( |
| 34 | const struct lttng_error_query *query); |
| 35 | |
| 36 | LTTNG_HIDDEN |
| 37 | const struct lttng_trigger *lttng_error_query_action_borrow_trigger_target( |
| 38 | const struct lttng_error_query *query); |
| 39 | |
| 40 | LTTNG_HIDDEN |
| 41 | struct lttng_action *lttng_error_query_action_borrow_action_target( |
| 42 | const struct lttng_error_query *query, |
| 43 | struct lttng_trigger *trigger); |
| 44 | |
| 45 | LTTNG_HIDDEN |
| 46 | int lttng_error_query_serialize(const struct lttng_error_query *query, |
| 47 | struct lttng_payload *payload); |
| 48 | |
| 49 | LTTNG_HIDDEN |
| 50 | ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view, |
| 51 | struct lttng_error_query **query); |
| 52 | |
| 53 | LTTNG_HIDDEN |
| 54 | int lttng_error_query_result_serialize( |
| 55 | const struct lttng_error_query_result *result, |
| 56 | struct lttng_payload *payload); |
| 57 | |
| 58 | LTTNG_HIDDEN |
| 59 | ssize_t lttng_error_query_result_create_from_payload( |
| 60 | struct lttng_payload_view *view, |
| 61 | struct lttng_error_query_result **result); |
| 62 | |
| 63 | LTTNG_HIDDEN |
| 64 | int lttng_error_query_results_serialize( |
| 65 | const struct lttng_error_query_results *results, |
| 66 | struct lttng_payload *payload); |
| 67 | |
| 68 | LTTNG_HIDDEN |
| 69 | ssize_t lttng_error_query_results_create_from_payload( |
| 70 | struct lttng_payload_view *view, |
| 71 | struct lttng_error_query_results **results); |
| 72 | |
| 73 | LTTNG_HIDDEN |
| 74 | struct lttng_error_query_result * |
| 75 | lttng_error_query_result_counter_create( |
| 76 | const char *name, const char *description, uint64_t value); |
| 77 | |
| 78 | LTTNG_HIDDEN |
| 79 | void lttng_error_query_result_destroy(struct lttng_error_query_result *result); |
| 80 | |
| 81 | LTTNG_HIDDEN |
| 82 | struct lttng_error_query_results *lttng_error_query_results_create(void); |
| 83 | |
| 84 | /* Ownership of `result` is transferred on success. */ |
| 85 | LTTNG_HIDDEN |
| 86 | int lttng_error_query_results_add_result( |
| 87 | struct lttng_error_query_results *results, |
| 88 | struct lttng_error_query_result *result); |
| 89 | |
| 90 | #endif /* LTTNG_ERROR_QUERY_INTERNAL_H */ |