comment changed
[public/netxms.git] / include / base64.h
CommitLineData
92502d5f
VK
1/* base64.h -- Encode binary data using printable characters.\r
2 Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\r
3 Written by Simon Josefsson.\r
4\r
5 This program is free software; you can redistribute it and/or modify\r
6 it under the terms of the GNU General Public License as published by\r
7 the Free Software Foundation; either version 2, or (at your option)\r
8 any later version.\r
9\r
10 This program is distributed in the hope that it will be useful,\r
11 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
13 GNU General Public License for more details.\r
14\r
15 You should have received a copy of the GNU General Public License\r
16 along with this program; if not, write to the Free Software Foundation,\r
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */\r
18\r
19#ifndef BASE64_H\r
20#define BASE64_H\r
21\r
22/* Get size_t. */\r
23#include <stddef.h>\r
24\r
25/* This uses that the expression (n+(k-1))/k means the smallest\r
26 integer >= n/k, i.e., the ceiling of n/k. */\r
27#define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)\r
28\r
29BOOL LIBNETXMS_EXPORTABLE isbase64 (char ch);\r
30\r
31void LIBNETXMS_EXPORTABLE base64_encode (const char *in, size_t inlen,\r
32 char *out, size_t outlen);\r
33\r
34size_t LIBNETXMS_EXPORTABLE base64_encode_alloc (const char *in, size_t inlen, char **out);\r
35\r
36BOOL LIBNETXMS_EXPORTABLE base64_decode (const char *in, size_t inlen,\r
37 char *out, size_t *outlen);\r
38\r
39BOOL LIBNETXMS_EXPORTABLE base64_decode_alloc (const char *in, size_t inlen,\r
40 char **out, size_t *outlen);\r
41\r
42#endif /* BASE64_H */\r