liblttng-ctl: use lttng_payload for serialize/create_from_buffer
[lttng-tools.git] / include / lttng / condition / condition-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_CONDITION_INTERNAL_H
9 #define LTTNG_CONDITION_INTERNAL_H
10
11 #include <lttng/condition/condition.h>
12 #include <common/macros.h>
13 #include <common/sessiond-comm/payload-view.h>
14 #include <common/sessiond-comm/payload.h>
15 #include <stdbool.h>
16 #include <urcu/list.h>
17 #include <stdint.h>
18 #include <sys/types.h>
19
20 typedef void (*condition_destroy_cb)(struct lttng_condition *condition);
21 typedef bool (*condition_validate_cb)(const struct lttng_condition *condition);
22 typedef int (*condition_serialize_cb)(
23 const struct lttng_condition *condition,
24 struct lttng_payload *payload);
25 typedef bool (*condition_equal_cb)(const struct lttng_condition *a,
26 const struct lttng_condition *b);
27 typedef ssize_t (*condition_create_from_payload_cb)(
28 struct lttng_payload_view *view,
29 struct lttng_condition **condition);
30
31 struct lttng_condition {
32 enum lttng_condition_type type;
33 condition_validate_cb validate;
34 condition_serialize_cb serialize;
35 condition_equal_cb equal;
36 condition_destroy_cb destroy;
37 };
38
39 struct lttng_condition_comm {
40 /* enum lttng_condition_type */
41 int8_t condition_type;
42 char payload[];
43 };
44
45 LTTNG_HIDDEN
46 void lttng_condition_init(struct lttng_condition *condition,
47 enum lttng_condition_type type);
48
49 LTTNG_HIDDEN
50 bool lttng_condition_validate(const struct lttng_condition *condition);
51
52 LTTNG_HIDDEN
53 ssize_t lttng_condition_create_from_payload(
54 struct lttng_payload_view *view,
55 struct lttng_condition **condition);
56
57 LTTNG_HIDDEN
58 int lttng_condition_serialize(const struct lttng_condition *condition,
59 struct lttng_payload *payload);
60
61 LTTNG_HIDDEN
62 bool lttng_condition_is_equal(const struct lttng_condition *a,
63 const struct lttng_condition *b);
64
65 #endif /* LTTNG_CONDITION_INTERNAL_H */
This page took 0.044076 seconds and 4 git commands to generate.