| 1 | /* |
| 2 | * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_LOCATION_H |
| 9 | #define LTTNG_LOCATION_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | enum lttng_trace_archive_location_type { |
| 18 | LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_UNKNOWN = 0, |
| 19 | LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL = 1, |
| 20 | LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY = 2, |
| 21 | }; |
| 22 | |
| 23 | enum lttng_trace_archive_location_status { |
| 24 | LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK = 0, |
| 25 | LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID = -1, |
| 26 | LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_ERROR = -2, |
| 27 | }; |
| 28 | |
| 29 | enum lttng_trace_archive_location_relay_protocol_type { |
| 30 | LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP = 0, |
| 31 | }; |
| 32 | |
| 33 | /* |
| 34 | * Location of a trace archive. |
| 35 | */ |
| 36 | struct lttng_trace_archive_location; |
| 37 | |
| 38 | /* |
| 39 | * Get a trace archive location's type. |
| 40 | */ |
| 41 | extern enum lttng_trace_archive_location_type |
| 42 | lttng_trace_archive_location_get_type( |
| 43 | const struct lttng_trace_archive_location *location); |
| 44 | |
| 45 | /* |
| 46 | * Get the absolute path of a local trace archive location. |
| 47 | * |
| 48 | * The trace archive location maintains ownership of the absolute_path. |
| 49 | */ |
| 50 | extern enum lttng_trace_archive_location_status |
| 51 | lttng_trace_archive_location_local_get_absolute_path( |
| 52 | const struct lttng_trace_archive_location *location, |
| 53 | const char **absolute_path); |
| 54 | |
| 55 | /* |
| 56 | * Get the host address of the relay daemon associated to this trace archive |
| 57 | * location. May be a hostname, IPv4, or IPv6 address. |
| 58 | * |
| 59 | * The trace archive location maintains ownership of relay_host. |
| 60 | */ |
| 61 | extern enum lttng_trace_archive_location_status |
| 62 | lttng_trace_archive_location_relay_get_host( |
| 63 | const struct lttng_trace_archive_location *location, |
| 64 | const char **relay_host); |
| 65 | |
| 66 | /* |
| 67 | * Get the control port of the relay daemon associated to this trace archive |
| 68 | * location. |
| 69 | */ |
| 70 | extern enum lttng_trace_archive_location_status |
| 71 | lttng_trace_archive_location_relay_get_control_port( |
| 72 | const struct lttng_trace_archive_location *location, |
| 73 | uint16_t *control_port); |
| 74 | |
| 75 | /* |
| 76 | * Get the data port of the relay daemon associated to this trace archive |
| 77 | * location. |
| 78 | */ |
| 79 | extern enum lttng_trace_archive_location_status |
| 80 | lttng_trace_archive_location_relay_get_data_port( |
| 81 | const struct lttng_trace_archive_location *location, |
| 82 | uint16_t *data_port); |
| 83 | |
| 84 | /* |
| 85 | * Get the protocol used to communicate with the relay daemon associated to this |
| 86 | * trace archive location. |
| 87 | */ |
| 88 | extern enum lttng_trace_archive_location_status |
| 89 | lttng_trace_archive_location_relay_get_protocol_type( |
| 90 | const struct lttng_trace_archive_location *location, |
| 91 | enum lttng_trace_archive_location_relay_protocol_type *protocol); |
| 92 | |
| 93 | /* |
| 94 | * Get path relative to the relay daemon's current output path. |
| 95 | * |
| 96 | * The trace archive location maintains ownership of relative_path. |
| 97 | */ |
| 98 | extern enum lttng_trace_archive_location_status |
| 99 | lttng_trace_archive_location_relay_get_relative_path( |
| 100 | const struct lttng_trace_archive_location *location, |
| 101 | const char **relative_path); |
| 102 | |
| 103 | #ifdef __cplusplus |
| 104 | } |
| 105 | #endif |
| 106 | |
| 107 | #endif /* LTTNG_LOCATION_H */ |