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