GNUnet  0.10.x
container_multiuuidmap.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2008, 2012 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 
29 #define LOG(kind, ...) \
30  GNUNET_log_from(kind, "util-container-multiuuidmap", __VA_ARGS__)
31 
38 #define NEXT_CACHE_SIZE 16
39 
40 
44 struct BigMapEntry {
48  void *value;
49 
53  struct BigMapEntry *next;
54 
58  struct GNUNET_Uuid key;
59 };
60 
61 
65 struct SmallMapEntry {
69  void *value;
70 
74  struct SmallMapEntry *next;
75 
79  const struct GNUNET_Uuid *key;
80 };
81 
82 
86 union MapEntry {
90  struct SmallMapEntry *sme;
91 
95  struct BigMapEntry *bme;
96 };
97 
98 
106  union MapEntry *map;
107 
111  unsigned int size;
112 
116  unsigned int map_length;
117 
123 
128  unsigned int modification_counter;
129 
135  union MapEntry next_cache[NEXT_CACHE_SIZE];
136 
141  unsigned int next_cache_off;
142 };
143 
144 
153  union MapEntry me;
154 
158  unsigned int idx;
159 
164  unsigned int modification_counter;
165 
170 };
171 
172 
189 GNUNET_CONTAINER_multiuuidmap_create(unsigned int len, int do_not_copy_keys)
190 {
192 
193  GNUNET_assert(len > 0);
195  map->map = GNUNET_malloc_large(len * sizeof(union MapEntry));
196  if (NULL == map->map)
197  {
198  GNUNET_free(map);
199  return NULL;
200  }
201  map->map_length = len;
202  map->use_small_entries = do_not_copy_keys;
203  return map;
204 }
205 
206 
213 void
216 {
217  GNUNET_assert(0 == map->next_cache_off);
218  for (unsigned int i = 0; i < map->map_length; i++)
219  {
220  union MapEntry me;
221 
222  me = map->map[i];
223  if (map->use_small_entries)
224  {
225  struct SmallMapEntry *sme;
226  struct SmallMapEntry *nxt;
227 
228  nxt = me.sme;
229  while (NULL != (sme = nxt))
230  {
231  nxt = sme->next;
232  GNUNET_free(sme);
233  }
234  me.sme = NULL;
235  }
236  else
237  {
238  struct BigMapEntry *bme;
239  struct BigMapEntry *nxt;
240 
241  nxt = me.bme;
242  while (NULL != (bme = nxt))
243  {
244  nxt = bme->next;
245  GNUNET_free(bme);
246  }
247  me.bme = NULL;
248  }
249  }
250  GNUNET_free(map->map);
251  GNUNET_free(map);
252 }
253 
254 
262 static unsigned int
264  const struct GNUNET_Uuid *key)
265 {
266  unsigned int kx;
267 
268  GNUNET_assert(NULL != map);
269  GNUNET_memcpy(&kx, key, sizeof(kx));
270  return kx % map->map_length;
271 }
272 
273 
280 unsigned int
282  const struct GNUNET_CONTAINER_MultiUuidmap *map)
283 {
284  return map->size;
285 }
286 
287 
298 void *
300  const struct GNUNET_CONTAINER_MultiUuidmap *map,
301  const struct GNUNET_Uuid *key)
302 {
303  union MapEntry me;
304 
305  me = map->map[idx_of(map, key)];
306  if (map->use_small_entries)
307  {
308  for (struct SmallMapEntry *sme = me.sme; NULL != sme; sme = sme->next)
309  if (0 == GNUNET_memcmp(key, sme->key))
310  return sme->value;
311  }
312  else
313  {
314  for (struct BigMapEntry *bme = me.bme; NULL != bme; bme = bme->next)
315  if (0 == GNUNET_memcmp(key, &bme->key))
316  return bme->value;
317  }
318  return NULL;
319 }
320 
321 
331 int
335  void *it_cls)
336 {
337  int count;
338  union MapEntry me;
339  union MapEntry *ce;
340  struct GNUNET_Uuid kc;
341 
342  count = 0;
343  GNUNET_assert(NULL != map);
344  ce = &map->next_cache[map->next_cache_off];
346  for (unsigned int i = 0; i < map->map_length; i++)
347  {
348  me = map->map[i];
349  if (map->use_small_entries)
350  {
351  struct SmallMapEntry *sme;
352 
353  ce->sme = me.sme;
354  while (NULL != (sme = ce->sme))
355  {
356  ce->sme = sme->next;
357  if ((NULL != it) && (GNUNET_OK != it(it_cls, sme->key, sme->value)))
358  {
360  return GNUNET_SYSERR;
361  }
362  count++;
363  }
364  }
365  else
366  {
367  struct BigMapEntry *bme;
368 
369  ce->bme = me.bme;
370  while (NULL != (bme = ce->bme))
371  {
372  ce->bme = bme->next;
373  if (NULL != it)
374  {
375  kc = bme->key;
376  if (GNUNET_OK != it(it_cls, &kc, bme->value))
377  {
379  return GNUNET_SYSERR;
380  }
381  }
382  count++;
383  }
384  }
385  }
387  return count;
388 }
389 
390 
398 static void
400  const struct BigMapEntry *bme)
401 {
402  for (unsigned int i = 0; i < map->next_cache_off; i++)
403  if (map->next_cache[i].bme == bme)
404  map->next_cache[i].bme = bme->next;
405 }
406 
407 
415 static void
417  const struct SmallMapEntry *sme)
418 {
419  for (unsigned int i = 0; i < map->next_cache_off; i++)
420  if (map->next_cache[i].sme == sme)
421  map->next_cache[i].sme = sme->next;
422 }
423 
424 
436 int
438  const struct GNUNET_Uuid *key,
439  const void *value)
440 {
441  union MapEntry me;
442  unsigned int i;
443 
444  map->modification_counter++;
445  i = idx_of(map, key);
446  me = map->map[i];
447  if (map->use_small_entries)
448  {
449  struct SmallMapEntry *p = NULL;
450 
451  for (struct SmallMapEntry *sme = me.sme; NULL != sme; sme = sme->next)
452  {
453  if ((0 == GNUNET_memcmp(key, sme->key)) && (value == sme->value))
454  {
455  if (NULL == p)
456  map->map[i].sme = sme->next;
457  else
458  p->next = sme->next;
459  update_next_cache_sme(map, sme);
460  GNUNET_free(sme);
461  map->size--;
462  return GNUNET_YES;
463  }
464  p = sme;
465  }
466  }
467  else
468  {
469  struct BigMapEntry *p = NULL;
470 
471  for (struct BigMapEntry *bme = me.bme; NULL != bme; bme = bme->next)
472  {
473  if ((0 == GNUNET_memcmp(key, &bme->key)) && (value == bme->value))
474  {
475  if (NULL == p)
476  map->map[i].bme = bme->next;
477  else
478  p->next = bme->next;
479  update_next_cache_bme(map, bme);
480  GNUNET_free(bme);
481  map->size--;
482  return GNUNET_YES;
483  }
484  p = bme;
485  }
486  }
487  return GNUNET_NO;
488 }
489 
490 
499 int
502  const struct GNUNET_Uuid *key)
503 {
504  union MapEntry me;
505  unsigned int i;
506  int ret;
507 
508  map->modification_counter++;
509 
510  ret = 0;
511  i = idx_of(map, key);
512  me = map->map[i];
513  if (map->use_small_entries)
514  {
515  struct SmallMapEntry *sme;
516  struct SmallMapEntry *p;
517 
518  p = NULL;
519  sme = me.sme;
520  while (NULL != sme)
521  {
522  if (0 == GNUNET_memcmp(key, sme->key))
523  {
524  if (NULL == p)
525  map->map[i].sme = sme->next;
526  else
527  p->next = sme->next;
528  update_next_cache_sme(map, sme);
529  GNUNET_free(sme);
530  map->size--;
531  if (NULL == p)
532  sme = map->map[i].sme;
533  else
534  sme = p->next;
535  ret++;
536  }
537  else
538  {
539  p = sme;
540  sme = sme->next;
541  }
542  }
543  }
544  else
545  {
546  struct BigMapEntry *bme;
547  struct BigMapEntry *p;
548 
549  p = NULL;
550  bme = me.bme;
551  while (NULL != bme)
552  {
553  if (0 == GNUNET_memcmp(key, &bme->key))
554  {
555  if (NULL == p)
556  map->map[i].bme = bme->next;
557  else
558  p->next = bme->next;
559  update_next_cache_bme(map, bme);
560  GNUNET_free(bme);
561  map->size--;
562  if (NULL == p)
563  bme = map->map[i].bme;
564  else
565  bme = p->next;
566  ret++;
567  }
568  else
569  {
570  p = bme;
571  bme = bme->next;
572  }
573  }
574  }
575  return ret;
576 }
577 
578 
588 int
590  const struct GNUNET_CONTAINER_MultiUuidmap *map,
591  const struct GNUNET_Uuid *key)
592 {
593  union MapEntry me;
594 
595  me = map->map[idx_of(map, key)];
596  if (map->use_small_entries)
597  {
598  for (struct SmallMapEntry *sme = me.sme; NULL != sme; sme = sme->next)
599  if (0 == GNUNET_memcmp(key, sme->key))
600  return GNUNET_YES;
601  }
602  else
603  {
604  for (struct BigMapEntry *bme = me.bme; NULL != bme; bme = bme->next)
605  if (0 == GNUNET_memcmp(key, &bme->key))
606  return GNUNET_YES;
607  }
608  return GNUNET_NO;
609 }
610 
611 
622 int
624  const struct GNUNET_CONTAINER_MultiUuidmap *map,
625  const struct GNUNET_Uuid *key,
626  const void *value)
627 {
628  union MapEntry me;
629 
630  me = map->map[idx_of(map, key)];
631  if (map->use_small_entries)
632  {
633  for (struct SmallMapEntry *sme = me.sme; NULL != sme; sme = sme->next)
634  if ((0 == GNUNET_memcmp(key, sme->key)) && (sme->value == value))
635  return GNUNET_YES;
636  }
637  else
638  {
639  for (struct BigMapEntry *bme = me.bme; NULL != bme; bme = bme->next)
640  if ((0 == GNUNET_memcmp(key, &bme->key)) && (bme->value == value))
641  return GNUNET_YES;
642  }
643  return GNUNET_NO;
644 }
645 
646 
652 static void
654 {
655  union MapEntry *old_map;
656  union MapEntry *new_map;
657  unsigned int old_len;
658  unsigned int new_len;
659  unsigned int idx;
660 
661  old_map = map->map;
662  old_len = map->map_length;
663  new_len = old_len * 2;
664  if (0 == new_len) /* 2^31 * 2 == 0 */
665  new_len = old_len; /* never use 0 */
666  if (new_len == old_len)
667  return; /* nothing changed */
668  new_map = GNUNET_malloc_large(new_len * sizeof(union MapEntry));
669  if (NULL == new_map)
670  return; /* grow not possible */
671  map->modification_counter++;
672  map->map_length = new_len;
673  map->map = new_map;
674  for (unsigned int i = 0; i < old_len; i++)
675  {
676  if (map->use_small_entries)
677  {
678  struct SmallMapEntry *sme;
679 
680  while (NULL != (sme = old_map[i].sme))
681  {
682  old_map[i].sme = sme->next;
683  idx = idx_of(map, sme->key);
684  sme->next = new_map[idx].sme;
685  new_map[idx].sme = sme;
686  }
687  }
688  else
689  {
690  struct BigMapEntry *bme;
691 
692  while (NULL != (bme = old_map[i].bme))
693  {
694  old_map[i].bme = bme->next;
695  idx = idx_of(map, &bme->key);
696  bme->next = new_map[idx].bme;
697  new_map[idx].bme = bme;
698  }
699  }
700  }
701  GNUNET_free(old_map);
702 }
703 
704 
717 int
719  const struct GNUNET_Uuid *key,
720  void *value,
722 {
723  union MapEntry me;
724  unsigned int i;
725 
726  i = idx_of(map, key);
729  {
730  me = map->map[i];
731  if (map->use_small_entries)
732  {
733  for (struct SmallMapEntry *sme = me.sme; NULL != sme; sme = sme->next)
734  if (0 == GNUNET_memcmp(key, sme->key))
735  {
737  return GNUNET_SYSERR;
738  sme->value = value;
739  return GNUNET_NO;
740  }
741  }
742  else
743  {
744  for (struct BigMapEntry *bme = me.bme; NULL != bme; bme = bme->next)
745  if (0 == GNUNET_memcmp(key, &bme->key))
746  {
748  return GNUNET_SYSERR;
749  bme->value = value;
750  return GNUNET_NO;
751  }
752  }
753  }
754  if (map->size / 3 >= map->map_length / 4)
755  {
756  grow(map);
757  i = idx_of(map, key);
758  }
759  if (map->use_small_entries)
760  {
761  struct SmallMapEntry *sme;
762 
763  sme = GNUNET_new(struct SmallMapEntry);
764  sme->key = key;
765  sme->value = value;
766  sme->next = map->map[i].sme;
767  map->map[i].sme = sme;
768  }
769  else
770  {
771  struct BigMapEntry *bme;
772 
773  bme = GNUNET_new(struct BigMapEntry);
774  bme->key = *key;
775  bme->value = value;
776  bme->next = map->map[i].bme;
777  map->map[i].bme = bme;
778  }
779  map->size++;
780  return GNUNET_OK;
781 }
782 
783 
794 int
797  const struct GNUNET_Uuid *key,
799  void *it_cls)
800 {
801  int count;
802  union MapEntry me;
803  union MapEntry *ce;
804 
805  ce = &map->next_cache[map->next_cache_off];
807  count = 0;
808  me = map->map[idx_of(map, key)];
809  if (map->use_small_entries)
810  {
811  struct SmallMapEntry *sme;
812 
813  ce->sme = me.sme;
814  while (NULL != (sme = ce->sme))
815  {
816  ce->sme = sme->next;
817  if (0 != GNUNET_memcmp(key, sme->key))
818  continue;
819  if ((NULL != it) && (GNUNET_OK != it(it_cls, key, sme->value)))
820  {
822  return GNUNET_SYSERR;
823  }
824  count++;
825  }
826  }
827  else
828  {
829  struct BigMapEntry *bme;
830 
831  ce->bme = me.bme;
832  while (NULL != (bme = ce->bme))
833  {
834  ce->bme = bme->next;
835  if (0 != GNUNET_memcmp(key, &bme->key))
836  continue;
837  if ((NULL != it) && (GNUNET_OK != it(it_cls, key, bme->value)))
838  {
840  return GNUNET_SYSERR;
841  }
842  count++;
843  }
844  }
846  return count;
847 }
848 
849 
861 unsigned int
863  const struct GNUNET_CONTAINER_MultiUuidmap *map,
865  void *it_cls)
866 {
867  unsigned int off;
868  union MapEntry me;
869 
870  if (0 == map->size)
871  return 0;
872  if (NULL == it)
873  return 1;
875  for (unsigned int idx = 0; idx < map->map_length; idx++)
876  {
877  me = map->map[idx];
878  if (map->use_small_entries)
879  {
880  for (struct SmallMapEntry *sme = me.sme; NULL != sme; sme = sme->next)
881  {
882  if (0 == off)
883  {
884  if (GNUNET_OK != it(it_cls, sme->key, sme->value))
885  return GNUNET_SYSERR;
886  return 1;
887  }
888  off--;
889  }
890  }
891  else
892  {
893  for (struct BigMapEntry *bme = me.bme; NULL != bme; bme = bme->next)
894  {
895  if (0 == off)
896  {
897  if (GNUNET_OK != it(it_cls, &bme->key, bme->value))
898  return GNUNET_SYSERR;
899  return 1;
900  }
901  off--;
902  }
903  }
904  }
905  GNUNET_break(0);
906  return GNUNET_SYSERR;
907 }
908 
909 
924  const struct GNUNET_CONTAINER_MultiUuidmap *map)
925 {
927 
929  iter->map = map;
931  iter->me = map->map[0];
932  return iter;
933 }
934 
935 
950 int
953  struct GNUNET_Uuid *key,
954  const void **value)
955 {
956  /* make sure the map has not been modified */
958 
959  /* look for the next entry, skipping empty buckets */
960  while (1)
961  {
962  if (iter->idx >= iter->map->map_length)
963  return GNUNET_NO;
964  if (GNUNET_YES == iter->map->use_small_entries)
965  {
966  if (NULL != iter->me.sme)
967  {
968  if (NULL != key)
969  *key = *iter->me.sme->key;
970  if (NULL != value)
971  *value = iter->me.sme->value;
972  iter->me.sme = iter->me.sme->next;
973  return GNUNET_YES;
974  }
975  }
976  else
977  {
978  if (NULL != iter->me.bme)
979  {
980  if (NULL != key)
981  *key = iter->me.bme->key;
982  if (NULL != value)
983  *value = iter->me.bme->value;
984  iter->me.bme = iter->me.bme->next;
985  return GNUNET_YES;
986  }
987  }
988  iter->idx += 1;
989  if (iter->idx < iter->map->map_length)
990  iter->me = iter->map->map[iter->idx];
991  }
992 }
993 
994 
1000 void
1003 {
1004  GNUNET_free(iter);
1005 }
1006 
1007 
1008 /* end of container_multiuuidmap.c */
static void update_next_cache_sme(struct GNUNET_CONTAINER_MultiUuidmap *map, const struct SmallMapEntry *sme)
We are about to free() the sme, make sure it is not in the list of next values for any iterator in th...
void GNUNET_CONTAINER_multiuuidmap_iterator_destroy(struct GNUNET_CONTAINER_MultiUuidmapIterator *iter)
Destroy a multiuuidmap iterator.
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity me
Our own peer identity.
GNUNET_CONTAINER_MultiHashMapOption
Options for storing values in the HashMap.
struct SmallMapEntry * next
If there is a hash collision, we create a linked list.
int GNUNET_CONTAINER_multiuuidmap_iterate(struct GNUNET_CONTAINER_MultiUuidmap *map, GNUNET_CONTAINER_MultiUuidmapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void * value
Value of the entry.
int GNUNET_CONTAINER_multiuuidmap_remove_all(struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
Remove all entries for the given key from the map.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void grow(struct GNUNET_CONTAINER_MultiUuidmap *map)
Grow the given map to a more appropriate size.
int GNUNET_CONTAINER_multiuuidmap_put(struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void GNUNET_CONTAINER_multiuuidmap_destroy(struct GNUNET_CONTAINER_MultiUuidmap *map)
Destroy a hash map.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const struct GNUNET_HashCode * key
Key for the entry.
#define GNUNET_NO
Definition: gnunet_common.h:78
void * value
Value of the entry.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_new(type)
Allocate a struct or union of the given type.
unsigned int modification_counter
Modification counter as observed on the map when the iterator was created.
struct SmallMapEntry * sme
Variant used if map entries only contain a pointer to the key.
int GNUNET_CONTAINER_multiuuidmap_remove(struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, const void *value)
Remove the given key-value pair from the map.
Internal representation of the hash map.
static int ret
Final status code.
Definition: gnunet-arm.c:89
#define GNUNET_malloc_large(size)
Wrapper around malloc.
#define NEXT_CACHE_SIZE
Maximum recursion depth for callbacks of GNUNET_CONTAINER_multihashmap_get_multiple() themselve s aga...
const struct GNUNET_CONTAINER_MultiUuidmap * map
Map that we are iterating over.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
unsigned int size
Number of entries in the map.
struct BigMapEntry * next
If there is a hash collision, we create a linked list.
static struct GNUNET_CONTAINER_MultiPeerMap * map
Handle to the map used to store old latency values for peers.
int GNUNET_CONTAINER_multiuuidmap_get_multiple(struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, GNUNET_CONTAINER_MultiUuidmapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
unsigned int idx
Current bucket index.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
, &#39; bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
Entry in the map.
unsigned int GNUNET_CONTAINER_multiuuidmap_get_random(const struct GNUNET_CONTAINER_MultiUuidmap *map, GNUNET_CONTAINER_MultiUuidmapIteratorCallback it, void *it_cls)
Call it on a random value from the map, or not at all if the map is empty.
Randomness for IVs etc.
A UUID, a 128 bit random value.
struct GNUNET_CONTAINER_MultiUuidmap * GNUNET_CONTAINER_multiuuidmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
union MapEntry me
Position in the bucket &#39;idx&#39;.
unsigned int GNUNET_CONTAINER_multiuuidmap_size(const struct GNUNET_CONTAINER_MultiUuidmap *map)
Get the number of key-value pairs in the map.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
unsigned int modification_counter
Counts the destructive modifications (grow, remove) to the map, so that iterators can check if they a...
int GNUNET_CONTAINER_multiuuidmap_contains(const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
Check if the map contains any value under the given key (including values that are NULL)...
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
struct GNUNET_CONTAINER_MultiUuidmapIterator * GNUNET_CONTAINER_multiuuidmap_iterator_create(const struct GNUNET_CONTAINER_MultiUuidmap *map)
Create an iterator for a multiuuidmap.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
int(* GNUNET_CONTAINER_MultiUuidmapIteratorCallback)(void *cls, const struct GNUNET_Uuid *key, void *value)
Iterator over uuid map entries.
Allow multiple values with the same key.
static void update_next_cache_bme(struct GNUNET_CONTAINER_MultiUuidmap *map, const struct BigMapEntry *bme)
We are about to free() the bme, make sure it is not in the list of next values for any iterator in th...
An entry in the hash map with just a pointer to the key.
const struct GNUNET_Uuid * key
Key for the entry.
int GNUNET_CONTAINER_multiuuidmap_contains_value(const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, const void *value)
Check if the map contains the given value under the given key.
int GNUNET_CONTAINER_multiuuidmap_iterator_next(struct GNUNET_CONTAINER_MultiUuidmapIterator *iter, struct GNUNET_Uuid *key, const void **value)
Retrieve the next element from the hash map at the iterator&#39;s position.
static unsigned int idx_of(const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
Compute the index of the bucket for the given key.
unsigned int next_cache_off
Offset of next_cache entries in use, must be smaller than NEXT_CACHE_SIZE.
int use_small_entries
GNUNET_NO if the map entries are of type &#39;struct BigMapEntry&#39;, GNUNET_YES if the map entries are of t...
An entry in the hash map with the full key.
union MapEntry next_cache[16]
Map entries indicating iteration positions currently in use by GNUNET_CONTAINER_multihashmap_get_mult...
#define GNUNET_YES
Definition: gnunet_common.h:77
struct BigMapEntry * bme
Variant used if map entries contain the full key.
unsigned int map_length
Length of the "map" array.
union MapEntry * map
All of our buckets.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_HashCode key
Key for the entry.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
void * GNUNET_CONTAINER_multiuuidmap_get(const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
Given a key find a value in the map matching the key.