Generate bytecodes related to the trigger on reception
[lttng-tools.git] / include / lttng / event-rule / event-rule-internal.h
CommitLineData
7a3dcaf6
JR
1/*
2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_EVENT_RULE_INTERNAL_H
9#define LTTNG_EVENT_RULE_INTERNAL_H
10
11#include <common/macros.h>
58daac01 12#include <common/credentials.h>
7a3dcaf6
JR
13#include <lttng/domain.h>
14#include <lttng/event-rule/event-rule.h>
15#include <lttng/lttng-error.h>
16#include <stdbool.h>
17#include <stdint.h>
18#include <sys/types.h>
19#include <urcu/ref.h>
20
21struct lttng_payload;
22struct lttng_payload_view;
23
24typedef void (*event_rule_destroy_cb)(struct lttng_event_rule *event_rule);
25typedef bool (*event_rule_validate_cb)(
26 const struct lttng_event_rule *event_rule);
27typedef int (*event_rule_serialize_cb)(
28 const struct lttng_event_rule *event_rule,
29 struct lttng_payload *payload);
30typedef bool (*event_rule_equal_cb)(const struct lttng_event_rule *a,
31 const struct lttng_event_rule *b);
32typedef ssize_t (*event_rule_create_from_payload_cb)(
33 struct lttng_payload_view *view,
34 struct lttng_event_rule **event_rule);
35typedef enum lttng_error_code (*event_rule_generate_filter_bytecode_cb)(
58daac01
JR
36 struct lttng_event_rule *event_rule,
37 const struct lttng_credentials *creds);
7a3dcaf6
JR
38typedef const char *(*event_rule_get_filter_cb)(
39 const struct lttng_event_rule *event_rule);
40typedef const struct lttng_filter_bytecode *(
41 *event_rule_get_filter_bytecode_cb)(
42 const struct lttng_event_rule *event_rule);
43typedef struct lttng_event_exclusion *(*event_rule_generate_exclusions_cb)(
44 const struct lttng_event_rule *event_rule);
45
46struct lttng_event_rule {
47 struct urcu_ref ref;
48 enum lttng_event_rule_type type;
49 event_rule_validate_cb validate;
50 event_rule_serialize_cb serialize;
51 event_rule_equal_cb equal;
52 event_rule_destroy_cb destroy;
53 event_rule_generate_filter_bytecode_cb generate_filter_bytecode;
54 event_rule_get_filter_cb get_filter;
55 event_rule_get_filter_bytecode_cb get_filter_bytecode;
56 event_rule_generate_exclusions_cb generate_exclusions;
57};
58
59struct lttng_event_rule_comm {
60 /* enum lttng_event_rule_type */
61 int8_t event_rule_type;
62 char payload[];
63};
64
65LTTNG_HIDDEN
66void lttng_event_rule_init(struct lttng_event_rule *event_rule,
67 enum lttng_event_rule_type type);
68
69LTTNG_HIDDEN
70bool lttng_event_rule_validate(const struct lttng_event_rule *event_rule);
71
72LTTNG_HIDDEN
73ssize_t lttng_event_rule_create_from_payload(
74 struct lttng_payload_view *payload,
75 struct lttng_event_rule **event_rule);
76
77LTTNG_HIDDEN
78int lttng_event_rule_serialize(const struct lttng_event_rule *event_rule,
79 struct lttng_payload *payload);
80
81LTTNG_HIDDEN
82bool lttng_event_rule_is_equal(const struct lttng_event_rule *a,
83 const struct lttng_event_rule *b);
84
85LTTNG_HIDDEN
86bool lttng_event_rule_get(struct lttng_event_rule *rule);
87
88LTTNG_HIDDEN
89void lttng_event_rule_put(struct lttng_event_rule *rule);
90
91LTTNG_HIDDEN
92enum lttng_domain_type lttng_event_rule_get_domain_type(
93 const struct lttng_event_rule *rule);
94
95LTTNG_HIDDEN
96enum lttng_error_code lttng_event_rule_generate_filter_bytecode(
58daac01
JR
97 struct lttng_event_rule *rule,
98 const struct lttng_credentials *creds);
7a3dcaf6
JR
99
100/*
101 * If not present/implemented returns NULL.
102 * Caller DOES NOT own the returned object.
103 */
104LTTNG_HIDDEN
105const char *lttng_event_rule_get_filter(const struct lttng_event_rule *rule);
106
107/*
108 * If not present/implemented returns NULL.
109 * Caller DOES NOT own the returned object.
110 */
111LTTNG_HIDDEN
112const struct lttng_filter_bytecode *lttng_event_rule_get_filter_bytecode(
113 const struct lttng_event_rule *rule);
114
115/*
116 * If not present/implemented return NULL.
117 * Caller OWNS the returned object.
118 */
119LTTNG_HIDDEN
120struct lttng_event_exclusion *lttng_event_rule_generate_exclusions(
121 const struct lttng_event_rule *rule);
122
123LTTNG_HIDDEN
124const char *lttng_event_rule_type_str(enum lttng_event_rule_type type);
125
126#endif /* LTTNG_EVENT_RULE_INTERNAL_H */
This page took 0.038859 seconds and 4 git commands to generate.