a90d1ac2b2f662697fd54412596cba2e06689b9d
[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
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,
27 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING,
28 NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED,
29 NOTIFICATION_COMMAND_TYPE_QUIT,
30 };
31
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. */
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;
53 /* Remove channel. */
54 struct {
55 uint64_t key;
56 enum lttng_domain_type domain;
57 } remove_channel;
58 struct {
59 const char *session_name;
60 uid_t uid;
61 gid_t gid;
62 uint64_t trace_archive_chunk_id;
63 struct lttng_trace_archive_location *location;
64 } session_rotation;
65 } parameters;
66
67 /* lttng_waiter on which to wait for command reply (optional). */
68 struct lttng_waiter reply_waiter;
69 enum lttng_error_code reply_code;
70 };
71
72 enum lttng_error_code notification_thread_command_register_trigger(
73 struct notification_thread_handle *handle,
74 struct lttng_trigger *trigger);
75
76 enum lttng_error_code notification_thread_command_unregister_trigger(
77 struct notification_thread_handle *handle,
78 struct lttng_trigger *trigger);
79
80 enum lttng_error_code notification_thread_command_add_channel(
81 struct notification_thread_handle *handle,
82 char *session_name, uid_t session_uid, gid_t session_gid,
83 char *channel_name, uint64_t key,
84 enum lttng_domain_type domain, uint64_t capacity);
85
86 enum lttng_error_code notification_thread_command_remove_channel(
87 struct notification_thread_handle *handle,
88 uint64_t key, enum lttng_domain_type domain);
89
90 enum lttng_error_code notification_thread_command_session_rotation_ongoing(
91 struct notification_thread_handle *handle,
92 const char *session_name, uid_t session_uid, gid_t session_gid,
93 uint64_t trace_archive_chunk_id);
94
95 /* Ownership of location is transferred. */
96 enum lttng_error_code notification_thread_command_session_rotation_completed(
97 struct notification_thread_handle *handle,
98 const char *session_name, uid_t session_uid, gid_t session_gid,
99 uint64_t trace_archive_chunk_id,
100 struct lttng_trace_archive_location *location);
101
102 void notification_thread_command_quit(
103 struct notification_thread_handle *handle);
104
105 #endif /* NOTIFICATION_THREAD_COMMANDS_H */
This page took 0.052232 seconds and 4 git commands to generate.