bin: compile lttng-sessiond as C++
[lttng-tools.git] / include / lttng / location-internal.h
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
11#include <lttng/location.h>
1e9f1cf8
JG
12#include <common/dynamic-buffer.h>
13#include <common/buffer-view.h>
434131e4 14#include <common/macros.h>
89293443 15#include <sys/types.h>
d3740619 16#include <urcu/ref.h>
434131e4 17
7966af57
SM
18#ifdef __cplusplus
19extern "C" {
20#endif
21
d3740619
JR
22/*
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.
27 */
434131e4 28struct lttng_trace_archive_location {
d3740619 29 struct urcu_ref ref;
434131e4
JG
30 enum lttng_trace_archive_location_type type;
31 union {
32 struct {
33 char *absolute_path;
34 } local;
35 struct {
36 char *host;
37 enum lttng_trace_archive_location_relay_protocol_type protocol;
38 struct {
39 uint16_t control, data;
40 } ports;
41 char *relative_path;
42 } relay;
43 } types;
44};
45
1e9f1cf8
JG
46struct lttng_trace_archive_location_comm {
47 /* A value from enum lttng_trace_archive_location_type */
48 int8_t type;
49 union {
50 struct {
51 /* Includes the trailing \0. */
52 uint32_t absolute_path_len;
53 } LTTNG_PACKED local;
54 struct {
55 /* Includes the trailing \0. */
56 uint32_t hostname_len;
57 /*
58 * A value from
59 * enum lttng_trace_archive_location_relay_protocol_type.
60 */
61 int8_t protocol;
62 struct {
63 uint16_t control, data;
64 } ports;
65 /* Includes the trailing \0. */
66 uint32_t relative_path_len;
67 } LTTNG_PACKED relay;
68 } LTTNG_PACKED types;
69 /*
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
76 */
77 char payload[];
78} LTTNG_PACKED;
79
80
434131e4
JG
81struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(
82 const char *path);
83
434131e4
JG
84struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
85 const char *host,
86 enum lttng_trace_archive_location_relay_protocol_type protocol,
87 uint16_t control_port, uint16_t data_port,
88 const char *relative_path);
89
1e9f1cf8
JG
90ssize_t lttng_trace_archive_location_create_from_buffer(
91 const struct lttng_buffer_view *buffer,
92 struct lttng_trace_archive_location **location);
93
1e9f1cf8
JG
94ssize_t lttng_trace_archive_location_serialize(
95 const struct lttng_trace_archive_location *location,
96 struct lttng_dynamic_buffer *buffer);
97
d3740619
JR
98void lttng_trace_archive_location_get(
99 struct lttng_trace_archive_location *location);
100
d3740619 101void lttng_trace_archive_location_put(
434131e4
JG
102 struct lttng_trace_archive_location *location);
103
7966af57
SM
104#ifdef __cplusplus
105}
106#endif
107
434131e4 108#endif /* LTTNG_LOCATION_INTERNAL_H */
This page took 0.033913 seconds and 4 git commands to generate.