]> git.ozlabs.org Git - ccan/blob - ccan/invbloom/_info
03e9fe0bf11f26fead4da4fd688c7b94a4403495
[ccan] / ccan / invbloom / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * invbloom - implementation of invertible bloom lookup tables.
7  *
8  * This code implements a subset of invertible bloom lookup tables
9  * as described in[1].
10  *
11  * [1] Goodrich, Michael T., and Michael Mitzenmacher. "Invertible bloom
12  *     lookup tables." Communication, Control, and Computing (Allerton), 2011
13  *     49th Annual Allerton Conference on. IEEE, 2011.
14  *      http://arxiv.org/pdf/1101.2245
15  *
16  * License: BSD-MIT
17  *
18  * Example:
19  *      #include <ccan/invbloom/invbloom.h>
20  *      #include <stdio.h>
21  *
22  *      int main(int argc, char *argv[])
23  *      {
24  *              unsigned int i, n;
25  *              struct invbloom *ib = invbloom_new(NULL, char *, 16, 0);
26  *
27  *              for (i = 1; i < argc; i++)
28  *                      invbloom_insert(ib, &argv[i]);
29  *
30  *              n = 0;
31  *              for (i = 1; i < argc; i++)
32  *                      n += invbloom_get(ib, &argv[i]);
33  *
34  *              printf("%u out of %u are found\n", n, argc);
35  *
36  *              n = 0;
37  *              for (i = 1; i < argc; i++) {
38  *                      unsigned int j;
39  *                      char **p = invbloom_extract(NULL, ib);
40  *
41  *                      for (j = 1; j < argc; j++) {
42  *                              if (p == &argv[j])
43  *                                      n++;
44  *                      }
45  *                      tal_free(p);
46  *              }
47  *              printf("%u out of %u were extracted\n", n, argc);
48  *              return 0;
49  *      }
50  */
51 int main(int argc, char *argv[])
52 {
53         /* Expect exactly one argument */
54         if (argc != 2)
55                 return 1;
56
57         if (strcmp(argv[1], "depends") == 0) {
58                 printf("ccan/endian\n");
59                 printf("ccan/hash\n");
60                 printf("ccan/short_types\n");
61                 printf("ccan/tal\n");
62                 return 0;
63         }
64
65         return 1;
66 }