chiark / gitweb /
tree-wide: drop 'This file is part of systemd' blurb
[elogind.git] / src / libelogind / sd-id128 / id128-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5   Copyright 2016 Lennart Poettering
6 ***/
7
8 #include <stdbool.h>
9
10 #include "sd-id128.h"
11
12 #include "hash-funcs.h"
13 #include "macro.h"
14
15 char *id128_to_uuid_string(sd_id128_t id, char s[37]);
16
17 /* Like SD_ID128_FORMAT_STR, but formats as UUID, not in plain format */
18 #define ID128_UUID_FORMAT_STR "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
19
20 bool id128_is_valid(const char *s) _pure_;
21
22 typedef enum Id128Format {
23         ID128_ANY,
24         ID128_PLAIN,  /* formatted as 32 hex chars as-is */
25         ID128_UUID,   /* formatted as 36 character uuid string */
26         _ID128_FORMAT_MAX,
27 } Id128Format;
28
29 int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret);
30 int id128_read(const char *p, Id128Format f, sd_id128_t *ret);
31
32 int id128_write_fd(int fd, Id128Format f, sd_id128_t id, bool do_sync);
33 #if 0 /// UNNEEDED by elogind
34 int id128_write(const char *p, Id128Format f, sd_id128_t id, bool do_sync);
35
36 void id128_hash_func(const void *p, struct siphash *state);
37 int id128_compare_func(const void *a, const void *b) _pure_;
38 extern const struct hash_ops id128_hash_ops;
39 #endif // 0