summaryrefslogtreecommitdiffstats
path: root/gl/base64.h
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 09:22:57 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 10:19:08 (GMT)
commit71cdb52799220f8d9052643baf1d3e9836a9c755 (patch)
tree27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/base64.h
parentf7afa46586645e50498d8b2d0c67884f014dc3a4 (diff)
downloadmonitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz
Sync with gnulib
Diffstat (limited to 'gl/base64.h')
-rw-r--r--gl/base64.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/gl/base64.h b/gl/base64.h
index 1f9b203..63b6abc 100644
--- a/gl/base64.h
+++ b/gl/base64.h
@@ -29,6 +29,12 @@
29 integer >= n/k, i.e., the ceiling of n/k. */ 29 integer >= n/k, i.e., the ceiling of n/k. */
30# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4) 30# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
31 31
32struct base64_decode_context
33{
34 unsigned int i;
35 char buf[4];
36};
37
32extern bool isbase64 (char ch); 38extern bool isbase64 (char ch);
33 39
34extern void base64_encode (const char *restrict in, size_t inlen, 40extern void base64_encode (const char *restrict in, size_t inlen,
@@ -36,10 +42,20 @@ extern void base64_encode (const char *restrict in, size_t inlen,
36 42
37extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out); 43extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
38 44
39extern bool base64_decode (const char *restrict in, size_t inlen, 45extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
40 char *restrict out, size_t *outlen); 46
47extern bool base64_decode_ctx (struct base64_decode_context *ctx,
48 const char *restrict in, size_t inlen,
49 char *restrict out, size_t *outlen);
50
51extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
52 const char *in, size_t inlen,
53 char **out, size_t *outlen);
54
55#define base64_decode(in, inlen, out, outlen) \
56 base64_decode_ctx (NULL, in, inlen, out, outlen)
41 57
42extern bool base64_decode_alloc (const char *in, size_t inlen, 58#define base64_decode_alloc(in, inlen, out, outlen) \
43 char **out, size_t *outlen); 59 base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
44 60
45#endif /* BASE64_H */ 61#endif /* BASE64_H */