221
248
svn_checksum__from_digest_sha1(const unsigned char *digest,
222
249
apr_pool_t *result_pool);
252
* Internal function for creating a 32 bit FNV-1a checksum from a binary
258
svn_checksum__from_digest_fnv1a_32(const unsigned char *digest,
259
apr_pool_t *result_pool);
262
* Internal function for creating a modified 32 bit FNV-1a checksum from
268
svn_checksum__from_digest_fnv1a_32x4(const unsigned char *digest,
269
apr_pool_t *result_pool);
273
* Return a stream that calculates a checksum of type @a kind over all
274
* data written to the @a inner_stream. When the returned stream gets
275
* closed, write the checksum to @a *checksum.
276
* Allocate the result in @a pool.
278
* @note The stream returned only supports #svn_stream_write and
282
svn_checksum__wrap_write_stream(svn_checksum_t **checksum,
283
svn_stream_t *inner_stream,
284
svn_checksum_kind_t kind,
288
* Return a stream that calculates a 32 bit modified FNV-1a checksum
289
* over all data written to the @a inner_stream and writes the digest
290
* to @a *digest when the returned stream gets closed.
291
* Allocate the stream in @a pool.
294
svn_checksum__wrap_write_stream_fnv1a_32x4(apr_uint32_t *digest,
295
svn_stream_t *inner_stream,
299
* Return a 32 bit FNV-1a checksum for the first @a len bytes in @a input.
304
svn__fnv1a_32(const void *input, apr_size_t len);
307
* Return a 32 bit modified FNV-1a checksum for the first @a len bytes in
310
* @note This is a proprietary checksumming algorithm based FNV-1a with
311
* approximately the same strength. It is up to 4 times faster
312
* than plain FNV-1a for longer data blocks.
317
svn__fnv1a_32x4(const void *input, apr_size_t len);
226
323
* @defgroup svn_hash_support Hash table serialization support
335
/** Like svn_ver_check_list(), but with a @a comparator parameter.
336
* Private backport of svn_ver_check_list2() from trunk.
339
svn_ver__check_list2(const svn_version_t *my_version,
340
const svn_version_checklist_t *checklist,
341
svn_boolean_t (*comparator)(const svn_version_t *,
342
const svn_version_t *));
344
/** To minimize merge churn in callers, alias the trunk name privately. */
345
#define svn_ver_check_list2 svn_ver__check_list2
483
* @defgroup svn_compress Data (de-)compression API
487
/* This is at least as big as the largest size of an integer that
488
svn__encode_uint() can generate; it is sufficient for creating buffers
489
for it to write into. This assumes that integers are at most 64 bits,
490
and so 10 bytes (with 7 bits of information each) are sufficient to
492
#define SVN__MAX_ENCODED_UINT_LEN 10
494
/* Compression method parameters for svn__encode_uint. */
496
/* No compression (but a length prefix will still be added to the buffer) */
497
#define SVN__COMPRESSION_NONE 0
499
/* Fastest, least effective compression method & level provided by zlib. */
500
#define SVN__COMPRESSION_ZLIB_MIN 1
502
/* Default compression method & level provided by zlib. */
503
#define SVN__COMPRESSION_ZLIB_DEFAULT 5
505
/* Slowest, best compression method & level provided by zlib. */
506
#define SVN__COMPRESSION_ZLIB_MAX 9
508
/* Encode VAL into the buffer P using the variable-length 7b/8b unsigned
509
integer format. Return the incremented value of P after the
510
encoded bytes have been written. P must point to a buffer of size
511
at least SVN__MAX_ENCODED_UINT_LEN.
513
This encoding uses the high bit of each byte as a continuation bit
514
and the other seven bits as data bits. High-order data bits are
515
encoded first, followed by lower-order bits, so the value can be
516
reconstructed by concatenating the data bits from left to right and
517
interpreting the result as a binary number. Examples (brackets
518
denote byte boundaries, spaces are for clarity only):
520
1 encodes as [0 0000001]
521
33 encodes as [0 0100001]
522
129 encodes as [1 0000001] [0 0000001]
523
2000 encodes as [1 0001111] [0 1010000]
526
svn__encode_uint(unsigned char *p, apr_uint64_t val);
528
/* Decode an unsigned 7b/8b-encoded integer into *VAL and return a pointer
529
to the byte after the integer. The bytes to be decoded live in the
530
range [P..END-1]. If these bytes do not contain a whole encoded
531
integer, return NULL; in this case *VAL is undefined.
533
See the comment for svn__encode_uint() earlier in this file for more
534
detail on the encoding format. */
535
const unsigned char *
536
svn__decode_uint(apr_uint64_t *val,
537
const unsigned char *p,
538
const unsigned char *end);
540
/* Get the data from IN, compress it according to the specified
541
* COMPRESSION_METHOD and write the result to OUT.
542
* SVN__COMPRESSION_NONE is valid for COMPRESSION_METHOD.
545
svn__compress(svn_stringbuf_t *in,
546
svn_stringbuf_t *out,
547
int compression_method);
549
/* Get the compressed data from IN, decompress it and write the result to
550
* OUT. Return an error if the decompressed size is larger than LIMIT.
553
svn__decompress(svn_stringbuf_t *in,
554
svn_stringbuf_t *out,
560
* @defgroup svn_root_pools Recycle-able root pools API
564
/* Opaque thread-safe container for unused / recylcleable root pools.
566
* Recyling root pools (actually, their allocators) circumvents a
567
* scalability bottleneck in the OS memory management when multi-threaded
568
* applications frequently create and destroy allocators.
570
typedef struct svn_root_pools__t svn_root_pools__t;
572
/* Create a new root pools container and return it in *POOLS.
575
svn_root_pools__create(svn_root_pools__t **pools);
577
/* Return a currently unused pool from POOLS. If POOLS is empty, create a
578
* new root pool and return that. The pool returned is not thread-safe.
581
svn_root_pools__acquire_pool(svn_root_pools__t *pools);
583
/* Clear and release the given root POOL and put it back into POOLS.
584
* If that fails, destroy POOL.
587
svn_root_pools__release_pool(apr_pool_t *pool,
588
svn_root_pools__t *pools);
593
* @defgroup svn_config_private Private configuration handling API
597
/* Future attempts to modify CFG will trigger an assertion. */
599
svn_config__set_read_only(svn_config_t *cfg,
600
apr_pool_t *scratch_pool);
602
/* Return TRUE, if CFG cannot be modified. */
604
svn_config__is_read_only(svn_config_t *cfg);
606
/* Return TRUE, if OPTION in SECTION in CFG exists and does not require
607
* further expansion (due to either containing no placeholders or already
608
* having been expanded). */
610
svn_config__is_expanded(svn_config_t *cfg,
614
/* Return a shallow copy of SCR in POOL. If SRC is read-only, different
615
* shallow copies may be used from different threads.
617
* Any single r/o svn_config_t or shallow copy is not thread-safe because
618
* it contains shared buffers for tempoary data.
621
svn_config__shallow_copy(svn_config_t *src,
624
/* Add / replace SECTION in TARGET with the same section from SOURCE by
625
* simply adding a reference to it. If TARGET is read-only, the sections
626
* list in target gets duplicated before the modification.
628
* This is an API tailored for use by the svn_repos__authz_pool_t API to
629
* prevent breach of encapsulation.
632
svn_config__shallow_replace_section(svn_config_t *target,
633
svn_config_t *source,
634
const char *section);
636
/* Allocate *CFG_HASH and populate it with default, empty,
637
* svn_config_t for the configuration categories (@c
638
* SVN_CONFIG_CATEGORY_SERVERS, @c SVN_CONFIG_CATEGORY_CONFIG, etc.).
639
* This returns a hash equivalent to svn_config_get_config when the
640
* config files are empty.
643
svn_config__get_default_config(apr_hash_t **cfg_hash,
650
* @defgroup svn_bit_array Packed bit array handling API
654
/* This opaque data struct is an alternative to an INT->VOID hash.
656
* Technically, it is an automatically growing packed bit array.
657
* All indexes not previously set are implicitly 0 and setting it will
658
* grow the array as needed.
660
typedef struct svn_bit_array__t svn_bit_array__t;
662
/* Return a new bit array allocated in POOL. MAX is a mere hint for
663
* the initial size of the array in bits.
666
svn_bit_array__create(apr_size_t max,
669
/* Set bit at index IDX in ARRAY to VALUE. If necessary, grow the
670
* underlying data buffer, i.e. any IDX is valid unless we run OOM.
673
svn_bit_array__set(svn_bit_array__t *array,
675
svn_boolean_t value);
677
/* Get the bit value at index IDX in ARRAY. Bits not previously accessed
678
* are implicitly 0 (or FALSE). That implies IDX can never be out-of-range.
681
svn_bit_array__get(svn_bit_array__t *array,
684
/* Return the global pool used by the DSO loader, this may be NULL if
685
no DSOs have been loaded. */