Abstract base `lttng_enabler` to support other types of enablers
[lttng-ust.git] / liblttng-ust / ust-events-internal.h
CommitLineData
d871c65b
FD
1#ifndef _LTTNG_UST_EVENTS_INTERNAL_H
2#define _LTTNG_UST_EVENTS_INTERNAL_H
3
4/*
5 * ust-events-internal.h
6 *
7 * Copyright 2019 (c) - Francis Deslauriers <francis.deslauriers@efficios.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28#include <stdint.h>
29
30#include <urcu/list.h>
31#include <urcu/hlist.h>
32
33#include <helper.h>
34#include <lttng/ust-events.h>
35
36struct lttng_event_enabler {
37 struct lttng_enabler base;
38 struct cds_list_head node; /* per-session list of enablers */
39 struct lttng_channel *chan;
40 /*
41 * Unused, but kept around to make it explicit that the tracer can do
42 * it.
43 */
44 struct lttng_ctx *ctx;
45};
46
47static inline
48struct lttng_enabler *lttng_event_enabler_as_enabler(
49 struct lttng_event_enabler *event_enabler)
50{
51 return &event_enabler->base;
52}
53
54
55/*
56 * Allocate and initialize a `struct lttng_event_enabler` object.
57 *
58 * On success, returns a `struct lttng_event_enabler`,
59 * On memory error, returns NULL.
60 */
61LTTNG_HIDDEN
62struct lttng_event_enabler *lttng_event_enabler_create(
63 enum lttng_enabler_format_type format_type,
64 struct lttng_ust_event *event_param,
65 struct lttng_channel *chan);
66
67/*
68 * Destroy a `struct lttng_event_enabler` object.
69 */
70LTTNG_HIDDEN
71void lttng_event_enabler_destroy(struct lttng_event_enabler *enabler);
72
73/*
74 * Enable a `struct lttng_event_enabler` object and all events related to this
75 * enabler.
76 */
77LTTNG_HIDDEN
78int lttng_event_enabler_enable(struct lttng_event_enabler *enabler);
79
80/*
81 * Disable a `struct lttng_event_enabler` object and all events related to this
82 * enabler.
83 */
84LTTNG_HIDDEN
85int lttng_event_enabler_disable(struct lttng_event_enabler *enabler);
86
87/*
88 * Attach filter bytecode program to `struct lttng_event_enabler` and all
89 * events related to this enabler.
90 */
91LTTNG_HIDDEN
92int lttng_event_enabler_attach_bytecode(struct lttng_event_enabler *enabler,
93 struct lttng_ust_filter_bytecode_node *bytecode);
94
95/*
96 * Attach an application context to an event enabler.
97 *
98 * Not implemented.
99 */
100LTTNG_HIDDEN
101int lttng_event_enabler_attach_context(struct lttng_event_enabler *enabler,
102 struct lttng_ust_context *ctx);
103
104/*
105 * Attach exclusion list to `struct lttng_event_enabler` and all
106 * events related to this enabler.
107 */
108LTTNG_HIDDEN
109int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *enabler,
110 struct lttng_ust_excluder_node *excluder);
111
112/*
113 * Synchronize bytecodes for the enabler and the event.
114 *
115 * This function goes over all bytecode programs of the event enabler to ensure
116 * each is linked to the provided event.
117 */
118LTTNG_HIDDEN
119void lttng_event_enabler_link_bytecode(struct lttng_event *event,
120 struct lttng_event_enabler *enabler);
121
122#endif /* _LTTNG_UST_EVENTS_INTERNAL_H */
This page took 0.026707 seconds and 4 git commands to generate.