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> |
ab0ee2ca JG |
18 | |
19 | struct notification_thread_data; | |
20 | struct lttng_trigger; | |
21 | ||
22 | enum notification_thread_command_type { | |
23 | NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER, | |
24 | NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER, | |
25 | NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL, | |
26 | NOTIFICATION_COMMAND_TYPE_REMOVE_CHANNEL, | |
731c1b12 JG |
27 | NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING, |
28 | NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED, | |
ab0ee2ca JG |
29 | NOTIFICATION_COMMAND_TYPE_QUIT, |
30 | }; | |
31 | ||
ab0ee2ca JG |
32 | struct notification_thread_command { |
33 | struct cds_list_head cmd_list_node; | |
34 | ||
35 | enum notification_thread_command_type type; | |
36 | union { | |
37 | /* Register/Unregister trigger. */ | |
38 | struct lttng_trigger *trigger; | |
39 | /* Add channel. */ | |
8abe313a JG |
40 | struct { |
41 | struct { | |
42 | const char *name; | |
43 | uid_t uid; | |
44 | gid_t gid; | |
45 | } session; | |
46 | struct { | |
47 | const char *name; | |
48 | enum lttng_domain_type domain; | |
49 | uint64_t key; | |
50 | uint64_t capacity; | |
51 | } channel; | |
52 | } add_channel; | |
ab0ee2ca JG |
53 | /* Remove channel. */ |
54 | struct { | |
55 | uint64_t key; | |
56 | enum lttng_domain_type domain; | |
57 | } remove_channel; | |
731c1b12 JG |
58 | struct { |
59 | const char *session_name; | |
60 | uid_t uid; | |
61 | gid_t gid; | |
62 | uint64_t trace_archive_chunk_id; | |
b0563fed | 63 | /* Weak reference. */ |
731c1b12 JG |
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 JG |
70 | enum lttng_error_code reply_code; |
71 | }; | |
72 | ||
73 | enum lttng_error_code notification_thread_command_register_trigger( | |
74 | struct notification_thread_handle *handle, | |
75 | struct lttng_trigger *trigger); | |
76 | ||
77 | enum lttng_error_code notification_thread_command_unregister_trigger( | |
78 | struct notification_thread_handle *handle, | |
79 | struct lttng_trigger *trigger); | |
80 | ||
81 | enum lttng_error_code notification_thread_command_add_channel( | |
82 | struct notification_thread_handle *handle, | |
731c1b12 | 83 | char *session_name, uid_t session_uid, gid_t session_gid, |
ab0ee2ca JG |
84 | char *channel_name, uint64_t key, |
85 | enum lttng_domain_type domain, uint64_t capacity); | |
86 | ||
87 | enum lttng_error_code notification_thread_command_remove_channel( | |
88 | struct notification_thread_handle *handle, | |
89 | uint64_t key, enum lttng_domain_type domain); | |
90 | ||
731c1b12 JG |
91 | enum lttng_error_code notification_thread_command_session_rotation_ongoing( |
92 | struct notification_thread_handle *handle, | |
93 | const char *session_name, uid_t session_uid, gid_t session_gid, | |
94 | uint64_t trace_archive_chunk_id); | |
95 | ||
96 | /* Ownership of location is transferred. */ | |
97 | enum lttng_error_code notification_thread_command_session_rotation_completed( | |
98 | struct notification_thread_handle *handle, | |
99 | const char *session_name, uid_t session_uid, gid_t session_gid, | |
100 | uint64_t trace_archive_chunk_id, | |
101 | struct lttng_trace_archive_location *location); | |
102 | ||
ab0ee2ca JG |
103 | void notification_thread_command_quit( |
104 | struct notification_thread_handle *handle); | |
105 | ||
106 | #endif /* NOTIFICATION_THREAD_COMMANDS_H */ |