sessiond: trigger: run trigger actions through an action executor
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.h
1 /*
2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef NOTIFICATION_THREAD_COMMANDS_H
9 #define NOTIFICATION_THREAD_COMMANDS_H
10
11 #include <lttng/domain.h>
12 #include <lttng/lttng-error.h>
13 #include <urcu/rculfhash.h>
14 #include "notification-thread.h"
15 #include "notification-thread-internal.h"
16 #include "notification-thread-events.h"
17 #include <common/waiter.h>
18 #include <stdbool.h>
19
20 struct notification_thread_data;
21 struct lttng_trigger;
22
23 enum notification_thread_command_type {
24 NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER,
25 NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER,
26 NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL,
27 NOTIFICATION_COMMAND_TYPE_REMOVE_CHANNEL,
28 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING,
29 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED,
30 NOTIFICATION_COMMAND_TYPE_QUIT,
31 NOTIFICATION_COMMAND_TYPE_CLIENT_COMMUNICATION_UPDATE,
32 };
33
34 struct notification_thread_command {
35 struct cds_list_head cmd_list_node;
36
37 enum notification_thread_command_type type;
38 union {
39 /* Register/Unregister trigger. */
40 struct lttng_trigger *trigger;
41 /* Add channel. */
42 struct {
43 struct {
44 const char *name;
45 uid_t uid;
46 gid_t gid;
47 } session;
48 struct {
49 const char *name;
50 enum lttng_domain_type domain;
51 uint64_t key;
52 uint64_t capacity;
53 } channel;
54 } add_channel;
55 /* Remove channel. */
56 struct {
57 uint64_t key;
58 enum lttng_domain_type domain;
59 } remove_channel;
60 struct {
61 const char *session_name;
62 uid_t uid;
63 gid_t gid;
64 uint64_t trace_archive_chunk_id;
65 struct lttng_trace_archive_location *location;
66 } session_rotation;
67 /* Client communication update. */
68 struct {
69 notification_client_id id;
70 enum client_transmission_status status;
71 } client_communication_update;
72
73 } parameters;
74
75 /* lttng_waiter on which to wait for command reply (optional). */
76 struct lttng_waiter reply_waiter;
77 enum lttng_error_code reply_code;
78 bool is_async;
79 };
80
81 enum lttng_error_code notification_thread_command_register_trigger(
82 struct notification_thread_handle *handle,
83 struct lttng_trigger *trigger);
84
85 enum lttng_error_code notification_thread_command_unregister_trigger(
86 struct notification_thread_handle *handle,
87 struct lttng_trigger *trigger);
88
89 enum lttng_error_code notification_thread_command_add_channel(
90 struct notification_thread_handle *handle,
91 char *session_name, uid_t session_uid, gid_t session_gid,
92 char *channel_name, uint64_t key,
93 enum lttng_domain_type domain, uint64_t capacity);
94
95 enum lttng_error_code notification_thread_command_remove_channel(
96 struct notification_thread_handle *handle,
97 uint64_t key, enum lttng_domain_type domain);
98
99 enum lttng_error_code notification_thread_command_session_rotation_ongoing(
100 struct notification_thread_handle *handle,
101 const char *session_name, uid_t session_uid, gid_t session_gid,
102 uint64_t trace_archive_chunk_id);
103
104 /* Ownership of location is transferred. */
105 enum lttng_error_code notification_thread_command_session_rotation_completed(
106 struct notification_thread_handle *handle,
107 const char *session_name, uid_t session_uid, gid_t session_gid,
108 uint64_t trace_archive_chunk_id,
109 struct lttng_trace_archive_location *location);
110
111 void notification_thread_command_quit(
112 struct notification_thread_handle *handle);
113
114 #endif /* NOTIFICATION_THREAD_COMMANDS_H */
This page took 0.031448 seconds and 4 git commands to generate.