GME
13
|
00001 00027 #ifndef SVN_CHECKSUM_H 00028 #define SVN_CHECKSUM_H 00029 00030 #include <apr.h> /* for apr_size_t */ 00031 #include <apr_pools.h> /* for apr_pool_t */ 00032 00033 #include "svn_types.h" /* for svn_boolean_t, svn_error_t */ 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif /* __cplusplus */ 00038 00039 00045 typedef enum svn_checksum_kind_t 00046 { 00048 svn_checksum_md5, 00049 00051 svn_checksum_sha1 00052 } svn_checksum_kind_t; 00053 00059 typedef struct svn_checksum_t 00060 { 00062 const unsigned char *digest; 00063 00066 svn_checksum_kind_t kind; 00067 } svn_checksum_t; 00068 00072 typedef struct svn_checksum_ctx_t svn_checksum_ctx_t; 00073 00079 svn_checksum_t * 00080 svn_checksum_create(svn_checksum_kind_t kind, 00081 apr_pool_t *pool); 00082 00088 svn_error_t * 00089 svn_checksum_clear(svn_checksum_t *checksum); 00090 00097 svn_boolean_t 00098 svn_checksum_match(const svn_checksum_t *checksum1, 00099 const svn_checksum_t *checksum2); 00100 00101 00108 svn_checksum_t * 00109 svn_checksum_dup(const svn_checksum_t *checksum, 00110 apr_pool_t *pool); 00111 00112 00118 const char * 00119 svn_checksum_to_cstring_display(const svn_checksum_t *checksum, 00120 apr_pool_t *pool); 00121 00122 00131 const char * 00132 svn_checksum_to_cstring(const svn_checksum_t *checksum, 00133 apr_pool_t *pool); 00134 00135 00143 const char * 00144 svn_checksum_serialize(const svn_checksum_t *checksum, 00145 apr_pool_t *result_pool, 00146 apr_pool_t *scratch_pool); 00147 00148 00155 svn_error_t * 00156 svn_checksum_deserialize(const svn_checksum_t **checksum, 00157 const char *data, 00158 apr_pool_t *result_pool, 00159 apr_pool_t *scratch_pool); 00160 00161 00170 svn_error_t * 00171 svn_checksum_parse_hex(svn_checksum_t **checksum, 00172 svn_checksum_kind_t kind, 00173 const char *hex, 00174 apr_pool_t *pool); 00175 00182 svn_error_t * 00183 svn_checksum(svn_checksum_t **checksum, 00184 svn_checksum_kind_t kind, 00185 const void *data, 00186 apr_size_t len, 00187 apr_pool_t *pool); 00188 00189 00196 svn_checksum_t * 00197 svn_checksum_empty_checksum(svn_checksum_kind_t kind, 00198 apr_pool_t *pool); 00199 00200 00207 svn_checksum_ctx_t * 00208 svn_checksum_ctx_create(svn_checksum_kind_t kind, 00209 apr_pool_t *pool); 00210 00217 svn_error_t * 00218 svn_checksum_update(svn_checksum_ctx_t *ctx, 00219 const void *data, 00220 apr_size_t len); 00221 00222 00229 svn_error_t * 00230 svn_checksum_final(svn_checksum_t **checksum, 00231 const svn_checksum_ctx_t *ctx, 00232 apr_pool_t *pool); 00233 00234 00240 apr_size_t 00241 svn_checksum_size(const svn_checksum_t *checksum); 00242 00249 svn_boolean_t 00250 svn_checksum_is_empty_checksum(svn_checksum_t *checksum); 00251 00252 00266 svn_error_t * 00267 svn_checksum_mismatch_err(const svn_checksum_t *expected, 00268 const svn_checksum_t *actual, 00269 apr_pool_t *scratch_pool, 00270 const char *fmt, 00271 ...) 00272 __attribute__ ((format(printf, 4, 5))); 00273 00274 #ifdef __cplusplus 00275 } 00276 #endif /* __cplusplus */ 00277 00278 #endif /* SVN_CHECKSUM_H */