| 1 | /* |
| 2 | * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_CREDENTIALS_H |
| 9 | #define LTTNG_CREDENTIALS_H |
| 10 | |
| 11 | #include <sys/types.h> |
| 12 | #include <stdbool.h> |
| 13 | #include "macros.h" |
| 14 | |
| 15 | #include "optional.h" |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | struct lttng_credentials { |
| 22 | LTTNG_OPTIONAL(uid_t) uid; |
| 23 | LTTNG_OPTIONAL(gid_t) gid; |
| 24 | }; |
| 25 | |
| 26 | uid_t lttng_credentials_get_uid(const struct lttng_credentials *creds); |
| 27 | |
| 28 | gid_t lttng_credentials_get_gid(const struct lttng_credentials *creds); |
| 29 | |
| 30 | bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a, |
| 31 | const struct lttng_credentials *b); |
| 32 | |
| 33 | bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a, |
| 34 | const struct lttng_credentials *b); |
| 35 | |
| 36 | bool lttng_credentials_is_equal(const struct lttng_credentials *a, |
| 37 | const struct lttng_credentials *b); |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | #endif /* LTTNG_CREDENTIALS_H */ |