| 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_LIST_H |
| 9 | #define LTTNG_ACTION_LIST_H |
| 10 | |
| 11 | struct lttng_action; |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | /* |
| 18 | * Create a newly allocated action list object. |
| 19 | * |
| 20 | * Returns a new action list on success, NULL on failure. This action list |
| 21 | * must be destroyed using lttng_action_list_destroy(). |
| 22 | */ |
| 23 | extern struct lttng_action *lttng_action_list_create(void); |
| 24 | |
| 25 | /* |
| 26 | * Add an action to an lttng_action object of type LTTNG_ACTION_LIST. |
| 27 | * |
| 28 | * The action list acquires a reference to the action. The action can be |
| 29 | * safely destroyed after calling this function. An action must not be |
| 30 | * modified after adding it to a list. |
| 31 | * |
| 32 | * Adding an action list to an action list is not supported. |
| 33 | */ |
| 34 | extern enum lttng_action_status lttng_action_list_add_action( |
| 35 | struct lttng_action *list, struct lttng_action *action); |
| 36 | |
| 37 | /* |
| 38 | * Get the number of actions in an action list. |
| 39 | */ |
| 40 | extern enum lttng_action_status lttng_action_list_get_count( |
| 41 | const struct lttng_action *list, unsigned int *count); |
| 42 | |
| 43 | /* |
| 44 | * Get an action from the action list at a given index. |
| 45 | * |
| 46 | * Note that the list maintains the ownership of the returned action. |
| 47 | * It must not be destroyed by the user, nor should it be held beyond |
| 48 | * the lifetime of the action list. |
| 49 | * |
| 50 | * Returns an action, or NULL on error. |
| 51 | */ |
| 52 | extern const struct lttng_action *lttng_action_list_get_at_index( |
| 53 | const struct lttng_action *list, |
| 54 | unsigned int index); |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #endif /* LTTNG_ACTION_LIST_H */ |