Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
svn_base64.h
Go to the documentation of this file.
1 /**
2  * @copyright
3  * ====================================================================
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements. See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership. The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License. You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied. See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_base64.h
24  * @brief Base64 encoding and decoding functions
25  */
26 
27 #ifndef SVN_BASE64_H
28 #define SVN_BASE64_H
29 
30 #include <apr_pools.h>
31 
32 #include "svn_types.h"
33 #include "svn_io.h" /* for svn_stream_t */
34 #include "svn_string.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 /**
41  *
42  *
43  * @defgroup base64 Base64 encoding/decoding functions
44  *
45  * @{
46  */
47 
48 /** Return a writable generic stream which will encode binary data in
49  * base64 format and write the encoded data to @a output. Be sure to
50  * close the stream when done writing in order to squeeze out the last
51  * bit of encoded data. The stream is allocated in @a pool.
52  */
55  apr_pool_t *pool);
56 
57 /** Return a writable generic stream which will decode base64-encoded
58  * data and write the decoded data to @a output. The stream is allocated
59  * in @a pool.
60  */
63  apr_pool_t *pool);
64 
65 
66 /** Encode an @c svn_stringbuf_t into base64.
67  *
68  * A simple interface for encoding base64 data assuming we have all of
69  * it present at once. If @a break_lines is true, newlines will be
70  * inserted periodically; otherwise the string will only consist of
71  * base64 encoding characters. The returned string will be allocated
72  * from @a pool.
73  *
74  * @since New in 1.6.
75  */
76 const svn_string_t *
78  svn_boolean_t break_lines,
79  apr_pool_t *pool);
80 
81 /**
82  * Same as svn_base64_encode_string2, but with @a break_lines always
83  * TRUE.
84  *
85  * @deprecated Provided for backward compatibility with the 1.5 API.
86  */
88 const svn_string_t *
90  apr_pool_t *pool);
91 
92 /** Decode an @c svn_stringbuf_t from base64.
93  *
94  * A simple interface for decoding base64 data assuming we have all of
95  * it present at once. The returned string will be allocated from @c
96  * pool.
97  *
98  */
99 const svn_string_t *
101  apr_pool_t *pool);
102 
103 
104 /** Return a base64-encoded checksum for finalized @a digest.
105  *
106  * @a digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data.
107  * Allocate the returned checksum in @a pool.
108  *
109  * @deprecated Provided for backward compatibility with the 1.5 API.
110  */
113 svn_base64_from_md5(unsigned char digest[],
114  apr_pool_t *pool);
115 
116 
117 /** @} end group: Base64 encoding/decoding functions */
118 
119 #ifdef __cplusplus
120 }
121 #endif /* __cplusplus */
122 
123 #endif /* SVN_BASE64_H */
Counted-length strings for Subversion, plus some C string goodies.
const svn_string_t * svn_base64_encode_string2(const svn_string_t *str, svn_boolean_t break_lines, apr_pool_t *pool)
Encode an svn_stringbuf_t into base64.
const svn_string_t * svn_base64_encode_string(const svn_string_t *str, apr_pool_t *pool)
Same as svn_base64_encode_string2, but with break_lines always TRUE.
General file I/O for Subversion.
A simple counted string.
Definition: svn_string.h:96
svn_stringbuf_t * svn_base64_from_md5(unsigned char digest[], apr_pool_t *pool)
Return a base64-encoded checksum for finalized digest.
struct svn_stream_t svn_stream_t
An abstract stream of bytes–either incoming or outgoing or both.
Definition: svn_io.h:816
svn_stream_t * svn_base64_encode(svn_stream_t *output, apr_pool_t *pool)
Return a writable generic stream which will encode binary data in base64 format and write the encoded...
Subversion&#39;s data types.
#define SVN_DEPRECATED
Macro used to mark deprecated functions.
Definition: svn_types.h:59
svn_stream_t * svn_base64_decode(svn_stream_t *output, apr_pool_t *pool)
Return a writable generic stream which will decode base64-encoded data and write the decoded data to ...
const svn_string_t * svn_base64_decode_string(const svn_string_t *str, apr_pool_t *pool)
Decode an svn_stringbuf_t from base64.
int svn_boolean_t
YABT: Yet Another Boolean Type.
Definition: svn_types.h:94
A buffered string, capable of appending without an allocation and copy for each append.
Definition: svn_string.h:104