Move firing policy from lttng_trigger to lttng_action
[lttng-tools.git] / include / lttng / trigger / trigger-internal.h
index df69f3d110a2c49fe970f80883f74f018cea0c37..c5ee9c64b4c1db9642251417fa812f3e18a9a68d 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/trigger/trigger.h>
 #include <common/credentials.h>
+#include <common/dynamic-array.h>
 #include <common/macros.h>
 #include <common/optional.h>
 #include <stdint.h>
@@ -37,6 +38,10 @@ struct lttng_trigger {
        LTTNG_OPTIONAL(uint64_t) tracer_token;
 };
 
+struct lttng_triggers {
+       struct lttng_dynamic_pointer_array array;
+};
+
 struct lttng_trigger_comm {
        /*
         * Credentials, only the uid portion is used for now.
@@ -54,24 +59,23 @@ struct lttng_trigger_comm {
        char payload[];
 } LTTNG_PACKED;
 
+struct lttng_triggers_comm {
+       uint32_t count;
+       uint32_t length;
+       /* Count * lttng_trigger_comm structure */
+       char payload[];
+};
+
 LTTNG_HIDDEN
 ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *view,
                struct lttng_trigger **trigger);
 
 LTTNG_HIDDEN
-int lttng_trigger_serialize(struct lttng_trigger *trigger,
+int lttng_trigger_serialize(const struct lttng_trigger *trigger,
                struct lttng_payload *payload);
 
 LTTNG_HIDDEN
-const struct lttng_condition *lttng_trigger_get_const_condition(
-               const struct lttng_trigger *trigger);
-
-LTTNG_HIDDEN
-const struct lttng_action *lttng_trigger_get_const_action(
-               const struct lttng_trigger *trigger);
-
-LTTNG_HIDDEN
-bool lttng_trigger_validate(struct lttng_trigger *trigger);
+bool lttng_trigger_validate(const struct lttng_trigger *trigger);
 
 LTTNG_HIDDEN
 int lttng_trigger_assign_name(
@@ -98,6 +102,49 @@ void lttng_trigger_get(struct lttng_trigger *trigger);
 LTTNG_HIDDEN
 void lttng_trigger_put(struct lttng_trigger *trigger);
 
+/*
+ * Allocate a new set of triggers.
+ * The returned object must be freed via lttng_triggers_destroy.
+ */
+LTTNG_HIDDEN
+struct lttng_triggers *lttng_triggers_create(void);
+
+/*
+ * Return the a pointer to a mutable element at index "index" of an
+ * lttng_triggers set.
+ *
+ * This differs from the public `lttng_triggers_get_at_index` in that
+ * the returned pointer to a mutable trigger.
+ *
+ * The ownership of the trigger set element is NOT transfered.
+ * The returned object can NOT be freed via lttng_trigger_destroy.
+ */
+LTTNG_HIDDEN
+struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(
+               const struct lttng_triggers *triggers, unsigned int index);
+
+/*
+ * Add a trigger to the triggers set.
+ *
+ * A reference to the added trigger is acquired on behalf of the trigger set
+ * on success.
+ */
+LTTNG_HIDDEN
+int lttng_triggers_add(
+               struct lttng_triggers *triggers, struct lttng_trigger *trigger);
+
+/*
+ * Serialize a trigger set to an lttng_payload object.
+ * Return LTTNG_OK on success, negative lttng error code on error.
+ */
+LTTNG_HIDDEN
+int lttng_triggers_serialize(const struct lttng_triggers *triggers,
+               struct lttng_payload *payload);
+
+LTTNG_HIDDEN
+ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *view,
+               struct lttng_triggers **triggers);
+
 LTTNG_HIDDEN
 const struct lttng_credentials *lttng_trigger_get_credentials(
                const struct lttng_trigger *trigger);
@@ -106,4 +153,33 @@ LTTNG_HIDDEN
 void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
                const struct lttng_credentials *creds);
 
+/*
+ * Return the type of any underlying domain restriction. If no particular
+ * requirement is present, returns LTTNG_DOMAIN_NONE.
+ */
+LTTNG_HIDDEN
+enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
+               const struct lttng_trigger *trigger);
+
+/*
+ * Generate any bytecode related to the trigger.
+ * On success LTTNG_OK. On error, returns lttng_error code.
+ */
+LTTNG_HIDDEN
+enum lttng_error_code lttng_trigger_generate_bytecode(
+               struct lttng_trigger *trigger,
+               const struct lttng_credentials *creds);
+
+LTTNG_HIDDEN
+struct lttng_trigger *lttng_trigger_copy(const struct lttng_trigger *trigger);
+
+/*
+ * A given trigger needs a tracer notifier if
+ *  it has an event-rule condition,
+ *  AND
+ *  it has one or more sessiond-execution action.
+ */
+LTTNG_HIDDEN
+bool lttng_trigger_needs_tracer_notifier(const struct lttng_trigger *trigger);
+
 #endif /* LTTNG_TRIGGER_INTERNAL_H */
This page took 0.024659 seconds and 4 git commands to generate.