2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_ACTION_INTERNAL_H
9 #define LTTNG_ACTION_INTERNAL_H
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>
18 #include <sys/types.h>
21 typedef bool (*action_validate_cb
)(struct lttng_action
*action
);
22 typedef void (*action_destroy_cb
)(struct lttng_action
*action
);
23 typedef int (*action_serialize_cb
)(struct lttng_action
*action
,
24 struct lttng_payload
*payload
);
25 typedef bool (*action_equal_cb
)(const struct lttng_action
*a
,
26 const struct lttng_action
*b
);
27 typedef ssize_t (*action_create_from_payload_cb
)(
28 struct lttng_payload_view
*view
,
29 struct lttng_action
**action
);
33 enum lttng_action_type type
;
34 action_validate_cb validate
;
35 action_serialize_cb serialize
;
36 action_equal_cb equal
;
37 action_destroy_cb destroy
;
40 struct lttng_action_comm
{
41 /* enum lttng_action_type */
46 void lttng_action_init(struct lttng_action
*action
,
47 enum lttng_action_type type
,
48 action_validate_cb validate
,
49 action_serialize_cb serialize
,
50 action_equal_cb equal
,
51 action_destroy_cb destroy
);
54 bool lttng_action_validate(struct lttng_action
*action
);
57 int lttng_action_serialize(struct lttng_action
*action
,
58 struct lttng_payload
*buf
);
61 ssize_t
lttng_action_create_from_payload(struct lttng_payload_view
*view
,
62 struct lttng_action
**action
);
65 enum lttng_action_type
lttng_action_get_type_const(
66 const struct lttng_action
*action
);
69 bool lttng_action_is_equal(const struct lttng_action
*a
,
70 const struct lttng_action
*b
);
73 void lttng_action_get(struct lttng_action
*action
);
76 void lttng_action_put(struct lttng_action
*action
);
78 #endif /* LTTNG_ACTION_INTERNAL_H */