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 <lttng/lttng.h>
14 #include <common/macros.h>
15 #include <common/payload.h>
16 #include <common/payload-view.h>
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
,
25 enum lttng_error_query_target_type
lttng_error_query_get_target_type(
26 const struct lttng_error_query
*query
);
29 const struct lttng_trigger
*lttng_error_query_trigger_borrow_target(
30 const struct lttng_error_query
*query
);
33 const struct lttng_trigger
*lttng_error_query_condition_borrow_target(
34 const struct lttng_error_query
*query
);
37 const struct lttng_trigger
*lttng_error_query_action_borrow_trigger_target(
38 const struct lttng_error_query
*query
);
41 struct lttng_action
*lttng_error_query_action_borrow_action_target(
42 const struct lttng_error_query
*query
,
43 struct lttng_trigger
*trigger
);
46 int lttng_error_query_serialize(const struct lttng_error_query
*query
,
47 struct lttng_payload
*payload
);
50 ssize_t
lttng_error_query_create_from_payload(struct lttng_payload_view
*view
,
51 struct lttng_error_query
**query
);
54 int lttng_error_query_result_serialize(
55 const struct lttng_error_query_result
*result
,
56 struct lttng_payload
*payload
);
59 ssize_t
lttng_error_query_result_create_from_payload(
60 struct lttng_payload_view
*view
,
61 struct lttng_error_query_result
**result
);
64 int lttng_error_query_results_serialize(
65 const struct lttng_error_query_results
*results
,
66 struct lttng_payload
*payload
);
69 ssize_t
lttng_error_query_results_create_from_payload(
70 struct lttng_payload_view
*view
,
71 struct lttng_error_query_results
**results
);
74 struct lttng_error_query_result
*
75 lttng_error_query_result_counter_create(
76 const char *name
, const char *description
, uint64_t value
);
79 void lttng_error_query_result_destroy(struct lttng_error_query_result
*result
);
82 struct lttng_error_query_results
*lttng_error_query_results_create(void);
84 /* Ownership of `result` is transferred on success. */
86 int lttng_error_query_results_add_result(
87 struct lttng_error_query_results
*results
,
88 struct lttng_error_query_result
*result
);
90 #endif /* LTTNG_ERROR_QUERY_INTERNAL_H */