Remove extern "C" from internal headers
[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 <common/macros.h>
12 #include <common/payload-view.h>
13 #include <common/payload.h>
14 #include <lttng/condition/condition.h>
15 #include <lttng/lttng-error.h>
16 #include <stdbool.h>
17 #include <stdint.h>
18 #include <sys/types.h>
19 #include <urcu/list.h>
20 #include <urcu/ref.h>
21
22 struct mi_writer;
23 struct mi_lttng_error_query_callbacks;
24 struct lttng_trigger;
25
26 typedef void (*condition_destroy_cb)(struct lttng_condition *condition);
27 typedef bool (*condition_validate_cb)(const struct lttng_condition *condition);
28 typedef int (*condition_serialize_cb)(
29 const struct lttng_condition *condition,
30 struct lttng_payload *payload);
31 typedef bool (*condition_equal_cb)(const struct lttng_condition *a,
32 const struct lttng_condition *b);
33 typedef ssize_t (*condition_create_from_payload_cb)(
34 struct lttng_payload_view *view,
35 struct lttng_condition **condition);
36 typedef enum lttng_error_code (*condition_mi_serialize_cb)(
37 const struct lttng_condition *condition,
38 struct mi_writer *writer);
39
40 struct lttng_condition {
41 /* Reference counting is only exposed to internal users. */
42 struct urcu_ref ref;
43 enum lttng_condition_type type;
44 condition_validate_cb validate;
45 condition_serialize_cb serialize;
46 condition_equal_cb equal;
47 condition_destroy_cb destroy;
48 condition_mi_serialize_cb mi_serialize;
49 };
50
51 struct lttng_condition_comm {
52 /* enum lttng_condition_type */
53 int8_t condition_type;
54 char payload[];
55 };
56
57 void lttng_condition_get(struct lttng_condition *condition);
58
59 void lttng_condition_put(struct lttng_condition *condition);
60
61 void lttng_condition_init(struct lttng_condition *condition,
62 enum lttng_condition_type type);
63
64 bool lttng_condition_validate(const struct lttng_condition *condition);
65
66 ssize_t lttng_condition_create_from_payload(
67 struct lttng_payload_view *view,
68 struct lttng_condition **condition);
69
70 int lttng_condition_serialize(const struct lttng_condition *condition,
71 struct lttng_payload *payload);
72
73 bool lttng_condition_is_equal(const struct lttng_condition *a,
74 const struct lttng_condition *b);
75
76 enum lttng_error_code lttng_condition_mi_serialize(
77 const struct lttng_trigger *trigger,
78 const struct lttng_condition *condition,
79 struct mi_writer *writer,
80 const struct mi_lttng_error_query_callbacks
81 *error_query_callbacks);
82
83 const char *lttng_condition_type_str(enum lttng_condition_type type);
84
85 #endif /* LTTNG_CONDITION_INTERNAL_H */
This page took 0.030672 seconds and 4 git commands to generate.