actions: Make lttng_action reference countable
[lttng-tools.git] / include / lttng / action / action-internal.h
CommitLineData
a58c490f 1/*
ab5be9fa 2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
a58c490f 3 *
ab5be9fa 4 * SPDX-License-Identifier: LGPL-2.1-only
a58c490f 5 *
a58c490f
JG
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>
3647288f 14#include <common/dynamic-buffer.h>
c0a66c84
JG
15#include <common/sessiond-comm/payload-view.h>
16#include <common/sessiond-comm/payload.h>
a58c490f 17#include <stdbool.h>
72756a3f 18#include <sys/types.h>
c852ce4e 19#include <urcu/ref.h>
a58c490f
JG
20
21typedef bool (*action_validate_cb)(struct lttng_action *action);
22typedef void (*action_destroy_cb)(struct lttng_action *action);
3647288f 23typedef int (*action_serialize_cb)(struct lttng_action *action,
c0a66c84 24 struct lttng_payload *payload);
3dd04a6a
JR
25typedef bool (*action_equal_cb)(const struct lttng_action *a,
26 const struct lttng_action *b);
c0a66c84
JG
27typedef ssize_t (*action_create_from_payload_cb)(
28 struct lttng_payload_view *view,
869a3c2d 29 struct lttng_action **action);
a58c490f
JG
30
31struct lttng_action {
c852ce4e 32 struct urcu_ref ref;
a58c490f
JG
33 enum lttng_action_type type;
34 action_validate_cb validate;
35 action_serialize_cb serialize;
3dd04a6a 36 action_equal_cb equal;
a58c490f
JG
37 action_destroy_cb destroy;
38};
39
40struct lttng_action_comm {
41 /* enum lttng_action_type */
42 int8_t action_type;
43} LTTNG_PACKED;
44
6acb3f46
SM
45LTTNG_HIDDEN
46void lttng_action_init(struct lttng_action *action,
47 enum lttng_action_type type,
48 action_validate_cb validate,
49 action_serialize_cb serialize,
3dd04a6a 50 action_equal_cb equal,
6acb3f46
SM
51 action_destroy_cb destroy);
52
a58c490f
JG
53LTTNG_HIDDEN
54bool lttng_action_validate(struct lttng_action *action);
55
56LTTNG_HIDDEN
3647288f 57int lttng_action_serialize(struct lttng_action *action,
c0a66c84 58 struct lttng_payload *buf);
a58c490f
JG
59
60LTTNG_HIDDEN
c0a66c84 61ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
a58c490f
JG
62 struct lttng_action **action);
63
9b63a4aa
JG
64LTTNG_HIDDEN
65enum lttng_action_type lttng_action_get_type_const(
66 const struct lttng_action *action);
67
3dd04a6a
JR
68LTTNG_HIDDEN
69bool lttng_action_is_equal(const struct lttng_action *a,
70 const struct lttng_action *b);
71
c852ce4e
JG
72LTTNG_HIDDEN
73void lttng_action_get(struct lttng_action *action);
74
75LTTNG_HIDDEN
76void lttng_action_put(struct lttng_action *action);
77
a58c490f 78#endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.029983 seconds and 4 git commands to generate.