787e9087a01e353c664c1876575dad2867a4fa5b
[lttng-tools.git] / include / lttng / action / action-internal.h
1 /*
2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_ACTION_INTERNAL_H
9 #define LTTNG_ACTION_INTERNAL_H
10
11 #include <lttng/action/action.h>
12 #include <common/macros.h>
13 #include <common/buffer-view.h>
14 #include <common/dynamic-buffer.h>
15 #include <stdbool.h>
16 #include <sys/types.h>
17
18 typedef bool (*action_validate_cb)(struct lttng_action *action);
19 typedef void (*action_destroy_cb)(struct lttng_action *action);
20 typedef int (*action_serialize_cb)(struct lttng_action *action,
21 struct lttng_dynamic_buffer *buf);
22
23 struct lttng_action {
24 enum lttng_action_type type;
25 action_validate_cb validate;
26 action_serialize_cb serialize;
27 action_destroy_cb destroy;
28 };
29
30 struct lttng_action_comm {
31 /* enum lttng_action_type */
32 int8_t action_type;
33 } LTTNG_PACKED;
34
35 LTTNG_HIDDEN
36 bool lttng_action_validate(struct lttng_action *action);
37
38 LTTNG_HIDDEN
39 int lttng_action_serialize(struct lttng_action *action,
40 struct lttng_dynamic_buffer *buf);
41
42 LTTNG_HIDDEN
43 ssize_t lttng_action_create_from_buffer(const struct lttng_buffer_view *view,
44 struct lttng_action **action);
45
46 LTTNG_HIDDEN
47 enum lttng_action_type lttng_action_get_type_const(
48 const struct lttng_action *action);
49
50 #endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.042943 seconds and 4 git commands to generate.