| 1 | /* |
| 2 | * Copyright (C) 2018 - Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU Lesser General Public License, version 2.1 only, |
| 6 | * as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This library is distributed in the hope that it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
| 11 | * for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this library; if not, write to the Free Software Foundation, |
| 15 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | */ |
| 17 | |
| 18 | #ifndef LTTNG_LOCATION_H |
| 19 | #define LTTNG_LOCATION_H |
| 20 | |
| 21 | #include <stdint.h> |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | enum lttng_trace_archive_location_type { |
| 28 | LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_UNKNOWN = 0, |
| 29 | LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL = 1, |
| 30 | LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY = 2, |
| 31 | }; |
| 32 | |
| 33 | enum lttng_trace_archive_location_status { |
| 34 | LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK = 0, |
| 35 | LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID = -1, |
| 36 | LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_ERROR = -2, |
| 37 | }; |
| 38 | |
| 39 | enum lttng_trace_archive_location_relay_protocol_type { |
| 40 | LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP = 0, |
| 41 | }; |
| 42 | |
| 43 | /* |
| 44 | * Location of a trace archive. |
| 45 | */ |
| 46 | struct lttng_trace_archive_location; |
| 47 | |
| 48 | /* |
| 49 | * Get a trace archive location's type. |
| 50 | */ |
| 51 | extern enum lttng_trace_archive_location_type |
| 52 | lttng_trace_archive_location_get_type( |
| 53 | const struct lttng_trace_archive_location *location); |
| 54 | |
| 55 | /* |
| 56 | * Get the absolute path of a local trace archive location. |
| 57 | * |
| 58 | * The trace archive location maintains ownership of the absolute_path. |
| 59 | */ |
| 60 | extern enum lttng_trace_archive_location_status |
| 61 | lttng_trace_archive_location_local_get_absolute_path( |
| 62 | const struct lttng_trace_archive_location *location, |
| 63 | const char **absolute_path); |
| 64 | |
| 65 | /* |
| 66 | * Get the host address of the relay daemon associated to this trace archive |
| 67 | * location. May be a hostname, IPv4, or IPv6 address. |
| 68 | * |
| 69 | * The trace archive location maintains ownership of relay_host. |
| 70 | */ |
| 71 | extern enum lttng_trace_archive_location_status |
| 72 | lttng_trace_archive_location_relay_get_host( |
| 73 | const struct lttng_trace_archive_location *location, |
| 74 | const char **relay_host); |
| 75 | |
| 76 | /* |
| 77 | * Get the control port of the relay daemon associated to this trace archive |
| 78 | * location. |
| 79 | */ |
| 80 | extern enum lttng_trace_archive_location_status |
| 81 | lttng_trace_archive_location_relay_get_control_port( |
| 82 | const struct lttng_trace_archive_location *location, |
| 83 | uint16_t *control_port); |
| 84 | |
| 85 | /* |
| 86 | * Get the data port of the relay daemon associated to this trace archive |
| 87 | * location. |
| 88 | */ |
| 89 | extern enum lttng_trace_archive_location_status |
| 90 | lttng_trace_archive_location_relay_get_data_port( |
| 91 | const struct lttng_trace_archive_location *location, |
| 92 | uint16_t *data_port); |
| 93 | |
| 94 | /* |
| 95 | * Get the protocol used to communicate with the relay daemon associated to this |
| 96 | * trace archive location. |
| 97 | */ |
| 98 | extern enum lttng_trace_archive_location_status |
| 99 | lttng_trace_archive_location_relay_get_protocol_type( |
| 100 | const struct lttng_trace_archive_location *location, |
| 101 | enum lttng_trace_archive_location_relay_protocol_type *protocol); |
| 102 | |
| 103 | /* |
| 104 | * Get path relative to the relay daemon's current output path. |
| 105 | * |
| 106 | * The trace archive location maintains ownership of relative_path. |
| 107 | */ |
| 108 | extern enum lttng_trace_archive_location_status |
| 109 | lttng_trace_archive_location_relay_get_relative_path( |
| 110 | const struct lttng_trace_archive_location *location, |
| 111 | const char **relative_path); |
| 112 | |
| 113 | #ifdef __cplusplus |
| 114 | } |
| 115 | #endif |
| 116 | |
| 117 | #endif /* LTTNG_LOCATION_H */ |