MI: implement all objects related to trigger machine interface
[lttng-tools.git] / include / lttng / condition / condition-internal.h
CommitLineData
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
a58c490f 11#include <common/macros.h>
9e620ea7
JG
12#include <common/payload-view.h>
13#include <common/payload.h>
0f7c2963
JR
14#include <lttng/condition/condition.h>
15#include <lttng/lttng-error.h>
a58c490f 16#include <stdbool.h>
a58c490f 17#include <stdint.h>
3897deca 18#include <sys/types.h>
0f7c2963
JR
19#include <urcu/list.h>
20#include <urcu/ref.h>
21
22struct mi_writer;
23struct mi_lttng_error_query_callbacks;
24struct lttng_trigger;
a58c490f
JG
25
26typedef void (*condition_destroy_cb)(struct lttng_condition *condition);
27typedef bool (*condition_validate_cb)(const struct lttng_condition *condition);
3647288f
JG
28typedef int (*condition_serialize_cb)(
29 const struct lttng_condition *condition,
c0a66c84 30 struct lttng_payload *payload);
a58c490f
JG
31typedef bool (*condition_equal_cb)(const struct lttng_condition *a,
32 const struct lttng_condition *b);
c0a66c84
JG
33typedef ssize_t (*condition_create_from_payload_cb)(
34 struct lttng_payload_view *view,
a58c490f 35 struct lttng_condition **condition);
0f7c2963
JR
36typedef enum lttng_error_code (*condition_mi_serialize_cb)(
37 const struct lttng_condition *condition,
38 struct mi_writer *writer);
a58c490f
JG
39
40struct lttng_condition {
4655b864
JR
41 /* Reference counting is only exposed to internal users. */
42 struct urcu_ref ref;
a58c490f
JG
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;
0f7c2963 48 condition_mi_serialize_cb mi_serialize;
a58c490f
JG
49};
50
51struct lttng_condition_comm {
52 /* enum lttng_condition_type */
53 int8_t condition_type;
54 char payload[];
55};
56
4655b864
JR
57LTTNG_HIDDEN
58void lttng_condition_get(struct lttng_condition *condition);
59
60LTTNG_HIDDEN
61void lttng_condition_put(struct lttng_condition *condition);
62
a58c490f
JG
63LTTNG_HIDDEN
64void lttng_condition_init(struct lttng_condition *condition,
65 enum lttng_condition_type type);
66
67LTTNG_HIDDEN
68bool lttng_condition_validate(const struct lttng_condition *condition);
69
70LTTNG_HIDDEN
c0a66c84
JG
71ssize_t lttng_condition_create_from_payload(
72 struct lttng_payload_view *view,
a58c490f
JG
73 struct lttng_condition **condition);
74
75LTTNG_HIDDEN
3647288f 76int lttng_condition_serialize(const struct lttng_condition *condition,
c0a66c84 77 struct lttng_payload *payload);
a58c490f
JG
78
79LTTNG_HIDDEN
80bool lttng_condition_is_equal(const struct lttng_condition *a,
81 const struct lttng_condition *b);
82
0f7c2963
JR
83LTTNG_HIDDEN
84enum lttng_error_code lttng_condition_mi_serialize(
85 const struct lttng_trigger *trigger,
86 const struct lttng_condition *condition,
87 struct mi_writer *writer,
88 const struct mi_lttng_error_query_callbacks
89 *error_query_callbacks);
90
0de2479d
SM
91LTTNG_HIDDEN
92const char *lttng_condition_type_str(enum lttng_condition_type type);
93
a58c490f 94#endif /* LTTNG_CONDITION_INTERNAL_H */
This page took 0.049001 seconds and 5 git commands to generate.