docs: Add supported versions and fix-backport policy
[lttng-tools.git] / include / lttng / location-internal.hpp
CommitLineData
434131e4 1/*
ab5be9fa 2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
434131e4 3 *
ab5be9fa 4 * SPDX-License-Identifier: LGPL-2.1-only
434131e4 5 *
434131e4
JG
6 */
7
8#ifndef LTTNG_LOCATION_INTERNAL_H
9#define LTTNG_LOCATION_INTERNAL_H
10
c9e313bc 11#include <common/buffer-view.hpp>
28f23191 12#include <common/dynamic-buffer.hpp>
c9e313bc 13#include <common/macros.hpp>
28f23191
JG
14
15#include <lttng/location.h>
16
89293443 17#include <sys/types.h>
d3740619 18#include <urcu/ref.h>
434131e4 19
d3740619
JR
20/*
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.
25 */
434131e4 26struct lttng_trace_archive_location {
d3740619 27 struct urcu_ref ref;
434131e4
JG
28 enum lttng_trace_archive_location_type type;
29 union {
30 struct {
31 char *absolute_path;
32 } local;
33 struct {
34 char *host;
35 enum lttng_trace_archive_location_relay_protocol_type protocol;
36 struct {
37 uint16_t control, data;
38 } ports;
39 char *relative_path;
40 } relay;
41 } types;
42};
43
1e9f1cf8
JG
44struct lttng_trace_archive_location_comm {
45 /* A value from enum lttng_trace_archive_location_type */
46 int8_t type;
47 union {
48 struct {
49 /* Includes the trailing \0. */
50 uint32_t absolute_path_len;
51 } LTTNG_PACKED local;
52 struct {
53 /* Includes the trailing \0. */
54 uint32_t hostname_len;
55 /*
56 * A value from
57 * enum lttng_trace_archive_location_relay_protocol_type.
58 */
59 int8_t protocol;
60 struct {
61 uint16_t control, data;
62 } ports;
63 /* Includes the trailing \0. */
64 uint32_t relative_path_len;
65 } LTTNG_PACKED relay;
66 } LTTNG_PACKED types;
67 /*
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
74 */
75 char payload[];
76} LTTNG_PACKED;
77
28f23191 78struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(const char *path);
434131e4 79
434131e4 80struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
28f23191
JG
81 const char *host,
82 enum lttng_trace_archive_location_relay_protocol_type protocol,
83 uint16_t control_port,
84 uint16_t data_port,
85 const char *relative_path);
434131e4 86
28f23191
JG
87ssize_t
88lttng_trace_archive_location_create_from_buffer(const struct lttng_buffer_view *buffer,
89 struct lttng_trace_archive_location **location);
1e9f1cf8 90
28f23191
JG
91ssize_t lttng_trace_archive_location_serialize(const struct lttng_trace_archive_location *location,
92 struct lttng_dynamic_buffer *buffer);
1e9f1cf8 93
28f23191 94void lttng_trace_archive_location_get(struct lttng_trace_archive_location *location);
d3740619 95
28f23191 96void lttng_trace_archive_location_put(struct lttng_trace_archive_location *location);
434131e4
JG
97
98#endif /* LTTNG_LOCATION_INTERNAL_H */
This page took 0.052471 seconds and 4 git commands to generate.