| 1 | /* |
| 2 | * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-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.hpp" |
| 14 | |
| 15 | #include "optional.hpp" |
| 16 | |
| 17 | struct lttng_credentials { |
| 18 | LTTNG_OPTIONAL(uid_t) uid; |
| 19 | LTTNG_OPTIONAL(gid_t) gid; |
| 20 | }; |
| 21 | |
| 22 | uid_t lttng_credentials_get_uid(const struct lttng_credentials *creds); |
| 23 | |
| 24 | gid_t lttng_credentials_get_gid(const struct lttng_credentials *creds); |
| 25 | |
| 26 | bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a, |
| 27 | const struct lttng_credentials *b); |
| 28 | |
| 29 | bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a, |
| 30 | const struct lttng_credentials *b); |
| 31 | |
| 32 | bool lttng_credentials_is_equal(const struct lttng_credentials *a, |
| 33 | const struct lttng_credentials *b); |
| 34 | |
| 35 | #endif /* LTTNG_CREDENTIALS_H */ |