Clean-up: run format-cpp on the tree
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.hpp
CommitLineData
2f77fc4b 1/*
ab5be9fa 2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
2f77fc4b 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
2f77fc4b 5 *
2f77fc4b
DG
6 */
7
8#ifndef CMD_H
9#define CMD_H
10
c9e313bc
SM
11#include "context.hpp"
12#include "lttng-sessiond.hpp"
159b042f 13#include "lttng/tracker.h"
c9e313bc 14#include "session.hpp"
28f23191 15
c9e313bc 16#include <common/tracker.hpp>
2f77fc4b 17
b0880ae5 18struct notification_thread_handle;
999af9c1 19struct lttng_dynamic_buffer;
b0880ae5 20
a503e1ef
JG
21/*
22 * A callback (and associated user data) that should be run after a command
23 * has been executed. No locks should be taken while executing this handler.
24 *
25 * The command's reply should not be sent until the handler has run and
26 * completed successfully. On failure, the handler's return code should
27 * be the only reply sent to the client.
28 */
e665dfbc 29using completion_handler_function = enum lttng_error_code (*)(void *);
a503e1ef
JG
30struct cmd_completion_handler {
31 completion_handler_function run;
32 void *data;
33};
34
2f77fc4b
DG
35/*
36 * Init the command subsystem. Must be called before using any of the functions
37 * above. This is called in the main() of the session daemon.
38 */
39void cmd_init(void);
40
41/* Session commands */
28f23191
JG
42enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
43 int sock,
44 struct lttng_session_descriptor **return_descriptor);
0038180d 45int cmd_destroy_session(struct ltt_session *session, int *sock_fd);
2f77fc4b
DG
46
47/* Channel commands */
56a37563 48int cmd_disable_channel(struct ltt_session *session,
28f23191
JG
49 enum lttng_domain_type domain,
50 char *channel_name);
999af9c1 51int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe);
159b042f
JG
52
53/* Process attribute tracker commands */
28f23191
JG
54enum lttng_error_code
55cmd_process_attr_tracker_get_tracking_policy(struct ltt_session *session,
56 enum lttng_domain_type domain,
57 enum lttng_process_attr process_attr,
58 enum lttng_tracking_policy *policy);
59enum lttng_error_code
60cmd_process_attr_tracker_set_tracking_policy(struct ltt_session *session,
61 enum lttng_domain_type domain,
62 enum lttng_process_attr process_attr,
63 enum lttng_tracking_policy policy);
64enum lttng_error_code
65cmd_process_attr_tracker_inclusion_set_add_value(struct ltt_session *session,
66 enum lttng_domain_type domain,
67 enum lttng_process_attr process_attr,
68 const struct process_attr_value *value);
69enum lttng_error_code
70cmd_process_attr_tracker_inclusion_set_remove_value(struct ltt_session *session,
71 enum lttng_domain_type domain,
72 enum lttng_process_attr process_attr,
73 const struct process_attr_value *value);
74enum lttng_error_code
75cmd_process_attr_tracker_get_inclusion_set(struct ltt_session *session,
76 enum lttng_domain_type domain,
77 enum lttng_process_attr process_attr,
78 struct lttng_process_attr_values **values);
2f77fc4b
DG
79
80/* Event commands */
8ddd72ef 81int cmd_disable_event(struct command_ctx *cmd_ctx,
28f23191
JG
82 struct lttng_event *event,
83 char *filter_expression,
84 struct lttng_bytecode *filter,
85 struct lttng_event_exclusion *exclusion);
26e1c61f 86int cmd_add_context(struct command_ctx *cmd_ctx,
28f23191
JG
87 const struct lttng_event_context *event_context,
88 int kwpipe);
89int cmd_set_filter(struct ltt_session *session,
90 enum lttng_domain_type domain,
91 char *channel_name,
92 struct lttng_event *event,
93 struct lttng_bytecode *bytecode);
8ddd72ef 94int cmd_enable_event(struct command_ctx *cmd_ctx,
28f23191
JG
95 struct lttng_event *event,
96 char *filter_expression,
97 struct lttng_event_exclusion *exclusion,
98 struct lttng_bytecode *bytecode,
99 int wpipe);
2f77fc4b
DG
100
101/* Trace session action commands */
102int cmd_start_trace(struct ltt_session *session);
103int cmd_stop_trace(struct ltt_session *session);
104
105/* Consumer commands */
56a37563 106int cmd_register_consumer(struct ltt_session *session,
28f23191
JG
107 enum lttng_domain_type domain,
108 const char *sock_path,
109 struct consumer_data *cdata);
110int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris);
ffe60014 111int cmd_setup_relayd(struct ltt_session *session);
2f77fc4b
DG
112
113/* Listing commands */
28f23191 114ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **domains);
8ddd72ef 115enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
28f23191
JG
116 struct ltt_session *session,
117 char *channel_name,
118 struct lttng_payload *payload);
999af9c1 119enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
28f23191
JG
120 struct ltt_session *session,
121 struct lttng_payload *payload);
b178f53e 122void cmd_list_lttng_sessions(struct lttng_session *sessions,
28f23191
JG
123 size_t session_count,
124 uid_t uid,
125 gid_t gid);
b2d68839 126enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
28f23191 127 struct lttng_payload *reply);
8ddd72ef 128enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
28f23191 129 struct lttng_payload *reply_payload);
6dc3064a 130ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
28f23191
JG
131 struct lttng_snapshot_output **outputs);
132enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload);
2f77fc4b 133
6d805429 134int cmd_data_pending(struct ltt_session *session);
2f77fc4b 135
6dc3064a
DG
136/* Snapshot */
137int cmd_snapshot_add_output(struct ltt_session *session,
28f23191
JG
138 const struct lttng_snapshot_output *output,
139 uint32_t *id);
6dc3064a 140int cmd_snapshot_del_output(struct ltt_session *session,
28f23191 141 const struct lttng_snapshot_output *output);
6dc3064a 142int cmd_snapshot_record(struct ltt_session *session,
28f23191
JG
143 const struct lttng_snapshot_output *output,
144 int wait);
6dc3064a 145
28f23191 146int cmd_set_session_shm_path(struct ltt_session *session, const char *shm_path);
eded6438 147int cmd_regenerate_metadata(struct ltt_session *session);
c2561365 148int cmd_regenerate_statedump(struct ltt_session *session);
d7ba1388 149
28f23191
JG
150enum lttng_error_code
151cmd_register_trigger(const struct lttng_credentials *cmd_creds,
152 struct lttng_trigger *trigger,
153 bool is_anonymous_trigger,
154 struct notification_thread_handle *notification_thread_handle,
155 struct lttng_trigger **return_trigger);
156enum lttng_error_code
157cmd_unregister_trigger(const struct lttng_credentials *cmd_creds,
158 const struct lttng_trigger *trigger,
159 struct notification_thread_handle *notification_thread_handle);
160
161enum lttng_error_code
162cmd_list_triggers(struct command_ctx *cmd_ctx,
163 struct notification_thread_handle *notification_thread_handle,
164 struct lttng_triggers **return_triggers);
165enum lttng_error_code
166cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
167 const struct lttng_error_query *query,
168 struct lttng_error_query_results **_results,
169 struct notification_thread_handle *notification_thread);
fbc9f37d 170
5c408ad8 171int cmd_rotate_session(struct ltt_session *session,
28f23191
JG
172 struct lttng_rotate_session_return *rotate_return,
173 bool quiet_rotation,
174 enum lttng_trace_chunk_command_type command);
d68c9a04 175int cmd_rotate_get_info(struct ltt_session *session,
28f23191
JG
176 struct lttng_rotation_get_info_return *info_return,
177 uint64_t rotate_id);
66ea93b1 178int cmd_rotation_set_schedule(struct ltt_session *session,
28f23191
JG
179 bool activate,
180 enum lttng_rotation_schedule_type schedule_type,
181 uint64_t value);
5c408ad8 182
a503e1ef 183const struct cmd_completion_handler *cmd_pop_completion_handler(void);
4dbe1875
MD
184int start_kernel_session(struct ltt_kernel_session *ksess);
185int stop_kernel_session(struct ltt_kernel_session *ksess);
a503e1ef 186
2f77fc4b 187#endif /* CMD_H */
This page took 0.082257 seconds and 4 git commands to generate.