Commit | Line | Data |
---|---|---|
b178f53e | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
b178f53e | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
b178f53e | 5 | * |
b178f53e JG |
6 | */ |
7 | ||
8 | #ifndef LTTNG_SESSION_INTERNAL_H | |
9 | #define LTTNG_SESSION_INTERNAL_H | |
10 | ||
2d321d3e | 11 | #include <common/buffer-view.hpp> |
c9e313bc | 12 | #include <common/macros.hpp> |
2d321d3e JR |
13 | #include <common/optional.hpp> |
14 | #include <lttng/constant.h> | |
15 | #include <lttng/lttng-error.h> | |
989ddaeb | 16 | #include <lttng/trace-format-descriptor-internal.hpp> |
2d321d3e JR |
17 | |
18 | struct lttng_session; | |
19 | struct lttng_payload_view; | |
b178f53e JG |
20 | |
21 | struct lttng_session_extended { | |
2d321d3e | 22 | LTTNG_OPTIONAL(uint64_t) creation_time; |
989ddaeb JR |
23 | /* |
24 | * This is done this way to satisfy the API memory restriction for lttng_session on listing. | |
25 | * The caller must be able to simply call free on the return object and all memory be freed. | |
26 | */ | |
27 | struct lttng_buffer_view serialized_trace_format_descriptor; | |
2d321d3e JR |
28 | }; |
29 | ||
30 | struct lttng_session_comm { | |
31 | uint32_t name_len; | |
32 | uint32_t path_len; | |
33 | uint8_t enabled; | |
34 | uint32_t snapshot_mode; | |
35 | uint32_t live_timer_interval; | |
989ddaeb | 36 | uint32_t trace_format_descriptor_len; |
2d321d3e JR |
37 | /* lttng_session_extended data */ |
38 | LTTNG_OPTIONAL(uint64_t) LTTNG_PACKED creation_time; | |
39 | /* | |
40 | * Dynamic payload: | |
41 | * - name[name_len] | |
42 | * - path[path_len] | |
989ddaeb | 43 | * - trace_format_descriptor |
2d321d3e JR |
44 | */ |
45 | char payload[]; | |
b178f53e JG |
46 | } LTTNG_PACKED; |
47 | ||
2d321d3e JR |
48 | int lttng_session_serialize(const struct lttng_session *session, struct lttng_payload *payload); |
49 | ||
50 | ssize_t lttng_session_create_from_payload( | |
51 | struct lttng_payload_view *view, struct lttng_session **out_session); | |
52 | ||
53 | enum lttng_error_code lttng_sessions_create_and_flatten_from_payload( | |
54 | struct lttng_payload_view *view, | |
55 | unsigned int count, | |
56 | struct lttng_session **sessions); | |
57 | ||
b178f53e | 58 | #endif /* LTTNG_SESSION_INTERNAL_H */ |