| 1 | /* |
| 2 | * Copyright (C) 2019 - 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_SESSION_DESCRIPTOR_INTERNAL_H |
| 19 | #define LTTNG_SESSION_DESCRIPTOR_INTERNAL_H |
| 20 | |
| 21 | #include <lttng/session-descriptor.h> |
| 22 | #include <lttng/lttng-error.h> |
| 23 | #include <common/uri.h> |
| 24 | #include <common/dynamic-buffer.h> |
| 25 | #include <common/buffer-view.h> |
| 26 | #include <stdbool.h> |
| 27 | |
| 28 | /* Note that these enums are used as part of the lttnctl protocol. */ |
| 29 | enum lttng_session_descriptor_type { |
| 30 | LTTNG_SESSION_DESCRIPTOR_TYPE_UNKNOWN = -1, |
| 31 | /* |
| 32 | * The output type determines whether this is a no-output, local, |
| 33 | * or networked tracing session. |
| 34 | */ |
| 35 | LTTNG_SESSION_DESCRIPTOR_TYPE_REGULAR = 1, |
| 36 | LTTNG_SESSION_DESCRIPTOR_TYPE_SNAPSHOT = 2, |
| 37 | LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE = 3, |
| 38 | }; |
| 39 | |
| 40 | enum lttng_session_descriptor_output_type { |
| 41 | LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE = 0, |
| 42 | LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL = 1, |
| 43 | LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK = 2, |
| 44 | }; |
| 45 | |
| 46 | LTTNG_HIDDEN |
| 47 | ssize_t lttng_session_descriptor_create_from_buffer( |
| 48 | const struct lttng_buffer_view *view, |
| 49 | struct lttng_session_descriptor **descriptor); |
| 50 | |
| 51 | LTTNG_HIDDEN |
| 52 | int lttng_session_descriptor_serialize( |
| 53 | const struct lttng_session_descriptor *descriptor, |
| 54 | struct lttng_dynamic_buffer *buffer); |
| 55 | |
| 56 | LTTNG_HIDDEN |
| 57 | enum lttng_session_descriptor_type |
| 58 | lttng_session_descriptor_get_type( |
| 59 | const struct lttng_session_descriptor *descriptor); |
| 60 | |
| 61 | LTTNG_HIDDEN |
| 62 | enum lttng_session_descriptor_output_type |
| 63 | lttng_session_descriptor_get_output_type( |
| 64 | const struct lttng_session_descriptor *descriptor); |
| 65 | |
| 66 | LTTNG_HIDDEN |
| 67 | void lttng_session_descriptor_get_local_output_uri( |
| 68 | const struct lttng_session_descriptor *descriptor, |
| 69 | struct lttng_uri *local_uri); |
| 70 | |
| 71 | LTTNG_HIDDEN |
| 72 | void lttng_session_descriptor_get_network_output_uris( |
| 73 | const struct lttng_session_descriptor *descriptor, |
| 74 | struct lttng_uri *control, |
| 75 | struct lttng_uri *data); |
| 76 | |
| 77 | LTTNG_HIDDEN |
| 78 | unsigned long long |
| 79 | lttng_session_descriptor_live_get_timer_interval( |
| 80 | const struct lttng_session_descriptor *descriptor); |
| 81 | |
| 82 | LTTNG_HIDDEN |
| 83 | enum lttng_session_descriptor_status |
| 84 | lttng_session_descriptor_get_session_name( |
| 85 | const struct lttng_session_descriptor *descriptor, |
| 86 | const char **name); |
| 87 | |
| 88 | LTTNG_HIDDEN |
| 89 | int lttng_session_descriptor_set_session_name( |
| 90 | struct lttng_session_descriptor *descriptor, |
| 91 | const char *name); |
| 92 | |
| 93 | LTTNG_HIDDEN |
| 94 | bool lttng_session_descriptor_is_output_destination_initialized( |
| 95 | const struct lttng_session_descriptor *descriptor); |
| 96 | |
| 97 | LTTNG_HIDDEN |
| 98 | bool lttng_session_descriptor_has_output_directory( |
| 99 | const struct lttng_session_descriptor *descriptor); |
| 100 | |
| 101 | LTTNG_HIDDEN |
| 102 | enum lttng_error_code lttng_session_descriptor_set_default_output( |
| 103 | struct lttng_session_descriptor *descriptor, |
| 104 | time_t *session_creation_time, |
| 105 | const char *absolute_home_path); |
| 106 | |
| 107 | LTTNG_HIDDEN |
| 108 | int lttng_session_descriptor_assign( |
| 109 | struct lttng_session_descriptor *dst_descriptor, |
| 110 | const struct lttng_session_descriptor *src_descriptor); |
| 111 | |
| 112 | #endif /* LTTNG_SESSION_DESCRIPTOR_INTERNAL_H */ |