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