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 <lttng/location.h>
12 #include <common/dynamic-buffer.h>
13 #include <common/buffer-view.h>
14 #include <common/macros.h>
15 #include <sys/types.h>
23 * The public API assumes that trace archive locations are always
24 * provided as "constant". This means that the user of liblttng-ctl never
25 * has to destroy a trace archive location. Hence, users of liblttng-ctl
26 * have no visibility of the reference counting of archive locations.
28 struct lttng_trace_archive_location
{
30 enum lttng_trace_archive_location_type type
;
37 enum lttng_trace_archive_location_relay_protocol_type protocol
;
39 uint16_t control
, data
;
46 struct lttng_trace_archive_location_comm
{
47 /* A value from enum lttng_trace_archive_location_type */
51 /* Includes the trailing \0. */
52 uint32_t absolute_path_len
;
55 /* Includes the trailing \0. */
56 uint32_t hostname_len
;
59 * enum lttng_trace_archive_location_relay_protocol_type.
63 uint16_t control
, data
;
65 /* Includes the trailing \0. */
66 uint32_t relative_path_len
;
70 * Payload is composed of:
71 * - LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL
72 * - absolute path, including \0
73 * - LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY
74 * - hostname, including \0
75 * - relative path, including \0
81 struct lttng_trace_archive_location
*lttng_trace_archive_location_local_create(
84 struct lttng_trace_archive_location
*lttng_trace_archive_location_relay_create(
86 enum lttng_trace_archive_location_relay_protocol_type protocol
,
87 uint16_t control_port
, uint16_t data_port
,
88 const char *relative_path
);
90 ssize_t
lttng_trace_archive_location_create_from_buffer(
91 const struct lttng_buffer_view
*buffer
,
92 struct lttng_trace_archive_location
**location
);
94 ssize_t
lttng_trace_archive_location_serialize(
95 const struct lttng_trace_archive_location
*location
,
96 struct lttng_dynamic_buffer
*buffer
);
98 void lttng_trace_archive_location_get(
99 struct lttng_trace_archive_location
*location
);
101 void lttng_trace_archive_location_put(
102 struct lttng_trace_archive_location
*location
);
108 #endif /* LTTNG_LOCATION_INTERNAL_H */