sessiond: agent: enable events matching event notifiers
[lttng-tools.git] / include / lttng / event-rule / event-rule-internal.h
index 7aca4a02ba62098be6d6fe271bc151920ddc82e3..a8ad34fe897728731fd9bb4b0d468bbb90a4292e 100644 (file)
@@ -10,7 +10,9 @@
 
 #include <common/macros.h>
 #include <common/credentials.h>
+#include <common/sessiond-comm/sessiond-comm.h>
 #include <lttng/domain.h>
+#include <lttng/event.h>
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/lttng-error.h>
 #include <stdbool.h>
 struct lttng_payload;
 struct lttng_payload_view;
 
+enum lttng_event_rule_generate_exclusions_status {
+       LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OK,
+       LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE,
+       LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_ERROR,
+       LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OUT_OF_MEMORY,
+};
+
 typedef void (*event_rule_destroy_cb)(struct lttng_event_rule *event_rule);
 typedef bool (*event_rule_validate_cb)(
                const struct lttng_event_rule *event_rule);
@@ -40,7 +49,13 @@ typedef const char *(*event_rule_get_filter_cb)(
 typedef const struct lttng_filter_bytecode *(
                *event_rule_get_filter_bytecode_cb)(
                const struct lttng_event_rule *event_rule);
-typedef struct lttng_event_exclusion *(*event_rule_generate_exclusions_cb)(
+typedef enum lttng_event_rule_generate_exclusions_status (
+               *event_rule_generate_exclusions_cb)(
+               const struct lttng_event_rule *event_rule,
+               struct lttng_event_exclusion **exclusions);
+typedef unsigned long (*event_rule_hash_cb)(
+               const struct lttng_event_rule *event_rule);
+typedef struct lttng_event *(*event_rule_generate_lttng_event_cb)(
                const struct lttng_event_rule *event_rule);
 
 struct lttng_event_rule {
@@ -54,6 +69,8 @@ struct lttng_event_rule {
        event_rule_get_filter_cb get_filter;
        event_rule_get_filter_bytecode_cb get_filter_bytecode;
        event_rule_generate_exclusions_cb generate_exclusions;
+       event_rule_hash_cb hash;
+       event_rule_generate_lttng_event_cb generate_lttng_event;
 };
 
 struct lttng_event_rule_comm {
@@ -117,10 +134,31 @@ const struct lttng_filter_bytecode *lttng_event_rule_get_filter_bytecode(
  * Caller OWNS the returned object.
  */
 LTTNG_HIDDEN
-struct lttng_event_exclusion *lttng_event_rule_generate_exclusions(
-               const struct lttng_event_rule *rule);
+enum lttng_event_rule_generate_exclusions_status
+lttng_event_rule_generate_exclusions(const struct lttng_event_rule *rule,
+               struct lttng_event_exclusion **exclusions);
 
 LTTNG_HIDDEN
 const char *lttng_event_rule_type_str(enum lttng_event_rule_type type);
 
+LTTNG_HIDDEN
+unsigned long lttng_event_rule_hash(const struct lttng_event_rule *rule);
+
+/*
+ * This is a compatibility helper allowing us to generate a sessiond-side (not
+ * communication) `struct lttng_event` object from an event rule.
+ *
+ * This effectively bridges older parts of the code using those structures and
+ * new event-rule based code.
+ *
+ * The caller owns the returned object.
+ */
+LTTNG_HIDDEN
+struct lttng_event *lttng_event_rule_generate_lttng_event(
+               const struct lttng_event_rule *rule);
+
+/* Test if an event rule targets an agent domain. */
+LTTNG_HIDDEN
+bool lttng_event_rule_targets_agent_domain(const struct lttng_event_rule *rule);
+
 #endif /* LTTNG_EVENT_RULE_INTERNAL_H */
This page took 0.025367 seconds and 4 git commands to generate.