| 1 | /* |
| 2 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_TRIGGER_INTERNAL_H |
| 9 | #define LTTNG_TRIGGER_INTERNAL_H |
| 10 | |
| 11 | #include <lttng/trigger/trigger.h> |
| 12 | #include <common/credentials.h> |
| 13 | #include <common/macros.h> |
| 14 | #include <common/optional.h> |
| 15 | #include <stdint.h> |
| 16 | #include <stdbool.h> |
| 17 | #include <sys/types.h> |
| 18 | |
| 19 | struct lttng_payload; |
| 20 | struct lttng_payload_view; |
| 21 | |
| 22 | struct lttng_trigger { |
| 23 | struct lttng_condition *condition; |
| 24 | struct lttng_action *action; |
| 25 | LTTNG_OPTIONAL(struct lttng_credentials) creds; |
| 26 | }; |
| 27 | |
| 28 | struct lttng_trigger_comm { |
| 29 | /* length excludes its own length. */ |
| 30 | uint32_t length; |
| 31 | /* A condition and action object follow. */ |
| 32 | char payload[]; |
| 33 | } LTTNG_PACKED; |
| 34 | |
| 35 | LTTNG_HIDDEN |
| 36 | ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *view, |
| 37 | struct lttng_trigger **trigger); |
| 38 | |
| 39 | LTTNG_HIDDEN |
| 40 | int lttng_trigger_serialize(struct lttng_trigger *trigger, |
| 41 | struct lttng_payload *payload); |
| 42 | |
| 43 | LTTNG_HIDDEN |
| 44 | const struct lttng_condition *lttng_trigger_get_const_condition( |
| 45 | const struct lttng_trigger *trigger); |
| 46 | |
| 47 | LTTNG_HIDDEN |
| 48 | const struct lttng_action *lttng_trigger_get_const_action( |
| 49 | const struct lttng_trigger *trigger); |
| 50 | |
| 51 | LTTNG_HIDDEN |
| 52 | bool lttng_trigger_validate(struct lttng_trigger *trigger); |
| 53 | |
| 54 | LTTNG_HIDDEN |
| 55 | const struct lttng_credentials *lttng_trigger_get_credentials( |
| 56 | const struct lttng_trigger *trigger); |
| 57 | |
| 58 | LTTNG_HIDDEN |
| 59 | void lttng_trigger_set_credentials( |
| 60 | struct lttng_trigger *trigger, |
| 61 | const struct lttng_credentials *creds); |
| 62 | |
| 63 | #endif /* LTTNG_TRIGGER_INTERNAL_H */ |