| 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_ROTATE_SESSION_H |
| 9 | #define LTTNG_ACTION_ROTATE_SESSION_H |
| 10 | |
| 11 | #include <lttng/lttng-export.h> |
| 12 | |
| 13 | struct lttng_action; |
| 14 | struct lttng_rate_policy; |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | /* |
| 21 | * Create a newly allocated rotate-session action object. |
| 22 | * |
| 23 | * A rotate session action object must have a session name set to be considered |
| 24 | * valid when used with a trigger object (lttng_trigger). A name can be set |
| 25 | * using `lttng_action_rotate_session_set_session_name`. |
| 26 | * |
| 27 | * Returns a new action on success, NULL on failure. This action must be |
| 28 | * destroyed using lttng_action_destroy(). |
| 29 | */ |
| 30 | LTTNG_EXPORT extern struct lttng_action *lttng_action_rotate_session_create(void); |
| 31 | |
| 32 | /* |
| 33 | * Set the session name of an lttng_action object of type |
| 34 | * LTTNG_ACTION_TYPE_ROTATE_SESSION. |
| 35 | */ |
| 36 | LTTNG_EXPORT extern enum lttng_action_status |
| 37 | lttng_action_rotate_session_set_session_name(struct lttng_action *action, const char *session_name); |
| 38 | |
| 39 | /* |
| 40 | * Get the session name of an lttng_action object of type |
| 41 | * LTTNG_ACTION_TYPE_ROTATE_SESSION. |
| 42 | */ |
| 43 | LTTNG_EXPORT extern enum lttng_action_status |
| 44 | lttng_action_rotate_session_get_session_name(const struct lttng_action *action, |
| 45 | const char **session_name); |
| 46 | |
| 47 | /* |
| 48 | * Set the rate policy of a rotate session action. |
| 49 | * |
| 50 | * Returns LTTNG_ACTION_STATUS_OK on success, |
| 51 | * LTTNG_ACTION_STATUS_ERROR on internal error, |
| 52 | * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. |
| 53 | */ |
| 54 | LTTNG_EXPORT extern enum lttng_action_status |
| 55 | lttng_action_rotate_session_set_rate_policy(struct lttng_action *action, |
| 56 | const struct lttng_rate_policy *policy); |
| 57 | |
| 58 | /* |
| 59 | * Get the rate policy of a rotate session action. |
| 60 | * |
| 61 | * Returns LTTNG_ACTION_STATUS_OK on success, |
| 62 | * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. |
| 63 | */ |
| 64 | LTTNG_EXPORT extern enum lttng_action_status |
| 65 | lttng_action_rotate_session_get_rate_policy(const struct lttng_action *action, |
| 66 | const struct lttng_rate_policy **policy); |
| 67 | |
| 68 | #ifdef __cplusplus |
| 69 | } |
| 70 | #endif |
| 71 | |
| 72 | #endif /* LTTNG_ACTION_ROTATE_SESSION_H */ |