48static inline unsigned int
52 return (
unsigned) siphash24g(&a->key,
DIGEST_LEN*2);
74 HT_INIT(fp_pair_map_impl, &result->head);
93 memcpy(&(search.key), key,
sizeof(*key));
94 resolve = HT_FIND(fp_pair_map_impl, &(map->head), &search);
96 oldval = resolve->val;
100 memcpy(&(resolve->key), key,
sizeof(*key));
102 HT_INSERT(fp_pair_map_impl, &(map->head), resolve);
115 const char *first,
const char *second,
142 memcpy(&(search.key), key,
sizeof(*key));
143 resolve = HT_FIND(fp_pair_map_impl, &(map->head), &search);
144 if (resolve) val = resolve->val;
155 const char *first,
const char *second)
184 memcpy(&(search.key), key,
sizeof(*key));
185 resolve = HT_REMOVE(fp_pair_map_impl, &(map->head), &search);
204 for (ent = HT_START(fp_pair_map_impl, &(map->head));
205 ent != NULL; ent = next) {
207 next = HT_NEXT_RMV(fp_pair_map_impl, &(map->head), ent);
208 if (free_val) free_val(this->val);
212 HT_CLEAR(fp_pair_map_impl, &(map->head));
225 return HT_EMPTY(&(map->head));
236 return HT_SIZE(&(map->head));
247 return HT_START(fp_pair_map_impl, &(map->head));
260 return HT_NEXT(fp_pair_map_impl, &(map->head), iter);
277 iter = HT_NEXT_RMV(fp_pair_map_impl, &(map->head), iter);
293 if (key_out) memcpy(key_out, &((*iter)->key),
sizeof(
fp_pair_t));
294 if (val_out) *val_out = (*iter)->val;
303 return (iter == NULL);
313 tor_assert(!fp_pair_map_impl_HT_REP_IS_BAD_(&(map->head)));
int tor_memeq(const void *a, const void *b, size_t sz)
fp_pair_map_iter_t * fp_pair_map_iter_next_rmv(fp_pair_map_t *map, fp_pair_map_iter_t *iter)
static int fp_pair_map_entries_eq(const fp_pair_map_entry_t *a, const fp_pair_map_entry_t *b)
int fp_pair_map_isempty(const fp_pair_map_t *map)
void fp_pair_map_iter_get(fp_pair_map_iter_t *iter, fp_pair_t *key_out, void **val_out)
fp_pair_map_iter_t * fp_pair_map_iter_next(fp_pair_map_t *map, fp_pair_map_iter_t *iter)
void * fp_pair_map_set_by_digests(fp_pair_map_t *map, const char *first, const char *second, void *val)
int fp_pair_map_size(const fp_pair_map_t *map)
void * fp_pair_map_get(const fp_pair_map_t *map, const fp_pair_t *key)
void * fp_pair_map_remove(fp_pair_map_t *map, const fp_pair_t *key)
int fp_pair_map_iter_done(fp_pair_map_iter_t *iter)
fp_pair_map_iter_t * fp_pair_map_iter_init(fp_pair_map_t *map)
void * fp_pair_map_get_by_digests(const fp_pair_map_t *map, const char *first, const char *second)
void fp_pair_map_assert_ok(const fp_pair_map_t *map)
void fp_pair_map_free_(fp_pair_map_t *map, void(*free_val)(void *))
void * fp_pair_map_set(fp_pair_map_t *map, const fp_pair_t *key, void *val)
fp_pair_map_t * fp_pair_map_new(void)
static unsigned int fp_pair_map_entry_hash(const fp_pair_map_entry_t *a)
Header file for fp_pair.c.
HT_PROTOTYPE(hs_circuitmap_ht, circuit_t, hs_circuitmap_node, hs_circuit_hash_token, hs_circuits_have_same_token)
typedef HT_HEAD(hs_service_ht, hs_service_t) hs_service_ht
void * tor_reallocarray_(void *ptr, size_t sz1, size_t sz2)
void tor_free_(void *mem)
Master header file for Tor-specific functionality.