WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: AGPL3.0-or-later
-*/
+ */
/**
* @file set/ibf.h
/**
* Keys that can be inserted into and removed from an IBF.
*/
-struct IBF_Key
-{
+struct IBF_Key {
uint64_t key_val;
};
/**
* Hash of an IBF key.
*/
-struct IBF_KeyHash
-{
+struct IBF_KeyHash {
uint32_t key_hash_val;
};
/**
* Type of the count field of IBF buckets.
*/
-struct IBF_Count
-{
+struct IBF_Count {
int8_t count_val;
};
/**
* Size of one ibf bucket in bytes
*/
-#define IBF_BUCKET_SIZE (sizeof (struct IBF_Count) + sizeof (struct IBF_Key) + \
- sizeof (struct IBF_KeyHash))
+#define IBF_BUCKET_SIZE (sizeof(struct IBF_Count) + sizeof(struct IBF_Key) + \
+ sizeof(struct IBF_KeyHash))
/**
* An IBF is a counting bloom filter that has the ability to restore
* the hashes of its stored elements with high probability.
*/
-struct InvertibleBloomFilter
-{
+struct InvertibleBloomFilter {
/**
* How many cells does this IBF have?
*/
* @param buf buffer to write the data to
*/
void
-ibf_write_slice (const struct InvertibleBloomFilter *ibf,
- uint32_t start,
- uint32_t count,
- void *buf);
+ibf_write_slice(const struct InvertibleBloomFilter *ibf,
+ uint32_t start,
+ uint32_t count,
+ void *buf);
/**
* @param ibf the ibf to write to
*/
void
-ibf_read_slice (const void *buf,
- uint32_t start,
- uint32_t count,
- struct InvertibleBloomFilter *ibf);
+ibf_read_slice(const void *buf,
+ uint32_t start,
+ uint32_t count,
+ struct InvertibleBloomFilter *ibf);
/**
* @return a key
*/
struct IBF_Key
-ibf_key_from_hashcode (const struct GNUNET_HashCode *hash);
+ibf_key_from_hashcode(const struct GNUNET_HashCode *hash);
/**
* @param dst hashcode to store the result in
*/
void
-ibf_hashcode_from_key (struct IBF_Key key, struct GNUNET_HashCode *dst);
+ibf_hashcode_from_key(struct IBF_Key key, struct GNUNET_HashCode *dst);
/**
* @return the newly created invertible bloom filter, NULL on error
*/
struct InvertibleBloomFilter *
-ibf_create (uint32_t size, uint8_t hash_num);
+ibf_create(uint32_t size, uint8_t hash_num);
/**
* @param key the element's hash code
*/
void
-ibf_insert (struct InvertibleBloomFilter *ibf, struct IBF_Key key);
+ibf_insert(struct InvertibleBloomFilter *ibf, struct IBF_Key key);
/**
* @param key the element's hash code
*/
void
-ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key);
+ibf_remove(struct InvertibleBloomFilter *ibf, struct IBF_Key key);
/**
* @param ibf2 IBF that will be subtracted from ibf1
*/
void
-ibf_subtract (struct InvertibleBloomFilter *ibf1,
- const struct InvertibleBloomFilter *ibf2);
+ibf_subtract(struct InvertibleBloomFilter *ibf1,
+ const struct InvertibleBloomFilter *ibf2);
/**
* #GNUNET_SYSERR if the decoding has failed
*/
int
-ibf_decode (struct InvertibleBloomFilter *ibf,
- int *ret_side,
- struct IBF_Key *ret_id);
+ibf_decode(struct InvertibleBloomFilter *ibf,
+ int *ret_side,
+ struct IBF_Key *ret_id);
/**
* @param ibf the IBF to copy
*/
struct InvertibleBloomFilter *
-ibf_dup (const struct InvertibleBloomFilter *ibf);
+ibf_dup(const struct InvertibleBloomFilter *ibf);
/**
* @param ibf the intertible bloom filter to destroy
*/
void
-ibf_destroy (struct InvertibleBloomFilter *ibf);
+ibf_destroy(struct InvertibleBloomFilter *ibf);
#if 0 /* keep Emacsens' auto-indent happy */