Subversion 1.6.16

svn_base64.h

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