152b27eabbc38518c146ce15219b7153efdf0f2f
[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 <common/sessiond-comm/payload-view.h>
16 #include <common/sessiond-comm/payload.h>
17 #include <stdbool.h>
18 #include <sys/types.h>
19
20 typedef bool (*action_validate_cb)(struct lttng_action *action);
21 typedef void (*action_destroy_cb)(struct lttng_action *action);
22 typedef int (*action_serialize_cb)(struct lttng_action *action,
23 struct lttng_payload *payload);
24 typedef bool (*action_equal_cb)(const struct lttng_action *a,
25 const struct lttng_action *b);
26 typedef ssize_t (*action_create_from_payload_cb)(
27 struct lttng_payload_view *view,
28 struct lttng_action **action);
29
30 struct lttng_action {
31 enum lttng_action_type type;
32 action_validate_cb validate;
33 action_serialize_cb serialize;
34 action_equal_cb equal;
35 action_destroy_cb destroy;
36 };
37
38 struct lttng_action_comm {
39 /* enum lttng_action_type */
40 int8_t action_type;
41 } LTTNG_PACKED;
42
43 LTTNG_HIDDEN
44 void lttng_action_init(struct lttng_action *action,
45 enum lttng_action_type type,
46 action_validate_cb validate,
47 action_serialize_cb serialize,
48 action_equal_cb equal,
49 action_destroy_cb destroy);
50
51 LTTNG_HIDDEN
52 bool lttng_action_validate(struct lttng_action *action);
53
54 LTTNG_HIDDEN
55 int lttng_action_serialize(struct lttng_action *action,
56 struct lttng_payload *buf);
57
58 LTTNG_HIDDEN
59 ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
60 struct lttng_action **action);
61
62 LTTNG_HIDDEN
63 enum lttng_action_type lttng_action_get_type_const(
64 const struct lttng_action *action);
65
66 LTTNG_HIDDEN
67 bool lttng_action_is_equal(const struct lttng_action *a,
68 const struct lttng_action *b);
69
70 #endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.030408 seconds and 3 git commands to generate.