| 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 { |
| 34 | char session_name[NAME_MAX]; |
| 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 | * |
| 46 | * Return an newly allocated handle that should be freed using |
| 47 | * lttng_destroy_handle. On error, NULL is returned. |
| 48 | */ |
| 49 | extern struct lttng_handle *lttng_create_handle(const char *session_name, |
| 50 | struct lttng_domain *domain); |
| 51 | |
| 52 | /* |
| 53 | * Destroy an handle that has been previously created with lttng_create_handle. |
| 54 | * |
| 55 | * It free the given pointer making it unusable. |
| 56 | */ |
| 57 | extern void lttng_destroy_handle(struct lttng_handle *handle); |
| 58 | |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | |
| 64 | #endif /* LTTNG_HANDLE_H */ |