diff options
Diffstat (limited to 'src')
149 files changed, 1954 insertions, 1833 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 2b1e94c50..524b989c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -5,8 +5,7 @@ | |||
5 | SUBDIRS = \ | 5 | SUBDIRS = \ |
6 | include $(INTLEMU_SUBDIRS) \ | 6 | include $(INTLEMU_SUBDIRS) \ |
7 | lib \ | 7 | lib \ |
8 | service \ | ||
9 | plugin \ | 8 | plugin \ |
10 | rest-plugin \ | 9 | service \ |
11 | cli \ | 10 | cli \ |
12 | contrib | 11 | contrib |
diff --git a/src/cli/namestore/meson.build b/src/cli/namestore/meson.build index 2bad795b9..e619876c5 100644 --- a/src/cli/namestore/meson.build +++ b/src/cli/namestore/meson.build | |||
@@ -1,5 +1,5 @@ | |||
1 | executable ('gnunet-namestore', | 1 | executable ('gnunet-namestore', |
2 | gnunetnamestore_src, | 2 | ['gnunet-namestore.c'], |
3 | dependencies: [libgnunetnamestore_dep, | 3 | dependencies: [libgnunetnamestore_dep, |
4 | libgnunetutil_dep, | 4 | libgnunetutil_dep, |
5 | libgnunetgnsrecord_dep, | 5 | libgnunetgnsrecord_dep, |
diff --git a/src/cli/revocation/Makefile.am b/src/cli/revocation/Makefile.am index 6bd4919f9..3f8f5bb69 100644 --- a/src/cli/revocation/Makefile.am +++ b/src/cli/revocation/Makefile.am | |||
@@ -20,6 +20,7 @@ gnunet_revocation_SOURCES = \ | |||
20 | gnunet_revocation_LDADD = \ | 20 | gnunet_revocation_LDADD = \ |
21 | $(top_builddir)/src/service/revocation/libgnunetrevocation.la \ | 21 | $(top_builddir)/src/service/revocation/libgnunetrevocation.la \ |
22 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | 22 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ |
23 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | ||
23 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 24 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
24 | $(GN_LIBINTL) | 25 | $(GN_LIBINTL) |
25 | 26 | ||
@@ -27,7 +28,7 @@ gnunet_revocation_tvg_SOURCES = \ | |||
27 | gnunet-revocation-tvg.c | 28 | gnunet-revocation-tvg.c |
28 | gnunet_revocation_tvg_LDADD = \ | 29 | gnunet_revocation_tvg_LDADD = \ |
29 | $(top_builddir)/src/service/revocation/libgnunetrevocation.la \ | 30 | $(top_builddir)/src/service/revocation/libgnunetrevocation.la \ |
30 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | 31 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
31 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 32 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
32 | $(GN_LIBINTL) | 33 | $(GN_LIBINTL) |
33 | 34 | ||
diff --git a/src/cli/revocation/gnunet-revocation-tvg.c b/src/cli/revocation/gnunet-revocation-tvg.c index 7d354ed74..5c2bfbe45 100644 --- a/src/cli/revocation/gnunet-revocation-tvg.c +++ b/src/cli/revocation/gnunet-revocation-tvg.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_revocation_service.h" | 29 | #include "gnunet_revocation_service.h" |
30 | #include "gnunet_testing_lib.h" | 30 | #include "gnunet_testing_lib.h" |
31 | // FIXME try to avoid this include somehow | 31 | // FIXME try to avoid this include somehow |
32 | #include "../../service/revocation/revocation.h" | 32 | #include "../../lib/gnsrecord/gnsrecord_crypto.h" |
33 | #include <inttypes.h> | 33 | #include <inttypes.h> |
34 | 34 | ||
35 | #define TEST_EPOCHS 2 | 35 | #define TEST_EPOCHS 2 |
@@ -105,8 +105,8 @@ static void | |||
105 | run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv) | 105 | run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv) |
106 | { | 106 | { |
107 | struct GNUNET_CRYPTO_PublicKey id_pub; | 107 | struct GNUNET_CRYPTO_PublicKey id_pub; |
108 | struct GNUNET_REVOCATION_PowP *pow; | 108 | struct GNUNET_GNSRECORD_PowP *pow; |
109 | struct GNUNET_REVOCATION_PowCalculationHandle *ph; | 109 | struct GNUNET_GNSRECORD_PowCalculationHandle *ph; |
110 | struct GNUNET_TIME_Relative exp; | 110 | struct GNUNET_TIME_Relative exp; |
111 | char ztld[128]; | 111 | char ztld[128]; |
112 | ssize_t key_len; | 112 | ssize_t key_len; |
@@ -127,10 +127,10 @@ run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv) | |||
127 | fprintf (stdout, "Encoded zone identifier (zkl = zTLD):\n"); | 127 | fprintf (stdout, "Encoded zone identifier (zkl = zTLD):\n"); |
128 | fprintf (stdout, "%s\n", ztld); | 128 | fprintf (stdout, "%s\n", ztld); |
129 | fprintf (stdout, "\n"); | 129 | fprintf (stdout, "\n"); |
130 | pow = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE); | 130 | pow = GNUNET_malloc (GNUNET_MAX_POW_SIZE); |
131 | GNUNET_REVOCATION_pow_init (id_priv, | 131 | GNUNET_GNSRECORD_pow_init (id_priv, |
132 | pow); | 132 | pow); |
133 | ph = GNUNET_REVOCATION_pow_start (pow, | 133 | ph = GNUNET_GNSRECORD_pow_start (pow, |
134 | TEST_EPOCHS, | 134 | TEST_EPOCHS, |
135 | TEST_DIFFICULTY); | 135 | TEST_DIFFICULTY); |
136 | fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n", | 136 | fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n", |
@@ -138,12 +138,12 @@ run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv) | |||
138 | TEST_EPOCHS, | 138 | TEST_EPOCHS, |
139 | TEST_DIFFICULTY + TEST_EPOCHS); | 139 | TEST_DIFFICULTY + TEST_EPOCHS); |
140 | uint64_t pow_passes = 0; | 140 | uint64_t pow_passes = 0; |
141 | while (GNUNET_YES != GNUNET_REVOCATION_pow_round (ph)) | 141 | while (GNUNET_YES != GNUNET_GNSRECORD_pow_round (ph)) |
142 | { | 142 | { |
143 | pow_passes++; | 143 | pow_passes++; |
144 | } | 144 | } |
145 | struct GNUNET_REVOCATION_SignaturePurposePS *purp; | 145 | struct GNUNET_GNSRECORD_SignaturePurposePS *purp; |
146 | purp = REV_create_signature_message (pow); | 146 | purp = GNR_create_signature_message (pow); |
147 | fprintf (stdout, "Signed message:\n"); | 147 | fprintf (stdout, "Signed message:\n"); |
148 | print_bytes (purp, | 148 | print_bytes (purp, |
149 | ntohl (purp->purpose.size), | 149 | ntohl (purp->purpose.size), |
@@ -153,12 +153,12 @@ run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv) | |||
153 | 153 | ||
154 | exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, | 154 | exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, |
155 | TEST_EPOCHS); | 155 | TEST_EPOCHS); |
156 | GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (pow, | 156 | GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_check_pow (pow, |
157 | TEST_DIFFICULTY, | 157 | TEST_DIFFICULTY, |
158 | exp)); | 158 | exp)); |
159 | fprintf (stdout, "Proof:\n"); | 159 | fprintf (stdout, "Proof:\n"); |
160 | print_bytes (pow, | 160 | print_bytes (pow, |
161 | GNUNET_REVOCATION_proof_get_size (pow), | 161 | GNUNET_GNSRECORD_proof_get_size (pow), |
162 | 8); | 162 | 8); |
163 | GNUNET_free (ph); | 163 | GNUNET_free (ph); |
164 | 164 | ||
diff --git a/src/cli/revocation/gnunet-revocation.c b/src/cli/revocation/gnunet-revocation.c index 9667e7655..add9a003b 100644 --- a/src/cli/revocation/gnunet-revocation.c +++ b/src/cli/revocation/gnunet-revocation.c | |||
@@ -24,9 +24,9 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_gnsrecord_lib.h" | ||
27 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_revocation_service.h" | 29 | #include "gnunet_revocation_service.h" |
29 | #include "gnunet_identity_service.h" | ||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Pow passes | 32 | * Pow passes |
@@ -101,7 +101,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task; | |||
101 | /** | 101 | /** |
102 | * Proof-of-work object | 102 | * Proof-of-work object |
103 | */ | 103 | */ |
104 | static struct GNUNET_REVOCATION_PowP *proof_of_work; | 104 | static struct GNUNET_GNSRECORD_PowP *proof_of_work; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Function run if the user aborts with CTRL-C. | 107 | * Function run if the user aborts with CTRL-C. |
@@ -228,7 +228,7 @@ perform_revocation () | |||
228 | static void | 228 | static void |
229 | sync_pow () | 229 | sync_pow () |
230 | { | 230 | { |
231 | size_t psize = GNUNET_REVOCATION_proof_get_size (proof_of_work); | 231 | size_t psize = GNUNET_GNSRECORD_proof_get_size (proof_of_work); |
232 | if ((NULL != filename) && | 232 | if ((NULL != filename) && |
233 | (GNUNET_OK != | 233 | (GNUNET_OK != |
234 | GNUNET_DISK_fn_write (filename, | 234 | GNUNET_DISK_fn_write (filename, |
@@ -248,7 +248,7 @@ sync_pow () | |||
248 | static void | 248 | static void |
249 | calculate_pow_shutdown (void *cls) | 249 | calculate_pow_shutdown (void *cls) |
250 | { | 250 | { |
251 | struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls; | 251 | struct GNUNET_GNSRECORD_PowCalculationHandle *ph = cls; |
252 | fprintf (stderr, "%s", _ ("Cancelling calculation.\n")); | 252 | fprintf (stderr, "%s", _ ("Cancelling calculation.\n")); |
253 | sync_pow (); | 253 | sync_pow (); |
254 | if (NULL != pow_task) | 254 | if (NULL != pow_task) |
@@ -257,7 +257,7 @@ calculate_pow_shutdown (void *cls) | |||
257 | pow_task = NULL; | 257 | pow_task = NULL; |
258 | } | 258 | } |
259 | if (NULL != ph) | 259 | if (NULL != ph) |
260 | GNUNET_REVOCATION_pow_stop (ph); | 260 | GNUNET_GNSRECORD_pow_stop (ph); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
@@ -269,7 +269,7 @@ calculate_pow_shutdown (void *cls) | |||
269 | static void | 269 | static void |
270 | calculate_pow (void *cls) | 270 | calculate_pow (void *cls) |
271 | { | 271 | { |
272 | struct GNUNET_REVOCATION_PowCalculationHandle *ph = cls; | 272 | struct GNUNET_GNSRECORD_PowCalculationHandle *ph = cls; |
273 | size_t psize; | 273 | size_t psize; |
274 | 274 | ||
275 | /* store temporary results */ | 275 | /* store temporary results */ |
@@ -277,9 +277,9 @@ calculate_pow (void *cls) | |||
277 | if (0 == (pow_passes % 128)) | 277 | if (0 == (pow_passes % 128)) |
278 | sync_pow (); | 278 | sync_pow (); |
279 | /* actually do POW calculation */ | 279 | /* actually do POW calculation */ |
280 | if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph)) | 280 | if (GNUNET_OK == GNUNET_GNSRECORD_pow_round (ph)) |
281 | { | 281 | { |
282 | psize = GNUNET_REVOCATION_proof_get_size (proof_of_work); | 282 | psize = GNUNET_GNSRECORD_proof_get_size (proof_of_work); |
283 | if (NULL != filename) | 283 | if (NULL != filename) |
284 | { | 284 | { |
285 | (void) GNUNET_DISK_directory_remove (filename); | 285 | (void) GNUNET_DISK_directory_remove (filename); |
@@ -325,7 +325,7 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
325 | { | 325 | { |
326 | struct GNUNET_CRYPTO_PublicKey key; | 326 | struct GNUNET_CRYPTO_PublicKey key; |
327 | const struct GNUNET_CRYPTO_PrivateKey *privkey; | 327 | const struct GNUNET_CRYPTO_PrivateKey *privkey; |
328 | struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL; | 328 | struct GNUNET_GNSRECORD_PowCalculationHandle *ph = NULL; |
329 | size_t psize; | 329 | size_t psize; |
330 | 330 | ||
331 | el = NULL; | 331 | el = NULL; |
@@ -337,11 +337,11 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
337 | } | 337 | } |
338 | GNUNET_IDENTITY_ego_get_public_key (ego, &key); | 338 | GNUNET_IDENTITY_ego_get_public_key (ego, &key); |
339 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 339 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
340 | proof_of_work = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE); | 340 | proof_of_work = GNUNET_malloc (GNUNET_MAX_POW_SIZE); |
341 | if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && | 341 | if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && |
342 | (0 < (psize = | 342 | (0 < (psize = |
343 | GNUNET_DISK_fn_read (filename, proof_of_work, | 343 | GNUNET_DISK_fn_read (filename, proof_of_work, |
344 | GNUNET_REVOCATION_MAX_PROOF_SIZE)))) | 344 | GNUNET_MAX_POW_SIZE)))) |
345 | { | 345 | { |
346 | ssize_t ksize = GNUNET_CRYPTO_public_key_get_length (&key); | 346 | ssize_t ksize = GNUNET_CRYPTO_public_key_get_length (&key); |
347 | if (0 > ksize) | 347 | if (0 > ksize) |
@@ -360,9 +360,9 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
360 | return; | 360 | return; |
361 | } | 361 | } |
362 | if (GNUNET_YES == | 362 | if (GNUNET_YES == |
363 | GNUNET_REVOCATION_check_pow (proof_of_work, | 363 | GNUNET_GNSRECORD_check_pow (proof_of_work, |
364 | (unsigned int) matching_bits, | 364 | (unsigned int) matching_bits, |
365 | epoch_duration)) | 365 | epoch_duration)) |
366 | { | 366 | { |
367 | fprintf (stderr, "%s", _ ("Revocation certificate ready\n")); | 367 | fprintf (stderr, "%s", _ ("Revocation certificate ready\n")); |
368 | if (perform) | 368 | if (perform) |
@@ -377,20 +377,20 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
377 | fprintf (stderr, | 377 | fprintf (stderr, |
378 | "%s", | 378 | "%s", |
379 | _ ("Continuing calculation where left off...\n")); | 379 | _ ("Continuing calculation where left off...\n")); |
380 | ph = GNUNET_REVOCATION_pow_start (proof_of_work, | 380 | ph = GNUNET_GNSRECORD_pow_start (proof_of_work, |
381 | epochs, | 381 | epochs, |
382 | matching_bits); | 382 | matching_bits); |
383 | } | 383 | } |
384 | fprintf (stderr, | 384 | fprintf (stderr, |
385 | "%s", | 385 | "%s", |
386 | _ ("Revocation certificate not ready, calculating proof of work\n")); | 386 | _ ("Revocation certificate not ready, calculating proof of work\n")); |
387 | if (NULL == ph) | 387 | if (NULL == ph) |
388 | { | 388 | { |
389 | GNUNET_REVOCATION_pow_init (privkey, | 389 | GNUNET_GNSRECORD_pow_init (privkey, |
390 | proof_of_work); | 390 | proof_of_work); |
391 | ph = GNUNET_REVOCATION_pow_start (proof_of_work, | 391 | ph = GNUNET_GNSRECORD_pow_start (proof_of_work, |
392 | epochs, /* Epochs */ | 392 | epochs, /* Epochs */ |
393 | matching_bits); | 393 | matching_bits); |
394 | } | 394 | } |
395 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); | 395 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); |
396 | GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph); | 396 | GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph); |
@@ -419,7 +419,7 @@ run (void *cls, | |||
419 | { | 419 | { |
420 | if (GNUNET_OK != | 420 | if (GNUNET_OK != |
421 | GNUNET_CRYPTO_public_key_from_string (test_ego, | 421 | GNUNET_CRYPTO_public_key_from_string (test_ego, |
422 | &pk)) | 422 | &pk)) |
423 | { | 423 | { |
424 | fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego); | 424 | fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego); |
425 | return; | 425 | return; |
@@ -472,17 +472,17 @@ run (void *cls, | |||
472 | if ((NULL != filename) && (perform)) | 472 | if ((NULL != filename) && (perform)) |
473 | { | 473 | { |
474 | size_t bread; | 474 | size_t bread; |
475 | proof_of_work = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE); | 475 | proof_of_work = GNUNET_malloc (GNUNET_MAX_POW_SIZE); |
476 | if (0 < (bread = GNUNET_DISK_fn_read (filename, | 476 | if (0 < (bread = GNUNET_DISK_fn_read (filename, |
477 | proof_of_work, | 477 | proof_of_work, |
478 | GNUNET_REVOCATION_MAX_PROOF_SIZE))) | 478 | GNUNET_MAX_POW_SIZE))) |
479 | { | 479 | { |
480 | fprintf (stderr, | 480 | fprintf (stderr, |
481 | _ ("Failed to read revocation certificate from `%s'\n"), | 481 | _ ("Failed to read revocation certificate from `%s'\n"), |
482 | filename); | 482 | filename); |
483 | return; | 483 | return; |
484 | } | 484 | } |
485 | psize = GNUNET_REVOCATION_proof_get_size (proof_of_work); | 485 | psize = GNUNET_GNSRECORD_proof_get_size (proof_of_work); |
486 | if (bread != psize) | 486 | if (bread != psize) |
487 | { | 487 | { |
488 | fprintf (stderr, | 488 | fprintf (stderr, |
@@ -492,14 +492,14 @@ run (void *cls, | |||
492 | } | 492 | } |
493 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 493 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
494 | if (GNUNET_YES != | 494 | if (GNUNET_YES != |
495 | GNUNET_REVOCATION_check_pow (proof_of_work, | 495 | GNUNET_GNSRECORD_check_pow (proof_of_work, |
496 | (unsigned int) matching_bits, | 496 | (unsigned int) matching_bits, |
497 | epoch_duration)) | 497 | epoch_duration)) |
498 | { | 498 | { |
499 | struct GNUNET_REVOCATION_PowCalculationHandle *ph; | 499 | struct GNUNET_GNSRECORD_PowCalculationHandle *ph; |
500 | ph = GNUNET_REVOCATION_pow_start (proof_of_work, | 500 | ph = GNUNET_GNSRECORD_pow_start (proof_of_work, |
501 | epochs, /* Epochs */ | 501 | epochs, /* Epochs */ |
502 | matching_bits); | 502 | matching_bits); |
503 | 503 | ||
504 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); | 504 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); |
505 | GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph); | 505 | GNUNET_SCHEDULER_add_shutdown (&calculate_pow_shutdown, ph); |
diff --git a/src/cli/revocation/meson.build b/src/cli/revocation/meson.build index 83923c278..090b381df 100644 --- a/src/cli/revocation/meson.build +++ b/src/cli/revocation/meson.build | |||
@@ -4,9 +4,19 @@ executable ('gnunet-revocation', | |||
4 | libgnunetutil_dep, | 4 | libgnunetutil_dep, |
5 | libgnunetstatistics_dep, | 5 | libgnunetstatistics_dep, |
6 | libgnunetcore_dep, | 6 | libgnunetcore_dep, |
7 | libgnunetgnsrecord_dep, | ||
7 | libgnunetsetu_dep, | 8 | libgnunetsetu_dep, |
8 | libgnunetidentity_dep], | 9 | libgnunetidentity_dep], |
9 | include_directories: [incdir, configuration_inc], | 10 | include_directories: [incdir, configuration_inc], |
10 | install: true, | 11 | install: true, |
11 | install_dir: get_option('bindir')) | 12 | install_dir: get_option('bindir')) |
12 | 13 | ||
14 | executable ('gnunet-revocation-tvg', | ||
15 | ['gnunet-revocation.c'], | ||
16 | dependencies: [libgnunetrevocation_dep, | ||
17 | libgnunetutil_dep, | ||
18 | libgnunetgnsrecord_dep, | ||
19 | libgnunetidentity_dep], | ||
20 | include_directories: [incdir, configuration_inc], | ||
21 | install: false) | ||
22 | |||
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index ca51f586c..f3ea3ed25 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -3637,8 +3637,6 @@ GNUNET_CRYPTO_key_get_public (const struct | |||
3637 | GNUNET_CRYPTO_PrivateKey *privkey, | 3637 | GNUNET_CRYPTO_PrivateKey *privkey, |
3638 | struct GNUNET_CRYPTO_PublicKey *key); | 3638 | struct GNUNET_CRYPTO_PublicKey *key); |
3639 | 3639 | ||
3640 | |||
3641 | |||
3642 | #if 0 /* keep Emacsens' auto-indent happy */ | 3640 | #if 0 /* keep Emacsens' auto-indent happy */ |
3643 | { | 3641 | { |
3644 | #endif | 3642 | #endif |
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index d78e637e8..3f1830498 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -829,6 +829,135 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label, | |||
829 | enum GNUNET_GenericReturnValue | 829 | enum GNUNET_GenericReturnValue |
830 | GNUNET_GNSRECORD_label_check (const char*label, char **emsg); | 830 | GNUNET_GNSRECORD_label_check (const char*label, char **emsg); |
831 | 831 | ||
832 | /** | ||
833 | * Maximum length of a revocation | ||
834 | */ | ||
835 | #define GNUNET_MAX_POW_SIZE sizeof(struct GNUNET_GNSRECORD_PowP) +\ | ||
836 | sizeof(struct GNUNET_CRYPTO_PublicKey) +\ | ||
837 | 1024 //FIXME max sig_len | ||
838 | |||
839 | /** | ||
840 | * The proof-of-work narrowing factor. | ||
841 | * The number of PoWs that are calculates as part of revocation. | ||
842 | */ | ||
843 | #define POW_COUNT 32 | ||
844 | |||
845 | |||
846 | GNUNET_NETWORK_STRUCT_BEGIN | ||
847 | |||
848 | /** | ||
849 | * Struct for a proof of work as part of the revocation. | ||
850 | */ | ||
851 | struct GNUNET_GNSRECORD_PowP | ||
852 | { | ||
853 | /** | ||
854 | * The timestamp of the revocation | ||
855 | */ | ||
856 | struct GNUNET_TIME_AbsoluteNBO timestamp; | ||
857 | |||
858 | /** | ||
859 | * The TTL of this revocation (purely informational) | ||
860 | */ | ||
861 | struct GNUNET_TIME_RelativeNBO ttl; | ||
862 | |||
863 | /** | ||
864 | * The PoWs | ||
865 | */ | ||
866 | uint64_t pow[POW_COUNT] GNUNET_PACKED; | ||
867 | |||
868 | /** followed by the public key type, the key and a signature **/ | ||
869 | }; | ||
870 | |||
871 | |||
872 | /** | ||
873 | * The signature object we use for the PoW | ||
874 | */ | ||
875 | struct GNUNET_GNSRECORD_SignaturePurposePS | ||
876 | { | ||
877 | /** | ||
878 | * The signature purpose | ||
879 | */ | ||
880 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | ||
881 | |||
882 | /** | ||
883 | * The timestamp of the revocation | ||
884 | */ | ||
885 | struct GNUNET_TIME_AbsoluteNBO timestamp; | ||
886 | |||
887 | /** Followed by the zone public key type and key **/ | ||
888 | }; | ||
889 | |||
890 | GNUNET_NETWORK_STRUCT_END | ||
891 | |||
892 | |||
893 | /** | ||
894 | * Handle to a running proof-of-work calculation. | ||
895 | */ | ||
896 | struct GNUNET_GNSRECORD_PowCalculationHandle; | ||
897 | |||
898 | |||
899 | /** | ||
900 | * Check if the given proof-of-work is valid. | ||
901 | * | ||
902 | * @param pow proof of work | ||
903 | * @param matching_bits how many bits must match (configuration) | ||
904 | * @param epoch_duration length of single epoch in configuration | ||
905 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
906 | */ | ||
907 | enum GNUNET_GenericReturnValue | ||
908 | GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, | ||
909 | unsigned int matching_bits, | ||
910 | struct GNUNET_TIME_Relative epoch_duration); | ||
911 | |||
912 | |||
913 | /** | ||
914 | * Initializes a fresh PoW computation. | ||
915 | * | ||
916 | * @param key the key to calculate the PoW for. | ||
917 | * @param pow the pow object to work with in the calculation. | ||
918 | */ | ||
919 | void | ||
920 | GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
921 | struct GNUNET_GNSRECORD_PowP *pow); | ||
922 | |||
923 | |||
924 | /** | ||
925 | * Starts a proof-of-work calculation given the pow object as well as | ||
926 | * target epochs and difficulty. | ||
927 | * | ||
928 | * @param pow the PoW to based calculations on. | ||
929 | * @param epochs the number of epochs for which the PoW must be valid. | ||
930 | * @param difficulty the base difficulty of the PoW. | ||
931 | * @return a handle for use in PoW rounds | ||
932 | */ | ||
933 | struct GNUNET_GNSRECORD_PowCalculationHandle* | ||
934 | GNUNET_GNSRECORD_pow_start (struct GNUNET_GNSRECORD_PowP *pow, | ||
935 | int epochs, | ||
936 | unsigned int difficulty); | ||
937 | |||
938 | |||
939 | /** | ||
940 | * Calculate a single round in the key revocation PoW. | ||
941 | * | ||
942 | * @param pc handle to the PoW, initially called with NULL. | ||
943 | * @return GNUNET_YES if the @a pow is acceptable, GNUNET_NO if not | ||
944 | */ | ||
945 | enum GNUNET_GenericReturnValue | ||
946 | GNUNET_GNSRECORD_pow_round (struct GNUNET_GNSRECORD_PowCalculationHandle *pc); | ||
947 | |||
948 | size_t | ||
949 | GNUNET_GNSRECORD_proof_get_size (const struct GNUNET_GNSRECORD_PowP *pow); | ||
950 | |||
951 | /** | ||
952 | * Stop a PoW calculation | ||
953 | * | ||
954 | * @param pc the calculation to clean up | ||
955 | * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not | ||
956 | * valid | ||
957 | */ | ||
958 | void | ||
959 | GNUNET_GNSRECORD_pow_stop (struct GNUNET_GNSRECORD_PowCalculationHandle *pc); | ||
960 | |||
832 | #if 0 /* keep Emacsens' auto-indent happy */ | 961 | #if 0 /* keep Emacsens' auto-indent happy */ |
833 | { | 962 | { |
834 | #endif | 963 | #endif |
diff --git a/src/include/gnunet_rest_plugin.h b/src/include/gnunet_rest_plugin.h index 45b391ca1..3a8af5389 100644 --- a/src/include/gnunet_rest_plugin.h +++ b/src/include/gnunet_rest_plugin.h | |||
@@ -63,24 +63,13 @@ struct GNUNET_REST_Plugin | |||
63 | * e.g. http://hostname:port/name | 63 | * e.g. http://hostname:port/name |
64 | */ | 64 | */ |
65 | char *name; | 65 | char *name; |
66 | |||
67 | /** | ||
68 | * Function to process a REST call | ||
69 | * | ||
70 | * @param method the HTTP method called | ||
71 | * @param url the relative url accessed | ||
72 | * @param data the REST data (can be NULL) | ||
73 | * @param data_size the length of the data | ||
74 | * @param proc the callback for result | ||
75 | * @param proc_cls closure for callback | ||
76 | * @return GNUNET_YES if the request was processed | ||
77 | */ | ||
78 | enum GNUNET_GenericReturnValue (*process_request)( | ||
79 | struct GNUNET_REST_RequestHandle *handle, | ||
80 | GNUNET_REST_ResultProcessor proc, | ||
81 | void *proc_cls); | ||
82 | }; | 66 | }; |
83 | 67 | ||
68 | typedef enum GNUNET_GenericReturnValue (*GNUNET_REST_ProcessingFunction)( | ||
69 | void *plugin, | ||
70 | struct GNUNET_REST_RequestHandle *handle, | ||
71 | GNUNET_REST_ResultProcessor proc, | ||
72 | void *proc_cls); | ||
84 | 73 | ||
85 | #if 0 /* keep Emacsens' auto-indent happy */ | 74 | #if 0 /* keep Emacsens' auto-indent happy */ |
86 | { | 75 | { |
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index de5eedbb9..427be62ac 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define GNUNET_REVOCATION_SERVICE_H_ | 22 | #define GNUNET_REVOCATION_SERVICE_H_ |
23 | 23 | ||
24 | 24 | ||
25 | #include "gnunet_gnsrecord_lib.h" | ||
25 | #include "gnunet_identity_service.h" | 26 | #include "gnunet_identity_service.h" |
26 | 27 | ||
27 | /** | 28 | /** |
@@ -56,71 +57,6 @@ extern "C" | |||
56 | */ | 57 | */ |
57 | #define GNUNET_REVOCATION_VERSION 0x00000001 | 58 | #define GNUNET_REVOCATION_VERSION 0x00000001 |
58 | 59 | ||
59 | /** | ||
60 | * Maximum length of a revocation | ||
61 | */ | ||
62 | #define GNUNET_REVOCATION_MAX_PROOF_SIZE sizeof(struct GNUNET_REVOCATION_PowP) +\ | ||
63 | sizeof(struct GNUNET_CRYPTO_PublicKey) +\ | ||
64 | 1024 //FIXME max sig_len | ||
65 | |||
66 | /** | ||
67 | * The proof-of-work narrowing factor. | ||
68 | * The number of PoWs that are calculates as part of revocation. | ||
69 | */ | ||
70 | #define POW_COUNT 32 | ||
71 | |||
72 | |||
73 | GNUNET_NETWORK_STRUCT_BEGIN | ||
74 | |||
75 | /** | ||
76 | * Struct for a proof of work as part of the revocation. | ||
77 | */ | ||
78 | struct GNUNET_REVOCATION_PowP | ||
79 | { | ||
80 | /** | ||
81 | * The timestamp of the revocation | ||
82 | */ | ||
83 | struct GNUNET_TIME_AbsoluteNBO timestamp; | ||
84 | |||
85 | /** | ||
86 | * The TTL of this revocation (purely informational) | ||
87 | */ | ||
88 | struct GNUNET_TIME_RelativeNBO ttl; | ||
89 | |||
90 | /** | ||
91 | * The PoWs | ||
92 | */ | ||
93 | uint64_t pow[POW_COUNT] GNUNET_PACKED; | ||
94 | |||
95 | /** followed by the public key type, the key and a signature **/ | ||
96 | }; | ||
97 | |||
98 | |||
99 | /** | ||
100 | * The signature object we use for the PoW | ||
101 | */ | ||
102 | struct GNUNET_REVOCATION_SignaturePurposePS | ||
103 | { | ||
104 | /** | ||
105 | * The signature purpose | ||
106 | */ | ||
107 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | ||
108 | |||
109 | /** | ||
110 | * The timestamp of the revocation | ||
111 | */ | ||
112 | struct GNUNET_TIME_AbsoluteNBO timestamp; | ||
113 | |||
114 | /** Followed by the zone public key type and key **/ | ||
115 | }; | ||
116 | |||
117 | GNUNET_NETWORK_STRUCT_END | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Handle to a running proof-of-work calculation. | ||
122 | */ | ||
123 | struct GNUNET_REVOCATION_PowCalculationHandle; | ||
124 | 60 | ||
125 | /** | 61 | /** |
126 | * Handle for the key revocation query. | 62 | * Handle for the key revocation query. |
@@ -176,7 +112,7 @@ struct GNUNET_REVOCATION_Handle; | |||
176 | * | 112 | * |
177 | * @param cfg the configuration to use | 113 | * @param cfg the configuration to use |
178 | * @param pow proof of work to use (should have been created by | 114 | * @param pow proof of work to use (should have been created by |
179 | * iteratively calling #GNUNET_REVOCATION_pow_round) | 115 | * iteratively calling #GNUNET_CRYPTO_pow_round) |
180 | * @param func function to call with the result of the check | 116 | * @param func function to call with the result of the check |
181 | * (called with `is_valid` being #GNUNET_NO if | 117 | * (called with `is_valid` being #GNUNET_NO if |
182 | * the revocation worked). | 118 | * the revocation worked). |
@@ -185,7 +121,7 @@ struct GNUNET_REVOCATION_Handle; | |||
185 | */ | 121 | */ |
186 | struct GNUNET_REVOCATION_Handle * | 122 | struct GNUNET_REVOCATION_Handle * |
187 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | 123 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, |
188 | const struct GNUNET_REVOCATION_PowP *pow, | 124 | const struct GNUNET_GNSRECORD_PowP *pow, |
189 | GNUNET_REVOCATION_Callback func, void *func_cls); | 125 | GNUNET_REVOCATION_Callback func, void *func_cls); |
190 | 126 | ||
191 | 127 | ||
@@ -198,68 +134,6 @@ void | |||
198 | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); | 134 | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); |
199 | 135 | ||
200 | 136 | ||
201 | /** | ||
202 | * Check if the given proof-of-work is valid. | ||
203 | * | ||
204 | * @param pow proof of work | ||
205 | * @param matching_bits how many bits must match (configuration) | ||
206 | * @param epoch_duration length of single epoch in configuration | ||
207 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
208 | */ | ||
209 | enum GNUNET_GenericReturnValue | ||
210 | GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | ||
211 | unsigned int matching_bits, | ||
212 | struct GNUNET_TIME_Relative epoch_duration); | ||
213 | |||
214 | |||
215 | /** | ||
216 | * Initializes a fresh PoW computation. | ||
217 | * | ||
218 | * @param key the key to calculate the PoW for. | ||
219 | * @param pow the pow object to work with in the calculation. | ||
220 | */ | ||
221 | void | ||
222 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
223 | struct GNUNET_REVOCATION_PowP *pow); | ||
224 | |||
225 | |||
226 | /** | ||
227 | * Starts a proof-of-work calculation given the pow object as well as | ||
228 | * target epochs and difficulty. | ||
229 | * | ||
230 | * @param pow the PoW to based calculations on. | ||
231 | * @param epochs the number of epochs for which the PoW must be valid. | ||
232 | * @param difficulty the base difficulty of the PoW. | ||
233 | * @return a handle for use in PoW rounds | ||
234 | */ | ||
235 | struct GNUNET_REVOCATION_PowCalculationHandle* | ||
236 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, | ||
237 | int epochs, | ||
238 | unsigned int difficulty); | ||
239 | |||
240 | |||
241 | /** | ||
242 | * Calculate a single round in the key revocation PoW. | ||
243 | * | ||
244 | * @param pc handle to the PoW, initially called with NULL. | ||
245 | * @return GNUNET_YES if the @a pow is acceptable, GNUNET_NO if not | ||
246 | */ | ||
247 | enum GNUNET_GenericReturnValue | ||
248 | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc); | ||
249 | |||
250 | |||
251 | /** | ||
252 | * Stop a PoW calculation | ||
253 | * | ||
254 | * @param pc the calculation to clean up | ||
255 | * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not | ||
256 | * valid | ||
257 | */ | ||
258 | void | ||
259 | GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc); | ||
260 | |||
261 | size_t | ||
262 | GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow); | ||
263 | 137 | ||
264 | 138 | ||
265 | #if 0 /* keep Emacsens' auto-indent happy */ | 139 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/lib/gnsrecord/Makefile.am b/src/lib/gnsrecord/Makefile.am index 57b004847..ab79de900 100644 --- a/src/lib/gnsrecord/Makefile.am +++ b/src/lib/gnsrecord/Makefile.am | |||
@@ -47,6 +47,7 @@ libgnunetgnsrecord_la_SOURCES = \ | |||
47 | gnsrecord.c \ | 47 | gnsrecord.c \ |
48 | gnsrecord_serialization.c \ | 48 | gnsrecord_serialization.c \ |
49 | gnsrecord_crypto.c \ | 49 | gnsrecord_crypto.c \ |
50 | gnsrecord_pow.c \ | ||
50 | gnsrecord_misc.c | 51 | gnsrecord_misc.c |
51 | libgnunetgnsrecord_la_LIBADD = \ | 52 | libgnunetgnsrecord_la_LIBADD = \ |
52 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 53 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
diff --git a/src/lib/gnsrecord/gnsrecord_crypto.h b/src/lib/gnsrecord/gnsrecord_crypto.h index 4f2e4a5ca..85f2258ab 100644 --- a/src/lib/gnsrecord/gnsrecord_crypto.h +++ b/src/lib/gnsrecord/gnsrecord_crypto.h | |||
@@ -83,3 +83,12 @@ GNR_derive_block_xsalsa_key (unsigned char *nonce, | |||
83 | uint64_t exp, | 83 | uint64_t exp, |
84 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub); | 84 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub); |
85 | 85 | ||
86 | /** | ||
87 | * Create the revocation metadata to sign for a revocation message | ||
88 | * | ||
89 | * @param pow the PoW to sign | ||
90 | * @return the signature purpose | ||
91 | */ | ||
92 | struct GNUNET_GNSRECORD_SignaturePurposePS * | ||
93 | GNR_create_signature_message (const struct GNUNET_GNSRECORD_PowP *pow); | ||
94 | |||
diff --git a/src/lib/gnsrecord/gnsrecord_pow.c b/src/lib/gnsrecord/gnsrecord_pow.c new file mode 100644 index 000000000..a40dd7802 --- /dev/null +++ b/src/lib/gnsrecord/gnsrecord_pow.c | |||
@@ -0,0 +1,462 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2013, 2016 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 | */ | ||
20 | |||
21 | |||
22 | /** | ||
23 | * @brief API for proof of work | ||
24 | * @author Martin Schanzenbach | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_gnsrecord_lib.h" | ||
29 | #include "gnunet_signatures.h" | ||
30 | #include "gnunet_protocols.h" | ||
31 | #include <inttypes.h> | ||
32 | |||
33 | /** | ||
34 | * Helper struct that holds a found pow nonce | ||
35 | * and the corresponding number of leading zeros. | ||
36 | */ | ||
37 | struct BestPow | ||
38 | { | ||
39 | /** | ||
40 | * PoW nonce | ||
41 | */ | ||
42 | uint64_t pow; | ||
43 | |||
44 | /** | ||
45 | * Corresponding zero bits in hash | ||
46 | */ | ||
47 | unsigned int bits; | ||
48 | }; | ||
49 | |||
50 | |||
51 | /** | ||
52 | * The handle to a PoW calculation. | ||
53 | * Used in iterative PoW rounds. | ||
54 | */ | ||
55 | struct GNUNET_GNSRECORD_PowCalculationHandle | ||
56 | { | ||
57 | /** | ||
58 | * Current set of found PoWs | ||
59 | */ | ||
60 | struct BestPow best[POW_COUNT]; | ||
61 | |||
62 | /** | ||
63 | * The final PoW result data structure. | ||
64 | */ | ||
65 | struct GNUNET_GNSRECORD_PowP *pow; | ||
66 | |||
67 | /** | ||
68 | * The current nonce to try | ||
69 | */ | ||
70 | uint64_t current_pow; | ||
71 | |||
72 | /** | ||
73 | * Epochs how long the PoW should be valid. | ||
74 | * This is added on top of the difficulty in the PoW. | ||
75 | */ | ||
76 | unsigned int epochs; | ||
77 | |||
78 | /** | ||
79 | * The difficulty (leading zeros) to achieve. | ||
80 | */ | ||
81 | unsigned int difficulty; | ||
82 | |||
83 | }; | ||
84 | |||
85 | static struct GNUNET_CRYPTO_PowSalt salt = { "GnsRevocationPow" }; | ||
86 | |||
87 | /** | ||
88 | * Calculate the average zeros in the pows. | ||
89 | * | ||
90 | * @param ph the PowHandle | ||
91 | * @return the average number of zeros. | ||
92 | */ | ||
93 | static unsigned int | ||
94 | calculate_score (const struct GNUNET_GNSRECORD_PowCalculationHandle *ph) | ||
95 | { | ||
96 | double sum = 0.0; | ||
97 | for (unsigned int j = 0; j<POW_COUNT; j++) | ||
98 | sum += ph->best[j].bits; | ||
99 | double avg = sum / POW_COUNT; | ||
100 | return avg; | ||
101 | } | ||
102 | |||
103 | |||
104 | struct GNUNET_GNSRECORD_SignaturePurposePS * | ||
105 | GNR_create_signature_message (const struct GNUNET_GNSRECORD_PowP *pow) | ||
106 | { | ||
107 | struct GNUNET_GNSRECORD_SignaturePurposePS *spurp; | ||
108 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
109 | size_t ksize; | ||
110 | |||
111 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
112 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
113 | spurp = GNUNET_malloc (sizeof (*spurp) + ksize); | ||
114 | spurp->timestamp = pow->timestamp; | ||
115 | spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION); | ||
116 | spurp->purpose.size = htonl (sizeof(*spurp) + ksize); | ||
117 | GNUNET_CRYPTO_write_public_key_to_buffer (pk, | ||
118 | (char*) &spurp[1], | ||
119 | ksize); | ||
120 | return spurp; | ||
121 | } | ||
122 | |||
123 | |||
124 | enum GNUNET_GenericReturnValue | ||
125 | check_signature_identity (const struct GNUNET_GNSRECORD_PowP *pow, | ||
126 | const struct GNUNET_CRYPTO_PublicKey *key) | ||
127 | { | ||
128 | struct GNUNET_GNSRECORD_SignaturePurposePS *spurp; | ||
129 | unsigned char *sig; | ||
130 | size_t ksize; | ||
131 | int ret; | ||
132 | |||
133 | ksize = GNUNET_CRYPTO_public_key_get_length (key); | ||
134 | spurp = GNR_create_signature_message (pow); | ||
135 | sig = ((unsigned char*) &pow[1] + ksize); | ||
136 | ret = | ||
137 | GNUNET_CRYPTO_signature_verify_raw_ ( | ||
138 | GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION, | ||
139 | &spurp->purpose, | ||
140 | sig, | ||
141 | key); | ||
142 | GNUNET_free (spurp); | ||
143 | return ret == GNUNET_OK ? GNUNET_OK : GNUNET_SYSERR; | ||
144 | } | ||
145 | |||
146 | |||
147 | enum GNUNET_GenericReturnValue | ||
148 | check_signature (const struct GNUNET_GNSRECORD_PowP *pow) | ||
149 | { | ||
150 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
151 | |||
152 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
153 | return check_signature_identity (pow, pk); | ||
154 | } | ||
155 | |||
156 | |||
157 | /** | ||
158 | * Check if the given proof-of-work is valid. | ||
159 | * | ||
160 | * @param pow proof of work | ||
161 | * @param difficulty how many bits must match (configuration) LSD0001: D | ||
162 | * @param epoch_duration length of single epoch in configuration | ||
163 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
164 | */ | ||
165 | enum GNUNET_GenericReturnValue | ||
166 | GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, | ||
167 | unsigned int difficulty, | ||
168 | struct GNUNET_TIME_Relative epoch_duration) | ||
169 | { | ||
170 | char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) | ||
171 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) | ||
172 | + sizeof (uint64_t)] GNUNET_ALIGN; | ||
173 | struct GNUNET_HashCode result; | ||
174 | struct GNUNET_TIME_Absolute ts; | ||
175 | struct GNUNET_TIME_Absolute exp; | ||
176 | struct GNUNET_TIME_Relative ttl; | ||
177 | struct GNUNET_TIME_Relative buffer; | ||
178 | /* LSD0001: D' */ | ||
179 | unsigned int score = 0; | ||
180 | unsigned int tmp_score = 0; | ||
181 | unsigned int epochs; | ||
182 | uint64_t pow_val; | ||
183 | ssize_t pklen; | ||
184 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
185 | |||
186 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
187 | |||
188 | /** | ||
189 | * Check if signature valid | ||
190 | */ | ||
191 | if (GNUNET_OK != check_signature (pow)) | ||
192 | { | ||
193 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
194 | "Proof of work signature invalid!\n"); | ||
195 | return GNUNET_SYSERR; | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * First, check if PoW set is strictly monotically increasing | ||
200 | */ | ||
201 | for (unsigned int i = 0; i < POW_COUNT - 1; i++) | ||
202 | { | ||
203 | if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i + 1])) | ||
204 | return GNUNET_NO; | ||
205 | } | ||
206 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | ||
207 | &pow->timestamp, | ||
208 | sizeof (uint64_t)); | ||
209 | pklen = GNUNET_CRYPTO_public_key_get_length (pk); | ||
210 | if (0 > pklen) | ||
211 | { | ||
212 | GNUNET_break (0); | ||
213 | return GNUNET_NO; | ||
214 | } | ||
215 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | ||
216 | pk, | ||
217 | pklen); | ||
218 | for (unsigned int i = 0; i < POW_COUNT; i++) | ||
219 | { | ||
220 | pow_val = GNUNET_ntohll (pow->pow[i]); | ||
221 | GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t)); | ||
222 | GNUNET_CRYPTO_pow_hash (&salt, | ||
223 | buf, | ||
224 | sizeof(buf), | ||
225 | &result); | ||
226 | tmp_score = GNUNET_CRYPTO_hash_count_leading_zeros (&result); | ||
227 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
228 | "Score %u with %" PRIu64 " (#%u)\n", | ||
229 | tmp_score, pow_val, i); | ||
230 | |||
231 | score += tmp_score; | ||
232 | |||
233 | } | ||
234 | score = score / POW_COUNT; | ||
235 | if (score < difficulty) | ||
236 | return GNUNET_NO; | ||
237 | /* LSD0001: (D'-D+1) */ | ||
238 | epochs = score - difficulty + 1; | ||
239 | |||
240 | /** | ||
241 | * Check expiration | ||
242 | */ | ||
243 | ts = GNUNET_TIME_absolute_ntoh (pow->timestamp); | ||
244 | ttl = GNUNET_TIME_relative_multiply (epoch_duration, | ||
245 | epochs); | ||
246 | /** | ||
247 | * Extend by 10% for unsynchronized clocks | ||
248 | */ | ||
249 | buffer = GNUNET_TIME_relative_divide (epoch_duration, | ||
250 | 10); | ||
251 | exp = GNUNET_TIME_absolute_add (ts, ttl); | ||
252 | exp = GNUNET_TIME_absolute_add (exp, | ||
253 | buffer); | ||
254 | |||
255 | if (0 != GNUNET_TIME_absolute_get_remaining (ts).rel_value_us) | ||
256 | return GNUNET_NO; /* Not yet valid. */ | ||
257 | /* Revert to actual start time */ | ||
258 | ts = GNUNET_TIME_absolute_add (ts, | ||
259 | buffer); | ||
260 | |||
261 | if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us) | ||
262 | return GNUNET_NO; /* expired */ | ||
263 | return GNUNET_YES; | ||
264 | } | ||
265 | |||
266 | |||
267 | enum GNUNET_GenericReturnValue | ||
268 | sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
269 | struct GNUNET_GNSRECORD_PowP *pow) | ||
270 | { | ||
271 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); | ||
272 | struct GNUNET_GNSRECORD_SignaturePurposePS *rp; | ||
273 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
274 | size_t ksize; | ||
275 | char *sig; | ||
276 | |||
277 | /** | ||
278 | * Predate the validity period to prevent rejections due to | ||
279 | * unsynchronized clocks | ||
280 | */ | ||
281 | ts = GNUNET_TIME_absolute_subtract (ts, | ||
282 | GNUNET_TIME_UNIT_WEEKS); | ||
283 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
284 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
285 | pow->timestamp = GNUNET_TIME_absolute_hton (ts); | ||
286 | rp = GNR_create_signature_message (pow); | ||
287 | sig = ((char*) &pow[1]) + ksize; | ||
288 | int result = GNUNET_CRYPTO_sign_raw_ (key, | ||
289 | &rp->purpose, | ||
290 | (void*) sig); | ||
291 | GNUNET_free (rp); | ||
292 | if (result == GNUNET_SYSERR) | ||
293 | return GNUNET_NO; | ||
294 | else | ||
295 | return result; | ||
296 | } | ||
297 | |||
298 | |||
299 | enum GNUNET_GenericReturnValue | ||
300 | sign_pow (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
301 | struct GNUNET_GNSRECORD_PowP *pow) | ||
302 | { | ||
303 | struct GNUNET_CRYPTO_PublicKey *pk; | ||
304 | |||
305 | pk = (struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
306 | GNUNET_CRYPTO_key_get_public (key, pk); | ||
307 | return sign_pow_identity (key, pow); | ||
308 | } | ||
309 | |||
310 | |||
311 | /** | ||
312 | * Initializes a fresh PoW computation. | ||
313 | * | ||
314 | * @param key the key to calculate the PoW for. | ||
315 | * @param[out] pow starting point for PoW calculation (not yet valid) | ||
316 | */ | ||
317 | void | ||
318 | GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
319 | struct GNUNET_GNSRECORD_PowP *pow) | ||
320 | { | ||
321 | GNUNET_assert (GNUNET_OK == sign_pow (key, pow)); | ||
322 | } | ||
323 | |||
324 | |||
325 | struct GNUNET_GNSRECORD_PowCalculationHandle* | ||
326 | GNUNET_GNSRECORD_pow_start (struct GNUNET_GNSRECORD_PowP *pow, | ||
327 | int epochs, | ||
328 | unsigned int difficulty) | ||
329 | { | ||
330 | struct GNUNET_GNSRECORD_PowCalculationHandle *pc; | ||
331 | struct GNUNET_TIME_Relative ttl; | ||
332 | |||
333 | |||
334 | pc = GNUNET_new (struct GNUNET_GNSRECORD_PowCalculationHandle); | ||
335 | pc->pow = pow; | ||
336 | ttl = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, | ||
337 | epochs); | ||
338 | pc->pow->ttl = GNUNET_TIME_relative_hton (ttl); | ||
339 | pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
340 | UINT64_MAX); | ||
341 | pc->difficulty = difficulty; | ||
342 | pc->epochs = epochs; | ||
343 | return pc; | ||
344 | } | ||
345 | |||
346 | |||
347 | /** | ||
348 | * Comparison function for quicksort | ||
349 | * | ||
350 | * @param a left element | ||
351 | * @param b right element | ||
352 | * @return a-b | ||
353 | */ | ||
354 | static int | ||
355 | cmp_pow_value (const void *a, const void *b) | ||
356 | { | ||
357 | return (GNUNET_ntohll (*(uint64_t*) a) - GNUNET_ntohll (*(uint64_t*) b)); | ||
358 | } | ||
359 | |||
360 | |||
361 | /** | ||
362 | * Calculate a key revocation valid for broadcasting for a number | ||
363 | * of epochs. | ||
364 | * | ||
365 | * @param pc handle to the PoW, initially called with NULL. | ||
366 | * @param epochs number of epochs for which the revocation must be valid. | ||
367 | * @param pow current pow value to try | ||
368 | * @param difficulty current base difficulty to achieve | ||
369 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
370 | */ | ||
371 | enum GNUNET_GenericReturnValue | ||
372 | GNUNET_GNSRECORD_pow_round (struct GNUNET_GNSRECORD_PowCalculationHandle *pc) | ||
373 | { | ||
374 | char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) | ||
375 | + sizeof (uint64_t) | ||
376 | + sizeof (uint64_t)] GNUNET_ALIGN; | ||
377 | struct GNUNET_HashCode result; | ||
378 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
379 | unsigned int zeros; | ||
380 | int ret; | ||
381 | uint64_t pow_nbo; | ||
382 | ssize_t ksize; | ||
383 | |||
384 | pc->current_pow++; | ||
385 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &(pc->pow[1]); | ||
386 | |||
387 | /** | ||
388 | * Do not try duplicates | ||
389 | */ | ||
390 | for (unsigned int i = 0; i < POW_COUNT; i++) | ||
391 | if (pc->current_pow == pc->best[i].pow) | ||
392 | return GNUNET_NO; | ||
393 | pow_nbo = GNUNET_htonll (pc->current_pow); | ||
394 | GNUNET_memcpy (buf, &pow_nbo, sizeof(uint64_t)); | ||
395 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | ||
396 | &pc->pow->timestamp, | ||
397 | sizeof (uint64_t)); | ||
398 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
399 | GNUNET_assert (0 < ksize); | ||
400 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | ||
401 | pk, | ||
402 | ksize); | ||
403 | GNUNET_CRYPTO_pow_hash (&salt, | ||
404 | buf, | ||
405 | sizeof(buf), | ||
406 | &result); | ||
407 | zeros = GNUNET_CRYPTO_hash_count_leading_zeros (&result); | ||
408 | for (unsigned int i = 0; i < POW_COUNT; i++) | ||
409 | { | ||
410 | if (pc->best[i].bits < zeros) | ||
411 | { | ||
412 | pc->best[i].bits = zeros; | ||
413 | pc->best[i].pow = pc->current_pow; | ||
414 | pc->pow->pow[i] = pow_nbo; | ||
415 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
416 | "New best score %u with %" PRIu64 " (#%u)\n", | ||
417 | zeros, pc->current_pow, i); | ||
418 | |||
419 | break; | ||
420 | } | ||
421 | } | ||
422 | ret = calculate_score (pc) >= pc->difficulty + pc->epochs ? GNUNET_YES : | ||
423 | GNUNET_NO; | ||
424 | if (GNUNET_YES == ret) | ||
425 | { | ||
426 | /* Sort POWs) */ | ||
427 | qsort (pc->pow->pow, POW_COUNT, sizeof (uint64_t), &cmp_pow_value); | ||
428 | } | ||
429 | return ret; | ||
430 | } | ||
431 | |||
432 | |||
433 | size_t | ||
434 | GNUNET_GNSRECORD_proof_get_size (const struct GNUNET_GNSRECORD_PowP *pow) | ||
435 | { | ||
436 | size_t size; | ||
437 | size_t ksize; | ||
438 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
439 | |||
440 | size = sizeof (struct GNUNET_GNSRECORD_PowP); | ||
441 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
442 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
443 | size += ksize; | ||
444 | size += GNUNET_CRYPTO_signature_get_raw_length_by_type (pk->type); | ||
445 | return size; | ||
446 | } | ||
447 | |||
448 | |||
449 | /** | ||
450 | * Stop a PoW calculation | ||
451 | * | ||
452 | * @param pc the calculation to clean up | ||
453 | * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not | ||
454 | * valid | ||
455 | */ | ||
456 | void | ||
457 | GNUNET_GNSRECORD_pow_stop (struct GNUNET_GNSRECORD_PowCalculationHandle *pc) | ||
458 | { | ||
459 | GNUNET_free (pc); | ||
460 | } | ||
461 | |||
462 | |||
diff --git a/src/lib/gnsrecord/meson.build b/src/lib/gnsrecord/meson.build index 3e35e0caf..a35d6b66e 100644 --- a/src/lib/gnsrecord/meson.build +++ b/src/lib/gnsrecord/meson.build | |||
@@ -1,6 +1,7 @@ | |||
1 | libgnunetgnsrecord_src = ['gnsrecord.c', | 1 | libgnunetgnsrecord_src = ['gnsrecord.c', |
2 | 'gnsrecord_serialization.c', | 2 | 'gnsrecord_serialization.c', |
3 | 'gnsrecord_crypto.c', | 3 | 'gnsrecord_crypto.c', |
4 | 'gnsrecord_pow.c', | ||
4 | 'gnsrecord_misc.c'] | 5 | 'gnsrecord_misc.c'] |
5 | libgnunetgnsrecordjson_src = ['json_gnsrecord.c'] | 6 | libgnunetgnsrecordjson_src = ['json_gnsrecord.c'] |
6 | 7 | ||
diff --git a/src/meson.build b/src/meson.build index 5efd7e97a..8f8342a4d 100644 --- a/src/meson.build +++ b/src/meson.build | |||
@@ -4,8 +4,7 @@ endif | |||
4 | 4 | ||
5 | subdir('include') | 5 | subdir('include') |
6 | subdir('lib') | 6 | subdir('lib') |
7 | subdir('service') | ||
8 | subdir('plugin') | 7 | subdir('plugin') |
9 | subdir('rest-plugin') | 8 | subdir('service') |
10 | subdir('cli') | 9 | subdir('cli') |
11 | subdir('contrib') | 10 | subdir('contrib') |
diff --git a/src/plugin/Makefile.am b/src/plugin/Makefile.am index 1a1ecffa7..78e06fd63 100644 --- a/src/plugin/Makefile.am +++ b/src/plugin/Makefile.am | |||
@@ -1,10 +1,16 @@ | |||
1 | SUBDIRS = \ | 1 | SUBDIRS = \ |
2 | block \ | 2 | block \ |
3 | dns \ | ||
3 | gnsrecord \ | 4 | gnsrecord \ |
4 | dhtu \ | 5 | peerstore \ |
6 | datacache \ | ||
7 | datastore \ | ||
5 | namecache \ | 8 | namecache \ |
6 | namestore \ | 9 | namestore \ |
10 | dht \ | ||
7 | revocation \ | 11 | revocation \ |
12 | regex \ | ||
8 | gns \ | 13 | gns \ |
9 | fs \ | 14 | fs \ |
10 | reclaim | 15 | reclaim \ |
16 | messenger | ||
diff --git a/src/plugin/datacache/Makefile.am b/src/plugin/datacache/Makefile.am new file mode 100644 index 000000000..b9ae06975 --- /dev/null +++ b/src/plugin/datacache/Makefile.am | |||
@@ -0,0 +1,76 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | sqldir = $(prefix)/share/gnunet/sql/ | ||
9 | |||
10 | sql_DATA = \ | ||
11 | datacache-0001.sql \ | ||
12 | datacache-drop.sql | ||
13 | |||
14 | |||
15 | if USE_COVERAGE | ||
16 | AM_CFLAGS = --coverage -O0 | ||
17 | XLIBS = -lgcov | ||
18 | endif | ||
19 | |||
20 | if HAVE_SQLITE | ||
21 | SQLITE_PLUGIN = libgnunet_plugin_datacache_sqlite.la | ||
22 | endif | ||
23 | if HAVE_POSTGRESQL | ||
24 | POSTGRES_PLUGIN = libgnunet_plugin_datacache_postgres.la | ||
25 | endif | ||
26 | |||
27 | plugin_LTLIBRARIES = \ | ||
28 | $(SQLITE_PLUGIN) \ | ||
29 | $(POSTGRES_PLUGIN) \ | ||
30 | libgnunet_plugin_datacache_heap.la | ||
31 | |||
32 | # Real plugins should of course go into | ||
33 | # plugin_LTLIBRARIES | ||
34 | noinst_LTLIBRARIES = \ | ||
35 | libgnunet_plugin_datacache_template.la | ||
36 | |||
37 | |||
38 | libgnunet_plugin_datacache_sqlite_la_SOURCES = \ | ||
39 | plugin_datacache_sqlite.c | ||
40 | libgnunet_plugin_datacache_sqlite_la_LIBADD = \ | ||
41 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | ||
42 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | ||
43 | $(LTLIBINTL) | ||
44 | libgnunet_plugin_datacache_sqlite_la_LDFLAGS = \ | ||
45 | $(GN_PLUGIN_LDFLAGS) | ||
46 | |||
47 | libgnunet_plugin_datacache_heap_la_SOURCES = \ | ||
48 | plugin_datacache_heap.c | ||
49 | libgnunet_plugin_datacache_heap_la_LIBADD = \ | ||
50 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
51 | $(LTLIBINTL) | ||
52 | libgnunet_plugin_datacache_heap_la_LDFLAGS = \ | ||
53 | $(GN_PLUGIN_LDFLAGS) | ||
54 | |||
55 | libgnunet_plugin_datacache_postgres_la_SOURCES = \ | ||
56 | plugin_datacache_postgres.c | ||
57 | libgnunet_plugin_datacache_postgres_la_LIBADD = \ | ||
58 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ | ||
59 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
60 | $(GN_PLUGIN_LDFLAGS) -lpq | ||
61 | libgnunet_plugin_datacache_postgres_la_CPPFLAGS = \ | ||
62 | $(POSTGRESQL_CPPFLAGS) $(AM_CPPFLAGS) | ||
63 | libgnunet_plugin_datacache_postgres_la_LDFLAGS = \ | ||
64 | $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS) | ||
65 | |||
66 | libgnunet_plugin_datacache_template_la_SOURCES = \ | ||
67 | plugin_datacache_template.c | ||
68 | libgnunet_plugin_datacache_template_la_LIBADD = \ | ||
69 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
70 | $(LTLIBINTL) | ||
71 | libgnunet_plugin_datacache_template_la_LDFLAGS = \ | ||
72 | $(GN_PLUGIN_LDFLAGS) | ||
73 | |||
74 | |||
75 | EXTRA_DIST = \ | ||
76 | $(sql_DATA) | ||
diff --git a/src/service/datacache/datacache-0001.sql b/src/plugin/datacache/datacache-0001.sql index 6567de3c2..6567de3c2 100644 --- a/src/service/datacache/datacache-0001.sql +++ b/src/plugin/datacache/datacache-0001.sql | |||
diff --git a/src/service/datacache/datacache-drop.sql b/src/plugin/datacache/datacache-drop.sql index 2dd84bca8..2dd84bca8 100644 --- a/src/service/datacache/datacache-drop.sql +++ b/src/plugin/datacache/datacache-drop.sql | |||
diff --git a/src/plugin/datacache/meson.build b/src/plugin/datacache/meson.build new file mode 100644 index 000000000..3c9e7d330 --- /dev/null +++ b/src/plugin/datacache/meson.build | |||
@@ -0,0 +1,30 @@ | |||
1 | install_data ('datacache-0001.sql', | ||
2 | 'datacache-drop.sql', | ||
3 | install_dir: get_option('datadir')/'gnunet'/'sql') | ||
4 | |||
5 | shared_module('gnunet_plugin_datacache_sqlite', | ||
6 | ['plugin_datacache_sqlite.c'], | ||
7 | dependencies: [libgnunetutil_dep, | ||
8 | sqlite_dep, | ||
9 | libgnunetsq_dep], | ||
10 | include_directories: [incdir, configuration_inc], | ||
11 | install: true, | ||
12 | install_dir: get_option('libdir')/'gnunet') | ||
13 | |||
14 | shared_module('gnunet_plugin_datacache_heap', | ||
15 | ['plugin_datacache_heap.c'], | ||
16 | dependencies: [libgnunetutil_dep], | ||
17 | include_directories: [incdir, configuration_inc], | ||
18 | install: true, | ||
19 | install_dir: get_option('libdir')/'gnunet') | ||
20 | |||
21 | if pq_dep.found() | ||
22 | shared_module('gnunet_plugin_datacache_postgres', | ||
23 | ['plugin_datacache_postgres.c'], | ||
24 | dependencies: [libgnunetutil_dep, | ||
25 | pq_dep, | ||
26 | libgnunetpq_dep], | ||
27 | include_directories: [incdir, configuration_inc], | ||
28 | install: true, | ||
29 | install_dir: get_option('libdir')/'gnunet') | ||
30 | endif | ||
diff --git a/src/service/datacache/plugin_datacache_heap.c b/src/plugin/datacache/plugin_datacache_heap.c index 0dd8e47f8..0dd8e47f8 100644 --- a/src/service/datacache/plugin_datacache_heap.c +++ b/src/plugin/datacache/plugin_datacache_heap.c | |||
diff --git a/src/service/datacache/plugin_datacache_postgres.c b/src/plugin/datacache/plugin_datacache_postgres.c index 8bfd04aea..8bfd04aea 100644 --- a/src/service/datacache/plugin_datacache_postgres.c +++ b/src/plugin/datacache/plugin_datacache_postgres.c | |||
diff --git a/src/service/datacache/plugin_datacache_sqlite.c b/src/plugin/datacache/plugin_datacache_sqlite.c index 1c6f24a82..1c6f24a82 100644 --- a/src/service/datacache/plugin_datacache_sqlite.c +++ b/src/plugin/datacache/plugin_datacache_sqlite.c | |||
diff --git a/src/service/datacache/plugin_datacache_template.c b/src/plugin/datacache/plugin_datacache_template.c index 1bd712d39..1bd712d39 100644 --- a/src/service/datacache/plugin_datacache_template.c +++ b/src/plugin/datacache/plugin_datacache_template.c | |||
diff --git a/src/plugin/datastore/Makefile.am b/src/plugin/datastore/Makefile.am new file mode 100644 index 000000000..1f4ab59c8 --- /dev/null +++ b/src/plugin/datastore/Makefile.am | |||
@@ -0,0 +1,150 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | sqldir = $(prefix)/share/gnunet/sql/ | ||
11 | |||
12 | sql_DATA = \ | ||
13 | datastore-0001.sql \ | ||
14 | datastore-drop.sql | ||
15 | |||
16 | if USE_COVERAGE | ||
17 | AM_CFLAGS = --coverage -O0 | ||
18 | XLIBS = -lgcov | ||
19 | endif | ||
20 | |||
21 | |||
22 | if HAVE_SQLITE | ||
23 | SQLITE_PLUGIN = libgnunet_plugin_datastore_sqlite.la | ||
24 | if HAVE_BENCHMARKS | ||
25 | SQLITE_BENCHMARKS = \ | ||
26 | perf_plugin_datastore_sqlite | ||
27 | endif | ||
28 | SQLITE_TESTS = \ | ||
29 | test_plugin_datastore_sqlite \ | ||
30 | $(SQLITE_BENCHMARKS) | ||
31 | endif | ||
32 | if HAVE_POSTGRESQL | ||
33 | POSTGRES_PLUGIN = libgnunet_plugin_datastore_postgres.la | ||
34 | if HAVE_BENCHMARKS | ||
35 | POSTGRES_BENCHMARKS = \ | ||
36 | perf_plugin_datastore_postgres | ||
37 | endif | ||
38 | POSTGRES_TESTS = \ | ||
39 | test_plugin_datastore_postgres \ | ||
40 | $(POSTGRES_BENCHMARKS) | ||
41 | endif | ||
42 | |||
43 | plugin_LTLIBRARIES = \ | ||
44 | $(SQLITE_PLUGIN) \ | ||
45 | $(POSTGRES_PLUGIN) \ | ||
46 | libgnunet_plugin_datastore_heap.la | ||
47 | |||
48 | # Real plugins should of course go into | ||
49 | # plugin_LTLIBRARIES | ||
50 | noinst_LTLIBRARIES = \ | ||
51 | libgnunet_plugin_datastore_template.la | ||
52 | |||
53 | |||
54 | libgnunet_plugin_datastore_sqlite_la_SOURCES = \ | ||
55 | plugin_datastore_sqlite.c | ||
56 | libgnunet_plugin_datastore_sqlite_la_LIBADD = \ | ||
57 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | ||
58 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | ||
59 | $(LTLIBINTL) | ||
60 | libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \ | ||
61 | $(GN_PLUGIN_LDFLAGS) | ||
62 | |||
63 | |||
64 | libgnunet_plugin_datastore_heap_la_SOURCES = \ | ||
65 | plugin_datastore_heap.c | ||
66 | libgnunet_plugin_datastore_heap_la_LIBADD = \ | ||
67 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
68 | $(LTLIBINTL) | ||
69 | libgnunet_plugin_datastore_heap_la_LDFLAGS = \ | ||
70 | $(GN_PLUGIN_LDFLAGS) | ||
71 | |||
72 | |||
73 | libgnunet_plugin_datastore_postgres_la_SOURCES = \ | ||
74 | plugin_datastore_postgres.c | ||
75 | libgnunet_plugin_datastore_postgres_la_LIBADD = \ | ||
76 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ | ||
77 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq | ||
78 | libgnunet_plugin_datastore_postgres_la_LDFLAGS = \ | ||
79 | $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS) | ||
80 | libgnunet_plugin_datastore_postgres_la_CPPFLAGS = \ | ||
81 | $(POSTGRESQL_CPPFLAGS) $(AM_CPPFLAGS) | ||
82 | |||
83 | |||
84 | libgnunet_plugin_datastore_template_la_SOURCES = \ | ||
85 | plugin_datastore_template.c | ||
86 | libgnunet_plugin_datastore_template_la_LIBADD = \ | ||
87 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
88 | $(LTLIBINTL) | ||
89 | libgnunet_plugin_datastore_template_la_LDFLAGS = \ | ||
90 | $(GN_PLUGIN_LDFLAGS) | ||
91 | |||
92 | check_PROGRAMS = \ | ||
93 | perf_plugin_datastore_heap \ | ||
94 | test_plugin_datastore_heap \ | ||
95 | $(SQLITE_TESTS) \ | ||
96 | $(POSTGRES_TESTS) | ||
97 | |||
98 | if ENABLE_TEST_RUN | ||
99 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | ||
100 | TESTS = $(check_PROGRAMS) | ||
101 | endif | ||
102 | |||
103 | perf_plugin_datastore_heap_SOURCES = \ | ||
104 | perf_plugin_datastore.c | ||
105 | perf_plugin_datastore_heap_LDADD = \ | ||
106 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
107 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
108 | |||
109 | test_plugin_datastore_heap_SOURCES = \ | ||
110 | test_plugin_datastore.c | ||
111 | test_plugin_datastore_heap_LDADD = \ | ||
112 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
113 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
114 | |||
115 | |||
116 | perf_plugin_datastore_sqlite_SOURCES = \ | ||
117 | perf_plugin_datastore.c | ||
118 | perf_plugin_datastore_sqlite_LDADD = \ | ||
119 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
120 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
121 | |||
122 | test_plugin_datastore_sqlite_SOURCES = \ | ||
123 | test_plugin_datastore.c | ||
124 | test_plugin_datastore_sqlite_LDADD = \ | ||
125 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
126 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
127 | |||
128 | |||
129 | test_plugin_datastore_postgres_SOURCES = \ | ||
130 | test_plugin_datastore.c | ||
131 | test_plugin_datastore_postgres_LDADD = \ | ||
132 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
133 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
134 | |||
135 | perf_plugin_datastore_postgres_SOURCES = \ | ||
136 | perf_plugin_datastore.c | ||
137 | perf_plugin_datastore_postgres_LDADD = \ | ||
138 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
139 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
140 | |||
141 | |||
142 | EXTRA_DIST = \ | ||
143 | test_defaults.conf \ | ||
144 | perf_plugin_datastore_data_sqlite.conf \ | ||
145 | test_plugin_datastore_data_sqlite.conf \ | ||
146 | perf_plugin_datastore_data_heap.conf \ | ||
147 | test_plugin_datastore_data_heap.conf \ | ||
148 | perf_plugin_datastore_data_postgres.conf \ | ||
149 | test_plugin_datastore_data_postgres.conf \ | ||
150 | $(sql_DATA) | ||
diff --git a/src/service/datastore/datastore-0001.sql b/src/plugin/datastore/datastore-0001.sql index 0d4758be2..0d4758be2 100644 --- a/src/service/datastore/datastore-0001.sql +++ b/src/plugin/datastore/datastore-0001.sql | |||
diff --git a/src/service/datastore/datastore-drop.sql b/src/plugin/datastore/datastore-drop.sql index 67fee303d..67fee303d 100644 --- a/src/service/datastore/datastore-drop.sql +++ b/src/plugin/datastore/datastore-drop.sql | |||
diff --git a/src/plugin/datastore/meson.build b/src/plugin/datastore/meson.build new file mode 100644 index 000000000..6769cb78b --- /dev/null +++ b/src/plugin/datastore/meson.build | |||
@@ -0,0 +1,75 @@ | |||
1 | install_data ('datastore-0001.sql', | ||
2 | 'datastore-drop.sql', | ||
3 | install_dir: get_option('datadir')/'gnunet'/'sql') | ||
4 | |||
5 | shared_module('gnunet_plugin_datastore_sqlite', | ||
6 | ['plugin_datastore_sqlite.c'], | ||
7 | dependencies: [libgnunetutil_dep, | ||
8 | sqlite_dep, | ||
9 | libgnunetsq_dep], | ||
10 | include_directories: [incdir, configuration_inc], | ||
11 | install: true, | ||
12 | install_dir: get_option('libdir')/'gnunet') | ||
13 | |||
14 | shared_module('gnunet_plugin_datastore_heap', | ||
15 | ['plugin_datastore_heap.c'], | ||
16 | dependencies: [libgnunetutil_dep], | ||
17 | include_directories: [incdir, configuration_inc], | ||
18 | install: true, | ||
19 | install_dir: get_option('libdir')/'gnunet') | ||
20 | |||
21 | if pq_dep.found() | ||
22 | shared_module('gnunet_plugin_datastore_postgres', | ||
23 | ['plugin_datastore_postgres.c'], | ||
24 | dependencies: [libgnunetutil_dep, | ||
25 | pq_dep, | ||
26 | libgnunetpq_dep], | ||
27 | include_directories: [incdir, configuration_inc], | ||
28 | install: true, | ||
29 | install_dir: get_option('libdir')/'gnunet') | ||
30 | endif | ||
31 | |||
32 | testds_plugin_sqlite = executable ('test_plugin_datastore_sqlite', | ||
33 | ['test_plugin_datastore.c'], | ||
34 | dependencies: [ | ||
35 | libgnunetutil_dep, | ||
36 | ], | ||
37 | include_directories: [incdir, configuration_inc], | ||
38 | install: false) | ||
39 | |||
40 | testds_plugin_heap = executable ('test_plugin_datastore_heap', | ||
41 | ['test_plugin_datastore.c'], | ||
42 | dependencies: [ | ||
43 | libgnunetutil_dep, | ||
44 | ], | ||
45 | include_directories: [incdir, configuration_inc], | ||
46 | install: false) | ||
47 | |||
48 | testds_plugin_pq = executable ('test_plugin_datastore_postgres', | ||
49 | ['test_plugin_datastore.c'], | ||
50 | dependencies: [ | ||
51 | libgnunetutil_dep, | ||
52 | ], | ||
53 | include_directories: [incdir, configuration_inc], | ||
54 | install: false) | ||
55 | |||
56 | configure_file(input : 'test_defaults.conf', | ||
57 | output : 'test_defaults.conf', | ||
58 | copy: true) | ||
59 | configure_file(input : 'test_plugin_datastore_data_sqlite.conf', | ||
60 | output : 'test_plugin_datastore_data_sqlite.conf', | ||
61 | copy: true) | ||
62 | configure_file(input : 'test_plugin_datastore_data_heap.conf', | ||
63 | output : 'test_plugin_datastore_data_heap.conf', | ||
64 | copy: true) | ||
65 | configure_file(input : 'test_plugin_datastore_data_postgres.conf', | ||
66 | output : 'test_plugin_datastore_data_postgres.conf', | ||
67 | copy: true) | ||
68 | |||
69 | test('test_plugin_datastore_sqlite', testds_plugin_sqlite, | ||
70 | suite: 'datastore', workdir: meson.current_build_dir()) | ||
71 | test('test_plugin_datastore_heap', testds_plugin_heap, | ||
72 | suite: 'datastore', workdir: meson.current_build_dir()) | ||
73 | test('test_plugin_datastore_postgres', testds_plugin_pq, | ||
74 | suite: 'datastore', workdir: meson.current_build_dir()) | ||
75 | |||
diff --git a/src/service/datastore/perf_plugin_datastore.c b/src/plugin/datastore/perf_plugin_datastore.c index 8e63b08e6..8e63b08e6 100644 --- a/src/service/datastore/perf_plugin_datastore.c +++ b/src/plugin/datastore/perf_plugin_datastore.c | |||
diff --git a/src/service/datastore/perf_plugin_datastore_data_heap.conf b/src/plugin/datastore/perf_plugin_datastore_data_heap.conf index 873cf9606..873cf9606 100644 --- a/src/service/datastore/perf_plugin_datastore_data_heap.conf +++ b/src/plugin/datastore/perf_plugin_datastore_data_heap.conf | |||
diff --git a/src/service/datastore/perf_plugin_datastore_data_postgres.conf b/src/plugin/datastore/perf_plugin_datastore_data_postgres.conf index 7683887a8..7683887a8 100644 --- a/src/service/datastore/perf_plugin_datastore_data_postgres.conf +++ b/src/plugin/datastore/perf_plugin_datastore_data_postgres.conf | |||
diff --git a/src/service/datastore/perf_plugin_datastore_data_sqlite.conf b/src/plugin/datastore/perf_plugin_datastore_data_sqlite.conf index 888e020a6..888e020a6 100644 --- a/src/service/datastore/perf_plugin_datastore_data_sqlite.conf +++ b/src/plugin/datastore/perf_plugin_datastore_data_sqlite.conf | |||
diff --git a/src/service/datastore/plugin_datastore_heap.c b/src/plugin/datastore/plugin_datastore_heap.c index a827a2763..a827a2763 100644 --- a/src/service/datastore/plugin_datastore_heap.c +++ b/src/plugin/datastore/plugin_datastore_heap.c | |||
diff --git a/src/service/datastore/plugin_datastore_postgres.c b/src/plugin/datastore/plugin_datastore_postgres.c index 5fcacc17b..5fcacc17b 100644 --- a/src/service/datastore/plugin_datastore_postgres.c +++ b/src/plugin/datastore/plugin_datastore_postgres.c | |||
diff --git a/src/service/datastore/plugin_datastore_sqlite.c b/src/plugin/datastore/plugin_datastore_sqlite.c index 5ea9da4cb..5ea9da4cb 100644 --- a/src/service/datastore/plugin_datastore_sqlite.c +++ b/src/plugin/datastore/plugin_datastore_sqlite.c | |||
diff --git a/src/service/datastore/plugin_datastore_template.c b/src/plugin/datastore/plugin_datastore_template.c index 2b455f8cb..2b455f8cb 100644 --- a/src/service/datastore/plugin_datastore_template.c +++ b/src/plugin/datastore/plugin_datastore_template.c | |||
diff --git a/src/service/datastore/test_plugin_datastore.c b/src/plugin/datastore/test_plugin_datastore.c index 7de1acf2d..7de1acf2d 100644 --- a/src/service/datastore/test_plugin_datastore.c +++ b/src/plugin/datastore/test_plugin_datastore.c | |||
diff --git a/src/service/datastore/test_plugin_datastore_data_heap.conf b/src/plugin/datastore/test_plugin_datastore_data_heap.conf index b1ea8ff67..b1ea8ff67 100644 --- a/src/service/datastore/test_plugin_datastore_data_heap.conf +++ b/src/plugin/datastore/test_plugin_datastore_data_heap.conf | |||
diff --git a/src/service/datastore/test_plugin_datastore_data_postgres.conf b/src/plugin/datastore/test_plugin_datastore_data_postgres.conf index d0e29437f..d0e29437f 100644 --- a/src/service/datastore/test_plugin_datastore_data_postgres.conf +++ b/src/plugin/datastore/test_plugin_datastore_data_postgres.conf | |||
diff --git a/src/service/datastore/test_plugin_datastore_data_sqlite.conf b/src/plugin/datastore/test_plugin_datastore_data_sqlite.conf index ca837c77a..ca837c77a 100644 --- a/src/service/datastore/test_plugin_datastore_data_sqlite.conf +++ b/src/plugin/datastore/test_plugin_datastore_data_sqlite.conf | |||
diff --git a/src/plugin/dht/Makefile.am b/src/plugin/dht/Makefile.am new file mode 100644 index 000000000..4df810066 --- /dev/null +++ b/src/plugin/dht/Makefile.am | |||
@@ -0,0 +1,27 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | if USE_COVERAGE | ||
11 | AM_CFLAGS = --coverage -O0 | ||
12 | XLIB = -lgcov | ||
13 | endif | ||
14 | |||
15 | plugin_LTLIBRARIES = \ | ||
16 | libgnunet_plugin_block_dht.la | ||
17 | |||
18 | libgnunet_plugin_block_dht_la_SOURCES = \ | ||
19 | plugin_block_dht.c | ||
20 | libgnunet_plugin_block_dht_la_LIBADD = \ | ||
21 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | ||
22 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
23 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
24 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
25 | $(LTLIBINTL) | ||
26 | libgnunet_plugin_block_dht_la_LDFLAGS = \ | ||
27 | $(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/plugin/dht/meson.build b/src/plugin/dht/meson.build new file mode 100644 index 000000000..81b829dac --- /dev/null +++ b/src/plugin/dht/meson.build | |||
@@ -0,0 +1,9 @@ | |||
1 | shared_module('gnunet_plugin_block_dht', | ||
2 | ['plugin_block_dht.c'], | ||
3 | dependencies: [libgnunetutil_dep, | ||
4 | libgnunethello_dep, | ||
5 | libgnunetblock_dep, | ||
6 | libgnunetblockgroup_dep], | ||
7 | include_directories: [incdir, configuration_inc], | ||
8 | install:true, | ||
9 | install_dir: get_option('libdir')/'gnunet') | ||
diff --git a/src/service/dht/plugin_block_dht.c b/src/plugin/dht/plugin_block_dht.c index aa5ffc719..aa5ffc719 100644 --- a/src/service/dht/plugin_block_dht.c +++ b/src/plugin/dht/plugin_block_dht.c | |||
diff --git a/src/plugin/dns/Makefile.am b/src/plugin/dns/Makefile.am new file mode 100644 index 000000000..8b5843159 --- /dev/null +++ b/src/plugin/dns/Makefile.am | |||
@@ -0,0 +1,25 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if USE_COVERAGE | ||
5 | AM_CFLAGS = --coverage -O0 | ||
6 | endif | ||
7 | |||
8 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
9 | |||
10 | libexecdir= $(pkglibdir)/libexec/ | ||
11 | |||
12 | plugindir = $(libdir)/gnunet | ||
13 | |||
14 | plugin_LTLIBRARIES = \ | ||
15 | libgnunet_plugin_block_dns.la | ||
16 | |||
17 | libgnunet_plugin_block_dns_la_SOURCES = \ | ||
18 | plugin_block_dns.c | ||
19 | libgnunet_plugin_block_dns_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
21 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
22 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
23 | libgnunet_plugin_block_dns_la_LDFLAGS = \ | ||
24 | $(GN_LIBINTL) \ | ||
25 | $(top_builddir)/src/block/$(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/plugin/dns/meson.build b/src/plugin/dns/meson.build new file mode 100644 index 000000000..974b2c38d --- /dev/null +++ b/src/plugin/dns/meson.build | |||
@@ -0,0 +1,6 @@ | |||
1 | shared_module('gnunet_plugin_block_dns', | ||
2 | ['plugin_block_dns.c'], | ||
3 | dependencies: [libgnunetutil_dep, libgnunetblockgroup_dep], | ||
4 | include_directories: [incdir, configuration_inc], | ||
5 | install: true, | ||
6 | install_dir: get_option('libdir')/'gnunet') | ||
diff --git a/src/service/dns/plugin_block_dns.c b/src/plugin/dns/plugin_block_dns.c index 1bbd7f750..1bbd7f750 100644 --- a/src/service/dns/plugin_block_dns.c +++ b/src/plugin/dns/plugin_block_dns.c | |||
diff --git a/src/plugin/fs/Makefile.am b/src/plugin/fs/Makefile.am index 928997e4d..7c0e55cba 100644 --- a/src/plugin/fs/Makefile.am +++ b/src/plugin/fs/Makefile.am | |||
@@ -20,7 +20,6 @@ libgnunet_plugin_block_fs_la_SOURCES = \ | |||
20 | libgnunet_plugin_block_fs_la_LIBADD = \ | 20 | libgnunet_plugin_block_fs_la_LIBADD = \ |
21 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | 21 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ |
22 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | 22 | $(top_builddir)/src/lib/block/libgnunetblock.la \ |
23 | $(top_builddir)/src/service/fs/libgnunetfs.la \ | ||
24 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 23 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
25 | $(LTLIBINTL) | 24 | $(LTLIBINTL) |
26 | libgnunet_plugin_block_fs_la_LDFLAGS = \ | 25 | libgnunet_plugin_block_fs_la_LDFLAGS = \ |
diff --git a/src/plugin/gns/Makefile.am b/src/plugin/gns/Makefile.am index ebbb9aa51..8dc9ef2b2 100644 --- a/src/plugin/gns/Makefile.am +++ b/src/plugin/gns/Makefile.am | |||
@@ -34,7 +34,6 @@ libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ | |||
34 | plugin_gnsrecord_gns.c | 34 | plugin_gnsrecord_gns.c |
35 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ | 35 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ |
36 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | 36 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
37 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
38 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 37 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
39 | $(LTLIBINTL) | 38 | $(LTLIBINTL) |
40 | libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ | 39 | libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ |
@@ -47,7 +46,6 @@ libgnunet_plugin_block_gns_la_LIBADD = \ | |||
47 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 46 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
48 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | 47 | $(top_builddir)/src/lib/block/libgnunetblock.la \ |
49 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | 48 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ |
50 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
51 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la | 49 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la |
52 | libgnunet_plugin_block_gns_la_LDFLAGS = \ | 50 | libgnunet_plugin_block_gns_la_LDFLAGS = \ |
53 | $(GN_LIBINTL) \ | 51 | $(GN_LIBINTL) \ |
diff --git a/src/plugin/gns/meson.build b/src/plugin/gns/meson.build index 0e551b22e..2cdf770f8 100644 --- a/src/plugin/gns/meson.build +++ b/src/plugin/gns/meson.build | |||
@@ -2,7 +2,7 @@ shared_module('gnunet_plugin_gnsrecord_gns', | |||
2 | ['plugin_gnsrecord_gns.c'], | 2 | ['plugin_gnsrecord_gns.c'], |
3 | dependencies: [libgnunetutil_dep, | 3 | dependencies: [libgnunetutil_dep, |
4 | libgnunetgnsrecord_dep, | 4 | libgnunetgnsrecord_dep, |
5 | libgnunetidentity_dep], | 5 | ], |
6 | include_directories: [incdir, configuration_inc], | 6 | include_directories: [incdir, configuration_inc], |
7 | install: true, | 7 | install: true, |
8 | install_dir: get_option('libdir')/'gnunet') | 8 | install_dir: get_option('libdir')/'gnunet') |
diff --git a/src/plugin/meson.build b/src/plugin/meson.build index 6ebae59d7..d4f797c54 100644 --- a/src/plugin/meson.build +++ b/src/plugin/meson.build | |||
@@ -1,9 +1,17 @@ | |||
1 | subdir('block') | 1 | subdir('block') |
2 | subdir('dhtu') | 2 | subdir('dns') |
3 | subdir('gnsrecord') | 3 | subdir('gnsrecord') |
4 | subdir('datacache') | ||
5 | subdir('datastore') | ||
6 | subdir('peerstore') | ||
4 | subdir('namecache') | 7 | subdir('namecache') |
5 | subdir('namestore') | 8 | subdir('namestore') |
9 | subdir('dht') | ||
10 | subdir('seti') | ||
11 | subdir('setu') | ||
12 | subdir('regex') | ||
6 | subdir('revocation') | 13 | subdir('revocation') |
7 | subdir('gns') | 14 | subdir('gns') |
8 | subdir('fs') | 15 | subdir('fs') |
9 | subdir('reclaim') | 16 | subdir('reclaim') |
17 | subdir('messenger') | ||
diff --git a/src/plugin/messenger/Makefile.am b/src/plugin/messenger/Makefile.am new file mode 100644 index 000000000..e3c69ea33 --- /dev/null +++ b/src/plugin/messenger/Makefile.am | |||
@@ -0,0 +1,26 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if USE_COVERAGE | ||
5 | AM_CFLAGS = --coverage -O0 | ||
6 | XLIB = -lgcov | ||
7 | endif | ||
8 | |||
9 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
10 | |||
11 | libexecdir= $(pkglibdir)/libexec/ | ||
12 | |||
13 | plugin_LTLIBRARIES = \ | ||
14 | libgnunet_plugin_gnsrecord_messenger.la | ||
15 | |||
16 | |||
17 | libgnunet_plugin_gnsrecord_messenger_la_SOURCES = \ | ||
18 | plugin_gnsrecord_messenger.c | ||
19 | libgnunet_plugin_gnsrecord_messenger_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
21 | $(LTLIBINTL) | ||
22 | libgnunet_plugin_gnsrecord_messenger_la_LDFLAGS = \ | ||
23 | $(GN_PLUGIN_LDFLAGS) | ||
24 | |||
25 | |||
26 | plugindir = $(libdir)/gnunet | ||
diff --git a/src/plugin/messenger/meson.build b/src/plugin/messenger/meson.build new file mode 100644 index 000000000..17dd9bd32 --- /dev/null +++ b/src/plugin/messenger/meson.build | |||
@@ -0,0 +1,7 @@ | |||
1 | shared_module('gnunet_plugin_gnsrecord_messenger', | ||
2 | ['plugin_gnsrecord_messenger.c'], | ||
3 | dependencies: [libgnunetutil_dep, libgnunetgnsrecord_dep, | ||
4 | ], | ||
5 | include_directories: [incdir, configuration_inc], | ||
6 | install: true, | ||
7 | install_dir: get_option('libdir')/'gnunet') | ||
diff --git a/src/service/messenger/plugin_gnsrecord_messenger.c b/src/plugin/messenger/plugin_gnsrecord_messenger.c index e09a0330d..e09a0330d 100644 --- a/src/service/messenger/plugin_gnsrecord_messenger.c +++ b/src/plugin/messenger/plugin_gnsrecord_messenger.c | |||
diff --git a/src/plugin/namecache/Makefile.am b/src/plugin/namecache/Makefile.am index 0ccbf9ea1..bf8fc9b8d 100644 --- a/src/plugin/namecache/Makefile.am +++ b/src/plugin/namecache/Makefile.am | |||
@@ -56,10 +56,7 @@ plugin_LTLIBRARIES = \ | |||
56 | libgnunet_plugin_namecache_flat_la_SOURCES = \ | 56 | libgnunet_plugin_namecache_flat_la_SOURCES = \ |
57 | plugin_namecache_flat.c | 57 | plugin_namecache_flat.c |
58 | libgnunet_plugin_namecache_flat_la_LIBADD = \ | 58 | libgnunet_plugin_namecache_flat_la_LIBADD = \ |
59 | $(top_builddir)/src/service/namecache/libgnunetnamecache.la \ | ||
60 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
61 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | 59 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
62 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
63 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | 60 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ |
64 | $(LTLIBINTL) | 61 | $(LTLIBINTL) |
65 | libgnunet_plugin_namecache_flat_la_LDFLAGS = \ | 62 | libgnunet_plugin_namecache_flat_la_LDFLAGS = \ |
@@ -68,11 +65,8 @@ libgnunet_plugin_namecache_flat_la_LDFLAGS = \ | |||
68 | libgnunet_plugin_namecache_sqlite_la_SOURCES = \ | 65 | libgnunet_plugin_namecache_sqlite_la_SOURCES = \ |
69 | plugin_namecache_sqlite.c | 66 | plugin_namecache_sqlite.c |
70 | libgnunet_plugin_namecache_sqlite_la_LIBADD = \ | 67 | libgnunet_plugin_namecache_sqlite_la_LIBADD = \ |
71 | $(top_builddir)/src/service/namecache/libgnunetnamecache.la \ | ||
72 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | 68 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ |
73 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
74 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | 69 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
75 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
76 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | 70 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ |
77 | $(LTLIBINTL) | 71 | $(LTLIBINTL) |
78 | libgnunet_plugin_namecache_sqlite_la_LDFLAGS = \ | 72 | libgnunet_plugin_namecache_sqlite_la_LDFLAGS = \ |
@@ -82,11 +76,8 @@ libgnunet_plugin_namecache_sqlite_la_LDFLAGS = \ | |||
82 | libgnunet_plugin_namecache_postgres_la_SOURCES = \ | 76 | libgnunet_plugin_namecache_postgres_la_SOURCES = \ |
83 | plugin_namecache_postgres.c | 77 | plugin_namecache_postgres.c |
84 | libgnunet_plugin_namecache_postgres_la_LIBADD = \ | 78 | libgnunet_plugin_namecache_postgres_la_LIBADD = \ |
85 | $(top_builddir)/src/service/namecache/libgnunetnamecache.la \ | ||
86 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ | 79 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ |
87 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
88 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | 80 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
89 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
90 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq \ | 81 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq \ |
91 | $(LTLIBINTL) | 82 | $(LTLIBINTL) |
92 | libgnunet_plugin_namecache_postgres_la_LDFLAGS = \ | 83 | libgnunet_plugin_namecache_postgres_la_LDFLAGS = \ |
diff --git a/src/plugin/namestore/Makefile.am b/src/plugin/namestore/Makefile.am index e413c1b08..03b743d7a 100644 --- a/src/plugin/namestore/Makefile.am +++ b/src/plugin/namestore/Makefile.am | |||
@@ -76,37 +76,16 @@ TESTS = \ | |||
76 | $(check_SCRIPTS) | 76 | $(check_SCRIPTS) |
77 | endif | 77 | endif |
78 | 78 | ||
79 | REST_PLUGIN = libgnunet_plugin_rest_namestore.la | ||
80 | |||
81 | plugin_LTLIBRARIES = \ | 79 | plugin_LTLIBRARIES = \ |
82 | $(SQLITE_PLUGIN) \ | 80 | $(SQLITE_PLUGIN) \ |
83 | $(POSTGRES_PLUGIN) \ | 81 | $(POSTGRES_PLUGIN) |
84 | $(REST_PLUGIN) | ||
85 | |||
86 | |||
87 | libgnunet_plugin_rest_namestore_la_SOURCES = \ | ||
88 | plugin_rest_namestore.c | ||
89 | libgnunet_plugin_rest_namestore_la_LIBADD = \ | ||
90 | $(top_builddir)/src/service/namestore/libgnunetnamestore.la \ | ||
91 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
92 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
93 | $(top_builddir)/src/lib/json/libgnunetjson.la \ | ||
94 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | ||
95 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecordjson.la \ | ||
96 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
97 | $(LTLIBINTL) -ljansson $(MHD_LIBS) | ||
98 | libgnunet_plugin_rest_namestore_la_LDFLAGS = \ | ||
99 | $(GN_PLUGIN_LDFLAGS) | ||
100 | libgnunet_plugin_rest_namestore_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
101 | 82 | ||
102 | 83 | ||
103 | libgnunet_plugin_namestore_sqlite_la_SOURCES = \ | 84 | libgnunet_plugin_namestore_sqlite_la_SOURCES = \ |
104 | plugin_namestore_sqlite.c | 85 | plugin_namestore_sqlite.c |
105 | libgnunet_plugin_namestore_sqlite_la_LIBADD = \ | 86 | libgnunet_plugin_namestore_sqlite_la_LIBADD = \ |
106 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | 87 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
107 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
108 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | 88 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ |
109 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
110 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | 89 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ |
111 | $(LTLIBINTL) | 90 | $(LTLIBINTL) |
112 | libgnunet_plugin_namestore_sqlite_la_LDFLAGS = \ | 91 | libgnunet_plugin_namestore_sqlite_la_LDFLAGS = \ |
@@ -116,9 +95,7 @@ libgnunet_plugin_namestore_postgres_la_SOURCES = \ | |||
116 | plugin_namestore_postgres.c | 95 | plugin_namestore_postgres.c |
117 | libgnunet_plugin_namestore_postgres_la_LIBADD = \ | 96 | libgnunet_plugin_namestore_postgres_la_LIBADD = \ |
118 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | 97 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
119 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
120 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ | 98 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ |
121 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
122 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq \ | 99 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq \ |
123 | $(LTLIBINTL) | 100 | $(LTLIBINTL) |
124 | libgnunet_plugin_namestore_postgres_la_LDFLAGS = \ | 101 | libgnunet_plugin_namestore_postgres_la_LDFLAGS = \ |
@@ -422,9 +399,6 @@ test_plugin_namestore_postgres_LDADD = \ | |||
422 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 399 | $(top_builddir)/src/service/testing/libgnunettesting.la \ |
423 | $(top_builddir)/src/lib/util/libgnunetutil.la | 400 | $(top_builddir)/src/lib/util/libgnunetutil.la |
424 | 401 | ||
425 | check_SCRIPTS = \ | ||
426 | test_plugin_rest_namestore.sh | ||
427 | |||
428 | EXTRA_DIST = \ | 402 | EXTRA_DIST = \ |
429 | test_common.c \ | 403 | test_common.c \ |
430 | test_namestore_api.conf \ | 404 | test_namestore_api.conf \ |
@@ -434,5 +408,4 @@ EXTRA_DIST = \ | |||
434 | perf_namestore_api_sqlite.conf \ | 408 | perf_namestore_api_sqlite.conf \ |
435 | test_plugin_namestore_sqlite.conf \ | 409 | test_plugin_namestore_sqlite.conf \ |
436 | test_plugin_namestore_postgres.conf \ | 410 | test_plugin_namestore_postgres.conf \ |
437 | $(check_SCRIPTS) \ | ||
438 | $(sql_DATA) | 411 | $(sql_DATA) |
diff --git a/src/plugin/namestore/meson.build b/src/plugin/namestore/meson.build index 32db8c104..d51b4b730 100644 --- a/src/plugin/namestore/meson.build +++ b/src/plugin/namestore/meson.build | |||
@@ -1,26 +1,10 @@ | |||
1 | shared_module('gnunet_plugin_rest_namestore', | 1 | libgnunetpluginnamestore_sqlite_src = ['plugin_namestore_sqlite.c'] |
2 | ['plugin_rest_namestore.c'], | ||
3 | dependencies: [libgnunetrest_dep, | ||
4 | libgnunetidentity_dep, | ||
5 | libgnunetgnsrecordjson_dep, | ||
6 | libgnunetgnsrecord_dep, | ||
7 | libgnunetnamestore_dep, | ||
8 | libgnunetjson_dep, | ||
9 | libgnunetutil_dep, | ||
10 | json_dep, | ||
11 | mhd_dep], | ||
12 | include_directories: [incdir, configuration_inc], | ||
13 | install: true, | ||
14 | install_dir: get_option('libdir') / 'gnunet') | ||
15 | |||
16 | 2 | ||
17 | shared_module('gnunet_plugin_namestore_sqlite', | 3 | shared_module('gnunet_plugin_namestore_sqlite', |
18 | libgnunetpluginnamestore_sqlite_src, | 4 | libgnunetpluginnamestore_sqlite_src, |
19 | dependencies: [libgnunetutil_dep, | 5 | dependencies: [libgnunetutil_dep, |
20 | libgnunetgnsrecord_dep, | 6 | libgnunetgnsrecord_dep, |
21 | libgnunetidentity_dep, | ||
22 | libgnunetsq_dep, | 7 | libgnunetsq_dep, |
23 | libgnunetstatistics_dep, | ||
24 | sqlite_dep], | 8 | sqlite_dep], |
25 | include_directories: [incdir, configuration_inc], | 9 | include_directories: [incdir, configuration_inc], |
26 | install: true, | 10 | install: true, |
@@ -31,9 +15,7 @@ if pq_dep.found() | |||
31 | ['plugin_namestore_postgres.c'], | 15 | ['plugin_namestore_postgres.c'], |
32 | dependencies: [libgnunetutil_dep, | 16 | dependencies: [libgnunetutil_dep, |
33 | libgnunetgnsrecord_dep, | 17 | libgnunetgnsrecord_dep, |
34 | libgnunetidentity_dep, | ||
35 | libgnunetpq_dep, | 18 | libgnunetpq_dep, |
36 | libgnunetstatistics_dep, | ||
37 | pq_dep], | 19 | pq_dep], |
38 | include_directories: [incdir, configuration_inc], | 20 | include_directories: [incdir, configuration_inc], |
39 | install: true, | 21 | install: true, |
diff --git a/src/plugin/peerstore/Makefile.am b/src/plugin/peerstore/Makefile.am new file mode 100644 index 000000000..225e9a71e --- /dev/null +++ b/src/plugin/peerstore/Makefile.am | |||
@@ -0,0 +1,67 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | if USE_COVERAGE | ||
11 | AM_CFLAGS = -fprofile-arcs -ftest-coverage | ||
12 | endif | ||
13 | |||
14 | if HAVE_EXPERIMENTAL | ||
15 | FLAT_PLUGIN = libgnunet_plugin_peerstore_flat.la | ||
16 | FLAT_TESTS = test_plugin_peerstore_flat | ||
17 | libgnunet_plugin_peerstore_flat_la_SOURCES = \ | ||
18 | plugin_peerstore_flat.c | ||
19 | libgnunet_plugin_peerstore_flat_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
21 | $(LTLIBINTL) | ||
22 | libgnunet_plugin_peerstore_flat_la_LDFLAGS = \ | ||
23 | $(GN_PLUGIN_LDFLAGS) | ||
24 | endif | ||
25 | |||
26 | if HAVE_SQLITE | ||
27 | SQLITE_PLUGIN = libgnunet_plugin_peerstore_sqlite.la | ||
28 | SQLITE_TESTS = test_plugin_peerstore_sqlite | ||
29 | libgnunet_plugin_peerstore_sqlite_la_SOURCES = \ | ||
30 | plugin_peerstore_sqlite.c | ||
31 | libgnunet_plugin_peerstore_sqlite_la_LIBADD = \ | ||
32 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | ||
33 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
34 | $(XLIBS) -lsqlite3 \ | ||
35 | $(LTLIBINTL) | ||
36 | libgnunet_plugin_peerstore_sqlite_la_LDFLAGS = \ | ||
37 | $(GN_PLUGIN_LDFLAGS) | ||
38 | endif | ||
39 | |||
40 | plugin_LTLIBRARIES = \ | ||
41 | $(SQLITE_PLUGIN) \ | ||
42 | $(FLAT_PLUGIN) | ||
43 | |||
44 | test_plugin_peerstore_sqlite_SOURCES = \ | ||
45 | test_plugin_peerstore.c | ||
46 | test_plugin_peerstore_sqlite_LDADD = \ | ||
47 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
48 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
49 | |||
50 | test_plugin_peerstore_flat_SOURCES = \ | ||
51 | test_plugin_peerstore.c | ||
52 | test_plugin_peerstore_flat_LDADD = \ | ||
53 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
54 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
55 | |||
56 | check_PROGRAMS = \ | ||
57 | $(SQLITE_TESTS) \ | ||
58 | $(FLAT_TESTS) | ||
59 | |||
60 | EXTRA_DIST = \ | ||
61 | test_plugin_peerstore_flat.conf \ | ||
62 | test_plugin_peerstore_sqlite.conf | ||
63 | |||
64 | if ENABLE_TEST_RUN | ||
65 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | ||
66 | TESTS = $(check_PROGRAMS) | ||
67 | endif | ||
diff --git a/src/plugin/peerstore/meson.build b/src/plugin/peerstore/meson.build new file mode 100644 index 000000000..1d22ca798 --- /dev/null +++ b/src/plugin/peerstore/meson.build | |||
@@ -0,0 +1,9 @@ | |||
1 | shared_module('gnunet_plugin_peerstore_sqlite', | ||
2 | ['plugin_peerstore_sqlite.c'], | ||
3 | dependencies: [libgnunetutil_dep, | ||
4 | libgnunetsq_dep, | ||
5 | sqlite_dep], | ||
6 | include_directories: [incdir, | ||
7 | configuration_inc], | ||
8 | install: true, | ||
9 | install_dir: get_option('libdir')/'gnunet') | ||
diff --git a/src/service/peerstore/plugin_peerstore_flat.c b/src/plugin/peerstore/plugin_peerstore_flat.c index cc5b8b76b..cc304d4db 100644 --- a/src/service/peerstore/plugin_peerstore_flat.c +++ b/src/plugin/peerstore/plugin_peerstore_flat.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_peerstore_plugin.h" | 28 | #include "gnunet_peerstore_plugin.h" |
29 | #include "gnunet_peerstore_service.h" | 29 | #include "gnunet_peerstore_service.h" |
30 | #include "peerstore.h" | 30 | #include "../../service/peerstore/peerstore.h" |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Context for all functions in this plugin. | 33 | * Context for all functions in this plugin. |
diff --git a/src/service/peerstore/plugin_peerstore_sqlite.c b/src/plugin/peerstore/plugin_peerstore_sqlite.c index ad69efdf4..7d06d2c63 100644 --- a/src/service/peerstore/plugin_peerstore_sqlite.c +++ b/src/plugin/peerstore/plugin_peerstore_sqlite.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_peerstore_plugin.h" | 29 | #include "gnunet_peerstore_plugin.h" |
30 | #include "gnunet_peerstore_service.h" | 30 | #include "gnunet_peerstore_service.h" |
31 | #include "gnunet_sq_lib.h" | 31 | #include "gnunet_sq_lib.h" |
32 | #include "peerstore.h" | 32 | #include "../../service/peerstore/peerstore.h" |
33 | #include <sqlite3.h> | 33 | #include <sqlite3.h> |
34 | 34 | ||
35 | /** | 35 | /** |
diff --git a/src/service/peerstore/test_plugin_peerstore.c b/src/plugin/peerstore/test_plugin_peerstore.c index bce62dda9..bce62dda9 100644 --- a/src/service/peerstore/test_plugin_peerstore.c +++ b/src/plugin/peerstore/test_plugin_peerstore.c | |||
diff --git a/src/service/peerstore/test_plugin_peerstore_flat.conf b/src/plugin/peerstore/test_plugin_peerstore_flat.conf index c55b1e9d6..c55b1e9d6 100644 --- a/src/service/peerstore/test_plugin_peerstore_flat.conf +++ b/src/plugin/peerstore/test_plugin_peerstore_flat.conf | |||
diff --git a/src/service/peerstore/test_plugin_peerstore_sqlite.conf b/src/plugin/peerstore/test_plugin_peerstore_sqlite.conf index dcf1fc1a4..dcf1fc1a4 100644 --- a/src/service/peerstore/test_plugin_peerstore_sqlite.conf +++ b/src/plugin/peerstore/test_plugin_peerstore_sqlite.conf | |||
diff --git a/src/plugin/reclaim/Makefile.am b/src/plugin/reclaim/Makefile.am index 0b5159c6b..e8ac2f94d 100644 --- a/src/plugin/reclaim/Makefile.am +++ b/src/plugin/reclaim/Makefile.am | |||
@@ -59,11 +59,11 @@ endif | |||
59 | 59 | ||
60 | 60 | ||
61 | libgnunet_plugin_reclaim_credential_jwt_la_SOURCES = \ | 61 | libgnunet_plugin_reclaim_credential_jwt_la_SOURCES = \ |
62 | plugin_reclaim_credential_jwt.c | 62 | plugin_reclaim_credential_jwt.c \ |
63 | $(top_builddir)/src/service/reclaim/reclaim_attribute.c \ | ||
64 | $(top_builddir)/src/service/reclaim/reclaim_credential.c | ||
63 | libgnunet_plugin_reclaim_credential_jwt_la_LIBADD = \ | 65 | libgnunet_plugin_reclaim_credential_jwt_la_LIBADD = \ |
64 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
65 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 66 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
66 | $(top_builddir)/src/service/reclaim/libgnunetreclaim.la \ | ||
67 | -ljansson\ | 67 | -ljansson\ |
68 | $(LTLIBINTL) | 68 | $(LTLIBINTL) |
69 | libgnunet_plugin_reclaim_credential_jwt_la_LDFLAGS = \ | 69 | libgnunet_plugin_reclaim_credential_jwt_la_LDFLAGS = \ |
diff --git a/src/plugin/reclaim/meson.build b/src/plugin/reclaim/meson.build index 51346b108..df0289ca2 100644 --- a/src/plugin/reclaim/meson.build +++ b/src/plugin/reclaim/meson.build | |||
@@ -7,9 +7,7 @@ shared_module('gnunet_plugin_gnsrecord_reclaim', | |||
7 | 7 | ||
8 | shared_module('gnunet_plugin_reclaim_attribute_basic', | 8 | shared_module('gnunet_plugin_reclaim_attribute_basic', |
9 | ['plugin_reclaim_attribute_basic.c'], | 9 | ['plugin_reclaim_attribute_basic.c'], |
10 | dependencies: [libgnunetrest_dep, | 10 | dependencies: [ |
11 | libgnunetidentity_dep, | ||
12 | libgnunetreclaim_dep, | ||
13 | libgnunetjson_dep, | 11 | libgnunetjson_dep, |
14 | libgnunetutil_dep, | 12 | libgnunetutil_dep, |
15 | json_dep], | 13 | json_dep], |
@@ -18,9 +16,7 @@ shared_module('gnunet_plugin_reclaim_attribute_basic', | |||
18 | install_dir: get_option('libdir') / 'gnunet') | 16 | install_dir: get_option('libdir') / 'gnunet') |
19 | shared_module('gnunet_plugin_reclaim_credential_jwt', | 17 | shared_module('gnunet_plugin_reclaim_credential_jwt', |
20 | ['plugin_reclaim_credential_jwt.c'], | 18 | ['plugin_reclaim_credential_jwt.c'], |
21 | dependencies: [libgnunetrest_dep, | 19 | dependencies: [ |
22 | libgnunetidentity_dep, | ||
23 | libgnunetreclaim_dep, | ||
24 | libgnunetjson_dep, | 20 | libgnunetjson_dep, |
25 | libgnunetutil_dep, | 21 | libgnunetutil_dep, |
26 | json_dep], | 22 | json_dep], |
diff --git a/src/plugin/regex/Makefile.am b/src/plugin/regex/Makefile.am new file mode 100644 index 000000000..a39cfc927 --- /dev/null +++ b/src/plugin/regex/Makefile.am | |||
@@ -0,0 +1,40 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if USE_COVERAGE | ||
5 | AM_CFLAGS = --coverage | ||
6 | endif | ||
7 | |||
8 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
9 | |||
10 | libexecdir= $(pkglibdir)/libexec/ | ||
11 | |||
12 | plugindir = $(libdir)/gnunet | ||
13 | |||
14 | lib_LTLIBRARIES = \ | ||
15 | libgnunetregexblock.la | ||
16 | |||
17 | libgnunetregexblock_la_SOURCES = \ | ||
18 | regex_block_lib.c regex_block_lib.h | ||
19 | libgnunetregexblock_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
21 | $(XLIB) \ | ||
22 | $(LTLIBINTL) | ||
23 | libgnunetregexblock_la_LDFLAGS = \ | ||
24 | $(GN_LIB_LDFLAGS) \ | ||
25 | -version-info 1:0:0 | ||
26 | |||
27 | |||
28 | plugin_LTLIBRARIES = \ | ||
29 | libgnunet_plugin_block_regex.la | ||
30 | |||
31 | libgnunet_plugin_block_regex_la_SOURCES = \ | ||
32 | plugin_block_regex.c | ||
33 | libgnunet_plugin_block_regex_la_LIBADD = \ | ||
34 | libgnunetregexblock.la \ | ||
35 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
36 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
37 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
38 | libgnunet_plugin_block_regex_la_LDFLAGS = \ | ||
39 | $(GN_LIBINTL) \ | ||
40 | $(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/plugin/regex/meson.build b/src/plugin/regex/meson.build new file mode 100644 index 000000000..0e1b4b08d --- /dev/null +++ b/src/plugin/regex/meson.build | |||
@@ -0,0 +1,23 @@ | |||
1 | libgnunetregexblock_src = ['regex_block_lib.c'] | ||
2 | |||
3 | libgnunetregexblock = library('gnunetregexblock', | ||
4 | libgnunetregexblock_src, | ||
5 | soversion: '1', | ||
6 | version: '1.0.0', | ||
7 | dependencies: libgnunetutil_dep, | ||
8 | include_directories: [incdir, configuration_inc], | ||
9 | install: true, | ||
10 | install_dir: get_option('libdir')) | ||
11 | libgnunetregexblock_dep = declare_dependency(link_with : libgnunetregexblock) | ||
12 | |||
13 | shared_module('gnunet_plugin_block_regex', | ||
14 | ['plugin_block_regex.c'], | ||
15 | dependencies: [libgnunetutil_dep, | ||
16 | libgnunetregexblock_dep, | ||
17 | libgnunetblock_dep, | ||
18 | libgnunetblockgroup_dep], | ||
19 | include_directories: [incdir, configuration_inc], | ||
20 | install:true, | ||
21 | install_dir: get_option('libdir')/'gnunet') | ||
22 | |||
23 | |||
diff --git a/src/service/regex/plugin_block_regex.c b/src/plugin/regex/plugin_block_regex.c index 5f23a32df..5f23a32df 100644 --- a/src/service/regex/plugin_block_regex.c +++ b/src/plugin/regex/plugin_block_regex.c | |||
diff --git a/src/service/regex/regex_block_lib.c b/src/plugin/regex/regex_block_lib.c index 048d6d743..048d6d743 100644 --- a/src/service/regex/regex_block_lib.c +++ b/src/plugin/regex/regex_block_lib.c | |||
diff --git a/src/service/regex/regex_block_lib.h b/src/plugin/regex/regex_block_lib.h index 11029b9af..11029b9af 100644 --- a/src/service/regex/regex_block_lib.h +++ b/src/plugin/regex/regex_block_lib.h | |||
diff --git a/src/plugin/revocation/Makefile.am b/src/plugin/revocation/Makefile.am index db6df02c9..99373f8d7 100644 --- a/src/plugin/revocation/Makefile.am +++ b/src/plugin/revocation/Makefile.am | |||
@@ -18,11 +18,10 @@ plugin_LTLIBRARIES = \ | |||
18 | libgnunet_plugin_block_revocation_la_SOURCES = \ | 18 | libgnunet_plugin_block_revocation_la_SOURCES = \ |
19 | plugin_block_revocation.c | 19 | plugin_block_revocation.c |
20 | libgnunet_plugin_block_revocation_la_LIBADD = \ | 20 | libgnunet_plugin_block_revocation_la_LIBADD = \ |
21 | $(top_builddir)/src/service/revocation/libgnunetrevocation.la \ | 21 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
22 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | 22 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ |
23 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | 23 | $(top_builddir)/src/lib/block/libgnunetblock.la \ |
24 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 24 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
25 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
26 | $(LTLIBINTL) | 25 | $(LTLIBINTL) |
27 | libgnunet_plugin_block_revocation_la_LDFLAGS = \ | 26 | libgnunet_plugin_block_revocation_la_LDFLAGS = \ |
28 | $(GN_PLUGIN_LDFLAGS) | 27 | $(GN_PLUGIN_LDFLAGS) |
diff --git a/src/plugin/revocation/meson.build b/src/plugin/revocation/meson.build index 7f8c8ec5e..c4405e9b8 100644 --- a/src/plugin/revocation/meson.build +++ b/src/plugin/revocation/meson.build | |||
@@ -1,8 +1,6 @@ | |||
1 | shared_module('gnunet_plugin_block_revocation', | 1 | shared_module('gnunet_plugin_block_revocation', |
2 | ['plugin_block_revocation.c'], | 2 | ['plugin_block_revocation.c'], |
3 | dependencies: [libgnunetutil_dep, | 3 | dependencies: [libgnunetutil_dep, |
4 | libgnunetidentity_dep, | ||
5 | libgnunetrevocation_dep, | ||
6 | libgnunetblock_dep], | 4 | libgnunetblock_dep], |
7 | include_directories: [incdir, configuration_inc], | 5 | include_directories: [incdir, configuration_inc], |
8 | install: true, | 6 | install: true, |
diff --git a/src/plugin/revocation/plugin_block_revocation.c b/src/plugin/revocation/plugin_block_revocation.c index 4c5991507..c4332184e 100644 --- a/src/plugin/revocation/plugin_block_revocation.c +++ b/src/plugin/revocation/plugin_block_revocation.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_signatures.h" | 28 | #include "gnunet_signatures.h" |
29 | #include "gnunet_block_plugin.h" | 29 | #include "gnunet_block_plugin.h" |
30 | #include "gnunet_gnsrecord_lib.h" | ||
30 | #include "gnunet_block_group_lib.h" | 31 | #include "gnunet_block_group_lib.h" |
31 | // FIXME try to avoid this include somehow | ||
32 | #include "../../service/revocation/revocation.h" | 32 | #include "../../service/revocation/revocation.h" |
33 | #include "gnunet_revocation_service.h" | 33 | #include "gnunet_revocation_service.h" |
34 | 34 | ||
@@ -93,8 +93,8 @@ block_plugin_revocation_check_block (void *cls, | |||
93 | { | 93 | { |
94 | struct InternalContext *ic = cls; | 94 | struct InternalContext *ic = cls; |
95 | const struct RevokeMessage *rm = block; | 95 | const struct RevokeMessage *rm = block; |
96 | const struct GNUNET_REVOCATION_PowP *pow | 96 | const struct GNUNET_GNSRECORD_PowP *pow |
97 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; | 97 | = (const struct GNUNET_GNSRECORD_PowP *) &rm[1]; |
98 | struct GNUNET_CRYPTO_PublicKey pk; | 98 | struct GNUNET_CRYPTO_PublicKey pk; |
99 | size_t pklen; | 99 | size_t pklen; |
100 | size_t left; | 100 | size_t left; |
@@ -117,9 +117,9 @@ block_plugin_revocation_check_block (void *cls, | |||
117 | left = block_size - sizeof (*rm) - sizeof (*pow); | 117 | left = block_size - sizeof (*rm) - sizeof (*pow); |
118 | if (GNUNET_SYSERR == | 118 | if (GNUNET_SYSERR == |
119 | GNUNET_CRYPTO_read_public_key_from_buffer (&pow[1], | 119 | GNUNET_CRYPTO_read_public_key_from_buffer (&pow[1], |
120 | left, | 120 | left, |
121 | &pk, | 121 | &pk, |
122 | &pklen)) | 122 | &pklen)) |
123 | { | 123 | { |
124 | GNUNET_break_op (0); | 124 | GNUNET_break_op (0); |
125 | return GNUNET_NO; | 125 | return GNUNET_NO; |
@@ -130,9 +130,9 @@ block_plugin_revocation_check_block (void *cls, | |||
130 | return GNUNET_NO; | 130 | return GNUNET_NO; |
131 | } | 131 | } |
132 | if (GNUNET_YES != | 132 | if (GNUNET_YES != |
133 | GNUNET_REVOCATION_check_pow (pow, | 133 | GNUNET_GNSRECORD_check_pow (pow, |
134 | ic->matching_bits, | 134 | ic->matching_bits, |
135 | ic->epoch_duration)) | 135 | ic->epoch_duration)) |
136 | { | 136 | { |
137 | GNUNET_break_op (0); | 137 | GNUNET_break_op (0); |
138 | return GNUNET_NO; | 138 | return GNUNET_NO; |
@@ -203,8 +203,8 @@ block_plugin_revocation_get_key (void *cls, | |||
203 | struct GNUNET_HashCode *key) | 203 | struct GNUNET_HashCode *key) |
204 | { | 204 | { |
205 | const struct RevokeMessage *rm = block; | 205 | const struct RevokeMessage *rm = block; |
206 | const struct GNUNET_REVOCATION_PowP *pow | 206 | const struct GNUNET_GNSRECORD_PowP *pow |
207 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; | 207 | = (const struct GNUNET_GNSRECORD_PowP *) &rm[1]; |
208 | struct GNUNET_CRYPTO_PublicKey pk; | 208 | struct GNUNET_CRYPTO_PublicKey pk; |
209 | size_t pklen; | 209 | size_t pklen; |
210 | size_t left; | 210 | size_t left; |
@@ -226,9 +226,9 @@ block_plugin_revocation_get_key (void *cls, | |||
226 | } | 226 | } |
227 | left = block_size - sizeof (*rm) - sizeof (*pow); | 227 | left = block_size - sizeof (*rm) - sizeof (*pow); |
228 | if (GNUNET_SYSERR == GNUNET_CRYPTO_read_public_key_from_buffer (&pow[1], | 228 | if (GNUNET_SYSERR == GNUNET_CRYPTO_read_public_key_from_buffer (&pow[1], |
229 | left, | 229 | left, |
230 | &pk, | 230 | &pk, |
231 | &pklen)) | 231 | &pklen)) |
232 | { | 232 | { |
233 | GNUNET_break_op (0); | 233 | GNUNET_break_op (0); |
234 | return GNUNET_NO; | 234 | return GNUNET_NO; |
diff --git a/src/plugin/seti/Makefile.am b/src/plugin/seti/Makefile.am new file mode 100644 index 000000000..e6f579a65 --- /dev/null +++ b/src/plugin/seti/Makefile.am | |||
@@ -0,0 +1,25 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
5 | |||
6 | libexecdir= $(pkglibdir)/libexec/ | ||
7 | |||
8 | plugindir = $(libdir)/gnunet | ||
9 | |||
10 | if USE_COVERAGE | ||
11 | AM_CFLAGS = -fprofile-arcs -ftest-coverage | ||
12 | endif | ||
13 | |||
14 | plugin_LTLIBRARIES = \ | ||
15 | libgnunet_plugin_block_seti_test.la | ||
16 | |||
17 | libgnunet_plugin_block_seti_test_la_SOURCES = \ | ||
18 | plugin_block_seti_test.c | ||
19 | libgnunet_plugin_block_seti_test_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
21 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
22 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
23 | $(LTLIBINTL) | ||
24 | libgnunet_plugin_block_seti_test_la_LDFLAGS = \ | ||
25 | $(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/plugin/seti/meson.build b/src/plugin/seti/meson.build new file mode 100644 index 000000000..880936164 --- /dev/null +++ b/src/plugin/seti/meson.build | |||
@@ -0,0 +1,7 @@ | |||
1 | shared_module('gnunet_plugin_block_seti_test', | ||
2 | ['plugin_block_seti_test.c'], | ||
3 | dependencies: libgnunetutil_dep, | ||
4 | include_directories: [incdir, configuration_inc], | ||
5 | install:true, | ||
6 | install_dir: get_option('libdir')/'gnunet') | ||
7 | |||
diff --git a/src/service/seti/plugin_block_seti_test.c b/src/plugin/seti/plugin_block_seti_test.c index 5b9196cef..5b9196cef 100644 --- a/src/service/seti/plugin_block_seti_test.c +++ b/src/plugin/seti/plugin_block_seti_test.c | |||
diff --git a/src/plugin/setu/Makefile.am b/src/plugin/setu/Makefile.am new file mode 100644 index 000000000..90a14cce0 --- /dev/null +++ b/src/plugin/setu/Makefile.am | |||
@@ -0,0 +1,21 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
5 | |||
6 | libexecdir= $(pkglibdir)/libexec/ | ||
7 | |||
8 | plugindir = $(libdir)/gnunet | ||
9 | |||
10 | plugin_LTLIBRARIES = \ | ||
11 | libgnunet_plugin_block_setu_test.la | ||
12 | |||
13 | libgnunet_plugin_block_setu_test_la_SOURCES = \ | ||
14 | plugin_block_setu_test.c | ||
15 | libgnunet_plugin_block_setu_test_la_LIBADD = \ | ||
16 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
17 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
18 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
19 | $(LTLIBINTL) | ||
20 | libgnunet_plugin_block_setu_test_la_LDFLAGS = \ | ||
21 | $(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/plugin/setu/meson.build b/src/plugin/setu/meson.build new file mode 100644 index 000000000..e22738ab6 --- /dev/null +++ b/src/plugin/setu/meson.build | |||
@@ -0,0 +1,7 @@ | |||
1 | shared_module('gnunet_plugin_block_setu_test', | ||
2 | ['plugin_block_setu_test.c'], | ||
3 | dependencies: libgnunetutil_dep, | ||
4 | include_directories: [incdir, configuration_inc], | ||
5 | install:true, | ||
6 | install_dir: get_option('libdir')/'gnunet') | ||
7 | |||
diff --git a/src/service/setu/plugin_block_setu_test.c b/src/plugin/setu/plugin_block_setu_test.c index 178ad3314..178ad3314 100644 --- a/src/service/setu/plugin_block_setu_test.c +++ b/src/plugin/setu/plugin_block_setu_test.c | |||
diff --git a/src/rest-plugin/Makefile.am b/src/rest-plugin/Makefile.am deleted file mode 100644 index d76972b78..000000000 --- a/src/rest-plugin/Makefile.am +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | SUBDIRS = \ | ||
2 | rest \ | ||
3 | identity \ | ||
4 | gns \ | ||
5 | reclaim | ||
diff --git a/src/rest-plugin/gns/Makefile.am b/src/rest-plugin/gns/Makefile.am deleted file mode 100644 index 48b278df6..000000000 --- a/src/rest-plugin/gns/Makefile.am +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if HAVE_LIBIDN | ||
5 | LIBIDN= -lidn | ||
6 | else | ||
7 | LIBIDN= | ||
8 | endif | ||
9 | |||
10 | if HAVE_LIBIDN2 | ||
11 | LIBIDN2= -lidn2 | ||
12 | else | ||
13 | LIBIDN2= | ||
14 | endif | ||
15 | |||
16 | USE_VPN = $(top_builddir)/src/service/vpn/libgnunetvpn.la | ||
17 | |||
18 | if USE_COVERAGE | ||
19 | AM_CFLAGS = --coverage -O0 | ||
20 | endif | ||
21 | |||
22 | pkgcfgdir = $(pkgdatadir)/config.d/ | ||
23 | |||
24 | libexecdir= $(pkglibdir)/libexec/ | ||
25 | |||
26 | plugindir = $(libdir)/gnunet | ||
27 | |||
28 | REST_PLUGIN = libgnunet_plugin_rest_gns.la | ||
29 | |||
30 | plugin_LTLIBRARIES = \ | ||
31 | $(REST_PLUGIN) | ||
32 | |||
33 | |||
34 | libgnunet_plugin_rest_gns_la_SOURCES = \ | ||
35 | plugin_rest_gns.c | ||
36 | libgnunet_plugin_rest_gns_la_LIBADD = \ | ||
37 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | ||
38 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecordjson.la \ | ||
39 | $(top_builddir)/src/service/gns/libgnunetgns.la \ | ||
40 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
41 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
42 | $(top_builddir)/src/lib/json/libgnunetjson.la \ | ||
43 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
44 | $(LTLIBINTL) -ljansson $(MHD_LIBS) | ||
45 | libgnunet_plugin_rest_gns_la_LDFLAGS = \ | ||
46 | $(GN_PLUGIN_LDFLAGS) | ||
47 | libgnunet_plugin_rest_gns_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
48 | |||
49 | |||
50 | check_SCRIPTS = \ | ||
51 | test_plugin_rest_gns.sh | ||
52 | |||
53 | EXTRA_DIST = \ | ||
54 | test_plugin_rest_gns.sh | ||
55 | |||
56 | if ENABLE_TEST_RUN | ||
57 | if HAVE_SQLITE | ||
58 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | ||
59 | TESTS = $(check_SCRIPTS) | ||
60 | endif | ||
61 | endif | ||
diff --git a/src/rest-plugin/gns/meson.build b/src/rest-plugin/gns/meson.build deleted file mode 100644 index 7a4deffed..000000000 --- a/src/rest-plugin/gns/meson.build +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | shared_module('gnunet_plugin_rest_gns', | ||
2 | ['plugin_rest_gns.c'], | ||
3 | dependencies: [libgnunetrest_dep, | ||
4 | libgnunetgnsrecord_dep, | ||
5 | libgnunetgnsrecordjson_dep, | ||
6 | libgnunetgns_dep, | ||
7 | libgnunetutil_dep, | ||
8 | json_dep, | ||
9 | mhd_dep], | ||
10 | include_directories: [incdir, configuration_inc], | ||
11 | install: true, | ||
12 | install_dir: get_option('libdir') / 'gnunet') | ||
13 | |||
diff --git a/src/rest-plugin/gns/test_plugin_rest_gns.sh b/src/rest-plugin/gns/test_plugin_rest_gns.sh deleted file mode 100755 index 3bcfb5a08..000000000 --- a/src/rest-plugin/gns/test_plugin_rest_gns.sh +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # This file is in the public domain. | ||
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" INT | ||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1> /dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | ||
17 | |||
18 | gns_link="http://localhost:7776/gns" | ||
19 | wrong_link="http://localhost:7776/gnsandmore" | ||
20 | |||
21 | curl_get () { | ||
22 | #$1 is link | ||
23 | #$2 is grep | ||
24 | XURL=`which curl` | ||
25 | if [ "" = "$XURL" ] | ||
26 | then | ||
27 | echo "HTTP client (curl) not found, exiting" | ||
28 | exit 77 | ||
29 | fi | ||
30 | sleep 0.5 | ||
31 | cache="$(${XURL} -v "$1" 2>&1 | grep "$2")" | ||
32 | #echo "$cache" | ||
33 | if [ "" = "$cache" ] | ||
34 | then | ||
35 | gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1 | ||
36 | gnunet-arm -e -c test_gns_lookup.conf | ||
37 | echo "Download of $1 using $XURL failed, expected $2" | ||
38 | exit 1 | ||
39 | fi | ||
40 | } | ||
41 | TEST_TLD="testtld" | ||
42 | |||
43 | gnunet-arm -s -c test_gns_lookup.conf | ||
44 | |||
45 | curl_get "$gns_link/www.$TEST_TLD" "error" | ||
46 | |||
47 | gnunet-identity -C "$TEST_TLD" -c test_gns_lookup.conf | ||
48 | sleep 0.5 | ||
49 | curl_get "$gns_link/www.$TEST_TLD" "\[\]" | ||
50 | |||
51 | gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf | ||
52 | |||
53 | curl_get "$gns_link/www.$TEST_TLD" "1.1.1.1" | ||
54 | |||
55 | gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1::1 -t AAAA -c test_gns_lookup.conf | ||
56 | |||
57 | curl_get "$gns_link/www.$TEST_TLD" "1::1.*1.1.1.1" | ||
58 | |||
59 | gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.2 -t A -c test_gns_lookup.conf | ||
60 | |||
61 | curl_get "$gns_link/www.$TEST_TLD" "1.1.1.2.*1::1.*1.1.1.1" | ||
62 | curl_get "$gns_link/www.$TEST_TLD?record_type=A" "1.1.1.2.*1.1.1.1" | ||
63 | curl_get "$gns_link/www.$TEST_TLD?record_type=AAAA" "1::1" | ||
64 | curl_get "$gns_link/www.$TEST_TLD?record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1" | ||
65 | |||
66 | gnunet-namestore -z "$TEST_TLD" -p -a -n www1 -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf | ||
67 | curl_get "$gns_link/www1.$TEST_TLD" "1.1.1.1" | ||
68 | |||
69 | gnunet-namestore -z "$TEST_TLD" -d -n www1 -c test_gns_lookup.conf | ||
70 | gnunet-namestore -z "$TEST_TLD" -d -n www -c test_gns_lookup.conf | ||
71 | |||
72 | gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1 | ||
73 | |||
74 | curl_get "$gns_link/www1.$TEST_TLD" "error" | ||
75 | gnunet-arm -e -c test_gns_lookup.conf | ||
76 | exit 0 | ||
diff --git a/src/rest-plugin/identity/Makefile.am b/src/rest-plugin/identity/Makefile.am deleted file mode 100644 index bcad0c2dd..000000000 --- a/src/rest-plugin/identity/Makefile.am +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | if USE_COVERAGE | ||
7 | AM_CFLAGS = --coverage -O0 | ||
8 | XLIB = -lgcov | ||
9 | endif | ||
10 | |||
11 | plugin_LTLIBRARIES = libgnunet_plugin_rest_identity.la | ||
12 | |||
13 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
14 | |||
15 | libexecdir= $(pkglibdir)/libexec/ | ||
16 | |||
17 | libgnunet_plugin_rest_identity_la_SOURCES = \ | ||
18 | plugin_rest_identity.c | ||
19 | libgnunet_plugin_rest_identity_la_LIBADD = \ | ||
20 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
21 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
22 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
23 | $(LTLIBINTL) -ljansson $(MHD_LIBS) | ||
24 | libgnunet_plugin_rest_identity_la_LDFLAGS = \ | ||
25 | $(GN_PLUGIN_LDFLAGS) | ||
26 | libgnunet_plugin_rest_identity_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
diff --git a/src/rest-plugin/identity/meson.build b/src/rest-plugin/identity/meson.build deleted file mode 100644 index f459918db..000000000 --- a/src/rest-plugin/identity/meson.build +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | shared_module('gnunet_plugin_rest_identity', | ||
2 | ['plugin_rest_identity.c'], | ||
3 | dependencies: [libgnunetrest_dep, | ||
4 | libgnunetidentity_dep, | ||
5 | libgnunetutil_dep, | ||
6 | json_dep, | ||
7 | mhd_dep], | ||
8 | include_directories: [incdir, configuration_inc], | ||
9 | install: true, | ||
10 | install_dir: get_option('libdir') / 'gnunet') | ||
11 | |||
diff --git a/src/rest-plugin/meson.build b/src/rest-plugin/meson.build deleted file mode 100644 index 31d49864e..000000000 --- a/src/rest-plugin/meson.build +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | if get_option('monolith') == false | ||
2 | subdir('rest') | ||
3 | endif | ||
4 | subdir('identity') | ||
5 | subdir('gns') | ||
6 | subdir('reclaim') | ||
diff --git a/src/rest-plugin/reclaim/Makefile.am b/src/rest-plugin/reclaim/Makefile.am deleted file mode 100644 index 7bc305bef..000000000 --- a/src/rest-plugin/reclaim/Makefile.am +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | if USE_COVERAGE | ||
7 | AM_CFLAGS = --coverage -O0 | ||
8 | XLIB = -lgcov | ||
9 | endif | ||
10 | |||
11 | |||
12 | REST_PLUGIN = \ | ||
13 | libgnunet_plugin_rest_reclaim.la | ||
14 | |||
15 | if HAVE_JOSE | ||
16 | REST_PLUGIN += libgnunet_plugin_rest_openid_connect.la | ||
17 | endif | ||
18 | |||
19 | if HAVE_PABC | ||
20 | REST_PLUGIN += libgnunet_plugin_rest_pabc.la | ||
21 | endif | ||
22 | |||
23 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
24 | |||
25 | libexecdir= $(pkglibdir)/libexec/ | ||
26 | |||
27 | plugin_LTLIBRARIES = \ | ||
28 | $(REST_PLUGIN) | ||
29 | |||
30 | libgnunet_plugin_rest_reclaim_la_SOURCES = \ | ||
31 | plugin_rest_reclaim.c \ | ||
32 | json_reclaim.h \ | ||
33 | json_reclaim.c | ||
34 | libgnunet_plugin_rest_reclaim_la_LIBADD = \ | ||
35 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
36 | $(top_builddir)/src/service/reclaim/libgnunetreclaim.la \ | ||
37 | $(top_builddir)/src/lib/json/libgnunetjson.la \ | ||
38 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | ||
39 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
40 | $(top_builddir)/src/service/namestore/libgnunetnamestore.la \ | ||
41 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
42 | $(LTLIBINTL) -ljansson $(MHD_LIBS) | ||
43 | libgnunet_plugin_rest_reclaim_la_LDFLAGS = \ | ||
44 | $(GN_PLUGIN_LDFLAGS) | ||
45 | libgnunet_plugin_rest_reclaim_la_CFLAGS = \ | ||
46 | $(MHD_CFLAGS) $(AM_CFLAGS) | ||
47 | |||
48 | if HAVE_JOSE | ||
49 | libgnunet_plugin_rest_openid_connect_la_SOURCES = \ | ||
50 | plugin_rest_openid_connect.c \ | ||
51 | oidc_helper.h \ | ||
52 | oidc_helper.c | ||
53 | libgnunet_plugin_rest_openid_connect_la_LIBADD = \ | ||
54 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
55 | $(top_builddir)/src/service/reclaim/libgnunetreclaim.la \ | ||
56 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
57 | $(top_builddir)/src/service/namestore/libgnunetnamestore.la \ | ||
58 | $(top_builddir)/src/service/gns/libgnunetgns.la \ | ||
59 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | ||
60 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
61 | $(LTLIBINTL) -ljansson -ljose $(MHD_LIBS) \ | ||
62 | $(LIBGCRYPT_LIBS) | ||
63 | libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \ | ||
64 | $(GN_PLUGIN_LDFLAGS) | ||
65 | libgnunet_plugin_rest_openid_connect_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
66 | endif | ||
67 | |||
68 | if HAVE_PABC | ||
69 | libgnunet_plugin_rest_pabc_la_SOURCES = \ | ||
70 | plugin_rest_pabc.c \ | ||
71 | $(top_builddir)/src/plugin/reclaim/pabc_helper.c | ||
72 | libgnunet_plugin_rest_pabc_la_LIBADD = \ | ||
73 | $(top_builddir)/src/service/reclaim/libgnunetreclaim.la \ | ||
74 | $(top_builddir)/src/lib/json/libgnunetjson.la \ | ||
75 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
76 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
77 | $(LTLIBINTL) -ljansson -lpabc $(MHD_LIBS) | ||
78 | libgnunet_plugin_rest_pabc_la_LDFLAGS = \ | ||
79 | $(GN_PLUGIN_LDFLAGS) | ||
80 | libgnunet_plugin_rest_pabc_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
81 | endif | ||
diff --git a/src/rest-plugin/reclaim/meson.build b/src/rest-plugin/reclaim/meson.build deleted file mode 100644 index da4406850..000000000 --- a/src/rest-plugin/reclaim/meson.build +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | shared_module('gnunet_plugin_rest_reclaim', | ||
2 | ['plugin_rest_reclaim.c', 'json_reclaim.c'], | ||
3 | dependencies: [libgnunetrest_dep, | ||
4 | libgnunetidentity_dep, | ||
5 | libgnunetreclaim_dep, | ||
6 | libgnunetjson_dep, | ||
7 | libgnunetutil_dep, | ||
8 | json_dep, | ||
9 | mhd_dep], | ||
10 | include_directories: [incdir, configuration_inc], | ||
11 | install: true, | ||
12 | install_dir: get_option('libdir') / 'gnunet') | ||
13 | |||
14 | shared_module('gnunet_plugin_rest_openid_connect', | ||
15 | ['plugin_rest_openid_connect.c', 'oidc_helper.c'], | ||
16 | dependencies: [libgnunetrest_dep, | ||
17 | libgnunetreclaim_dep, | ||
18 | libgnunetidentity_dep, | ||
19 | libgnunetgns_dep, | ||
20 | libgnunetutil_dep, | ||
21 | jose_dep, | ||
22 | gcrypt_dep, | ||
23 | json_dep, | ||
24 | mhd_dep], | ||
25 | include_directories: [incdir, configuration_inc], | ||
26 | install: true, | ||
27 | install_dir: get_option('libdir') / 'gnunet') | ||
28 | |||
29 | |||
diff --git a/src/rest-plugin/rest/Makefile.am b/src/rest-plugin/rest/Makefile.am deleted file mode 100644 index 4f7f834fb..000000000 --- a/src/rest-plugin/rest/Makefile.am +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | if USE_COVERAGE | ||
11 | AM_CFLAGS = --coverage -O0 | ||
12 | XLIBS = -lgcov | ||
13 | endif | ||
14 | |||
15 | plugin_LTLIBRARIES = \ | ||
16 | libgnunet_plugin_rest_copying.la \ | ||
17 | libgnunet_plugin_rest_config.la | ||
18 | |||
19 | libgnunet_plugin_rest_copying_la_SOURCES = \ | ||
20 | plugin_rest_copying.c | ||
21 | libgnunet_plugin_rest_copying_la_LIBADD = \ | ||
22 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
23 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
24 | $(LTLIBINTL) $(MHD_LIBS) | ||
25 | libgnunet_plugin_rest_copying_la_LDFLAGS = \ | ||
26 | $(GN_PLUGIN_LDFLAGS) | ||
27 | libgnunet_plugin_rest_copying_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
28 | |||
29 | libgnunet_plugin_rest_config_la_SOURCES = \ | ||
30 | plugin_rest_config.c | ||
31 | libgnunet_plugin_rest_config_la_LIBADD = \ | ||
32 | $(top_builddir)/src/service/rest/libgnunetrest.la \ | ||
33 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
34 | $(LTLIBINTL) $(MHD_LIBS) -ljansson | ||
35 | libgnunet_plugin_rest_config_la_LDFLAGS = \ | ||
36 | $(GN_PLUGIN_LDFLAGS) | ||
37 | libgnunet_plugin_rest_config_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
diff --git a/src/rest-plugin/rest/meson.build b/src/rest-plugin/rest/meson.build deleted file mode 100644 index 0c7219327..000000000 --- a/src/rest-plugin/rest/meson.build +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | shared_module('gnunet_plugin_rest_config', | ||
2 | ['plugin_rest_config.c'], | ||
3 | dependencies: [libgnunetrest_dep, | ||
4 | libgnunetutil_dep, | ||
5 | json_dep, | ||
6 | mhd_dep], | ||
7 | include_directories: [incdir, configuration_inc], | ||
8 | install: true, | ||
9 | install_dir: get_option('libdir') / 'gnunet') | ||
10 | shared_module('gnunet_plugin_rest_copying', | ||
11 | ['plugin_rest_copying.c'], | ||
12 | dependencies: [libgnunetrest_dep, | ||
13 | libgnunetutil_dep, | ||
14 | json_dep, | ||
15 | mhd_dep], | ||
16 | include_directories: [incdir, configuration_inc], | ||
17 | install: true, | ||
18 | install_dir: get_option('libdir') / 'gnunet') | ||
diff --git a/src/service/Makefile.am b/src/service/Makefile.am index 8e661e432..041442725 100644 --- a/src/service/Makefile.am +++ b/src/service/Makefile.am | |||
@@ -13,9 +13,9 @@ SUBDIRS = \ | |||
13 | topology \ | 13 | topology \ |
14 | dns \ | 14 | dns \ |
15 | identity \ | 15 | identity \ |
16 | rest \ | ||
17 | datacache \ | 16 | datacache \ |
18 | datastore \ | 17 | datastore \ |
18 | dhtu \ | ||
19 | dht \ | 19 | dht \ |
20 | namecache \ | 20 | namecache \ |
21 | namestore \ | 21 | namestore \ |
@@ -31,5 +31,6 @@ SUBDIRS = \ | |||
31 | exit \ | 31 | exit \ |
32 | pt \ | 32 | pt \ |
33 | reclaim \ | 33 | reclaim \ |
34 | messenger | 34 | messenger \ |
35 | rest | ||
35 | 36 | ||
diff --git a/src/service/datacache/Makefile.am b/src/service/datacache/Makefile.am index 9caeac543..022b45253 100644 --- a/src/service/datacache/Makefile.am +++ b/src/service/datacache/Makefile.am | |||
@@ -8,25 +8,11 @@ pkgcfgdir= $(pkgdatadir)/config.d/ | |||
8 | dist_pkgcfg_DATA = \ | 8 | dist_pkgcfg_DATA = \ |
9 | datacache.conf | 9 | datacache.conf |
10 | 10 | ||
11 | sqldir = $(prefix)/share/gnunet/sql/ | ||
12 | |||
13 | sql_DATA = \ | ||
14 | datacache-0001.sql \ | ||
15 | datacache-drop.sql | ||
16 | |||
17 | |||
18 | if USE_COVERAGE | 11 | if USE_COVERAGE |
19 | AM_CFLAGS = --coverage -O0 | 12 | AM_CFLAGS = --coverage -O0 |
20 | XLIBS = -lgcov | 13 | XLIBS = -lgcov |
21 | endif | 14 | endif |
22 | 15 | ||
23 | if HAVE_SQLITE | ||
24 | SQLITE_PLUGIN = libgnunet_plugin_datacache_sqlite.la | ||
25 | endif | ||
26 | if HAVE_POSTGRESQL | ||
27 | POSTGRES_PLUGIN = libgnunet_plugin_datacache_postgres.la | ||
28 | endif | ||
29 | |||
30 | lib_LTLIBRARIES = \ | 16 | lib_LTLIBRARIES = \ |
31 | libgnunetdatacache.la | 17 | libgnunetdatacache.la |
32 | 18 | ||
@@ -41,57 +27,6 @@ libgnunetdatacache_la_LDFLAGS = \ | |||
41 | -version-info 0:1:0 | 27 | -version-info 0:1:0 |
42 | 28 | ||
43 | 29 | ||
44 | plugin_LTLIBRARIES = \ | ||
45 | $(SQLITE_PLUGIN) \ | ||
46 | $(POSTGRES_PLUGIN) \ | ||
47 | libgnunet_plugin_datacache_heap.la | ||
48 | |||
49 | # Real plugins should of course go into | ||
50 | # plugin_LTLIBRARIES | ||
51 | noinst_LTLIBRARIES = \ | ||
52 | libgnunet_plugin_datacache_template.la | ||
53 | |||
54 | |||
55 | libgnunet_plugin_datacache_sqlite_la_SOURCES = \ | ||
56 | plugin_datacache_sqlite.c | ||
57 | libgnunet_plugin_datacache_sqlite_la_LIBADD = \ | ||
58 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
59 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | ||
60 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | ||
61 | $(LTLIBINTL) | ||
62 | libgnunet_plugin_datacache_sqlite_la_LDFLAGS = \ | ||
63 | $(GN_PLUGIN_LDFLAGS) | ||
64 | |||
65 | libgnunet_plugin_datacache_heap_la_SOURCES = \ | ||
66 | plugin_datacache_heap.c | ||
67 | libgnunet_plugin_datacache_heap_la_LIBADD = \ | ||
68 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
69 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
70 | $(LTLIBINTL) | ||
71 | libgnunet_plugin_datacache_heap_la_LDFLAGS = \ | ||
72 | $(GN_PLUGIN_LDFLAGS) | ||
73 | |||
74 | libgnunet_plugin_datacache_postgres_la_SOURCES = \ | ||
75 | plugin_datacache_postgres.c | ||
76 | libgnunet_plugin_datacache_postgres_la_LIBADD = \ | ||
77 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ | ||
78 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
79 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
80 | $(GN_PLUGIN_LDFLAGS) -lpq | ||
81 | libgnunet_plugin_datacache_postgres_la_CPPFLAGS = \ | ||
82 | $(POSTGRESQL_CPPFLAGS) $(AM_CPPFLAGS) | ||
83 | libgnunet_plugin_datacache_postgres_la_LDFLAGS = \ | ||
84 | $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS) | ||
85 | |||
86 | libgnunet_plugin_datacache_template_la_SOURCES = \ | ||
87 | plugin_datacache_template.c | ||
88 | libgnunet_plugin_datacache_template_la_LIBADD = \ | ||
89 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
90 | $(LTLIBINTL) | ||
91 | libgnunet_plugin_datacache_template_la_LDFLAGS = \ | ||
92 | $(GN_PLUGIN_LDFLAGS) | ||
93 | |||
94 | |||
95 | if HAVE_SQLITE | 30 | if HAVE_SQLITE |
96 | SQLITE_TESTS = \ | 31 | SQLITE_TESTS = \ |
97 | test_datacache_sqlite \ | 32 | test_datacache_sqlite \ |
@@ -166,5 +101,4 @@ test_datacache_quota_postgres_LDADD = \ | |||
166 | EXTRA_DIST = \ | 101 | EXTRA_DIST = \ |
167 | test_datacache_data_sqlite.conf \ | 102 | test_datacache_data_sqlite.conf \ |
168 | test_datacache_data_heap.conf \ | 103 | test_datacache_data_heap.conf \ |
169 | test_datacache_data_postgres.conf \ | 104 | test_datacache_data_postgres.conf |
170 | $(sql_DATA) | ||
diff --git a/src/service/datacache/meson.build b/src/service/datacache/meson.build index 528885c0d..f50036c03 100644 --- a/src/service/datacache/meson.build +++ b/src/service/datacache/meson.build | |||
@@ -5,9 +5,6 @@ configure_file(input : 'datacache.conf', | |||
5 | configuration : cdata, | 5 | configuration : cdata, |
6 | install: true, | 6 | install: true, |
7 | install_dir: pkgcfgdir) | 7 | install_dir: pkgcfgdir) |
8 | install_data ('datacache-0001.sql', | ||
9 | 'datacache-drop.sql', | ||
10 | install_dir: get_option('datadir')/'gnunet'/'sql') | ||
11 | 8 | ||
12 | if get_option('monolith') | 9 | if get_option('monolith') |
13 | foreach p : libgnunetdatacache_src | 10 | foreach p : libgnunetdatacache_src |
@@ -27,36 +24,6 @@ libgnunetdatacache_dep = declare_dependency(link_with : libgnunetdatacache) | |||
27 | pkg.generate(libgnunetdatacache, url: 'https://www.gnunet.org', | 24 | pkg.generate(libgnunetdatacache, url: 'https://www.gnunet.org', |
28 | description : 'Provides datacache API for temporary storage to disk') | 25 | description : 'Provides datacache API for temporary storage to disk') |
29 | 26 | ||
30 | shared_module('gnunet_plugin_datacache_sqlite', | ||
31 | ['plugin_datacache_sqlite.c'], | ||
32 | dependencies: [libgnunetutil_dep, | ||
33 | libgnunetdatacache_dep, | ||
34 | sqlite_dep, | ||
35 | libgnunetsq_dep], | ||
36 | include_directories: [incdir, configuration_inc], | ||
37 | install: true, | ||
38 | install_dir: get_option('libdir')/'gnunet') | ||
39 | |||
40 | shared_module('gnunet_plugin_datacache_heap', | ||
41 | ['plugin_datacache_heap.c'], | ||
42 | dependencies: [libgnunetutil_dep, | ||
43 | libgnunetdatacache_dep], | ||
44 | include_directories: [incdir, configuration_inc], | ||
45 | install: true, | ||
46 | install_dir: get_option('libdir')/'gnunet') | ||
47 | |||
48 | if pq_dep.found() | ||
49 | shared_module('gnunet_plugin_datacache_postgres', | ||
50 | ['plugin_datacache_postgres.c'], | ||
51 | dependencies: [libgnunetutil_dep, | ||
52 | libgnunetdatacache_dep, | ||
53 | pq_dep, | ||
54 | libgnunetpq_dep], | ||
55 | include_directories: [incdir, configuration_inc], | ||
56 | install: true, | ||
57 | install_dir: get_option('libdir')/'gnunet') | ||
58 | endif | ||
59 | |||
60 | testdc_sqlite = executable ('test_datacache_sqlite', | 27 | testdc_sqlite = executable ('test_datacache_sqlite', |
61 | ['test_datacache.c'], | 28 | ['test_datacache.c'], |
62 | dependencies: [ | 29 | dependencies: [ |
diff --git a/src/service/datastore/Makefile.am b/src/service/datastore/Makefile.am index 9ae5004c6..22f98482a 100644 --- a/src/service/datastore/Makefile.am +++ b/src/service/datastore/Makefile.am | |||
@@ -10,12 +10,6 @@ libexecdir= $(pkglibdir)/libexec/ | |||
10 | pkgcfg_DATA = \ | 10 | pkgcfg_DATA = \ |
11 | datastore.conf | 11 | datastore.conf |
12 | 12 | ||
13 | sqldir = $(prefix)/share/gnunet/sql/ | ||
14 | |||
15 | sql_DATA = \ | ||
16 | datastore-0001.sql \ | ||
17 | datastore-drop.sql | ||
18 | |||
19 | if USE_COVERAGE | 13 | if USE_COVERAGE |
20 | AM_CFLAGS = --coverage -O0 | 14 | AM_CFLAGS = --coverage -O0 |
21 | XLIBS = -lgcov | 15 | XLIBS = -lgcov |
@@ -46,89 +40,30 @@ gnunet_service_datastore_LDADD = \ | |||
46 | $(GN_LIBINTL) | 40 | $(GN_LIBINTL) |
47 | 41 | ||
48 | if HAVE_SQLITE | 42 | if HAVE_SQLITE |
49 | SQLITE_PLUGIN = libgnunet_plugin_datastore_sqlite.la | ||
50 | if HAVE_BENCHMARKS | 43 | if HAVE_BENCHMARKS |
51 | SQLITE_BENCHMARKS = \ | 44 | SQLITE_BENCHMARKS = \ |
52 | perf_datastore_api_sqlite \ | 45 | perf_datastore_api_sqlite |
53 | perf_plugin_datastore_sqlite | ||
54 | endif | 46 | endif |
55 | SQLITE_TESTS = \ | 47 | SQLITE_TESTS = \ |
56 | test_datastore_api_sqlite \ | 48 | test_datastore_api_sqlite \ |
57 | test_datastore_api_management_sqlite \ | 49 | test_datastore_api_management_sqlite \ |
58 | test_plugin_datastore_sqlite \ | ||
59 | $(SQLITE_BENCHMARKS) | 50 | $(SQLITE_BENCHMARKS) |
60 | endif | 51 | endif |
61 | if HAVE_POSTGRESQL | 52 | if HAVE_POSTGRESQL |
62 | POSTGRES_PLUGIN = libgnunet_plugin_datastore_postgres.la | ||
63 | if HAVE_BENCHMARKS | 53 | if HAVE_BENCHMARKS |
64 | POSTGRES_BENCHMARKS = \ | 54 | POSTGRES_BENCHMARKS = \ |
65 | perf_datastore_api_postgres \ | 55 | perf_datastore_api_postgres |
66 | perf_plugin_datastore_postgres | ||
67 | endif | 56 | endif |
68 | POSTGRES_TESTS = \ | 57 | POSTGRES_TESTS = \ |
69 | test_datastore_api_postgres \ | 58 | test_datastore_api_postgres \ |
70 | test_datastore_api_management_postgres \ | 59 | test_datastore_api_management_postgres \ |
71 | test_plugin_datastore_postgres \ | ||
72 | $(POSTGRES_BENCHMARKS) | 60 | $(POSTGRES_BENCHMARKS) |
73 | endif | 61 | endif |
74 | 62 | ||
75 | plugin_LTLIBRARIES = \ | ||
76 | $(SQLITE_PLUGIN) \ | ||
77 | $(POSTGRES_PLUGIN) \ | ||
78 | libgnunet_plugin_datastore_heap.la | ||
79 | |||
80 | # Real plugins should of course go into | ||
81 | # plugin_LTLIBRARIES | ||
82 | noinst_LTLIBRARIES = \ | ||
83 | libgnunet_plugin_datastore_template.la | ||
84 | |||
85 | |||
86 | libgnunet_plugin_datastore_sqlite_la_SOURCES = \ | ||
87 | plugin_datastore_sqlite.c | ||
88 | libgnunet_plugin_datastore_sqlite_la_LIBADD = \ | ||
89 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | ||
90 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
91 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | ||
92 | $(LTLIBINTL) | ||
93 | libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \ | ||
94 | $(GN_PLUGIN_LDFLAGS) | ||
95 | |||
96 | |||
97 | libgnunet_plugin_datastore_heap_la_SOURCES = \ | ||
98 | plugin_datastore_heap.c | ||
99 | libgnunet_plugin_datastore_heap_la_LIBADD = \ | ||
100 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
101 | $(LTLIBINTL) | ||
102 | libgnunet_plugin_datastore_heap_la_LDFLAGS = \ | ||
103 | $(GN_PLUGIN_LDFLAGS) | ||
104 | |||
105 | |||
106 | libgnunet_plugin_datastore_postgres_la_SOURCES = \ | ||
107 | plugin_datastore_postgres.c | ||
108 | libgnunet_plugin_datastore_postgres_la_LIBADD = \ | ||
109 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | ||
110 | $(top_builddir)/src/lib/pq/libgnunetpq.la \ | ||
111 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) -lpq | ||
112 | libgnunet_plugin_datastore_postgres_la_LDFLAGS = \ | ||
113 | $(GN_PLUGIN_LDFLAGS) $(POSTGRESQL_LDFLAGS) | ||
114 | libgnunet_plugin_datastore_postgres_la_CPPFLAGS = \ | ||
115 | $(POSTGRESQL_CPPFLAGS) $(AM_CPPFLAGS) | ||
116 | |||
117 | |||
118 | libgnunet_plugin_datastore_template_la_SOURCES = \ | ||
119 | plugin_datastore_template.c | ||
120 | libgnunet_plugin_datastore_template_la_LIBADD = \ | ||
121 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
122 | $(LTLIBINTL) | ||
123 | libgnunet_plugin_datastore_template_la_LDFLAGS = \ | ||
124 | $(GN_PLUGIN_LDFLAGS) | ||
125 | |||
126 | check_PROGRAMS = \ | 63 | check_PROGRAMS = \ |
127 | test_datastore_api_heap \ | 64 | test_datastore_api_heap \ |
128 | test_datastore_api_management_heap \ | 65 | test_datastore_api_management_heap \ |
129 | perf_datastore_api_heap \ | 66 | perf_datastore_api_heap \ |
130 | perf_plugin_datastore_heap \ | ||
131 | test_plugin_datastore_heap \ | ||
132 | $(SQLITE_TESTS) \ | 67 | $(SQLITE_TESTS) \ |
133 | $(POSTGRES_TESTS) | 68 | $(POSTGRES_TESTS) |
134 | 69 | ||
@@ -158,19 +93,6 @@ perf_datastore_api_heap_LDADD = \ | |||
158 | libgnunetdatastore.la \ | 93 | libgnunetdatastore.la \ |
159 | $(top_builddir)/src/lib/util/libgnunetutil.la | 94 | $(top_builddir)/src/lib/util/libgnunetutil.la |
160 | 95 | ||
161 | perf_plugin_datastore_heap_SOURCES = \ | ||
162 | perf_plugin_datastore.c | ||
163 | perf_plugin_datastore_heap_LDADD = \ | ||
164 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
165 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
166 | |||
167 | test_plugin_datastore_heap_SOURCES = \ | ||
168 | test_plugin_datastore.c | ||
169 | test_plugin_datastore_heap_LDADD = \ | ||
170 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
171 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
172 | |||
173 | |||
174 | test_datastore_api_sqlite_SOURCES = \ | 96 | test_datastore_api_sqlite_SOURCES = \ |
175 | test_datastore_api.c | 97 | test_datastore_api.c |
176 | test_datastore_api_sqlite_LDADD = \ | 98 | test_datastore_api_sqlite_LDADD = \ |
@@ -192,19 +114,6 @@ perf_datastore_api_sqlite_LDADD = \ | |||
192 | libgnunetdatastore.la \ | 114 | libgnunetdatastore.la \ |
193 | $(top_builddir)/src/lib/util/libgnunetutil.la | 115 | $(top_builddir)/src/lib/util/libgnunetutil.la |
194 | 116 | ||
195 | perf_plugin_datastore_sqlite_SOURCES = \ | ||
196 | perf_plugin_datastore.c | ||
197 | perf_plugin_datastore_sqlite_LDADD = \ | ||
198 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
199 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
200 | |||
201 | test_plugin_datastore_sqlite_SOURCES = \ | ||
202 | test_plugin_datastore.c | ||
203 | test_plugin_datastore_sqlite_LDADD = \ | ||
204 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
205 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
206 | |||
207 | |||
208 | test_datastore_api_postgres_SOURCES = \ | 117 | test_datastore_api_postgres_SOURCES = \ |
209 | test_datastore_api.c | 118 | test_datastore_api.c |
210 | test_datastore_api_postgres_LDADD = \ | 119 | test_datastore_api_postgres_LDADD = \ |
@@ -226,28 +135,8 @@ perf_datastore_api_postgres_LDADD = \ | |||
226 | libgnunetdatastore.la \ | 135 | libgnunetdatastore.la \ |
227 | $(top_builddir)/src/lib/util/libgnunetutil.la | 136 | $(top_builddir)/src/lib/util/libgnunetutil.la |
228 | 137 | ||
229 | test_plugin_datastore_postgres_SOURCES = \ | ||
230 | test_plugin_datastore.c | ||
231 | test_plugin_datastore_postgres_LDADD = \ | ||
232 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
233 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
234 | |||
235 | perf_plugin_datastore_postgres_SOURCES = \ | ||
236 | perf_plugin_datastore.c | ||
237 | perf_plugin_datastore_postgres_LDADD = \ | ||
238 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
239 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
240 | |||
241 | |||
242 | EXTRA_DIST = \ | 138 | EXTRA_DIST = \ |
243 | test_defaults.conf \ | 139 | test_defaults.conf \ |
244 | test_datastore_api_data_sqlite.conf \ | 140 | test_datastore_api_data_sqlite.conf \ |
245 | perf_plugin_datastore_data_sqlite.conf \ | ||
246 | test_plugin_datastore_data_sqlite.conf \ | ||
247 | test_datastore_api_data_heap.conf \ | 141 | test_datastore_api_data_heap.conf \ |
248 | perf_plugin_datastore_data_heap.conf \ | 142 | test_datastore_api_data_postgres.conf |
249 | test_plugin_datastore_data_heap.conf \ | ||
250 | test_datastore_api_data_postgres.conf \ | ||
251 | perf_plugin_datastore_data_postgres.conf \ | ||
252 | test_plugin_datastore_data_postgres.conf \ | ||
253 | $(sql_DATA) | ||
diff --git a/src/service/datastore/meson.build b/src/service/datastore/meson.build index 9dde488a0..b81d8bb86 100644 --- a/src/service/datastore/meson.build +++ b/src/service/datastore/meson.build | |||
@@ -8,10 +8,6 @@ configure_file(input : 'datastore.conf.in', | |||
8 | install: true, | 8 | install: true, |
9 | install_dir: pkgcfgdir) | 9 | install_dir: pkgcfgdir) |
10 | 10 | ||
11 | install_data ('datastore-0001.sql', | ||
12 | 'datastore-drop.sql', | ||
13 | install_dir: get_option('datadir')/'gnunet'/'sql') | ||
14 | |||
15 | if get_option('monolith') | 11 | if get_option('monolith') |
16 | foreach p : libgnunetdatastore_src + gnunetservicedatastore_src | 12 | foreach p : libgnunetdatastore_src + gnunetservicedatastore_src |
17 | gnunet_src += 'datastore/' + p | 13 | gnunet_src += 'datastore/' + p |
@@ -32,36 +28,6 @@ libgnunetdatastore_dep = declare_dependency(link_with : libgnunetdatastore) | |||
32 | pkg.generate(libgnunetdatastore, url: 'https://www.gnunet.org', | 28 | pkg.generate(libgnunetdatastore, url: 'https://www.gnunet.org', |
33 | description : 'Management API for the datastore for persistent storage to disk') | 29 | description : 'Management API for the datastore for persistent storage to disk') |
34 | 30 | ||
35 | shared_module('gnunet_plugin_datastore_sqlite', | ||
36 | ['plugin_datastore_sqlite.c'], | ||
37 | dependencies: [libgnunetutil_dep, | ||
38 | libgnunetdatastore_dep, | ||
39 | sqlite_dep, | ||
40 | libgnunetsq_dep], | ||
41 | include_directories: [incdir, configuration_inc], | ||
42 | install: true, | ||
43 | install_dir: get_option('libdir')/'gnunet') | ||
44 | |||
45 | shared_module('gnunet_plugin_datastore_heap', | ||
46 | ['plugin_datastore_heap.c'], | ||
47 | dependencies: [libgnunetutil_dep, | ||
48 | libgnunetdatacache_dep], | ||
49 | include_directories: [incdir, configuration_inc], | ||
50 | install: true, | ||
51 | install_dir: get_option('libdir')/'gnunet') | ||
52 | |||
53 | if pq_dep.found() | ||
54 | shared_module('gnunet_plugin_datastore_postgres', | ||
55 | ['plugin_datastore_postgres.c'], | ||
56 | dependencies: [libgnunetutil_dep, | ||
57 | libgnunetdatastore_dep, | ||
58 | pq_dep, | ||
59 | libgnunetpq_dep], | ||
60 | include_directories: [incdir, configuration_inc], | ||
61 | install: true, | ||
62 | install_dir: get_option('libdir')/'gnunet') | ||
63 | endif | ||
64 | |||
65 | executable ('gnunet-service-datastore', | 31 | executable ('gnunet-service-datastore', |
66 | gnunetservicedatastore_src, | 32 | gnunetservicedatastore_src, |
67 | dependencies: [libgnunetdatastore_dep, | 33 | dependencies: [libgnunetdatastore_dep, |
@@ -92,16 +58,6 @@ testds_mgmt_sqlite = executable ('test_datastore_api_management_sqlite', | |||
92 | include_directories: [incdir, configuration_inc], | 58 | include_directories: [incdir, configuration_inc], |
93 | install: false) | 59 | install: false) |
94 | 60 | ||
95 | testds_plugin_sqlite = executable ('test_plugin_datastore_sqlite', | ||
96 | ['test_plugin_datastore.c'], | ||
97 | dependencies: [ | ||
98 | libgnunetdatastore_dep, | ||
99 | libgnunetutil_dep, | ||
100 | libgnunettesting_dep | ||
101 | ], | ||
102 | include_directories: [incdir, configuration_inc], | ||
103 | install: false) | ||
104 | |||
105 | testds_heap = executable ('test_datastore_api_heap', | 61 | testds_heap = executable ('test_datastore_api_heap', |
106 | ['test_datastore_api.c'], | 62 | ['test_datastore_api.c'], |
107 | dependencies: [ | 63 | dependencies: [ |
@@ -122,16 +78,6 @@ testds_mgmt_heap = executable ('test_datastore_api_management_heap', | |||
122 | include_directories: [incdir, configuration_inc], | 78 | include_directories: [incdir, configuration_inc], |
123 | install: false) | 79 | install: false) |
124 | 80 | ||
125 | testds_plugin_heap = executable ('test_plugin_datastore_heap', | ||
126 | ['test_plugin_datastore.c'], | ||
127 | dependencies: [ | ||
128 | libgnunetdatastore_dep, | ||
129 | libgnunetutil_dep, | ||
130 | libgnunettesting_dep | ||
131 | ], | ||
132 | include_directories: [incdir, configuration_inc], | ||
133 | install: false) | ||
134 | |||
135 | testds_pq = executable ('test_datastore_api_postgres', | 81 | testds_pq = executable ('test_datastore_api_postgres', |
136 | ['test_datastore_api.c'], | 82 | ['test_datastore_api.c'], |
137 | dependencies: [ | 83 | dependencies: [ |
@@ -142,16 +88,6 @@ testds_pq = executable ('test_datastore_api_postgres', | |||
142 | include_directories: [incdir, configuration_inc], | 88 | include_directories: [incdir, configuration_inc], |
143 | install: false) | 89 | install: false) |
144 | 90 | ||
145 | testds_plugin_pq = executable ('test_plugin_datastore_postgres', | ||
146 | ['test_plugin_datastore.c'], | ||
147 | dependencies: [ | ||
148 | libgnunetdatastore_dep, | ||
149 | libgnunetutil_dep, | ||
150 | libgnunettesting_dep | ||
151 | ], | ||
152 | include_directories: [incdir, configuration_inc], | ||
153 | install: false) | ||
154 | |||
155 | testds_mgmt_pq = executable ('test_datastore_api_management_postgres', | 91 | testds_mgmt_pq = executable ('test_datastore_api_management_postgres', |
156 | ['test_datastore_api_management.c'], | 92 | ['test_datastore_api_management.c'], |
157 | dependencies: [ | 93 | dependencies: [ |
@@ -179,18 +115,12 @@ test('test_datastore_api_sqlite', testds_sqlite, | |||
179 | suite: 'datastore', workdir: meson.current_build_dir()) | 115 | suite: 'datastore', workdir: meson.current_build_dir()) |
180 | test('test_datastore_api_management_sqlite', testds_mgmt_sqlite, | 116 | test('test_datastore_api_management_sqlite', testds_mgmt_sqlite, |
181 | suite: 'datastore', workdir: meson.current_build_dir()) | 117 | suite: 'datastore', workdir: meson.current_build_dir()) |
182 | test('test_plugin_datastore_sqlite', testds_plugin_sqlite, | ||
183 | suite: 'datastore', workdir: meson.current_build_dir()) | ||
184 | test('test_datastore_api_heap', testds_heap, | 118 | test('test_datastore_api_heap', testds_heap, |
185 | suite: 'datastore', workdir: meson.current_build_dir()) | 119 | suite: 'datastore', workdir: meson.current_build_dir()) |
186 | test('test_datastore_api_management_heap', testds_mgmt_heap, | 120 | test('test_datastore_api_management_heap', testds_mgmt_heap, |
187 | suite: 'datastore', workdir: meson.current_build_dir()) | 121 | suite: 'datastore', workdir: meson.current_build_dir()) |
188 | test('test_plugin_datastore_heap', testds_plugin_heap, | ||
189 | suite: 'datastore', workdir: meson.current_build_dir()) | ||
190 | test('test_datastore_api_postgres', testds_pq, | 122 | test('test_datastore_api_postgres', testds_pq, |
191 | suite: 'datastore', workdir: meson.current_build_dir()) | 123 | suite: 'datastore', workdir: meson.current_build_dir()) |
192 | test('test_datastore_api_management_postgres', testds_mgmt_pq, | 124 | test('test_datastore_api_management_postgres', testds_mgmt_pq, |
193 | suite: 'datastore', workdir: meson.current_build_dir()) | 125 | suite: 'datastore', workdir: meson.current_build_dir()) |
194 | test('test_plugin_datastore_postgres', testds_plugin_pq, | ||
195 | suite: 'datastore', workdir: meson.current_build_dir()) | ||
196 | 126 | ||
diff --git a/src/service/dht/Makefile.am b/src/service/dht/Makefile.am index bf3d26235..53df04faf 100644 --- a/src/service/dht/Makefile.am +++ b/src/service/dht/Makefile.am | |||
@@ -29,21 +29,6 @@ libgnunetdht_la_LDFLAGS = \ | |||
29 | -version-info 4:0:0 | 29 | -version-info 4:0:0 |
30 | 30 | ||
31 | 31 | ||
32 | plugin_LTLIBRARIES = \ | ||
33 | libgnunet_plugin_block_dht.la | ||
34 | |||
35 | libgnunet_plugin_block_dht_la_SOURCES = \ | ||
36 | plugin_block_dht.c | ||
37 | libgnunet_plugin_block_dht_la_LIBADD = \ | ||
38 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | ||
39 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
40 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
41 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
42 | $(LTLIBINTL) | ||
43 | libgnunet_plugin_block_dht_la_LDFLAGS = \ | ||
44 | $(GN_PLUGIN_LDFLAGS) | ||
45 | |||
46 | |||
47 | libexec_PROGRAMS = \ | 32 | libexec_PROGRAMS = \ |
48 | gnunet-service-dht | 33 | gnunet-service-dht |
49 | 34 | ||
diff --git a/src/service/dht/meson.build b/src/service/dht/meson.build index 49ace7e0b..3972a0983 100644 --- a/src/service/dht/meson.build +++ b/src/service/dht/meson.build | |||
@@ -29,16 +29,6 @@ libgnunetdht_dep = declare_dependency(link_with : libgnunetdht) | |||
29 | pkg.generate(libgnunetdht, url: 'https://www.gnunet.org', | 29 | pkg.generate(libgnunetdht, url: 'https://www.gnunet.org', |
30 | description : 'Provides API for the R5N distributed hash table') | 30 | description : 'Provides API for the R5N distributed hash table') |
31 | 31 | ||
32 | shared_module('gnunet_plugin_block_dht', | ||
33 | ['plugin_block_dht.c'], | ||
34 | dependencies: [libgnunetutil_dep, | ||
35 | libgnunethello_dep, | ||
36 | libgnunetblock_dep, | ||
37 | libgnunetblockgroup_dep], | ||
38 | include_directories: [incdir, configuration_inc], | ||
39 | install:true, | ||
40 | install_dir: get_option('libdir')/'gnunet') | ||
41 | |||
42 | executable ('gnunet-service-dht', | 32 | executable ('gnunet-service-dht', |
43 | gnunetservicedht_src, | 33 | gnunetservicedht_src, |
44 | dependencies: [libgnunetdht_dep, libgnunetutil_dep, | 34 | dependencies: [libgnunetdht_dep, libgnunetutil_dep, |
diff --git a/src/plugin/dhtu/.gitignore b/src/service/dhtu/.gitignore index 21f1a7c9b..21f1a7c9b 100644 --- a/src/plugin/dhtu/.gitignore +++ b/src/service/dhtu/.gitignore | |||
diff --git a/src/plugin/dhtu/Makefile.am b/src/service/dhtu/Makefile.am index 500d5a7b1..500d5a7b1 100644 --- a/src/plugin/dhtu/Makefile.am +++ b/src/service/dhtu/Makefile.am | |||
diff --git a/src/plugin/dhtu/dhtu.conf b/src/service/dhtu/dhtu.conf index ea5ade752..ea5ade752 100644 --- a/src/plugin/dhtu/dhtu.conf +++ b/src/service/dhtu/dhtu.conf | |||
diff --git a/src/plugin/dhtu/meson.build b/src/service/dhtu/meson.build index b2525e782..b2525e782 100644 --- a/src/plugin/dhtu/meson.build +++ b/src/service/dhtu/meson.build | |||
diff --git a/src/plugin/dhtu/plugin_dhtu_gnunet.c b/src/service/dhtu/plugin_dhtu_gnunet.c index 75f466916..75f466916 100644 --- a/src/plugin/dhtu/plugin_dhtu_gnunet.c +++ b/src/service/dhtu/plugin_dhtu_gnunet.c | |||
diff --git a/src/plugin/dhtu/plugin_dhtu_ip.c b/src/service/dhtu/plugin_dhtu_ip.c index 06d0f0f60..06d0f0f60 100644 --- a/src/plugin/dhtu/plugin_dhtu_ip.c +++ b/src/service/dhtu/plugin_dhtu_ip.c | |||
diff --git a/src/plugin/dhtu/test_dhtu_ip.c b/src/service/dhtu/test_dhtu_ip.c index 030b17b5f..030b17b5f 100644 --- a/src/plugin/dhtu/test_dhtu_ip.c +++ b/src/service/dhtu/test_dhtu_ip.c | |||
diff --git a/src/plugin/dhtu/testing_dhtu_cmd_send.c b/src/service/dhtu/testing_dhtu_cmd_send.c index 45d166b14..45d166b14 100644 --- a/src/plugin/dhtu/testing_dhtu_cmd_send.c +++ b/src/service/dhtu/testing_dhtu_cmd_send.c | |||
diff --git a/src/service/dns/Makefile.am b/src/service/dns/Makefile.am index 38ee78c3a..0d07b9e5e 100644 --- a/src/service/dns/Makefile.am +++ b/src/service/dns/Makefile.am | |||
@@ -29,9 +29,6 @@ noinst_PROGRAMS = \ | |||
29 | gnunet-dns-redirector \ | 29 | gnunet-dns-redirector \ |
30 | gnunet-zonewalk | 30 | gnunet-zonewalk |
31 | 31 | ||
32 | plugin_LTLIBRARIES = \ | ||
33 | libgnunet_plugin_block_dns.la | ||
34 | |||
35 | if LINUX | 32 | if LINUX |
36 | check_SCRIPTS = \ | 33 | check_SCRIPTS = \ |
37 | test_gnunet_dns.sh | 34 | test_gnunet_dns.sh |
@@ -77,17 +74,6 @@ libgnunetdns_la_LDFLAGS = \ | |||
77 | $(GN_LIB_LDFLAGS) \ | 74 | $(GN_LIB_LDFLAGS) \ |
78 | -version-info 0:0:0 | 75 | -version-info 0:0:0 |
79 | 76 | ||
80 | libgnunet_plugin_block_dns_la_SOURCES = \ | ||
81 | plugin_block_dns.c | ||
82 | libgnunet_plugin_block_dns_la_LIBADD = \ | ||
83 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
84 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
85 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
86 | libgnunet_plugin_block_dns_la_LDFLAGS = \ | ||
87 | $(GN_LIBINTL) \ | ||
88 | $(top_builddir)/src/block/$(GN_PLUGIN_LDFLAGS) | ||
89 | |||
90 | |||
91 | if ENABLE_TEST_RUN | 77 | if ENABLE_TEST_RUN |
92 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 78 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
93 | TESTS = $(check_PROGRAMS) $(check_SCRIPTS) | 79 | TESTS = $(check_PROGRAMS) $(check_SCRIPTS) |
diff --git a/src/service/dns/meson.build b/src/service/dns/meson.build index fe0f6e954..e1b7f7670 100644 --- a/src/service/dns/meson.build +++ b/src/service/dns/meson.build | |||
@@ -1,5 +1,4 @@ | |||
1 | libgnunetdns_src = ['dns_api.c'] | 1 | libgnunetdns_src = ['dns_api.c'] |
2 | libgnunetpluginblockdns_src = ['plugin_block_dns.c'] | ||
3 | 2 | ||
4 | gnunetservicedns_src = ['gnunet-service-dns.c'] | 3 | gnunetservicedns_src = ['gnunet-service-dns.c'] |
5 | gnunetdnsredirector_src = ['gnunet-dns-monitor.c'] | 4 | gnunetdnsredirector_src = ['gnunet-dns-monitor.c'] |
@@ -12,7 +11,7 @@ configure_file(input : 'dns.conf.in', | |||
12 | install_dir: pkgcfgdir) | 11 | install_dir: pkgcfgdir) |
13 | 12 | ||
14 | if get_option('monolith') | 13 | if get_option('monolith') |
15 | foreach p : libgnunetdns_src + gnunetservicedns_src + libgnunetpluginblockdns_src | 14 | foreach p : libgnunetdns_src + gnunetservicedns_src |
16 | gnunet_src += 'dns/' + p | 15 | gnunet_src += 'dns/' + p |
17 | endforeach | 16 | endforeach |
18 | endif | 17 | endif |
@@ -29,13 +28,6 @@ libgnunetdns_dep = declare_dependency(link_with : libgnunetdns) | |||
29 | pkg.generate(libgnunetdns, url: 'https://www.gnunet.org', | 28 | pkg.generate(libgnunetdns, url: 'https://www.gnunet.org', |
30 | description : 'Provides API to access GNUnet\'s DNS service (to intercept and manipulate DNS queries)') | 29 | description : 'Provides API to access GNUnet\'s DNS service (to intercept and manipulate DNS queries)') |
31 | 30 | ||
32 | shared_module('gnunet_plugin_block_dns', | ||
33 | libgnunetpluginblockdns_src, | ||
34 | dependencies: [libgnunetutil_dep, libgnunetblockgroup_dep], | ||
35 | include_directories: [incdir, configuration_inc], | ||
36 | install: true, | ||
37 | install_dir: get_option('libdir')/'gnunet') | ||
38 | |||
39 | executable ('gnunet-service-dns', | 31 | executable ('gnunet-service-dns', |
40 | gnunetservicedns_src, | 32 | gnunetservicedns_src, |
41 | dependencies: [libgnunetdns_dep, libgnunetutil_dep, | 33 | dependencies: [libgnunetdns_dep, libgnunetutil_dep, |
diff --git a/src/service/meson.build b/src/service/meson.build index 6acbc3b10..b089c9794 100644 --- a/src/service/meson.build +++ b/src/service/meson.build | |||
@@ -2,7 +2,6 @@ subdir('util') | |||
2 | subdir('arm') | 2 | subdir('arm') |
3 | subdir('statistics') | 3 | subdir('statistics') |
4 | subdir('testing') | 4 | subdir('testing') |
5 | subdir('rest') | ||
6 | subdir('datacache') | 5 | subdir('datacache') |
7 | subdir('datastore') | 6 | subdir('datastore') |
8 | subdir('peerstore') | 7 | subdir('peerstore') |
@@ -11,6 +10,7 @@ subdir('nat-auto') | |||
11 | subdir('transport') | 10 | subdir('transport') |
12 | subdir('core') | 11 | subdir('core') |
13 | subdir('nse') | 12 | subdir('nse') |
13 | subdir('dhtu') | ||
14 | subdir('dht') | 14 | subdir('dht') |
15 | subdir('hostlist') | 15 | subdir('hostlist') |
16 | subdir('regex') | 16 | subdir('regex') |
@@ -30,6 +30,7 @@ subdir('exit') | |||
30 | subdir('pt') | 30 | subdir('pt') |
31 | subdir('reclaim') | 31 | subdir('reclaim') |
32 | subdir('messenger') | 32 | subdir('messenger') |
33 | subdir('rest') | ||
33 | 34 | ||
34 | if not get_option('monolith') | 35 | if not get_option('monolith') |
35 | subdir_done() | 36 | subdir_done() |
@@ -42,7 +43,10 @@ libgnunet = library('gnunet', | |||
42 | libgnunetjson_dep, | 43 | libgnunetjson_dep, |
43 | libgnunetblock_dep, | 44 | libgnunetblock_dep, |
44 | libgnunetblockgroup_dep, | 45 | libgnunetblockgroup_dep, |
46 | libgnunetregexblock_dep, | ||
45 | libgnunetgnsrecord_dep, | 47 | libgnunetgnsrecord_dep, |
48 | libgnunetgnsrecordjson_dep, | ||
49 | jose_dep, | ||
46 | libgnunetcurl_dep], | 50 | libgnunetcurl_dep], |
47 | c_args: ['-DHAVE_GNUNET_MONOLITH=1'], | 51 | c_args: ['-DHAVE_GNUNET_MONOLITH=1'], |
48 | include_directories: [incdir, configuration_inc, exitdir]) | 52 | include_directories: [incdir, configuration_inc, exitdir]) |
diff --git a/src/service/messenger/Makefile.am b/src/service/messenger/Makefile.am index d778d6e0c..c2ae65a08 100644 --- a/src/service/messenger/Makefile.am +++ b/src/service/messenger/Makefile.am | |||
@@ -10,19 +10,6 @@ pkgcfgdir= $(pkgdatadir)/config.d/ | |||
10 | 10 | ||
11 | libexecdir= $(pkglibdir)/libexec/ | 11 | libexecdir= $(pkglibdir)/libexec/ |
12 | 12 | ||
13 | plugin_LTLIBRARIES = \ | ||
14 | libgnunet_plugin_gnsrecord_messenger.la | ||
15 | |||
16 | |||
17 | libgnunet_plugin_gnsrecord_messenger_la_SOURCES = \ | ||
18 | plugin_gnsrecord_messenger.c | ||
19 | libgnunet_plugin_gnsrecord_messenger_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
21 | $(LTLIBINTL) | ||
22 | libgnunet_plugin_gnsrecord_messenger_la_LDFLAGS = \ | ||
23 | $(GN_PLUGIN_LDFLAGS) | ||
24 | |||
25 | |||
26 | pkgcfg_DATA = \ | 13 | pkgcfg_DATA = \ |
27 | messenger.conf | 14 | messenger.conf |
28 | 15 | ||
diff --git a/src/service/messenger/meson.build b/src/service/messenger/meson.build index a6de2f516..3c05d7760 100644 --- a/src/service/messenger/meson.build +++ b/src/service/messenger/meson.build | |||
@@ -55,14 +55,6 @@ libgnunetmessenger_dep = declare_dependency(link_with : libgnunetmessenger) | |||
55 | pkg.generate(libgnunetmessenger, url: 'https://www.gnunet.org', | 55 | pkg.generate(libgnunetmessenger, url: 'https://www.gnunet.org', |
56 | description : 'Provides API to access the GNUnet Messenger subsystem') | 56 | description : 'Provides API to access the GNUnet Messenger subsystem') |
57 | 57 | ||
58 | shared_module('gnunet_plugin_gnsrecord_messenger', | ||
59 | ['plugin_gnsrecord_messenger.c'], | ||
60 | dependencies: [libgnunetutil_dep, libgnunetgnsrecord_dep, | ||
61 | libgnunetmessenger_dep], | ||
62 | include_directories: [incdir, configuration_inc], | ||
63 | install: true, | ||
64 | install_dir: get_option('libdir')/'gnunet') | ||
65 | |||
66 | executable ('gnunet-service-messenger', | 58 | executable ('gnunet-service-messenger', |
67 | gnunetservicemessenger_src, | 59 | gnunetservicemessenger_src, |
68 | dependencies: [libgnunetmessenger_dep, | 60 | dependencies: [libgnunetmessenger_dep, |
diff --git a/src/service/namestore/meson.build b/src/service/namestore/meson.build index 879eaef09..912b312fa 100644 --- a/src/service/namestore/meson.build +++ b/src/service/namestore/meson.build | |||
@@ -1,7 +1,5 @@ | |||
1 | libgnunetnamestore_src = ['namestore_api.c', 'namestore_api_monitor.c'] | 1 | libgnunetnamestore_src = ['namestore_api.c', 'namestore_api_monitor.c'] |
2 | libgnunetpluginnamestore_sqlite_src = ['plugin_namestore_sqlite.c'] | ||
3 | 2 | ||
4 | gnunetnamestore_src = ['gnunet-namestore.c'] | ||
5 | gnunetservicenamestore_src = ['gnunet-service-namestore.c'] | 3 | gnunetservicenamestore_src = ['gnunet-service-namestore.c'] |
6 | 4 | ||
7 | configure_file(input : 'namestore.conf.in', | 5 | configure_file(input : 'namestore.conf.in', |
diff --git a/src/service/peerstore/Makefile.am b/src/service/peerstore/Makefile.am index 28948b7db..de301bbcf 100644 --- a/src/service/peerstore/Makefile.am +++ b/src/service/peerstore/Makefile.am | |||
@@ -51,63 +51,15 @@ libgnunetpeerstore_la_LDFLAGS = \ | |||
51 | $(GN_LIBINTL) \ | 51 | $(GN_LIBINTL) \ |
52 | $(GN_LIB_LDFLAGS) | 52 | $(GN_LIB_LDFLAGS) |
53 | 53 | ||
54 | if HAVE_EXPERIMENTAL | ||
55 | FLAT_PLUGIN = libgnunet_plugin_peerstore_flat.la | ||
56 | FLAT_TESTS = test_plugin_peerstore_flat | ||
57 | libgnunet_plugin_peerstore_flat_la_SOURCES = \ | ||
58 | plugin_peerstore_flat.c | ||
59 | libgnunet_plugin_peerstore_flat_la_LIBADD = \ | ||
60 | libgnunetpeerstore.la \ | ||
61 | $(top_builddir)/src/lib/util/libgnunetutil.la $(XLIBS) \ | ||
62 | $(LTLIBINTL) | ||
63 | libgnunet_plugin_peerstore_flat_la_LDFLAGS = \ | ||
64 | $(GN_PLUGIN_LDFLAGS) | ||
65 | endif | ||
66 | |||
67 | if HAVE_SQLITE | ||
68 | SQLITE_PLUGIN = libgnunet_plugin_peerstore_sqlite.la | ||
69 | SQLITE_TESTS = test_plugin_peerstore_sqlite | ||
70 | libgnunet_plugin_peerstore_sqlite_la_SOURCES = \ | ||
71 | plugin_peerstore_sqlite.c | ||
72 | libgnunet_plugin_peerstore_sqlite_la_LIBADD = \ | ||
73 | libgnunetpeerstore.la \ | ||
74 | $(top_builddir)/src/lib/sq/libgnunetsq.la \ | ||
75 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
76 | $(XLIBS) -lsqlite3 \ | ||
77 | $(LTLIBINTL) | ||
78 | libgnunet_plugin_peerstore_sqlite_la_LDFLAGS = \ | ||
79 | $(GN_PLUGIN_LDFLAGS) | ||
80 | endif | ||
81 | |||
82 | plugin_LTLIBRARIES = \ | ||
83 | $(SQLITE_PLUGIN) \ | ||
84 | $(FLAT_PLUGIN) | ||
85 | |||
86 | test_plugin_peerstore_sqlite_SOURCES = \ | ||
87 | test_plugin_peerstore.c | ||
88 | test_plugin_peerstore_sqlite_LDADD = \ | ||
89 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
90 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
91 | |||
92 | test_plugin_peerstore_flat_SOURCES = \ | ||
93 | test_plugin_peerstore.c | ||
94 | test_plugin_peerstore_flat_LDADD = \ | ||
95 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
96 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
97 | |||
98 | check_PROGRAMS = \ | 54 | check_PROGRAMS = \ |
99 | test_peerstore_api_store \ | 55 | test_peerstore_api_store \ |
100 | test_peerstore_api_iterate \ | 56 | test_peerstore_api_iterate \ |
101 | test_peerstore_api_watch \ | 57 | test_peerstore_api_watch \ |
102 | test_peerstore_api_sync \ | 58 | test_peerstore_api_sync \ |
103 | perf_peerstore_store \ | 59 | perf_peerstore_store |
104 | $(SQLITE_TESTS) \ | ||
105 | $(FLAT_TESTS) | ||
106 | 60 | ||
107 | EXTRA_DIST = \ | 61 | EXTRA_DIST = \ |
108 | test_peerstore_api_data.conf \ | 62 | test_peerstore_api_data.conf |
109 | test_plugin_peerstore_flat.conf \ | ||
110 | test_plugin_peerstore_sqlite.conf | ||
111 | 63 | ||
112 | if ENABLE_TEST_RUN | 64 | if ENABLE_TEST_RUN |
113 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 65 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
diff --git a/src/service/peerstore/meson.build b/src/service/peerstore/meson.build index 7d8710c4b..db70b0b9e 100644 --- a/src/service/peerstore/meson.build +++ b/src/service/peerstore/meson.build | |||
@@ -28,16 +28,6 @@ pkg.generate(libgnunetpeerstore, url: 'https://www.gnunet.org', | |||
28 | description : 'Provides API for accessing the peerstore service') | 28 | description : 'Provides API for accessing the peerstore service') |
29 | libgnunetpeerstore_dep = declare_dependency(link_with : libgnunetpeerstore) | 29 | libgnunetpeerstore_dep = declare_dependency(link_with : libgnunetpeerstore) |
30 | 30 | ||
31 | shared_module('gnunet_plugin_peerstore_sqlite', | ||
32 | ['plugin_peerstore_sqlite.c'], | ||
33 | dependencies: [libgnunetutil_dep, | ||
34 | libgnunetpeerstore_dep, | ||
35 | libgnunetsq_dep, | ||
36 | sqlite_dep], | ||
37 | include_directories: [incdir, configuration_inc], | ||
38 | install: true, | ||
39 | install_dir: get_option('libdir')/'gnunet') | ||
40 | |||
41 | executable ('gnunet-service-peerstore', | 31 | executable ('gnunet-service-peerstore', |
42 | gnunetservicepeerstore_src, | 32 | gnunetservicepeerstore_src, |
43 | dependencies: [libgnunetpeerstore_dep, | 33 | dependencies: [libgnunetpeerstore_dep, |
diff --git a/src/service/regex/Makefile.am b/src/service/regex/Makefile.am index 14cdb054b..255988889 100644 --- a/src/service/regex/Makefile.am +++ b/src/service/regex/Makefile.am | |||
@@ -31,27 +31,15 @@ REGEX_INTERNAL_TEST = \ | |||
31 | gnunet_service_regex_SOURCES = \ | 31 | gnunet_service_regex_SOURCES = \ |
32 | $(REGEX_INTERNAL) gnunet-service-regex.c | 32 | $(REGEX_INTERNAL) gnunet-service-regex.c |
33 | gnunet_service_regex_LDADD = -lm \ | 33 | gnunet_service_regex_LDADD = -lm \ |
34 | libgnunetregexblock.la \ | 34 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
35 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 35 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
36 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 36 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
37 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 37 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
38 | $(GN_LIBINTL) | 38 | $(GN_LIBINTL) |
39 | 39 | ||
40 | lib_LTLIBRARIES = \ | 40 | lib_LTLIBRARIES = \ |
41 | libgnunetregexblock.la \ | ||
42 | libgnunetregex.la | 41 | libgnunetregex.la |
43 | 42 | ||
44 | libgnunetregexblock_la_SOURCES = \ | ||
45 | regex_block_lib.c regex_block_lib.h | ||
46 | libgnunetregexblock_la_LIBADD = \ | ||
47 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
48 | $(XLIB) \ | ||
49 | $(LTLIBINTL) | ||
50 | libgnunetregexblock_la_LDFLAGS = \ | ||
51 | $(GN_LIB_LDFLAGS) \ | ||
52 | -version-info 1:0:0 | ||
53 | |||
54 | |||
55 | libgnunetregex_la_SOURCES = \ | 43 | libgnunetregex_la_SOURCES = \ |
56 | regex_api_announce.c \ | 44 | regex_api_announce.c \ |
57 | regex_api_search.c \ | 45 | regex_api_search.c \ |
@@ -64,20 +52,6 @@ libgnunetregex_la_LDFLAGS = \ | |||
64 | -version-info 3:1:0 | 52 | -version-info 3:1:0 |
65 | 53 | ||
66 | 54 | ||
67 | plugin_LTLIBRARIES = \ | ||
68 | libgnunet_plugin_block_regex.la | ||
69 | |||
70 | libgnunet_plugin_block_regex_la_SOURCES = \ | ||
71 | plugin_block_regex.c | ||
72 | libgnunet_plugin_block_regex_la_LIBADD = \ | ||
73 | libgnunetregexblock.la \ | ||
74 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
75 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
76 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
77 | libgnunet_plugin_block_regex_la_LDFLAGS = \ | ||
78 | $(GN_LIBINTL) \ | ||
79 | $(GN_PLUGIN_LDFLAGS) | ||
80 | |||
81 | # FIXME we phased out mysql. If we want to keep, needs rewrite | 55 | # FIXME we phased out mysql. If we want to keep, needs rewrite |
82 | #if HAVE_MYSQL | 56 | #if HAVE_MYSQL |
83 | #noinst_mysql_progs = \ | 57 | #noinst_mysql_progs = \ |
@@ -100,7 +74,7 @@ perf_regex_SOURCES = \ | |||
100 | $(REGEX_INTERNAL_TEST) perf-regex.c | 74 | $(REGEX_INTERNAL_TEST) perf-regex.c |
101 | perf_regex_LDADD = -lm \ | 75 | perf_regex_LDADD = -lm \ |
102 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 76 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
103 | libgnunetregexblock.la \ | 77 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
104 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 78 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
105 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 79 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
106 | perf_regex_LDFLAGS = \ | 80 | perf_regex_LDFLAGS = \ |
@@ -110,7 +84,7 @@ gnunet_daemon_regexprofiler_SOURCES = \ | |||
110 | $(REGEX_INTERNAL_TEST) gnunet-daemon-regexprofiler.c | 84 | $(REGEX_INTERNAL_TEST) gnunet-daemon-regexprofiler.c |
111 | gnunet_daemon_regexprofiler_LDADD = -lm \ | 85 | gnunet_daemon_regexprofiler_LDADD = -lm \ |
112 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 86 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
113 | libgnunetregexblock.la \ | 87 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
114 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 88 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
115 | $(top_builddir)/src/lib/util/libgnunetutil.la | 89 | $(top_builddir)/src/lib/util/libgnunetutil.la |
116 | gnunet_daemon_regexprofiler_LDFLAGS = \ | 90 | gnunet_daemon_regexprofiler_LDFLAGS = \ |
@@ -133,7 +107,7 @@ test_regex_eval_api_SOURCES = \ | |||
133 | $(REGEX_INTERNAL_TEST) test_regex_eval_api.c | 107 | $(REGEX_INTERNAL_TEST) test_regex_eval_api.c |
134 | test_regex_eval_api_LDADD = -lm \ | 108 | test_regex_eval_api_LDADD = -lm \ |
135 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 109 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
136 | libgnunetregexblock.la \ | 110 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
137 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 111 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
138 | $(top_builddir)/src/lib/util/libgnunetutil.la | 112 | $(top_builddir)/src/lib/util/libgnunetutil.la |
139 | 113 | ||
@@ -154,7 +128,7 @@ test_regex_api_LDADD = -lm \ | |||
154 | test_regex_iterate_api_SOURCES = \ | 128 | test_regex_iterate_api_SOURCES = \ |
155 | $(REGEX_INTERNAL) test_regex_iterate_api.c | 129 | $(REGEX_INTERNAL) test_regex_iterate_api.c |
156 | test_regex_iterate_api_LDADD = -lm \ | 130 | test_regex_iterate_api_LDADD = -lm \ |
157 | libgnunetregexblock.la \ | 131 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
158 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 132 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
159 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 133 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
160 | $(top_builddir)/src/lib/util/libgnunetutil.la | 134 | $(top_builddir)/src/lib/util/libgnunetutil.la |
@@ -163,7 +137,7 @@ test_regex_proofs_SOURCES = \ | |||
163 | $(REGEX_INTERNAL_TEST) test_regex_proofs.c | 137 | $(REGEX_INTERNAL_TEST) test_regex_proofs.c |
164 | test_regex_proofs_LDADD = -lm \ | 138 | test_regex_proofs_LDADD = -lm \ |
165 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 139 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
166 | libgnunetregexblock.la \ | 140 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
167 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 141 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
168 | $(top_builddir)/src/lib/util/libgnunetutil.la | 142 | $(top_builddir)/src/lib/util/libgnunetutil.la |
169 | 143 | ||
@@ -171,7 +145,7 @@ test_regex_graph_api_SOURCES = \ | |||
171 | $(REGEX_INTERNAL_TEST) test_regex_graph_api.c | 145 | $(REGEX_INTERNAL_TEST) test_regex_graph_api.c |
172 | test_regex_graph_api_LDADD = -lm \ | 146 | test_regex_graph_api_LDADD = -lm \ |
173 | $(top_builddir)/src/service/dht/libgnunetdht.la \ | 147 | $(top_builddir)/src/service/dht/libgnunetdht.la \ |
174 | libgnunetregexblock.la \ | 148 | $(top_builddir)/src/plugin/regex/libgnunetregexblock.la \ |
175 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 149 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
176 | $(top_builddir)/src/lib/util/libgnunetutil.la | 150 | $(top_builddir)/src/lib/util/libgnunetutil.la |
177 | 151 | ||
diff --git a/src/service/regex/meson.build b/src/service/regex/meson.build index da607ca47..3c25a5148 100644 --- a/src/service/regex/meson.build +++ b/src/service/regex/meson.build | |||
@@ -1,7 +1,5 @@ | |||
1 | libgnunetregex_src = ['regex_api_announce.c', | 1 | libgnunetregex_src = ['regex_api_announce.c', |
2 | 'regex_api_search.c'] | 2 | 'regex_api_search.c'] |
3 | libgnunetregexblock_src = ['regex_block_lib.c'] | ||
4 | |||
5 | gnunetserviceregex_src = ['gnunet-service-regex.c', | 3 | gnunetserviceregex_src = ['gnunet-service-regex.c', |
6 | 'regex_internal_dht.c', | 4 | 'regex_internal_dht.c', |
7 | 'regex_internal.c'] | 5 | 'regex_internal.c'] |
@@ -14,7 +12,7 @@ configure_file(input : 'regex.conf.in', | |||
14 | 12 | ||
15 | 13 | ||
16 | if get_option('monolith') | 14 | if get_option('monolith') |
17 | foreach p : libgnunetregex_src + libgnunetregexblock_src + gnunetserviceregex_src | 15 | foreach p : libgnunetregex_src + gnunetserviceregex_src |
18 | gnunet_src += 'regex/' + p | 16 | gnunet_src += 'regex/' + p |
19 | endforeach | 17 | endforeach |
20 | endif | 18 | endif |
@@ -30,26 +28,6 @@ libgnunetregex = library('gnunetregex', | |||
30 | pkg.generate(libgnunetregex, url: 'https://www.gnunet.org', | 28 | pkg.generate(libgnunetregex, url: 'https://www.gnunet.org', |
31 | description : 'Provides API for accessing the regex service') | 29 | description : 'Provides API for accessing the regex service') |
32 | libgnunetregex_dep = declare_dependency(link_with : libgnunetregex) | 30 | libgnunetregex_dep = declare_dependency(link_with : libgnunetregex) |
33 | libgnunetregexblock = library('gnunetregexblock', | ||
34 | libgnunetregexblock_src, | ||
35 | soversion: '1', | ||
36 | version: '1.0.0', | ||
37 | dependencies: libgnunetutil_dep, | ||
38 | include_directories: [incdir, configuration_inc], | ||
39 | install: true, | ||
40 | install_dir: get_option('libdir')) | ||
41 | libgnunetregexblock_dep = declare_dependency(link_with : libgnunetregexblock) | ||
42 | |||
43 | shared_module('gnunet_plugin_block_regex', | ||
44 | ['plugin_block_regex.c'], | ||
45 | dependencies: [libgnunetutil_dep, | ||
46 | libgnunetregexblock_dep, | ||
47 | libgnunetblock_dep, | ||
48 | libgnunetblockgroup_dep], | ||
49 | include_directories: [incdir, configuration_inc], | ||
50 | install:true, | ||
51 | install_dir: get_option('libdir')/'gnunet') | ||
52 | |||
53 | 31 | ||
54 | executable ('gnunet-service-regex', | 32 | executable ('gnunet-service-regex', |
55 | gnunetserviceregex_src, | 33 | gnunetserviceregex_src, |
diff --git a/src/service/regex/regex_internal_dht.c b/src/service/regex/regex_internal_dht.c index bda979edb..9850f106f 100644 --- a/src/service/regex/regex_internal_dht.c +++ b/src/service/regex/regex_internal_dht.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "regex_internal_lib.h" | 27 | #include "regex_internal_lib.h" |
28 | #include "regex_block_lib.h" | ||
29 | #include "gnunet_dht_service.h" | 28 | #include "gnunet_dht_service.h" |
30 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
31 | #include "gnunet_constants.h" | 30 | #include "gnunet_constants.h" |
diff --git a/src/service/regex/regex_internal_lib.h b/src/service/regex/regex_internal_lib.h index 9baf84995..bfa3fc97d 100644 --- a/src/service/regex/regex_internal_lib.h +++ b/src/service/regex/regex_internal_lib.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_dht_service.h" | 30 | #include "gnunet_dht_service.h" |
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
32 | #include "regex_block_lib.h" | 32 | #include "../../plugin/regex/regex_block_lib.h" |
33 | 33 | ||
34 | #ifdef __cplusplus | 34 | #ifdef __cplusplus |
35 | extern "C" | 35 | extern "C" |
diff --git a/src/service/rest/Makefile.am b/src/service/rest/Makefile.am index 401be36f4..60769e366 100644 --- a/src/service/rest/Makefile.am +++ b/src/service/rest/Makefile.am | |||
@@ -24,10 +24,35 @@ libexec_PROGRAMS = \ | |||
24 | EXTRA_DIST = \ | 24 | EXTRA_DIST = \ |
25 | rest.conf | 25 | rest.conf |
26 | 26 | ||
27 | if HAVE_JOSE | ||
28 | OPENID_PLUGIN = \ | ||
29 | openid_plugin.c \ | ||
30 | oidc_helper.c | ||
31 | OPENID_JOSE_LIBS = -ljose | ||
32 | endif | ||
33 | |||
27 | gnunet_rest_server_SOURCES = \ | 34 | gnunet_rest_server_SOURCES = \ |
28 | gnunet-rest-server.c | 35 | gnunet-rest-server.c \ |
36 | config_plugin.c \ | ||
37 | copying_plugin.c \ | ||
38 | identity_plugin.c \ | ||
39 | namestore_plugin.c \ | ||
40 | gns_plugin.c \ | ||
41 | $(OPENID_PLUGIN) \ | ||
42 | reclaim_plugin.c json_reclaim.c | ||
29 | gnunet_rest_server_LDADD = \ | 43 | gnunet_rest_server_LDADD = \ |
30 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 44 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
45 | $(top_builddir)/src/lib/json/libgnunetjson.la \ | ||
46 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ | ||
47 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecordjson.la \ | ||
48 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | ||
49 | $(top_builddir)/src/service/namestore/libgnunetnamestore.la \ | ||
50 | $(top_builddir)/src/service/gns/libgnunetgns.la \ | ||
51 | $(top_builddir)/src/service/reclaim/libgnunetreclaim.la \ | ||
52 | libgnunetrest.la \ | ||
53 | $(OPENID_JOSE_LIBS) \ | ||
54 | -ljansson \ | ||
55 | $(LIBGCRYPT_LIBS) \ | ||
31 | $(GN_LIBINTL) $(MHD_LIBS) | 56 | $(GN_LIBINTL) $(MHD_LIBS) |
32 | gnunet_rest_server_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | 57 | gnunet_rest_server_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) |
33 | 58 | ||
diff --git a/src/rest-plugin/rest/plugin_rest_config.c b/src/service/rest/config_plugin.c index 826188702..fd0ac011a 100644 --- a/src/rest-plugin/rest/plugin_rest_config.c +++ b/src/service/rest/config_plugin.c | |||
@@ -40,7 +40,7 @@ struct Plugin | |||
40 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 40 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 43 | const struct GNUNET_CONFIGURATION_Handle *config_cfg; |
44 | 44 | ||
45 | struct RequestHandle | 45 | struct RequestHandle |
46 | { | 46 | { |
@@ -78,6 +78,7 @@ struct RequestHandle | |||
78 | * The URL | 78 | * The URL |
79 | */ | 79 | */ |
80 | char *url; | 80 | char *url; |
81 | |||
81 | }; | 82 | }; |
82 | 83 | ||
83 | /** | 84 | /** |
@@ -184,13 +185,13 @@ get_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
184 | if (strlen (GNUNET_REST_API_NS_CONFIG) == strlen (handle->url)) | 185 | if (strlen (GNUNET_REST_API_NS_CONFIG) == strlen (handle->url)) |
185 | { | 186 | { |
186 | result = json_object (); | 187 | result = json_object (); |
187 | GNUNET_CONFIGURATION_iterate (cfg, &add_sections, result); | 188 | GNUNET_CONFIGURATION_iterate (config_cfg, &add_sections, result); |
188 | } | 189 | } |
189 | else | 190 | else |
190 | { | 191 | { |
191 | result = json_object (); | 192 | result = json_object (); |
192 | section = &handle->url[strlen (GNUNET_REST_API_NS_CONFIG) + 1]; | 193 | section = &handle->url[strlen (GNUNET_REST_API_NS_CONFIG) + 1]; |
193 | GNUNET_CONFIGURATION_iterate_section_values (cfg, | 194 | GNUNET_CONFIGURATION_iterate_section_values (config_cfg, |
194 | section, | 195 | section, |
195 | &add_section_contents, | 196 | &add_section_contents, |
196 | result); | 197 | result); |
@@ -243,7 +244,7 @@ set_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
243 | { | 244 | { |
244 | struct RequestHandle *handle = cls; | 245 | struct RequestHandle *handle = cls; |
245 | char term_data[handle->rest_handle->data_size + 1]; | 246 | char term_data[handle->rest_handle->data_size + 1]; |
246 | struct GNUNET_CONFIGURATION_Handle *out = GNUNET_CONFIGURATION_dup (cfg); | 247 | struct GNUNET_CONFIGURATION_Handle *out = GNUNET_CONFIGURATION_dup (config_cfg); |
247 | 248 | ||
248 | json_error_t err; | 249 | json_error_t err; |
249 | json_t *data_json; | 250 | json_t *data_json; |
@@ -330,7 +331,7 @@ set_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
330 | cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); | 331 | cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); |
331 | 332 | ||
332 | GNUNET_CONFIGURATION_write (out, cfg_fn); | 333 | GNUNET_CONFIGURATION_write (out, cfg_fn); |
333 | cfg = out; | 334 | config_cfg = out; |
334 | handle->proc (handle->proc_cls, | 335 | handle->proc (handle->proc_cls, |
335 | GNUNET_REST_create_response (NULL), | 336 | GNUNET_REST_create_response (NULL), |
336 | MHD_HTTP_OK); | 337 | MHD_HTTP_OK); |
@@ -361,19 +362,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
361 | } | 362 | } |
362 | 363 | ||
363 | 364 | ||
364 | /** | 365 | enum GNUNET_GenericReturnValue |
365 | * Function processing the REST call | 366 | REST_config_process_request (void *plugin, |
366 | * | 367 | struct GNUNET_REST_RequestHandle *conndata_handle, |
367 | * @param method HTTP method | ||
368 | * @param url URL of the HTTP request | ||
369 | * @param data body of the HTTP request (optional) | ||
370 | * @param data_size length of the body | ||
371 | * @param proc callback function for the result | ||
372 | * @param proc_cls closure for @a proc | ||
373 | * @return #GNUNET_OK if request accepted | ||
374 | */ | ||
375 | static enum GNUNET_GenericReturnValue | ||
376 | rest_config_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, | ||
377 | GNUNET_REST_ResultProcessor proc, | 368 | GNUNET_REST_ResultProcessor proc, |
378 | void *proc_cls) | 369 | void *proc_cls) |
379 | { | 370 | { |
@@ -383,6 +374,7 @@ rest_config_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
383 | { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_CONFIG, &options_cont }, | 374 | { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_CONFIG, &options_cont }, |
384 | GNUNET_REST_HANDLER_END | 375 | GNUNET_REST_HANDLER_END |
385 | }; | 376 | }; |
377 | (void) plugin; | ||
386 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 378 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); |
387 | struct GNUNET_REST_RequestHandlerError err; | 379 | struct GNUNET_REST_RequestHandlerError err; |
388 | 380 | ||
@@ -404,6 +396,19 @@ rest_config_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
404 | return GNUNET_YES; | 396 | return GNUNET_YES; |
405 | } | 397 | } |
406 | 398 | ||
399 | void | ||
400 | REST_config_done (struct GNUNET_REST_Plugin *api) | ||
401 | { | ||
402 | struct Plugin *plugin; | ||
403 | |||
404 | while (NULL != requests_head) | ||
405 | cleanup_handle (requests_head); | ||
406 | plugin = api->cls; | ||
407 | plugin->cfg = NULL; | ||
408 | GNUNET_free (api); | ||
409 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONFIG REST plugin is finished\n"); | ||
410 | } | ||
411 | |||
407 | 412 | ||
408 | /** | 413 | /** |
409 | * Entry point for the plugin. | 414 | * Entry point for the plugin. |
@@ -412,44 +417,22 @@ rest_config_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
412 | * @return NULL on error, otherwise the plugin context | 417 | * @return NULL on error, otherwise the plugin context |
413 | */ | 418 | */ |
414 | void * | 419 | void * |
415 | libgnunet_plugin_rest_config_init (void *cls) | 420 | REST_config_init (const struct GNUNET_CONFIGURATION_Handle *c) |
416 | { | 421 | { |
417 | static struct Plugin plugin; | 422 | static struct Plugin plugin; |
418 | 423 | ||
419 | cfg = cls; | 424 | config_cfg = c; |
420 | struct GNUNET_REST_Plugin *api; | 425 | struct GNUNET_REST_Plugin *api; |
421 | 426 | ||
422 | memset (&plugin, 0, sizeof(struct Plugin)); | 427 | memset (&plugin, 0, sizeof(struct Plugin)); |
423 | plugin.cfg = cfg; | 428 | plugin.cfg = c; |
424 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 429 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
425 | api->cls = &plugin; | 430 | api->cls = &plugin; |
426 | api->name = GNUNET_REST_API_NS_CONFIG; | 431 | api->name = GNUNET_REST_API_NS_CONFIG; |
427 | api->process_request = &rest_config_process_request; | ||
428 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("CONFIG REST API initialized\n")); | 432 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("CONFIG REST API initialized\n")); |
429 | return api; | 433 | return api; |
430 | } | 434 | } |
431 | 435 | ||
432 | 436 | ||
433 | /** | ||
434 | * Exit point from the plugin. | ||
435 | * | ||
436 | * @param cls the plugin context (as returned by "init") | ||
437 | * @return always NULL | ||
438 | */ | ||
439 | void * | ||
440 | libgnunet_plugin_rest_config_done (void *cls) | ||
441 | { | ||
442 | struct GNUNET_REST_Plugin *api = cls; | ||
443 | struct Plugin *plugin; | ||
444 | |||
445 | while (NULL != requests_head) | ||
446 | cleanup_handle (requests_head); | ||
447 | plugin = api->cls; | ||
448 | plugin->cfg = NULL; | ||
449 | GNUNET_free (api); | ||
450 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONFIG REST plugin is finished\n"); | ||
451 | return NULL; | ||
452 | } | ||
453 | |||
454 | 437 | ||
455 | /* end of plugin_rest_config.c */ | 438 | /* end of plugin_rest_config.c */ |
diff --git a/src/service/rest/config_plugin.h b/src/service/rest/config_plugin.h new file mode 100644 index 000000000..c959a94f2 --- /dev/null +++ b/src/service/rest/config_plugin.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #include "platform.h" | ||
2 | #include "gnunet_util_lib.h" | ||
3 | #include "gnunet_rest_plugin.h" | ||
4 | |||
5 | /** | ||
6 | * Function processing the REST call | ||
7 | * | ||
8 | * @param method HTTP method | ||
9 | * @param url URL of the HTTP request | ||
10 | * @param data body of the HTTP request (optional) | ||
11 | * @param data_size length of the body | ||
12 | * @param proc callback function for the result | ||
13 | * @param proc_cls closure for @a proc | ||
14 | * @return #GNUNET_OK if request accepted | ||
15 | */ | ||
16 | enum GNUNET_GenericReturnValue | ||
17 | REST_config_process_request (void *plugin, | ||
18 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
19 | GNUNET_REST_ResultProcessor proc, | ||
20 | void *proc_cls); | ||
21 | |||
22 | /** | ||
23 | * Entry point for the plugin. | ||
24 | * | ||
25 | */ | ||
26 | void * | ||
27 | REST_config_init (const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
28 | |||
29 | /** | ||
30 | * Exit point from the plugin. | ||
31 | * | ||
32 | * @param cls the plugin context (as returned by "init") | ||
33 | * @return always NULL | ||
34 | */ | ||
35 | void | ||
36 | REST_config_done (struct GNUNET_REST_Plugin *api); | ||
37 | |||
diff --git a/src/rest-plugin/rest/plugin_rest_copying.c b/src/service/rest/copying_plugin.c index 52783a81a..d907f6729 100644 --- a/src/rest-plugin/rest/plugin_rest_copying.c +++ b/src/service/rest/copying_plugin.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #define GNUNET_REST_API_NS_COPYING "/copying" | 31 | #define GNUNET_REST_API_NS_COPYING "/copying" |
32 | 32 | ||
33 | #define GNUNET_REST_COPYING_TEXT \ | 33 | #define GNUNET_REST_COPYING_TEXT \ |
34 | "GNU Affero General Public License version 3 or later. See also: <http://www.gnu.org/licenses/>" | 34 | "GNU Affero General Public License version 3 or later. See also: <http://www.gnu.org/licenses/>" |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * @brief struct returned by the initialization function of the plugin | 37 | * @brief struct returned by the initialization function of the plugin |
@@ -41,8 +41,6 @@ struct Plugin | |||
41 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 41 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
45 | |||
46 | struct RequestHandle | 44 | struct RequestHandle |
47 | { | 45 | { |
48 | /** | 46 | /** |
@@ -159,8 +157,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
159 | * @param proc_cls closure for @a proc | 157 | * @param proc_cls closure for @a proc |
160 | * @return #GNUNET_OK if request accepted | 158 | * @return #GNUNET_OK if request accepted |
161 | */ | 159 | */ |
162 | static enum GNUNET_GenericReturnValue | 160 | enum GNUNET_GenericReturnValue |
163 | rest_copying_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, | 161 | REST_copying_process_request (void *plugin, |
162 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
164 | GNUNET_REST_ResultProcessor proc, | 163 | GNUNET_REST_ResultProcessor proc, |
165 | void *proc_cls) | 164 | void *proc_cls) |
166 | { | 165 | { |
@@ -191,22 +190,20 @@ rest_copying_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
191 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | 190 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" |
192 | * @return NULL on error, otherwise the plugin context | 191 | * @return NULL on error, otherwise the plugin context |
193 | */ | 192 | */ |
194 | void * | 193 | void* |
195 | libgnunet_plugin_rest_copying_init (void *cls) | 194 | REST_copying_init (const struct GNUNET_CONFIGURATION_Handle *c) |
196 | { | 195 | { |
197 | static struct Plugin plugin; | 196 | static struct Plugin plugin; |
198 | 197 | ||
199 | cfg = cls; | ||
200 | struct GNUNET_REST_Plugin *api; | 198 | struct GNUNET_REST_Plugin *api; |
201 | 199 | ||
202 | if (NULL != plugin.cfg) | 200 | if (NULL != plugin.cfg) |
203 | return NULL; /* can only initialize once! */ | 201 | return NULL; /* can only initialize once! */ |
204 | memset (&plugin, 0, sizeof(struct Plugin)); | 202 | memset (&plugin, 0, sizeof(struct Plugin)); |
205 | plugin.cfg = cfg; | 203 | plugin.cfg = c; |
206 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 204 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
207 | api->cls = &plugin; | 205 | api->cls = &plugin; |
208 | api->name = GNUNET_REST_API_NS_COPYING; | 206 | api->name = GNUNET_REST_API_NS_COPYING; |
209 | api->process_request = &rest_copying_process_request; | ||
210 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 207 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
211 | _ ("COPYING REST API initialized\n")); | 208 | _ ("COPYING REST API initialized\n")); |
212 | return api; | 209 | return api; |
@@ -219,10 +216,9 @@ libgnunet_plugin_rest_copying_init (void *cls) | |||
219 | * @param cls the plugin context (as returned by "init") | 216 | * @param cls the plugin context (as returned by "init") |
220 | * @return always NULL | 217 | * @return always NULL |
221 | */ | 218 | */ |
222 | void * | 219 | void |
223 | libgnunet_plugin_rest_copying_done (void *cls) | 220 | REST_copying_done (struct GNUNET_REST_Plugin *api) |
224 | { | 221 | { |
225 | struct GNUNET_REST_Plugin *api = cls; | ||
226 | struct Plugin *plugin = api->cls; | 222 | struct Plugin *plugin = api->cls; |
227 | 223 | ||
228 | while (NULL != requests_head) | 224 | while (NULL != requests_head) |
@@ -231,7 +227,6 @@ libgnunet_plugin_rest_copying_done (void *cls) | |||
231 | GNUNET_free (api); | 227 | GNUNET_free (api); |
232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 228 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
233 | "COPYING REST plugin is finished\n"); | 229 | "COPYING REST plugin is finished\n"); |
234 | return NULL; | ||
235 | } | 230 | } |
236 | 231 | ||
237 | 232 | ||
diff --git a/src/service/rest/copying_plugin.h b/src/service/rest/copying_plugin.h new file mode 100644 index 000000000..4ba1a2e36 --- /dev/null +++ b/src/service/rest/copying_plugin.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "gnunet_rest_plugin.h" | ||
2 | /** | ||
3 | * Function processing the REST call | ||
4 | * | ||
5 | * @param method HTTP method | ||
6 | * @param url URL of the HTTP request | ||
7 | * @param data body of the HTTP request (optional) | ||
8 | * @param data_size length of the body | ||
9 | * @param proc callback function for the result | ||
10 | * @param proc_cls closure for @a proc | ||
11 | * @return #GNUNET_OK if request accepted | ||
12 | */ | ||
13 | enum GNUNET_GenericReturnValue | ||
14 | REST_copying_process_request (void *plugin, | ||
15 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
16 | GNUNET_REST_ResultProcessor proc, | ||
17 | void *proc_cls); | ||
18 | |||
19 | /** | ||
20 | * Entry point for the plugin. | ||
21 | * | ||
22 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | ||
23 | * @return NULL on error, otherwise the plugin context | ||
24 | */ | ||
25 | void* | ||
26 | REST_copying_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Exit point from the plugin. | ||
31 | * | ||
32 | * @param cls the plugin context (as returned by "init") | ||
33 | * @return always NULL | ||
34 | */ | ||
35 | void | ||
36 | REST_copying_done (struct GNUNET_REST_Plugin *api); | ||
diff --git a/src/rest-plugin/gns/plugin_rest_gns.c b/src/service/rest/gns_plugin.c index 659b77493..0ea89d0cd 100644 --- a/src/rest-plugin/gns/plugin_rest_gns.c +++ b/src/service/rest/gns_plugin.c | |||
@@ -56,7 +56,7 @@ | |||
56 | /** | 56 | /** |
57 | * The configuration handle | 57 | * The configuration handle |
58 | */ | 58 | */ |
59 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 59 | const struct GNUNET_CONFIGURATION_Handle *gns_cfg; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * HTTP methods allows for this plugin | 62 | * HTTP methods allows for this plugin |
@@ -221,7 +221,7 @@ do_error (void *cls) | |||
221 | handle->proc (handle->proc_cls, resp, handle->response_code); | 221 | handle->proc (handle->proc_cls, resp, handle->response_code); |
222 | json_decref (json_error); | 222 | json_decref (json_error); |
223 | GNUNET_free (response); | 223 | GNUNET_free (response); |
224 | cleanup_handle(handle); | 224 | cleanup_handle (handle); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
@@ -265,7 +265,8 @@ handle_gns_response (void *cls, | |||
265 | return; | 265 | return; |
266 | } | 266 | } |
267 | 267 | ||
268 | result_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (handle->name, rd, rd_count); | 268 | result_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (handle->name, rd, |
269 | rd_count); | ||
269 | 270 | ||
270 | result = json_dumps (result_obj, 0); | 271 | result = json_dumps (result_obj, 0); |
271 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); | 272 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); |
@@ -381,10 +382,11 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
381 | * @param proc_cls closure for callback function | 382 | * @param proc_cls closure for callback function |
382 | * @return GNUNET_OK if request accepted | 383 | * @return GNUNET_OK if request accepted |
383 | */ | 384 | */ |
384 | static enum GNUNET_GenericReturnValue | 385 | enum GNUNET_GenericReturnValue |
385 | rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | 386 | REST_gns_process_request (void *plugin, |
386 | GNUNET_REST_ResultProcessor proc, | 387 | struct GNUNET_REST_RequestHandle *rest_handle, |
387 | void *proc_cls) | 388 | GNUNET_REST_ResultProcessor proc, |
389 | void *proc_cls) | ||
388 | { | 390 | { |
389 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 391 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); |
390 | struct GNUNET_REST_RequestHandlerError err; | 392 | struct GNUNET_REST_RequestHandlerError err; |
@@ -426,18 +428,17 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
426 | * @return NULL on error, otherwise the plugin context | 428 | * @return NULL on error, otherwise the plugin context |
427 | */ | 429 | */ |
428 | void * | 430 | void * |
429 | libgnunet_plugin_rest_gns_init (void *cls) | 431 | REST_gns_init (const struct GNUNET_CONFIGURATION_Handle *c) |
430 | { | 432 | { |
431 | static struct Plugin plugin; | 433 | static struct Plugin plugin; |
432 | struct GNUNET_REST_Plugin *api; | 434 | struct GNUNET_REST_Plugin *api; |
433 | 435 | ||
434 | cfg = cls; | 436 | gns_cfg = c; |
435 | memset (&plugin, 0, sizeof(struct Plugin)); | 437 | memset (&plugin, 0, sizeof(struct Plugin)); |
436 | plugin.cfg = cfg; | 438 | plugin.cfg = gns_cfg; |
437 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 439 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
438 | api->cls = &plugin; | 440 | api->cls = &plugin; |
439 | api->name = GNUNET_REST_API_NS_GNS; | 441 | api->name = GNUNET_REST_API_NS_GNS; |
440 | api->process_request = &rest_process_request; | ||
441 | GNUNET_asprintf (&allow_methods, | 442 | GNUNET_asprintf (&allow_methods, |
442 | "%s, %s, %s, %s, %s", | 443 | "%s, %s, %s, %s, %s", |
443 | MHD_HTTP_METHOD_GET, | 444 | MHD_HTTP_METHOD_GET, |
@@ -445,7 +446,7 @@ libgnunet_plugin_rest_gns_init (void *cls) | |||
445 | MHD_HTTP_METHOD_PUT, | 446 | MHD_HTTP_METHOD_PUT, |
446 | MHD_HTTP_METHOD_DELETE, | 447 | MHD_HTTP_METHOD_DELETE, |
447 | MHD_HTTP_METHOD_OPTIONS); | 448 | MHD_HTTP_METHOD_OPTIONS); |
448 | gns = GNUNET_GNS_connect (cfg); | 449 | gns = GNUNET_GNS_connect (gns_cfg); |
449 | 450 | ||
450 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Gns REST API initialized\n")); | 451 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Gns REST API initialized\n")); |
451 | return api; | 452 | return api; |
@@ -459,7 +460,7 @@ libgnunet_plugin_rest_gns_init (void *cls) | |||
459 | * @return always NULL | 460 | * @return always NULL |
460 | */ | 461 | */ |
461 | void * | 462 | void * |
462 | libgnunet_plugin_rest_gns_done (void *cls) | 463 | REST_gns_done (void *cls) |
463 | { | 464 | { |
464 | struct GNUNET_REST_Plugin *api = cls; | 465 | struct GNUNET_REST_Plugin *api = cls; |
465 | struct RequestHandle *request; | 466 | struct RequestHandle *request; |
diff --git a/src/service/rest/gns_plugin.h b/src/service/rest/gns_plugin.h new file mode 100644 index 000000000..13878c139 --- /dev/null +++ b/src/service/rest/gns_plugin.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "gnunet_rest_plugin.h" | ||
2 | /** | ||
3 | * Function processing the REST call | ||
4 | * | ||
5 | * @param method HTTP method | ||
6 | * @param url URL of the HTTP request | ||
7 | * @param data body of the HTTP request (optional) | ||
8 | * @param data_size length of the body | ||
9 | * @param proc callback function for the result | ||
10 | * @param proc_cls closure for @a proc | ||
11 | * @return #GNUNET_OK if request accepted | ||
12 | */ | ||
13 | enum GNUNET_GenericReturnValue | ||
14 | REST_gns_process_request (void *plugin, | ||
15 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
16 | GNUNET_REST_ResultProcessor proc, | ||
17 | void *proc_cls); | ||
18 | |||
19 | /** | ||
20 | * Entry point for the plugin. | ||
21 | * | ||
22 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | ||
23 | * @return NULL on error, otherwise the plugin context | ||
24 | */ | ||
25 | void* | ||
26 | REST_gns_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Exit point from the plugin. | ||
31 | * | ||
32 | * @param cls the plugin context (as returned by "init") | ||
33 | * @return always NULL | ||
34 | */ | ||
35 | void | ||
36 | REST_gns_done (struct GNUNET_REST_Plugin *api); | ||
diff --git a/src/service/rest/gnunet-rest-server.c b/src/service/rest/gnunet-rest-server.c index 5163c2271..ce81704ae 100644 --- a/src/service/rest/gnunet-rest-server.c +++ b/src/service/rest/gnunet-rest-server.c | |||
@@ -29,6 +29,16 @@ | |||
29 | #include "gnunet_rest_plugin.h" | 29 | #include "gnunet_rest_plugin.h" |
30 | #include "gnunet_mhd_compat.h" | 30 | #include "gnunet_mhd_compat.h" |
31 | 31 | ||
32 | #include "config_plugin.h" | ||
33 | #include "copying_plugin.h" | ||
34 | #include "identity_plugin.h" | ||
35 | #include "namestore_plugin.h" | ||
36 | #include "gns_plugin.h" | ||
37 | #ifdef HAVE_JOSE | ||
38 | #include "openid_plugin.h" | ||
39 | #endif | ||
40 | #include "reclaim_plugin.h" | ||
41 | |||
32 | /** | 42 | /** |
33 | * Default Socks5 listen port. | 43 | * Default Socks5 listen port. |
34 | */ | 44 | */ |
@@ -54,7 +64,7 @@ | |||
54 | * After how long do we clean up unused MHD SSL/TLS instances? | 64 | * After how long do we clean up unused MHD SSL/TLS instances? |
55 | */ | 65 | */ |
56 | #define MHD_CACHE_TIMEOUT \ | 66 | #define MHD_CACHE_TIMEOUT \ |
57 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | 67 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) |
58 | 68 | ||
59 | #define GN_REST_STATE_INIT 0 | 69 | #define GN_REST_STATE_INIT 0 |
60 | #define GN_REST_STATE_PROCESSING 1 | 70 | #define GN_REST_STATE_PROCESSING 1 |
@@ -178,7 +188,12 @@ struct PluginListEntry | |||
178 | /** | 188 | /** |
179 | * The plugin | 189 | * The plugin |
180 | */ | 190 | */ |
181 | struct GNUNET_REST_Plugin *plugin; | 191 | void *plugin; |
192 | |||
193 | /** | ||
194 | * Request function | ||
195 | */ | ||
196 | GNUNET_REST_ProcessingFunction process_request; | ||
182 | }; | 197 | }; |
183 | 198 | ||
184 | /** | 199 | /** |
@@ -240,6 +255,21 @@ static struct AcceptedRequest *req_list_head; | |||
240 | */ | 255 | */ |
241 | static struct AcceptedRequest *req_list_tail; | 256 | static struct AcceptedRequest *req_list_tail; |
242 | 257 | ||
258 | |||
259 | /** | ||
260 | * plugins | ||
261 | */ | ||
262 | |||
263 | struct GNUNET_REST_Plugin *config_plugin; | ||
264 | struct GNUNET_REST_Plugin *copying_plugin; | ||
265 | struct GNUNET_REST_Plugin *identity_plugin; | ||
266 | struct GNUNET_REST_Plugin *namestore_plugin; | ||
267 | struct GNUNET_REST_Plugin *gns_plugin; | ||
268 | #ifdef HAVE_JOSE | ||
269 | struct GNUNET_REST_Plugin *openid_plugin; | ||
270 | #endif | ||
271 | struct GNUNET_REST_Plugin *reclaim_plugin; | ||
272 | |||
243 | /* ************************* Global helpers ********************* */ | 273 | /* ************************* Global helpers ********************* */ |
244 | 274 | ||
245 | 275 | ||
@@ -294,6 +324,7 @@ cleanup_url_map (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
294 | return GNUNET_YES; | 324 | return GNUNET_YES; |
295 | } | 325 | } |
296 | 326 | ||
327 | |||
297 | static void | 328 | static void |
298 | cleanup_handle (struct MhdConnectionHandle *handle) | 329 | cleanup_handle (struct MhdConnectionHandle *handle) |
299 | { | 330 | { |
@@ -323,6 +354,7 @@ cleanup_handle (struct MhdConnectionHandle *handle) | |||
323 | GNUNET_free (handle); | 354 | GNUNET_free (handle); |
324 | } | 355 | } |
325 | 356 | ||
357 | |||
326 | static void | 358 | static void |
327 | cleanup_ar (struct AcceptedRequest *ar) | 359 | cleanup_ar (struct AcceptedRequest *ar) |
328 | { | 360 | { |
@@ -334,7 +366,8 @@ cleanup_ar (struct AcceptedRequest *ar) | |||
334 | { | 366 | { |
335 | GNUNET_NETWORK_socket_free_memory_only_ (ar->sock); | 367 | GNUNET_NETWORK_socket_free_memory_only_ (ar->sock); |
336 | } | 368 | } |
337 | else { | 369 | else |
370 | { | ||
338 | GNUNET_NETWORK_socket_close (ar->sock); | 371 | GNUNET_NETWORK_socket_close (ar->sock); |
339 | } | 372 | } |
340 | ar->sock = NULL; | 373 | ar->sock = NULL; |
@@ -344,6 +377,7 @@ cleanup_ar (struct AcceptedRequest *ar) | |||
344 | GNUNET_free (ar); | 377 | GNUNET_free (ar); |
345 | } | 378 | } |
346 | 379 | ||
380 | |||
347 | static int | 381 | static int |
348 | header_iterator (void *cls, | 382 | header_iterator (void *cls, |
349 | enum MHD_ValueKind kind, | 383 | enum MHD_ValueKind kind, |
@@ -561,9 +595,10 @@ create_response (void *cls, | |||
561 | con_handle->state = GN_REST_STATE_PROCESSING; | 595 | con_handle->state = GN_REST_STATE_PROCESSING; |
562 | for (ple = plugins_head; NULL != ple; ple = ple->next) | 596 | for (ple = plugins_head; NULL != ple; ple = ple->next) |
563 | { | 597 | { |
564 | if (GNUNET_YES == ple->plugin->process_request (rest_conndata_handle, | 598 | if (GNUNET_YES == ple->process_request (ple->plugin, |
565 | &plugin_callback, | 599 | rest_conndata_handle, |
566 | con_handle)) | 600 | &plugin_callback, |
601 | con_handle)) | ||
567 | break; /* Request handled */ | 602 | break; /* Request handled */ |
568 | } | 603 | } |
569 | if (NULL == ple) | 604 | if (NULL == ple) |
@@ -603,8 +638,8 @@ create_response (void *cls, | |||
603 | strlen ("chrome-extension://")))) | 638 | strlen ("chrome-extension://")))) |
604 | { | 639 | { |
605 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, | 640 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, |
606 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, | 641 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, |
607 | origin)); | 642 | origin)); |
608 | } | 643 | } |
609 | } | 644 | } |
610 | if (NULL != allow_origins) | 645 | if (NULL != allow_origins) |
@@ -615,9 +650,10 @@ create_response (void *cls, | |||
615 | { | 650 | { |
616 | if (0 == strncmp (allow_origin, origin, strlen (allow_origin))) | 651 | if (0 == strncmp (allow_origin, origin, strlen (allow_origin))) |
617 | { | 652 | { |
618 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, | 653 | GNUNET_assert (MHD_NO != MHD_add_response_header ( |
619 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, | 654 | con_handle->response, |
620 | allow_origin)); | 655 | MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, |
656 | allow_origin)); | ||
621 | break; | 657 | break; |
622 | } | 658 | } |
623 | allow_origin = strtok (NULL, ","); | 659 | allow_origin = strtok (NULL, ","); |
@@ -628,14 +664,14 @@ create_response (void *cls, | |||
628 | if (NULL != allow_credentials) | 664 | if (NULL != allow_credentials) |
629 | { | 665 | { |
630 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, | 666 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, |
631 | "Access-Control-Allow-Credentials", | 667 | "Access-Control-Allow-Credentials", |
632 | allow_credentials)); | 668 | allow_credentials)); |
633 | } | 669 | } |
634 | if (NULL != allow_headers) | 670 | if (NULL != allow_headers) |
635 | { | 671 | { |
636 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, | 672 | GNUNET_assert (MHD_NO != MHD_add_response_header (con_handle->response, |
637 | "Access-Control-Allow-Headers", | 673 | "Access-Control-Allow-Headers", |
638 | allow_headers)); | 674 | allow_headers)); |
639 | } | 675 | } |
640 | run_mhd_now (); | 676 | run_mhd_now (); |
641 | { | 677 | { |
@@ -757,6 +793,7 @@ schedule_httpd () | |||
757 | GNUNET_NETWORK_fdset_destroy (wws); | 793 | GNUNET_NETWORK_fdset_destroy (wws); |
758 | } | 794 | } |
759 | 795 | ||
796 | |||
760 | /** | 797 | /** |
761 | * Function called when MHD first processes an incoming connection. | 798 | * Function called when MHD first processes an incoming connection. |
762 | * Gives us the respective URI information. | 799 | * Gives us the respective URI information. |
@@ -791,7 +828,6 @@ mhd_log_callback (void *cls, | |||
791 | } | 828 | } |
792 | 829 | ||
793 | 830 | ||
794 | |||
795 | /** | 831 | /** |
796 | * Function called when MHD decides that we are done with a connection. | 832 | * Function called when MHD decides that we are done with a connection. |
797 | * | 833 | * |
@@ -823,6 +859,7 @@ mhd_completed_cb (void *cls, | |||
823 | *con_cls = NULL; | 859 | *con_cls = NULL; |
824 | } | 860 | } |
825 | 861 | ||
862 | |||
826 | /** | 863 | /** |
827 | * Function called when MHD connection is opened or closed. | 864 | * Function called when MHD connection is opened or closed. |
828 | * | 865 | * |
@@ -886,7 +923,6 @@ mhd_connection_cb (void *cls, | |||
886 | } | 923 | } |
887 | 924 | ||
888 | 925 | ||
889 | |||
890 | /** | 926 | /** |
891 | * Task run whenever HTTP server operations are pending. | 927 | * Task run whenever HTTP server operations are pending. |
892 | * | 928 | * |
@@ -977,10 +1013,17 @@ do_shutdown (void *cls) | |||
977 | GNUNET_CONTAINER_DLL_remove (plugins_head, | 1013 | GNUNET_CONTAINER_DLL_remove (plugins_head, |
978 | plugins_tail, | 1014 | plugins_tail, |
979 | ple); | 1015 | ple); |
980 | GNUNET_PLUGIN_unload (ple->libname, ple->plugin); | ||
981 | GNUNET_free (ple->libname); | 1016 | GNUNET_free (ple->libname); |
982 | GNUNET_free (ple); | 1017 | GNUNET_free (ple); |
983 | } | 1018 | } |
1019 | REST_config_done (config_plugin); | ||
1020 | REST_copying_done (copying_plugin); | ||
1021 | REST_identity_done (identity_plugin); | ||
1022 | REST_gns_done (gns_plugin); | ||
1023 | #ifdef HAVE_JOSE | ||
1024 | REST_openid_done (openid_plugin); | ||
1025 | #endif | ||
1026 | REST_reclaim_done (reclaim_plugin); | ||
984 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); | 1027 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); |
985 | kill_httpd (); | 1028 | kill_httpd (); |
986 | GNUNET_free (allow_credentials); | 1029 | GNUNET_free (allow_credentials); |
@@ -1065,28 +1108,30 @@ bind_v6 () | |||
1065 | * @param libname the name of the library loaded | 1108 | * @param libname the name of the library loaded |
1066 | * @param lib_ret the object returned by the plugin initializer | 1109 | * @param lib_ret the object returned by the plugin initializer |
1067 | */ | 1110 | */ |
1068 | static void | 1111 | static enum GNUNET_GenericReturnValue |
1069 | load_plugin (void *cls, const char *libname, void *lib_ret) | 1112 | setup_plugin (const char *name, |
1113 | GNUNET_REST_ProcessingFunction proc, | ||
1114 | void *plugin_cls) | ||
1070 | { | 1115 | { |
1071 | struct GNUNET_REST_Plugin *plugin = lib_ret; | ||
1072 | struct PluginListEntry *ple; | 1116 | struct PluginListEntry *ple; |
1073 | 1117 | ||
1074 | if (NULL == lib_ret) | 1118 | if (NULL == plugin_cls) |
1075 | { | 1119 | { |
1076 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1077 | "Could not load plugin `%s'\n", | 1121 | "Could not load plugin\n"); |
1078 | libname); | 1122 | return GNUNET_SYSERR; |
1079 | return; | ||
1080 | } | 1123 | } |
1081 | GNUNET_assert (1 < strlen (plugin->name)); | 1124 | GNUNET_assert (1 < strlen (name)); |
1082 | GNUNET_assert ('/' == *plugin->name); | 1125 | GNUNET_assert ('/' == *name); |
1083 | ple = GNUNET_new (struct PluginListEntry); | 1126 | ple = GNUNET_new (struct PluginListEntry); |
1084 | ple->libname = GNUNET_strdup (libname); | 1127 | ple->libname = GNUNET_strdup (name); |
1085 | ple->plugin = plugin; | 1128 | ple->plugin = plugin_cls; |
1129 | ple->process_request = proc; | ||
1086 | GNUNET_CONTAINER_DLL_insert (plugins_head, | 1130 | GNUNET_CONTAINER_DLL_insert (plugins_head, |
1087 | plugins_tail, | 1131 | plugins_tail, |
1088 | ple); | 1132 | ple); |
1089 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded plugin `%s'\n", libname); | 1133 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded plugin `%s'\n", name); |
1134 | return GNUNET_OK; | ||
1090 | } | 1135 | } |
1091 | 1136 | ||
1092 | 1137 | ||
@@ -1201,7 +1246,8 @@ run (void *cls, | |||
1201 | memset (basic_auth_secret_tmp, 0, 16); | 1246 | memset (basic_auth_secret_tmp, 0, 16); |
1202 | if (GNUNET_SYSERR == GNUNET_DISK_fn_read (basic_auth_file, | 1247 | if (GNUNET_SYSERR == GNUNET_DISK_fn_read (basic_auth_file, |
1203 | basic_auth_secret_tmp, | 1248 | basic_auth_secret_tmp, |
1204 | sizeof (basic_auth_secret_tmp) - 1)) | 1249 | sizeof (basic_auth_secret_tmp) |
1250 | - 1)) | ||
1205 | { | 1251 | { |
1206 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1252 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1207 | "Unable to read basic auth secret file.\n"); | 1253 | "Unable to read basic auth secret file.\n"); |
@@ -1330,12 +1376,45 @@ run (void *cls, | |||
1330 | GNUNET_SCHEDULER_shutdown (); | 1376 | GNUNET_SCHEDULER_shutdown (); |
1331 | return; | 1377 | return; |
1332 | } | 1378 | } |
1333 | /* Load plugins */ | 1379 | /* Load plugins */ |
1334 | GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (), | 1380 | // FIXME: Use per-plugin rest plugin structs |
1335 | "libgnunet_plugin_rest", | 1381 | struct GNUNET_REST_Plugin *config_plugin = REST_config_init (cfg); |
1336 | (void *) cfg, | 1382 | if (GNUNET_OK != setup_plugin (config_plugin->name, &REST_config_process_request, config_plugin)) |
1337 | &load_plugin, | 1383 | { |
1338 | NULL); | 1384 | GNUNET_SCHEDULER_shutdown (); |
1385 | } | ||
1386 | struct GNUNET_REST_Plugin *copying_plugin = REST_copying_init (cfg); | ||
1387 | if (GNUNET_OK != setup_plugin (copying_plugin->name, &REST_copying_process_request, copying_plugin)) | ||
1388 | { | ||
1389 | GNUNET_SCHEDULER_shutdown (); | ||
1390 | } | ||
1391 | struct GNUNET_REST_Plugin *identity_plugin = REST_identity_init (cfg); | ||
1392 | if (GNUNET_OK != setup_plugin (identity_plugin->name, &REST_identity_process_request, identity_plugin)) | ||
1393 | { | ||
1394 | GNUNET_SCHEDULER_shutdown (); | ||
1395 | } | ||
1396 | struct GNUNET_REST_Plugin *namestore_plugin = REST_namestore_init (cfg); | ||
1397 | if (GNUNET_OK != setup_plugin (namestore_plugin->name, &REST_namestore_process_request, namestore_plugin)) | ||
1398 | { | ||
1399 | GNUNET_SCHEDULER_shutdown (); | ||
1400 | } | ||
1401 | struct GNUNET_REST_Plugin *gns_plugin = REST_gns_init (cfg); | ||
1402 | if (GNUNET_OK != setup_plugin (gns_plugin->name, &REST_gns_process_request, gns_plugin)) | ||
1403 | { | ||
1404 | GNUNET_SCHEDULER_shutdown (); | ||
1405 | } | ||
1406 | #ifdef HAVE_JOSE | ||
1407 | struct GNUNET_REST_Plugin *openid_plugin = REST_openid_init (cfg); | ||
1408 | if (GNUNET_OK != setup_plugin (openid_plugin->name, &REST_openid_process_request, openid_plugin)) | ||
1409 | { | ||
1410 | GNUNET_SCHEDULER_shutdown (); | ||
1411 | } | ||
1412 | #endif | ||
1413 | struct GNUNET_REST_Plugin *reclaim_plugin = REST_reclaim_init (cfg); | ||
1414 | if (GNUNET_OK != setup_plugin (reclaim_plugin->name, &REST_reclaim_process_request, reclaim_plugin)) | ||
1415 | { | ||
1416 | GNUNET_SCHEDULER_shutdown (); | ||
1417 | } | ||
1339 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 1418 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
1340 | } | 1419 | } |
1341 | 1420 | ||
diff --git a/src/rest-plugin/identity/plugin_rest_identity.c b/src/service/rest/identity_plugin.c index e7b7f8a9c..f6c9dd792 100644 --- a/src/rest-plugin/identity/plugin_rest_identity.c +++ b/src/service/rest/identity_plugin.c | |||
@@ -106,7 +106,7 @@ | |||
106 | /** | 106 | /** |
107 | * The configuration handle | 107 | * The configuration handle |
108 | */ | 108 | */ |
109 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 109 | const struct GNUNET_CONFIGURATION_Handle *id_cfg; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * HTTP methods allows for this plugin | 112 | * HTTP methods allows for this plugin |
@@ -921,6 +921,7 @@ ego_delete_name (struct GNUNET_REST_RequestHandle *con_handle, | |||
921 | handle); | 921 | handle); |
922 | } | 922 | } |
923 | 923 | ||
924 | |||
924 | struct ego_sign_data_cls | 925 | struct ego_sign_data_cls |
925 | { | 926 | { |
926 | void *data; | 927 | void *data; |
@@ -952,10 +953,10 @@ ego_sign_data_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
952 | return; | 953 | return; |
953 | } | 954 | } |
954 | 955 | ||
955 | if ( GNUNET_OK != GNUNET_CRYPTO_eddsa_sign_raw (&(ego->pk.eddsa_key), | 956 | if (GNUNET_OK != GNUNET_CRYPTO_eddsa_sign_raw (&(ego->pk.eddsa_key), |
956 | (void *) data, | 957 | (void *) data, |
957 | strlen ( (char*) data), | 958 | strlen ( (char*) data), |
958 | &sig)) | 959 | &sig)) |
959 | { | 960 | { |
960 | handle->ec = GNUNET_EC_UNKNOWN; | 961 | handle->ec = GNUNET_EC_UNKNOWN; |
961 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 962 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
@@ -980,6 +981,7 @@ ego_sign_data_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
980 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 981 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
981 | } | 982 | } |
982 | 983 | ||
984 | |||
983 | /** | 985 | /** |
984 | * | 986 | * |
985 | * @param con_handle the connection handle | 987 | * @param con_handle the connection handle |
@@ -1030,12 +1032,13 @@ ego_sign_data (struct GNUNET_REST_RequestHandle *con_handle, | |||
1030 | cls2->data = (void *) GNUNET_strdup (data); | 1032 | cls2->data = (void *) GNUNET_strdup (data); |
1031 | cls2->handle = handle; | 1033 | cls2->handle = handle; |
1032 | 1034 | ||
1033 | GNUNET_IDENTITY_ego_lookup (cfg, | 1035 | GNUNET_IDENTITY_ego_lookup (id_cfg, |
1034 | username, | 1036 | username, |
1035 | ego_sign_data_cb, | 1037 | ego_sign_data_cb, |
1036 | cls2); | 1038 | cls2); |
1037 | } | 1039 | } |
1038 | 1040 | ||
1041 | |||
1039 | /** | 1042 | /** |
1040 | * Respond to OPTIONS request | 1043 | * Respond to OPTIONS request |
1041 | * | 1044 | * |
@@ -1155,10 +1158,11 @@ list_ego (void *cls, | |||
1155 | * @param proc_cls closure for callback function | 1158 | * @param proc_cls closure for callback function |
1156 | * @return GNUNET_OK if request accepted | 1159 | * @return GNUNET_OK if request accepted |
1157 | */ | 1160 | */ |
1158 | static enum GNUNET_GenericReturnValue | 1161 | enum GNUNET_GenericReturnValue |
1159 | rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | 1162 | REST_identity_process_request (void* plugin, |
1160 | GNUNET_REST_ResultProcessor proc, | 1163 | struct GNUNET_REST_RequestHandle *rest_handle, |
1161 | void *proc_cls) | 1164 | GNUNET_REST_ResultProcessor proc, |
1165 | void *proc_cls) | ||
1162 | { | 1166 | { |
1163 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 1167 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); |
1164 | struct GNUNET_REST_RequestHandlerError err; | 1168 | struct GNUNET_REST_RequestHandlerError err; |
@@ -1218,20 +1222,19 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
1218 | * @return NULL on error, otherwise the plugin context | 1222 | * @return NULL on error, otherwise the plugin context |
1219 | */ | 1223 | */ |
1220 | void * | 1224 | void * |
1221 | libgnunet_plugin_rest_identity_init (void *cls) | 1225 | REST_identity_init (const struct GNUNET_CONFIGURATION_Handle *c) |
1222 | { | 1226 | { |
1223 | static struct Plugin plugin; | 1227 | static struct Plugin plugin; |
1224 | struct GNUNET_REST_Plugin *api; | 1228 | struct GNUNET_REST_Plugin *api; |
1225 | 1229 | ||
1226 | cfg = cls; | 1230 | id_cfg = c; |
1227 | if (NULL != plugin.cfg) | 1231 | if (NULL != plugin.cfg) |
1228 | return NULL; /* can only initialize once! */ | 1232 | return NULL; /* can only initialize once! */ |
1229 | memset (&plugin, 0, sizeof(struct Plugin)); | 1233 | memset (&plugin, 0, sizeof(struct Plugin)); |
1230 | plugin.cfg = cfg; | 1234 | plugin.cfg = c; |
1231 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 1235 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
1232 | api->cls = &plugin; | 1236 | api->cls = &plugin; |
1233 | api->name = GNUNET_REST_API_NS_IDENTITY; | 1237 | api->name = GNUNET_REST_API_NS_IDENTITY; |
1234 | api->process_request = &rest_process_request; | ||
1235 | GNUNET_asprintf (&allow_methods, | 1238 | GNUNET_asprintf (&allow_methods, |
1236 | "%s, %s, %s, %s, %s", | 1239 | "%s, %s, %s, %s, %s", |
1237 | MHD_HTTP_METHOD_GET, | 1240 | MHD_HTTP_METHOD_GET, |
@@ -1240,7 +1243,7 @@ libgnunet_plugin_rest_identity_init (void *cls) | |||
1240 | MHD_HTTP_METHOD_DELETE, | 1243 | MHD_HTTP_METHOD_DELETE, |
1241 | MHD_HTTP_METHOD_OPTIONS); | 1244 | MHD_HTTP_METHOD_OPTIONS); |
1242 | state = ID_REST_STATE_INIT; | 1245 | state = ID_REST_STATE_INIT; |
1243 | identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL); | 1246 | identity_handle = GNUNET_IDENTITY_connect (id_cfg, &list_ego, NULL); |
1244 | 1247 | ||
1245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Identity REST API initialized\n")); | 1248 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Identity REST API initialized\n")); |
1246 | return api; | 1249 | return api; |
@@ -1253,10 +1256,9 @@ libgnunet_plugin_rest_identity_init (void *cls) | |||
1253 | * @param cls the plugin context (as returned by "init") | 1256 | * @param cls the plugin context (as returned by "init") |
1254 | * @return always NULL | 1257 | * @return always NULL |
1255 | */ | 1258 | */ |
1256 | void * | 1259 | void |
1257 | libgnunet_plugin_rest_identity_done (void *cls) | 1260 | REST_identity_done (struct GNUNET_REST_Plugin *api) |
1258 | { | 1261 | { |
1259 | struct GNUNET_REST_Plugin *api = cls; | ||
1260 | struct Plugin *plugin = api->cls; | 1262 | struct Plugin *plugin = api->cls; |
1261 | struct EgoEntry *ego_entry; | 1263 | struct EgoEntry *ego_entry; |
1262 | struct EgoEntry *ego_tmp; | 1264 | struct EgoEntry *ego_tmp; |
@@ -1279,7 +1281,6 @@ libgnunet_plugin_rest_identity_done (void *cls) | |||
1279 | GNUNET_free (allow_methods); | 1281 | GNUNET_free (allow_methods); |
1280 | GNUNET_free (api); | 1282 | GNUNET_free (api); |
1281 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Identity REST plugin is finished\n"); | 1283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Identity REST plugin is finished\n"); |
1282 | return NULL; | ||
1283 | } | 1284 | } |
1284 | 1285 | ||
1285 | 1286 | ||
diff --git a/src/service/rest/identity_plugin.h b/src/service/rest/identity_plugin.h new file mode 100644 index 000000000..0886156c1 --- /dev/null +++ b/src/service/rest/identity_plugin.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "gnunet_rest_plugin.h" | ||
2 | /** | ||
3 | * Function processing the REST call | ||
4 | * | ||
5 | * @param method HTTP method | ||
6 | * @param url URL of the HTTP request | ||
7 | * @param data body of the HTTP request (optional) | ||
8 | * @param data_size length of the body | ||
9 | * @param proc callback function for the result | ||
10 | * @param proc_cls closure for @a proc | ||
11 | * @return #GNUNET_OK if request accepted | ||
12 | */ | ||
13 | enum GNUNET_GenericReturnValue | ||
14 | REST_identity_process_request (void *plugin, | ||
15 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
16 | GNUNET_REST_ResultProcessor proc, | ||
17 | void *proc_cls); | ||
18 | |||
19 | /** | ||
20 | * Entry point for the plugin. | ||
21 | * | ||
22 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | ||
23 | * @return NULL on error, otherwise the plugin context | ||
24 | */ | ||
25 | void* | ||
26 | REST_identity_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Exit point from the plugin. | ||
31 | * | ||
32 | * @param cls the plugin context (as returned by "init") | ||
33 | * @return always NULL | ||
34 | */ | ||
35 | void | ||
36 | REST_identity_done (struct GNUNET_REST_Plugin *api); | ||
diff --git a/src/rest-plugin/reclaim/json_reclaim.c b/src/service/rest/json_reclaim.c index b1ca7a4a5..b1ca7a4a5 100644 --- a/src/rest-plugin/reclaim/json_reclaim.c +++ b/src/service/rest/json_reclaim.c | |||
diff --git a/src/rest-plugin/reclaim/json_reclaim.h b/src/service/rest/json_reclaim.h index 613ddf873..613ddf873 100644 --- a/src/rest-plugin/reclaim/json_reclaim.h +++ b/src/service/rest/json_reclaim.h | |||
diff --git a/src/service/rest/meson.build b/src/service/rest/meson.build index 316724fdb..347cbb852 100644 --- a/src/service/rest/meson.build +++ b/src/service/rest/meson.build | |||
@@ -1,6 +1,16 @@ | |||
1 | libgnunetrest_src = ['rest.c'] | 1 | libgnunetrest_src = ['rest.c'] |
2 | 2 | ||
3 | gnunetservicerest_src = ['gnunet-rest-server.c'] | 3 | gnunetservicerest_src = ['gnunet-rest-server.c', |
4 | 'config_plugin.c', | ||
5 | 'copying_plugin.c', | ||
6 | 'identity_plugin.c', | ||
7 | 'namestore_plugin.c', | ||
8 | 'gns_plugin.c', | ||
9 | 'openid_plugin.c', | ||
10 | 'oidc_helper.c', | ||
11 | 'json_reclaim.c', | ||
12 | 'reclaim_plugin.c', | ||
13 | ] | ||
4 | 14 | ||
5 | configure_file(input : 'rest.conf', | 15 | configure_file(input : 'rest.conf', |
6 | output : 'rest.conf', | 16 | output : 'rest.conf', |
@@ -30,7 +40,19 @@ libgnunetrest_dep = declare_dependency(link_with : libgnunetrest) | |||
30 | 40 | ||
31 | executable ('gnunet-rest-server', | 41 | executable ('gnunet-rest-server', |
32 | gnunetservicerest_src, | 42 | gnunetservicerest_src, |
33 | dependencies: [libgnunetrest_dep, libgnunetutil_dep, mhd_dep], | 43 | dependencies: [libgnunetrest_dep, |
44 | libgnunetutil_dep, | ||
45 | libgnunetidentity_dep, | ||
46 | libgnunetgns_dep, | ||
47 | libgnunetreclaim_dep, | ||
48 | libgnunetnamestore_dep, | ||
49 | libgnunetjson_dep, | ||
50 | libgnunetgnsrecord_dep, | ||
51 | libgnunetgnsrecordjson_dep, | ||
52 | json_dep, | ||
53 | jose_dep, | ||
54 | gcrypt_dep, | ||
55 | mhd_dep], | ||
34 | include_directories: [incdir, configuration_inc], | 56 | include_directories: [incdir, configuration_inc], |
35 | install: true, | 57 | install: true, |
36 | install_dir: get_option('libdir') / 'gnunet' / 'libexec') | 58 | install_dir: get_option('libdir') / 'gnunet' / 'libexec') |
diff --git a/src/plugin/namestore/plugin_rest_namestore.c b/src/service/rest/namestore_plugin.c index 31e78e6dd..8c5b8b824 100644 --- a/src/plugin/namestore/plugin_rest_namestore.c +++ b/src/service/rest/namestore_plugin.c | |||
@@ -57,7 +57,7 @@ | |||
57 | /** | 57 | /** |
58 | * The configuration handle | 58 | * The configuration handle |
59 | */ | 59 | */ |
60 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 60 | const struct GNUNET_CONFIGURATION_Handle *ns_cfg; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * HTTP methods allows for this plugin | 63 | * HTTP methods allows for this plugin |
@@ -333,7 +333,7 @@ do_error (void *cls) | |||
333 | struct MHD_Response *resp; | 333 | struct MHD_Response *resp; |
334 | json_t *json_error = json_object (); | 334 | json_t *json_error = json_object (); |
335 | char *response; | 335 | char *response; |
336 | const char* emsg; | 336 | const char*emsg; |
337 | int response_code; | 337 | int response_code; |
338 | 338 | ||
339 | emsg = GNUNET_ErrorCode_get_hint (handle->ec); | 339 | emsg = GNUNET_ErrorCode_get_hint (handle->ec); |
@@ -788,6 +788,7 @@ import_next_cb (void *cls, enum GNUNET_ErrorCode ec) | |||
788 | handle->rd_set_pos += sent_rds; | 788 | handle->rd_set_pos += sent_rds; |
789 | } | 789 | } |
790 | 790 | ||
791 | |||
791 | static void | 792 | static void |
792 | bulk_tx_start (void *cls, enum GNUNET_ErrorCode ec) | 793 | bulk_tx_start (void *cls, enum GNUNET_ErrorCode ec) |
793 | { | 794 | { |
@@ -920,7 +921,7 @@ namestore_import (struct GNUNET_REST_RequestHandle *con_handle, | |||
920 | handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 921 | handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
921 | 922 | ||
922 | // We need a per-client connection for a transactional bulk import | 923 | // We need a per-client connection for a transactional bulk import |
923 | handle->nc = GNUNET_NAMESTORE_connect (cfg); | 924 | handle->nc = GNUNET_NAMESTORE_connect (ns_cfg); |
924 | if (NULL == handle->nc) | 925 | if (NULL == handle->nc) |
925 | { | 926 | { |
926 | handle->ec = GNUNET_EC_NAMESTORE_UNKNOWN; | 927 | handle->ec = GNUNET_EC_NAMESTORE_UNKNOWN; |
@@ -932,6 +933,7 @@ namestore_import (struct GNUNET_REST_RequestHandle *con_handle, | |||
932 | handle); | 933 | handle); |
933 | } | 934 | } |
934 | 935 | ||
936 | |||
935 | /** | 937 | /** |
936 | * Handle namestore POST/PUT request | 938 | * Handle namestore POST/PUT request |
937 | * | 939 | * |
@@ -1238,10 +1240,11 @@ list_ego (void *cls, | |||
1238 | * @param proc_cls closure for callback function | 1240 | * @param proc_cls closure for callback function |
1239 | * @return GNUNET_OK if request accepted | 1241 | * @return GNUNET_OK if request accepted |
1240 | */ | 1242 | */ |
1241 | static enum GNUNET_GenericReturnValue | 1243 | enum GNUNET_GenericReturnValue |
1242 | rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | 1244 | REST_namestore_process_request (void *plugin, |
1243 | GNUNET_REST_ResultProcessor proc, | 1245 | struct GNUNET_REST_RequestHandle *rest_handle, |
1244 | void *proc_cls) | 1246 | GNUNET_REST_ResultProcessor proc, |
1247 | void *proc_cls) | ||
1245 | { | 1248 | { |
1246 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 1249 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); |
1247 | struct GNUNET_REST_RequestHandlerError err; | 1250 | struct GNUNET_REST_RequestHandlerError err; |
@@ -1291,20 +1294,19 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
1291 | * @return NULL on error, otherwise the plugin context | 1294 | * @return NULL on error, otherwise the plugin context |
1292 | */ | 1295 | */ |
1293 | void * | 1296 | void * |
1294 | libgnunet_plugin_rest_namestore_init (void *cls) | 1297 | REST_namestore_init (const struct GNUNET_CONFIGURATION_Handle *c) |
1295 | { | 1298 | { |
1296 | static struct Plugin plugin; | 1299 | static struct Plugin plugin; |
1297 | struct GNUNET_REST_Plugin *api; | 1300 | struct GNUNET_REST_Plugin *api; |
1298 | 1301 | ||
1299 | cfg = cls; | 1302 | ns_cfg = c; |
1300 | if (NULL != plugin.cfg) | 1303 | if (NULL != plugin.cfg) |
1301 | return NULL; /* can only initialize once! */ | 1304 | return NULL; /* can only initialize once! */ |
1302 | memset (&plugin, 0, sizeof(struct Plugin)); | 1305 | memset (&plugin, 0, sizeof(struct Plugin)); |
1303 | plugin.cfg = cfg; | 1306 | plugin.cfg = c; |
1304 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 1307 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
1305 | api->cls = &plugin; | 1308 | api->cls = &plugin; |
1306 | api->name = GNUNET_REST_API_NS_NAMESTORE; | 1309 | api->name = GNUNET_REST_API_NS_NAMESTORE; |
1307 | api->process_request = &rest_process_request; | ||
1308 | state = ID_REST_STATE_INIT; | 1310 | state = ID_REST_STATE_INIT; |
1309 | GNUNET_asprintf (&allow_methods, | 1311 | GNUNET_asprintf (&allow_methods, |
1310 | "%s, %s, %s, %s, %s", | 1312 | "%s, %s, %s, %s, %s", |
@@ -1313,8 +1315,8 @@ libgnunet_plugin_rest_namestore_init (void *cls) | |||
1313 | MHD_HTTP_METHOD_PUT, | 1315 | MHD_HTTP_METHOD_PUT, |
1314 | MHD_HTTP_METHOD_DELETE, | 1316 | MHD_HTTP_METHOD_DELETE, |
1315 | MHD_HTTP_METHOD_OPTIONS); | 1317 | MHD_HTTP_METHOD_OPTIONS); |
1316 | ns_handle = GNUNET_NAMESTORE_connect (cfg); | 1318 | ns_handle = GNUNET_NAMESTORE_connect (ns_cfg); |
1317 | identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL); | 1319 | identity_handle = GNUNET_IDENTITY_connect (ns_cfg, &list_ego, NULL); |
1318 | 1320 | ||
1319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ( | 1321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ( |
1320 | "Namestore REST API initialized\n")); | 1322 | "Namestore REST API initialized\n")); |
@@ -1328,10 +1330,9 @@ libgnunet_plugin_rest_namestore_init (void *cls) | |||
1328 | * @param cls the plugin context (as returned by "init") | 1330 | * @param cls the plugin context (as returned by "init") |
1329 | * @return always NULL | 1331 | * @return always NULL |
1330 | */ | 1332 | */ |
1331 | void * | 1333 | void |
1332 | libgnunet_plugin_rest_namestore_done (void *cls) | 1334 | REST_namestore_done (struct GNUNET_REST_Plugin *api) |
1333 | { | 1335 | { |
1334 | struct GNUNET_REST_Plugin *api = cls; | ||
1335 | struct Plugin *plugin = api->cls; | 1336 | struct Plugin *plugin = api->cls; |
1336 | struct RequestHandle *request; | 1337 | struct RequestHandle *request; |
1337 | struct EgoEntry *ego_entry; | 1338 | struct EgoEntry *ego_entry; |
@@ -1357,7 +1358,6 @@ libgnunet_plugin_rest_namestore_done (void *cls) | |||
1357 | GNUNET_free (allow_methods); | 1358 | GNUNET_free (allow_methods); |
1358 | GNUNET_free (api); | 1359 | GNUNET_free (api); |
1359 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore REST plugin is finished\n"); | 1360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore REST plugin is finished\n"); |
1360 | return NULL; | ||
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | 1363 | ||
diff --git a/src/service/rest/namestore_plugin.h b/src/service/rest/namestore_plugin.h new file mode 100644 index 000000000..2bdf77546 --- /dev/null +++ b/src/service/rest/namestore_plugin.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #include "gnunet_rest_plugin.h" | ||
2 | /** | ||
3 | * Function processing the REST call | ||
4 | * | ||
5 | * @param method HTTP method | ||
6 | * @param url URL of the HTTP request | ||
7 | * @param data body of the HTTP request (optional) | ||
8 | * @param data_size length of the body | ||
9 | * @param proc callback function for the result | ||
10 | * @param proc_cls closure for @a proc | ||
11 | * @return #GNUNET_OK if request accepted | ||
12 | */ | ||
13 | enum GNUNET_GenericReturnValue | ||
14 | REST_namestore_process_request (void *plugin, | ||
15 | struct GNUNET_REST_RequestHandle * | ||
16 | conndata_handle, | ||
17 | GNUNET_REST_ResultProcessor proc, | ||
18 | void *proc_cls); | ||
19 | |||
20 | /** | ||
21 | * Entry point for the plugin. | ||
22 | * | ||
23 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | ||
24 | * @return NULL on error, otherwise the plugin context | ||
25 | */ | ||
26 | void* | ||
27 | REST_namestore_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
28 | |||
29 | |||
30 | /** | ||
31 | * Exit point from the plugin. | ||
32 | * | ||
33 | * @param cls the plugin context (as returned by "init") | ||
34 | * @return always NULL | ||
35 | */ | ||
36 | void | ||
37 | REST_namestore_done (struct GNUNET_REST_Plugin *api); | ||
diff --git a/src/rest-plugin/reclaim/oidc_helper.c b/src/service/rest/oidc_helper.c index a2da7312b..a2da7312b 100644 --- a/src/rest-plugin/reclaim/oidc_helper.c +++ b/src/service/rest/oidc_helper.c | |||
diff --git a/src/rest-plugin/reclaim/oidc_helper.h b/src/service/rest/oidc_helper.h index de788fbdb..de788fbdb 100644 --- a/src/rest-plugin/reclaim/oidc_helper.h +++ b/src/service/rest/oidc_helper.h | |||
diff --git a/src/rest-plugin/reclaim/plugin_rest_openid_connect.c b/src/service/rest/openid_plugin.c index d0aee043e..a4f082d2a 100644 --- a/src/rest-plugin/reclaim/plugin_rest_openid_connect.c +++ b/src/service/rest/openid_plugin.c | |||
@@ -242,7 +242,7 @@ | |||
242 | * How long to wait for a consume in userinfo endpoint | 242 | * How long to wait for a consume in userinfo endpoint |
243 | */ | 243 | */ |
244 | #define CONSUME_TIMEOUT GNUNET_TIME_relative_multiply ( \ | 244 | #define CONSUME_TIMEOUT GNUNET_TIME_relative_multiply ( \ |
245 | GNUNET_TIME_UNIT_SECONDS,2) | 245 | GNUNET_TIME_UNIT_SECONDS,2) |
246 | 246 | ||
247 | /** | 247 | /** |
248 | * OIDC ignored parameter array | 248 | * OIDC ignored parameter array |
@@ -268,7 +268,7 @@ struct GNUNET_CONTAINER_MultiHashMap *OIDC_cookie_jar_map; | |||
268 | /** | 268 | /** |
269 | * The configuration handle | 269 | * The configuration handle |
270 | */ | 270 | */ |
271 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 271 | const struct GNUNET_CONFIGURATION_Handle *oid_cfg; |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * HTTP methods allows for this plugin | 274 | * HTTP methods allows for this plugin |
@@ -905,6 +905,7 @@ read_jwk_from_file (const char *filename) | |||
905 | return jwk; | 905 | return jwk; |
906 | } | 906 | } |
907 | 907 | ||
908 | |||
908 | /** | 909 | /** |
909 | * @brief Write the JWK to file. If unsuccessful emit warning | 910 | * @brief Write the JWK to file. If unsuccessful emit warning |
910 | * | 911 | * |
@@ -927,6 +928,7 @@ write_jwk_to_file (const char *filename, | |||
927 | return GNUNET_OK; | 928 | return GNUNET_OK; |
928 | } | 929 | } |
929 | 930 | ||
931 | |||
930 | /** | 932 | /** |
931 | * @brief Generate a new RSA JSON Web Key | 933 | * @brief Generate a new RSA JSON Web Key |
932 | * | 934 | * |
@@ -942,6 +944,7 @@ generate_jwk () | |||
942 | return jwk; | 944 | return jwk; |
943 | } | 945 | } |
944 | 946 | ||
947 | |||
945 | /** | 948 | /** |
946 | * Return the path to the oidc directory path | 949 | * Return the path to the oidc directory path |
947 | * | 950 | * |
@@ -954,7 +957,7 @@ get_oidc_dir_path (void *cls) | |||
954 | struct RequestHandle *handle = cls; | 957 | struct RequestHandle *handle = cls; |
955 | 958 | ||
956 | // Read OIDC directory from config | 959 | // Read OIDC directory from config |
957 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, | 960 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (oid_cfg, |
958 | "reclaim-rest-plugin", | 961 | "reclaim-rest-plugin", |
959 | "oidc_dir", | 962 | "oidc_dir", |
960 | &oidc_directory)) | 963 | &oidc_directory)) |
@@ -970,6 +973,7 @@ get_oidc_dir_path (void *cls) | |||
970 | return oidc_directory; | 973 | return oidc_directory; |
971 | } | 974 | } |
972 | 975 | ||
976 | |||
973 | /** | 977 | /** |
974 | * Return the path to the RSA JWK key file | 978 | * Return the path to the RSA JWK key file |
975 | * | 979 | * |
@@ -1004,7 +1008,7 @@ login_redirect (void *cls) | |||
1004 | struct GNUNET_Buffer buf = { 0 }; | 1008 | struct GNUNET_Buffer buf = { 0 }; |
1005 | struct RequestHandle *handle = cls; | 1009 | struct RequestHandle *handle = cls; |
1006 | 1010 | ||
1007 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, | 1011 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (oid_cfg, |
1008 | "reclaim-rest-plugin", | 1012 | "reclaim-rest-plugin", |
1009 | "address", | 1013 | "address", |
1010 | &login_base_url)) | 1014 | &login_base_url)) |
@@ -1451,8 +1455,8 @@ code_redirect (void *cls) | |||
1451 | { | 1455 | { |
1452 | if (GNUNET_OK != | 1456 | if (GNUNET_OK != |
1453 | GNUNET_CRYPTO_public_key_from_string (handle->oidc | 1457 | GNUNET_CRYPTO_public_key_from_string (handle->oidc |
1454 | ->login_identity, | 1458 | ->login_identity, |
1455 | &pubkey)) | 1459 | &pubkey)) |
1456 | { | 1460 | { |
1457 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); | 1461 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); |
1458 | handle->edesc = | 1462 | handle->edesc = |
@@ -1833,7 +1837,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1833 | 1837 | ||
1834 | if (GNUNET_OK != | 1838 | if (GNUNET_OK != |
1835 | GNUNET_CRYPTO_public_key_from_string (handle->oidc->client_id, | 1839 | GNUNET_CRYPTO_public_key_from_string (handle->oidc->client_id, |
1836 | &handle->oidc->client_pkey)) | 1840 | &handle->oidc->client_pkey)) |
1837 | { | 1841 | { |
1838 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); | 1842 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); |
1839 | handle->edesc = GNUNET_strdup ("The client is not authorized to request an " | 1843 | handle->edesc = GNUNET_strdup ("The client is not authorized to request an " |
@@ -1856,7 +1860,8 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1856 | } | 1860 | } |
1857 | } | 1861 | } |
1858 | if (NULL == handle->tld) | 1862 | if (NULL == handle->tld) |
1859 | GNUNET_CONFIGURATION_iterate_section_values (cfg, "gns", tld_iter, handle); | 1863 | GNUNET_CONFIGURATION_iterate_section_values (oid_cfg, "gns", tld_iter, |
1864 | handle); | ||
1860 | if (NULL == handle->tld) | 1865 | if (NULL == handle->tld) |
1861 | handle->tld = GNUNET_strdup (handle->oidc->client_id); | 1866 | handle->tld = GNUNET_strdup (handle->oidc->client_id); |
1862 | GNUNET_SCHEDULER_add_now (&build_authz_response, handle); | 1867 | GNUNET_SCHEDULER_add_now (&build_authz_response, handle); |
@@ -2085,7 +2090,7 @@ check_authorization (struct RequestHandle *handle, | |||
2085 | } | 2090 | } |
2086 | 2091 | ||
2087 | // check client password | 2092 | // check client password |
2088 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, | 2093 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (oid_cfg, |
2089 | "reclaim-rest-plugin", | 2094 | "reclaim-rest-plugin", |
2090 | "OIDC_CLIENT_HMAC_SECRET", | 2095 | "OIDC_CLIENT_HMAC_SECRET", |
2091 | &expected_pass)) | 2096 | &expected_pass)) |
@@ -2277,7 +2282,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2277 | GNUNET_free (code_verifier); | 2282 | GNUNET_free (code_verifier); |
2278 | 2283 | ||
2279 | // create jwt | 2284 | // create jwt |
2280 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, | 2285 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (oid_cfg, |
2281 | "reclaim-rest-plugin", | 2286 | "reclaim-rest-plugin", |
2282 | "expiration_time", | 2287 | "expiration_time", |
2283 | &expiration_time)) | 2288 | &expiration_time)) |
@@ -2295,7 +2300,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2295 | } | 2300 | } |
2296 | 2301 | ||
2297 | // Check if HMAC or RSA should be used | 2302 | // Check if HMAC or RSA should be used |
2298 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, | 2303 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (oid_cfg, |
2299 | "reclaim-rest-plugin", | 2304 | "reclaim-rest-plugin", |
2300 | "oidc_json_web_algorithm", | 2305 | "oidc_json_web_algorithm", |
2301 | &jwa)) | 2306 | &jwa)) |
@@ -2306,7 +2311,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2306 | jwa = JWT_ALG_VALUE_RSA; | 2311 | jwa = JWT_ALG_VALUE_RSA; |
2307 | } | 2312 | } |
2308 | 2313 | ||
2309 | if ( ! strcmp (jwa, JWT_ALG_VALUE_RSA)) | 2314 | if (! strcmp (jwa, JWT_ALG_VALUE_RSA)) |
2310 | { | 2315 | { |
2311 | // Replace for now | 2316 | // Replace for now |
2312 | oidc_jwk_path = get_oidc_jwk_path (cls); | 2317 | oidc_jwk_path = get_oidc_jwk_path (cls); |
@@ -2341,10 +2346,10 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2341 | (NULL != nonce) ? nonce : NULL, | 2346 | (NULL != nonce) ? nonce : NULL, |
2342 | oidc_jwk); | 2347 | oidc_jwk); |
2343 | } | 2348 | } |
2344 | else if ( ! strcmp (jwa, JWT_ALG_VALUE_HMAC)) | 2349 | else if (! strcmp (jwa, JWT_ALG_VALUE_HMAC)) |
2345 | { | 2350 | { |
2346 | // TODO OPTIONAL acr,amr,azp | 2351 | // TODO OPTIONAL acr,amr,azp |
2347 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, | 2352 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (oid_cfg, |
2348 | "reclaim-rest-plugin", | 2353 | "reclaim-rest-plugin", |
2349 | "jwt_secret", | 2354 | "jwt_secret", |
2350 | &jwt_secret)) | 2355 | &jwt_secret)) |
@@ -2708,6 +2713,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2708 | GNUNET_free (authorization); | 2713 | GNUNET_free (authorization); |
2709 | } | 2714 | } |
2710 | 2715 | ||
2716 | |||
2711 | /** | 2717 | /** |
2712 | * Responds to /jwks.json | 2718 | * Responds to /jwks.json |
2713 | * | 2719 | * |
@@ -2763,6 +2769,7 @@ jwks_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2763 | cleanup_handle (handle); | 2769 | cleanup_handle (handle); |
2764 | } | 2770 | } |
2765 | 2771 | ||
2772 | |||
2766 | /** | 2773 | /** |
2767 | * If listing is enabled, prints information about the egos. | 2774 | * If listing is enabled, prints information about the egos. |
2768 | * | 2775 | * |
@@ -2997,10 +3004,11 @@ oidc_config_cors (struct GNUNET_REST_RequestHandle *con_handle, | |||
2997 | } | 3004 | } |
2998 | 3005 | ||
2999 | 3006 | ||
3000 | static enum GNUNET_GenericReturnValue | 3007 | enum GNUNET_GenericReturnValue |
3001 | rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | 3008 | REST_openid_process_request (void *plugin, |
3002 | GNUNET_REST_ResultProcessor proc, | 3009 | struct GNUNET_REST_RequestHandle *rest_handle, |
3003 | void *proc_cls) | 3010 | GNUNET_REST_ResultProcessor proc, |
3011 | void *proc_cls) | ||
3004 | { | 3012 | { |
3005 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 3013 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); |
3006 | struct GNUNET_REST_RequestHandlerError err; | 3014 | struct GNUNET_REST_RequestHandlerError err; |
@@ -3056,24 +3064,23 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
3056 | * @return NULL on error, otherwise the plugin context | 3064 | * @return NULL on error, otherwise the plugin context |
3057 | */ | 3065 | */ |
3058 | void * | 3066 | void * |
3059 | libgnunet_plugin_rest_openid_connect_init (void *cls) | 3067 | REST_openid_init (const struct GNUNET_CONFIGURATION_Handle *c) |
3060 | { | 3068 | { |
3061 | static struct Plugin plugin; | 3069 | static struct Plugin plugin; |
3062 | struct GNUNET_REST_Plugin *api; | 3070 | struct GNUNET_REST_Plugin *api; |
3063 | 3071 | ||
3064 | cfg = cls; | 3072 | oid_cfg = c; |
3065 | if (NULL != plugin.cfg) | 3073 | if (NULL != plugin.cfg) |
3066 | return NULL; /* can only initialize once! */ | 3074 | return NULL; /* can only initialize once! */ |
3067 | memset (&plugin, 0, sizeof(struct Plugin)); | 3075 | memset (&plugin, 0, sizeof(struct Plugin)); |
3068 | plugin.cfg = cfg; | 3076 | plugin.cfg = oid_cfg; |
3069 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 3077 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
3070 | api->cls = &plugin; | 3078 | api->cls = &plugin; |
3071 | api->name = GNUNET_REST_API_NS_OIDC; | 3079 | api->name = GNUNET_REST_API_NS_OIDC; |
3072 | api->process_request = &rest_identity_process_request; | 3080 | identity_handle = GNUNET_IDENTITY_connect (oid_cfg, &list_ego, NULL); |
3073 | identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL); | 3081 | gns_handle = GNUNET_GNS_connect (oid_cfg); |
3074 | gns_handle = GNUNET_GNS_connect (cfg); | 3082 | idp = GNUNET_RECLAIM_connect (oid_cfg); |
3075 | idp = GNUNET_RECLAIM_connect (cfg); | 3083 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (oid_cfg, |
3076 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, | ||
3077 | "reclaim-rest-plugin", | 3084 | "reclaim-rest-plugin", |
3078 | "OIDC_USERINFO_CONSUME_TIMEOUT", | 3085 | "OIDC_USERINFO_CONSUME_TIMEOUT", |
3079 | &consume_timeout)) | 3086 | &consume_timeout)) |
@@ -3112,7 +3119,7 @@ cleanup_hashmap (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
3112 | * @return always NULL | 3119 | * @return always NULL |
3113 | */ | 3120 | */ |
3114 | void * | 3121 | void * |
3115 | libgnunet_plugin_rest_openid_connect_done (void *cls) | 3122 | REST_openid_done (void *cls) |
3116 | { | 3123 | { |
3117 | struct GNUNET_REST_Plugin *api = cls; | 3124 | struct GNUNET_REST_Plugin *api = cls; |
3118 | struct Plugin *plugin = api->cls; | 3125 | struct Plugin *plugin = api->cls; |
diff --git a/src/service/rest/openid_plugin.h b/src/service/rest/openid_plugin.h new file mode 100644 index 000000000..65545ac66 --- /dev/null +++ b/src/service/rest/openid_plugin.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "gnunet_rest_plugin.h" | ||
2 | /** | ||
3 | * Function processing the REST call | ||
4 | * | ||
5 | * @param method HTTP method | ||
6 | * @param url URL of the HTTP request | ||
7 | * @param data body of the HTTP request (optional) | ||
8 | * @param data_size length of the body | ||
9 | * @param proc callback function for the result | ||
10 | * @param proc_cls closure for @a proc | ||
11 | * @return #GNUNET_OK if request accepted | ||
12 | */ | ||
13 | enum GNUNET_GenericReturnValue | ||
14 | REST_openid_process_request (void *plugin, | ||
15 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
16 | GNUNET_REST_ResultProcessor proc, | ||
17 | void *proc_cls); | ||
18 | |||
19 | /** | ||
20 | * Entry point for the plugin. | ||
21 | * | ||
22 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | ||
23 | * @return NULL on error, otherwise the plugin context | ||
24 | */ | ||
25 | void* | ||
26 | REST_openid_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Exit point from the plugin. | ||
31 | * | ||
32 | * @param cls the plugin context (as returned by "init") | ||
33 | * @return always NULL | ||
34 | */ | ||
35 | void | ||
36 | REST_openid_done (struct GNUNET_REST_Plugin *api); | ||
diff --git a/src/rest-plugin/reclaim/plugin_rest_pabc.c b/src/service/rest/pabc_plugin.c index 4b7d21df3..4b7d21df3 100644 --- a/src/rest-plugin/reclaim/plugin_rest_pabc.c +++ b/src/service/rest/pabc_plugin.c | |||
diff --git a/src/rest-plugin/reclaim/plugin_rest_reclaim.c b/src/service/rest/reclaim_plugin.c index b2586109a..677a6a676 100644 --- a/src/rest-plugin/reclaim/plugin_rest_reclaim.c +++ b/src/service/rest/reclaim_plugin.c | |||
@@ -80,7 +80,7 @@ | |||
80 | /** | 80 | /** |
81 | * The configuration handle | 81 | * The configuration handle |
82 | */ | 82 | */ |
83 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 83 | const struct GNUNET_CONFIGURATION_Handle *rcfg; |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * HTTP methods allows for this plugin | 86 | * HTTP methods allows for this plugin |
@@ -317,7 +317,8 @@ do_error (void *cls) | |||
317 | handle->response_code = MHD_HTTP_BAD_REQUEST; | 317 | handle->response_code = MHD_HTTP_BAD_REQUEST; |
318 | } | 318 | } |
319 | resp = GNUNET_REST_create_response (json_error); | 319 | resp = GNUNET_REST_create_response (json_error); |
320 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, "Content-Type", "application/json")); | 320 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, "Content-Type", |
321 | "application/json")); | ||
321 | handle->proc (handle->proc_cls, resp, handle->response_code); | 322 | handle->proc (handle->proc_cls, resp, handle->response_code); |
322 | cleanup_handle (handle); | 323 | cleanup_handle (handle); |
323 | GNUNET_free (json_error); | 324 | GNUNET_free (json_error); |
@@ -1316,7 +1317,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1316 | 1317 | ||
1317 | // For now, independent of path return all options | 1318 | // For now, independent of path return all options |
1318 | resp = GNUNET_REST_create_response (NULL); | 1319 | resp = GNUNET_REST_create_response (NULL); |
1319 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods)); | 1320 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
1321 | "Access-Control-Allow-Methods", | ||
1322 | allow_methods)); | ||
1320 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 1323 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
1321 | cleanup_handle (handle); | 1324 | cleanup_handle (handle); |
1322 | return; | 1325 | return; |
@@ -1431,10 +1434,10 @@ list_ego (void *cls, | |||
1431 | } | 1434 | } |
1432 | 1435 | ||
1433 | 1436 | ||
1434 | static enum GNUNET_GenericReturnValue | 1437 | enum GNUNET_GenericReturnValue |
1435 | rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | 1438 | REST_reclaim_process_request (struct GNUNET_REST_RequestHandle *rest_handle, |
1436 | GNUNET_REST_ResultProcessor proc, | 1439 | GNUNET_REST_ResultProcessor proc, |
1437 | void *proc_cls) | 1440 | void *proc_cls) |
1438 | { | 1441 | { |
1439 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 1442 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); |
1440 | struct GNUNET_REST_RequestHandlerError err; | 1443 | struct GNUNET_REST_RequestHandlerError err; |
@@ -1492,20 +1495,19 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
1492 | * @return NULL on error, otherwise the plugin context | 1495 | * @return NULL on error, otherwise the plugin context |
1493 | */ | 1496 | */ |
1494 | void * | 1497 | void * |
1495 | libgnunet_plugin_rest_reclaim_init (void *cls) | 1498 | REST_reclaim_init (struct GNUNET_CONFIGURATION_Handle *c) |
1496 | { | 1499 | { |
1497 | static struct Plugin plugin; | 1500 | static struct Plugin plugin; |
1498 | struct GNUNET_REST_Plugin *api; | 1501 | struct GNUNET_REST_Plugin *api; |
1499 | 1502 | ||
1500 | cfg = cls; | 1503 | rcfg = c; |
1501 | if (NULL != plugin.cfg) | 1504 | if (NULL != plugin.cfg) |
1502 | return NULL; /* can only initialize once! */ | 1505 | return NULL; /* can only initialize once! */ |
1503 | memset (&plugin, 0, sizeof(struct Plugin)); | 1506 | memset (&plugin, 0, sizeof(struct Plugin)); |
1504 | plugin.cfg = cfg; | 1507 | plugin.cfg = rcfg; |
1505 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 1508 | api = GNUNET_new (struct GNUNET_REST_Plugin); |
1506 | api->cls = &plugin; | 1509 | api->cls = &plugin; |
1507 | api->name = GNUNET_REST_API_NS_RECLAIM; | 1510 | api->name = GNUNET_REST_API_NS_RECLAIM; |
1508 | api->process_request = &rest_identity_process_request; | ||
1509 | GNUNET_asprintf (&allow_methods, | 1511 | GNUNET_asprintf (&allow_methods, |
1510 | "%s, %s, %s, %s, %s", | 1512 | "%s, %s, %s, %s, %s", |
1511 | MHD_HTTP_METHOD_GET, | 1513 | MHD_HTTP_METHOD_GET, |
@@ -1513,9 +1515,9 @@ libgnunet_plugin_rest_reclaim_init (void *cls) | |||
1513 | MHD_HTTP_METHOD_PUT, | 1515 | MHD_HTTP_METHOD_PUT, |
1514 | MHD_HTTP_METHOD_DELETE, | 1516 | MHD_HTTP_METHOD_DELETE, |
1515 | MHD_HTTP_METHOD_OPTIONS); | 1517 | MHD_HTTP_METHOD_OPTIONS); |
1516 | identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, NULL); | 1518 | identity_handle = GNUNET_IDENTITY_connect (rcfg, &list_ego, NULL); |
1517 | state = ID_REST_STATE_INIT; | 1519 | state = ID_REST_STATE_INIT; |
1518 | idp = GNUNET_RECLAIM_connect (cfg); | 1520 | idp = GNUNET_RECLAIM_connect (rcfg); |
1519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1521 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1520 | _ ("Identity Provider REST API initialized\n")); | 1522 | _ ("Identity Provider REST API initialized\n")); |
1521 | return api; | 1523 | return api; |
@@ -1529,9 +1531,8 @@ libgnunet_plugin_rest_reclaim_init (void *cls) | |||
1529 | * @return always NULL | 1531 | * @return always NULL |
1530 | */ | 1532 | */ |
1531 | void * | 1533 | void * |
1532 | libgnunet_plugin_rest_reclaim_done (void *cls) | 1534 | REST_reclaim_done (struct GNUNET_REST_Plugin *api) |
1533 | { | 1535 | { |
1534 | struct GNUNET_REST_Plugin *api = cls; | ||
1535 | struct Plugin *plugin = api->cls; | 1536 | struct Plugin *plugin = api->cls; |
1536 | struct RequestHandle *request; | 1537 | struct RequestHandle *request; |
1537 | struct EgoEntry *ego_entry; | 1538 | struct EgoEntry *ego_entry; |
diff --git a/src/service/rest/reclaim_plugin.h b/src/service/rest/reclaim_plugin.h new file mode 100644 index 000000000..102fd827e --- /dev/null +++ b/src/service/rest/reclaim_plugin.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "gnunet_rest_plugin.h" | ||
2 | /** | ||
3 | * Function processing the REST call | ||
4 | * | ||
5 | * @param method HTTP method | ||
6 | * @param url URL of the HTTP request | ||
7 | * @param data body of the HTTP request (optional) | ||
8 | * @param data_size length of the body | ||
9 | * @param proc callback function for the result | ||
10 | * @param proc_cls closure for @a proc | ||
11 | * @return #GNUNET_OK if request accepted | ||
12 | */ | ||
13 | enum GNUNET_GenericReturnValue | ||
14 | REST_reclaim_process_request (void *plugin, | ||
15 | struct GNUNET_REST_RequestHandle *conndata_handle, | ||
16 | GNUNET_REST_ResultProcessor proc, | ||
17 | void *proc_cls); | ||
18 | |||
19 | /** | ||
20 | * Entry point for the plugin. | ||
21 | * | ||
22 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | ||
23 | * @return NULL on error, otherwise the plugin context | ||
24 | */ | ||
25 | void* | ||
26 | REST_reclaim_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Exit point from the plugin. | ||
31 | * | ||
32 | * @param cls the plugin context (as returned by "init") | ||
33 | * @return always NULL | ||
34 | */ | ||
35 | void | ||
36 | REST_reclaim_done (struct GNUNET_REST_Plugin *api); | ||
diff --git a/src/service/revocation/Makefile.am b/src/service/revocation/Makefile.am index 726c75ab6..18bf21fb0 100644 --- a/src/service/revocation/Makefile.am +++ b/src/service/revocation/Makefile.am | |||
@@ -29,7 +29,7 @@ libgnunetrevocation_la_SOURCES = \ | |||
29 | revocation_api.c revocation.h | 29 | revocation_api.c revocation.h |
30 | libgnunetrevocation_la_LIBADD = \ | 30 | libgnunetrevocation_la_LIBADD = \ |
31 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 31 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
32 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | 32 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
33 | $(LIBGCRYPT_LIBS) \ | 33 | $(LIBGCRYPT_LIBS) \ |
34 | $(GN_LIBINTL) $(XLIB) -lgcrypt | 34 | $(GN_LIBINTL) $(XLIB) -lgcrypt |
35 | libgnunetrevocation_la_LDFLAGS = \ | 35 | libgnunetrevocation_la_LDFLAGS = \ |
@@ -46,7 +46,7 @@ gnunet_service_revocation_LDADD = \ | |||
46 | $(top_builddir)/src/service/core/libgnunetcore.la \ | 46 | $(top_builddir)/src/service/core/libgnunetcore.la \ |
47 | $(top_builddir)/src/service/setu/libgnunetsetu.la \ | 47 | $(top_builddir)/src/service/setu/libgnunetsetu.la \ |
48 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 48 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
49 | $(top_builddir)/src/service/identity/libgnunetidentity.la \ | 49 | $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ |
50 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 50 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
51 | -lm \ | 51 | -lm \ |
52 | $(GN_LIBINTL) | 52 | $(GN_LIBINTL) |
diff --git a/src/service/revocation/gnunet-service-revocation.c b/src/service/revocation/gnunet-service-revocation.c index 3755b87e5..8a8610758 100644 --- a/src/service/revocation/gnunet-service-revocation.c +++ b/src/service/revocation/gnunet-service-revocation.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "platform.h" | 38 | #include "platform.h" |
39 | #include <math.h> | 39 | #include <math.h> |
40 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
41 | #include "gnunet_gnsrecord_lib.h" | ||
41 | #include "gnunet_block_lib.h" | 42 | #include "gnunet_block_lib.h" |
42 | #include "gnunet_constants.h" | 43 | #include "gnunet_constants.h" |
43 | #include "gnunet_protocols.h" | 44 | #include "gnunet_protocols.h" |
@@ -172,13 +173,13 @@ new_peer_entry (const struct GNUNET_PeerIdentity *peer) | |||
172 | static enum GNUNET_GenericReturnValue | 173 | static enum GNUNET_GenericReturnValue |
173 | verify_revoke_message (const struct RevokeMessage *rm) | 174 | verify_revoke_message (const struct RevokeMessage *rm) |
174 | { | 175 | { |
175 | const struct GNUNET_REVOCATION_PowP *pow | 176 | const struct GNUNET_GNSRECORD_PowP *pow |
176 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; | 177 | = (const struct GNUNET_GNSRECORD_PowP *) &rm[1]; |
177 | 178 | ||
178 | if (GNUNET_YES != | 179 | if (GNUNET_YES != |
179 | GNUNET_REVOCATION_check_pow (pow, | 180 | GNUNET_GNSRECORD_check_pow (pow, |
180 | (unsigned int) revocation_work_required, | 181 | (unsigned int) revocation_work_required, |
181 | epoch_duration)) | 182 | epoch_duration)) |
182 | { | 183 | { |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 184 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
184 | "Proof of work invalid!\n"); | 185 | "Proof of work invalid!\n"); |
@@ -221,6 +222,7 @@ client_disconnect_cb (void *cls, | |||
221 | GNUNET_assert (client == app_cls); | 222 | GNUNET_assert (client == app_cls); |
222 | } | 223 | } |
223 | 224 | ||
225 | |||
224 | static int | 226 | static int |
225 | check_query_message (void *cls, | 227 | check_query_message (void *cls, |
226 | const struct QueryMessage *qm) | 228 | const struct QueryMessage *qm) |
@@ -261,7 +263,7 @@ handle_query_message (void *cls, | |||
261 | key_len = ntohl (qm->key_len); | 263 | key_len = ntohl (qm->key_len); |
262 | if ((GNUNET_SYSERR == | 264 | if ((GNUNET_SYSERR == |
263 | GNUNET_CRYPTO_read_public_key_from_buffer (&qm[1], key_len, | 265 | GNUNET_CRYPTO_read_public_key_from_buffer (&qm[1], key_len, |
264 | &zone, &read)) || | 266 | &zone, &read)) || |
265 | (read != key_len)) | 267 | (read != key_len)) |
266 | { | 268 | { |
267 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 269 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -342,8 +344,8 @@ publicize_rm (const struct RevokeMessage *rm) | |||
342 | struct GNUNET_HashCode hc; | 344 | struct GNUNET_HashCode hc; |
343 | struct GNUNET_SETU_Element e; | 345 | struct GNUNET_SETU_Element e; |
344 | ssize_t pklen; | 346 | ssize_t pklen; |
345 | const struct GNUNET_REVOCATION_PowP *pow | 347 | const struct GNUNET_GNSRECORD_PowP *pow |
346 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; | 348 | = (const struct GNUNET_GNSRECORD_PowP *) &rm[1]; |
347 | const struct GNUNET_CRYPTO_PublicKey *pk | 349 | const struct GNUNET_CRYPTO_PublicKey *pk |
348 | = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | 350 | = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
349 | 351 | ||
@@ -980,8 +982,8 @@ run (void *cls, | |||
980 | GNUNET_free (fn); | 982 | GNUNET_free (fn); |
981 | return; | 983 | return; |
982 | } | 984 | } |
983 | struct GNUNET_REVOCATION_PowP *pow = (struct | 985 | struct GNUNET_GNSRECORD_PowP *pow = (struct |
984 | GNUNET_REVOCATION_PowP *) &rm[1]; | 986 | GNUNET_GNSRECORD_PowP *) &rm[1]; |
985 | ssize_t ksize; | 987 | ssize_t ksize; |
986 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | 988 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
987 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | 989 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); |
diff --git a/src/service/revocation/meson.build b/src/service/revocation/meson.build index 14e352ffa..57f19f115 100644 --- a/src/service/revocation/meson.build +++ b/src/service/revocation/meson.build | |||
@@ -19,7 +19,9 @@ libgnunetrevocation = library('gnunetrevocation', | |||
19 | libgnunetrevocation_src, | 19 | libgnunetrevocation_src, |
20 | soversion: '0', | 20 | soversion: '0', |
21 | version: '0.0.0', | 21 | version: '0.0.0', |
22 | dependencies: [libgnunetutil_dep, libgnunetidentity_dep], | 22 | dependencies: [libgnunetutil_dep, |
23 | libgnunetgnsrecord_dep, | ||
24 | libgnunetidentity_dep], | ||
23 | include_directories: [incdir, configuration_inc], | 25 | include_directories: [incdir, configuration_inc], |
24 | install: true, | 26 | install: true, |
25 | install_dir: get_option('libdir')) | 27 | install_dir: get_option('libdir')) |
@@ -34,6 +36,7 @@ executable ('gnunet-service-revocation', | |||
34 | libgnunetstatistics_dep, | 36 | libgnunetstatistics_dep, |
35 | libgnunetcore_dep, | 37 | libgnunetcore_dep, |
36 | libgnunetsetu_dep, | 38 | libgnunetsetu_dep, |
39 | libgnunetgnsrecord_dep, | ||
37 | libgnunetidentity_dep], | 40 | libgnunetidentity_dep], |
38 | include_directories: [incdir, configuration_inc], | 41 | include_directories: [incdir, configuration_inc], |
39 | install: true, | 42 | install: true, |
diff --git a/src/service/revocation/revocation.h b/src/service/revocation/revocation.h index 90b8c7da0..cbb36acfb 100644 --- a/src/service/revocation/revocation.h +++ b/src/service/revocation/revocation.h | |||
@@ -112,13 +112,4 @@ struct RevocationResponseMessage | |||
112 | 112 | ||
113 | GNUNET_NETWORK_STRUCT_END | 113 | GNUNET_NETWORK_STRUCT_END |
114 | 114 | ||
115 | /** | ||
116 | * Create the revocation metadata to sign for a revocation message | ||
117 | * | ||
118 | * @param pow the PoW to sign | ||
119 | * @return the signature purpose | ||
120 | */ | ||
121 | struct GNUNET_REVOCATION_SignaturePurposePS * | ||
122 | REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow); | ||
123 | |||
124 | #endif | 115 | #endif |
diff --git a/src/service/revocation/revocation_api.c b/src/service/revocation/revocation_api.c index 3b7d83710..0e3641af8 100644 --- a/src/service/revocation/revocation_api.c +++ b/src/service/revocation/revocation_api.c | |||
@@ -52,60 +52,6 @@ struct GNUNET_REVOCATION_Query | |||
52 | 52 | ||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Helper struct that holds a found pow nonce | ||
56 | * and the corresponding number of leading zeros. | ||
57 | */ | ||
58 | struct BestPow | ||
59 | { | ||
60 | /** | ||
61 | * PoW nonce | ||
62 | */ | ||
63 | uint64_t pow; | ||
64 | |||
65 | /** | ||
66 | * Corresponding zero bits in hash | ||
67 | */ | ||
68 | unsigned int bits; | ||
69 | }; | ||
70 | |||
71 | |||
72 | /** | ||
73 | * The handle to a PoW calculation. | ||
74 | * Used in iterative PoW rounds. | ||
75 | */ | ||
76 | struct GNUNET_REVOCATION_PowCalculationHandle | ||
77 | { | ||
78 | /** | ||
79 | * Current set of found PoWs | ||
80 | */ | ||
81 | struct BestPow best[POW_COUNT]; | ||
82 | |||
83 | /** | ||
84 | * The final PoW result data structure. | ||
85 | */ | ||
86 | struct GNUNET_REVOCATION_PowP *pow; | ||
87 | |||
88 | /** | ||
89 | * The current nonce to try | ||
90 | */ | ||
91 | uint64_t current_pow; | ||
92 | |||
93 | /** | ||
94 | * Epochs how long the PoW should be valid. | ||
95 | * This is added on top of the difficulty in the PoW. | ||
96 | */ | ||
97 | unsigned int epochs; | ||
98 | |||
99 | /** | ||
100 | * The difficulty (leading zeros) to achieve. | ||
101 | */ | ||
102 | unsigned int difficulty; | ||
103 | |||
104 | }; | ||
105 | |||
106 | static struct GNUNET_CRYPTO_PowSalt salt = { "GnsRevocationPow" }; | ||
107 | |||
108 | /** | ||
109 | * Generic error handler, called with the appropriate | 55 | * Generic error handler, called with the appropriate |
110 | * error code and the same closure specified at the creation of | 56 | * error code and the same closure specified at the creation of |
111 | * the message queue. | 57 | * the message queue. |
@@ -301,7 +247,7 @@ handle_revocation_response (void *cls, | |||
301 | */ | 247 | */ |
302 | struct GNUNET_REVOCATION_Handle * | 248 | struct GNUNET_REVOCATION_Handle * |
303 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | 249 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, |
304 | const struct GNUNET_REVOCATION_PowP *pow, | 250 | const struct GNUNET_GNSRECORD_PowP *pow, |
305 | GNUNET_REVOCATION_Callback func, | 251 | GNUNET_REVOCATION_Callback func, |
306 | void *func_cls) | 252 | void *func_cls) |
307 | { | 253 | { |
@@ -339,9 +285,9 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
339 | GNUNET_free (h); | 285 | GNUNET_free (h); |
340 | return NULL; | 286 | return NULL; |
341 | } | 287 | } |
342 | if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow, | 288 | if (GNUNET_YES != GNUNET_GNSRECORD_check_pow (pow, |
343 | (unsigned int) matching_bits, | 289 | (unsigned int) matching_bits, |
344 | epoch_duration)) | 290 | epoch_duration)) |
345 | { | 291 | { |
346 | GNUNET_break (0); | 292 | GNUNET_break (0); |
347 | GNUNET_free (h); | 293 | GNUNET_free (h); |
@@ -361,7 +307,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
361 | } | 307 | } |
362 | h->func = func; | 308 | h->func = func; |
363 | h->func_cls = func_cls; | 309 | h->func_cls = func_cls; |
364 | size_t extra_len = GNUNET_REVOCATION_proof_get_size (pow); | 310 | size_t extra_len = GNUNET_GNSRECORD_proof_get_size (pow); |
365 | env = GNUNET_MQ_msg_extra (rm, | 311 | env = GNUNET_MQ_msg_extra (rm, |
366 | extra_len, | 312 | extra_len, |
367 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | 313 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); |
@@ -385,380 +331,4 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) | |||
385 | } | 331 | } |
386 | 332 | ||
387 | 333 | ||
388 | /** | ||
389 | * Calculate the average zeros in the pows. | ||
390 | * | ||
391 | * @param ph the PowHandle | ||
392 | * @return the average number of zeros. | ||
393 | */ | ||
394 | static unsigned int | ||
395 | calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph) | ||
396 | { | ||
397 | double sum = 0.0; | ||
398 | for (unsigned int j = 0; j<POW_COUNT; j++) | ||
399 | sum += ph->best[j].bits; | ||
400 | double avg = sum / POW_COUNT; | ||
401 | return avg; | ||
402 | } | ||
403 | |||
404 | |||
405 | struct GNUNET_REVOCATION_SignaturePurposePS * | ||
406 | REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow) | ||
407 | { | ||
408 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; | ||
409 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
410 | size_t ksize; | ||
411 | |||
412 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
413 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
414 | spurp = GNUNET_malloc (sizeof (*spurp) + ksize); | ||
415 | spurp->timestamp = pow->timestamp; | ||
416 | spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION); | ||
417 | spurp->purpose.size = htonl (sizeof(*spurp) + ksize); | ||
418 | GNUNET_CRYPTO_write_public_key_to_buffer (pk, | ||
419 | (char*) &spurp[1], | ||
420 | ksize); | ||
421 | return spurp; | ||
422 | } | ||
423 | |||
424 | |||
425 | enum GNUNET_GenericReturnValue | ||
426 | check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, | ||
427 | const struct GNUNET_CRYPTO_PublicKey *key) | ||
428 | { | ||
429 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; | ||
430 | unsigned char *sig; | ||
431 | size_t ksize; | ||
432 | int ret; | ||
433 | |||
434 | ksize = GNUNET_CRYPTO_public_key_get_length (key); | ||
435 | spurp = REV_create_signature_message (pow); | ||
436 | sig = ((unsigned char*) &pow[1] + ksize); | ||
437 | ret = | ||
438 | GNUNET_CRYPTO_signature_verify_raw_ ( | ||
439 | GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION, | ||
440 | &spurp->purpose, | ||
441 | sig, | ||
442 | key); | ||
443 | GNUNET_free (spurp); | ||
444 | return ret == GNUNET_OK ? GNUNET_OK : GNUNET_SYSERR; | ||
445 | } | ||
446 | |||
447 | |||
448 | enum GNUNET_GenericReturnValue | ||
449 | check_signature (const struct GNUNET_REVOCATION_PowP *pow) | ||
450 | { | ||
451 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
452 | |||
453 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
454 | return check_signature_identity (pow, pk); | ||
455 | } | ||
456 | |||
457 | |||
458 | /** | ||
459 | * Check if the given proof-of-work is valid. | ||
460 | * | ||
461 | * @param pow proof of work | ||
462 | * @param difficulty how many bits must match (configuration) LSD0001: D | ||
463 | * @param epoch_duration length of single epoch in configuration | ||
464 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
465 | */ | ||
466 | enum GNUNET_GenericReturnValue | ||
467 | GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | ||
468 | unsigned int difficulty, | ||
469 | struct GNUNET_TIME_Relative epoch_duration) | ||
470 | { | ||
471 | char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) | ||
472 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) | ||
473 | + sizeof (uint64_t)] GNUNET_ALIGN; | ||
474 | struct GNUNET_HashCode result; | ||
475 | struct GNUNET_TIME_Absolute ts; | ||
476 | struct GNUNET_TIME_Absolute exp; | ||
477 | struct GNUNET_TIME_Relative ttl; | ||
478 | struct GNUNET_TIME_Relative buffer; | ||
479 | /* LSD0001: D' */ | ||
480 | unsigned int score = 0; | ||
481 | unsigned int tmp_score = 0; | ||
482 | unsigned int epochs; | ||
483 | uint64_t pow_val; | ||
484 | ssize_t pklen; | ||
485 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
486 | |||
487 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
488 | |||
489 | /** | ||
490 | * Check if signature valid | ||
491 | */ | ||
492 | if (GNUNET_OK != check_signature (pow)) | ||
493 | { | ||
494 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
495 | "Proof of work signature invalid!\n"); | ||
496 | return GNUNET_SYSERR; | ||
497 | } | ||
498 | |||
499 | /** | ||
500 | * First, check if PoW set is strictly monotically increasing | ||
501 | */ | ||
502 | for (unsigned int i = 0; i < POW_COUNT - 1; i++) | ||
503 | { | ||
504 | if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i + 1])) | ||
505 | return GNUNET_NO; | ||
506 | } | ||
507 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | ||
508 | &pow->timestamp, | ||
509 | sizeof (uint64_t)); | ||
510 | pklen = GNUNET_CRYPTO_public_key_get_length (pk); | ||
511 | if (0 > pklen) | ||
512 | { | ||
513 | GNUNET_break (0); | ||
514 | return GNUNET_NO; | ||
515 | } | ||
516 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | ||
517 | pk, | ||
518 | pklen); | ||
519 | for (unsigned int i = 0; i < POW_COUNT; i++) | ||
520 | { | ||
521 | pow_val = GNUNET_ntohll (pow->pow[i]); | ||
522 | GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t)); | ||
523 | GNUNET_CRYPTO_pow_hash (&salt, | ||
524 | buf, | ||
525 | sizeof(buf), | ||
526 | &result); | ||
527 | tmp_score = GNUNET_CRYPTO_hash_count_leading_zeros (&result); | ||
528 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
529 | "Score %u with %" PRIu64 " (#%u)\n", | ||
530 | tmp_score, pow_val, i); | ||
531 | |||
532 | score += tmp_score; | ||
533 | |||
534 | } | ||
535 | score = score / POW_COUNT; | ||
536 | if (score < difficulty) | ||
537 | return GNUNET_NO; | ||
538 | /* LSD0001: (D'-D+1) */ | ||
539 | epochs = score - difficulty + 1; | ||
540 | |||
541 | /** | ||
542 | * Check expiration | ||
543 | */ | ||
544 | ts = GNUNET_TIME_absolute_ntoh (pow->timestamp); | ||
545 | ttl = GNUNET_TIME_relative_multiply (epoch_duration, | ||
546 | epochs); | ||
547 | /** | ||
548 | * Extend by 10% for unsynchronized clocks | ||
549 | */ | ||
550 | buffer = GNUNET_TIME_relative_divide (epoch_duration, | ||
551 | 10); | ||
552 | exp = GNUNET_TIME_absolute_add (ts, ttl); | ||
553 | exp = GNUNET_TIME_absolute_add (exp, | ||
554 | buffer); | ||
555 | |||
556 | if (0 != GNUNET_TIME_absolute_get_remaining (ts).rel_value_us) | ||
557 | return GNUNET_NO; /* Not yet valid. */ | ||
558 | /* Revert to actual start time */ | ||
559 | ts = GNUNET_TIME_absolute_add (ts, | ||
560 | buffer); | ||
561 | |||
562 | if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us) | ||
563 | return GNUNET_NO; /* expired */ | ||
564 | return GNUNET_YES; | ||
565 | } | ||
566 | |||
567 | |||
568 | enum GNUNET_GenericReturnValue | ||
569 | sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
570 | struct GNUNET_REVOCATION_PowP *pow) | ||
571 | { | ||
572 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); | ||
573 | struct GNUNET_REVOCATION_SignaturePurposePS *rp; | ||
574 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
575 | size_t ksize; | ||
576 | char *sig; | ||
577 | |||
578 | /** | ||
579 | * Predate the validity period to prevent rejections due to | ||
580 | * unsynchronized clocks | ||
581 | */ | ||
582 | ts = GNUNET_TIME_absolute_subtract (ts, | ||
583 | GNUNET_TIME_UNIT_WEEKS); | ||
584 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
585 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
586 | pow->timestamp = GNUNET_TIME_absolute_hton (ts); | ||
587 | rp = REV_create_signature_message (pow); | ||
588 | sig = ((char*) &pow[1]) + ksize; | ||
589 | int result = GNUNET_CRYPTO_sign_raw_ (key, | ||
590 | &rp->purpose, | ||
591 | (void*) sig); | ||
592 | GNUNET_free (rp); | ||
593 | if (result == GNUNET_SYSERR) | ||
594 | return GNUNET_NO; | ||
595 | else | ||
596 | return result; | ||
597 | } | ||
598 | |||
599 | |||
600 | enum GNUNET_GenericReturnValue | ||
601 | sign_pow (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
602 | struct GNUNET_REVOCATION_PowP *pow) | ||
603 | { | ||
604 | struct GNUNET_CRYPTO_PublicKey *pk; | ||
605 | |||
606 | pk = (struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
607 | GNUNET_CRYPTO_key_get_public (key, pk); | ||
608 | return sign_pow_identity (key, pow); | ||
609 | } | ||
610 | |||
611 | |||
612 | /** | ||
613 | * Initializes a fresh PoW computation. | ||
614 | * | ||
615 | * @param key the key to calculate the PoW for. | ||
616 | * @param[out] pow starting point for PoW calculation (not yet valid) | ||
617 | */ | ||
618 | void | ||
619 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, | ||
620 | struct GNUNET_REVOCATION_PowP *pow) | ||
621 | { | ||
622 | GNUNET_assert (GNUNET_OK == sign_pow (key, pow)); | ||
623 | } | ||
624 | |||
625 | |||
626 | struct GNUNET_REVOCATION_PowCalculationHandle* | ||
627 | GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, | ||
628 | int epochs, | ||
629 | unsigned int difficulty) | ||
630 | { | ||
631 | struct GNUNET_REVOCATION_PowCalculationHandle *pc; | ||
632 | struct GNUNET_TIME_Relative ttl; | ||
633 | |||
634 | |||
635 | pc = GNUNET_new (struct GNUNET_REVOCATION_PowCalculationHandle); | ||
636 | pc->pow = pow; | ||
637 | ttl = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, | ||
638 | epochs); | ||
639 | pc->pow->ttl = GNUNET_TIME_relative_hton (ttl); | ||
640 | pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
641 | UINT64_MAX); | ||
642 | pc->difficulty = difficulty; | ||
643 | pc->epochs = epochs; | ||
644 | return pc; | ||
645 | } | ||
646 | |||
647 | |||
648 | /** | ||
649 | * Comparison function for quicksort | ||
650 | * | ||
651 | * @param a left element | ||
652 | * @param b right element | ||
653 | * @return a-b | ||
654 | */ | ||
655 | static int | ||
656 | cmp_pow_value (const void *a, const void *b) | ||
657 | { | ||
658 | return (GNUNET_ntohll (*(uint64_t*) a) - GNUNET_ntohll (*(uint64_t*) b)); | ||
659 | } | ||
660 | |||
661 | |||
662 | /** | ||
663 | * Calculate a key revocation valid for broadcasting for a number | ||
664 | * of epochs. | ||
665 | * | ||
666 | * @param pc handle to the PoW, initially called with NULL. | ||
667 | * @param epochs number of epochs for which the revocation must be valid. | ||
668 | * @param pow current pow value to try | ||
669 | * @param difficulty current base difficulty to achieve | ||
670 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | ||
671 | */ | ||
672 | enum GNUNET_GenericReturnValue | ||
673 | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | ||
674 | { | ||
675 | char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) | ||
676 | + sizeof (uint64_t) | ||
677 | + sizeof (uint64_t)] GNUNET_ALIGN; | ||
678 | struct GNUNET_HashCode result; | ||
679 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
680 | unsigned int zeros; | ||
681 | int ret; | ||
682 | uint64_t pow_nbo; | ||
683 | ssize_t ksize; | ||
684 | |||
685 | pc->current_pow++; | ||
686 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &(pc->pow[1]); | ||
687 | |||
688 | /** | ||
689 | * Do not try duplicates | ||
690 | */ | ||
691 | for (unsigned int i = 0; i < POW_COUNT; i++) | ||
692 | if (pc->current_pow == pc->best[i].pow) | ||
693 | return GNUNET_NO; | ||
694 | pow_nbo = GNUNET_htonll (pc->current_pow); | ||
695 | GNUNET_memcpy (buf, &pow_nbo, sizeof(uint64_t)); | ||
696 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | ||
697 | &pc->pow->timestamp, | ||
698 | sizeof (uint64_t)); | ||
699 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
700 | GNUNET_assert (0 < ksize); | ||
701 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | ||
702 | pk, | ||
703 | ksize); | ||
704 | GNUNET_CRYPTO_pow_hash (&salt, | ||
705 | buf, | ||
706 | sizeof(buf), | ||
707 | &result); | ||
708 | zeros = GNUNET_CRYPTO_hash_count_leading_zeros (&result); | ||
709 | for (unsigned int i = 0; i < POW_COUNT; i++) | ||
710 | { | ||
711 | if (pc->best[i].bits < zeros) | ||
712 | { | ||
713 | pc->best[i].bits = zeros; | ||
714 | pc->best[i].pow = pc->current_pow; | ||
715 | pc->pow->pow[i] = pow_nbo; | ||
716 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
717 | "New best score %u with %" PRIu64 " (#%u)\n", | ||
718 | zeros, pc->current_pow, i); | ||
719 | |||
720 | break; | ||
721 | } | ||
722 | } | ||
723 | ret = calculate_score (pc) >= pc->difficulty + pc->epochs ? GNUNET_YES : | ||
724 | GNUNET_NO; | ||
725 | if (GNUNET_YES == ret) | ||
726 | { | ||
727 | /* Sort POWs) */ | ||
728 | qsort (pc->pow->pow, POW_COUNT, sizeof (uint64_t), &cmp_pow_value); | ||
729 | } | ||
730 | return ret; | ||
731 | } | ||
732 | |||
733 | |||
734 | /** | ||
735 | * Stop a PoW calculation | ||
736 | * | ||
737 | * @param pc the calculation to clean up | ||
738 | * @return #GNUNET_YES if pow valid, #GNUNET_NO if pow was set but is not | ||
739 | * valid | ||
740 | */ | ||
741 | void | ||
742 | GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | ||
743 | { | ||
744 | GNUNET_free (pc); | ||
745 | } | ||
746 | |||
747 | |||
748 | size_t | ||
749 | GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow) | ||
750 | { | ||
751 | size_t size; | ||
752 | size_t ksize; | ||
753 | const struct GNUNET_CRYPTO_PublicKey *pk; | ||
754 | |||
755 | size = sizeof (struct GNUNET_REVOCATION_PowP); | ||
756 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; | ||
757 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); | ||
758 | size += ksize; | ||
759 | size += GNUNET_CRYPTO_signature_get_raw_length_by_type (pk->type); | ||
760 | return size; | ||
761 | } | ||
762 | |||
763 | |||
764 | /* end of revocation_api.c */ | 334 | /* end of revocation_api.c */ |
diff --git a/src/service/seti/Makefile.am b/src/service/seti/Makefile.am index c2d31df9c..00923d56d 100644 --- a/src/service/seti/Makefile.am +++ b/src/service/seti/Makefile.am | |||
@@ -68,19 +68,5 @@ test_seti_api_LDADD = \ | |||
68 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 68 | $(top_builddir)/src/service/testing/libgnunettesting.la \ |
69 | libgnunetseti.la | 69 | libgnunetseti.la |
70 | 70 | ||
71 | plugin_LTLIBRARIES = \ | ||
72 | libgnunet_plugin_block_seti_test.la | ||
73 | |||
74 | libgnunet_plugin_block_seti_test_la_SOURCES = \ | ||
75 | plugin_block_seti_test.c | ||
76 | libgnunet_plugin_block_seti_test_la_LIBADD = \ | ||
77 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
78 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
79 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
80 | $(LTLIBINTL) | ||
81 | libgnunet_plugin_block_seti_test_la_LDFLAGS = \ | ||
82 | $(GN_PLUGIN_LDFLAGS) | ||
83 | |||
84 | |||
85 | EXTRA_DIST = \ | 71 | EXTRA_DIST = \ |
86 | test_seti.conf | 72 | test_seti.conf |
diff --git a/src/service/seti/meson.build b/src/service/seti/meson.build index 8538917d8..1743e327d 100644 --- a/src/service/seti/meson.build +++ b/src/service/seti/meson.build | |||
@@ -26,12 +26,6 @@ libgnunetseti = library('gnunetseti', | |||
26 | pkg.generate(libgnunetseti, url: 'https://www.gnunet.org', | 26 | pkg.generate(libgnunetseti, url: 'https://www.gnunet.org', |
27 | description : 'Provides API for accessing the set intersection service') | 27 | description : 'Provides API for accessing the set intersection service') |
28 | libgnunetseti_dep = declare_dependency(link_with : libgnunetseti) | 28 | libgnunetseti_dep = declare_dependency(link_with : libgnunetseti) |
29 | shared_module('gnunet_plugin_block_seti_test', | ||
30 | ['plugin_block_seti_test.c'], | ||
31 | dependencies: libgnunetutil_dep, | ||
32 | include_directories: [incdir, configuration_inc], | ||
33 | install:true, | ||
34 | install_dir: get_option('libdir')/'gnunet') | ||
35 | executable ('gnunet-service-seti', | 29 | executable ('gnunet-service-seti', |
36 | gnunetserviceseti_src, | 30 | gnunetserviceseti_src, |
37 | dependencies: [libgnunetseti_dep, | 31 | dependencies: [libgnunetseti_dep, |
diff --git a/src/service/setu/Makefile.am b/src/service/setu/Makefile.am index f7f8ed394..f0cf9fdbc 100644 --- a/src/service/setu/Makefile.am +++ b/src/service/setu/Makefile.am | |||
@@ -88,19 +88,5 @@ perf_setu_api_LDADD = \ | |||
88 | libgnunetsetu.la | 88 | libgnunetsetu.la |
89 | 89 | ||
90 | 90 | ||
91 | plugin_LTLIBRARIES = \ | ||
92 | libgnunet_plugin_block_setu_test.la | ||
93 | |||
94 | libgnunet_plugin_block_setu_test_la_SOURCES = \ | ||
95 | plugin_block_setu_test.c | ||
96 | libgnunet_plugin_block_setu_test_la_LIBADD = \ | ||
97 | $(top_builddir)/src/lib/block/libgnunetblock.la \ | ||
98 | $(top_builddir)/src/lib/block/libgnunetblockgroup.la \ | ||
99 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
100 | $(LTLIBINTL) | ||
101 | libgnunet_plugin_block_setu_test_la_LDFLAGS = \ | ||
102 | $(GN_PLUGIN_LDFLAGS) | ||
103 | |||
104 | |||
105 | EXTRA_DIST = \ | 91 | EXTRA_DIST = \ |
106 | test_setu.conf | 92 | test_setu.conf |
diff --git a/src/service/setu/meson.build b/src/service/setu/meson.build index 974f16274..ccfa5762b 100644 --- a/src/service/setu/meson.build +++ b/src/service/setu/meson.build | |||
@@ -28,12 +28,6 @@ libgnunetsetu = library('gnunetsetu', | |||
28 | pkg.generate(libgnunetsetu, url: 'https://www.gnunet.org', | 28 | pkg.generate(libgnunetsetu, url: 'https://www.gnunet.org', |
29 | description : 'Provides API for accessing the set union service') | 29 | description : 'Provides API for accessing the set union service') |
30 | libgnunetsetu_dep = declare_dependency(link_with : libgnunetsetu) | 30 | libgnunetsetu_dep = declare_dependency(link_with : libgnunetsetu) |
31 | shared_module('gnunet_plugin_block_setu_test', | ||
32 | ['plugin_block_setu_test.c'], | ||
33 | dependencies: libgnunetutil_dep, | ||
34 | include_directories: [incdir, configuration_inc], | ||
35 | install:true, | ||
36 | install_dir: get_option('libdir')/'gnunet') | ||
37 | executable ('gnunet-service-setu', | 31 | executable ('gnunet-service-setu', |
38 | gnunetservicesetu_src, | 32 | gnunetservicesetu_src, |
39 | dependencies: [libgnunetsetu_dep, | 33 | dependencies: [libgnunetsetu_dep, |
diff --git a/src/service/topology/gnunet-daemon-topology.c b/src/service/topology/gnunet-daemon-topology.c index efabac0fc..71cc5bd19 100644 --- a/src/service/topology/gnunet-daemon-topology.c +++ b/src/service/topology/gnunet-daemon-topology.c | |||
@@ -641,35 +641,26 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) | |||
641 | int num_addresses_old; | 641 | int num_addresses_old; |
642 | int num_addresses_new; | 642 | int num_addresses_new; |
643 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello); | 643 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello); |
644 | struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder); | 644 | struct GNUNET_PeerIdentity pid; |
645 | struct Peer *peer; | 645 | struct Peer *peer; |
646 | uint16_t size; | 646 | uint16_t size; |
647 | 647 | ||
648 | GNUNET_HELLO_builder_iterate (builder, | 648 | GNUNET_HELLO_builder_iterate (builder, |
649 | pid, | 649 | &pid, |
650 | &address_iterator, | 650 | &address_iterator, |
651 | &num_addresses_new); | 651 | &num_addresses_new); |
652 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 652 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
653 | "consider 0 for %s\n", | 653 | "consider 0 for %s\n", |
654 | GNUNET_i2s (pid)); | 654 | GNUNET_i2s (&pid)); |
655 | if (0 == num_addresses_new) | 655 | if (0 == num_addresses_new) |
656 | { | 656 | { |
657 | GNUNET_HELLO_builder_free (builder); | 657 | GNUNET_HELLO_builder_free (builder); |
658 | return; /* no point in advertising this one... */ | 658 | return; /* no point in advertising this one... */ |
659 | } | 659 | } |
660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 660 | peer = GNUNET_CONTAINER_multipeermap_get (peers, &pid); |
661 | "consider 1\n"); | ||
662 | if (NULL == pid) | ||
663 | { | ||
664 | GNUNET_HELLO_builder_free (builder); | ||
665 | return; | ||
666 | } | ||
667 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
668 | "consider 2\n"); | ||
669 | peer = GNUNET_CONTAINER_multipeermap_get (peers, pid); | ||
670 | if (NULL == peer) | 661 | if (NULL == peer) |
671 | { | 662 | { |
672 | peer = make_peer (pid, hello); | 663 | peer = make_peer (&pid, hello); |
673 | } | 664 | } |
674 | else if (NULL != peer->hello) | 665 | else if (NULL != peer->hello) |
675 | { | 666 | { |
@@ -679,10 +670,10 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) | |||
679 | struct GNUNET_TIME_Absolute old_hello_exp = | 670 | struct GNUNET_TIME_Absolute old_hello_exp = |
680 | GNUNET_HELLO_builder_get_expiration_time (peer->hello); | 671 | GNUNET_HELLO_builder_get_expiration_time (peer->hello); |
681 | struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg (peer->hello); | 672 | struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg (peer->hello); |
682 | struct GNUNET_PeerIdentity *pid_old = GNUNET_HELLO_builder_get_id (builder_old); | 673 | struct GNUNET_PeerIdentity pid_old; |
683 | 674 | ||
684 | GNUNET_HELLO_builder_iterate (builder_old, | 675 | GNUNET_HELLO_builder_iterate (builder_old, |
685 | pid_old, | 676 | &pid_old, |
686 | &address_iterator, | 677 | &address_iterator, |
687 | &num_addresses_old); | 678 | &num_addresses_old); |
688 | if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && | 679 | if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && |
@@ -710,7 +701,7 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) | |||
710 | } | 701 | } |
711 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 702 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
712 | "Found HELLO from peer `%s' for advertising\n", | 703 | "Found HELLO from peer `%s' for advertising\n", |
713 | GNUNET_i2s (pid)); | 704 | GNUNET_i2s (&pid)); |
714 | if (NULL != peer->filter) | 705 | if (NULL != peer->filter) |
715 | { | 706 | { |
716 | GNUNET_CONTAINER_bloomfilter_free (peer->filter); | 707 | GNUNET_CONTAINER_bloomfilter_free (peer->filter); |
@@ -828,7 +819,7 @@ check_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
828 | { | 819 | { |
829 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg ( | 820 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg ( |
830 | message); | 821 | message); |
831 | struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder); | 822 | const struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder); |
832 | 823 | ||
833 | if (NULL == pid) | 824 | if (NULL == pid) |
834 | { | 825 | { |
@@ -858,10 +849,8 @@ handle_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
858 | { | 849 | { |
859 | struct GNUNET_PEERSTORE_StoreHelloContext *shc; | 850 | struct GNUNET_PEERSTORE_StoreHelloContext *shc; |
860 | const struct GNUNET_PeerIdentity *other = cls; | 851 | const struct GNUNET_PeerIdentity *other = cls; |
861 | struct Peer *peer; | ||
862 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg ( | 852 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg ( |
863 | message); | 853 | message); |
864 | struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder); | ||
865 | 854 | ||
866 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 855 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
867 | "Received encrypted HELLO from peer `%s'", | 856 | "Received encrypted HELLO from peer `%s'", |
@@ -871,6 +860,7 @@ handle_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
871 | 1, | 860 | 1, |
872 | GNUNET_NO); | 861 | GNUNET_NO); |
873 | GNUNET_HELLO_builder_from_msg (message); | 862 | GNUNET_HELLO_builder_from_msg (message); |
863 | // FIXME this is not working shc uninitialized | ||
874 | shc = GNUNET_PEERSTORE_hello_add (ps, message, &shc_cont, shc); | 864 | shc = GNUNET_PEERSTORE_hello_add (ps, message, &shc_cont, shc); |
875 | GNUNET_HELLO_builder_free (builder); | 865 | GNUNET_HELLO_builder_free (builder); |
876 | } | 866 | } |