Rename pmconflict_t to alpm_conflict_t
[pacman-ng.git] / lib / libalpm / base64.h
blob0ae9612cf144f9ba48ee20aad3b39a3def768a8d
1 /**
2 * \file base64.h
4 * Copyright (C) 2006-2010, Brainspark B.V.
6 * This file is part of PolarSSL (http://www.polarssl.org)
7 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
9 * All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #ifndef _BASE64_H
26 #define _BASE64_H
28 #define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL 0x0010
29 #define POLARSSL_ERR_BASE64_INVALID_CHARACTER 0x0012
31 /**
32 * \brief Encode a buffer into base64 format
34 * \param dst destination buffer
35 * \param dlen size of the buffer
36 * \param src source buffer
37 * \param slen amount of data to be encoded
39 * \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
40 * *dlen is always updated to reflect the amount
41 * of data that has (or would have) been written.
43 * \note Call this function with *dlen = 0 to obtain the
44 * required buffer size in *dlen
46 int base64_encode( unsigned char *dst, int *dlen,
47 const unsigned char *src, int slen );
49 /**
50 * \brief Decode a base64-formatted buffer
52 * \param dst destination buffer
53 * \param dlen size of the buffer
54 * \param src source buffer
55 * \param slen amount of data to be decoded
57 * \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
58 * POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
59 * correct. *dlen is always updated to reflect the amount
60 * of data that has (or would have) been written.
62 * \note Call this function with *dlen = 0 to obtain the
63 * required buffer size in *dlen
65 int base64_decode( unsigned char *dst, int *dlen,
66 const unsigned char *src, int slen );
68 #endif /* base64.h */