| 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 | struct mi_writer; |
| 19 | |
| 20 | enum lttng_error_query_target_type { |
| 21 | LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER, |
| 22 | LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION, |
| 23 | LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION, |
| 24 | }; |
| 25 | |
| 26 | enum lttng_error_query_target_type lttng_error_query_get_target_type( |
| 27 | const struct lttng_error_query *query); |
| 28 | |
| 29 | const struct lttng_trigger *lttng_error_query_trigger_borrow_target( |
| 30 | const struct lttng_error_query *query); |
| 31 | |
| 32 | const struct lttng_trigger *lttng_error_query_condition_borrow_target( |
| 33 | const struct lttng_error_query *query); |
| 34 | |
| 35 | const struct lttng_trigger *lttng_error_query_action_borrow_trigger_target( |
| 36 | const struct lttng_error_query *query); |
| 37 | |
| 38 | struct lttng_action *lttng_error_query_action_borrow_action_target( |
| 39 | const struct lttng_error_query *query, |
| 40 | struct lttng_trigger *trigger); |
| 41 | |
| 42 | int lttng_error_query_serialize(const struct lttng_error_query *query, |
| 43 | struct lttng_payload *payload); |
| 44 | |
| 45 | ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view, |
| 46 | struct lttng_error_query **query); |
| 47 | |
| 48 | int lttng_error_query_result_serialize( |
| 49 | const struct lttng_error_query_result *result, |
| 50 | struct lttng_payload *payload); |
| 51 | |
| 52 | ssize_t lttng_error_query_result_create_from_payload( |
| 53 | struct lttng_payload_view *view, |
| 54 | struct lttng_error_query_result **result); |
| 55 | |
| 56 | int lttng_error_query_results_serialize( |
| 57 | const struct lttng_error_query_results *results, |
| 58 | struct lttng_payload *payload); |
| 59 | |
| 60 | ssize_t lttng_error_query_results_create_from_payload( |
| 61 | struct lttng_payload_view *view, |
| 62 | struct lttng_error_query_results **results); |
| 63 | |
| 64 | struct lttng_error_query_result * |
| 65 | lttng_error_query_result_counter_create( |
| 66 | const char *name, const char *description, uint64_t value); |
| 67 | |
| 68 | void lttng_error_query_result_destroy(struct lttng_error_query_result *result); |
| 69 | |
| 70 | struct lttng_error_query_results *lttng_error_query_results_create(void); |
| 71 | |
| 72 | /* Ownership of `result` is transferred on success. */ |
| 73 | int lttng_error_query_results_add_result( |
| 74 | struct lttng_error_query_results *results, |
| 75 | struct lttng_error_query_result *result); |
| 76 | |
| 77 | enum lttng_error_code lttng_error_query_results_mi_serialize( |
| 78 | const struct lttng_error_query_results *results, |
| 79 | struct mi_writer *writer); |
| 80 | |
| 81 | #endif /* LTTNG_ERROR_QUERY_INTERNAL_H */ |