Merge from vendor branch OPENSSL:
[dragonfly.git] / contrib / bind-9.3 / lib / isccc / include / isccc / base64.h
1 /*
2  * Portions Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Portions Copyright (C) 2001  Internet Software Consortium.
4  * Portions Copyright (C) 2001  Nominum, Inc.
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
13  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18
19 /* $Id: base64.h,v 1.2.206.1 2004/03/06 08:15:21 marka Exp $ */
20
21 #ifndef ISCCC_BASE64_H
22 #define ISCCC_BASE64_H 1
23
24 #include <isc/lang.h>
25 #include <isccc/types.h>
26
27 ISC_LANG_BEGINDECLS
28
29 /***
30  *** Functions
31  ***/
32
33 isc_result_t
34 isccc_base64_encode(isccc_region_t *source, int wordlength,
35                   const char *wordbreak, isccc_region_t *target);
36 /*
37  * Convert data into base64 encoded text.
38  *
39  * Notes:
40  *      The base64 encoded text in 'target' will be divided into
41  *      words of at most 'wordlength' characters, separated by
42  *      the 'wordbreak' string.  No parentheses will surround
43  *      the text.
44  *
45  * Requires:
46  *      'source' is a region containing binary data.
47  *      'target' is a text region containing available space.
48  *      'wordbreak' points to a null-terminated string of
49  *              zero or more whitespace characters.
50  */
51
52 isc_result_t
53 isccc_base64_decode(const char *cstr, isccc_region_t *target);
54 /*
55  * Decode a null-terminated base64 string.
56  *
57  * Requires:
58  *      'cstr' is non-null.
59  *      'target' is a valid region.
60  *
61  * Returns:
62  *      ISC_R_SUCCESS   -- the entire decoded representation of 'cstring'
63  *                         fit in 'target'.
64  *      ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding.
65  *      ISC_R_NOSPACE   -- 'target' is not big enough.
66  */
67
68 ISC_LANG_ENDDECLS
69
70 #endif /* ISCCC_BASE64_H */