| 1 | /* |
| 2 | * Copyright (C) 2017 Julien Desfossez <jdesfossez@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_ROTATE_INTERNAL_ABI_H |
| 9 | #define LTTNG_ROTATE_INTERNAL_ABI_H |
| 10 | |
| 11 | #include <limits.h> |
| 12 | #include <stdint.h> |
| 13 | #include <stdbool.h> |
| 14 | |
| 15 | #include <lttng/constant.h> |
| 16 | #include <lttng/rotation.h> |
| 17 | #include <common/macros.h> |
| 18 | |
| 19 | /* |
| 20 | * Object returned by the rotate session API. |
| 21 | * This is opaque to the public library. |
| 22 | */ |
| 23 | struct lttng_rotation_handle { |
| 24 | char session_name[LTTNG_NAME_MAX]; |
| 25 | /* |
| 26 | * ID of the rotate command. |
| 27 | * This matches the session->rotate_count, so the handle is valid until |
| 28 | * the next rotate command. After that, the rotation_get_state command |
| 29 | * returns the "expired" state. |
| 30 | */ |
| 31 | uint64_t rotation_id; |
| 32 | /* |
| 33 | * Where the rotated (readable) trace has been stored when the |
| 34 | * rotation is completed. |
| 35 | */ |
| 36 | struct lttng_trace_archive_location *archive_location; |
| 37 | }; |
| 38 | |
| 39 | struct lttng_rotation_schedule { |
| 40 | enum lttng_rotation_schedule_type type; |
| 41 | }; |
| 42 | |
| 43 | struct lttng_rotation_schedule_size_threshold { |
| 44 | struct lttng_rotation_schedule parent; |
| 45 | struct { |
| 46 | bool set; |
| 47 | uint64_t bytes; |
| 48 | } size; |
| 49 | }; |
| 50 | |
| 51 | struct lttng_rotation_schedule_periodic { |
| 52 | struct lttng_rotation_schedule parent; |
| 53 | struct { |
| 54 | bool set; |
| 55 | uint64_t us; |
| 56 | } period; |
| 57 | }; |
| 58 | |
| 59 | struct lttng_rotation_schedules { |
| 60 | /* |
| 61 | * Only one rotation schedule per type is supported for now. |
| 62 | * Schedules are owned by this object. |
| 63 | */ |
| 64 | unsigned int count; |
| 65 | struct lttng_rotation_schedule *schedules[2]; |
| 66 | }; |
| 67 | |
| 68 | /* |
| 69 | * Internal objects between lttng-ctl and the session daemon, the values |
| 70 | * are then copied to the user's lttng_rotation_handle object. |
| 71 | */ |
| 72 | |
| 73 | /* For the LTTNG_ROTATE_SESSION command. */ |
| 74 | struct lttng_rotate_session_return { |
| 75 | uint64_t rotation_id; |
| 76 | } LTTNG_PACKED; |
| 77 | |
| 78 | /* For the LTTNG_ROTATION_GET_INFO command. */ |
| 79 | struct lttng_rotation_get_info_return { |
| 80 | /* Represents values defined in enum lttng_rotation_state. */ |
| 81 | int32_t status; |
| 82 | /* |
| 83 | * Represents values defined in enum lttng_trace_archive_location_type. |
| 84 | */ |
| 85 | int8_t location_type; |
| 86 | union { |
| 87 | struct { |
| 88 | char absolute_path[LTTNG_PATH_MAX]; |
| 89 | } LTTNG_PACKED local; |
| 90 | struct { |
| 91 | char host[LTTNG_HOST_NAME_MAX]; |
| 92 | /* |
| 93 | * Represents values defined in |
| 94 | * enum lttng_trace_archive_location_relay_protocol_type. |
| 95 | */ |
| 96 | int8_t protocol; |
| 97 | struct { |
| 98 | uint16_t control; |
| 99 | uint16_t data; |
| 100 | } LTTNG_PACKED ports; |
| 101 | char relative_path[LTTNG_PATH_MAX]; |
| 102 | } LTTNG_PACKED relay; |
| 103 | } location; |
| 104 | } LTTNG_PACKED; |
| 105 | |
| 106 | /* For the LTTNG_SESSION_LIST_SCHEDULES command. */ |
| 107 | struct lttng_session_list_schedules_return { |
| 108 | struct { |
| 109 | uint8_t set; |
| 110 | uint64_t value; |
| 111 | } periodic; |
| 112 | struct { |
| 113 | uint8_t set; |
| 114 | uint64_t value; |
| 115 | } size; |
| 116 | } LTTNG_PACKED; |
| 117 | |
| 118 | #endif /* LTTNG_ROTATE_INTERNAL_ABI_H */ |