00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Licensed to the Apache Software Foundation (ASF) under one 00005 * or more contributor license agreements. See the NOTICE file 00006 * distributed with this work for additional information 00007 * regarding copyright ownership. The ASF licenses this file 00008 * to you under the Apache License, Version 2.0 (the 00009 * "License"); you may not use this file except in compliance 00010 * with the License. You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, 00015 * software distributed under the License is distributed on an 00016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00017 * KIND, either express or implied. See the License for the 00018 * specific language governing permissions and limitations 00019 * under the License. 00020 * ==================================================================== 00021 * @endcopyright 00022 * 00023 * @file svn_base64.h 00024 * @brief Base64 encoding and decoding functions 00025 */ 00026 00027 #ifndef SVN_BASE64_H 00028 #define SVN_BASE64_H 00029 00030 #include <apr_pools.h> 00031 00032 #include "svn_types.h" 00033 #include "svn_io.h" /* for svn_stream_t */ 00034 #include "svn_string.h" 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif /* __cplusplus */ 00039 00040 /** 00041 * 00042 * 00043 * @defgroup base64 Base64 encoding/decoding functions 00044 * 00045 * @{ 00046 */ 00047 00048 /** Return a writable generic stream which will encode binary data in 00049 * base64 format and write the encoded data to @a output. If @a break_lines 00050 * is true, newlines will be inserted periodically; otherwise the output 00051 * stream will only consist of base64 encoding characters. Be sure to close 00052 * the stream when done writing in order to squeeze out the last bit of 00053 * encoded data. The stream is allocated in @a pool. 00054 * 00055 * @since New in 1.10. 00056 */ 00057 svn_stream_t * 00058 svn_base64_encode2(svn_stream_t *output, 00059 svn_boolean_t break_lines, 00060 apr_pool_t *pool); 00061 00062 /** 00063 * Same as svn_base64_encode2, but with @a break_lines always TRUE. 00064 * 00065 * @deprecated Provided for backward compatibility with the 1.9 API. 00066 */ 00067 SVN_DEPRECATED 00068 svn_stream_t * 00069 svn_base64_encode(svn_stream_t *output, 00070 apr_pool_t *pool); 00071 00072 /** Return a writable generic stream which will decode base64-encoded 00073 * data and write the decoded data to @a output. The stream is allocated 00074 * in @a pool. 00075 */ 00076 svn_stream_t * 00077 svn_base64_decode(svn_stream_t *output, 00078 apr_pool_t *pool); 00079 00080 00081 /** Encode an @c svn_stringbuf_t into base64. 00082 * 00083 * A simple interface for encoding base64 data assuming we have all of 00084 * it present at once. If @a break_lines is true, newlines will be 00085 * inserted periodically; otherwise the string will only consist of 00086 * base64 encoding characters. The returned string will be allocated 00087 * from @a pool. 00088 * 00089 * @since New in 1.6. 00090 */ 00091 const svn_string_t * 00092 svn_base64_encode_string2(const svn_string_t *str, 00093 svn_boolean_t break_lines, 00094 apr_pool_t *pool); 00095 00096 /** 00097 * Same as svn_base64_encode_string2, but with @a break_lines always 00098 * TRUE. 00099 * 00100 * @deprecated Provided for backward compatibility with the 1.5 API. 00101 */ 00102 SVN_DEPRECATED 00103 const svn_string_t * 00104 svn_base64_encode_string(const svn_string_t *str, 00105 apr_pool_t *pool); 00106 00107 /** Decode an @c svn_stringbuf_t from base64. 00108 * 00109 * A simple interface for decoding base64 data assuming we have all of 00110 * it present at once. The returned string will be allocated from @c 00111 * pool. 00112 * 00113 */ 00114 const svn_string_t * 00115 svn_base64_decode_string(const svn_string_t *str, 00116 apr_pool_t *pool); 00117 00118 00119 /** Return a base64-encoded checksum for finalized @a digest. 00120 * 00121 * @a digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data. 00122 * Allocate the returned checksum in @a pool. 00123 * 00124 * @deprecated Provided for backward compatibility with the 1.5 API. 00125 */ 00126 SVN_DEPRECATED 00127 svn_stringbuf_t * 00128 svn_base64_from_md5(unsigned char digest[], 00129 apr_pool_t *pool); 00130 00131 00132 /** @} end group: Base64 encoding/decoding functions */ 00133 00134 #ifdef __cplusplus 00135 } 00136 #endif /* __cplusplus */ 00137 00138 #endif /* SVN_BASE64_H */
1.6.1