Commit | Line | Data |
---|---|---|
5c408ad8 | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2017 Julien Desfossez <jdesfossez@efficios.com> |
5c408ad8 | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
5c408ad8 | 5 | * |
5c408ad8 JD |
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> | |
d68c9a04 | 13 | #include <stdbool.h> |
5c408ad8 JD |
14 | |
15 | #include <lttng/constant.h> | |
16 | #include <lttng/rotation.h> | |
17 | #include <common/macros.h> | |
18 | ||
d68c9a04 JD |
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 | */ | |
dd73d57b | 36 | struct lttng_trace_archive_location *archive_location; |
d68c9a04 JD |
37 | }; |
38 | ||
66ea93b1 JG |
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 | ||
5c408ad8 JD |
68 | /* |
69 | * Internal objects between lttng-ctl and the session daemon, the values | |
d68c9a04 | 70 | * are then copied to the user's lttng_rotation_handle object. |
5c408ad8 | 71 | */ |
d68c9a04 | 72 | |
5c408ad8 JD |
73 | /* For the LTTNG_ROTATE_SESSION command. */ |
74 | struct lttng_rotate_session_return { | |
d68c9a04 JD |
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. */ | |
5c408ad8 | 81 | int32_t status; |
3e3665b8 JG |
82 | /* |
83 | * Represents values defined in enum lttng_trace_archive_location_type. | |
84 | */ | |
05f8afa9 | 85 | int8_t location_type; |
dd73d57b JG |
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 | */ | |
05f8afa9 | 96 | int8_t protocol; |
dd73d57b JG |
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; | |
d68c9a04 JD |
104 | } LTTNG_PACKED; |
105 | ||
66ea93b1 JG |
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; | |
329f3443 JD |
116 | } LTTNG_PACKED; |
117 | ||
5c408ad8 | 118 | #endif /* LTTNG_ROTATE_INTERNAL_ABI_H */ |