]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ | |
2 | #pragma once | |
3 | ||
4 | #include "forward.h" | |
5 | ||
6 | char octchar(int x) _const_; | |
7 | int unoctchar(char c) _const_; | |
8 | ||
9 | char decchar(int x) _const_; | |
10 | int undecchar(char c) _const_; | |
11 | ||
12 | char hexchar(int x) _const_; | |
13 | int unhexchar(char c) _const_; | |
14 | ||
15 | char* hexmem(const void *p, size_t l) _nonnull_if_nonzero_(1, 2); | |
16 | int unhexmem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size) _nonnull_if_nonzero_(1, 2); | |
17 | static inline int unhexmem(const char *p, void **ret_data, size_t *ret_size) { | |
18 | return unhexmem_full(p, SIZE_MAX, false, ret_data, ret_size); | |
19 | } | |
20 | ||
21 | char base32hexchar(int x) _const_; | |
22 | int unbase32hexchar(char c) _const_; | |
23 | ||
24 | char base64char(int x) _const_; | |
25 | char urlsafe_base64char(int x) _const_; | |
26 | int unbase64char(char c) _const_; | |
27 | ||
28 | char* base32hexmem(const void *p, size_t l, bool padding) _nonnull_if_nonzero_(1, 2); | |
29 | int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *len) _nonnull_if_nonzero_(1, 2); | |
30 | ||
31 | ssize_t base64mem_full(const void *p, size_t l, size_t line_break, char **ret) _nonnull_if_nonzero_(1, 2); | |
32 | static inline ssize_t base64mem(const void *p, size_t l, char **ret) { | |
33 | return base64mem_full(p, l, SIZE_MAX, ret); | |
34 | } | |
35 | ||
36 | ssize_t base64_append( | |
37 | char **prefix, | |
38 | size_t plen, | |
39 | const void *p, | |
40 | size_t l, | |
41 | size_t margin, | |
42 | size_t width); | |
43 | int unbase64mem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size) _nonnull_if_nonzero_(1, 2); | |
44 | static inline int unbase64mem(const char *p, void **ret_data, size_t *ret_size) { | |
45 | return unbase64mem_full(p, SIZE_MAX, false, ret_data, ret_size); | |
46 | } | |
47 | ||
48 | void hexdump(FILE *f, const void *p, size_t s) _nonnull_if_nonzero_(2, 3); |