SoW-2019-0002: Dynamic Snapshot
[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>
a58c490f 15#include <stdbool.h>
72756a3f 16#include <sys/types.h>
1831ae68 17#include <urcu/ref.h>
a58c490f
JG
18
19typedef bool (*action_validate_cb)(struct lttng_action *action);
20typedef void (*action_destroy_cb)(struct lttng_action *action);
3647288f
JG
21typedef int (*action_serialize_cb)(struct lttng_action *action,
22 struct lttng_dynamic_buffer *buf);
1831ae68
FD
23typedef bool (*action_equal_cb)(const struct lttng_action *a,
24 const struct lttng_action *b);
25typedef ssize_t (*action_create_from_buffer_cb)(
26 const struct lttng_buffer_view *view,
27 struct lttng_action **action);
a58c490f
JG
28
29struct lttng_action {
1831ae68 30 struct urcu_ref ref;
a58c490f
JG
31 enum lttng_action_type type;
32 action_validate_cb validate;
33 action_serialize_cb serialize;
1831ae68 34 action_equal_cb equal;
a58c490f
JG
35 action_destroy_cb destroy;
36};
37
38struct lttng_action_comm {
39 /* enum lttng_action_type */
40 int8_t action_type;
41} LTTNG_PACKED;
42
1831ae68
FD
43LTTNG_HIDDEN
44void 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
a58c490f
JG
51LTTNG_HIDDEN
52bool lttng_action_validate(struct lttng_action *action);
53
54LTTNG_HIDDEN
3647288f
JG
55int lttng_action_serialize(struct lttng_action *action,
56 struct lttng_dynamic_buffer *buf);
a58c490f
JG
57
58LTTNG_HIDDEN
59ssize_t lttng_action_create_from_buffer(const struct lttng_buffer_view *view,
60 struct lttng_action **action);
61
9b63a4aa
JG
62LTTNG_HIDDEN
63enum lttng_action_type lttng_action_get_type_const(
64 const struct lttng_action *action);
65
1831ae68
FD
66LTTNG_HIDDEN
67bool lttng_action_is_equal(const struct lttng_action *a,
68 const struct lttng_action *b);
69
70LTTNG_HIDDEN
71void lttng_action_get(struct lttng_action *action);
72
73LTTNG_HIDDEN
74void lttng_action_put(struct lttng_action *action);
75
76LTTNG_HIDDEN
77const char* lttng_action_type_string(enum lttng_action_type action_type);
78
a58c490f 79#endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.039788 seconds and 5 git commands to generate.