Clean-up: run format-cpp on the tree
[lttng-tools.git] / include / lttng / action / path.h
CommitLineData
27993cc2
JG
1/*
2 * Copyright (C) 2021 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_ACTION_PATH_H
9#define LTTNG_ACTION_PATH_H
10
4bd69c5f 11#include <lttng/lttng-export.h>
28f23191 12
27993cc2 13#include <stddef.h>
28f23191 14#include <stdint.h>
27993cc2
JG
15
16struct lttng_action_path;
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22enum lttng_action_path_status {
23 LTTNG_ACTION_PATH_STATUS_OK = 0,
24 LTTNG_ACTION_PATH_STATUS_INVALID = -1,
25};
26
27/*
28 * Create a path to an action.
29 *
30 * An action path indicates how to reach a given action from the action
31 * of a trigger. The action of a trigger is implicitly the root of an action
32 * path.
33 *
34 * The indexes of an action path allow the resolution of an action.
35 * The indexes that make-up an action path indicate the index of the successive
36 * action lists that must be traversed to reach the target action.
37 *
38 * For instance, an action path that has a single index 'N' implies that:
39 * - The root action is a list,
40 * - The target action is the 'N'-th action in that list.
41 *
42 * An action path with two indexes, N1 and N2 implies that:
43 * - The root action is an action list (L1),
44 * - The N1-th action of the action list (L1) is also a list (L2),
45 * - The target action is the N2-th action of the L2 list.
46 *
47 * The `indexes` are copied internally and can be disposed-of by the caller.
48 */
28f23191
JG
49LTTNG_EXPORT extern struct lttng_action_path *lttng_action_path_create(const uint64_t *indexes,
50 size_t index_count);
27993cc2
JG
51
52/*
53 * Get the count of indexes in an action path.
54 */
28f23191
JG
55LTTNG_EXPORT extern enum lttng_action_path_status
56lttng_action_path_get_index_count(const struct lttng_action_path *path, size_t *index_count);
27993cc2
JG
57
58/*
59 * Get an index from an action path.
60 */
4bd69c5f 61LTTNG_EXPORT extern enum lttng_action_path_status lttng_action_path_get_index_at_index(
28f23191 62 const struct lttng_action_path *path, size_t path_index, uint64_t *out_index);
27993cc2
JG
63
64/*
65 * Destroy an action path object.
66 */
4bd69c5f 67LTTNG_EXPORT extern void lttng_action_path_destroy(struct lttng_action_path *action_path);
27993cc2
JG
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif /* LTTNG_ACTION_PATH_H */
This page took 0.033791 seconds and 4 git commands to generate.