X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng%2Ftrigger%2Ftrigger-internal.h;h=20989bd99e700c0c547de38ea18e9060e8da972e;hp=6942ece78d7a88d9b15a2585fdb200e43f0261f8;hb=0de2479d5f5a287d31c69e34ea5202a69019f224;hpb=a02903c0743cebd1f51227905ee89e571b84acbc diff --git a/include/lttng/trigger/trigger-internal.h b/include/lttng/trigger/trigger-internal.h index 6942ece78..20989bd99 100644 --- a/include/lttng/trigger/trigger-internal.h +++ b/include/lttng/trigger/trigger-internal.h @@ -30,6 +30,11 @@ struct lttng_trigger { char *name; /* For now only the uid portion of the credentials is used. */ struct lttng_credentials creds; + struct { + enum lttng_trigger_firing_policy type; + uint64_t threshold; + uint64_t current_count; + } firing_policy; /* * Internal use only. * The unique token passed to the tracer to identify an event-rule @@ -55,6 +60,10 @@ struct lttng_trigger_comm { uint32_t length; /* Includes '\0' terminator. */ uint32_t name_length; + /* Firing policy. */ + /* Maps to enum lttng_trigger_firing_policy. */ + uint8_t firing_policy_type; + uint64_t firing_policy_threshold; /* A null-terminated name, a condition, and an action follow. */ char payload[]; } LTTNG_PACKED; @@ -74,14 +83,6 @@ LTTNG_HIDDEN 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); @@ -161,4 +162,35 @@ LTTNG_HIDDEN void lttng_trigger_set_credentials(struct lttng_trigger *trigger, const struct lttng_credentials *creds); + +/* + * Fire the trigger. + * Increments the occurrence count. + */ +LTTNG_HIDDEN +void lttng_trigger_fire(struct lttng_trigger *trigger); + +/* + * Check if the trigger would fire. + */ +LTTNG_HIDDEN +bool lttng_trigger_should_fire(const struct lttng_trigger *trigger); + +/* + * 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); + #endif /* LTTNG_TRIGGER_INTERNAL_H */