trigger: introduce refcounting
[lttng-tools.git] / include / lttng / trigger / trigger-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_TRIGGER_INTERNAL_H
9#define LTTNG_TRIGGER_INTERNAL_H
10
11#include <lttng/trigger/trigger.h>
3da864a9 12#include <common/credentials.h>
a58c490f 13#include <common/macros.h>
3da864a9 14#include <common/optional.h>
a58c490f
JG
15#include <stdint.h>
16#include <stdbool.h>
72756a3f 17#include <sys/types.h>
f01d28b4 18#include <urcu/ref.h>
a58c490f 19
c0a66c84
JG
20struct lttng_payload;
21struct lttng_payload_view;
22
a58c490f 23struct lttng_trigger {
f01d28b4
JR
24 /* Reference counting is only exposed to internal users. */
25 struct urcu_ref ref;
26
a58c490f
JG
27 struct lttng_condition *condition;
28 struct lttng_action *action;
3da864a9 29 LTTNG_OPTIONAL(struct lttng_credentials) creds;
a58c490f
JG
30};
31
32struct lttng_trigger_comm {
33 /* length excludes its own length. */
34 uint32_t length;
35 /* A condition and action object follow. */
36 char payload[];
37} LTTNG_PACKED;
38
39LTTNG_HIDDEN
c0a66c84 40ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *view,
a58c490f
JG
41 struct lttng_trigger **trigger);
42
43LTTNG_HIDDEN
3647288f 44int lttng_trigger_serialize(struct lttng_trigger *trigger,
c0a66c84 45 struct lttng_payload *payload);
a58c490f 46
9b63a4aa
JG
47LTTNG_HIDDEN
48const struct lttng_condition *lttng_trigger_get_const_condition(
49 const struct lttng_trigger *trigger);
50
51LTTNG_HIDDEN
52const struct lttng_action *lttng_trigger_get_const_action(
53 const struct lttng_trigger *trigger);
54
a58c490f
JG
55LTTNG_HIDDEN
56bool lttng_trigger_validate(struct lttng_trigger *trigger);
57
f01d28b4
JR
58LTTNG_HIDDEN
59void lttng_trigger_get(struct lttng_trigger *trigger);
60
61LTTNG_HIDDEN
62void lttng_trigger_put(struct lttng_trigger *trigger);
63
3da864a9
JR
64LTTNG_HIDDEN
65const struct lttng_credentials *lttng_trigger_get_credentials(
66 const struct lttng_trigger *trigger);
67
68LTTNG_HIDDEN
69void lttng_trigger_set_credentials(
70 struct lttng_trigger *trigger,
71 const struct lttng_credentials *creds);
72
a58c490f 73#endif /* LTTNG_TRIGGER_INTERNAL_H */
This page took 0.04882 seconds and 4 git commands to generate.