summaryrefslogtreecommitdiff
path: root/src/basic/util.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-07-10 14:38:19 +0200
committerTom Gundersen <teg@jklm.no>2015-07-12 19:24:14 +0200
commit13a5d76b3277a2a499345cc24facc21eb17ccdae (patch)
treee3a06b0243983cc5c65bb3a3fdbba72455dd2e21 /src/basic/util.h
parent30494563f235b21c6583f7476b8ee35e9f5f8048 (diff)
basic: util - add base64mem() function similar to hexmem()
This implements RFC4648 for a slightly more compact representation of binary data compared to hex (6 bits per character rather than 4).
Diffstat (limited to 'src/basic/util.h')
-rw-r--r--src/basic/util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/util.h b/src/basic/util.h
index ea77907f7f..dae43006e4 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -240,6 +240,8 @@ char octchar(int x) _const_;
int unoctchar(char c) _const_;
char decchar(int x) _const_;
int undecchar(char c) _const_;
+char base64char(int x) _const_;
+int unbase64char(char c) _const_;
char *cescape(const char *s);
size_t cescape_char(char c, char *buf);
@@ -616,6 +618,9 @@ static inline void *mempset(void *s, int c, size_t n) {
char *hexmem(const void *p, size_t l);
int unhexmem(const char *p, size_t l, void **mem, size_t *len);
+char *base64mem(const void *p, size_t l);
+int unbase64mem(const char *p, size_t l, void **mem, size_t *len);
+
char *strextend(char **x, ...) _sentinel_;
char *strrep(const char *s, unsigned n);