| 1 | /* |
| 2 | * Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_ACTION_SNAPSHOT_SESSION_H |
| 9 | #define LTTNG_ACTION_SNAPSHOT_SESSION_H |
| 10 | |
| 11 | #include <lttng/lttng-export.h> |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | struct lttng_action; |
| 18 | struct lttng_snapshot_output; |
| 19 | struct lttng_rate_policy; |
| 20 | |
| 21 | /* |
| 22 | * Create a newly allocated snapshot-session action object. |
| 23 | * |
| 24 | * A snapshot session action object must have a session name set to be |
| 25 | * considered valid when used with a trigger object (lttng_trigger). A name can |
| 26 | * be set using `lttng_action_snapshot_session_set_session_name`. |
| 27 | * |
| 28 | * Returns a new action on success, NULL on failure. This action must be |
| 29 | * destroyed using lttng_action_destroy(). |
| 30 | */ |
| 31 | LTTNG_EXPORT extern struct lttng_action *lttng_action_snapshot_session_create(void); |
| 32 | |
| 33 | /* |
| 34 | * Set the session name of an lttng_action object of type |
| 35 | * LTTNG_ACTION_TYPE_SNAPSHOT_SESSION. |
| 36 | */ |
| 37 | LTTNG_EXPORT extern enum lttng_action_status |
| 38 | lttng_action_snapshot_session_set_session_name(struct lttng_action *action, |
| 39 | const char *session_name); |
| 40 | |
| 41 | /* |
| 42 | * Get the session name of an lttng_action object of type |
| 43 | * LTTNG_ACTION_TYPE_SNAPSHOT_SESSION. |
| 44 | */ |
| 45 | LTTNG_EXPORT extern enum lttng_action_status |
| 46 | lttng_action_snapshot_session_get_session_name(const struct lttng_action *action, |
| 47 | const char **session_name); |
| 48 | |
| 49 | /* |
| 50 | * Set an explicit snapshot output for this snapshot session action. |
| 51 | * |
| 52 | * The given snapshot output will be used instead of the session's |
| 53 | * default snapshot output. |
| 54 | * |
| 55 | * This function takes ownership of the given snapshot output. |
| 56 | */ |
| 57 | LTTNG_EXPORT extern enum lttng_action_status |
| 58 | lttng_action_snapshot_session_set_output(struct lttng_action *action, |
| 59 | struct lttng_snapshot_output *output); |
| 60 | |
| 61 | /* |
| 62 | * Get the explicit snapshot output for this snapshot session action. |
| 63 | */ |
| 64 | LTTNG_EXPORT extern enum lttng_action_status |
| 65 | lttng_action_snapshot_session_get_output(const struct lttng_action *action, |
| 66 | const struct lttng_snapshot_output **output); |
| 67 | |
| 68 | /* |
| 69 | * Set the rate policy of a snapshot session action. |
| 70 | * |
| 71 | * Returns LTTNG_ACTION_STATUS_OK on success, |
| 72 | * LTTNG_ACTION_STATUS_ERROR on internal error, |
| 73 | * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. |
| 74 | */ |
| 75 | LTTNG_EXPORT extern enum lttng_action_status |
| 76 | lttng_action_snapshot_session_set_rate_policy(struct lttng_action *action, |
| 77 | const struct lttng_rate_policy *policy); |
| 78 | |
| 79 | /* |
| 80 | * Get the rate policy of a snapshot session action. |
| 81 | * |
| 82 | * Returns LTTNG_ACTION_STATUS_OK on success, |
| 83 | * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. |
| 84 | */ |
| 85 | LTTNG_EXPORT extern enum lttng_action_status |
| 86 | lttng_action_snapshot_session_get_rate_policy(const struct lttng_action *action, |
| 87 | const struct lttng_rate_policy **policy); |
| 88 | |
| 89 | #ifdef __cplusplus |
| 90 | } |
| 91 | #endif |
| 92 | |
| 93 | #endif /* LTTNG_ACTION_SNAPSHOT_SESSION_H */ |