]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
e4e73a63 LP |
2 | #pragma once |
3 | ||
0c15577a | 4 | #include "forward.h" |
e4e73a63 LP |
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 | ||
6da2ea9f MY |
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); | |
bdd2036e MY |
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); | |
7088befb | 19 | } |
e4e73a63 LP |
20 | |
21 | char base32hexchar(int x) _const_; | |
22 | int unbase32hexchar(char c) _const_; | |
23 | ||
24 | char base64char(int x) _const_; | |
130298ba | 25 | char urlsafe_base64char(int x) _const_; |
e4e73a63 LP |
26 | int unbase64char(char c) _const_; |
27 | ||
6da2ea9f MY |
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); | |
e4e73a63 | 30 | |
6da2ea9f | 31 | ssize_t base64mem_full(const void *p, size_t l, size_t line_break, char **ret) _nonnull_if_nonzero_(1, 2); |
82b4ec44 LP |
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 | ||
c21b3169 YW |
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); | |
6da2ea9f | 43 | int unbase64mem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size) _nonnull_if_nonzero_(1, 2); |
bdd2036e MY |
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); | |
2432d09c | 46 | } |
e4e73a63 | 47 | |
6da2ea9f | 48 | void hexdump(FILE *f, const void *p, size_t s) _nonnull_if_nonzero_(2, 3); |