2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_TRIGGER_H
9 #define LTTNG_TRIGGER_H
12 struct lttng_condition
;
19 enum lttng_register_trigger_status
{
20 LTTNG_REGISTER_TRIGGER_STATUS_OK
= 0,
21 LTTNG_REGISTER_TRIGGER_STATUS_INVALID
= -1,
25 * Create a trigger object associating a condition and an action.
27 * A trigger associates a condition and an action to take whenever the
28 * condition evaluates to true. Such actions can, for example, consist
29 * in the emission of a notification to clients listening through
30 * notification channels.
32 * The caller retains the ownership of both the condition and action
33 * and both must be kept alive for the lifetime of the trigger object.
35 * A trigger must be registered in order to become activate and can
36 * be destroyed after its registration.
38 * Returns a trigger object on success, NULL on error.
39 * Trigger objects must be destroyed using the lttng_trigger_destroy()
42 extern struct lttng_trigger
*lttng_trigger_create(
43 struct lttng_condition
*condition
, struct lttng_action
*action
);
46 * Get the condition of a trigger.
48 * The caller acquires no ownership of the returned condition.
50 * Returns a condition on success, NULL on error.
52 extern struct lttng_condition
*lttng_trigger_get_condition(
53 struct lttng_trigger
*trigger
);
56 * Get the action of a trigger.
58 * The caller acquires no ownership of the returned action.
60 * Returns an action on success, NULL on error.
62 extern struct lttng_action
*lttng_trigger_get_action(
63 struct lttng_trigger
*trigger
);
66 * Destroy (frees) a trigger object.
68 extern void lttng_trigger_destroy(struct lttng_trigger
*trigger
);
71 * Register a trigger to the session daemon.
73 * The trigger can be destroyed after this call.
75 * Return 0 on success, a negative LTTng error code on error.
77 extern int lttng_register_trigger(struct lttng_trigger
*trigger
);
80 * Unregister a trigger from the session daemon.
82 * The trigger can be destroyed after this call.
84 * Return 0 on success, a negative LTTng error code on error.
86 extern int lttng_unregister_trigger(struct lttng_trigger
*trigger
);
92 #endif /* LTTNG_TRIGGER_H */