d1868b06ba49375237b93c99ea7c9ce932ff3596
[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 typedef ssize_t (*action_create_from_buffer_cb)(
23 const struct lttng_buffer_view *view,
24 struct lttng_action **action);
25
26 struct lttng_action {
27 enum lttng_action_type type;
28 action_validate_cb validate;
29 action_serialize_cb serialize;
30 action_destroy_cb destroy;
31 };
32
33 struct lttng_action_comm {
34 /* enum lttng_action_type */
35 int8_t action_type;
36 } LTTNG_PACKED;
37
38 LTTNG_HIDDEN
39 void lttng_action_init(struct lttng_action *action,
40 enum lttng_action_type type,
41 action_validate_cb validate,
42 action_serialize_cb serialize,
43 action_destroy_cb destroy);
44
45 LTTNG_HIDDEN
46 bool lttng_action_validate(struct lttng_action *action);
47
48 LTTNG_HIDDEN
49 int lttng_action_serialize(struct lttng_action *action,
50 struct lttng_dynamic_buffer *buf);
51
52 LTTNG_HIDDEN
53 ssize_t lttng_action_create_from_buffer(const struct lttng_buffer_view *view,
54 struct lttng_action **action);
55
56 LTTNG_HIDDEN
57 enum lttng_action_type lttng_action_get_type_const(
58 const struct lttng_action *action);
59
60 #endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.029418 seconds and 3 git commands to generate.