2 * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001 Internet Software Consortium.
4 * Portions Copyright (C) 2001 Nominum, Inc.
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.
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.
19 /* $Id: base64.h,v 1.3.18.2 2005/04/29 00:17:13 marka Exp $ */
21 #ifndef ISCCC_BASE64_H
22 #define ISCCC_BASE64_H 1
27 #include <isccc/types.h>
36 isccc_base64_encode(isccc_region_t *source, int wordlength,
37 const char *wordbreak, isccc_region_t *target);
39 * Convert data into base64 encoded text.
42 *\li The base64 encoded text in 'target' will be divided into
43 * words of at most 'wordlength' characters, separated by
44 * the 'wordbreak' string. No parentheses will surround
48 *\li 'source' is a region containing binary data.
49 *\li 'target' is a text region containing available space.
50 *\li 'wordbreak' points to a null-terminated string of
51 * zero or more whitespace characters.
55 isccc_base64_decode(const char *cstr, isccc_region_t *target);
57 * Decode a null-terminated base64 string.
60 *\li 'cstr' is non-null.
61 *\li 'target' is a valid region.
64 *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring'
66 *\li #ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding.
67 *\li #ISC_R_NOSPACE -- 'target' is not big enough.
72 #endif /* ISCCC_BASE64_H */