Subversion
svn_base64.h
Go to the documentation of this file.
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.  Be sure to
00050  * close the stream when done writing in order to squeeze out the last
00051  * bit of encoded data.  The stream is allocated in @a pool.
00052  */
00053 svn_stream_t *
00054 svn_base64_encode(svn_stream_t *output,
00055                   apr_pool_t *pool);
00056 
00057 /** Return a writable generic stream which will decode base64-encoded
00058  * data and write the decoded data to @a output.  The stream is allocated
00059  * in @a pool.
00060  */
00061 svn_stream_t *
00062 svn_base64_decode(svn_stream_t *output,
00063                   apr_pool_t *pool);
00064 
00065 
00066 /** Encode an @c svn_stringbuf_t into base64.
00067  *
00068  * A simple interface for encoding base64 data assuming we have all of
00069  * it present at once.  If @a break_lines is true, newlines will be
00070  * inserted periodically; otherwise the string will only consist of
00071  * base64 encoding characters.  The returned string will be allocated
00072  * from @a pool.
00073  *
00074  * @since New in 1.6.
00075  */
00076 const svn_string_t *
00077 svn_base64_encode_string2(const svn_string_t *str,
00078                           svn_boolean_t break_lines,
00079                           apr_pool_t *pool);
00080 
00081 /**
00082  * Same as svn_base64_encode_string2, but with @a break_lines always
00083  * TRUE.
00084  *
00085  * @deprecated Provided for backward compatibility with the 1.5 API.
00086  */
00087 SVN_DEPRECATED
00088 const svn_string_t *
00089 svn_base64_encode_string(const svn_string_t *str,
00090                          apr_pool_t *pool);
00091 
00092 /** Decode an @c svn_stringbuf_t from base64.
00093  *
00094  * A simple interface for decoding base64 data assuming we have all of
00095  * it present at once.  The returned string will be allocated from @c
00096  * pool.
00097  *
00098  */
00099 const svn_string_t *
00100 svn_base64_decode_string(const svn_string_t *str,
00101                          apr_pool_t *pool);
00102 
00103 
00104 /** Return a base64-encoded checksum for finalized @a digest.
00105  *
00106  * @a digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data.
00107  * Allocate the returned checksum in @a pool.
00108  *
00109  * @deprecated Provided for backward compatibility with the 1.5 API.
00110  */
00111 SVN_DEPRECATED
00112 svn_stringbuf_t *
00113 svn_base64_from_md5(unsigned char digest[],
00114                     apr_pool_t *pool);
00115 
00116 
00117 /** @} end group: Base64 encoding/decoding functions */
00118 
00119 #ifdef __cplusplus
00120 }
00121 #endif /* __cplusplus */
00122 
00123 #endif /* SVN_BASE64_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines