2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_LOCATION_INTERNAL_H
9 #define LTTNG_LOCATION_INTERNAL_H
11 #include <common/buffer-view.hpp>
12 #include <common/dynamic-buffer.hpp>
13 #include <common/macros.hpp>
15 #include <lttng/location.h>
17 #include <sys/types.h>
21 * The public API assumes that trace archive locations are always
22 * provided as "constant". This means that the user of liblttng-ctl never
23 * has to destroy a trace archive location. Hence, users of liblttng-ctl
24 * have no visibility of the reference counting of archive locations.
26 struct lttng_trace_archive_location {
28 enum lttng_trace_archive_location_type type;
35 enum lttng_trace_archive_location_relay_protocol_type protocol;
37 uint16_t control, data;
44 struct lttng_trace_archive_location_comm {
45 /* A value from enum lttng_trace_archive_location_type */
49 /* Includes the trailing \0. */
50 uint32_t absolute_path_len;
53 /* Includes the trailing \0. */
54 uint32_t hostname_len;
57 * enum lttng_trace_archive_location_relay_protocol_type.
61 uint16_t control, data;
63 /* Includes the trailing \0. */
64 uint32_t relative_path_len;
68 * Payload is composed of:
69 * - LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL
70 * - absolute path, including \0
71 * - LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY
72 * - hostname, including \0
73 * - relative path, including \0
78 struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(const char *path);
80 struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
82 enum lttng_trace_archive_location_relay_protocol_type protocol,
83 uint16_t control_port,
85 const char *relative_path);
88 lttng_trace_archive_location_create_from_buffer(const struct lttng_buffer_view *buffer,
89 struct lttng_trace_archive_location **location);
91 ssize_t lttng_trace_archive_location_serialize(const struct lttng_trace_archive_location *location,
92 struct lttng_dynamic_buffer *buffer);
94 void lttng_trace_archive_location_get(struct lttng_trace_archive_location *location);
96 void lttng_trace_archive_location_put(struct lttng_trace_archive_location *location);
98 #endif /* LTTNG_LOCATION_INTERNAL_H */