chiark / gitweb /
Drop FOREACH_WORD_QUOTED
[elogind.git] / src / basic / hexdecoct.h
1 #pragma once
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2010 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 #include <stddef.h>
24 #include <stdio.h>
25 #include <sys/types.h>
26
27 #include "macro.h"
28
29 char octchar(int x) _const_;
30 int unoctchar(char c) _const_;
31
32 char decchar(int x) _const_;
33 int undecchar(char c) _const_;
34
35 char hexchar(int x) _const_;
36 int unhexchar(char c) _const_;
37
38 char *hexmem(const void *p, size_t l);
39 int unhexmem(const char *p, size_t l, void **mem, size_t *len);
40
41 char base32hexchar(int x) _const_;
42 int unbase32hexchar(char c) _const_;
43
44 char base64char(int x) _const_;
45 int unbase64char(char c) _const_;
46
47 char *base32hexmem(const void *p, size_t l, bool padding);
48 int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *len);
49
50 ssize_t base64mem(const void *p, size_t l, char **out);
51 int base64_append(char **prefix, int plen,
52                   const void *p, size_t l,
53                   int margin, int width);
54 int unbase64mem(const char *p, size_t l, void **mem, size_t *len);
55
56 void hexdump(FILE *f, const void *p, size_t s);