2 * error-query-internal.h
4 * Copyright (C) 2021 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 * SPDX-License-Identifier: GPL-2.1-only
10 #ifndef LTTNG_ERROR_QUERY_INTERNAL_H
11 #define LTTNG_ERROR_QUERY_INTERNAL_H
13 #include <common/macros.hpp>
14 #include <common/payload-view.hpp>
15 #include <common/payload.hpp>
17 #include <lttng/lttng.h>
21 enum lttng_error_query_target_type {
22 LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER,
23 LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION,
24 LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION,
27 enum lttng_error_query_target_type
28 lttng_error_query_get_target_type(const struct lttng_error_query *query);
30 const struct lttng_trigger *
31 lttng_error_query_trigger_borrow_target(const struct lttng_error_query *query);
33 const struct lttng_trigger *
34 lttng_error_query_condition_borrow_target(const struct lttng_error_query *query);
36 const struct lttng_trigger *
37 lttng_error_query_action_borrow_trigger_target(const struct lttng_error_query *query);
40 lttng_error_query_action_borrow_action_target(const struct lttng_error_query *query,
41 struct lttng_trigger *trigger);
43 int lttng_error_query_serialize(const struct lttng_error_query *query,
44 struct lttng_payload *payload);
46 ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
47 struct lttng_error_query **query);
49 int lttng_error_query_result_serialize(const struct lttng_error_query_result *result,
50 struct lttng_payload *payload);
52 ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *view,
53 struct lttng_error_query_result **result);
55 int lttng_error_query_results_serialize(const struct lttng_error_query_results *results,
56 struct lttng_payload *payload);
58 ssize_t lttng_error_query_results_create_from_payload(struct lttng_payload_view *view,
59 struct lttng_error_query_results **results);
61 struct lttng_error_query_result *
62 lttng_error_query_result_counter_create(const char *name, const char *description, uint64_t value);
64 void lttng_error_query_result_destroy(struct lttng_error_query_result *result);
66 struct lttng_error_query_results *lttng_error_query_results_create();
68 /* Ownership of `result` is transferred on success. */
69 int lttng_error_query_results_add_result(struct lttng_error_query_results *results,
70 struct lttng_error_query_result *result);
73 lttng_error_query_results_mi_serialize(const struct lttng_error_query_results *results,
74 struct mi_writer *writer);
76 #endif /* LTTNG_ERROR_QUERY_INTERNAL_H */