Fix: liblttng-ctl comm: lttng_event is not packed
[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>
6a751b95
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>
6a751b95
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);
6a751b95
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;
6a751b95 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
57void lttng_condition_get(struct lttng_condition *condition);
58
4655b864
JR
59void lttng_condition_put(struct lttng_condition *condition);
60
a58c490f
JG
61void lttng_condition_init(struct lttng_condition *condition,
62 enum lttng_condition_type type);
63
a58c490f
JG
64bool lttng_condition_validate(const struct lttng_condition *condition);
65
c0a66c84
JG
66ssize_t lttng_condition_create_from_payload(
67 struct lttng_payload_view *view,
a58c490f
JG
68 struct lttng_condition **condition);
69
3647288f 70int lttng_condition_serialize(const struct lttng_condition *condition,
c0a66c84 71 struct lttng_payload *payload);
a58c490f 72
a58c490f
JG
73bool lttng_condition_is_equal(const struct lttng_condition *a,
74 const struct lttng_condition *b);
75
6a751b95
JR
76enum 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
0de2479d
SM
83const char *lttng_condition_type_str(enum lttng_condition_type type);
84
a58c490f 85#endif /* LTTNG_CONDITION_INTERNAL_H */
This page took 0.036694 seconds and 4 git commands to generate.