]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd/sd-id128/id128-util.h
core: add "invocation ID" concept to service manager
[thirdparty/systemd.git] / src / libsystemd / sd-id128 / id128-util.h
CommitLineData
910fd145
LP
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2016 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
22#include <stdbool.h>
23
24#include "sd-id128.h"
4b58153d
LP
25
26#include "hash-funcs.h"
910fd145
LP
27#include "macro.h"
28
29char *id128_to_uuid_string(sd_id128_t id, char s[37]);
30
31/* Like SD_ID128_FORMAT_STR, but formats as UUID, not in plain format */
32#define ID128_UUID_FORMAT_STR "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
33
34bool id128_is_valid(const char *s) _pure_;
35
36typedef enum Id128Format {
37 ID128_ANY,
38 ID128_PLAIN, /* formatted as 32 hex chars as-is */
39 ID128_UUID, /* formatted as 36 character uuid string */
40 _ID128_FORMAT_MAX,
41} Id128Format;
42
43int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret);
44int id128_read(const char *p, Id128Format f, sd_id128_t *ret);
45
15b1248a
LP
46int id128_write_fd(int fd, Id128Format f, sd_id128_t id, bool do_sync);
47int id128_write(const char *p, Id128Format f, sd_id128_t id, bool do_sync);
4b58153d
LP
48
49void id128_hash_func(const void *p, struct siphash *state);
50int id128_compare_func(const void *a, const void *b) _pure_;
51extern const struct hash_ops id128_hash_ops;