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