Commit | Line | Data |
---|---|---|
ab0ee2ca | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
ab0ee2ca | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: GPL-2.0-only |
ab0ee2ca | 5 | * |
ab0ee2ca JG |
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" | |
8abe313a JG |
15 | #include "notification-thread-internal.h" |
16 | #include "notification-thread-events.h" | |
8ada111f | 17 | #include <common/waiter.h> |
0ab399e0 | 18 | #include <stdbool.h> |
ab0ee2ca JG |
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, | |
731c1b12 JG |
28 | NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING, |
29 | NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED, | |
ab0ee2ca JG |
30 | NOTIFICATION_COMMAND_TYPE_QUIT, |
31 | }; | |
32 | ||
ab0ee2ca JG |
33 | struct notification_thread_command { |
34 | struct cds_list_head cmd_list_node; | |
35 | ||
36 | enum notification_thread_command_type type; | |
37 | union { | |
38 | /* Register/Unregister trigger. */ | |
39 | struct lttng_trigger *trigger; | |
40 | /* Add channel. */ | |
8abe313a JG |
41 | struct { |
42 | struct { | |
43 | const char *name; | |
44 | uid_t uid; | |
45 | gid_t gid; | |
46 | } session; | |
47 | struct { | |
48 | const char *name; | |
49 | enum lttng_domain_type domain; | |
50 | uint64_t key; | |
51 | uint64_t capacity; | |
52 | } channel; | |
53 | } add_channel; | |
ab0ee2ca JG |
54 | /* Remove channel. */ |
55 | struct { | |
56 | uint64_t key; | |
57 | enum lttng_domain_type domain; | |
58 | } remove_channel; | |
731c1b12 JG |
59 | struct { |
60 | const char *session_name; | |
61 | uid_t uid; | |
62 | gid_t gid; | |
63 | uint64_t trace_archive_chunk_id; | |
64 | struct lttng_trace_archive_location *location; | |
65 | } session_rotation; | |
ab0ee2ca JG |
66 | } parameters; |
67 | ||
8ada111f JG |
68 | /* lttng_waiter on which to wait for command reply (optional). */ |
69 | struct lttng_waiter reply_waiter; | |
ab0ee2ca | 70 | enum lttng_error_code reply_code; |
0ab399e0 | 71 | bool is_async; |
ab0ee2ca JG |
72 | }; |
73 | ||
74 | enum lttng_error_code notification_thread_command_register_trigger( | |
75 | struct notification_thread_handle *handle, | |
76 | struct lttng_trigger *trigger); | |
77 | ||
78 | enum lttng_error_code notification_thread_command_unregister_trigger( | |
79 | struct notification_thread_handle *handle, | |
80 | struct lttng_trigger *trigger); | |
81 | ||
82 | enum lttng_error_code notification_thread_command_add_channel( | |
83 | struct notification_thread_handle *handle, | |
731c1b12 | 84 | char *session_name, uid_t session_uid, gid_t session_gid, |
ab0ee2ca JG |
85 | char *channel_name, uint64_t key, |
86 | enum lttng_domain_type domain, uint64_t capacity); | |
87 | ||
88 | enum lttng_error_code notification_thread_command_remove_channel( | |
89 | struct notification_thread_handle *handle, | |
90 | uint64_t key, enum lttng_domain_type domain); | |
91 | ||
731c1b12 JG |
92 | enum lttng_error_code notification_thread_command_session_rotation_ongoing( |
93 | struct notification_thread_handle *handle, | |
94 | const char *session_name, uid_t session_uid, gid_t session_gid, | |
95 | uint64_t trace_archive_chunk_id); | |
96 | ||
97 | /* Ownership of location is transferred. */ | |
98 | enum lttng_error_code notification_thread_command_session_rotation_completed( | |
99 | struct notification_thread_handle *handle, | |
100 | const char *session_name, uid_t session_uid, gid_t session_gid, | |
101 | uint64_t trace_archive_chunk_id, | |
102 | struct lttng_trace_archive_location *location); | |
103 | ||
ab0ee2ca JG |
104 | void notification_thread_command_quit( |
105 | struct notification_thread_handle *handle); | |
106 | ||
107 | #endif /* NOTIFICATION_THREAD_COMMANDS_H */ |