]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/hexdecoct.h
Merge pull request #2085 from fbuihuu/more-use-of-check-load-state
[thirdparty/systemd.git] / src / basic / hexdecoct.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25 #include <stddef.h>
26 #include <stdio.h>
27 #include <sys/types.h>
28
29 #include "macro.h"
30
31 char octchar(int x) _const_;
32 int unoctchar(char c) _const_;
33
34 char decchar(int x) _const_;
35 int undecchar(char c) _const_;
36
37 char hexchar(int x) _const_;
38 int unhexchar(char c) _const_;
39
40 char *hexmem(const void *p, size_t l);
41 int unhexmem(const char *p, size_t l, void **mem, size_t *len);
42
43 char base32hexchar(int x) _const_;
44 int unbase32hexchar(char c) _const_;
45
46 char base64char(int x) _const_;
47 int unbase64char(char c) _const_;
48
49 char *base32hexmem(const void *p, size_t l, bool padding);
50 int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *len);
51
52 char *base64mem(const void *p, size_t l);
53 int unbase64mem(const char *p, size_t l, void **mem, size_t *len);
54
55 void hexdump(FILE *f, const void *p, size_t s);