2 * hash.h - hashing routines mainly used for caching key details.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2000-2002 Project Purple
16 #define HASHMASK 0x3FF
19 * inithash - Initialize the hash ready for use.
21 * This function prepares the hash ready for use. It should be called
22 * before any of the functions below are used.
27 * addtohash - Adds a key to the hash.
28 * @key: The key to add.
30 * Takes a key and stores it in the hash.
32 void addtohash(struct stats_key *key);
35 * createandaddtohash - Creates a key and adds it to the hash.
36 * @keyid: The key to create and add.
38 * Takes a key, checks if it exists in the hash and if not creates it
39 * and adds it to the hash. Returns the key from the hash whether it
40 * already existed or we just created it.
42 struct stats_key *createandaddtohash(uint64_t keyid);
45 * findinhash - Finds a key in the hash.
46 * @keyid: The key we want.
48 * Finds a key in the hash and returns it.
50 struct stats_key *findinhash(uint64_t keyid);
53 * hashelements - Returns the size of the hash
55 * Returns the number of elements that have been loaded into the hash.
57 unsigned long hashelements(void);
60 * gethashtableentry - Returns an entry from the hash table.
61 * @entry: The entry to return. 0 <= entry < HASHSIZE must hold.
63 * Gets a particular entry from the hash. Useful for doing something over
64 * all entries in the hash.
66 struct ll *gethashtableentry(int entry);
69 * hash_getkeysigs - Gets the signatures on a key.
70 * @keyid: The key we want the signatures for.
72 * This function gets the signatures on a key. It's the same as the
73 * getkeysigs function from the keydb module except we also cache the data
74 * so that if we need it again we already have it available.
76 struct ll *hash_getkeysigs(uint64_t keyid);
78 #endif /* __HASH_H__ */