X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=blobdiff_plain;f=bloom.h;h=806dde49977b96ecd3f666766a5a8baa00ded6f4;hp=afb22980d504e9a1d70cc3622ea8d647ea2566a5;hb=560d397a66ba141f18e13557feae78ca94a25f98;hpb=2842e5142322dcc2e42172c28fc041dcc5673dd5 diff --git a/bloom.h b/bloom.h index afb2298..806dde4 100644 --- a/bloom.h +++ b/bloom.h @@ -1,12 +1,25 @@ +/* + * Copyright (C) 2008 Andre Noll + * + * Licensed under the GPL v2. For licencing details see COPYING. + */ + +/** \file bloom.h Struct bloom and bloom filter functions. */ + +/** Describes one instance of a bloom filter. */ struct bloom { + /** The bloom filter is of size 2^order bits. */ unsigned order; + /** Set that many bits in the filter per entry. */ unsigned num_hash_functions; + /** How many entries have been inserted so far. */ uint64_t num_entries; + /** Number of bits currently set. */ uint64_t num_set_bits; + /** The bit array. */ uint8_t *filter; }; -int bloom_init(unsigned bloom_filter_order, unsigned num_hash_functions, - struct bloom **result); +struct bloom *bloom_new(unsigned order, unsigned num_hash_functions); void bloom_free(struct bloom *b); -int bloom_test_and_insert(const uint8_t *data, size_t len, struct bloom *b); +int bloom_insert(const uint8_t *data, size_t len, struct bloom *b);