trigger: implement trigger naming
[lttng-tools.git] / include / lttng / trigger / trigger-internal.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_TRIGGER_INTERNAL_H
9#define LTTNG_TRIGGER_INTERNAL_H
10
11#include <lttng/trigger/trigger.h>
12#include <common/credentials.h>
13#include <common/macros.h>
14#include <common/optional.h>
15#include <stdint.h>
16#include <stdbool.h>
17#include <sys/types.h>
18#include <urcu/ref.h>
19
20struct lttng_payload;
21struct lttng_payload_view;
22
23struct lttng_trigger {
24 /* Reference counting is only exposed to internal users. */
25 struct urcu_ref ref;
26
27 struct lttng_condition *condition;
28 struct lttng_action *action;
29 char *name;
30 /* For now only the uid portion of the credentials is used. */
31 struct lttng_credentials creds;
32};
33
34struct lttng_trigger_comm {
35 /*
36 * Credentials, only the uid portion is used for now.
37 * Used as an override when desired by the root user.
38 */
39 uint64_t uid;
40 /*
41 * Length of the variable length payload (name, condition, and
42 * an action).
43 */
44 uint32_t length;
45 /* Includes '\0' terminator. */
46 uint32_t name_length;
47 /* A null-terminated name, a condition, and an action follow. */
48 char payload[];
49} LTTNG_PACKED;
50
51LTTNG_HIDDEN
52ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *view,
53 struct lttng_trigger **trigger);
54
55LTTNG_HIDDEN
56int lttng_trigger_serialize(struct lttng_trigger *trigger,
57 struct lttng_payload *payload);
58
59LTTNG_HIDDEN
60const struct lttng_condition *lttng_trigger_get_const_condition(
61 const struct lttng_trigger *trigger);
62
63LTTNG_HIDDEN
64const struct lttng_action *lttng_trigger_get_const_action(
65 const struct lttng_trigger *trigger);
66
67LTTNG_HIDDEN
68bool lttng_trigger_validate(struct lttng_trigger *trigger);
69
70LTTNG_HIDDEN
71int lttng_trigger_assign_name(
72 struct lttng_trigger *dst, const struct lttng_trigger *src);
73
74LTTNG_HIDDEN
75int lttng_trigger_generate_name(struct lttng_trigger *trigger,
76 uint64_t unique_id);
77
78LTTNG_HIDDEN
79bool lttng_trigger_is_equal(
80 const struct lttng_trigger *a, const struct lttng_trigger *b);
81
82LTTNG_HIDDEN
83void lttng_trigger_get(struct lttng_trigger *trigger);
84
85LTTNG_HIDDEN
86void lttng_trigger_put(struct lttng_trigger *trigger);
87
88LTTNG_HIDDEN
89const struct lttng_credentials *lttng_trigger_get_credentials(
90 const struct lttng_trigger *trigger);
91
92LTTNG_HIDDEN
93void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
94 const struct lttng_credentials *creds);
95
96#endif /* LTTNG_TRIGGER_INTERNAL_H */
This page took 0.023024 seconds and 4 git commands to generate.