2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #ifndef NOTIFICATION_THREAD_COMMANDS_H
9 #define NOTIFICATION_THREAD_COMMANDS_H
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>
20 struct notification_thread_data
;
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
,
34 struct notification_thread_command
{
35 struct cds_list_head cmd_list_node
;
37 enum notification_thread_command_type type
;
39 /* Register/Unregister trigger. */
40 struct lttng_trigger
*trigger
;
50 enum lttng_domain_type domain
;
58 enum lttng_domain_type domain
;
61 const char *session_name
;
64 uint64_t trace_archive_chunk_id
;
65 struct lttng_trace_archive_location
*location
;
67 /* Client communication update. */
69 notification_client_id id
;
70 enum client_transmission_status status
;
71 } client_communication_update
;
75 /* lttng_waiter on which to wait for command reply (optional). */
76 struct lttng_waiter reply_waiter
;
77 enum lttng_error_code reply_code
;
81 enum lttng_error_code
notification_thread_command_register_trigger(
82 struct notification_thread_handle
*handle
,
83 struct lttng_trigger
*trigger
);
85 enum lttng_error_code
notification_thread_command_unregister_trigger(
86 struct notification_thread_handle
*handle
,
87 struct lttng_trigger
*trigger
);
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
);
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
);
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
);
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
);
111 void notification_thread_command_quit(
112 struct notification_thread_handle
*handle
);
114 #endif /* NOTIFICATION_THREAD_COMMANDS_H */