base64.h
1 /*
2  * Copyright (C) 2014 Hochschule für Angewandte Wissenschaften Hamburg (HAW)
3  * Copyright (C) 2014 Martin Landsmann <Martin.Landsmann@HAW-Hamburg.de>
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
20 #ifndef BASE64_H
21 #define BASE64_H
22 
23 #include <stddef.h> /* for size_t */
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define BASE64_SUCCESS (0)
30 #define BASE64_ERROR_BUFFER_OUT (-1)
31 #define BASE64_ERROR_BUFFER_OUT_SIZE (-2)
32 #define BASE64_ERROR_DATA_IN (-3)
33 #define BASE64_ERROR_DATA_IN_SIZE (-4)
53 int base64_encode(unsigned char *data_in, size_t data_in_size, \
54  unsigned char *base64_out, size_t *base64_out_size);
55 
74 int base64_decode(unsigned char *base64_in, size_t base64_in_size, \
75  unsigned char *data_out, size_t *data_out_size);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
82 #endif /* BASE64_H */
int base64_decode(unsigned char *base64_in, size_t base64_in_size, unsigned char *data_out, size_t *data_out_size)
Decodes a given base64 string and save the result to the given destination.