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