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.
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.2.206.1 2004/03/06 08:15:21 marka Exp $ */
21 #ifndef ISCCC_BASE64_H
22 #define ISCCC_BASE64_H 1
25 #include <isccc/types.h>
34 isccc_base64_encode(isccc_region_t *source, int wordlength,
35 const char *wordbreak, isccc_region_t *target);
37 * Convert data into base64 encoded text.
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
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.
53 isccc_base64_decode(const char *cstr, isccc_region_t *target);
55 * Decode a null-terminated base64 string.
59 * 'target' is a valid region.
62 * ISC_R_SUCCESS -- the entire decoded representation of 'cstring'
64 * ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding.
65 * ISC_R_NOSPACE -- 'target' is not big enough.
70 #endif /* ISCCC_BASE64_H */