Fix: lttng: uninitialized pointer free'd when no sessiond is present
[lttng-tools.git] / include / lttng / session-descriptor-internal.h
1 /*
2 * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_SESSION_DESCRIPTOR_INTERNAL_H
9 #define LTTNG_SESSION_DESCRIPTOR_INTERNAL_H
10
11 #include <lttng/session-descriptor.h>
12 #include <lttng/lttng-error.h>
13 #include <common/uri.h>
14 #include <common/dynamic-buffer.h>
15 #include <common/buffer-view.h>
16 #include <stdbool.h>
17
18 /* Note that these enums are used as part of the lttnctl protocol. */
19 enum lttng_session_descriptor_type {
20 LTTNG_SESSION_DESCRIPTOR_TYPE_UNKNOWN = -1,
21 /*
22 * The output type determines whether this is a no-output, local,
23 * or networked tracing session.
24 */
25 LTTNG_SESSION_DESCRIPTOR_TYPE_REGULAR = 1,
26 LTTNG_SESSION_DESCRIPTOR_TYPE_SNAPSHOT = 2,
27 LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE = 3,
28 };
29
30 enum lttng_session_descriptor_output_type {
31 LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE = 0,
32 LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL = 1,
33 LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK = 2,
34 };
35
36 LTTNG_HIDDEN
37 ssize_t lttng_session_descriptor_create_from_buffer(
38 const struct lttng_buffer_view *view,
39 struct lttng_session_descriptor **descriptor);
40
41 LTTNG_HIDDEN
42 int lttng_session_descriptor_serialize(
43 const struct lttng_session_descriptor *descriptor,
44 struct lttng_dynamic_buffer *buffer);
45
46 LTTNG_HIDDEN
47 enum lttng_session_descriptor_type
48 lttng_session_descriptor_get_type(
49 const struct lttng_session_descriptor *descriptor);
50
51 LTTNG_HIDDEN
52 enum lttng_session_descriptor_output_type
53 lttng_session_descriptor_get_output_type(
54 const struct lttng_session_descriptor *descriptor);
55
56 LTTNG_HIDDEN
57 void lttng_session_descriptor_get_local_output_uri(
58 const struct lttng_session_descriptor *descriptor,
59 struct lttng_uri *local_uri);
60
61 LTTNG_HIDDEN
62 void lttng_session_descriptor_get_network_output_uris(
63 const struct lttng_session_descriptor *descriptor,
64 struct lttng_uri *control,
65 struct lttng_uri *data);
66
67 LTTNG_HIDDEN
68 unsigned long long
69 lttng_session_descriptor_live_get_timer_interval(
70 const struct lttng_session_descriptor *descriptor);
71
72 LTTNG_HIDDEN
73 enum lttng_session_descriptor_status
74 lttng_session_descriptor_get_session_name(
75 const struct lttng_session_descriptor *descriptor,
76 const char **name);
77
78 LTTNG_HIDDEN
79 int lttng_session_descriptor_set_session_name(
80 struct lttng_session_descriptor *descriptor,
81 const char *name);
82
83 LTTNG_HIDDEN
84 bool lttng_session_descriptor_is_output_destination_initialized(
85 const struct lttng_session_descriptor *descriptor);
86
87 LTTNG_HIDDEN
88 bool lttng_session_descriptor_has_output_directory(
89 const struct lttng_session_descriptor *descriptor);
90
91 LTTNG_HIDDEN
92 enum lttng_error_code lttng_session_descriptor_set_default_output(
93 struct lttng_session_descriptor *descriptor,
94 time_t *session_creation_time,
95 const char *absolute_home_path);
96
97 LTTNG_HIDDEN
98 int lttng_session_descriptor_assign(
99 struct lttng_session_descriptor *dst_descriptor,
100 const struct lttng_session_descriptor *src_descriptor);
101
102 #endif /* LTTNG_SESSION_DESCRIPTOR_INTERNAL_H */
This page took 0.032807 seconds and 5 git commands to generate.