| 1 | #if 0
|
|---|
| 2 | INDI
|
|---|
| 3 | Copyright (C) 2003 Elwood C. Downey
|
|---|
| 4 |
|
|---|
| 5 | This library is free software; you can redistribute it and/or
|
|---|
| 6 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 7 | License as published by the Free Software Foundation; either
|
|---|
| 8 | version 2.1 of the License, or (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This library is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 13 | Lesser General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 16 | License along with this library; if not, write to the Free Software
|
|---|
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|---|
| 18 |
|
|---|
| 19 | #endif
|
|---|
| 20 |
|
|---|
| 21 | #ifndef BASE64_H
|
|---|
| 22 | #define BASE64_H
|
|---|
| 23 |
|
|---|
| 24 | #ifdef __cplusplus
|
|---|
| 25 | extern "C" {
|
|---|
| 26 | #endif
|
|---|
| 27 |
|
|---|
| 28 | /**
|
|---|
| 29 | * \defgroup base64 Base 64 Functions: Convert from and to base64
|
|---|
| 30 | */
|
|---|
| 31 | /*@{*/
|
|---|
| 32 |
|
|---|
| 33 | /** \brief Convert bytes array to base64.
|
|---|
| 34 | \param out output buffer in base64. The buffer size must be at least (4 * inlen / 3 + 4) bytes long.
|
|---|
| 35 | \param in input binary buffer
|
|---|
| 36 | \param inlen number of bytes to convert
|
|---|
| 37 | \return 0 on success, -1 on failure.
|
|---|
| 38 | */
|
|---|
| 39 | extern int to64frombits(unsigned char *out, const unsigned char *in,
|
|---|
| 40 | int inlen);
|
|---|
| 41 |
|
|---|
| 42 | /** \brief Convert base64 to bytes array.
|
|---|
| 43 | \param out output buffer in bytes. The buffer size must be at least (3 * size_of_in_buffer / 4) bytes long.
|
|---|
| 44 | \param in input base64 buffer
|
|---|
| 45 | \return 0 on success, -1 on failure.
|
|---|
| 46 | */
|
|---|
| 47 |
|
|---|
| 48 | extern int from64tobits(char *out, const char *in);
|
|---|
| 49 |
|
|---|
| 50 | /*@}*/
|
|---|
| 51 |
|
|---|
| 52 | #ifdef __cplusplus
|
|---|
| 53 | }
|
|---|
| 54 | #endif
|
|---|
| 55 |
|
|---|
| 56 | #endif
|
|---|