00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Copyright (c) 2000-2004, 2008 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 "svn_io.h" 00026 #include "svn_types.h" 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif /* __cplusplus */ 00031 00032 /** 00033 * 00034 * 00035 * @defgroup base64 Base64 encoding/decoding functions 00036 * 00037 * @{ 00038 */ 00039 00040 /** Return a writable generic stream which will encode binary data in 00041 * base64 format and write the encoded data to @c output. Be sure to 00042 * close the stream when done writing in order to squeeze out the last 00043 * bit of encoded data. The stream is allocated in @c pool. 00044 */ 00045 svn_stream_t * 00046 svn_base64_encode(svn_stream_t *output, 00047 apr_pool_t *pool); 00048 00049 /** Return a writable generic stream which will decode base64-encoded 00050 * data and write the decoded data to @c output. The stream is allocated 00051 * in @c pool. 00052 */ 00053 svn_stream_t * 00054 svn_base64_decode(svn_stream_t *output, 00055 apr_pool_t *pool); 00056 00057 00058 /** Encode an @c svn_stringbuf_t into base64. 00059 * 00060 * A simple interface for encoding base64 data assuming we have all of 00061 * it present at once. If @a break_lines is true, newlines will be 00062 * inserted periodically; otherwise the string will only consist of 00063 * base64 encoding characters. The returned string will be allocated 00064 * from @c pool. 00065 * 00066 * @since New in 1.6. 00067 */ 00068 const svn_string_t * 00069 svn_base64_encode_string2(const svn_string_t *str, 00070 svn_boolean_t break_lines, 00071 apr_pool_t *pool); 00072 00073 /** 00074 * Same as svn_base64_encode_string2, but with @a break_lines always 00075 * TRUE. 00076 * 00077 * @deprecated Provided for backward compatibility with the 1.5 API. 00078 */ 00079 SVN_DEPRECATED 00080 const svn_string_t * 00081 svn_base64_encode_string(const svn_string_t *str, 00082 apr_pool_t *pool); 00083 00084 /** Decode an @c svn_stringbuf_t from base64. 00085 * 00086 * A simple interface for decoding base64 data assuming we have all of 00087 * it present at once. The returned string will be allocated from @c 00088 * pool. 00089 * 00090 */ 00091 const svn_string_t * 00092 svn_base64_decode_string(const svn_string_t *str, 00093 apr_pool_t *pool); 00094 00095 00096 /** Return a base64-encoded checksum for finalized @a checksum. 00097 * Allocate the returned checksum in @a pool. 00098 * 00099 * If @a checksum->kind is not recognized, return @c 0. 00100 * 00101 * @since New in 1.6. 00102 */ 00103 svn_stringbuf_t * 00104 svn_base64_from_checksum(svn_checksum_t *checksum, 00105 apr_pool_t *pool); 00106 00107 /** Return a base64-encoded checksum for finalized @c digest. 00108 * 00109 * @c digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data. 00110 * Allocate the returned checksum in @c pool. 00111 * 00112 * @deprecated Provided for backward compatibility with the 1.5 API. 00113 */ 00114 SVN_DEPRECATED 00115 svn_stringbuf_t * 00116 svn_base64_from_md5(unsigned char digest[], 00117 apr_pool_t *pool); 00118 00119 00120 /** @} end group: Base64 encoding/decoding functions */ 00121 00122 #ifdef __cplusplus 00123 } 00124 #endif /* __cplusplus */ 00125 00126 #endif /* SVN_BASE64_H */
1.3.9.1