00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Copyright (c) 2000-2004 CollabNet. All rights reserved. 00005 * 00006 * This software is licensed as described in the file COPYING, which 00007 * you should have received as part of this distribution. The terms 00008 * are also available at http://subversion.tigris.org/license-1.html. 00009 * If newer versions of this license are posted there, you may use a 00010 * newer version instead, at your option. 00011 * 00012 * This software consists of voluntary contributions made by many 00013 * individuals. For exact contribution history, see the revision 00014 * history and logs, available at http://subversion.tigris.org/. 00015 * ==================================================================== 00016 * @endcopyright 00017 * 00018 * @file svn_base64.h 00019 * @brief Base64 encoding and decoding functions 00020 */ 00021 00022 #ifndef SVN_BASE64_H 00023 #define SVN_BASE64_H 00024 00025 #include <apr_md5.h> 00026 00027 #include "svn_io.h" 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif /* __cplusplus */ 00032 00033 /** 00034 * 00035 * 00036 * @defgroup base64 Base64 encoding/decoding functions 00037 * 00038 * @{ 00039 */ 00040 00041 /** Return a writable generic stream which will encode binary data in 00042 * base64 format and write the encoded data to @c output. Be sure to 00043 * close the stream when done writing in order to squeeze out the last 00044 * bit of encoded data. The stream is allocated in @c pool. 00045 */ 00046 svn_stream_t *svn_base64_encode(svn_stream_t *output, apr_pool_t *pool); 00047 00048 /** Return a writable generic stream which will decode base64-encoded 00049 * data and write the decoded data to @c output. The stream is allocated 00050 * in @c pool. 00051 */ 00052 svn_stream_t *svn_base64_decode(svn_stream_t *output, apr_pool_t *pool); 00053 00054 00055 /** Encode an @c svn_stringbuf_t into base64. 00056 * 00057 * A simple interface for encoding base64 data assuming we have all of 00058 * it present at once. The returned string will be allocated from @c pool. 00059 */ 00060 const svn_string_t *svn_base64_encode_string(const svn_string_t *str, 00061 apr_pool_t *pool); 00062 00063 /** Decode an @c svn_stringbuf_t from base64. 00064 * 00065 * A simple interface for decoding base64 data assuming we have all of 00066 * it present at once. The returned string will be allocated from @c pool. 00067 */ 00068 const svn_string_t *svn_base64_decode_string(const svn_string_t *str, 00069 apr_pool_t *pool); 00070 00071 00072 /** Return a base64-encoded checksum for finalized @c digest. 00073 * 00074 * @c digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data. 00075 * Allocate the returned checksum in @c pool. 00076 */ 00077 svn_stringbuf_t *svn_base64_from_md5(unsigned char digest[], 00078 apr_pool_t *pool); 00079 00080 00081 /** @} end group: Base64 encoding/decoding functions */ 00082 00083 #ifdef __cplusplus 00084 } 00085 #endif /* __cplusplus */ 00086 00087 #endif /* SVN_BASE64_H */