Commit | Line | Data |
---|---|---|
1239a312 | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2014 David Goulet <dgoulet@efficios.com> |
1239a312 | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
1239a312 | 5 | * |
1239a312 DG |
6 | */ |
7 | ||
8 | #ifndef LTTNG_HANDLE_H | |
9 | #define LTTNG_HANDLE_H | |
10 | ||
11 | #include <lttng/domain.h> | |
4bd69c5f | 12 | #include <lttng/lttng-export.h> |
1239a312 DG |
13 | |
14 | #ifdef __cplusplus | |
15 | extern "C" { | |
16 | #endif | |
17 | ||
18 | /* | |
19 | * Handle used as a context for commands. | |
20 | * | |
21 | * The structures should be initialized to zero before use. | |
22 | */ | |
28f23191 | 23 | #define LTTNG_HANDLE_PADDING1 16 |
1239a312 | 24 | struct lttng_handle { |
36d2e35d | 25 | char session_name[LTTNG_NAME_MAX]; |
1239a312 DG |
26 | struct lttng_domain domain; |
27 | ||
28 | char padding[LTTNG_HANDLE_PADDING1]; | |
29 | }; | |
30 | ||
31 | /* | |
32 | * Create an handle used as a context for every request made to the library. | |
33 | * | |
34 | * This handle contains the session name and domain on which the command will | |
35 | * be executed. A domain is basically a tracer like the kernel or user space. | |
36 | * | |
95681498 JG |
37 | * A NULL domain indicates that the handle is not bound to a specific domain. |
38 | * This is mostly used for actions that apply on a session and not on a domain | |
39 | * (e.g lttng_set_consumer_url). | |
40 | * | |
41 | * Return a newly allocated handle that should be freed using | |
1239a312 DG |
42 | * lttng_destroy_handle. On error, NULL is returned. |
43 | */ | |
4bd69c5f | 44 | LTTNG_EXPORT extern struct lttng_handle *lttng_create_handle(const char *session_name, |
28f23191 | 45 | struct lttng_domain *domain); |
1239a312 DG |
46 | |
47 | /* | |
48 | * Destroy an handle that has been previously created with lttng_create_handle. | |
49 | * | |
50 | * It free the given pointer making it unusable. | |
51 | */ | |
4bd69c5f | 52 | LTTNG_EXPORT extern void lttng_destroy_handle(struct lttng_handle *handle); |
1239a312 | 53 | |
1239a312 DG |
54 | #ifdef __cplusplus |
55 | } | |
56 | #endif | |
57 | ||
58 | #endif /* LTTNG_HANDLE_H */ |