Commit | Line | Data |
---|---|---|
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_CONDITION_INTERNAL_H | |
9 | #define LTTNG_CONDITION_INTERNAL_H | |
10 | ||
11 | #include <lttng/condition/condition.h> | |
12 | #include <common/macros.h> | |
13 | #include <common/buffer-view.h> | |
3647288f | 14 | #include <common/dynamic-buffer.h> |
a58c490f JG |
15 | #include <stdbool.h> |
16 | #include <urcu/list.h> | |
17 | #include <stdint.h> | |
3897deca | 18 | #include <sys/types.h> |
a58c490f JG |
19 | |
20 | typedef void (*condition_destroy_cb)(struct lttng_condition *condition); | |
21 | typedef bool (*condition_validate_cb)(const struct lttng_condition *condition); | |
3647288f JG |
22 | typedef int (*condition_serialize_cb)( |
23 | const struct lttng_condition *condition, | |
24 | struct lttng_dynamic_buffer *buf); | |
a58c490f JG |
25 | typedef bool (*condition_equal_cb)(const struct lttng_condition *a, |
26 | const struct lttng_condition *b); | |
27 | typedef ssize_t (*condition_create_from_buffer_cb)( | |
28 | const struct lttng_buffer_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_buffer( | |
54 | const struct lttng_buffer_view *buffer, | |
55 | struct lttng_condition **condition); | |
56 | ||
57 | LTTNG_HIDDEN | |
3647288f JG |
58 | int lttng_condition_serialize(const struct lttng_condition *condition, |
59 | struct lttng_dynamic_buffer *buf); | |
a58c490f JG |
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 */ |