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_NOTIFICATION_INTERNAL_H | |
9 | #define LTTNG_NOTIFICATION_INTERNAL_H | |
10 | ||
c9e313bc | 11 | #include <common/macros.hpp> |
0038180d JG |
12 | #include <common/make-unique-wrapper.hpp> |
13 | ||
14 | #include <lttng/notification/notification.h> | |
15 | ||
16 | #include <memory> | |
a58c490f | 17 | #include <stdbool.h> |
0038180d | 18 | #include <stdint.h> |
72756a3f | 19 | #include <sys/types.h> |
a58c490f | 20 | |
c0a66c84 JG |
21 | struct lttng_payload; |
22 | struct lttng_payload_view; | |
23 | ||
a58c490f | 24 | struct lttng_notification { |
0038180d JG |
25 | using uptr = std::unique_ptr< |
26 | lttng_notification, | |
27 | lttng::details::create_unique_class<lttng_notification, | |
28 | lttng_notification_destroy>::deleter>; | |
29 | ||
52d55cf9 | 30 | struct lttng_trigger *trigger; |
a58c490f | 31 | struct lttng_evaluation *evaluation; |
a58c490f JG |
32 | }; |
33 | ||
34 | struct lttng_notification_comm { | |
35 | /* Size of the payload following this field. */ | |
36 | uint32_t length; | |
52d55cf9 | 37 | /* Trigger and evaluation objects follow. */ |
a58c490f JG |
38 | char payload[]; |
39 | } LTTNG_PACKED; | |
40 | ||
28f23191 JG |
41 | struct lttng_notification *lttng_notification_create(struct lttng_trigger *trigger, |
42 | struct lttng_evaluation *evaluation); | |
a58c490f | 43 | |
9b63a4aa | 44 | int lttng_notification_serialize(const struct lttng_notification *notification, |
28f23191 | 45 | struct lttng_payload *payload); |
a58c490f | 46 | |
28f23191 JG |
47 | ssize_t lttng_notification_create_from_payload(struct lttng_payload_view *view, |
48 | struct lttng_notification **notification); | |
a58c490f | 49 | |
28f23191 JG |
50 | const struct lttng_condition * |
51 | lttng_notification_get_const_condition(const struct lttng_notification *notification); | |
52 | const struct lttng_evaluation * | |
53 | lttng_notification_get_const_evaluation(const struct lttng_notification *notification); | |
c08136a3 | 54 | |
28f23191 JG |
55 | const struct lttng_trigger * |
56 | lttng_notification_get_const_trigger(const struct lttng_notification *notification); | |
c08136a3 | 57 | |
a58c490f | 58 | #endif /* LTTNG_NOTIFICATION_INTERNAL_H */ |