aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--po/POTFILES.in125
-rw-r--r--src/Makefile.am1
-rw-r--r--src/include/gnunet_protocols.h5
-rw-r--r--src/include/gnunet_reclaim_attribute_lib.h6
-rw-r--r--src/zklaim/Makefile.am47
-rw-r--r--src/zklaim/plugin_reclaim_attribute_zklaim.c181
-rw-r--r--src/zklaim/zklaim_api.c433
-rw-r--r--src/zklaim/zklaim_api.h90
9 files changed, 823 insertions, 66 deletions
diff --git a/configure.ac b/configure.ac
index 91a2f5227..53539cbb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1772,6 +1772,7 @@ src/rest-plugins/Makefile
1772src/abe/Makefile 1772src/abe/Makefile
1773src/reclaim-attribute/Makefile 1773src/reclaim-attribute/Makefile
1774src/reclaim/Makefile 1774src/reclaim/Makefile
1775src/zklaim/Makefile
1775pkgconfig/Makefile 1776pkgconfig/Makefile
1776pkgconfig/gnunetarm.pc 1777pkgconfig/gnunetarm.pc
1777pkgconfig/gnunetats.pc 1778pkgconfig/gnunetats.pc
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a0fbfc6a1..a18d114ed 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,13 +4,21 @@ src/arm/arm_monitor_api.c
4src/arm/gnunet-arm.c 4src/arm/gnunet-arm.c
5src/arm/gnunet-service-arm.c 5src/arm/gnunet-service-arm.c
6src/arm/mockup-service.c 6src/arm/mockup-service.c
7src/ats-tests/ats-testing-experiment.c
8src/ats-tests/ats-testing-log.c
9src/ats-tests/ats-testing-preferences.c
10src/ats-tests/ats-testing-traffic.c
11src/ats-tests/ats-testing.c
12src/ats-tests/gnunet-ats-sim.c
13src/ats-tests/gnunet-solver-eval.c
14src/ats-tool/gnunet-ats.c
7src/ats/ats_api_connectivity.c 15src/ats/ats_api_connectivity.c
8src/ats/ats_api_performance.c 16src/ats/ats_api_performance.c
9src/ats/ats_api_scanner.c 17src/ats/ats_api_scanner.c
10src/ats/ats_api_scheduling.c 18src/ats/ats_api_scheduling.c
11src/ats/gnunet-ats-solver-eval.c 19src/ats/gnunet-ats-solver-eval.c
12src/ats/gnunet-service-ats_addresses.c
13src/ats/gnunet-service-ats.c 20src/ats/gnunet-service-ats.c
21src/ats/gnunet-service-ats_addresses.c
14src/ats/gnunet-service-ats_connectivity.c 22src/ats/gnunet-service-ats_connectivity.c
15src/ats/gnunet-service-ats_normalization.c 23src/ats/gnunet-service-ats_normalization.c
16src/ats/gnunet-service-ats_performance.c 24src/ats/gnunet-service-ats_performance.c
@@ -21,14 +29,6 @@ src/ats/gnunet-service-ats_scheduling.c
21src/ats/plugin_ats_mlp.c 29src/ats/plugin_ats_mlp.c
22src/ats/plugin_ats_proportional.c 30src/ats/plugin_ats_proportional.c
23src/ats/plugin_ats_ril.c 31src/ats/plugin_ats_ril.c
24src/ats-tests/ats-testing.c
25src/ats-tests/ats-testing-experiment.c
26src/ats-tests/ats-testing-log.c
27src/ats-tests/ats-testing-preferences.c
28src/ats-tests/ats-testing-traffic.c
29src/ats-tests/gnunet-ats-sim.c
30src/ats-tests/gnunet-solver-eval.c
31src/ats-tool/gnunet-ats.c
32src/auction/gnunet-auction-create.c 32src/auction/gnunet-auction-create.c
33src/auction/gnunet-auction-info.c 33src/auction/gnunet-auction-info.c
34src/auction/gnunet-auction-join.c 34src/auction/gnunet-auction-join.c
@@ -40,8 +40,8 @@ src/block/plugin_block_test.c
40src/cadet/cadet_api.c 40src/cadet/cadet_api.c
41src/cadet/cadet_test_lib.c 41src/cadet/cadet_test_lib.c
42src/cadet/desirability_table.c 42src/cadet/desirability_table.c
43src/cadet/gnunet-cadet.c
44src/cadet/gnunet-cadet-profiler.c 43src/cadet/gnunet-cadet-profiler.c
44src/cadet/gnunet-cadet.c
45src/cadet/gnunet-service-cadet.c 45src/cadet/gnunet-service-cadet.c
46src/cadet/gnunet-service-cadet_channel.c 46src/cadet/gnunet-service-cadet_channel.c
47src/cadet/gnunet-service-cadet_connection.c 47src/cadet/gnunet-service-cadet_connection.c
@@ -57,15 +57,15 @@ src/consensus/gnunet-service-consensus.c
57src/consensus/plugin_block_consensus.c 57src/consensus/plugin_block_consensus.c
58src/conversation/conversation_api.c 58src/conversation/conversation_api.c
59src/conversation/conversation_api_call.c 59src/conversation/conversation_api_call.c
60src/conversation/gnunet-conversation.c
61src/conversation/gnunet-conversation-test.c 60src/conversation/gnunet-conversation-test.c
62src/conversation/gnunet_gst.c 61src/conversation/gnunet-conversation.c
63src/conversation/gnunet_gst_test.c
64src/conversation/gnunet-helper-audio-playback.c
65src/conversation/gnunet-helper-audio-playback-gst.c 62src/conversation/gnunet-helper-audio-playback-gst.c
66src/conversation/gnunet-helper-audio-record.c 63src/conversation/gnunet-helper-audio-playback.c
67src/conversation/gnunet-helper-audio-record-gst.c 64src/conversation/gnunet-helper-audio-record-gst.c
65src/conversation/gnunet-helper-audio-record.c
68src/conversation/gnunet-service-conversation.c 66src/conversation/gnunet-service-conversation.c
67src/conversation/gnunet_gst.c
68src/conversation/gnunet_gst_test.c
69src/conversation/microphone.c 69src/conversation/microphone.c
70src/conversation/plugin_gnsrecord_conversation.c 70src/conversation/plugin_gnsrecord_conversation.c
71src/conversation/speaker.c 71src/conversation/speaker.c
@@ -102,7 +102,6 @@ src/dht/dht_api.c
102src/dht/dht_test_lib.c 102src/dht/dht_test_lib.c
103src/dht/gnunet-dht-get.c 103src/dht/gnunet-dht-get.c
104src/dht/gnunet-dht-monitor.c 104src/dht/gnunet-dht-monitor.c
105src/dht/gnunet_dht_profiler.c
106src/dht/gnunet-dht-put.c 105src/dht/gnunet-dht-put.c
107src/dht/gnunet-service-dht.c 106src/dht/gnunet-service-dht.c
108src/dht/gnunet-service-dht_clients.c 107src/dht/gnunet-service-dht_clients.c
@@ -111,6 +110,7 @@ src/dht/gnunet-service-dht_hello.c
111src/dht/gnunet-service-dht_neighbours.c 110src/dht/gnunet-service-dht_neighbours.c
112src/dht/gnunet-service-dht_nse.c 111src/dht/gnunet-service-dht_nse.c
113src/dht/gnunet-service-dht_routing.c 112src/dht/gnunet-service-dht_routing.c
113src/dht/gnunet_dht_profiler.c
114src/dht/plugin_block_dht.c 114src/dht/plugin_block_dht.c
115src/dns/dns_api.c 115src/dns/dns_api.c
116src/dns/gnunet-dns-monitor.c 116src/dns/gnunet-dns-monitor.c
@@ -124,8 +124,8 @@ src/dv/gnunet-dv.c
124src/dv/gnunet-service-dv.c 124src/dv/gnunet-service-dv.c
125src/dv/plugin_transport_dv.c 125src/dv/plugin_transport_dv.c
126src/exit/gnunet-daemon-exit.c 126src/exit/gnunet-daemon-exit.c
127src/exit/gnunet-helper-exit.c
128src/exit/gnunet-helper-exit-windows.c 127src/exit/gnunet-helper-exit-windows.c
128src/exit/gnunet-helper-exit.c
129src/fragmentation/defragmentation.c 129src/fragmentation/defragmentation.c
130src/fragmentation/fragmentation.c 130src/fragmentation/fragmentation.c
131src/fs/fs_api.c 131src/fs/fs_api.c
@@ -150,8 +150,8 @@ src/fs/gnunet-auto-share.c
150src/fs/gnunet-daemon-fsprofiler.c 150src/fs/gnunet-daemon-fsprofiler.c
151src/fs/gnunet-directory.c 151src/fs/gnunet-directory.c
152src/fs/gnunet-download.c 152src/fs/gnunet-download.c
153src/fs/gnunet-fs.c
154src/fs/gnunet-fs-profiler.c 153src/fs/gnunet-fs-profiler.c
154src/fs/gnunet-fs.c
155src/fs/gnunet-helper-fs-publish.c 155src/fs/gnunet-helper-fs-publish.c
156src/fs/gnunet-publish.c 156src/fs/gnunet-publish.c
157src/fs/gnunet-search.c 157src/fs/gnunet-search.c
@@ -171,10 +171,10 @@ src/gns/gns_tld_api.c
171src/gns/gnunet-bcd.c 171src/gns/gnunet-bcd.c
172src/gns/gnunet-dns2gns.c 172src/gns/gnunet-dns2gns.c
173src/gns/gnunet-gns-benchmark.c 173src/gns/gnunet-gns-benchmark.c
174src/gns/gnunet-gns.c
175src/gns/gnunet-gns-helper-service-w32.c 174src/gns/gnunet-gns-helper-service-w32.c
176src/gns/gnunet-gns-import.c 175src/gns/gnunet-gns-import.c
177src/gns/gnunet-gns-proxy.c 176src/gns/gnunet-gns-proxy.c
177src/gns/gnunet-gns.c
178src/gns/gnunet-service-gns.c 178src/gns/gnunet-service-gns.c
179src/gns/gnunet-service-gns_interceptor.c 179src/gns/gnunet-service-gns_interceptor.c
180src/gns/gnunet-service-gns_resolver.c 180src/gns/gnunet-service-gns_resolver.c
@@ -182,16 +182,15 @@ src/gns/nss/nss_gns.c
182src/gns/nss/nss_gns_query.c 182src/gns/nss/nss_gns_query.c
183src/gns/plugin_block_gns.c 183src/gns/plugin_block_gns.c
184src/gns/plugin_gnsrecord_gns.c 184src/gns/plugin_gnsrecord_gns.c
185src/gns/plugin_rest_gns.c 185src/gns/w32nsp-install.c
186src/gns/w32nsp-resolve.c
187src/gns/w32nsp-uninstall.c
188src/gns/w32nsp.c
186src/gnsrecord/gnsrecord.c 189src/gnsrecord/gnsrecord.c
187src/gnsrecord/gnsrecord_crypto.c 190src/gnsrecord/gnsrecord_crypto.c
188src/gnsrecord/gnsrecord_misc.c 191src/gnsrecord/gnsrecord_misc.c
189src/gnsrecord/gnsrecord_serialization.c 192src/gnsrecord/gnsrecord_serialization.c
190src/gnsrecord/plugin_gnsrecord_dns.c 193src/gnsrecord/plugin_gnsrecord_dns.c
191src/gns/w32nsp.c
192src/gns/w32nsp-install.c
193src/gns/w32nsp-resolve.c
194src/gns/w32nsp-uninstall.c
195src/hello/address.c 194src/hello/address.c
196src/hello/gnunet-hello.c 195src/hello/gnunet-hello.c
197src/hello/hello.c 196src/hello/hello.c
@@ -202,17 +201,17 @@ src/identity/gnunet-identity.c
202src/identity/gnunet-service-identity.c 201src/identity/gnunet-service-identity.c
203src/identity/identity_api.c 202src/identity/identity_api.c
204src/identity/identity_api_lookup.c 203src/identity/identity_api_lookup.c
205src/identity/plugin_rest_identity.c
206src/jsonapi/jsonapi.c
207src/jsonapi/jsonapi_document.c
208src/jsonapi/jsonapi_error.c
209src/jsonapi/jsonapi_relationship.c
210src/jsonapi/jsonapi_resource.c
211src/json/json.c 204src/json/json.c
212src/json/json_generator.c 205src/json/json_generator.c
213src/json/json_gnsrecord.c 206src/json/json_gnsrecord.c
214src/json/json_helper.c 207src/json/json_helper.c
215src/json/json_mhd.c 208src/json/json_mhd.c
209src/jsonapi/jsonapi.c
210src/jsonapi/jsonapi_document.c
211src/jsonapi/jsonapi_error.c
212src/jsonapi/jsonapi_relationship.c
213src/jsonapi/jsonapi_resource.c
214src/jsonapi/plugin_rest_reclaim.c
216src/multicast/gnunet-multicast.c 215src/multicast/gnunet-multicast.c
217src/multicast/gnunet-service-multicast.c 216src/multicast/gnunet-service-multicast.c
218src/multicast/multicast_api.c 217src/multicast/multicast_api.c
@@ -226,8 +225,8 @@ src/namecache/namecache_api.c
226src/namecache/plugin_namecache_flat.c 225src/namecache/plugin_namecache_flat.c
227src/namecache/plugin_namecache_postgres.c 226src/namecache/plugin_namecache_postgres.c
228src/namecache/plugin_namecache_sqlite.c 227src/namecache/plugin_namecache_sqlite.c
229src/namestore/gnunet-namestore.c
230src/namestore/gnunet-namestore-fcfsd.c 228src/namestore/gnunet-namestore-fcfsd.c
229src/namestore/gnunet-namestore.c
231src/namestore/gnunet-service-namestore.c 230src/namestore/gnunet-service-namestore.c
232src/namestore/gnunet-zoneimport.c 231src/namestore/gnunet-zoneimport.c
233src/namestore/namestore_api.c 232src/namestore/namestore_api.c
@@ -242,10 +241,10 @@ src/nat-auto/gnunet-service-nat-auto.c
242src/nat-auto/gnunet-service-nat-auto_legacy.c 241src/nat-auto/gnunet-service-nat-auto_legacy.c
243src/nat-auto/nat_auto_api.c 242src/nat-auto/nat_auto_api.c
244src/nat-auto/nat_auto_api_test.c 243src/nat-auto/nat_auto_api_test.c
245src/nat/gnunet-helper-nat-client.c
246src/nat/gnunet-helper-nat-client-windows.c 244src/nat/gnunet-helper-nat-client-windows.c
247src/nat/gnunet-helper-nat-server.c 245src/nat/gnunet-helper-nat-client.c
248src/nat/gnunet-helper-nat-server-windows.c 246src/nat/gnunet-helper-nat-server-windows.c
247src/nat/gnunet-helper-nat-server.c
249src/nat/gnunet-nat.c 248src/nat/gnunet-nat.c
250src/nat/gnunet-service-nat.c 249src/nat/gnunet-service-nat.c
251src/nat/gnunet-service-nat_externalip.c 250src/nat/gnunet-service-nat_externalip.c
@@ -254,15 +253,15 @@ src/nat/gnunet-service-nat_mini.c
254src/nat/gnunet-service-nat_stun.c 253src/nat/gnunet-service-nat_stun.c
255src/nat/nat_api.c 254src/nat/nat_api.c
256src/nat/nat_api_stun.c 255src/nat/nat_api_stun.c
257src/nse/gnunet-nse.c
258src/nse/gnunet-nse-profiler.c 256src/nse/gnunet-nse-profiler.c
257src/nse/gnunet-nse.c
259src/nse/gnunet-service-nse.c 258src/nse/gnunet-service-nse.c
260src/nse/nse_api.c 259src/nse/nse_api.c
260src/peerinfo-tool/gnunet-peerinfo.c
261src/peerinfo-tool/gnunet-peerinfo_plugins.c
261src/peerinfo/gnunet-service-peerinfo.c 262src/peerinfo/gnunet-service-peerinfo.c
262src/peerinfo/peerinfo_api.c 263src/peerinfo/peerinfo_api.c
263src/peerinfo/peerinfo_api_notify.c 264src/peerinfo/peerinfo_api_notify.c
264src/peerinfo-tool/gnunet-peerinfo.c
265src/peerinfo-tool/gnunet-peerinfo_plugins.c
266src/peerstore/gnunet-peerstore.c 265src/peerstore/gnunet-peerstore.c
267src/peerstore/gnunet-service-peerstore.c 266src/peerstore/gnunet-service-peerstore.c
268src/peerstore/peerstore_api.c 267src/peerstore/peerstore_api.c
@@ -292,7 +291,6 @@ src/reclaim-attribute/reclaim_attribute.c
292src/reclaim/gnunet-reclaim.c 291src/reclaim/gnunet-reclaim.c
293src/reclaim/gnunet-service-reclaim.c 292src/reclaim/gnunet-service-reclaim.c
294src/reclaim/jwt.c 293src/reclaim/jwt.c
295src/reclaim/oidc_helper.c
296src/reclaim/plugin_gnsrecord_reclaim.c 294src/reclaim/plugin_gnsrecord_reclaim.c
297src/reclaim/plugin_reclaim_sqlite.c 295src/reclaim/plugin_reclaim_sqlite.c
298src/reclaim/reclaim_api.c 296src/reclaim/reclaim_api.c
@@ -318,27 +316,25 @@ src/rest-plugins/plugin_rest_namestore.c
318src/rest-plugins/plugin_rest_openid_connect.c 316src/rest-plugins/plugin_rest_openid_connect.c
319src/rest-plugins/plugin_rest_peerinfo.c 317src/rest-plugins/plugin_rest_peerinfo.c
320src/rest/gnunet-rest-server.c 318src/rest/gnunet-rest-server.c
321src/rest/plugin_rest_copying.c
322src/rest/rest.c 319src/rest/rest.c
323src/revocation/gnunet-revocation.c 320src/revocation/gnunet-revocation.c
324src/revocation/gnunet-service-revocation.c 321src/revocation/gnunet-service-revocation.c
325src/revocation/plugin_block_revocation.c 322src/revocation/plugin_block_revocation.c
326src/revocation/revocation_api.c 323src/revocation/revocation_api.c
327src/rps/gnunet-rps.c
328src/rps/gnunet-rps-profiler.c 324src/rps/gnunet-rps-profiler.c
325src/rps/gnunet-rps.c
329src/rps/gnunet-service-rps.c 326src/rps/gnunet-service-rps.c
330src/rps/gnunet-service-rps_custommap.c 327src/rps/gnunet-service-rps_custommap.c
331src/rps/gnunet-service-rps_sampler.c 328src/rps/gnunet-service-rps_sampler.c
332src/rps/gnunet-service-rps_sampler_elem.c 329src/rps/gnunet-service-rps_sampler_elem.c
333src/rps/gnunet-service-rps_view.c 330src/rps/gnunet-service-rps_view.c
334src/rps/rps_api.c
335src/rps/rps_test_lib.c
336src/rps/rps-test_util.c 331src/rps/rps-test_util.c
332src/rps/rps_api.c
337src/scalarproduct/gnunet-scalarproduct.c 333src/scalarproduct/gnunet-scalarproduct.c
338src/scalarproduct/gnunet-service-scalarproduct_alice.c
339src/scalarproduct/gnunet-service-scalarproduct_bob.c
340src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c 334src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
341src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c 335src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
336src/scalarproduct/gnunet-service-scalarproduct_alice.c
337src/scalarproduct/gnunet-service-scalarproduct_bob.c
342src/scalarproduct/scalarproduct_api.c 338src/scalarproduct/scalarproduct_api.c
343src/secretsharing/gnunet-secretsharing-profiler.c 339src/secretsharing/gnunet-secretsharing-profiler.c
344src/secretsharing/gnunet-service-secretsharing.c 340src/secretsharing/gnunet-service-secretsharing.c
@@ -367,15 +363,16 @@ src/statistics/gnunet-statistics.c
367src/statistics/statistics_api.c 363src/statistics/statistics_api.c
368src/template/gnunet-service-template.c 364src/template/gnunet-service-template.c
369src/template/gnunet-template.c 365src/template/gnunet-template.c
366src/testbed-logger/gnunet-service-testbed-logger.c
367src/testbed-logger/testbed_logger_api.c
370src/testbed/generate-underlay-topology.c 368src/testbed/generate-underlay-topology.c
371src/testbed/gnunet-daemon-latency-logger.c 369src/testbed/gnunet-daemon-latency-logger.c
372src/testbed/gnunet-daemon-testbed-blacklist.c 370src/testbed/gnunet-daemon-testbed-blacklist.c
373src/testbed/gnunet-daemon-testbed-underlay.c 371src/testbed/gnunet-daemon-testbed-underlay.c
374src/testbed/gnunet-helper-testbed.c 372src/testbed/gnunet-helper-testbed.c
375src/testbed/gnunet_mpi_test.c
376src/testbed/gnunet-service-test-barriers.c 373src/testbed/gnunet-service-test-barriers.c
377src/testbed/gnunet-service-testbed_barriers.c
378src/testbed/gnunet-service-testbed.c 374src/testbed/gnunet-service-testbed.c
375src/testbed/gnunet-service-testbed_barriers.c
379src/testbed/gnunet-service-testbed_cache.c 376src/testbed/gnunet-service-testbed_cache.c
380src/testbed/gnunet-service-testbed_connectionpool.c 377src/testbed/gnunet-service-testbed_connectionpool.c
381src/testbed/gnunet-service-testbed_cpustatus.c 378src/testbed/gnunet-service-testbed_cpustatus.c
@@ -383,20 +380,19 @@ src/testbed/gnunet-service-testbed_links.c
383src/testbed/gnunet-service-testbed_meminfo.c 380src/testbed/gnunet-service-testbed_meminfo.c
384src/testbed/gnunet-service-testbed_oc.c 381src/testbed/gnunet-service-testbed_oc.c
385src/testbed/gnunet-service-testbed_peers.c 382src/testbed/gnunet-service-testbed_peers.c
386src/testbed/gnunet_testbed_mpi_spawn.c
387src/testbed/gnunet-testbed-profiler.c 383src/testbed/gnunet-testbed-profiler.c
388src/testbed-logger/gnunet-service-testbed-logger.c 384src/testbed/gnunet_mpi_test.c
389src/testbed-logger/testbed_logger_api.c 385src/testbed/gnunet_testbed_mpi_spawn.c
390src/testbed/testbed_api_barriers.c
391src/testbed/testbed_api.c 386src/testbed/testbed_api.c
387src/testbed/testbed_api_barriers.c
392src/testbed/testbed_api_hosts.c 388src/testbed/testbed_api_hosts.c
393src/testbed/testbed_api_operations.c 389src/testbed/testbed_api_operations.c
394src/testbed/testbed_api_peers.c 390src/testbed/testbed_api_peers.c
395src/testbed/testbed_api_sd.c 391src/testbed/testbed_api_sd.c
396src/testbed/testbed_api_services.c 392src/testbed/testbed_api_services.c
397src/testbed/testbed_api_statistics.c 393src/testbed/testbed_api_statistics.c
398src/testbed/testbed_api_testbed.c
399src/testbed/testbed_api_test.c 394src/testbed/testbed_api_test.c
395src/testbed/testbed_api_testbed.c
400src/testbed/testbed_api_topology.c 396src/testbed/testbed_api_topology.c
401src/testbed/testbed_api_underlay.c 397src/testbed/testbed_api_underlay.c
402src/testing/gnunet-testing.c 398src/testing/gnunet-testing.c
@@ -405,28 +401,28 @@ src/testing/testing.c
405src/topology/friends.c 401src/topology/friends.c
406src/topology/gnunet-daemon-topology.c 402src/topology/gnunet-daemon-topology.c
407src/transport/gnunet-helper-transport-bluetooth.c 403src/transport/gnunet-helper-transport-bluetooth.c
408src/transport/gnunet-helper-transport-wlan.c
409src/transport/gnunet-helper-transport-wlan-dummy.c 404src/transport/gnunet-helper-transport-wlan-dummy.c
410src/transport/gnunet-service-transport_ats.c 405src/transport/gnunet-helper-transport-wlan.c
411src/transport/gnunet-service-transport.c 406src/transport/gnunet-service-transport.c
407src/transport/gnunet-service-transport_ats.c
412src/transport/gnunet-service-transport_hello.c 408src/transport/gnunet-service-transport_hello.c
413src/transport/gnunet-service-transport_manipulation.c 409src/transport/gnunet-service-transport_manipulation.c
414src/transport/gnunet-service-transport_neighbours.c 410src/transport/gnunet-service-transport_neighbours.c
415src/transport/gnunet-service-transport_plugins.c 411src/transport/gnunet-service-transport_plugins.c
416src/transport/gnunet-service-transport_validation.c 412src/transport/gnunet-service-transport_validation.c
417src/transport/gnunet-transport.c
418src/transport/gnunet-transport-certificate-creation.c 413src/transport/gnunet-transport-certificate-creation.c
419src/transport/gnunet-transport-profiler.c 414src/transport/gnunet-transport-profiler.c
420src/transport/gnunet-transport-wlan-receiver.c 415src/transport/gnunet-transport-wlan-receiver.c
421src/transport/gnunet-transport-wlan-sender.c 416src/transport/gnunet-transport-wlan-sender.c
417src/transport/gnunet-transport.c
422src/transport/plugin_transport_http_client.c 418src/transport/plugin_transport_http_client.c
423src/transport/plugin_transport_http_common.c 419src/transport/plugin_transport_http_common.c
424src/transport/plugin_transport_http_server.c 420src/transport/plugin_transport_http_server.c
425src/transport/plugin_transport_smtp.c 421src/transport/plugin_transport_smtp.c
426src/transport/plugin_transport_tcp.c 422src/transport/plugin_transport_tcp.c
427src/transport/plugin_transport_template.c 423src/transport/plugin_transport_template.c
428src/transport/plugin_transport_udp_broadcasting.c
429src/transport/plugin_transport_udp.c 424src/transport/plugin_transport_udp.c
425src/transport/plugin_transport_udp_broadcasting.c
430src/transport/plugin_transport_unix.c 426src/transport/plugin_transport_unix.c
431src/transport/plugin_transport_wlan.c 427src/transport/plugin_transport_wlan.c
432src/transport/plugin_transport_xt.c 428src/transport/plugin_transport_xt.c
@@ -435,6 +431,11 @@ src/transport/tcp_connection_legacy.c
435src/transport/tcp_server_legacy.c 431src/transport/tcp_server_legacy.c
436src/transport/tcp_server_mst_legacy.c 432src/transport/tcp_server_mst_legacy.c
437src/transport/tcp_service_legacy.c 433src/transport/tcp_service_legacy.c
434src/transport/transport-testing-filenames.c
435src/transport/transport-testing-loggers.c
436src/transport/transport-testing-main.c
437src/transport/transport-testing-send.c
438src/transport/transport-testing.c
438src/transport/transport_api_address_to_string.c 439src/transport/transport_api_address_to_string.c
439src/transport/transport_api_blacklist.c 440src/transport/transport_api_blacklist.c
440src/transport/transport_api_core.c 441src/transport/transport_api_core.c
@@ -443,11 +444,6 @@ src/transport/transport_api_manipulation.c
443src/transport/transport_api_monitor_peers.c 444src/transport/transport_api_monitor_peers.c
444src/transport/transport_api_monitor_plugins.c 445src/transport/transport_api_monitor_plugins.c
445src/transport/transport_api_offer_hello.c 446src/transport/transport_api_offer_hello.c
446src/transport/transport-testing.c
447src/transport/transport-testing-filenames.c
448src/transport/transport-testing-loggers.c
449src/transport/transport-testing-main.c
450src/transport/transport-testing-send.c
451src/util/bandwidth.c 447src/util/bandwidth.c
452src/util/bio.c 448src/util/bio.c
453src/util/client.c 449src/util/client.c
@@ -459,8 +455,8 @@ src/util/configuration_loader.c
459src/util/container_bloomfilter.c 455src/util/container_bloomfilter.c
460src/util/container_heap.c 456src/util/container_heap.c
461src/util/container_meta_data.c 457src/util/container_meta_data.c
462src/util/container_multihashmap32.c
463src/util/container_multihashmap.c 458src/util/container_multihashmap.c
459src/util/container_multihashmap32.c
464src/util/container_multipeermap.c 460src/util/container_multipeermap.c
465src/util/container_multishortmap.c 461src/util/container_multishortmap.c
466src/util/crypto_abe.c 462src/util/crypto_abe.c
@@ -482,15 +478,15 @@ src/util/dnsparser.c
482src/util/dnsstub.c 478src/util/dnsstub.c
483src/util/getopt.c 479src/util/getopt.c
484src/util/getopt_helpers.c 480src/util/getopt_helpers.c
485src/util/gnunet-config.c
486src/util/gnunet-config-diff.c 481src/util/gnunet-config-diff.c
482src/util/gnunet-config.c
487src/util/gnunet-ecc.c 483src/util/gnunet-ecc.c
488src/util/gnunet-helper-w32-console.c 484src/util/gnunet-helper-w32-console.c
489src/util/gnunet-resolver.c 485src/util/gnunet-resolver.c
490src/util/gnunet-scrypt.c 486src/util/gnunet-scrypt.c
491src/util/gnunet-service-resolver.c 487src/util/gnunet-service-resolver.c
492src/util/gnunet-timeout.c
493src/util/gnunet-timeout-w32.c 488src/util/gnunet-timeout-w32.c
489src/util/gnunet-timeout.c
494src/util/gnunet-uri.c 490src/util/gnunet-uri.c
495src/util/helper.c 491src/util/helper.c
496src/util/load.c 492src/util/load.c
@@ -518,14 +514,15 @@ src/util/tun.c
518src/util/w32cat.c 514src/util/w32cat.c
519src/util/win.c 515src/util/win.c
520src/util/winproc.c 516src/util/winproc.c
521src/vpn/gnunet-helper-vpn.c
522src/vpn/gnunet-helper-vpn-windows.c 517src/vpn/gnunet-helper-vpn-windows.c
518src/vpn/gnunet-helper-vpn.c
523src/vpn/gnunet-service-vpn.c 519src/vpn/gnunet-service-vpn.c
524src/vpn/gnunet-vpn.c 520src/vpn/gnunet-vpn.c
525src/vpn/vpn_api.c 521src/vpn/vpn_api.c
522src/zklaim/plugin_reclaim_attribute_zklaim.c
526src/zklaim/zklaim.c 523src/zklaim/zklaim.c
527src/zonemaster/gnunet-service-zonemaster.c
528src/zonemaster/gnunet-service-zonemaster-monitor.c 524src/zonemaster/gnunet-service-zonemaster-monitor.c
525src/zonemaster/gnunet-service-zonemaster.c
529src/fs/fs_api.h 526src/fs/fs_api.h
530src/include/gnunet_common.h 527src/include/gnunet_common.h
531src/include/gnunet_mq_lib.h 528src/include/gnunet_mq_lib.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 1c129b041..54f6dfab2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,7 @@ if HAVE_ZKLAIM
29 EXP_DIR += zklaim 29 EXP_DIR += zklaim
30endif 30endif
31endif 31endif
32endif
32if HAVE_JSON 33if HAVE_JSON
33 EXP_DIR += \ 34 EXP_DIR += \
34 auction 35 auction
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 4400db7e1..0081138e0 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2700,6 +2700,11 @@ extern "C"
2700 2700
2701/******************************************************************************/ 2701/******************************************************************************/
2702 2702
2703/******************************************************************************/
2704/*********************************** ZKLAIM ***********************************/
2705#define GNUNET_MESSAGE_TYPE_ZKLAIM_CREATE 990
2706
2707#define GNUNET_MESSAGE_TYPE_ZKLAIM_RESULT_CODE 991
2703 2708
2704/******************************************************************************/ 2709/******************************************************************************/
2705/*********************************** CADET **********************************/ 2710/*********************************** CADET **********************************/
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h
index df5356d76..9b928328e 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_attribute_lib.h
@@ -50,6 +50,12 @@ extern "C"
50#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1 50#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1
51 51
52 52
53/**
54 * ZKlaim attribute.
55 */
56#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_ZKLAIM 2
57
58
53 59
54/** 60/**
55 * An attribute. 61 * An attribute.
diff --git a/src/zklaim/Makefile.am b/src/zklaim/Makefile.am
index a3432794a..1b25ac1a3 100644
--- a/src/zklaim/Makefile.am
+++ b/src/zklaim/Makefile.am
@@ -12,9 +12,51 @@ if USE_COVERAGE
12 XLIB = -lgcov 12 XLIB = -lgcov
13endif 13endif
14 14
15plugin_LTLIBRARIES = \
16 libgnunet_plugin_reclaim_attribute_zklaim.la
15 17
16gnunet_zklaim_SOURCES = zklaim.c 18lib_LTLIBRARIES = \
19 libgnunetzklaim.la
20
21libgnunetzklaim_la_SOURCES = \
22 zklaim_api.c \
23 zklaim_api.h
24libgnunetzklaim_la_LIBADD = \
25 $(top_builddir)/src/util/libgnunetutil.la \
26 $(GN_LIBINTL) $(XLIB)
27libgnunetzklaim_la_LDFLAGS = \
28 $(GN_LIB_LDFLAGS) $(WINFLAGS) \
29 -version-info 0:0:0
30
31
32libgnunet_plugin_reclaim_attribute_zklaim_la_SOURCES = \
33 plugin_reclaim_attribute_zklaim.c
34libgnunet_plugin_reclaim_attribute_zklaim_la_LIBADD = \
35 $(top_builddir)/src/util/libgnunetutil.la \
36 $(LTLIBINTL)
37libgnunet_plugin_reclaim_attribute_zklaim_la_LDFLAGS = \
38 $(GN_PLUGIN_LDFLAGS)
39
40test_zklaim_SOURCES = zklaim.c
41test_zklaim_LDADD = \
42 $(GCLIBADD)\
43 $(LIBGCRYPT_LIBS) \
44 -lzklaim \
45 -lgcrypt \
46 -lgmp \
47 -lgmpxx \
48 -lcrypto \
49 -lprocps \
50 -lstdc++ \
51 -lm
52test_zklaim_LDFLAGS = \
53 $(GN_LIB_LDFLAGS)
54
55gnunet_zklaim_SOURCES = gnunet-zklaim.c
17gnunet_zklaim_LDADD = \ 56gnunet_zklaim_LDADD = \
57 $(top_builddir)/src/util/libgnunetutil.la \
58 $(top_builddir)/src/identity/libgnunetidentity.la \
59 libgnunetzklaim.la \
18 $(GCLIBADD)\ 60 $(GCLIBADD)\
19 $(LIBGCRYPT_LIBS) \ 61 $(LIBGCRYPT_LIBS) \
20 -lzklaim \ 62 -lzklaim \
@@ -28,8 +70,9 @@ gnunet_zklaim_LDADD = \
28gnunet_zklaim_LDFLAGS = \ 70gnunet_zklaim_LDFLAGS = \
29 $(GN_LIB_LDFLAGS) 71 $(GN_LIB_LDFLAGS)
30 72
31#lib_LTLIBRARIES = libgnunetzklaim.la
32bin_PROGRAMS = gnunet-zklaim 73bin_PROGRAMS = gnunet-zklaim
74#lib_LTLIBRARIES = libgnunetzklaim.la
75check_PROGRAMS = test_zklaim
33 76
34if ENABLE_TEST_RUN 77if ENABLE_TEST_RUN
35AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 78AM_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/zklaim/plugin_reclaim_attribute_zklaim.c b/src/zklaim/plugin_reclaim_attribute_zklaim.c
new file mode 100644
index 000000000..a79576cb1
--- /dev/null
+++ b/src/zklaim/plugin_reclaim_attribute_zklaim.c
@@ -0,0 +1,181 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 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
19/**
20 * @file zklaim/plugin_reclaim_attribute_zklaim.c
21 * @brief identity attribute plugin to provide the API for ZKlaims
22 *
23 * @author Martin Schanzenbach
24 */
25#include "platform.h"
26#include "gnunet_util_lib.h"
27#include "gnunet_reclaim_attribute_plugin.h"
28#include <inttypes.h>
29
30
31/**
32 * Convert the 'value' of an attribute to a string.
33 *
34 * @param cls closure, unused
35 * @param type type of the attribute
36 * @param data value in binary encoding
37 * @param data_size number of bytes in @a data
38 * @return NULL on error, otherwise human-readable representation of the value
39 */
40static char *
41zklaim_value_to_string (void *cls,
42 uint32_t type,
43 const void *data,
44 size_t data_size)
45{
46
47 switch (type)
48 {
49 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_ZKLAIM:
50 return GNUNET_strndup (data, data_size);
51 default:
52 return NULL;
53 }
54}
55
56
57/**
58 * Convert human-readable version of a 'value' of an attribute to the binary
59 * representation.
60 *
61 * @param cls closure, unused
62 * @param type type of the attribute
63 * @param s human-readable string
64 * @param data set to value in binary encoding (will be allocated)
65 * @param data_size set to number of bytes in @a data
66 * @return #GNUNET_OK on success
67 */
68static int
69zklaim_string_to_value (void *cls,
70 uint32_t type,
71 const char *s,
72 void **data,
73 size_t *data_size)
74{
75 if (NULL == s)
76 return GNUNET_SYSERR;
77 switch (type)
78 {
79
80 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_ZKLAIM:
81 *data = GNUNET_strdup (s);
82 *data_size = strlen (s);
83 return GNUNET_OK;
84 default:
85 return GNUNET_SYSERR;
86 }
87}
88
89
90/**
91 * Mapping of attribute type numbers to human-readable
92 * attribute type names.
93 */
94static struct {
95 const char *name;
96 uint32_t number;
97} zklaim_name_map[] = {
98 { "ZKLAIM", GNUNET_RECLAIM_ATTRIBUTE_TYPE_ZKLAIM },
99 { NULL, UINT32_MAX }
100};
101
102
103/**
104 * Convert a type name to the corresponding number.
105 *
106 * @param cls closure, unused
107 * @param zklaim_typename name to convert
108 * @return corresponding number, UINT32_MAX on error
109 */
110static uint32_t
111zklaim_typename_to_number (void *cls,
112 const char *zklaim_typename)
113{
114 unsigned int i;
115
116 i=0;
117 while ( (NULL != zklaim_name_map[i].name) &&
118 (0 != strcasecmp (zklaim_typename,
119 zklaim_name_map[i].name)) )
120 i++;
121 return zklaim_name_map[i].number;
122}
123
124
125/**
126 * Convert a type number (i.e. 1) to the corresponding type string
127 *
128 * @param cls closure, unused
129 * @param type number of a type to convert
130 * @return corresponding typestring, NULL on error
131 */
132static const char *
133zklaim_number_to_typename (void *cls,
134 uint32_t type)
135{
136 unsigned int i;
137
138 i=0;
139 while ( (NULL != zklaim_name_map[i].name) &&
140 (type != zklaim_name_map[i].number) )
141 i++;
142 return zklaim_name_map[i].name;
143}
144
145
146/**
147 * Entry point for the plugin.
148 *
149 * @param cls NULL
150 * @return the exported block API
151 */
152void *
153libgnunet_plugin_reclaim_attribute_zklaim_init (void *cls)
154{
155 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
156
157 api = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions);
158 api->value_to_string = &zklaim_value_to_string;
159 api->string_to_value = &zklaim_string_to_value;
160 api->typename_to_number = &zklaim_typename_to_number;
161 api->number_to_typename = &zklaim_number_to_typename;
162 return api;
163}
164
165
166/**
167 * Exit point from the plugin.
168 *
169 * @param cls the return value from #libgnunet_plugin_block_test_init()
170 * @return NULL
171 */
172void *
173libgnunet_plugin_reclaim_attribute_zklaim_done (void *cls)
174{
175 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = cls;
176
177 GNUNET_free (api);
178 return NULL;
179}
180
181/* end of plugin_reclaim_attribute_type_zklaim.c */
diff --git a/src/zklaim/zklaim_api.c b/src/zklaim/zklaim_api.c
new file mode 100644
index 000000000..f54ede342
--- /dev/null
+++ b/src/zklaim/zklaim_api.c
@@ -0,0 +1,433 @@
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
19/**
20 * @file zklaim/zklaim_api.c
21 * @brief api to interact with the zklaim service
22 * @author Martin Schanzenbach
23 */
24#include "platform.h"
25#include "gnunet_util_lib.h"
26#include "gnunet_constants.h"
27#include "gnunet_protocols.h"
28#include "gnunet_zklaim_service.h"
29#include "zklaim/zklaim.h"
30#include "zklaim_api.h"
31
32#define LOG(kind,...) GNUNET_log_from (kind, "zklaim-api",__VA_ARGS__)
33
34/**
35 * Handle for an ego.
36 */
37struct GNUNET_ZKLAIM_Context
38{
39 /**
40 * ZKlaim context.
41 */
42 struct zklaim_ctx *zk_ctx;
43
44 /**
45 * Current name associated with this context.
46 */
47 char *name;
48
49 /**
50 * Attributes associated with context
51 */
52 char *attrs;
53
54 /**
55 * Client context associated with this ego.
56 */
57 void *ctx;
58
59};
60
61
62/**
63 * Handle for an operation with the service.
64 */
65struct GNUNET_ZKLAIM_Operation
66{
67
68 /**
69 * Main handle.
70 */
71 struct GNUNET_ZKLAIM_Handle *h;
72
73 /**
74 * We keep operations in a DLL.
75 */
76 struct GNUNET_ZKLAIM_Operation *next;
77
78 /**
79 * We keep operations in a DLL.
80 */
81 struct GNUNET_ZKLAIM_Operation *prev;
82
83 /**
84 * Message to send to the zklaim service.
85 * Allocated at the end of this struct.
86 */
87 const struct GNUNET_MessageHeader *msg;
88
89 /**
90 * Continuation to invoke with the result of the transmission; @e cb
91 * will be NULL in this case.
92 */
93 GNUNET_ZKLAIM_ContinuationWithStatus cont;
94
95 /**
96 * Closure for @e cont or @e cb.
97 */
98 void *cls;
99
100};
101
102
103/**
104 * Handle for the service.
105 */
106struct GNUNET_ZKLAIM_Handle
107{
108 /**
109 * Configuration to use.
110 */
111 const struct GNUNET_CONFIGURATION_Handle *cfg;
112
113 /**
114 * Connection to service.
115 */
116 struct GNUNET_MQ_Handle *mq;
117
118 /**
119 * Hash map from the hash of the public key to the
120 * respective `GNUNET_ZKLAIM_Ego` handle.
121 */
122 struct GNUNET_CONTAINER_MultiHashMap *egos;
123
124 /**
125 * Closure for @e cb.
126 */
127 void *cb_cls;
128
129 /**
130 * Head of active operations.
131 */
132 struct GNUNET_ZKLAIM_Operation *op_head;
133
134 /**
135 * Tail of active operations.
136 */
137 struct GNUNET_ZKLAIM_Operation *op_tail;
138
139 /**
140 * Task doing exponential back-off trying to reconnect.
141 */
142 struct GNUNET_SCHEDULER_Task *reconnect_task;
143
144 /**
145 * Time for next connect retry.
146 */
147 struct GNUNET_TIME_Relative reconnect_delay;
148
149};
150
151
152/**
153 * Try again to connect to the zklaim service.
154 *
155 * @param cls handle to the zklaim service.
156 */
157static void
158reconnect (void *cls);
159
160/**
161 * Reschedule a connect attempt to the service.
162 *
163 * @param h transport service to reconnect
164 */
165static void
166reschedule_connect (struct GNUNET_ZKLAIM_Handle *h)
167{
168 struct GNUNET_ZKLAIM_Operation *op;
169
170 GNUNET_assert (NULL == h->reconnect_task);
171
172 if (NULL != h->mq)
173 {
174 GNUNET_MQ_destroy (h->mq);
175 h->mq = NULL;
176 }
177 while (NULL != (op = h->op_head))
178 {
179 GNUNET_CONTAINER_DLL_remove (h->op_head,
180 h->op_tail,
181 op);
182 if (NULL != op->cont)
183 op->cont (op->cls,
184 GNUNET_SYSERR,
185 "Error in communication with the zklaim service");
186 GNUNET_free (op);
187 }
188 LOG (GNUNET_ERROR_TYPE_DEBUG,
189 "Scheduling task to reconnect to zklaim service in %s.\n",
190 GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay,
191 GNUNET_YES));
192 h->reconnect_task =
193 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
194 &reconnect,
195 h);
196 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
197}
198
199
200/**
201 * Generic error handler, called with the appropriate error code and
202 * the same closure specified at the creation of the message queue.
203 * Not every message queue implementation supports an error handler.
204 *
205 * @param cls closure with the `struct GNUNET_ZKLAIM_Handle *`
206 * @param error error code
207 */
208static void
209mq_error_handler (void *cls,
210 enum GNUNET_MQ_Error error)
211{
212 struct GNUNET_ZKLAIM_Handle *h = cls;
213
214 reschedule_connect (h);
215}
216
217
218/**
219 * We received a result code from the service. Check the message
220 * is well-formed.
221 *
222 * @param cls closure
223 * @param rcm result message received
224 * @return #GNUNET_OK if the message is well-formed
225 */
226static int
227check_zklaim_result_code (void *cls,
228 const struct ResultCodeMessage *rcm)
229{
230 uint16_t size = ntohs (rcm->header.size) - sizeof (*rcm);
231 const char *str = (const char *) &rcm[1];
232
233 if (0 == size)
234 return GNUNET_OK;
235 if ('\0' != str[size - 1])
236 {
237 GNUNET_break (0);
238 return GNUNET_SYSERR;
239 }
240 return GNUNET_OK;
241}
242
243
244/**
245 * We received a result code from the service.
246 *
247 * @param cls closure
248 * @param rcm result message received
249 */
250static void
251handle_zklaim_result_code (void *cls,
252 const struct ResultCodeMessage *rcm)
253{
254 struct GNUNET_ZKLAIM_Handle *h = cls;
255 struct GNUNET_ZKLAIM_Operation *op;
256 uint16_t size = ntohs (rcm->header.size) - sizeof (*rcm);
257 const char *str = (0 == size) ? NULL : (const char *) &rcm[1];
258
259 op = h->op_head;
260 if (NULL == op)
261 {
262 GNUNET_break (0);
263 reschedule_connect (h);
264 return;
265 }
266 GNUNET_CONTAINER_DLL_remove (h->op_head,
267 h->op_tail,
268 op);
269 if (NULL != op->cont)
270 op->cont (op->cls,
271 GNUNET_OK,
272 str);
273 GNUNET_free (op);
274}
275
276
277/**
278 * Try again to connect to the zklaim service.
279 *
280 * @param cls handle to the zklaim service.
281 */
282static void
283reconnect (void *cls)
284{
285 struct GNUNET_ZKLAIM_Handle *h = cls;
286 struct GNUNET_MQ_MessageHandler handlers[] = {
287 GNUNET_MQ_hd_var_size (zklaim_result_code,
288 GNUNET_MESSAGE_TYPE_ZKLAIM_RESULT_CODE,
289 struct ResultCodeMessage,
290 h),
291 GNUNET_MQ_handler_end ()
292 };
293
294 h->reconnect_task = NULL;
295 LOG (GNUNET_ERROR_TYPE_DEBUG,
296 "Connecting to zklaim service.\n");
297 GNUNET_assert (NULL == h->mq);
298 h->mq = GNUNET_CLIENT_connect (h->cfg,
299 "zklaim",
300 handlers,
301 &mq_error_handler,
302 h);
303 if (NULL == h->mq)
304 return;
305}
306
307
308/**
309 * Connect to the zklaim service.
310 *
311 * @param cfg the configuration to use
312 * @param cb function to call on all zklaim events, can be NULL
313 * @param cb_cls closure for @a cb
314 * @return handle to use
315 */
316struct GNUNET_ZKLAIM_Handle *
317GNUNET_ZKLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
318{
319 struct GNUNET_ZKLAIM_Handle *h;
320
321 h = GNUNET_new (struct GNUNET_ZKLAIM_Handle);
322 h->cfg = cfg;
323 reconnect (h);
324 if (NULL == h->mq)
325 {
326 GNUNET_free (h);
327 return NULL;
328 }
329 return h;
330}
331
332
333/**
334 * Create a new zklaim with the given name.
335 *
336 * @param h zklaim service to use
337 * @param name desired name
338 * @param cont function to call with the result (will only be called once)
339 * @param cont_cls closure for @a cont
340 * @return handle to abort the operation
341 */
342struct GNUNET_ZKLAIM_Operation *
343GNUNET_ZKLAIM_context_create (struct GNUNET_ZKLAIM_Handle *h,
344 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk,
345 const char *name,
346 const char *attr_list,
347 GNUNET_ZKLAIM_ContinuationWithStatus cont,
348 void *cont_cls)
349{
350 struct GNUNET_ZKLAIM_Operation *op;
351 struct GNUNET_MQ_Envelope *env;
352 struct CreateRequestMessage *crm;
353 size_t slen;
354
355 if (NULL == h->mq)
356 return NULL;
357 slen = strlen (name) + 1;
358 if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct CreateRequestMessage))
359 {
360 GNUNET_break (0);
361 return NULL;
362 }
363 op = GNUNET_new (struct GNUNET_ZKLAIM_Operation);
364 op->h = h;
365 op->cont = cont;
366 op->cls = cont_cls;
367 GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
368 h->op_tail,
369 op);
370 env = GNUNET_MQ_msg_extra (crm,
371 slen,
372 GNUNET_MESSAGE_TYPE_ZKLAIM_CREATE);
373 crm->name_len = htons (slen);
374 crm->reserved = htons (0);
375 crm->private_key = *pk;
376 GNUNET_memcpy (&crm[1],
377 name,
378 slen);
379 GNUNET_MQ_send (h->mq,
380 env);
381 //TODO add attrs
382 return op;
383}
384
385
386/**
387 * Cancel an zklaim operation. Note that the operation MAY still
388 * be executed; this merely cancels the continuation; if the request
389 * was already transmitted, the service may still choose to complete
390 * the operation.
391 *
392 * @param op operation to cancel
393 */
394void
395GNUNET_ZKLAIM_cancel (struct GNUNET_ZKLAIM_Operation *op)
396{
397 op->cont = NULL;
398}
399
400
401/**
402 * Disconnect from zklaim service
403 *
404 * @param h handle to destroy
405 */
406void
407GNUNET_ZKLAIM_disconnect (struct GNUNET_ZKLAIM_Handle *h)
408{
409 struct GNUNET_ZKLAIM_Operation *op;
410
411 GNUNET_assert (NULL != h);
412 if (h->reconnect_task != NULL)
413 {
414 GNUNET_SCHEDULER_cancel (h->reconnect_task);
415 h->reconnect_task = NULL;
416 }
417 while (NULL != (op = h->op_head))
418 {
419 GNUNET_break (NULL == op->cont);
420 GNUNET_CONTAINER_DLL_remove (h->op_head,
421 h->op_tail,
422 op);
423 GNUNET_free (op);
424 }
425 if (NULL != h->mq)
426 {
427 GNUNET_MQ_destroy (h->mq);
428 h->mq = NULL;
429 }
430 GNUNET_free (h);
431}
432
433/* end of zklaim_api.c */
diff --git a/src/zklaim/zklaim_api.h b/src/zklaim/zklaim_api.h
new file mode 100644
index 000000000..77053c667
--- /dev/null
+++ b/src/zklaim/zklaim_api.h
@@ -0,0 +1,90 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2013 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
19/**
20 * @author Martin Schanzenbach
21 * @file zklaim/zklaim.h
22 *
23 * @brief Common type definitions for the zklaim
24 * service and API.
25 */
26#ifndef ZKLAIM_API_H
27#define ZKLAIM_API_H
28
29#include "gnunet_common.h"
30
31
32GNUNET_NETWORK_STRUCT_BEGIN
33
34
35/**
36 * Answer from service to client about last operation;
37 * GET_DEFAULT maybe answered with this message on failure;
38 * CREATE and RENAME will always be answered with this message.
39 */
40struct ResultCodeMessage
41{
42 /**
43 * Type: #GNUNET_MESSAGE_TYPE_ZKLAIM_RESULT_CODE
44 */
45 struct GNUNET_MessageHeader header;
46
47 /**
48 * Status code for the last operation, in NBO.
49 * (currently not used).
50 */
51 uint32_t result_code GNUNET_PACKED;
52
53 /* followed by 0-terminated error message (on error) */
54
55};
56
57
58/**
59 * Client requests creation of an identity. Service
60 * will respond with a result code.
61 */
62struct CreateRequestMessage
63{
64 /**
65 * Type: #GNUNET_MESSAGE_TYPE_ZKLAIM_CREATE
66 */
67 struct GNUNET_MessageHeader header;
68
69 /**
70 * Number of bytes in identity name string including 0-termination, in NBO.
71 */
72 uint16_t name_len GNUNET_PACKED;
73
74 /**
75 * Always zero.
76 */
77 uint16_t reserved GNUNET_PACKED;
78
79 /**
80 * The private key
81 */
82 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
83
84 /* followed by 0-terminated identity name */
85
86};
87
88GNUNET_NETWORK_STRUCT_END
89
90#endif