common: set dynamic-buffer's data to NULL on reset()
[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>
a58c490f
JG
17
18typedef bool (*action_validate_cb)(struct lttng_action *action);
19typedef void (*action_destroy_cb)(struct lttng_action *action);
3647288f
JG
20typedef int (*action_serialize_cb)(struct lttng_action *action,
21 struct lttng_dynamic_buffer *buf);
3dd04a6a
JR
22typedef bool (*action_equal_cb)(const struct lttng_action *a,
23 const struct lttng_action *b);
869a3c2d
SM
24typedef ssize_t (*action_create_from_buffer_cb)(
25 const struct lttng_buffer_view *view,
26 struct lttng_action **action);
a58c490f
JG
27
28struct lttng_action {
29 enum lttng_action_type type;
30 action_validate_cb validate;
31 action_serialize_cb serialize;
3dd04a6a 32 action_equal_cb equal;
a58c490f
JG
33 action_destroy_cb destroy;
34};
35
36struct lttng_action_comm {
37 /* enum lttng_action_type */
38 int8_t action_type;
39} LTTNG_PACKED;
40
6acb3f46
SM
41LTTNG_HIDDEN
42void lttng_action_init(struct lttng_action *action,
43 enum lttng_action_type type,
44 action_validate_cb validate,
45 action_serialize_cb serialize,
3dd04a6a 46 action_equal_cb equal,
6acb3f46
SM
47 action_destroy_cb destroy);
48
a58c490f
JG
49LTTNG_HIDDEN
50bool lttng_action_validate(struct lttng_action *action);
51
52LTTNG_HIDDEN
3647288f
JG
53int lttng_action_serialize(struct lttng_action *action,
54 struct lttng_dynamic_buffer *buf);
a58c490f
JG
55
56LTTNG_HIDDEN
57ssize_t lttng_action_create_from_buffer(const struct lttng_buffer_view *view,
58 struct lttng_action **action);
59
9b63a4aa
JG
60LTTNG_HIDDEN
61enum lttng_action_type lttng_action_get_type_const(
62 const struct lttng_action *action);
63
3dd04a6a
JR
64LTTNG_HIDDEN
65bool lttng_action_is_equal(const struct lttng_action *a,
66 const struct lttng_action *b);
67
a58c490f 68#endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.030186 seconds and 4 git commands to generate.