2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_CONDITION_INTERNAL_H
9 #define LTTNG_CONDITION_INTERNAL_H
11 #include <lttng/condition/condition.h>
12 #include <common/macros.h>
13 #include <common/payload-view.h>
14 #include <common/payload.h>
16 #include <urcu/list.h>
19 #include <sys/types.h>
21 typedef void (*condition_destroy_cb
)(struct lttng_condition
*condition
);
22 typedef bool (*condition_validate_cb
)(const struct lttng_condition
*condition
);
23 typedef int (*condition_serialize_cb
)(
24 const struct lttng_condition
*condition
,
25 struct lttng_payload
*payload
);
26 typedef bool (*condition_equal_cb
)(const struct lttng_condition
*a
,
27 const struct lttng_condition
*b
);
28 typedef ssize_t (*condition_create_from_payload_cb
)(
29 struct lttng_payload_view
*view
,
30 struct lttng_condition
**condition
);
32 struct lttng_condition
{
33 /* Reference counting is only exposed to internal users. */
35 enum lttng_condition_type type
;
36 condition_validate_cb validate
;
37 condition_serialize_cb serialize
;
38 condition_equal_cb equal
;
39 condition_destroy_cb destroy
;
42 struct lttng_condition_comm
{
43 /* enum lttng_condition_type */
44 int8_t condition_type
;
49 void lttng_condition_get(struct lttng_condition
*condition
);
52 void lttng_condition_put(struct lttng_condition
*condition
);
55 void lttng_condition_init(struct lttng_condition
*condition
,
56 enum lttng_condition_type type
);
59 bool lttng_condition_validate(const struct lttng_condition
*condition
);
62 ssize_t
lttng_condition_create_from_payload(
63 struct lttng_payload_view
*view
,
64 struct lttng_condition
**condition
);
67 int lttng_condition_serialize(const struct lttng_condition
*condition
,
68 struct lttng_payload
*payload
);
71 bool lttng_condition_is_equal(const struct lttng_condition
*a
,
72 const struct lttng_condition
*b
);
75 const char *lttng_condition_type_str(enum lttng_condition_type type
);
77 #endif /* LTTNG_CONDITION_INTERNAL_H */