* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
/*! \file isc/base64.h */
isc_base64_totext(isc_region_t *source, int wordlength,
const char *wordbreak, isc_buffer_t *target);
* \brief Convert data into base64 encoded text.
*\li The base64 encoded text in 'target' will be divided into
* words of at most 'wordlength' characters, separated by
* the 'wordbreak' string. No parentheses will surround
*\li 'source' is a region containing binary data
*\li 'target' is a text buffer containing available space
*\li 'wordbreak' points to a null-terminated string of
* zero or more whitespace characters
*\li target will contain the base64 encoded version of the data
* in source. The 'used' pointer in target will be advanced as
isc_base64_decodestring(const char *cstr, isc_buffer_t *target);
* \brief Decode a null-terminated base64 string.
*\li 'target' is a valid buffer.
*\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring'
*\li #ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding.
* Other error returns are any possible error code from:
*\li isc_lex_openbuffer(),
*\li isc_base64_tobuffer().
isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length);
* \brief Convert base64 encoded text from a lexer context into
* `target`. If 'length' is non-negative, it is the expected number of
* encoded octets to convert.
* If 'length' is -1 then 0 or more encoded octets are expected.
* If 'length' is -2 then 1 or more encoded octets are expected.
*\li #ISC_R_BADBASE64 -- invalid base64 encoding.
*\li #ISC_R_UNEXPECTEDEND: the text does not contain the expected
* number of encoded octets.
*\li 'lexer' is a valid lexer context
*\li 'target' is a buffer containing binary data
*\li 'length' is -2, -1, or non-negative
*\li target will contain the data represented by the base64 encoded
* string parsed by the lexer. No more than `length` octets will
* be read, if `length` is non-negative. The 'used' pointer in
* 'target' will be advanced as necessary.
#endif /* ISC_BASE64_H */