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 /** Return a writable generic stream which will encode binary data in 00034 * base64 format and write the encoded data to @c output. Be sure to 00035 * close the stream when done writing in order to squeeze out the last 00036 * bit of encoded data. The stream is allocated in @c pool. 00037 */ 00038 svn_stream_t *svn_base64_encode (svn_stream_t *output, apr_pool_t *pool); 00039 00040 /** Return a writable generic stream which will decode base64-encoded 00041 * data and write the decoded data to @c output. The stream is allocated 00042 * in @c pool. 00043 */ 00044 svn_stream_t *svn_base64_decode (svn_stream_t *output, apr_pool_t *pool); 00045 00046 00047 /** Encode an @c svn_stringbuf_t into base64. 00048 * 00049 * A simple interface for encoding base64 data assuming we have all of 00050 * it present at once. The returned string will be allocated from @c pool. 00051 */ 00052 const svn_string_t *svn_base64_encode_string (const svn_string_t *str, 00053 apr_pool_t *pool); 00054 00055 /** Decode an @c svn_stringbuf_t from base64. 00056 * 00057 * A simple interface for decoding 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_decode_string (const svn_string_t *str, 00061 apr_pool_t *pool); 00062 00063 00064 /** Return a base64-encoded checksum for finalized @c digest. 00065 * 00066 * @c digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data. 00067 * Allocate the returned checksum in @c pool. 00068 */ 00069 svn_stringbuf_t *svn_base64_from_md5 (unsigned char digest[], 00070 apr_pool_t *pool); 00071 00072 00073 #ifdef __cplusplus 00074 } 00075 #endif /* __cplusplus */ 00076 00077 #endif /* SVN_BASE64_H */