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_EVALUATION_INTERNAL_H | |
9 | #define LTTNG_EVALUATION_INTERNAL_H | |
10 | ||
11 | #include <lttng/condition/evaluation.h> | |
12 | #include <common/macros.h> | |
a58c490f | 13 | #include <stdbool.h> |
3897deca | 14 | #include <sys/types.h> |
a58c490f | 15 | |
c0a66c84 JG |
16 | struct lttng_payload; |
17 | struct lttng_payload_view; | |
18 | ||
a58c490f | 19 | typedef void (*evaluation_destroy_cb)(struct lttng_evaluation *evaluation); |
9b63a4aa JG |
20 | typedef int (*evaluation_serialize_cb)( |
21 | const struct lttng_evaluation *evaluation, | |
c0a66c84 | 22 | struct lttng_payload *payload); |
a58c490f JG |
23 | |
24 | struct lttng_evaluation_comm { | |
25 | /* enum lttng_condition_type type */ | |
26 | int8_t type; | |
27 | char payload[]; | |
28 | } LTTNG_PACKED; | |
29 | ||
30 | struct lttng_evaluation { | |
31 | enum lttng_condition_type type; | |
32 | evaluation_serialize_cb serialize; | |
33 | evaluation_destroy_cb destroy; | |
34 | }; | |
35 | ||
c19092cd JG |
36 | LTTNG_HIDDEN |
37 | void lttng_evaluation_init(struct lttng_evaluation *evaluation, | |
38 | enum lttng_condition_type type); | |
39 | ||
a58c490f | 40 | LTTNG_HIDDEN |
c0a66c84 | 41 | ssize_t lttng_evaluation_create_from_payload(struct lttng_payload_view *view, |
a58c490f JG |
42 | struct lttng_evaluation **evaluation); |
43 | ||
44 | LTTNG_HIDDEN | |
9b63a4aa | 45 | int lttng_evaluation_serialize(const struct lttng_evaluation *evaluation, |
c0a66c84 | 46 | struct lttng_payload *payload); |
a58c490f JG |
47 | |
48 | #endif /* LTTNG_EVALUATION_INTERNAL_H */ |