summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am5
-rw-r--r--src/abd/delegate_misc.c1
-rw-r--r--src/abd/gnunet-abd.c4
-rw-r--r--src/abd/gnunet-service-abd.c1
-rw-r--r--src/arm/gnunet-service-arm.c2
-rw-r--r--src/arm/meson.build71
-rw-r--r--src/arm/mockup-service.c2
-rw-r--r--src/arm/test_gnunet_service_arm.c3
-rw-r--r--src/ats/ats_api_connectivity.c5
-rw-r--r--src/ats/ats_api_performance.c50
-rw-r--r--src/ats/ats_api_scheduling.c20
-rw-r--r--src/ats/gnunet-service-ats_addresses.c31
-rw-r--r--src/ats/gnunet-service-ats_addresses.h2
-rw-r--r--src/ats/gnunet-service-ats_connectivity.c2
-rw-r--r--src/ats/gnunet-service-ats_plugins.c18
-rw-r--r--src/ats/gnunet-service-ats_plugins.h3
-rw-r--r--src/ats/gnunet-service-ats_preferences.c5
-rw-r--r--src/ats/gnunet-service-ats_reservations.c6
-rw-r--r--src/ats/gnunet-service-ats_reservations.h2
-rw-r--r--src/ats/gnunet-service-ats_scheduling.c14
-rw-r--r--src/ats/gnunet-service-ats_scheduling.h3
-rw-r--r--src/ats/meson.build58
-rw-r--r--src/block/bg_bf.c2
-rw-r--r--src/block/block.c7
-rw-r--r--src/block/meson.build47
-rw-r--r--src/block/plugin_block_template.c7
-rw-r--r--src/block/plugin_block_test.c7
-rw-r--r--src/cadet/.gitignore1
-rw-r--r--src/cadet/cadet.h1
-rw-r--r--src/cadet/cadet_api.c24
-rw-r--r--src/cadet/cadet_api_drop_message.c2
-rw-r--r--src/cadet/cadet_api_get_path.c9
-rw-r--r--src/cadet/cadet_api_list_tunnels.c2
-rw-r--r--src/cadet/desirability_table.c1
-rw-r--r--src/cadet/gnunet-cadet-profiler.c4
-rw-r--r--src/cadet/gnunet-service-cadet.c10
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c70
-rw-r--r--src/cadet/gnunet-service-cadet_channel.h14
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c33
-rw-r--r--src/cadet/gnunet-service-cadet_connection.h6
-rw-r--r--src/cadet/gnunet-service-cadet_core.c19
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c30
-rw-r--r--src/cadet/gnunet-service-cadet_hello.c2
-rw-r--r--src/cadet/gnunet-service-cadet_paths.c14
-rw-r--r--src/cadet/gnunet-service-cadet_paths.h3
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c53
-rw-r--r--src/cadet/gnunet-service-cadet_peer.h8
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.c68
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.h21
-rw-r--r--src/cadet/meson.build75
-rw-r--r--src/cadet/test_cadet.c2
-rw-r--r--src/cadet/test_cadet_flow.c2
-rw-r--r--src/consensus/Makefile.am6
-rw-r--r--src/consensus/consensus_api.c3
-rw-r--r--src/consensus/gnunet-consensus-profiler.c2
-rw-r--r--src/consensus/meson.build48
-rw-r--r--src/consensus/plugin_block_consensus.c1
-rw-r--r--src/conversation/conversation.h33
-rw-r--r--src/conversation/conversation_api.c40
-rw-r--r--src/conversation/conversation_api_call.c16
-rw-r--r--src/conversation/gnunet-helper-audio-playback-gst.c2
-rw-r--r--src/conversation/gnunet-service-conversation.c112
-rw-r--r--src/conversation/gnunet_gst.c1
-rw-r--r--src/conversation/gnunet_gst_test.c1
-rw-r--r--src/conversation/meson.build96
-rw-r--r--src/conversation/test_conversation.conf8
-rw-r--r--src/conversation/test_conversation_api.c13
-rw-r--r--src/conversation/test_conversation_api_reject.c13
-rw-r--r--src/conversation/test_conversation_api_twocalls.c13
-rw-r--r--src/core/core.h3
-rw-r--r--src/core/core_api.c1
-rw-r--r--src/core/gnunet-service-core_kx.c16
-rw-r--r--src/core/gnunet-service-core_sessions.c15
-rw-r--r--src/core/gnunet-service-core_typemap.c6
-rw-r--r--src/core/meson.build48
-rw-r--r--src/core/test_core_api.c8
-rw-r--r--src/core/test_core_api_reliability.c6
-rw-r--r--src/core/test_core_api_send_to_self.conf2
-rw-r--r--src/core/test_core_api_start_only.c18
-rw-r--r--src/core/test_core_quota_compliance.c29
-rw-r--r--src/curl/Makefile.am14
-rw-r--r--src/curl/curl.c61
-rw-r--r--src/curl/curl_reschedule.c40
-rw-r--r--src/curl/meson.build19
-rw-r--r--src/datacache/Makefile.am10
-rw-r--r--src/datacache/datacache-0001.sql48
-rw-r--r--src/datacache/datacache-drop.sql25
-rw-r--r--src/datacache/datacache.conf4
-rw-r--r--src/datacache/meson.build51
-rw-r--r--src/datacache/perf_datacache.c2
-rw-r--r--src/datacache/plugin_datacache_postgres.c104
-rw-r--r--src/datacache/plugin_datacache_sqlite.c2
-rw-r--r--src/datacache/test_datacache.c3
-rw-r--r--src/datacache/test_datacache_quota.c3
-rw-r--r--src/datastore/Makefile.am73
-rw-r--r--src/datastore/datastore-0001.sql49
-rw-r--r--src/datastore/datastore-drop.sql25
-rw-r--r--src/datastore/datastore.conf.in1
-rw-r--r--src/datastore/datastore_api.c83
-rw-r--r--src/datastore/gnunet-datastore.c2
-rw-r--r--src/datastore/gnunet-service-datastore.c15
-rw-r--r--src/datastore/meson.build74
-rw-r--r--src/datastore/perf_datastore_api.c2
-rw-r--r--src/datastore/perf_plugin_datastore.c2
-rw-r--r--src/datastore/perf_plugin_datastore_data_mysql.conf10
-rw-r--r--src/datastore/plugin_datastore_mysql.c1203
-rw-r--r--src/datastore/plugin_datastore_postgres.c136
-rw-r--r--src/datastore/plugin_datastore_sqlite.c1
-rw-r--r--src/datastore/test_datastore_api.c2
-rw-r--r--src/datastore/test_datastore_api_data_mysql.conf10
-rw-r--r--src/datastore/test_datastore_api_management.c2
-rw-r--r--src/datastore/test_plugin_datastore.c2
-rw-r--r--src/datastore/test_plugin_datastore_data_mysql.conf9
-rw-r--r--src/dht/dht_api.c1
-rwxr-xr-xsrc/dht/dhtu_testbed_connect.sh10
-rw-r--r--src/dht/dhtu_testbed_deploy.conf2
-rwxr-xr-xsrc/dht/dhtu_testbed_deploy.sh19
-rw-r--r--src/dht/gnunet-dht-get.c44
-rw-r--r--src/dht/gnunet-dht-put.c4
-rw-r--r--src/dht/gnunet-service-dht.h4
-rw-r--r--src/dht/gnunet-service-dht_clients.c86
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c138
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h4
-rw-r--r--src/dht/gnunet-service-dht_routing.c2
-rw-r--r--src/dht/meson.build90
-rw-r--r--src/dht/plugin_block_dht.c20
-rwxr-xr-xsrc/dht/test_dht_tools.sh5
-rw-r--r--src/dhtu/meson.build36
-rw-r--r--src/dhtu/plugin_dhtu_gnunet.c2
-rw-r--r--src/dhtu/plugin_dhtu_ip.c1
-rw-r--r--src/dhtu/testing_dhtu_cmd_send.c2
-rw-r--r--src/dns/dns_api.c8
-rw-r--r--src/dns/gnunet-dns-monitor.c1
-rw-r--r--src/dns/gnunet-dns-redirector.c1
-rw-r--r--src/dns/gnunet-helper-dns.c2
-rw-r--r--src/dns/gnunet-service-dns.c3
-rw-r--r--src/dns/gnunet-zonewalk.c2
-rw-r--r--src/dns/meson.build65
-rw-r--r--src/dns/plugin_block_dns.c1
-rw-r--r--src/exit/gnunet-daemon-exit.c8
-rw-r--r--src/exit/gnunet-helper-exit.c2
-rw-r--r--src/exit/meson.build29
-rw-r--r--src/fragmentation/fragmentation.c1
-rw-r--r--src/fragmentation/fragmentation.h2
-rw-r--r--src/fragmentation/meson.build21
-rw-r--r--src/fs/Makefile.am20
-rw-r--r--src/fs/fs.conf.in3
-rw-r--r--src/fs/fs.h1
-rw-r--r--src/fs/fs_api.c76
-rw-r--r--src/fs/fs_api.h11
-rw-r--r--src/fs/fs_directory.c65
-rw-r--r--src/fs/fs_dirmetascan.c35
-rw-r--r--src/fs/fs_download.c105
-rw-r--r--src/fs/fs_file_information.c102
-rw-r--r--src/fs/fs_getopt.c44
-rw-r--r--src/fs/fs_list_indexed.c18
-rw-r--r--src/fs/fs_misc.c45
-rw-r--r--src/fs/fs_namespace.c38
-rw-r--r--src/fs/fs_publish.c13
-rw-r--r--src/fs/fs_publish_ksk.c15
-rw-r--r--src/fs/fs_publish_ublock.c33
-rw-r--r--src/fs/fs_publish_ublock.h9
-rw-r--r--src/fs/fs_search.c59
-rw-r--r--src/fs/fs_sharetree.c33
-rw-r--r--src/fs/fs_test_lib.c29
-rw-r--r--src/fs/fs_tree.c11
-rw-r--r--src/fs/fs_unindex.c1
-rw-r--r--src/fs/fs_uri.c30
-rw-r--r--src/fs/gnunet-daemon-fsprofiler.c1
-rw-r--r--src/fs/gnunet-directory.c9
-rw-r--r--src/fs/gnunet-download.c1
-rw-r--r--src/fs/gnunet-fs.c93
-rw-r--r--src/fs/gnunet-helper-fs-publish.c45
-rw-r--r--src/fs/gnunet-publish.c27
-rw-r--r--src/fs/gnunet-search.c136
-rw-r--r--src/fs/gnunet-service-fs.c17
-rw-r--r--src/fs/gnunet-service-fs_cadet_server.c1
-rw-r--r--src/fs/gnunet-service-fs_cp.c31
-rw-r--r--src/fs/gnunet-service-fs_cp.h8
-rw-r--r--src/fs/gnunet-service-fs_indexing.c27
-rw-r--r--src/fs/gnunet-service-fs_indexing.h1
-rw-r--r--src/fs/gnunet-service-fs_pr.c36
-rw-r--r--src/fs/gnunet-service-fs_push.c9
-rw-r--r--src/fs/gnunet-service-fs_put.c6
-rw-r--r--src/fs/gnunet-unindex.c1
-rw-r--r--src/fs/meson.build141
-rw-r--r--src/fs/meta_data.c (renamed from src/util/container_meta_data.c)518
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p.c4
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p_respect.c3
-rw-r--r--src/fs/plugin_block_fs.c4
-rw-r--r--src/fs/test_fs_directory.c50
-rw-r--r--src/fs/test_fs_download.c6
-rw-r--r--src/fs/test_fs_download_persistence.c6
-rw-r--r--src/fs/test_fs_file_information.c8
-rw-r--r--src/fs/test_fs_list_indexed.c6
-rw-r--r--src/fs/test_fs_meta_data.c492
-rw-r--r--src/fs/test_fs_namespace.c18
-rw-r--r--src/fs/test_fs_namespace_list_updateable.c12
-rw-r--r--src/fs/test_fs_publish.c6
-rw-r--r--src/fs/test_fs_publish_persistence.c6
-rw-r--r--src/fs/test_fs_search.c6
-rw-r--r--src/fs/test_fs_search_persistence.c6
-rw-r--r--src/fs/test_fs_search_probes.c6
-rw-r--r--src/fs/test_fs_search_with_and.c6
-rw-r--r--src/fs/test_fs_test_lib.c6
-rw-r--r--src/fs/test_fs_unindex.c6
-rw-r--r--src/fs/test_fs_unindex_persistence.c6
-rw-r--r--src/fs/test_fs_uri.c5
-rw-r--r--src/fs/test_gnunet_service_fs_migration.c4
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c3
-rw-r--r--src/gns/Makefile.am38
-rw-r--r--src/gns/gns.conf.in18
-rw-r--r--src/gns/gns.h13
-rw-r--r--src/gns/gns_api.c16
-rw-r--r--src/gns/gns_tld_api.c2
-rw-r--r--src/gns/gnunet-bcd.c8
-rw-r--r--src/gns/gnunet-dns2gns.c18
-rw-r--r--src/gns/gnunet-gns-proxy.c23
-rw-r--r--src/gns/gnunet-gns.c1
-rw-r--r--src/gns/gnunet-service-gns.c37
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c7
-rw-r--r--src/gns/gnunet-service-gns_resolver.c24
-rw-r--r--src/gns/meson.build150
-rw-r--r--src/gns/nss/meson.build31
-rw-r--r--src/gns/nss/nss_gns.c6
-rw-r--r--src/gns/plugin_block_gns.c1
-rw-r--r--src/gns/plugin_gnsrecord_gns.c3
-rw-r--r--src/gns/plugin_rest_gns.c2
-rw-r--r--src/gns/test_dns2gns.conf2
-rwxr-xr-xsrc/gns/test_gns_at_lookup.sh1
-rwxr-xr-xsrc/gns/test_gns_caa_lookup.sh1
-rwxr-xr-xsrc/gns/test_gns_delegated_lookup.sh1
-rwxr-xr-xsrc/gns/test_gns_dht_lookup.sh2
-rwxr-xr-xsrc/gns/test_gns_gns2dns_cname_lookup.sh3
-rwxr-xr-xsrc/gns/test_gns_gns2dns_lookup.sh8
-rwxr-xr-xsrc/gns/test_gns_gns2dns_zkey_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_ipv6_lookup.sh1
-rw-r--r--src/gns/test_gns_lookup.conf13
-rwxr-xr-xsrc/gns/test_gns_lookup.sh1
-rw-r--r--src/gns/test_gns_lookup_peer1.conf2
-rw-r--r--src/gns/test_gns_lookup_peer2.conf2
-rwxr-xr-xsrc/gns/test_gns_mx_lookup.sh6
-rw-r--r--src/gns/test_gns_proxy.conf11
-rwxr-xr-xsrc/gns/test_gns_redirect_lookup.sh4
-rwxr-xr-xsrc/gns/test_gns_rel_expiration.sh1
-rwxr-xr-xsrc/gns/test_gns_revocation.sh1
-rwxr-xr-xsrc/gns/test_gns_soa_lookup.sh1
-rwxr-xr-xsrc/gns/test_gns_txt_lookup.sh1
-rwxr-xr-xsrc/gns/test_plugin_rest_gns.sh7
-rwxr-xr-xsrc/gns/test_proxy.sh17
-rw-r--r--src/gnsrecord/Makefile.am17
-rw-r--r--src/gnsrecord/gnsrecord.c17
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c268
-rw-r--r--src/gnsrecord/gnsrecord_crypto.h2
-rw-r--r--src/gnsrecord/gnsrecord_misc.c75
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c20
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c118
-rw-r--r--src/gnsrecord/json_gnsrecord.c164
-rw-r--r--src/gnsrecord/meson.build39
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c9
-rw-r--r--src/gnsrecord/test_gnsrecord_block_expiration.c5
-rw-r--r--src/gnsrecord/test_gnsrecord_crypto.c3
-rw-r--r--src/gnsrecord/test_gnsrecord_serialization.c1
-rw-r--r--src/gnsrecord/test_gnsrecord_testvectors.c740
-rw-r--r--src/hello/address.c18
-rw-r--r--src/hello/hello-ng.c6
-rw-r--r--src/hello/hello.c22
-rw-r--r--src/hello/meson.build35
-rw-r--r--src/hello/test_hello-ng.c8
-rw-r--r--src/hello/test_hello-uri.c1
-rw-r--r--src/hostlist/Makefile.am26
-rw-r--r--src/hostlist/gnunet-daemon-hostlist_client.c9
-rw-r--r--src/hostlist/meson.build27
-rw-r--r--src/identity/Makefile.am22
-rw-r--r--src/identity/gnunet-identity.c191
-rw-r--r--src/identity/gnunet-service-identity.c325
-rw-r--r--src/identity/identity.h75
-rw-r--r--src/identity/identity_api.c495
-rw-r--r--src/identity/identity_api_lookup.c23
-rw-r--r--src/identity/identity_api_suffix_lookup.c25
-rw-r--r--src/identity/meson.build48
-rw-r--r--src/identity/plugin_rest_identity.c490
-rw-r--r--src/identity/test_identity.c64
-rw-r--r--src/identity/test_identity_defaults.c299
-rwxr-xr-xsrc/identity/test_identity_messages.sh32
-rwxr-xr-xsrc/identity/test_plugin_rest_identity_signature.sh81
-rw-r--r--src/include/.gitignore5
-rw-r--r--src/include/Makefile.am10
-rw-r--r--src/include/block_dns.h6
-rw-r--r--src/include/block_fs.h6
-rw-r--r--src/include/block_regex.h1
-rw-r--r--src/include/gauger.h1
-rw-r--r--src/include/gettext.h1
-rw-r--r--src/include/gnu_name_system_record_types.h192
-rw-r--r--src/include/gnunet_abd_service.h10
-rw-r--r--src/include/gnunet_applications.h5
-rw-r--r--src/include/gnunet_arm_service.h1
-rw-r--r--src/include/gnunet_ats_application_service.h6
-rw-r--r--src/include/gnunet_ats_plugin.h6
-rw-r--r--src/include/gnunet_ats_service.h29
-rw-r--r--src/include/gnunet_ats_transport_service.h1
-rw-r--r--src/include/gnunet_bandwidth_lib.h16
-rw-r--r--src/include/gnunet_bio_lib.h106
-rw-r--r--src/include/gnunet_block_group_lib.h3
-rw-r--r--src/include/gnunet_block_lib.h9
-rw-r--r--src/include/gnunet_block_plugin.h6
-rw-r--r--src/include/gnunet_buffer_lib.h10
-rw-r--r--src/include/gnunet_cadet_service.h9
-rw-r--r--src/include/gnunet_child_management_lib.h13
-rw-r--r--src/include/gnunet_client_lib.h19
-rw-r--r--src/include/gnunet_common.h56
-rw-r--r--src/include/gnunet_config.h.in58
-rw-r--r--src/include/gnunet_configuration_lib.h138
-rw-r--r--src/include/gnunet_consensus_service.h10
-rw-r--r--src/include/gnunet_container_lib.h523
-rw-r--r--src/include/gnunet_conversation_service.h6
-rw-r--r--src/include/gnunet_core_service.h6
-rw-r--r--src/include/gnunet_crypto_lib.h226
-rw-r--r--src/include/gnunet_curl_lib.h23
-rw-r--r--src/include/gnunet_datacache_lib.h6
-rw-r--r--src/include/gnunet_datacache_plugin.h6
-rw-r--r--src/include/gnunet_datastore_plugin.h28
-rw-r--r--src/include/gnunet_datastore_service.h6
-rw-r--r--src/include/gnunet_db_lib.h1
-rw-r--r--src/include/gnunet_dht_block_types.h6
-rw-r--r--src/include/gnunet_dht_service.h12
-rw-r--r--src/include/gnunet_dhtu_plugin.h3
-rw-r--r--src/include/gnunet_disk_lib.h14
-rw-r--r--src/include/gnunet_dns_service.h6
-rw-r--r--src/include/gnunet_dnsparser_lib.h12
-rw-r--r--src/include/gnunet_dnsstub_lib.h12
-rw-r--r--src/include/gnunet_error_codes.h242
-rw-r--r--src/include/gnunet_fragmentation_lib.h7
-rw-r--r--src/include/gnunet_friends_lib.h6
-rw-r--r--src/include/gnunet_fs_service.h506
-rw-r--r--src/include/gnunet_getopt_lib.h12
-rw-r--r--src/include/gnunet_gns_service.h7
-rw-r--r--src/include/gnunet_gnsrecord_json_lib.h14
-rw-r--r--src/include/gnunet_gnsrecord_lib.h174
-rw-r--r--src/include/gnunet_gnsrecord_plugin.h5
-rw-r--r--src/include/gnunet_hello_lib.h14
-rw-r--r--src/include/gnunet_hello_uri_lib.h6
-rw-r--r--src/include/gnunet_helper_lib.h25
-rw-r--r--src/include/gnunet_identity_service.h262
-rw-r--r--src/include/gnunet_json_lib.h111
-rw-r--r--src/include/gnunet_load_lib.h6
-rw-r--r--src/include/gnunet_messenger_service.h35
-rw-r--r--src/include/gnunet_mhd_compat.h3
-rw-r--r--src/include/gnunet_microphone_lib.h6
-rw-r--r--src/include/gnunet_mq_lib.h36
-rw-r--r--src/include/gnunet_mst_lib.h23
-rw-r--r--src/include/gnunet_my_lib.h500
-rw-r--r--src/include/gnunet_mysql_lib.h157
-rw-r--r--src/include/gnunet_namecache_plugin.h6
-rw-r--r--src/include/gnunet_namecache_service.h6
-rw-r--r--src/include/gnunet_namestore_plugin.h122
-rw-r--r--src/include/gnunet_namestore_service.h294
-rw-r--r--src/include/gnunet_nat_auto_service.h3
-rw-r--r--src/include/gnunet_nat_service.h7
-rw-r--r--src/include/gnunet_nc_lib.h14
-rw-r--r--src/include/gnunet_network_lib.h15
-rw-r--r--src/include/gnunet_nse_service.h6
-rw-r--r--src/include/gnunet_nt_lib.h7
-rw-r--r--src/include/gnunet_op_lib.h11
-rw-r--r--src/include/gnunet_os_lib.h36
-rw-r--r--src/include/gnunet_peer_lib.h11
-rw-r--r--src/include/gnunet_peerinfo_service.h10
-rw-r--r--src/include/gnunet_peerstore_plugin.h6
-rw-r--r--src/include/gnunet_peerstore_service.h7
-rw-r--r--src/include/gnunet_plugin_lib.h15
-rw-r--r--src/include/gnunet_pq_lib.h603
-rw-r--r--src/include/gnunet_program_lib.h11
-rw-r--r--src/include/gnunet_protocols.h43
-rw-r--r--src/include/gnunet_reclaim_lib.h22
-rw-r--r--src/include/gnunet_reclaim_plugin.h6
-rw-r--r--src/include/gnunet_reclaim_service.h53
-rw-r--r--src/include/gnunet_regex_service.h6
-rw-r--r--src/include/gnunet_resolver_service.h6
-rw-r--r--src/include/gnunet_rest_lib.h6
-rw-r--r--src/include/gnunet_rest_plugin.h6
-rw-r--r--src/include/gnunet_revocation_service.h6
-rw-r--r--src/include/gnunet_rps_service.h5
-rw-r--r--src/include/gnunet_scalarproduct_service.h3
-rw-r--r--src/include/gnunet_scheduler_lib.h7
-rw-r--r--src/include/gnunet_secretsharing_service.h1
-rw-r--r--src/include/gnunet_service_lib.h28
-rw-r--r--src/include/gnunet_set_service.h16
-rw-r--r--src/include/gnunet_seti_service.h6
-rw-r--r--src/include/gnunet_setu_service.h12
-rw-r--r--src/include/gnunet_signal_lib.h10
-rw-r--r--src/include/gnunet_signatures.h254
-rw-r--r--src/include/gnunet_socks.h6
-rw-r--r--src/include/gnunet_speaker_lib.h6
-rw-r--r--src/include/gnunet_sq_lib.h3
-rw-r--r--src/include/gnunet_statistics_service.h6
-rw-r--r--src/include/gnunet_strings_lib.h36
-rw-r--r--src/include/gnunet_testbed_logger_service.h6
-rw-r--r--src/include/gnunet_testbed_service.h18
-rw-r--r--src/include/gnunet_testing_barrier.h115
-rw-r--r--src/include/gnunet_testing_lib.h29
-rw-r--r--src/include/gnunet_testing_netjail_lib.h164
-rw-r--r--src/include/gnunet_testing_ng_lib.h151
-rw-r--r--src/include/gnunet_testing_plugin.h88
-rw-r--r--src/include/gnunet_time_lib.h9
-rw-r--r--src/include/gnunet_transport_application_service.h10
-rw-r--r--src/include/gnunet_transport_communication_service.h13
-rw-r--r--src/include/gnunet_transport_core_service.h8
-rw-r--r--src/include/gnunet_transport_hello_service.h6
-rw-r--r--src/include/gnunet_transport_manipulation_service.h6
-rw-r--r--src/include/gnunet_transport_monitor_service.h8
-rw-r--r--src/include/gnunet_transport_plugin.h6
-rw-r--r--src/include/gnunet_transport_service.h11
-rw-r--r--src/include/gnunet_tun_lib.h12
-rw-r--r--src/include/gnunet_util_lib.h58
-rw-r--r--src/include/gnunet_vpn_service.h6
-rw-r--r--src/include/meson.build134
-rw-r--r--src/include/platform.h3
-rw-r--r--src/integration-tests/Makefile.am7
-rw-r--r--src/json/Makefile.am15
-rw-r--r--src/json/json_generator.c30
-rw-r--r--src/json/json_helper.c166
-rw-r--r--src/json/json_pack.c25
-rw-r--r--src/json/meson.build25
-rw-r--r--src/json/test_json.c5
-rw-r--r--src/meson.build83
-rw-r--r--src/messenger/gnunet-messenger.c16
-rw-r--r--src/messenger/gnunet-service-messenger.c258
-rw-r--r--src/messenger/gnunet-service-messenger.h4
-rw-r--r--src/messenger/gnunet-service-messenger_basement.c1
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.c31
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.h26
-rw-r--r--src/messenger/gnunet-service-messenger_handle.c5
-rw-r--r--src/messenger/gnunet-service-messenger_handle.h31
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.c1
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.h13
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.c1
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.h12
-rw-r--r--src/messenger/gnunet-service-messenger_member.c1
-rw-r--r--src/messenger/gnunet-service-messenger_member.h20
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.c1
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.h19
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.c1
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.h15
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.c1
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.h34
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.c1
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.h5
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.c1
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.h14
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.c1
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.h18
-rw-r--r--src/messenger/gnunet-service-messenger_message_state.c1
-rw-r--r--src/messenger/gnunet-service-messenger_message_state.h2
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.c3
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.h15
-rw-r--r--src/messenger/gnunet-service-messenger_operation.c1
-rw-r--r--src/messenger/gnunet-service-messenger_operation.h11
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.c1
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.h12
-rw-r--r--src/messenger/gnunet-service-messenger_room.c1
-rw-r--r--src/messenger/gnunet-service-messenger_room.h60
-rw-r--r--src/messenger/gnunet-service-messenger_service.c1
-rw-r--r--src/messenger/gnunet-service-messenger_service.h36
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.c1
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.h29
-rw-r--r--src/messenger/meson.build76
-rw-r--r--src/messenger/messenger_api.c15
-rw-r--r--src/messenger/messenger_api_contact.c1
-rw-r--r--src/messenger/messenger_api_contact.h12
-rw-r--r--src/messenger/messenger_api_contact_store.c1
-rw-r--r--src/messenger/messenger_api_contact_store.h17
-rw-r--r--src/messenger/messenger_api_handle.c1
-rw-r--r--src/messenger/messenger_api_handle.h22
-rw-r--r--src/messenger/messenger_api_list_tunnels.c1
-rw-r--r--src/messenger/messenger_api_list_tunnels.h19
-rw-r--r--src/messenger/messenger_api_message.c510
-rw-r--r--src/messenger/messenger_api_message.h13
-rw-r--r--src/messenger/messenger_api_room.c1
-rw-r--r--src/messenger/messenger_api_room.h15
-rw-r--r--src/messenger/messenger_api_util.c1
-rw-r--r--src/messenger/messenger_api_util.h6
-rw-r--r--src/messenger/test_messenger.c2
-rw-r--r--src/messenger/test_messenger_adapt.c1
-rw-r--r--src/messenger/test_messenger_anonymous.c2
-rw-r--r--src/messenger/test_messenger_async_client.c1
-rw-r--r--src/messenger/test_messenger_async_p2p.c1
-rw-r--r--src/messenger/test_messenger_growth.c1
-rw-r--r--src/messenger/test_messenger_ring.c1
-rw-r--r--src/messenger/test_messenger_server.c1
-rw-r--r--src/messenger/test_messenger_sync_client.c1
-rw-r--r--src/messenger/test_messenger_sync_p2p.c1
-rw-r--r--src/messenger/test_messenger_worst_client.c1
-rw-r--r--src/messenger/test_messenger_worst_p2p.c1
-rw-r--r--src/messenger/testing_messenger_barrier.c1
-rw-r--r--src/messenger/testing_messenger_barrier.h4
-rw-r--r--src/messenger/testing_messenger_setup.c2
-rw-r--r--src/my/.gitignore1
-rw-r--r--src/my/Makefile.am41
-rw-r--r--src/my/my.c269
-rw-r--r--src/my/my_query_helper.c400
-rw-r--r--src/my/my_result_helper.c876
-rw-r--r--src/my/test_my.c300
-rw-r--r--src/my/test_my.conf0
-rw-r--r--src/mysql/Makefile.am18
-rw-r--r--src/mysql/mysql.c485
-rw-r--r--src/namecache/Makefile.am10
-rw-r--r--src/namecache/gnunet-namecache.c1
-rw-r--r--src/namecache/gnunet-service-namecache.c3
-rw-r--r--src/namecache/meson.build73
-rw-r--r--src/namecache/namecache-0001.sql42
-rw-r--r--src/namecache/namecache-drop.sql25
-rw-r--r--src/namecache/namecache.conf.in3
-rw-r--r--src/namecache/namecache.h20
-rw-r--r--src/namecache/namecache_api.c3
-rw-r--r--src/namecache/plugin_namecache_postgres.c87
-rw-r--r--src/namecache/plugin_namecache_sqlite.c2
-rw-r--r--src/namecache/test_namecache_api_cache_block.c5
-rw-r--r--src/namecache/test_plugin_namecache.c13
-rw-r--r--src/namestore/.gitignore43
-rw-r--r--src/namestore/Makefile.am362
-rw-r--r--src/namestore/example_zonefile27
-rw-r--r--src/namestore/gnunet-namestore-dbtool.c199
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c19
-rw-r--r--src/namestore/gnunet-namestore-zonefile.c763
-rw-r--r--src/namestore/gnunet-namestore.c1406
-rw-r--r--src/namestore/gnunet-service-namestore.c1475
-rw-r--r--src/namestore/gnunet-zoneimport.c22
-rw-r--r--src/namestore/meson.build123
-rw-r--r--src/namestore/namestore-0001.sql48
-rw-r--r--src/namestore/namestore-drop.sql25
-rw-r--r--src/namestore/namestore.conf.in9
-rw-r--r--src/namestore/namestore.h195
-rw-r--r--src/namestore/namestore_api.c600
-rw-r--r--src/namestore/namestore_api_monitor.c121
-rw-r--r--src/namestore/perf_namestore_api_flat.conf10
-rw-r--r--src/namestore/perf_namestore_api_import.c406
-rw-r--r--src/namestore/perf_namestore_api_postgres.conf5
-rw-r--r--src/namestore/perf_namestore_api_sqlite.conf1
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c7
-rw-r--r--src/namestore/plugin_namestore_flat.c2
-rw-r--r--src/namestore/plugin_namestore_postgres.c372
-rw-r--r--src/namestore/plugin_namestore_sqlite.c364
-rw-r--r--src/namestore/plugin_rest_namestore.c505
-rw-r--r--src/namestore/test_common.c66
-rw-r--r--src/namestore/test_namestore_api.conf21
-rw-r--r--src/namestore/test_namestore_api_edit_records.c399
-rw-r--r--src/namestore/test_namestore_api_flat.conf7
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c12
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c255
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow.c288
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c371
-rw-r--r--src/namestore/test_namestore_api_monitoring.c7
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c48
-rw-r--r--src/namestore/test_namestore_api_postgres.conf3
-rw-r--r--src/namestore/test_namestore_api_remove.c22
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c17
-rw-r--r--src/namestore/test_namestore_api_sqlite.conf1
-rw-r--r--src/namestore/test_namestore_api_store.c6
-rw-r--r--src/namestore/test_namestore_api_store_update.c78
-rw-r--r--src/namestore/test_namestore_api_tx_rollback.c (renamed from src/namestore/test_namestore_api_lookup_private.c)188
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c9
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c18
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c9
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c8
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c10
-rwxr-xr-x[-rw-r--r--]src/namestore/test_namestore_put_multiple.sh49
-rwxr-xr-xsrc/namestore/test_namestore_put_stdin.sh68
-rwxr-xr-xsrc/namestore/test_namestore_zonefile_import.sh33
-rw-r--r--src/namestore/test_plugin_namestore.c23
-rw-r--r--src/namestore/test_plugin_namestore_flat.conf2
-rw-r--r--src/namestore/test_plugin_namestore_postgres.conf3
-rw-r--r--src/namestore/test_plugin_namestore_sqlite.conf1
-rwxr-xr-xsrc/namestore/test_plugin_rest_namestore.sh22
-rw-r--r--src/nat-auto/gnunet-nat-server.c2
-rw-r--r--src/nat-auto/meson.build49
-rw-r--r--src/nat-auto/nat_auto_api_test.c2
-rw-r--r--src/nat/gnunet-helper-nat-client.c3
-rw-r--r--src/nat/gnunet-helper-nat-server.c3
-rw-r--r--src/nat/gnunet-nat.c2
-rw-r--r--src/nat/gnunet-service-nat.c2
-rw-r--r--src/nat/gnunet-service-nat_helper.c10
-rw-r--r--src/nat/gnunet-service-nat_mini.c13
-rw-r--r--src/nat/meson.build75
-rw-r--r--src/nat/nat_api.c38
-rw-r--r--src/nat/nat_api_stun.c2
-rw-r--r--src/nse/gnunet-service-nse.c2
-rw-r--r--src/nse/meson.build47
-rw-r--r--src/nt/meson.build21
-rw-r--r--src/nt/nt.c6
-rw-r--r--src/peerinfo-tool/meson.build17
-rw-r--r--src/peerinfo/meson.build41
-rw-r--r--src/peerinfo/peerinfo.h5
-rw-r--r--src/peerinfo/peerinfo_api.c23
-rw-r--r--src/peerstore/Makefile.am3
-rw-r--r--src/peerstore/meson.build38
-rw-r--r--src/peerstore/peerstore_api.c16
-rw-r--r--src/peerstore/peerstore_common.c7
-rw-r--r--src/peerstore/test_plugin_peerstore.c2
-rw-r--r--src/pq/Makefile.am11
-rw-r--r--src/pq/meson.build23
-rw-r--r--src/pq/pq.c29
-rw-r--r--src/pq/pq.h71
-rw-r--r--src/pq/pq_connect.c242
-rw-r--r--src/pq/pq_eval.c69
-rw-r--r--src/pq/pq_event.c37
-rw-r--r--src/pq/pq_exec.c26
-rw-r--r--src/pq/pq_prepare.c93
-rw-r--r--src/pq/pq_query_helper.c760
-rw-r--r--src/pq/pq_result_helper.c620
-rw-r--r--src/pq/test_pq.c218
-rw-r--r--src/pq/versioning.sql298
-rw-r--r--src/pt/Makefile.am37
-rw-r--r--src/pt/gnunet-daemon-pt.c2
-rw-r--r--src/pt/meson.build22
-rw-r--r--src/pt/test_gns_vpn.c11
-rw-r--r--src/pt/test_gnunet_vpn.c3
-rw-r--r--src/reclaim/.gitignore2
-rw-r--r--src/reclaim/Makefile.am46
-rw-r--r--src/reclaim/did.h6
-rw-r--r--src/reclaim/did_core.c265
-rw-r--r--src/reclaim/did_core.h138
-rw-r--r--src/reclaim/did_helper.c203
-rw-r--r--src/reclaim/did_helper.h74
-rw-r--r--src/reclaim/gnunet-did.c485
-rw-r--r--src/reclaim/gnunet-reclaim.c5
-rw-r--r--src/reclaim/gnunet-service-reclaim.c456
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.c117
-rw-r--r--src/reclaim/meson.build85
-rw-r--r--src/reclaim/oidc_helper.c38
-rw-r--r--src/reclaim/oidc_helper.h6
-rw-r--r--src/reclaim/pabc_helper.c1
-rw-r--r--src/reclaim/plugin_reclaim_credential_jwt.c13
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c51
-rw-r--r--src/reclaim/plugin_rest_reclaim.c4
-rw-r--r--src/reclaim/reclaim.h170
-rw-r--r--src/reclaim/reclaim_api.c500
-rw-r--r--src/reclaim/reclaim_attribute.c47
-rw-r--r--src/reclaim/reclaim_attribute.h14
-rw-r--r--src/reclaim/reclaim_credential.c80
-rw-r--r--src/reclaim/reclaim_credential.h28
-rw-r--r--src/reclaim/test_did_helper.c137
-rw-r--r--src/reclaim/test_reclaim.conf6
-rw-r--r--src/reclaim/test_reclaim_attribute.c2
-rwxr-xr-xsrc/reclaim/test_reclaim_attribute.sh2
-rwxr-xr-xsrc/reclaim/test_reclaim_consume.sh6
-rwxr-xr-xsrc/reclaim/test_reclaim_issue.sh4
-rw-r--r--src/regex/Makefile.am91
-rw-r--r--src/regex/gnunet-regex-profiler.c41
-rw-r--r--src/regex/gnunet-regex-simulation-profiler.c1
-rw-r--r--src/regex/gnunet-service-regex.c6
-rw-r--r--src/regex/meson.build80
-rw-r--r--src/regex/perf-regex.c2
-rw-r--r--src/regex/regex_api_announce.c5
-rw-r--r--src/regex/regex_api_search.c17
-rw-r--r--src/regex/regex_block_lib.c43
-rw-r--r--src/regex/regex_internal.c64
-rw-r--r--src/regex/regex_internal.h4
-rw-r--r--src/regex/regex_internal_dht.c6
-rw-r--r--src/regex/regex_test_random.c2
-rw-r--r--src/regex/test_regex_eval_api.c2
-rw-r--r--src/regex/test_regex_graph_api.c2
-rw-r--r--src/regex/test_regex_integration.c1
-rw-r--r--src/regex/test_regex_iterate_api.c2
-rw-r--r--src/rest/gnunet-rest-server.c132
-rw-r--r--src/rest/meson.build38
-rw-r--r--src/rest/plugin_rest_config.c1
-rw-r--r--src/rest/rest.c13
-rw-r--r--src/rest/rest.conf4
-rw-r--r--src/revocation/Makefile.am16
-rw-r--r--src/revocation/gnunet-revocation-tvg.c99
-rw-r--r--src/revocation/gnunet-revocation.c2
-rw-r--r--src/revocation/gnunet-service-revocation.c54
-rw-r--r--src/revocation/meson.build63
-rw-r--r--src/revocation/plugin_block_revocation.c63
-rw-r--r--src/revocation/revocation.h7
-rw-r--r--src/revocation/revocation_api.c65
-rw-r--r--src/revocation/test_revocation.c6
-rw-r--r--src/revocation/test_revocation_testvectors.c297
-rw-r--r--src/rps/gnunet-rps-profiler.c2
-rw-r--r--src/rps/gnunet-rps.c2
-rw-r--r--src/rps/gnunet-service-rps.c12
-rw-r--r--src/rps/gnunet-service-rps_sampler_elem.c2
-rw-r--r--src/rps/rps-sampler_common.c22
-rw-r--r--src/rps/rps-sampler_common.h2
-rw-r--r--src/rps/rps_api.c2
-rw-r--r--src/rps/test_service_rps_custommap.c1
-rw-r--r--src/rps/test_service_rps_sampler_elem.c1
-rw-r--r--src/rps/test_service_rps_view.c1
-rw-r--r--src/scalarproduct/gnunet-scalarproduct.c3
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c2
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c4
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_alice.c2
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_bob.c2
-rw-r--r--src/scalarproduct/meson.build102
-rw-r--r--src/scalarproduct/scalarproduct_api.c25
-rw-r--r--src/secretsharing/Makefile.am6
-rw-r--r--src/secretsharing/gnunet-secretsharing-profiler.c2
-rw-r--r--src/secretsharing/gnunet-service-secretsharing.c1
-rw-r--r--src/secretsharing/meson.build44
-rw-r--r--src/secretsharing/secretsharing_api.c26
-rw-r--r--src/secretsharing/secretsharing_common.c1
-rw-r--r--src/secretsharing/secretsharing_protocol.h8
-rw-r--r--src/secretsharing/test_secretsharing_api.c1
-rw-r--r--src/set/Makefile.am6
-rw-r--r--src/set/gnunet-service-set.c5
-rw-r--r--src/set/gnunet-service-set_intersection.c9
-rw-r--r--src/set/gnunet-service-set_intersection.h2
-rw-r--r--src/set/gnunet-service-set_union.c6
-rw-r--r--src/set/gnunet-service-set_union_strata_estimator.c6
-rw-r--r--src/set/gnunet-set-ibf-profiler.c2
-rw-r--r--src/set/ibf.c1
-rw-r--r--src/set/ibf_sim.c1
-rw-r--r--src/set/meson.build52
-rw-r--r--src/set/set_api.c63
-rw-r--r--src/seti/Makefile.am6
-rw-r--r--src/seti/gnunet-service-seti.c1
-rw-r--r--src/seti/meson.build48
-rw-r--r--src/seti/seti_api.c26
-rw-r--r--src/setu/Makefile.am6
-rw-r--r--src/setu/gnunet-service-setu.c27
-rw-r--r--src/setu/gnunet-service-setu_protocol.h2
-rw-r--r--src/setu/gnunet-service-setu_strata_estimator.c3
-rw-r--r--src/setu/gnunet-setu-ibf-profiler.c2
-rw-r--r--src/setu/ibf.c31
-rw-r--r--src/setu/ibf_sim.c1
-rw-r--r--src/setu/meson.build50
-rw-r--r--src/setu/setu_api.c26
-rw-r--r--src/sq/meson.build25
-rw-r--r--src/sq/sq.c18
-rw-r--r--src/sq/sq_exec.c2
-rw-r--r--src/sq/sq_prepare.c11
-rw-r--r--src/sq/sq_query_helper.c2
-rw-r--r--src/sq/test_sq.c2
-rw-r--r--src/statistics/gnunet-service-statistics.c17
-rw-r--r--src/statistics/meson.build44
-rw-r--r--src/statistics/statistics_api.c40
-rw-r--r--src/statistics/test_gnunet_statistics.py.in23
-rw-r--r--src/testbed-logger/test_testbed_logger_api.c10
-rw-r--r--src/testbed-logger/testbed_logger_api.c7
-rw-r--r--src/testbed/gnunet-service-testbed.c10
-rw-r--r--src/testbed/gnunet-service-testbed.h11
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c7
-rw-r--r--src/testbed/gnunet-service-testbed_cache.c1
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c1
-rw-r--r--src/testbed/gnunet-service-testbed_links.c1
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c1
-rw-r--r--src/testbed/gnunet-service-testbed_peers.c19
-rw-r--r--src/testbed/meson.build46
-rw-r--r--src/testbed/test_testbed_api.c2
-rw-r--r--src/testbed/test_testbed_api_test.c2
-rw-r--r--src/testbed/testbed_api.c77
-rw-r--r--src/testbed/testbed_api_barriers.c11
-rw-r--r--src/testbed/testbed_api_hosts.c26
-rw-r--r--src/testbed/testbed_api_operations.c8
-rw-r--r--src/testbed/testbed_api_operations.h6
-rw-r--r--src/testbed/testbed_api_peers.c55
-rw-r--r--src/testbed/testbed_api_peers.h2
-rw-r--r--src/testbed/testbed_api_testbed.c5
-rw-r--r--src/testbed/testbed_api_topology.c63
-rw-r--r--src/testbed/testbed_api_topology.h6
-rw-r--r--src/testbed/testbed_api_underlay.c1
-rw-r--r--src/testing/Makefile.am8
-rw-r--r--src/testing/gnunet-cmds-helper.c384
-rwxr-xr-xsrc/testing/netjail_core.sh260
-rwxr-xr-xsrc/testing/netjail_exec.sh14
-rwxr-xr-xsrc/testing/netjail_start.sh74
-rwxr-xr-xsrc/testing/netjail_stop.sh59
-rw-r--r--src/testing/testing.c706
-rw-r--r--src/testing/testing.h278
-rw-r--r--src/testing/testing_api_cmd_barrier.c202
-rw-r--r--src/testing/testing_api_cmd_barrier_reached.c229
-rw-r--r--src/testing/testing_api_cmd_batch.c25
-rw-r--r--src/testing/testing_api_cmd_block_until_external_trigger.c32
-rw-r--r--src/testing/testing_api_cmd_end.c39
-rw-r--r--src/testing/testing_api_cmd_finish.c17
-rw-r--r--src/testing/testing_api_cmd_local_test_finished.c120
-rw-r--r--src/testing/testing_api_cmd_local_test_prepared.c39
-rw-r--r--src/testing/testing_api_cmd_netjail_start.c17
-rw-r--r--src/testing/testing_api_cmd_netjail_start_cmds_helper.c (renamed from src/testing/testing_api_cmd_netjail_start_testsystem.c)358
-rw-r--r--src/testing/testing_api_cmd_netjail_stop.c19
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_cmds_helper.c (renamed from src/testing/testing_api_cmd_netjail_stop_testsystem.c)19
-rw-r--r--src/testing/testing_api_cmd_send_peer_ready.c30
-rw-r--r--src/testing/testing_api_cmd_system_create.c13
-rw-r--r--src/testing/testing_api_cmd_system_destroy.c15
-rw-r--r--src/testing/testing_api_loop.c396
-rw-r--r--src/testing/testing_api_traits.c2
-rw-r--r--src/testing/testing_cmds.h50
-rw-r--r--src/topology/meson.build44
-rw-r--r--src/topology/test_gnunet_daemon_topology.c4
-rw-r--r--src/transport/.gitignore6
-rw-r--r--src/transport/Makefile.am154
-rw-r--r--src/transport/gnunet-communicator-quic.c1796
-rw-r--r--src/transport/gnunet-communicator-tcp.c893
-rw-r--r--src/transport/gnunet-communicator-udp.c1564
-rw-r--r--src/transport/gnunet-helper-transport-bluetooth.c3
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c23
-rw-r--r--src/transport/gnunet-service-tng.c1126
-rw-r--r--src/transport/gnunet-service-transport.c14
-rw-r--r--src/transport/gnunet-service-transport_ats.c14
-rw-r--r--src/transport/gnunet-service-transport_ats.h3
-rw-r--r--src/transport/gnunet-service-transport_hello.c10
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c4
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c24
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h2
-rw-r--r--src/transport/gnunet-service-transport_plugins.c19
-rw-r--r--src/transport/gnunet-service-transport_plugins.h4
-rw-r--r--src/transport/meson.build141
-rw-r--r--src/transport/plugin_transport_http_client.c12
-rw-r--r--src/transport/plugin_transport_http_common.c47
-rw-r--r--src/transport/plugin_transport_http_common.h6
-rw-r--r--src/transport/plugin_transport_http_server.c2
-rw-r--r--src/transport/plugin_transport_tcp.c2
-rw-r--r--src/transport/plugin_transport_udp.c2
-rw-r--r--src/transport/plugin_transport_wlan.c3
-rw-r--r--src/transport/plugin_transport_wlan.h2
-rw-r--r--src/transport/tcp_server_legacy.c20
-rw-r--r--src/transport/test_communicator_basic.c91
-rw-r--r--src/transport/test_communicator_quic_basic_peer1.conf45
-rw-r--r--src/transport/test_communicator_quic_basic_peer2.conf45
-rw-r--r--src/transport/test_communicator_udp_backchannel_peer1.conf2
-rw-r--r--src/transport/test_communicator_udp_backchannel_peer2.conf2
-rw-r--r--src/transport/test_communicator_udp_basic_peer1.conf3
-rw-r--r--src/transport/test_communicator_udp_basic_peer2.conf2
-rw-r--r--src/transport/test_communicator_udp_rekey_peer1.conf3
-rw-r--r--src/transport/test_communicator_udp_rekey_peer2.conf3
-rw-r--r--src/transport/test_transport_api2.c2
-rw-r--r--src/transport/test_transport_api2_tcp_node1.conf9
-rw-r--r--src/transport/test_transport_api2_tcp_node2.conf4
-rw-r--r--src/transport/test_transport_api2_tcp_peer1.conf4
-rw-r--r--src/transport/test_transport_api2_tcp_peer2.conf4
-rw-r--r--src/transport/test_transport_distance_vector_circle_topo.conf1
-rw-r--r--src/transport/test_transport_distance_vector_inverse_topo.conf13
-rwxr-xr-xsrc/transport/test_transport_nat_icmp_tcp.sh12
-rw-r--r--src/transport/test_transport_nat_icmp_tcp_topo.conf7
-rwxr-xr-xsrc/transport/test_transport_nat_upnp.sh12
-rw-r--r--src/transport/test_transport_nat_upnp_topo.conf7
-rw-r--r--src/transport/test_transport_plugin_cmd_nat_upnp.c405
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c111
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_broadcast.c124
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_dv.c130
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_performance.c517
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c122
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_inverse.sh12
-rwxr-xr-xsrc/transport/test_transport_simple_send_performance.sh (renamed from src/transport/test_transport_simple_send_dv.sh)2
-rw-r--r--src/transport/test_transport_simple_send_performance_topo.conf6
-rw-r--r--src/transport/test_transport_start_with_config.c18
-rw-r--r--src/transport/transport-testing-cmds.h103
-rw-r--r--src/transport/transport-testing-communicator.c46
-rw-r--r--src/transport/transport-testing-communicator.h10
-rw-r--r--src/transport/transport-testing-filenames.c29
-rw-r--r--src/transport/transport-testing-filenames2.c1
-rw-r--r--src/transport/transport-testing-loggers.c1
-rw-r--r--src/transport/transport-testing-loggers2.c1
-rw-r--r--src/transport/transport-testing-main.c3
-rw-r--r--src/transport/transport-testing-main2.c3
-rw-r--r--src/transport/transport-testing-send.c1
-rw-r--r--src/transport/transport-testing-send2.c1
-rw-r--r--src/transport/transport-testing.c1
-rw-r--r--src/transport/transport-testing2.c35
-rw-r--r--src/transport/transport-testing2.h25
-rw-r--r--src/transport/transport.conf.in4
-rw-r--r--src/transport/transport.h12
-rw-r--r--src/transport/transport_api2_communication.c120
-rw-r--r--src/transport/transport_api2_core.c28
-rw-r--r--src/transport/transport_api_address_to_string.c4
-rw-r--r--src/transport/transport_api_cmd_backchannel_check.c85
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c95
-rw-r--r--src/transport/transport_api_cmd_send_simple.c66
-rw-r--r--src/transport/transport_api_cmd_send_simple_performance.c220
-rw-r--r--src/transport/transport_api_cmd_start_peer.c62
-rw-r--r--src/transport/transport_api_cmd_stop_peer.c18
-rw-r--r--src/transport/transport_api_core.c2
-rw-r--r--src/transport/transport_api_monitor_peers.c26
-rw-r--r--src/transport/transport_api_monitor_plugins.c4
-rw-r--r--src/transport/transport_api_offer_hello.c5
-rwxr-xr-xsrc/transport/upnp.sh22
-rw-r--r--src/util/.gitignore2
-rw-r--r--src/util/Makefile.am31
-rw-r--r--src/util/bandwidth.c36
-rw-r--r--src/util/benchmark.c1
-rw-r--r--src/util/bio.c283
-rw-r--r--src/util/buffer.c2
-rw-r--r--src/util/child_management.c23
-rw-r--r--src/util/client.c25
-rw-r--r--src/util/common_allocation.c20
-rw-r--r--src/util/common_endian.c13
-rw-r--r--src/util/common_logging.c85
-rw-r--r--src/util/compress.c91
-rw-r--r--src/util/configuration.c163
-rw-r--r--src/util/configuration_helper.c1
-rw-r--r--src/util/consttime_memcmp.c1
-rw-r--r--src/util/container_bloomfilter.c12
-rw-r--r--src/util/container_heap.c68
-rw-r--r--src/util/container_multihashmap.c149
-rw-r--r--src/util/container_multihashmap32.c95
-rw-r--r--src/util/container_multipeermap.c146
-rw-r--r--src/util/container_multishortmap.c118
-rw-r--r--src/util/container_multiuuidmap.c126
-rw-r--r--src/util/crypto_crc.c44
-rw-r--r--src/util/crypto_cs.c3
-rw-r--r--src/util/crypto_ecc.c221
-rw-r--r--src/util/crypto_ecc_dlog.c4
-rw-r--r--src/util/crypto_ecc_gnsrecord.c49
-rw-r--r--src/util/crypto_ecc_setup.c28
-rw-r--r--src/util/crypto_edx25519.c4
-rw-r--r--src/util/crypto_hash.c18
-rw-r--r--src/util/crypto_hash_file.c13
-rw-r--r--src/util/crypto_hkdf.c5
-rw-r--r--src/util/crypto_kdf.c5
-rw-r--r--src/util/crypto_mpi.c3
-rw-r--r--src/util/crypto_paillier.c23
-rw-r--r--src/util/crypto_pow.c3
-rw-r--r--src/util/crypto_random.c17
-rw-r--r--src/util/crypto_rsa.c5
-rw-r--r--src/util/crypto_symmetric.c12
-rw-r--r--src/util/disk.c15
-rw-r--r--src/util/disk.h3
-rw-r--r--src/util/dnsparser.c8
-rw-r--r--src/util/dnsstub.c15
-rw-r--r--src/util/getopt.c1
-rw-r--r--src/util/getopt_helpers.c1
-rw-r--r--src/util/gnunet-base32.c1
-rw-r--r--src/util/gnunet-config-diff.c1
-rw-r--r--src/util/gnunet-config.c20
-rw-r--r--src/util/gnunet-crypto-tvg.c23
-rw-r--r--src/util/gnunet-ecc.c1
-rw-r--r--src/util/gnunet-qr.c3
-rw-r--r--src/util/gnunet-resolver.c1
-rw-r--r--src/util/gnunet-scrypt.c2
-rw-r--r--src/util/gnunet-service-resolver.c9
-rw-r--r--src/util/gnunet-timeout.c1
-rw-r--r--src/util/gnunet-uri.c1
-rw-r--r--src/util/gnunet_error_codes.c262
-rw-r--r--src/util/helper.c54
-rw-r--r--src/util/load.c1
-rw-r--r--src/util/meson.build219
-rw-r--r--src/util/mq.c6
-rw-r--r--src/util/mst.c36
-rw-r--r--src/util/nc.c1
-rw-r--r--src/util/network.c36
-rw-r--r--src/util/op.c3
-rw-r--r--src/util/os_installation.c8
-rw-r--r--src/util/os_network.c1
-rw-r--r--src/util/os_priority.c135
-rw-r--r--src/util/peer.c15
-rw-r--r--src/util/perf_crypto_asymmetric.c1
-rw-r--r--src/util/perf_crypto_cs.c1
-rw-r--r--src/util/perf_crypto_ecc_dlog.c1
-rw-r--r--src/util/perf_crypto_hash.c1
-rw-r--r--src/util/perf_crypto_paillier.c1
-rw-r--r--src/util/perf_crypto_rsa.c1
-rw-r--r--src/util/perf_crypto_symmetric.c1
-rw-r--r--src/util/perf_malloc.c1
-rw-r--r--src/util/perf_mq.c1
-rw-r--r--src/util/perf_scheduler.c1
-rw-r--r--src/util/plugin.c69
-rw-r--r--src/util/proc_compat.c3
-rw-r--r--src/util/program.c1
-rw-r--r--src/util/regex.c44
-rw-r--r--src/util/resolver_api.c1
-rw-r--r--src/util/scheduler.c77
-rw-r--r--src/util/service.c3
-rw-r--r--src/util/signal.c1
-rw-r--r--src/util/socks.c3
-rw-r--r--src/util/speedup.c7
-rw-r--r--src/util/strings.c52
-rw-r--r--src/util/test_bio.c339
-rw-r--r--src/util/test_child_management.c1
-rw-r--r--src/util/test_client.c1
-rw-r--r--src/util/test_common_allocation.c2
-rw-r--r--src/util/test_common_endian.c1
-rw-r--r--src/util/test_common_logging.c1
-rw-r--r--src/util/test_common_logging_dummy.c5
-rw-r--r--src/util/test_common_logging_runtime_loglevels.c1
-rw-r--r--src/util/test_configuration.c1
-rw-r--r--src/util/test_container_bloomfilter.c1
-rw-r--r--src/util/test_container_dll.c1
-rw-r--r--src/util/test_container_heap.c1
-rw-r--r--src/util/test_container_meta_data.c375
-rw-r--r--src/util/test_container_multihashmap.c1
-rw-r--r--src/util/test_container_multihashmap32.c1
-rw-r--r--src/util/test_container_multipeermap.c1
-rw-r--r--src/util/test_crypto_crc.c1
-rw-r--r--src/util/test_crypto_cs.c1
-rw-r--r--src/util/test_crypto_ecc_dlog.c1
-rw-r--r--src/util/test_crypto_ecdh_ecdsa.c1
-rw-r--r--src/util/test_crypto_ecdh_eddsa.c1
-rw-r--r--src/util/test_crypto_ecdhe.c1
-rw-r--r--src/util/test_crypto_ecdsa.c1
-rw-r--r--src/util/test_crypto_eddsa.c1
-rw-r--r--src/util/test_crypto_edx25519.c1
-rw-r--r--src/util/test_crypto_hash.c1
-rw-r--r--src/util/test_crypto_hash_context.c1
-rw-r--r--src/util/test_crypto_hkdf.c5
-rw-r--r--src/util/test_crypto_kdf.c5
-rw-r--r--src/util/test_crypto_paillier.c1
-rw-r--r--src/util/test_crypto_random.c1
-rw-r--r--src/util/test_crypto_rsa.c1
-rw-r--r--src/util/test_crypto_symmetric.c1
-rw-r--r--src/util/test_disk.c1
-rw-r--r--src/util/test_getopt.c1
-rw-r--r--src/util/test_hexcoder.c2
-rw-r--r--src/util/test_mq.c1
-rw-r--r--src/util/test_os_network.c1
-rw-r--r--src/util/test_os_start_process.c1
-rw-r--r--src/util/test_peer.c1
-rw-r--r--src/util/test_plugin.c1
-rw-r--r--src/util/test_plugin_plug.c1
-rw-r--r--src/util/test_program.c1
-rw-r--r--src/util/test_regex.c1
-rw-r--r--src/util/test_resolver_api.c1
-rw-r--r--src/util/test_scheduler.c1
-rw-r--r--src/util/test_scheduler_delay.c1
-rw-r--r--src/util/test_scheduler_hogging_cancel.c51
-rw-r--r--src/util/test_scheduler_hogging_priority.c55
-rw-r--r--src/util/test_service.c1
-rw-r--r--src/util/test_socks.c1
-rw-r--r--src/util/test_speedup.c1
-rw-r--r--src/util/test_strings.c1
-rw-r--r--src/util/test_strings_to_data.c1
-rw-r--r--src/util/test_time.c1
-rw-r--r--src/util/test_tun.c1
-rw-r--r--src/util/test_uri.c1
-rw-r--r--src/util/time.c1
-rw-r--r--src/util/tun.c40
-rw-r--r--src/util/uri.c1
-rw-r--r--src/vpn/gnunet-helper-vpn.c2
-rw-r--r--src/vpn/gnunet-service-vpn.c5
-rw-r--r--src/vpn/gnunet-vpn.c1
-rw-r--r--src/vpn/meson.build65
-rw-r--r--src/vpn/vpn_api.c22
-rw-r--r--src/zonemaster/Makefile.am19
-rw-r--r--src/zonemaster/gnunet-service-zonemaster-monitor.c460
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c881
-rw-r--r--src/zonemaster/meson.build30
-rw-r--r--src/zonemaster/zonemaster.conf.in19
1036 files changed, 33863 insertions, 23210 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d7c0b51f0..8fb984d4b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,10 +25,6 @@ if HAVE_SQLITE
SQLITE_DIR = sq
endif
-if HAVE_MYSQL
- MYSQL_DIR = mysql my
-endif
-
if HAVE_POSTGRESQL
POSTGRES_DIR = pq
endif
@@ -50,7 +46,6 @@ SUBDIRS = \
$(REST_DIR) \
peerinfo \
$(SQLITE_DIR) \
- $(MYSQL_DIR) \
$(POSTGRES_DIR) \
datacache \
datastore \
diff --git a/src/abd/delegate_misc.c b/src/abd/delegate_misc.c
index 0c5520d52..cc45cde04 100644
--- a/src/abd/delegate_misc.c
+++ b/src/abd/delegate_misc.c
@@ -190,6 +190,7 @@ GNUNET_ABD_delegate_from_string (const char *s)
* @param issuer the ego that should be used to issue the attribute
* @param subject the subject of the attribute
* @param iss_attr the name of the attribute
+ * @param expiration the TTL of the credential
* @return handle to the queued request
*/
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c
index 9f5fef958..6f6521d98 100644
--- a/src/abd/gnunet-abd.c
+++ b/src/abd/gnunet-abd.c
@@ -429,8 +429,8 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
* Parse expiration time.
*
* @param expirationstring text to parse
- * @param etime_is_rel[out] set to #GNUNET_YES if time is relative
- * @param etime[out] set to expiration time (abs or rel)
+ * @param[out] etime_is_rel set to #GNUNET_YES if time is relative
+ * @param[out] etime set to expiration time (abs or rel)
* @return #GNUNET_OK on success
*/
static int
diff --git a/src/abd/gnunet-service-abd.c b/src/abd/gnunet-service-abd.c
index 407d5bdc3..42b26eb9b 100644
--- a/src/abd/gnunet-service-abd.c
+++ b/src/abd/gnunet-service-abd.c
@@ -32,7 +32,6 @@
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
-#include <gnunet_dnsparser_lib.h>
#include <gnunet_gns_service.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_identity_service.h>
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index b412094d3..da94efdd8 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -1358,7 +1358,7 @@ pool_write (char *pool_start, size_t pool_size, size_t *pool_pos, char *str)
* Handle LIST-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param request the actual message
*/
static void
handle_list (void *cls, const struct GNUNET_ARM_Message *request)
diff --git a/src/arm/meson.build b/src/arm/meson.build
new file mode 100644
index 000000000..9943c32f9
--- /dev/null
+++ b/src/arm/meson.build
@@ -0,0 +1,71 @@
+libgnunetarm_src = ['arm_api.c',
+ 'arm_monitor_api.c']
+
+gnunetservicearm_src = ['gnunet-service-arm.c']
+
+gnunetarm_src = ['gnunet-arm.c']
+
+testarmapi_src = ['test_arm_api.c']
+testexpbo_src = ['test_exponential_backoff.c']
+testgnunetservice_src = ['test_gnunet_service_arm.c']
+
+configure_file(input : 'arm.conf.in',
+ output : 'arm.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetarm_src + gnunetservicearm_src
+ gnunet_src += 'arm/' + p
+ endforeach
+ subdir_done()
+endif
+
+libgnunetarm = library('gnunetarm',
+ libgnunetarm_src,
+ dependencies: libgnunetutil_dep,
+ version: '2.0.0',
+ soversion: '2',
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+pkg.generate(libgnunetarm, url: 'https://www.gnunet.org',
+ description : 'Provides API for accessing the Automated Restart Manager service')
+libgnunetarm_dep = declare_dependency(link_with : libgnunetarm)
+executable ('gnunet-arm',
+ gnunetarm_src,
+ dependencies: [libgnunetarm_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-service-arm',
+ gnunetservicearm_src,
+ dependencies: [libgnunetarm_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
+testarmapi = executable ('test_arm_api',
+ testarmapi_src,
+ dependencies: [libgnunetarm_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: false)
+testexpbo = executable ('test_exponential_backoff',
+ testexpbo_src,
+ dependencies: [libgnunetarm_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: false)
+testgnunetservice = executable ('test_gnunet_service',
+ testgnunetservice_src,
+ dependencies: [libgnunetarm_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: false)
+configure_file(copy: true,
+ input: 'test_arm_api_data.conf',
+ output: 'test_arm_api_data.conf')
+test('test_arm_api', testarmapi, workdir: meson.current_source_dir(),
+ suite: 'arm')
+# FIXME this test currently times out/fails.
+#test('test_exponential_backoff', testexpbo, workdir: meson.current_source_dir())
+test('test_gnunet_service', testgnunetservice, workdir: meson.current_source_dir(),
+ suite: 'arm')
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c
index 43dd3c92b..3d3f79d35 100644
--- a/src/arm/mockup-service.c
+++ b/src/arm/mockup-service.c
@@ -18,8 +18,8 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
-#include <stdlib.h>
#include "platform.h"
+#include <stdlib.h>
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
diff --git a/src/arm/test_gnunet_service_arm.c b/src/arm/test_gnunet_service_arm.c
index 90fb8bfa0..df4ad95c2 100644
--- a/src/arm/test_gnunet_service_arm.c
+++ b/src/arm/test_gnunet_service_arm.c
@@ -26,8 +26,7 @@
#include "platform.h"
#include "gnunet_arm_service.h"
#include "gnunet_resolver_service.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
+#include "gnunet_util_lib.h"
/**
* Timeout for starting services, very short because of the strange way start works
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c
index 1b8e82777..f62d89772 100644
--- a/src/ats/ats_api_connectivity.c
+++ b/src/ats/ats_api_connectivity.c
@@ -330,11 +330,6 @@ GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
}
-/**
- * We no longer care about being connected to a peer.
- *
- * @param sh handle to stop
- */
void
GNUNET_ATS_connectivity_suggest_cancel (struct
GNUNET_ATS_ConnectivitySuggestHandle *sh)
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index 7349fb989..242589851 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -670,20 +670,6 @@ GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph)
}
-/**
- * Reserve inbound bandwidth from the given peer. ATS will look at
- * the current amount of traffic we receive from the peer and ensure
- * that the peer could add @a amount of data to its stream.
- *
- * @param ph performance handle
- * @param peer identifies the peer
- * @param amount reserve N bytes for receiving, negative
- * amounts can be used to undo a (recent) reservation;
- * @param rcb function to call with the resulting reservation information
- * @param rcb_cls closure for @a rcb
- * @return NULL on error
- * @deprecated will be replaced soon
- */
struct GNUNET_ATS_ReservationContext *
GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph,
const struct GNUNET_PeerIdentity *peer,
@@ -718,11 +704,6 @@ GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph,
}
-/**
- * Cancel request for reserving bandwidth.
- *
- * @param rc context returned by the original #GNUNET_ATS_reserve_bandwidth() call
- */
void
GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc)
{
@@ -730,18 +711,6 @@ GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc)
}
-/**
- * Get information about addresses known to the ATS subsystem.
- *
- * @param ph the performance handle to use
- * @param peer peer idm can be NULL for all peers
- * @param all #GNUNET_YES to get information about all addresses or #GNUNET_NO to
- * get only address currently used
- * @param infocb callback to call with the addresses,
- * will callback with address == NULL when done
- * @param infocb_cls closure for @a infocb
- * @return ats performance context
- */
struct GNUNET_ATS_AddressListHandle*
GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph,
const struct GNUNET_PeerIdentity *peer,
@@ -791,11 +760,6 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph,
}
-/**
- * Cancel a pending address listing operation
- *
- * @param alh the handle of the request to cancel
- */
void
GNUNET_ATS_performance_list_addresses_cancel (struct
GNUNET_ATS_AddressListHandle *alh)
@@ -809,12 +773,6 @@ GNUNET_ATS_performance_list_addresses_cancel (struct
}
-/**
- * Convert a `enum GNUNET_ATS_PreferenceType` to a string
- *
- * @param type the preference type
- * @return a string or NULL if invalid
- */
const char *
GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type)
{
@@ -826,14 +784,6 @@ GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type)
}
-/**
- * Change preferences for the given peer. Preference changes are forgotten if peers
- * disconnect.
- *
- * @param ph performance handle
- * @param peer identifies the peer
- * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes
- */
void
GNUNET_ATS_performance_change_preference (struct
GNUNET_ATS_PerformanceHandle *ph,
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index ea4b27653..6fb61b2e8 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -557,14 +557,6 @@ reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
}
-/**
- * Initialize the ATS subsystem.
- *
- * @param cfg configuration to use
- * @param suggest_cb notification to call whenever the suggestation changed
- * @param suggest_cb_cls closure for @a suggest_cb
- * @return ats context
- */
struct GNUNET_ATS_SchedulingHandle *
GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_ATS_AddressSuggestionCallback suggest_cb,
@@ -701,18 +693,6 @@ GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
}
-/**
- * A session was destroyed, disassociate it from the
- * given address record. If this was an incoming
- * address, destroy the address as well.
- *
- * @param ar address record to update information for
- * @param session session handle
- * @return #GNUNET_YES if the @a ar was destroyed because
- * it was an incoming address,
- * #GNUNET_NO if the @ar was kept because we can
- * use it still to establish a new session
- */
int
GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar,
struct GNUNET_ATS_Session *session)
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index d02efd939..9c9856094 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -196,17 +196,6 @@ find_exact_address (const struct GNUNET_PeerIdentity *peer,
}
-/**
- * Add a new address for a peer.
- *
- * @param peer peer
- * @param plugin_name transport plugin name
- * @param plugin_addr plugin address
- * @param plugin_addr_len length of the plugin address in @a plugin_addr
- * @param local_address_info the local address for the address
- * @param session_id session id, can be 0
- * @param prop performance information for this address
- */
void
GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
const char *plugin_name,
@@ -265,13 +254,6 @@ GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
}
-/**
- * Update an address with new performance information for a peer.
- *
- * @param peer peer
- * @param session_id session id, never 0
- * @param prop performance information for this address
- */
void
GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
uint32_t session_id,
@@ -465,13 +447,6 @@ peerinfo_it (void *cls,
}
-/**
- * Return information all peers currently known to ATS
- *
- * @param peer the respective peer, NULL for 'all' peers
- * @param pi_it the iterator to call for every peer
- * @param pi_it_cls the closure for @a pi_it
- */
void
GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
GNUNET_ATS_PeerInfo_Iterator pi_it,
@@ -665,12 +640,6 @@ req_addr_peerinfo_it (void *cls,
}
-/**
- * Handle 'address list request' messages from clients.
- *
- * @param cls client that sent the request
- * @param alrm the request message
- */
void
GAS_handle_request_address_list (struct GNUNET_SERVICE_Client *client,
const struct AddressListRequestMessage *alrm)
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index b39484f59..8e6f40f38 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -464,7 +464,7 @@ typedef void
/**
* Return information all peers currently known to ATS
*
- * @param peer the respective peer
+ * @param peer the respective peer, NULL for 'all' peers
* @param pi_it the iterator to call for every peer
* @param pi_it_cls the closure for @a pi_it
*/
diff --git a/src/ats/gnunet-service-ats_connectivity.c b/src/ats/gnunet-service-ats_connectivity.c
index 5ee9b60f5..702c5ba87 100644
--- a/src/ats/gnunet-service-ats_connectivity.c
+++ b/src/ats/gnunet-service-ats_connectivity.c
@@ -76,7 +76,7 @@ GAS_connectivity_has_peer (void *cls,
* Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS messages from clients.
*
* @param client client that sent the request
- * @param message the request message
+ * @param msg the request message
*/
void
GAS_handle_request_address (struct GNUNET_SERVICE_Client *client,
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c
index d8d6be11d..d3db69caa 100644
--- a/src/ats/gnunet-service-ats_plugins.c
+++ b/src/ats/gnunet-service-ats_plugins.c
@@ -70,11 +70,6 @@ GAS_plugin_notify_preference_changed (const struct GNUNET_PeerIdentity *peer,
}
-/**
- * The relative value for a property changed.
- *
- * @param address the peer for which a property changed
- */
void
GAS_plugin_notify_property_changed (struct ATS_Address *address)
{
@@ -425,13 +420,6 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
-/**
- * Initialize plugins subsystem.
- *
- * @param cfg configuration to use
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (failed to load
- * solver plugin)
- */
int
GAS_plugin_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
@@ -493,12 +481,6 @@ GAS_plugin_done ()
}
-/**
- * Tell the solver that the given address can now be used
- * for talking to the respective peer.
- *
- * @param new_address the new address
- */
void
GAS_plugin_new_address (struct ATS_Address *new_address)
{
diff --git a/src/ats/gnunet-service-ats_plugins.h b/src/ats/gnunet-service-ats_plugins.h
index 0bd358917..1abdbbd80 100644
--- a/src/ats/gnunet-service-ats_plugins.h
+++ b/src/ats/gnunet-service-ats_plugins.h
@@ -67,7 +67,7 @@ GAS_plugin_notify_preference_changed (const struct GNUNET_PeerIdentity *peer,
/**
* The relative value for a property changed.
*
- * @param address the peer
+ * @param address The peer for which a property changed.
*/
void
GAS_plugin_notify_property_changed (struct ATS_Address *address);
@@ -78,7 +78,6 @@ GAS_plugin_notify_property_changed (struct ATS_Address *address);
* for talking to the respective peer.
*
* @param new_address the new address
- * @param addr_net network scope the address is in
*/
void
GAS_plugin_new_address (struct ATS_Address *new_address);
diff --git a/src/ats/gnunet-service-ats_preferences.c b/src/ats/gnunet-service-ats_preferences.c
index 0869c65dc..c2b2dc4c1 100644
--- a/src/ats/gnunet-service-ats_preferences.c
+++ b/src/ats/gnunet-service-ats_preferences.c
@@ -747,11 +747,6 @@ GAS_preference_get_by_peer (void *cls,
}
-/**
- * A performance client disconnected
- *
- * @param client the client
- */
void
GAS_preference_client_disconnect (struct GNUNET_SERVICE_Client *client)
{
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c
index a50e9d5b7..471a19859 100644
--- a/src/ats/gnunet-service-ats_reservations.c
+++ b/src/ats/gnunet-service-ats_reservations.c
@@ -135,12 +135,6 @@ GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer,
}
-/**
- * Handle 'reservation request' messages from clients.
- *
- * @param client client that sent the request
- * @param msg the request message
- */
void
GAS_handle_reservation_request (struct GNUNET_SERVICE_Client *client,
const struct ReservationRequestMessage *msg)
diff --git a/src/ats/gnunet-service-ats_reservations.h b/src/ats/gnunet-service-ats_reservations.h
index d95945697..07edd69e0 100644
--- a/src/ats/gnunet-service-ats_reservations.h
+++ b/src/ats/gnunet-service-ats_reservations.h
@@ -58,8 +58,6 @@ GAS_handle_reservation_request (struct GNUNET_SERVICE_Client *client,
/**
* Initialize reservations subsystem.
- *
- * @param server handle to our server
*/
void
GAS_reservations_init (void);
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c
index 456c222a9..2dfb70343 100644
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ b/src/ats/gnunet-service-ats_scheduling.c
@@ -71,15 +71,6 @@ GAS_scheduling_remove_client (struct GNUNET_SERVICE_Client *client)
}
-/**
- * Transmit the given address suggestion and bandwidth update to all scheduling
- * clients.
- *
- * @param peer peer for which this is an address suggestion
- * @param session_id session ID to use for the given client
- * @param bandwidth_out assigned outbound bandwidth
- * @param bandwidth_in assigned inbound bandwidth
- */
void
GAS_scheduling_transmit_address_suggestion (const struct
GNUNET_PeerIdentity *peer,
@@ -114,11 +105,6 @@ GAS_scheduling_transmit_address_suggestion (const struct
}
-/**
- * Handle 'address add' messages from clients.
- *
- * @param m the request message
- */
void
GAS_handle_address_add (const struct AddressAddMessage *m)
{
diff --git a/src/ats/gnunet-service-ats_scheduling.h b/src/ats/gnunet-service-ats_scheduling.h
index d68306988..ca6c1bd57 100644
--- a/src/ats/gnunet-service-ats_scheduling.h
+++ b/src/ats/gnunet-service-ats_scheduling.h
@@ -55,7 +55,7 @@ GAS_scheduling_remove_client (struct GNUNET_SERVICE_Client *client);
* clients.
*
* @param peer peer for which this is an address suggestion
- * @param session_id session ID to use
+ * @param session_id session ID to use for the given client
* @param bandwidth_out assigned outbound bandwidth
* @param bandwidth_in assigned inbound bandwidth
*/
@@ -72,7 +72,6 @@ GAS_scheduling_transmit_address_suggestion (const struct
/**
* Handle 'address add' messages from clients.
*
- * @param client client that sent the request
* @param m the request message
*/
void
diff --git a/src/ats/meson.build b/src/ats/meson.build
new file mode 100644
index 000000000..4aa4e6972
--- /dev/null
+++ b/src/ats/meson.build
@@ -0,0 +1,58 @@
+libgnunetats_src = ['ats_api_connectivity.c',
+ 'ats_api_scheduling.c',
+ 'ats_api_scanner.c',
+ 'ats_api_performance.c']
+
+gnunetserviceats_src = ['gnunet-service-ats.c',
+ 'gnunet-service-ats_addresses.c',
+ 'gnunet-service-ats_connectivity.c',
+ 'gnunet-service-ats_normalization.c',
+ 'gnunet-service-ats_performance.c',
+ 'gnunet-service-ats_plugins.c',
+ 'gnunet-service-ats_preferences.c',
+ 'gnunet-service-ats_scheduling.c',
+ 'gnunet-service-ats_reservations.c']
+
+configure_file(input : 'ats.conf.in',
+ output : 'ats.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetats_src + gnunetserviceats_src
+ gnunet_src += 'ats/' + p
+ endforeach
+ subdir_done()
+endif
+
+libgnunetats = library('gnunetats',
+ libgnunetats_src,
+ version: '4.0.0',
+ soversion: '4',
+ dependencies: [libgnunetutil_dep, libgnunethello_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+pkg.generate(libgnunetats, url : 'https://www.gnunet.org',
+ description : 'Provides API for allocating bandwidth, expressing preferences for certain peers and accessing allocation information')
+libgnunetats_dep = declare_dependency(link_with : libgnunetats)
+
+shared_module('gnunet_plugin_ats_proportional',
+ ['plugin_ats_proportional.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetats_dep,
+ libgnunetstatistics_dep,
+ libgnunetnt_dep,
+ libgnunetstatistics_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+executable ('gnunet-service-ats',
+ gnunetserviceats_src,
+ dependencies: [libgnunetats_dep, libgnunetutil_dep,
+ libgnunetnt_dep, libgnunetstatistics_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
diff --git a/src/block/bg_bf.c b/src/block/bg_bf.c
index b79ea3c55..c8269498e 100644
--- a/src/block/bg_bf.c
+++ b/src/block/bg_bf.c
@@ -226,7 +226,7 @@ GNUNET_BLOCK_GROUP_bf_create (void *cls,
* @param bg block group to use for testing
* @param hc hash of element to evaluate
* @return #GNUNET_YES if @a hc is (likely) a duplicate
- * #GNUNET_NO if @a hc was definitively not in @bg (but now is)
+ * #GNUNET_NO if @a hc was definitively not in @a bg (but now is)
*/
enum GNUNET_GenericReturnValue
GNUNET_BLOCK_GROUP_bf_test_and_set (struct GNUNET_BLOCK_Group *bg,
diff --git a/src/block/block.c b/src/block/block.c
index 4b2d8a960..9edc7ce5e 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -299,9 +299,12 @@ GNUNET_BLOCK_check_query (struct GNUNET_BLOCK_Context *ctx,
const void *xquery,
size_t xquery_size)
{
- struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx,
- type);
+ struct GNUNET_BLOCK_PluginFunctions *plugin;
+ if (GNUNET_BLOCK_TYPE_ANY == type)
+ return GNUNET_SYSERR; /* no checks */
+ plugin = find_plugin (ctx,
+ type);
if (NULL == plugin)
return GNUNET_SYSERR;
return plugin->check_query (plugin->cls,
diff --git a/src/block/meson.build b/src/block/meson.build
new file mode 100644
index 000000000..b9bde48f6
--- /dev/null
+++ b/src/block/meson.build
@@ -0,0 +1,47 @@
+libgnunetblock_src = ['block.c']
+libgnunetblockgroup_src = ['bg_bf.c']
+
+if get_option('monolith')
+ foreach p : libgnunetblock_src + libgnunetblockgroup_src
+ gnunet_src += 'block/' + p
+ endforeach
+ subdir_done()
+endif
+
+libgnunetblock = library('gnunetblock',
+ libgnunetblock_src,
+ dependencies: libgnunetutil_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ version: '0.0.0',
+ soversion: '0',
+ install_dir: get_option('libdir'))
+libgnunetblock_dep = declare_dependency(link_with : libgnunetblock)
+pkg.generate(libgnunetblock, url: 'https://www.gnunet.org',
+ description : 'Library for data block manipulation')
+
+libgnunetblockgroup = library('gnunetblockgroup',
+ libgnunetblockgroup_src,
+ dependencies: [libgnunetutil_dep, libgnunetblock_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ version: '0.0.0',
+ soversion: '0',
+ install_dir: get_option('libdir'))
+libgnunetblockgroup_dep = declare_dependency(link_with : libgnunetblockgroup)
+
+plugin_dep = [libgnunetutil_dep, libgnunetblock_dep, libgnunetblockgroup_dep]
+shared_module('gnunet_plugin_block_test',
+ ['plugin_block_test.c'],
+ dependencies: plugin_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+shared_module('gnunet_plugin_block_template',
+ ['plugin_block_template.c'],
+ dependencies: plugin_dep,
+ include_directories: [incdir, configuration_inc],
+ install: false,
+ install_dir: get_option('libdir')/'gnunet')
+
diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c
index 46a370924..4a271fa42 100644
--- a/src/block/plugin_block_template.c
+++ b/src/block/plugin_block_template.c
@@ -55,7 +55,7 @@
* by this @a type of block (this is not an error)
*/
static struct GNUNET_BLOCK_Group *
-block_plugin_template_create_group (void *cls,
+block_plugin_template_create_group (void *ctx,
enum GNUNET_BLOCK_Type type,
const void *raw_data,
size_t raw_data_size,
@@ -79,7 +79,7 @@ block_plugin_template_create_group (void *cls,
bf_size = TEMPLATE_BF_SIZE;
}
GNUNET_break (NULL == va_arg (va, const char *));
- return GNUNET_BLOCK_GROUP_bf_create (cls,
+ return GNUNET_BLOCK_GROUP_bf_create (ctx,
bf_size,
BLOOMFILTER_K,
type,
@@ -92,10 +92,9 @@ block_plugin_template_create_group (void *cls,
* Function called to validate a query.
*
* @param cls closure
- * @param ctx block context
* @param type block type
* @param query original query (hash)
- * @param xquery extrended query data (can be NULL, depending on type)
+ * @param xquery extended query data (can be NULL, depending on type)
* @param xquery_size number of bytes in @a xquery
* @return #GNUNET_OK if the query is fine, #GNUNET_NO if not, #GNUNET_SYSERR if not supported
*/
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index 2e404bbc2..5afac9205 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -53,7 +53,7 @@
* by this @a type of block (this is not an error)
*/
static struct GNUNET_BLOCK_Group *
-block_plugin_test_create_group (void *cls,
+block_plugin_test_create_group (void *ctx,
enum GNUNET_BLOCK_Type type,
const void *raw_data,
size_t raw_data_size,
@@ -77,7 +77,7 @@ block_plugin_test_create_group (void *cls,
bf_size = TEST_BF_SIZE;
}
GNUNET_break (NULL == va_arg (va, const char *));
- return GNUNET_BLOCK_GROUP_bf_create (cls,
+ return GNUNET_BLOCK_GROUP_bf_create (ctx,
bf_size,
BLOOMFILTER_K,
type,
@@ -90,10 +90,9 @@ block_plugin_test_create_group (void *cls,
* Function called to validate a query.
*
* @param cls closure
- * @param ctx block context
* @param type block type
* @param query original query (hash)
- * @param xquery extrended query data (can be NULL, depending on type)
+ * @param xquery extended query data (can be NULL, depending on type)
* @param xquery_size number of bytes in @a xquery
* @return #GNUNET_OK if the query is fine, #GNUNET_NO if not, #GNUNET_SYSERR if @a type is not supported
*/
diff --git a/src/cadet/.gitignore b/src/cadet/.gitignore
index b556fa4c8..e72d81bd8 100644
--- a/src/cadet/.gitignore
+++ b/src/cadet/.gitignore
@@ -24,3 +24,4 @@ test_cadet_local_mq
test_cadet_*_newtest_cadet_2_reopen
test_cadet_5_reopen
test_cadet_2_reopen
+test_cadet_2_destroy
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h
index 31dad4117..e8caa7d35 100644
--- a/src/cadet/cadet.h
+++ b/src/cadet/cadet.h
@@ -55,7 +55,6 @@ extern "C" {
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_peer_lib.h"
#include "gnunet_core_service.h"
#include "gnunet_cadet_service.h"
#include "gnunet_protocols.h"
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index c9f0722d5..0bfb01868 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -198,7 +198,6 @@ create_channel (struct GNUNET_CADET_Handle *h,
* - Frees all memory used
*
* @param ch Pointer to the channel.
- * @param call_cleaner Whether to call the cleaner handler.
*/
static void
destroy_channel (struct GNUNET_CADET_Channel *ch)
@@ -461,7 +460,7 @@ cadet_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
/**
* Process the new channel notification and add it to the channels in the handle
*
- * @param h The cadet handle
+ * @param cls The cadet handle
* @param msg A message with the details of the new incoming channel
*/
static void
@@ -529,7 +528,7 @@ handle_channel_created (
/**
* Process the channel destroy notification and free associated resources
*
- * @param h The cadet handle
+ * @param cls The cadet handle
* @param msg A message with the details of the channel being destroyed
*/
static void
@@ -582,7 +581,7 @@ check_local_data (void *cls, const struct GNUNET_CADET_LocalData *message)
/**
* Process the incoming data packets, call appropriate handlers.
*
- * @param h The cadet handle
+ * @param cls The cadet handle
* @param message A message encapsulating the data
*/
static void
@@ -620,7 +619,7 @@ handle_local_data (void *cls, const struct GNUNET_CADET_LocalData *message)
* Process a local ACK message, enabling the client to send
* more data to the service.
*
- * @param h Cadet handle.
+ * @param cls Cadet handle.
* @param message Message itself.
*/
static void
@@ -798,12 +797,6 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
}
-/**
- * Close a port opened with @a GNUNET_CADET_open_port().
- * The @a new_channel callback will no longer be called.
- *
- * @param p Port handle.
- */
void
GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p)
{
@@ -853,15 +846,6 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
}
-/**
- * Get information about a channel.
- *
- * @param channel Channel handle.
- * @param option Query (GNUNET_CADET_OPTION_*).
- * @param ... dependent on option, currently not used
- *
- * @return Union with an answer to the query.
- */
const union GNUNET_CADET_ChannelInfo *
GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
enum GNUNET_CADET_ChannelInfoOption option,
diff --git a/src/cadet/cadet_api_drop_message.c b/src/cadet/cadet_api_drop_message.c
index 2b031b5c0..e172418c4 100644
--- a/src/cadet/cadet_api_drop_message.c
+++ b/src/cadet/cadet_api_drop_message.c
@@ -27,7 +27,7 @@
/**
- * Drop the next cadet message of a given type..
+ * Drop the next cadet message of a given type.
*
* @param mq message queue
* @param ccn client channel number.
diff --git a/src/cadet/cadet_api_get_path.c b/src/cadet/cadet_api_get_path.c
index 68070eab2..f32a5e20b 100644
--- a/src/cadet/cadet_api_get_path.c
+++ b/src/cadet/cadet_api_get_path.c
@@ -216,15 +216,6 @@ reconnect (void *cls)
}
-/**
- * Request information about paths known to the running cadet peer.
- *
- * @param cfg configuration to use
- * @param id Peer whose paths to examine.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- * @return NULL on error
- */
struct GNUNET_CADET_GetPath *
GNUNET_CADET_get_path (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_PeerIdentity *id,
diff --git a/src/cadet/cadet_api_list_tunnels.c b/src/cadet/cadet_api_list_tunnels.c
index e9ae069bb..dce12835f 100644
--- a/src/cadet/cadet_api_list_tunnels.c
+++ b/src/cadet/cadet_api_list_tunnels.c
@@ -95,7 +95,7 @@ handle_get_tunnels (void *cls,
* Process a local reply about info on all tunnels, pass info to the user.
*
* @param cls a `struct GNUNET_CADET_ListTunnels *`
- * @param message Message itself.
+ * @param msg Message itself.
*/
static void
handle_get_tunnels_end (void *cls,
diff --git a/src/cadet/desirability_table.c b/src/cadet/desirability_table.c
index 829c618af..b4db7c2dd 100644
--- a/src/cadet/desirability_table.c
+++ b/src/cadet/desirability_table.c
@@ -5,6 +5,7 @@
* for various plausible inputs.
* @author Christian Grothoff
*/
+#include "platform.h"
#include <stdio.h>
int
diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c
index e61053f94..22cbe55dc 100644
--- a/src/cadet/gnunet-cadet-profiler.c
+++ b/src/cadet/gnunet-cadet-profiler.c
@@ -22,8 +22,8 @@
*
* @brief Profiler for cadet experiments.
*/
-#include <stdio.h>
#include "platform.h"
+#include <stdio.h>
#include "cadet_test_lib.h"
#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
@@ -659,8 +659,6 @@ ping (void *cls)
/**
* @brief Reply with a pong to origin.
*
- * @param cls Closure (peer).
- * @param tc Task context.
*/
static void
pong (struct GNUNET_CADET_Channel *channel,
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c
index 73e463e9b..07b580005 100644
--- a/src/cadet/gnunet-service-cadet.c
+++ b/src/cadet/gnunet-service-cadet.c
@@ -442,7 +442,7 @@ shutdown_task (void *cls)
* client @a cls opened port @a port. Bind them now.
*
* @param cls the `struct CadetClient`
- * @param h_port the hashed port
+ * @param port the hashed port
* @param value the `struct CadetChannel`
* @return #GNUNET_YES (iterate over all such channels)
*/
@@ -1097,13 +1097,6 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c,
}
-/**
- * A client that created a loose channel that was not bound to a port
- * disconnected, drop it from the #loose_channels list.
- *
- * @param h_port the hashed port the channel was trying to bind to
- * @param ch the channel that was lost
- */
void
GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port,
struct CadetChannel *ch)
@@ -1233,7 +1226,6 @@ client_disconnect_cb (void *cls,
* Setup CADET internals.
*
* @param cls closure
- * @param server the initialized server
* @param c configuration to use
*/
static void
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index 9a2180cc1..78658c296 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -388,11 +388,6 @@ struct CadetChannel
};
-/**
- * Assign type of message to drop.
- * @param ch CadetChannel to assign type to drop.
- * @param message GNUNET_CADET_RequestDropCadetMessage to get the type from.
- */
void
GCCH_assign_type_to_drop (struct CadetChannel *ch, const struct
GNUNET_CADET_RequestDropCadetMessage *message)
@@ -660,16 +655,6 @@ GCCH_tunnel_up (struct CadetChannel *ch)
}
-/**
- * Create a new channel.
- *
- * @param owner local client owning the channel
- * @param ccn local number of this channel at the @a owner
- * @param destination peer to which we should build the channel
- * @param port desired port at @a destination
- * @param options options for the channel
- * @return handle to the new channel
- */
struct CadetChannel *
GCCH_channel_local_new (struct CadetClient *owner,
struct GNUNET_CADET_ClientChannelNumber ccn,
@@ -756,15 +741,6 @@ timeout_closed_cb (void *cls)
}
-/**
- * Create a new channel based on a request coming in over the network.
- *
- * @param t tunnel to the remote peer
- * @param ctn identifier of this channel in the tunnel
- * @param h_port desired hash of local port
- * @param options options for the channel
- * @return handle to the new channel
- */
struct CadetChannel *
GCCH_channel_incoming_new (struct CadetTunnel *t,
struct GNUNET_CADET_ChannelTunnelNumber ctn,
@@ -960,15 +936,6 @@ send_ack_to_client (struct CadetChannel *ch, int to_owner)
}
-/**
- * A client is bound to the port that we have a channel
- * open to. Send the acknowledgement for the connection
- * request and establish the link with the client.
- *
- * @param ch open incoming channel
- * @param c client listening on the respective @a port
- * @param port the port @a is listening on
- */
void
GCCH_bind (struct CadetChannel *ch,
struct CadetClient *c,
@@ -1126,15 +1093,6 @@ GCCH_channel_local_destroy (struct CadetChannel *ch,
}
-/**
- * We got an acknowledgement for the creation of the channel
- * (the port is open on the other side). Verify that the
- * other end really has the right port, and begin transmissions.
- *
- * @param ch channel to destroy
- * @param cti identifier of the connection that delivered the message
- * @param port port number (needed to verify receiver knows the port)
- */
void
GCCH_handle_channel_open_ack (
struct CadetChannel *ch,
@@ -1199,7 +1157,7 @@ GCCH_handle_channel_open_ack (
* @param cls closure, to a flag where we indicate duplicate packets
* @param m1 a message of to sort
* @param m2 another message to sort
- * @return #GNUNET_YES if @e1 < @e2, otherwise #GNUNET_NO
+ * @return #GNUNET_YES if @a e1 < @a e2, otherwise #GNUNET_NO
*/
static int
is_before (void *cls,
@@ -1227,14 +1185,6 @@ is_before (void *cls,
}
-/**
- * We got payload data for a channel. Pass it on to the client
- * and send an ACK to the other end (once flow control allows it!)
- *
- * @param ch channel that got data
- * @param cti identifier of the connection that delivered the message
- * @param msg message that was received
- */
void
GCCH_handle_channel_plaintext_data (
struct CadetChannel *ch,
@@ -1657,15 +1607,6 @@ GCCH_handle_channel_plaintext_data_ack (
}
-/**
- * Destroy channel, based on the other peer closing the
- * connection. Also needs to remove this channel from
- * the tunnel.
- *
- * @param ch channel to destroy
- * @param cti identifier of the connection that delivered the message,
- * NULL if we are simulating receiving a destroy due to shutdown
- */
void
GCCH_handle_remote_destroy (
struct CadetChannel *ch,
@@ -1704,7 +1645,7 @@ GCCH_handle_remote_destroy (
* @param cls closure, to a flag where we indicate duplicate packets
* @param crm1 an element of to sort
* @param crm2 another element to sort
- * @return #GNUNET_YES if @e1 < @e2, otherwise #GNUNET_NO
+ * @return #GNUNET_YES if @a e1 < @a e2, otherwise #GNUNET_NO
*/
static int
cmp_crm_by_next_retry (void *cls,
@@ -1916,13 +1857,6 @@ GCCH_handle_local_data (struct CadetChannel *ch,
}
-/**
- * Handle ACK from client on local channel. Means the client is ready
- * for more data, see if we have any for it.
- *
- * @param ch channel to destroy
- * @param client_ccn ccn of the client sending the ack
- */
void
GCCH_handle_local_ack (struct CadetChannel *ch,
struct GNUNET_CADET_ClientChannelNumber client_ccn)
diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h
index 6d691cafc..b09de883f 100644
--- a/src/cadet/gnunet-service-cadet_channel.h
+++ b/src/cadet/gnunet-service-cadet_channel.h
@@ -67,7 +67,7 @@ GCCH_is_type_to_drop (struct CadetChannel *ch, const struct
GNUNET_MessageHeader *message);
/**
- * Check if type of message is the one to drop.
+ * Assign type of message to drop.
* @param ch CadetChannel to assign type to drop.
* @param message GNUNET_CADET_RequestDropCadetMessage to get the type from.
*/
@@ -174,7 +174,6 @@ GCCH_tunnel_up (struct CadetChannel *ch);
*
* @param t tunnel to the remote peer
* @param chid identifier of this channel in the tunnel
- * @param origin peer to who initiated the channel
* @param h_port hash of desired local port
* @param options options for the channel
* @return handle to the new channel
@@ -201,7 +200,8 @@ GCCH_handle_duplicate_open (struct CadetChannel *ch,
/**
- * We got payload data for a channel. Pass it on to the client.
+ * We got payload data for a channel. Pass it on to the client
+ * and send an ACK to the other end (once flow control allows it!)
*
* @param ch channel that got data
* @param cti identifier of the connection that delivered the message
@@ -234,7 +234,8 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch,
/**
* We got an acknowledgement for the creation of the channel
- * (the port is open on the other side). Begin transmissions.
+ * (the port is open on the other side). Verify that the
+ * other end really has the right port, and begin transmissions.
*
* @param ch channel to destroy
* @param cti identifier of the connection that delivered the message,
@@ -262,7 +263,7 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch,
*
* @param ch channel to destroy
* @param cti identifier of the connection that delivered the message,
- * NULL during shutdown
+ * NULL if we are simulating receiving a destroy due to shutdown
*/
void
GCCH_handle_remote_destroy (struct CadetChannel *ch,
@@ -292,7 +293,8 @@ GCCH_handle_local_data (struct CadetChannel *ch,
/**
- * Handle ACK from client on local channel.
+ * Handle ACK from client on local channel. Means the client is ready
+ * for more data, see if we have any for it.
*
* @param ch channel to destroy
* @param client_ccn ccn of the client sending the ack
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 637e8663b..f01c1388e 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -431,9 +431,9 @@ GCC_ack_expected (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
/**
* We observed an ACK for a message that was originally sent via
- * the connection identified by @a cti.
+ * the connection identified by @a cid.
*
- * @param cti connection identifier where we got an ACK for a message
+ * @param cid connection identifier where we got an ACK for a message
* that was originally sent via this connection (the ACK
* may have gotten back to us via a different connection).
*/
@@ -449,14 +449,6 @@ GCC_ack_observed (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
}
-/**
- * We observed some the given @a latency on the connection
- * identified by @a cti. (The same connection was taken
- * in both directions.)
- *
- * @param cid connection identifier where we measured latency
- * @param latency the observed latency
- */
void
GCC_latency_observed (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
struct GNUNET_TIME_Relative latency)
@@ -484,13 +476,6 @@ GCC_latency_observed (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
}
-/**
- * A #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK was received for
- * this connection, implying that the end-to-end connection is up.
- * Process it.
- *
- * @param cc the connection that got the ACK.
- */
void
GCC_handle_connection_create_ack (struct CadetConnection *cc)
{
@@ -943,18 +928,6 @@ GCC_create_inbound (struct CadetPeer *destination,
}
-/**
- * Create a connection to @a destination via @a path and
- * notify @a cb whenever we are ready for more data.
- *
- * @param destination where to go
- * @param path which path to take (may not be the full path)
- * @param off offset of @a destination on @a path
- * @param ct tunnel that uses the connection
- * @param ready_cb function to call when ready to transmit
- * @param ready_cb_cls closure for @a cb
- * @return handle to the connection
- */
struct CadetConnection *
GCC_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
@@ -1010,7 +983,7 @@ GCC_transmit (struct CadetConnection *cc, struct GNUNET_MQ_Envelope *env)
* Obtain the path used by this connection.
*
* @param cc connection
- * @param off[out] set to the length of the path we use
+ * @param[out] off set to the length of the path we use
* @return path to @a cc
*/
struct CadetPeerPath *
diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h
index d646b3dc2..54c845b13 100644
--- a/src/cadet/gnunet-service-cadet_connection.h
+++ b/src/cadet/gnunet-service-cadet_connection.h
@@ -142,7 +142,9 @@ GCC_transmit (struct CadetConnection *cc,
/**
- * A CREATE_ACK was received for this connection, process it.
+ * A #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK was received for
+ * this connection, implying that the end-to-end connection is up.
+ * Process it.
*
* @param cc the connection that got the ACK.
*/
@@ -320,7 +322,7 @@ GCC_get_ct (struct CadetConnection *cc);
* Obtain the path used by this connection.
*
* @param cc connection
- * @param off[out] set to offset in this path where the connection @a cc ends
+ * @param[out] off set to offset in this path where the connection @a cc ends
* @return path to @a cc
*/
struct CadetPeerPath *
diff --git a/src/cadet/gnunet-service-cadet_core.c b/src/cadet/gnunet-service-cadet_core.c
index 95a5d3f63..68f7405c3 100644
--- a/src/cadet/gnunet-service-cadet_core.c
+++ b/src/cadet/gnunet-service-cadet_core.c
@@ -139,14 +139,6 @@ struct RouteDirection
};
-/**
- * Description of a segment of a `struct CadetConnection` at the
- * intermediate peers. Routes are basically entries in a peer's
- * routing table for forwarding traffic. At both endpoints, the
- * routes are terminated by a `struct CadetConnection`, which knows
- * the complete `struct CadetPath` that is formed by the individual
- * routes.
- */
struct CadetRoute
{
/**
@@ -620,10 +612,10 @@ timeout_cb (void *cls)
* later if the connection ever goes down.
*
* @param cls the `struct RouteDirection`
- * @param available #GNUNET_YES if sending is now possible,
- * #GNUNET_NO if sending is no longer possible
- * #GNUNET_SYSERR if sending is no longer possible
- * and the last envelope was discarded
+ * @param ready #GNUNET_YES if sending is now possible,
+ * #GNUNET_NO if sending is no longer possible
+ * #GNUNET_SYSERR if sending is no longer possible
+ * and the last envelope was discarded
*/
static void
dir_ready_cb (void *cls, int ready)
@@ -1321,9 +1313,6 @@ GCO_init (const struct GNUNET_CONFIGURATION_Handle *c)
}
-/**
- * Shut down the CORE subsystem.
- */
void
GCO_shutdown ()
{
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index 3df2687de..576753a38 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -55,9 +55,6 @@
#define LOG(level, ...) GNUNET_log_from (level, "cadet-dht", __VA_ARGS__)
-/**
- * Handle for DHT searches.
- */
struct GCD_search_handle
{
/**
@@ -206,7 +203,7 @@ announce_id (void *cls)
dht_replication_level, /* Replication level */
GNUNET_DHT_RO_RECORD_ROUTE
| GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, /* DHT options */
- GNUNET_BLOCK_TYPE_DHT_HELLO, /* Block type */
+ GNUNET_BLOCK_TYPE_LEGACY_HELLO, /* Block type */
size, /* Size of the data */
(const char *) hello, /* Data itself */
expiration, /* Data expiration */
@@ -215,10 +212,6 @@ announce_id (void *cls)
}
-/**
- * Function called by the HELLO subsystem whenever OUR hello
- * changes. Re-triggers the DHT PUT immediately.
- */
void
GCD_hello_update ()
{
@@ -232,11 +225,6 @@ GCD_hello_update ()
}
-/**
- * Initialize the DHT subsystem.
- *
- * @param c Configuration.
- */
void
GCD_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
@@ -277,9 +265,6 @@ GCD_init (const struct GNUNET_CONFIGURATION_Handle *c)
}
-/**
- * Shut down the DHT subsystem.
- */
void
GCD_shutdown (void)
{
@@ -296,12 +281,6 @@ GCD_shutdown (void)
}
-/**
- * Search DHT for paths to @a peeR_id
- *
- * @param peer_id peer to search for
- * @return handle to abort search
- */
struct GCD_search_handle *
GCD_search (const struct GNUNET_PeerIdentity *peer_id)
{
@@ -321,7 +300,7 @@ GCD_search (const struct GNUNET_PeerIdentity *peer_id)
h = GNUNET_new (struct GCD_search_handle);
h->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */
- GNUNET_BLOCK_TYPE_DHT_HELLO, /* type */
+ GNUNET_BLOCK_TYPE_LEGACY_HELLO, /* type */
&phash, /* key to search */
dht_replication_level, /* replication level */
GNUNET_DHT_RO_RECORD_ROUTE
@@ -338,11 +317,6 @@ GCD_search (const struct GNUNET_PeerIdentity *peer_id)
}
-/**
- * Stop DHT search started with #GCD_search().
- *
- * @param h handle to search to stop
- */
void
GCD_search_stop (struct GCD_search_handle *h)
{
diff --git a/src/cadet/gnunet-service-cadet_hello.c b/src/cadet/gnunet-service-cadet_hello.c
index c7857032b..e1850d60a 100644
--- a/src/cadet/gnunet-service-cadet_hello.c
+++ b/src/cadet/gnunet-service-cadet_hello.c
@@ -57,7 +57,7 @@ static struct GNUNET_PEERINFO_NotifyContext *nc;
* Process each hello message received from peerinfo.
*
* @param cls Closure (unused).
- * @param peer Identity of the peer.
+ * @param id Identity of the peer.
* @param hello Hello of the peer.
* @param err_msg Error message.
*/
diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c
index aa31aaa74..83b996e05 100644
--- a/src/cadet/gnunet-service-cadet_paths.c
+++ b/src/cadet/gnunet-service-cadet_paths.c
@@ -594,13 +594,6 @@ GCPP_try_path_from_dht (const struct GNUNET_DHT_PathElement *get_path,
}
-/**
- * We got an incoming connection, obtain the corresponding path.
- *
- * @param path_length number of segments on the @a path
- * @param pids path through the network, in reverse order (we are at the end at index @a path_length)
- * @return corresponding path object
- */
struct CadetPeerPath *
GCPP_get_path_from_route (unsigned int path_length,
const struct GNUNET_PeerIdentity *pids)
@@ -723,13 +716,6 @@ GCPP_find_peer (struct CadetPeerPath *path,
}
-/**
- * Obtain the peer at offset @a off in @a path.
- *
- * @param path peer path to inspect
- * @param off offset to return, must be smaller than path length
- * @return the peer at offset @a off
- */
struct CadetPeer *
GCPP_get_peer_at_offset (struct CadetPeerPath *path,
unsigned int off)
diff --git a/src/cadet/gnunet-service-cadet_paths.h b/src/cadet/gnunet-service-cadet_paths.h
index afd193596..0f3b4dd1a 100644
--- a/src/cadet/gnunet-service-cadet_paths.h
+++ b/src/cadet/gnunet-service-cadet_paths.h
@@ -53,7 +53,8 @@ GCPP_try_path_from_dht (const struct GNUNET_DHT_PathElement *get_path,
* We got an incoming connection, obtain the corresponding path.
*
* @param path_length number of segments on the @a path
- * @param path through the network, in reverse order (we are at the end!)
+ * @param pids path through the network, in reverse order
+ * (we are at the end, at index @a path_length)
* @return corresponding path object
*/
struct CadetPeerPath *
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index 2437a3e1b..f2b508ae0 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -211,7 +211,7 @@ struct CadetPeer
/**
* Sum over all of the offsets of all of the paths in the @a path_heads DLLs.
- * Used to speed-up @GCP_get_desirability_of_path() calculation.
+ * Used to speed-up #GCP_get_desirability_of_path() calculation.
*/
unsigned int off_sum;
@@ -225,19 +225,13 @@ struct CadetPeer
unsigned int mqm_ready_counter;
/**
- * Current length of the @e path_heads and @path_tails arrays.
+ * Current length of the @e path_heads and @e path_tails arrays.
* The arrays should be grown as needed.
*/
unsigned int path_dll_length;
};
-/**
- * Get the static string for a peer ID.
- *
- * @param cp Peer.
- * @return Static string for it's ID.
- */
const char *
GCP_2s (const struct CadetPeer *cp)
{
@@ -260,21 +254,6 @@ GCP_2s (const struct CadetPeer *cp)
}
-/**
- * Calculate how desirable a path is for @a cp if @a cp
- * is at offset @a off.
- *
- * The 'desirability_table.c' program can be used to compute a list of
- * sample outputs for different scenarios. Basically, we score paths
- * lower if there are many alternatives, and higher if they are
- * shorter than average, and very high if they are much shorter than
- * average and without many alternatives.
- *
- * @param cp a peer reachable via a path
- * @param off offset of @a cp in the path
- * @return score how useful a path is to reach @a cp,
- * positive scores mean path is more desirable
- */
double
GCP_get_desirability_of_path (struct CadetPeer *cp,
unsigned int off)
@@ -965,17 +944,6 @@ path_heap_cleanup (void *cls)
}
-/**
- * Try adding a @a path to this @a peer. If the peer already
- * has plenty of paths, return NULL.
- *
- * @param cp peer to which the @a path leads to
- * @param path a path looking for an owner; may not be fully initialized yet!
- * @param off offset of @a cp in @a path
- * @param force force attaching the path
- * @return NULL if this peer does not care to become a new owner,
- * otherwise the node in the peer's path heap for the @a path.
- */
struct GNUNET_CONTAINER_HeapNode *
GCP_attach_path (struct CadetPeer *cp,
struct CadetPeerPath *path,
@@ -1287,16 +1255,6 @@ GCP_iterate_indirect_paths (struct CadetPeer *cp,
}
-/**
- * Iterate over the paths to @a cp where
- * @a cp is at distance @a dist from us.
- *
- * @param cp Peer to get path info.
- * @param dist desired distance of @a cp to us on the path
- * @param callback Function to call for every path.
- * @param callback_cls Closure for @a callback.
- * @return Number of iterated paths.
- */
unsigned int
GCP_iterate_paths_at (struct CadetPeer *cp,
unsigned int dist,
@@ -1365,13 +1323,6 @@ hello_offer_done (void *cls)
}
-/**
- * We got a HELLO for a @a peer, remember it, and possibly
- * trigger adequate actions (like trying to connect).
- *
- * @param cp the peer we got a HELLO for
- * @param hello the HELLO to remember
- */
void
GCP_set_hello (struct CadetPeer *cp,
const struct GNUNET_HELLO_Message *hello)
diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h
index 7a39615ff..69436d766 100644
--- a/src/cadet/gnunet-service-cadet_peer.h
+++ b/src/cadet/gnunet-service-cadet_peer.h
@@ -62,6 +62,12 @@ GCP_get (const struct GNUNET_PeerIdentity *peer_id,
* Calculate how desirable a path is for @a cp if
* @a cp is at offset @a off in the path.
*
+ * The 'desirability_table.c' program can be used to compute a list of
+ * sample outputs for different scenarios. Basically, we score paths
+ * lower if there are many alternatives, and higher if they are
+ * shorter than average, and very high if they are much shorter than
+ * average and without many alternatives.
+ *
* @param cp a peer reachable via a path
* @param off offset of @a cp in a path
* @return score how useful a path is to reach @a cp,
@@ -229,7 +235,7 @@ GCP_drop_tunnel (struct CadetPeer *cp,
* @param cp peer to which the @a path leads to
* @param path a path looking for an owner; may not be fully initialized yet!
* @param off offset of @a cp in @a path
- * @param force for attaching the path
+ * @param force force attaching the path
* @return NULL if this peer does not care to become a new owner,
* otherwise the node in the peer's path heap for the @a path.
*/
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c
index cabbeed0c..c7e422926 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -169,7 +169,7 @@ struct CadetTunnelAxolotl
* 32-byte chain keys (used for forward-secrecy) for
* receiving messages. Updated for every message. If
* messages are skipped, the respective derived MKs
- * (and the current @HKr) are kept in the @e skipped_head DLL.
+ * (and the current @e HKr) are kept in the @e skipped_head DLL.
*/
struct GNUNET_CRYPTO_SymmetricSessionKey CKr;
@@ -576,13 +576,6 @@ GCT_get_destination (struct CadetTunnel *t)
}
-/**
- * Count channels of a tunnel.
- *
- * @param t Tunnel on which to count.
- *
- * @return Number of channels.
- */
unsigned int
GCT_count_channels (struct CadetTunnel *t)
{
@@ -606,13 +599,6 @@ lookup_channel (struct CadetTunnel *t,
}
-/**
- * Count all created connections of a tunnel. Not necessarily ready connections!
- *
- * @param t Tunnel on which to count.
- *
- * @return Number of connections created, either being established or ready.
- */
unsigned int
GCT_count_any_connections (const struct CadetTunnel *t)
{
@@ -688,7 +674,7 @@ new_ephemeral (struct CadetTunnelAxolotl *ax)
* @param size Size of @c plaintext.
* @param iv Initialization vector for the message.
* @param key Key to use.
- * @param hmac[out] Destination to store the HMAC.
+ * @param[out] hmac Destination to store the HMAC.
*/
static void
t_hmac (const void *plaintext,
@@ -904,7 +890,7 @@ t_ax_decrypt (struct CadetTunnelAxolotl *ax,
* Encrypt header with the axolotl header key.
*
* @param ax key material to use.
- * @param[in|out] msg Message whose header to encrypt.
+ * @param[in,out] msg Message whose header to encrypt.
*/
static void
t_h_encrypt (struct CadetTunnelAxolotl *ax,
@@ -1502,7 +1488,7 @@ cleanup_ax (struct CadetTunnelAxolotl *ax)
* Computes the new chain keys, and root keys, etc, and also checks
* whether this is a replay of the current chain.
*
- * @param[in|out] axolotl chain key state to recompute
+ * @param[in,out] ax chain key state to recompute
* @param pid peer identity of the other peer
* @param ephemeral_key ephemeral public key of the other peer
* @param ratchet_key senders next ephemeral public key
@@ -1706,14 +1692,6 @@ retry_kx (void *cls)
}
-/**
- * Handle KX message that lacks authentication (and which will thus
- * only be considered authenticated after we respond with our own
- * KX_AUTH and finally successfully decrypt payload).
- *
- * @param ct connection/tunnel combo that received encrypted message
- * @param msg the key exchange message
- */
void
GCT_handle_kx (struct CadetTConnection *ct,
const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
@@ -2839,14 +2817,6 @@ maintain_connections_cb (void *cls)
}
-/**
- * Consider using the path @a p for the tunnel @a t.
- * The tunnel destination is at offset @a off in path @a p.
- *
- * @param cls our tunnel
- * @param path a path to our destination
- * @param off offset of the destination on path @a path
- */
void
GCT_consider_path (struct CadetTunnel *t,
struct CadetPeerPath *p,
@@ -3216,16 +3186,6 @@ GCT_create_tunnel (struct CadetPeer *destination)
}
-/**
- * Add a @a connection to the @a tunnel.
- *
- * @param t a tunnel
- * @param cid connection identifier to use for the connection
- * @param options options for the connection
- * @param path path to use for the connection
- * @return #GNUNET_OK on success,
- * #GNUNET_SYSERR on failure (duplicate connection)
- */
int
GCT_add_inbound_connection (struct CadetTunnel *t,
const struct
@@ -3449,17 +3409,6 @@ GCT_handle_encrypted (struct CadetTConnection *ct,
}
-/**
- * Sends an already built message on a tunnel, encrypting it and
- * choosing the best connection if not provided.
- *
- * @param message Message to send. Function modifies it.
- * @param t Tunnel on which this message is transmitted.
- * @param cont Continuation to call once message is really sent.
- * @param cont_cls Closure for @c cont.
- * @param The ID of the channel we are using for sending.
- * @return Handle to cancel message
- */
struct CadetTunnelQueueEntry *
GCT_send (struct CadetTunnel *t,
const struct GNUNET_MessageHeader *message,
@@ -3538,15 +3487,6 @@ GCT_send (struct CadetTunnel *t,
}
-/**
- * Cancel a previously sent message while it's in the queue.
- *
- * ONLY can be called before the continuation given to the send
- * function is called. Once the continuation is called, the message is
- * no longer in the queue!
- *
- * @param tq Handle to the queue entry to cancel.
- */
void
GCT_send_cancel (struct CadetTunnelQueueEntry *tq)
{
diff --git a/src/cadet/gnunet-service-cadet_tunnels.h b/src/cadet/gnunet-service-cadet_tunnels.h
index aea131542..e893955a0 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.h
+++ b/src/cadet/gnunet-service-cadet_tunnels.h
@@ -160,8 +160,8 @@ GCT_get_destination (struct CadetTunnel *t);
* Consider using the path @a p for the tunnel @a t.
* The tunnel destination is at offset @a off in path @a p.
*
- * @param cls our tunnel
- * @param path a path to our destination
+ * @param t our tunnel
+ * @param p a path to our destination
* @param off offset of the destination on path @a path
*/
void
@@ -252,20 +252,21 @@ GCT_send_cancel (struct CadetTunnelQueueEntry *q);
/**
- * Return the number of channels using a tunnel.
+ * Returns the number of channels using a tunnel.
*
- * @param t tunnel to count obtain the number of channels for
- * @return number of channels using the tunnel
+ * @param t Tunnel in question.
+ * @return Number of channels using the tunnel.
*/
unsigned int
GCT_count_channels (struct CadetTunnel *t);
/**
- * Return the number of connections available for a tunnel.
+ * Counts the number of connections created for a tunnel,
+ * including busy connections.
*
- * @param t tunnel to count obtain the number of connections for
- * @return number of connections available for the tunnel
+ * @param t Tunnel to be counted.
+ * @return Number of connections created for the tunnel.
*/
unsigned int
GCT_count_any_connections (const struct CadetTunnel *t);
@@ -341,7 +342,9 @@ GCT_change_estate (struct CadetTunnel *t,
enum CadetTunnelEState state);
/**
- * Handle KX message.
+ * Handle KX message that lacks authentication (and which will thus
+ * only be considered authenticated after we respond with our own
+ * KX_AUTH and finally successfully decrypt the payload).
*
* @param ct connection/tunnel combo that received encrypted message
* @param msg the key exchange message
diff --git a/src/cadet/meson.build b/src/cadet/meson.build
new file mode 100644
index 000000000..91587590d
--- /dev/null
+++ b/src/cadet/meson.build
@@ -0,0 +1,75 @@
+libgnunetcadet_src = ['cadet_api.c',
+ 'cadet_api_drop_message.c',
+ 'cadet_api_get_channel.c',
+ 'cadet_api_get_path.c',
+ 'cadet_api_list_peers.c',
+ 'cadet_api_list_tunnels.c',
+ 'cadet_api_helper.c']
+
+gnunetcadet_src = ['gnunet-cadet.c']
+gnunetservicecadet_src = ['gnunet-service-cadet.c',
+ 'gnunet-service-cadet_channel.c',
+ 'gnunet-service-cadet_connection.c',
+ 'gnunet-service-cadet_core.c',
+ 'gnunet-service-cadet_dht.c',
+ 'gnunet-service-cadet_hello.c',
+ 'gnunet-service-cadet_tunnels.c',
+ 'gnunet-service-cadet_paths.c',
+ 'gnunet-service-cadet_peer.c']
+
+configure_file(input : 'cadet.conf.in',
+ output : 'cadet.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetcadet_src + gnunetservicecadet_src
+ gnunet_src += 'cadet/' + p
+ endforeach
+endif
+
+libgnunetcadet = library('gnunetcadet',
+ libgnunetcadet_src,
+ dependencies: libgnunetutil_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ soversion: '7',
+ version: '7.0.0',
+ install_dir: get_option('libdir'))
+libgnunetcadet_dep = declare_dependency(link_with : libgnunetcadet)
+pkg.generate(libgnunetcadet, url: 'https://www.gnunet.org',
+ description : 'API for multicast and multi-hop routing between GNUnet peers')
+
+executable ('gnunet-cadet',
+ gnunetservicecadet_src,
+ dependencies: [libgnunetcadet_dep,
+ libgnunetutil_dep,
+ libgnunetcore_dep,
+ libgnunetdht_dep,
+ m_dep,
+ libgnunetstatistics_dep,
+ libgnunetpeerinfo_dep,
+ libgnunetats_dep,
+ libgnunettransport_dep,
+ libgnunethello_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-service-cadet',
+ gnunetservicecadet_src,
+ dependencies: [libgnunetcadet_dep,
+ libgnunetutil_dep,
+ libgnunetats_dep,
+ m_dep,
+ libgnunetcore_dep,
+ libgnunetdht_dep,
+ libgnunetstatistics_dep,
+ libgnunettransport_dep,
+ libgnunetpeerinfo_dep,
+ libgnunethello_dep,
+ libgnunetblock_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
+
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index bdf2ac986..61c09f389 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -23,8 +23,8 @@
* @author Christian Grothoff
* @brief Test for the cadet service using mq API.
*/
-#include <stdio.h>
#include "platform.h"
+#include <stdio.h>
#include "cadet.h"
#include "cadet_test_lib.h"
#include "gnunet_cadet_service.h"
diff --git a/src/cadet/test_cadet_flow.c b/src/cadet/test_cadet_flow.c
index 9f5a45986..441599973 100644
--- a/src/cadet/test_cadet_flow.c
+++ b/src/cadet/test_cadet_flow.c
@@ -23,8 +23,8 @@
* @author Christian Grothoff
* @brief Test for flow control of CADET service
*/
-#include <stdio.h>
#include "platform.h"
+#include <stdio.h>
#include "cadet_test_lib.h"
#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am
index d7b23e7c6..4a04883c0 100644
--- a/src/consensus/Makefile.am
+++ b/src/consensus/Makefile.am
@@ -18,6 +18,9 @@ endif
libexec_PROGRAMS = \
gnunet-service-consensus
+noinst_PROGRAMS = \
+ gnunet-consensus-profiler
+
if ENABLE_MALICIOUS
libexec_PROGRAMS += \
gnunet-service-evil-consensus
@@ -89,9 +92,6 @@ libgnunet_plugin_block_consensus_la_LDFLAGS = \
-bin_PROGRAMS = \
- gnunet-consensus-profiler
-
check_PROGRAMS = \
test_consensus_api
diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c
index b4a9e5d39..01d0ad3de 100644
--- a/src/consensus/consensus_api.c
+++ b/src/consensus/consensus_api.c
@@ -26,7 +26,6 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_client_lib.h"
#include "gnunet_consensus_service.h"
#include "consensus.h"
@@ -305,8 +304,6 @@ GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
* inserted by the client.
*
* @param consensus consensus session
- * @param deadline deadline after which the conculde callback
- * must be called
* @param conclude called when the conclusion was successful
* @param conclude_cls closure for the conclude callback
*/
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c
index 07a536a2d..535837008 100644
--- a/src/consensus/gnunet-consensus-profiler.c
+++ b/src/consensus/gnunet-consensus-profiler.c
@@ -380,7 +380,7 @@ disconnect_adapter (void *cls, void *op_result)
/**
* Callback to be called when the requested peer information is available
*
- * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information()
+ * @param cb_cls the closure from GNUNET_TESTBED_peer_get_information()
* @param op the operation this callback corresponds to
* @param pinfo the result; will be NULL if the operation has failed
* @param emsg error message if the operation has failed; will be NULL if the
diff --git a/src/consensus/meson.build b/src/consensus/meson.build
new file mode 100644
index 000000000..b67017ab3
--- /dev/null
+++ b/src/consensus/meson.build
@@ -0,0 +1,48 @@
+libgnunetconsensus_src = ['consensus_api.c']
+
+gnunetserviceconsensus_src = ['gnunet-service-consensus.c']
+
+configure_file(input : 'consensus.conf.in',
+ output : 'consensus.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetconsensus_src + gnunetserviceconsensus_src
+ gnunet_src += 'consensus/' + p
+ endforeach
+ subdir_done()
+endif
+
+libgnunetconsensus = shared_library('gnunetconsensus',
+ libgnunetconsensus_src,
+ soversion: '0',
+ version: '0.0.0',
+ dependencies: libgnunetutil_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+pkg.generate(libgnunetconsensus, url: 'https://www.gnunet.org',
+ description : 'Provides API for accessing the consensus service')
+libgnunetarm_dep = declare_dependency(link_with : libgnunetarm)
+libgnunetconsensus_dep = declare_dependency(link_with : libgnunetconsensus)
+
+shared_module('gnunet_plugin_block_consensus',
+ ['plugin_block_consensus.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetblock_dep],
+ include_directories: [incdir, configuration_inc],
+ install:true,
+ install_dir: get_option('libdir')/'gnunet')
+
+executable ('gnunet-service-consensus',
+ gnunetserviceconsensus_src,
+ dependencies: [libgnunetconsensus_dep,
+ libgnunetutil_dep,
+ libgnunetset_dep,
+ libgnunetstatistics_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
+
diff --git a/src/consensus/plugin_block_consensus.c b/src/consensus/plugin_block_consensus.c
index f30b9b0d7..241d8fc7b 100644
--- a/src/consensus/plugin_block_consensus.c
+++ b/src/consensus/plugin_block_consensus.c
@@ -52,7 +52,6 @@ struct BlockContext
* Function called to validate a query.
*
* @param cls closure
- * @param ctx block context
* @param type block type
* @param query original query (hash)
* @param xquery extrended query data (can be NULL, depending on type)
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h
index d244f5163..ee4ca372c 100644
--- a/src/conversation/conversation.h
+++ b/src/conversation/conversation.h
@@ -105,9 +105,13 @@ struct ClientPhoneRingMessage
uint32_t cid GNUNET_PACKED;
/**
- * Who is calling us?
+ * The identity key length
+ */
+ uint32_t key_len;
+
+ /**
+ * followed by who is calling us?, a public key
*/
- struct GNUNET_IDENTITY_PublicKey caller_id;
};
@@ -230,9 +234,13 @@ struct ClientCallMessage
struct GNUNET_HashCode line_port;
/**
- * Identity of the caller.
+ * The identity key length
+ */
+ uint32_t key_len;
+
+ /**
+ * followed by the identity of the caller.
*/
- struct GNUNET_IDENTITY_PrivateKey caller_id;
};
@@ -301,19 +309,24 @@ struct CadetPhoneRingMessage
uint32_t reserved GNUNET_PACKED;
/**
- * Who is calling us? (also who is signing).
+ * When does the signature expire?
*/
- struct GNUNET_IDENTITY_PublicKey caller_id;
+ struct GNUNET_TIME_AbsoluteNBO expiration_time;
/**
- * When does the signature expire?
+ * The length of the key
*/
- struct GNUNET_TIME_AbsoluteNBO expiration_time;
+ uint32_t key_len;
+
+ /**
+ * The length of the signature
+ */
+ uint32_t sig_len;
/**
- * Signature over a `struct CadetPhoneRingInfoPS`
+ * Followed by the public key of who is calling us? (also who is signing).
+ * followed by the signature over a `struct CadetPhoneRingInfoPS`
*/
- struct GNUNET_IDENTITY_Signature signature;
};
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 1984abdd6..9c4c520be 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -238,7 +238,19 @@ transmit_phone_audio (void *cls,
e);
}
-
+/**
+ * We received a `struct ClientPhoneRingMessage`
+ *
+ * @param cls the `struct GNUNET_CONVERSATION_Phone`
+ * @param ring the message
+ */
+static enum GNUNET_GenericReturnValue
+check_phone_ring (void *cls,
+ const struct ClientPhoneRingMessage *ring)
+{
+ //FIXME
+ return GNUNET_OK;
+}
/**
* We received a `struct ClientPhoneRingMessage`
*
@@ -251,7 +263,11 @@ handle_phone_ring (void *cls,
{
struct GNUNET_CONVERSATION_Phone *phone = cls;
struct GNUNET_CONVERSATION_Caller *caller;
+ struct GNUNET_IDENTITY_PublicKey caller_id;
+ size_t key_len;
+ size_t read;
+ key_len = ntohl (ring->key_len);
switch (phone->state)
{
case PS_REGISTER:
@@ -259,12 +275,22 @@ handle_phone_ring (void *cls,
break;
case PS_READY:
+ if ((GNUNET_SYSERR ==
+ GNUNET_IDENTITY_read_public_key_from_buffer (&ring[1],
+ key_len,
+ &caller_id,
+ &read)) ||
+ (read != key_len))
+ {
+ GNUNET_break (0);
+ break;
+ }
caller = GNUNET_new (struct GNUNET_CONVERSATION_Caller);
caller->phone = phone;
GNUNET_CONTAINER_DLL_insert (phone->caller_head,
phone->caller_tail,
caller);
- caller->caller_id = ring->caller_id;
+ caller->caller_id = caller_id;
caller->cid = ring->cid;
caller->state = CS_RINGING;
phone->event_handler (phone->event_handler_cls,
@@ -300,7 +326,7 @@ find_caller (struct GNUNET_CONVERSATION_Phone *phone,
* We received a `struct ClientPhoneHangupMessage`.
*
* @param cls the `struct GNUNET_CONVERSATION_Phone *`
- * @param msg the message
+ * @param hang the message
*/
static void
handle_phone_hangup (void *cls,
@@ -562,10 +588,10 @@ static void
reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone)
{
struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_fixed_size (phone_ring,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING,
- struct ClientPhoneRingMessage,
- phone),
+ GNUNET_MQ_hd_var_size (phone_ring,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING,
+ struct ClientPhoneRingMessage,
+ phone),
GNUNET_MQ_hd_fixed_size (phone_hangup,
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
struct ClientPhoneHangupMessage,
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index 2be7886fa..129192bf0 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -375,7 +375,7 @@ handle_call_hangup (void *cls,
* We received a `struct ClientAudioMessage`, check it is well-formed.
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
- * @param msg the message
+ * @param am the message
* @return #GNUNET_OK (always well-formed)
*/
static int
@@ -393,7 +393,7 @@ check_call_audio (void *cls,
* We received a `struct ClientAudioMessage`
*
* @param cls the `struct GNUNET_CONVERSATION_Call`
- * @param msg the message
+ * @param am the message
*/
static void
handle_call_audio (void *cls,
@@ -455,6 +455,8 @@ handle_gns_response (void *cls,
struct GNUNET_CONVERSATION_Call *call = cls;
struct GNUNET_MQ_Envelope *e;
struct ClientCallMessage *ccm;
+ const struct GNUNET_IDENTITY_PrivateKey *caller_id;
+ size_t key_len;
(void) was_gns;
GNUNET_break (NULL != call->gns_lookup);
@@ -472,11 +474,15 @@ handle_gns_response (void *cls,
GNUNET_memcpy (&call->phone_record,
rd[i].data,
rd[i].data_size);
- e = GNUNET_MQ_msg (ccm,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL);
+ caller_id = GNUNET_IDENTITY_ego_get_private_key (call->caller_id);
+ key_len = GNUNET_IDENTITY_private_key_get_length (caller_id);
+ e = GNUNET_MQ_msg_extra (ccm, key_len,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL);
ccm->line_port = call->phone_record.line_port;
ccm->target = call->phone_record.peer;
- ccm->caller_id = *GNUNET_IDENTITY_ego_get_private_key (call->caller_id);
+ GNUNET_IDENTITY_write_private_key_to_buffer (caller_id,
+ &ccm[1], key_len);
+ ccm->key_len = htonl (key_len);
GNUNET_MQ_send (call->mq,
e);
call->state = CS_RINGING;
diff --git a/src/conversation/gnunet-helper-audio-playback-gst.c b/src/conversation/gnunet-helper-audio-playback-gst.c
index 48f0c5b48..f1e1e773d 100644
--- a/src/conversation/gnunet-helper-audio-playback-gst.c
+++ b/src/conversation/gnunet-helper-audio-playback-gst.c
@@ -180,7 +180,7 @@ feed_buffer_to_gst (const char *audio, size_t b_len)
"Feeding %u bytes to GStreamer\n",
(unsigned int) b_len);
- bufspace = g_memdup (audio, b_len);
+ bufspace = g_memdup2 (audio, b_len);
b = gst_buffer_new_wrapped (bufspace, b_len);
if (NULL == b)
{
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index a69c95a80..1fff8bd26 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -729,6 +729,18 @@ handle_client_audio_message (void *cls, const struct ClientAudioMessage *msg)
GNUNET_SERVICE_client_continue (line->client);
}
+/**
+ * Function to handle a ring message incoming over cadet
+ *
+ * @param cls closure, NULL
+ * @param msg the incoming message
+ */
+static enum GNUNET_GenericReturnValue
+check_cadet_ring_message (void *cls, const struct CadetPhoneRingMessage *msg)
+{
+ // FIXME
+ return GNUNET_OK;
+}
/**
* Function to handle a ring message incoming over cadet
@@ -744,19 +756,40 @@ handle_cadet_ring_message (void *cls, const struct CadetPhoneRingMessage *msg)
struct GNUNET_MQ_Envelope *env;
struct ClientPhoneRingMessage *cring;
struct CadetPhoneRingInfoPS rs;
+ struct GNUNET_IDENTITY_PublicKey identity;
+ struct GNUNET_IDENTITY_Signature sig;
+ size_t key_len;
+ size_t sig_len;
+ size_t read;
rs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING);
rs.purpose.size = htonl (sizeof(struct CadetPhoneRingInfoPS));
rs.line_port = line->line_port;
rs.target_peer = my_identity;
rs.expiration_time = msg->expiration_time;
-
+ key_len = ntohl (msg->key_len);
+ sig_len = ntohl (msg->sig_len);
+
+ if ((GNUNET_SYSERR ==
+ GNUNET_IDENTITY_read_public_key_from_buffer (&msg[1],
+ key_len,
+ &identity,
+ &read)) ||
+ (read != key_len))
+ {
+ GNUNET_break_op (0);
+ destroy_line_cadet_channels (ch);
+ return;
+ }
+ GNUNET_IDENTITY_read_signature_from_buffer (&sig,
+ (char*) &msg[1] + read,
+ sig_len);
if (GNUNET_OK !=
GNUNET_IDENTITY_signature_verify (
GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING,
&rs,
- &msg->signature,
- &msg->caller_id))
+ &sig,
+ &identity))
{
GNUNET_break_op (0);
destroy_line_cadet_channels (ch);
@@ -782,9 +815,12 @@ handle_cadet_ring_message (void *cls, const struct CadetPhoneRingMessage *msg)
}
GNUNET_CADET_receive_done (ch->channel);
ch->status = CS_CALLEE_RINGING;
- env = GNUNET_MQ_msg (cring, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING);
+ env = GNUNET_MQ_msg_extra (cring,
+ key_len,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING);
cring->cid = ch->cid;
- cring->caller_id = msg->caller_id;
+ memcpy (&cring[1], &msg[1], key_len);
+ cring->key_len = msg->key_len;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending RING message to client. CID is %u\n",
(unsigned int) ch->cid);
@@ -1080,6 +1116,18 @@ inbound_end (void *cls, const struct GNUNET_CADET_Channel *channel)
clean_up_channel (ch);
}
+/**
+ * Function to handle call request from the client
+ *
+ * @param cls the `struct Line` the message is about
+ * @param msg the message from the client
+ */
+static enum GNUNET_GenericReturnValue
+check_client_call_message (void *cls, const struct ClientCallMessage *msg)
+{
+ // FIXME
+ return GNUNET_OK;
+}
/**
* Function to handle call request from the client
@@ -1117,6 +1165,14 @@ handle_client_call_message (void *cls, const struct ClientCallMessage *msg)
struct GNUNET_MQ_Envelope *e;
struct CadetPhoneRingMessage *ring;
struct CadetPhoneRingInfoPS rs;
+ struct GNUNET_IDENTITY_PrivateKey caller_id;
+ struct GNUNET_IDENTITY_PublicKey caller_id_pub;
+ struct GNUNET_IDENTITY_Signature sig;
+ ssize_t written;
+ size_t key_len;
+ size_t pkey_len;
+ size_t sig_len;
+ size_t read;
line->line_port = msg->line_port;
rs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING);
@@ -1125,6 +1181,18 @@ handle_client_call_message (void *cls, const struct ClientCallMessage *msg)
rs.target_peer = msg->target;
rs.expiration_time =
GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (RING_TIMEOUT));
+ key_len = ntohl (msg->key_len);
+ if (GNUNET_SYSERR ==
+ GNUNET_IDENTITY_read_private_key_from_buffer (&msg[1],
+ key_len,
+ &caller_id,
+ &read))
+ {
+ GNUNET_break_op (0);
+ GNUNET_free (ch);
+ GNUNET_SERVICE_client_drop (line->client);
+ return;
+ }
ch->line = line;
GNUNET_CONTAINER_DLL_insert (line->channel_head, line->channel_tail, ch);
ch->status = CS_CALLER_CALLING;
@@ -1136,10 +1204,22 @@ handle_client_call_message (void *cls, const struct ClientCallMessage *msg)
&inbound_end,
cadet_handlers);
ch->mq = GNUNET_CADET_get_mq (ch->channel);
- e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
- GNUNET_IDENTITY_key_get_public (&msg->caller_id, &ring->caller_id);
+ GNUNET_assert (read == key_len);
+ GNUNET_IDENTITY_sign (&caller_id, &rs, &sig);
+ sig_len = GNUNET_IDENTITY_signature_get_length (&sig);
+ GNUNET_IDENTITY_key_get_public (&caller_id, &caller_id_pub);
+ pkey_len = GNUNET_IDENTITY_public_key_get_length (&caller_id_pub);
+ e = GNUNET_MQ_msg_extra (ring, pkey_len + sig_len,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
+ written = GNUNET_IDENTITY_write_public_key_to_buffer (&caller_id_pub,
+ &ring[1],
+ pkey_len);
ring->expiration_time = rs.expiration_time;
- GNUNET_IDENTITY_sign (&msg->caller_id, &rs, &ring->signature);
+ ring->key_len = htonl (pkey_len);
+ ring->sig_len = htonl (sig_len);
+ GNUNET_IDENTITY_write_signature_to_buffer (&sig,
+ (char *) &ring[1] + written,
+ sig_len);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending RING message via CADET\n");
GNUNET_MQ_send (ch->mq, e);
GNUNET_SERVICE_client_continue (line->client);
@@ -1246,10 +1326,10 @@ handle_client_register_message (void *cls,
{
struct Line *line = cls;
struct GNUNET_MQ_MessageHandler cadet_handlers[] =
- { GNUNET_MQ_hd_fixed_size (cadet_ring_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING,
- struct CadetPhoneRingMessage,
- NULL),
+ { GNUNET_MQ_hd_var_size (cadet_ring_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING,
+ struct CadetPhoneRingMessage,
+ NULL),
GNUNET_MQ_hd_fixed_size (cadet_hangup_message,
GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP,
struct CadetPhoneHangupMessage,
@@ -1367,10 +1447,10 @@ GNUNET_SERVICE_MAIN (
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
struct ClientPhoneHangupMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (client_call_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL,
- struct ClientCallMessage,
- NULL),
+ GNUNET_MQ_hd_var_size (client_call_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL,
+ struct ClientCallMessage,
+ NULL),
GNUNET_MQ_hd_var_size (client_audio_message,
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
struct ClientAudioMessage,
diff --git a/src/conversation/gnunet_gst.c b/src/conversation/gnunet_gst.c
index d776189cd..48d41a457 100644
--- a/src/conversation/gnunet_gst.c
+++ b/src/conversation/gnunet_gst.c
@@ -22,6 +22,7 @@
* @brief FIXME
* @author Hark
*/
+#include "platform.h"
#include "gnunet_gst_def.h"
/**
diff --git a/src/conversation/gnunet_gst_test.c b/src/conversation/gnunet_gst_test.c
index a7364aece..dd2ef5a38 100644
--- a/src/conversation/gnunet_gst_test.c
+++ b/src/conversation/gnunet_gst_test.c
@@ -23,6 +23,7 @@
* @author Hark
*/
+#include "platform.h"
#include "gnunet_gst_def.h"
#include "gnunet_gst.h"
diff --git a/src/conversation/meson.build b/src/conversation/meson.build
new file mode 100644
index 000000000..95d27072c
--- /dev/null
+++ b/src/conversation/meson.build
@@ -0,0 +1,96 @@
+libgnunetconversation_src = ['conversation_api.c', 'conversation_api_call.c']
+
+gnunetserviceconversation_src = ['gnunet-service-conversation.c',
+ 'gnunet-service-conversation_resolver.c',
+ 'gnunet-service-conversation_interceptor.c']
+
+gnunetconversationproxy_src = ['gnunet-conversation-proxy.c']
+
+configure_file(input : 'conversation.conf.in',
+ output : 'conversation.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+
+if get_option('monolith')
+ foreach p : libgnunetconversation_src + gnunetserviceconversation_src
+ gnunet_src += 'conversation/' + p
+ endforeach
+ subdir_done()
+endif
+
+libgnunetmicrophone = library('gnunetmicrophone',
+ ['microphone.c'],
+ soversion: '0',
+ version: '0.0.0',
+ dependencies: [libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetmicrophone_dep = declare_dependency(link_with : libgnunetmicrophone)
+pkg.generate(libgnunetmicrophone, url: 'https://www.gnunet.org',
+ description : 'Provides API to access to microphone')
+
+libgnunetspeaker = library('gnunetspeaker',
+ ['speaker.c'],
+ soversion: '0',
+ version: '0.0.0',
+ dependencies: [libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetspeaker_dep = declare_dependency(link_with : libgnunetspeaker)
+pkg.generate(libgnunetspeaker, url: 'https://www.gnunet.org',
+ description : 'Provides API to access to speaker')
+
+libgnunetconversation = library('gnunetconversation',
+ libgnunetconversation_src,
+ soversion: '0',
+ version: '0.0.0',
+ dependencies: [libgnunetutil_dep,
+ libgnunetgnsrecord_dep,
+ libgnunetgns_dep,
+ libgnunetnamestore_dep,
+ libgnunetidentity_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetconversation_dep = declare_dependency(link_with : libgnunetconversation)
+pkg.generate(libgnunetconversation, url: 'https://www.gnunet.org',
+ description : 'Provides API to access to conversation')
+
+shared_module('gnunet_plugin_gnsrecord_conversation',
+ ['plugin_gnsrecord_conversation.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetconversation_dep,
+ libgnunetgns_dep,
+ libgnunetgnsrecord_dep,
+ libgnunetidentity_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+executable ('gnunet-conversation',
+ 'gnunet-conversation.c',
+ dependencies: [libgnunetconversation_dep,
+ libgnunetgns_dep,
+ libgnunetgnsrecord_dep,
+ libgnunetnamestore_dep,
+ libgnunetspeaker_dep,
+ libgnunetmicrophone_dep,
+ libgnunetidentity_dep,
+ libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-service-conversation',
+ gnunetserviceconversation_src,
+ dependencies: [libgnunetconversation_dep,
+ libgnunetspeaker_dep,
+ libgnunetmicrophone_dep,
+ libgnunetidentity_dep,
+ libgnunetcadet_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
diff --git a/src/conversation/test_conversation.conf b/src/conversation/test_conversation.conf
index e77b41003..a2f768713 100644
--- a/src/conversation/test_conversation.conf
+++ b/src/conversation/test_conversation.conf
@@ -4,5 +4,13 @@
LINE=1
#PREFIX = valgrind
+[zonemaster-monitor]
+IMMEDIATE_START = YES
+START_ON_DEMAND = YES
+
+[zonemaster]
+IMMEDIATE_START = YES
+START_ON_DEMAND = YES
+
[nse]
WORKBITS = 0
diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c
index 41ef75821..22e9b1dd9 100644
--- a/src/conversation/test_conversation_api.c
+++ b/src/conversation/test_conversation_api.c
@@ -386,21 +386,20 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
static void
caller_ego_create_cont (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
(void) cls;
op = NULL;
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
}
static void
-namestore_put_cont (void *cls, int32_t success, const char *emsg)
+namestore_put_cont (void *cls, enum GNUNET_ErrorCode ec)
{
(void) cls;
qe = NULL;
- GNUNET_assert (GNUNET_YES == success);
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
GNUNET_assert (NULL == op);
op = GNUNET_IDENTITY_create (id, "caller-ego", NULL,
GNUNET_IDENTITY_TYPE_ECDSA,
@@ -468,11 +467,11 @@ identity_cb (void *cls,
static void
phone_ego_create_cont (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
(void) cls;
op = NULL;
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
}
diff --git a/src/conversation/test_conversation_api_reject.c b/src/conversation/test_conversation_api_reject.c
index 15728123b..a7aab069f 100644
--- a/src/conversation/test_conversation_api_reject.c
+++ b/src/conversation/test_conversation_api_reject.c
@@ -239,21 +239,20 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
static void
caller_ego_create_cont (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
(void) cls;
op = NULL;
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
}
static void
-namestore_put_cont (void *cls, int32_t success, const char *emsg)
+namestore_put_cont (void *cls, enum GNUNET_ErrorCode ec)
{
(void) cls;
qe = NULL;
- GNUNET_assert (GNUNET_YES == success);
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
GNUNET_assert (NULL == op);
op = GNUNET_IDENTITY_create (id, "caller-ego", NULL,
GNUNET_IDENTITY_TYPE_ECDSA,
@@ -321,11 +320,11 @@ identity_cb (void *cls,
static void
phone_ego_create_cont (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
(void) cls;
op = NULL;
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
}
diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c
index 9abf91d0b..1bd2b4e22 100644
--- a/src/conversation/test_conversation_api_twocalls.c
+++ b/src/conversation/test_conversation_api_twocalls.c
@@ -508,21 +508,20 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
static void
caller_ego_create_cont (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
(void) cls;
op = NULL;
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
}
static void
-namestore_put_cont (void *cls, int32_t success, const char *emsg)
+namestore_put_cont (void *cls, enum GNUNET_ErrorCode ec)
{
(void) cls;
qe = NULL;
- GNUNET_assert (GNUNET_YES == success);
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
GNUNET_assert (NULL == op);
op = GNUNET_IDENTITY_create (id, "caller-ego", NULL,
GNUNET_IDENTITY_TYPE_ECDSA,
@@ -597,11 +596,11 @@ identity_cb (void *cls,
static void
phone_ego_create_cont (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
(void) cls;
op = NULL;
- GNUNET_assert (NULL == emsg);
+ GNUNET_assert (GNUNET_EC_NONE == ec);
}
diff --git a/src/core/core.h b/src/core/core.h
index 4d8619a29..17df7acb7 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -26,9 +26,8 @@
#ifndef CORE_H
#define CORE_H
-#include "gnunet_bandwidth_lib.h"
#include "gnunet_transport_service.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_time_lib.h"
/**
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 81118693d..2e0bb1785 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -158,7 +158,6 @@ reconnect (struct GNUNET_CORE_Handle *h);
* Task schedule to try to re-connect to core.
*
* @param cls the `struct GNUNET_CORE_Handle`
- * @param tc task context
*/
static void
reconnect_task (void *cls)
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index 07c346485..b203f4902 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -488,7 +488,8 @@ derive_aes_key (const struct GNUNET_PeerIdentity *sender,
* @param iv initialization vector to use
* @param in ciphertext
* @param out plaintext
- * @param size size of @a in/@a out
+ * @param size size of @a in / @a out
+ *
* @return #GNUNET_OK on success
*/
static int
@@ -1392,13 +1393,6 @@ send_key (struct GSC_KeyExchangeInfo *kx)
}
-/**
- * Encrypt and transmit a message with the given payload.
- *
- * @param kx key exchange context
- * @param payload payload of the message
- * @param payload_size number of bytes in @a payload
- */
void
GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
const void *payload,
@@ -1895,12 +1889,6 @@ GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *kxinfo)
}
-/**
- * Check if the given neighbour has excess bandwidth available.
- *
- * @param target neighbour to check
- * @return #GNUNET_YES if excess bandwidth is available, #GNUNET_NO if not
- */
int
GSC_NEIGHBOURS_check_excess_bandwidth (const struct GSC_KeyExchangeInfo *kxinfo)
{
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index d40b3bfad..e103c89f5 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -855,14 +855,6 @@ GSC_SESSIONS_solicit (const struct GNUNET_PeerIdentity *pid)
}
-/**
- * Transmit a message to a particular peer.
- *
- * @param car original request that was queued and then solicited;
- * this handle will now be 'owned' by the SESSIONS subsystem
- * @param msg message to transmit
- * @param priority how important is this message
- */
void
GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
const struct GNUNET_MessageHeader *msg,
@@ -904,13 +896,6 @@ GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
}
-/**
- * We have received a typemap message from a peer, update ours.
- * Notifies clients about the session.
- *
- * @param peer peer this is about
- * @param msg typemap update message
- */
void
GSC_SESSIONS_set_typemap (const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *msg)
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c
index 47235501c..7b7df2fe9 100644
--- a/src/core/gnunet-service-core_typemap.c
+++ b/src/core/gnunet-service-core_typemap.c
@@ -253,12 +253,6 @@ GSC_TYPEMAP_add (const uint16_t *types, unsigned int tlen)
}
-/**
- * Remove a set of types from our type map.
- *
- * @param types array of types to remove
- * @param tlen length of the @a types array
- */
void
GSC_TYPEMAP_remove (const uint16_t *types, unsigned int tlen)
{
diff --git a/src/core/meson.build b/src/core/meson.build
new file mode 100644
index 000000000..4c5bb4d61
--- /dev/null
+++ b/src/core/meson.build
@@ -0,0 +1,48 @@
+libgnunetcore_src = ['core_api.c',
+ 'core_api_monitor_peers.c']
+
+gnunetservicecore_src = ['gnunet-service-core.c',
+ 'gnunet-service-core_kx.c',
+ 'gnunet-service-core_sessions.c',
+ 'gnunet-service-core_typemap.c']
+
+configure_file(input : 'core.conf.in',
+ output : 'core.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+
+if get_option('monolith')
+ foreach p : libgnunetcore_src + gnunetservicecore_src
+ gnunet_src += 'core/' + p
+ endforeach
+endif
+
+libgnunetcore = library('gnunetcore',
+ libgnunetcore_src,
+ dependencies: libgnunetutil_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ soversion: '0',
+ version: '0.1.0',
+ install_dir: get_option('libdir'))
+libgnunetcore_dep = declare_dependency(link_with : libgnunetcore)
+pkg.generate(libgnunetcore, url: 'https://www.gnunet.org',
+ description : 'Provides API for (encrypted) P2P communication')
+
+executable ('gnunet-core',
+ ['gnunet-core.c'],
+ dependencies: [libgnunetcore_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
+executable ('gnunet-service-core',
+ gnunetservicecore_src,
+ dependencies: [libgnunetcore_dep, libgnunetutil_dep,
+ libgnunetstatistics_dep,
+ libgnunettransport_dep,
+ zlib_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index 064964292..653ce1aa0 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -334,8 +334,12 @@ main (int argc, char *argv1[])
&ok);
stop_arm (&p1);
stop_arm (&p2);
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_api_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_api_peer2.conf",
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index debf808ca..d4b55a6b8 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -525,8 +525,10 @@ main (int argc,
stop_arm (&p2);
GNUNET_free (p1.hello);
GNUNET_free (p2.hello);
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
+ GNUNET_DISK_purge_cfg_dir ("test_core_api_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir ("test_core_api_peer2.conf",
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/core/test_core_api_send_to_self.conf b/src/core/test_core_api_send_to_self.conf
index c2a459bb9..fe8e69999 100644
--- a/src/core/test_core_api_send_to_self.conf
+++ b/src/core/test_core_api_send_to_self.conf
@@ -1,6 +1,6 @@
@INLINE@ test_core_defaults.conf
[PATHS]
-GNUNET_TEST_HOME = ~/.gnunet/
+GNUNET_TEST_HOME = $GNUNET_TMP/test-core-api-send-to-self/
[ats]
WAN_QUOTA_IN = 104857600
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c
index 007131134..e50d3b2ec 100644
--- a/src/core/test_core_api_start_only.c
+++ b/src/core/test_core_api_start_only.c
@@ -211,9 +211,13 @@ check ()
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
-
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
+
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_api_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_api_peer2.conf",
+ "GNUNET_TEST_HOME");
ok = 1;
GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1,
@@ -241,8 +245,12 @@ main (int argc,
"WARNING",
NULL);
ret = check ();
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_api_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_api_peer2.conf",
+ "GNUNET_TEST_HOME");
return ret;
}
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index cf2da3d97..099c6fa3b 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -530,6 +530,7 @@ process_hello (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received (my) HELLO from transport service\n");
GNUNET_assert (message != NULL);
+ if (NULL != p->hello) GNUNET_free (p->hello);
p->hello = GNUNET_malloc (ntohs (message->size));
GNUNET_memcpy (p->hello, message, ntohs (message->size));
if ((p == &p1) &&
@@ -722,22 +723,30 @@ cleanup_directory (int test)
switch (test)
{
case SYMMETRIC:
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_quota_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_quota_peer2.conf",
+ "GNUNET_TEST_HOME");
break;
case ASYMMETRIC_SEND_LIMITED:
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_quota_asymmetric_send_limit_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_quota_asymmetric_send_limit_peer2.conf",
+ "GNUNET_TEST_HOME");
break;
case ASYMMETRIC_RECV_LIMITED:
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
- GNUNET_DISK_directory_remove
- ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_quota_asymmetric_recv_limited_peer1.conf",
+ "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_core_quota_asymmetric_recv_limited_peer2.conf",
+ "GNUNET_TEST_HOME");
break;
}
}
diff --git a/src/curl/Makefile.am b/src/curl/Makefile.am
index c6b350bc7..bf18b0647 100644
--- a/src/curl/Makefile.am
+++ b/src/curl/Makefile.am
@@ -6,16 +6,6 @@ if USE_COVERAGE
XLIB = -lgcov
endif
-if HAVE_LIBGNURL
-LIB_GNURL=@LIBGNURL@
-CPP_GNURL=@LIBGNURL_CPPFLAGS@
-else
-if HAVE_LIBCURL
-LIB_GNURL=@LIBCURL@
-CPP_GNURL=@LIBCURL_CPPFLAGS@
-endif
-endif
-
lib_LTLIBRARIES = \
libgnunetcurl.la
@@ -29,10 +19,10 @@ libgnunetcurl_la_SOURCES = \
libgnunetcurl_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
-ljansson \
- $(LIB_GNURL) \
+ @LIBCURL@ \
$(XLIB)
libgnunetcurl_la_CPPFLAGS = \
- $(CPP_GNURL) $(AM_CPPFLAGS) $(MHD_CFLAGS)
+ @LIBCURL_CPPFLAGS@ $(AM_CPPFLAGS) $(MHD_CFLAGS)
#check_PROGRAMS = \
# test_curl
diff --git a/src/curl/curl.c b/src/curl/curl.c
index e45612e94..648c9a14e 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -32,6 +32,10 @@
#include "../util/benchmark.h"
#endif
+/**
+ * Set to 1 for extra debug logging.
+ */
+#define DEBUG 0
/**
* Log error related to CURL operations.
@@ -121,6 +125,11 @@ struct GNUNET_CURL_Job
* after the job has finished.
*/
struct curl_slist *job_headers;
+
+ /**
+ * When did we start the job?
+ */
+ struct GNUNET_TIME_Absolute start_time;
};
@@ -276,7 +285,7 @@ GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx,
}
-int
+enum GNUNET_GenericReturnValue
GNUNET_CURL_is_valid_scope_id (const char *scope_id)
{
if (strlen (scope_id) >= 64)
@@ -411,6 +420,7 @@ setup_job (CURL *eh,
return NULL;
}
job = GNUNET_new (struct GNUNET_CURL_Job);
+ job->start_time = GNUNET_TIME_absolute_get ();
job->job_headers = all_headers;
if ( (CURLE_OK !=
@@ -428,8 +438,14 @@ setup_job (CURL *eh,
(CURLE_OK !=
curl_easy_setopt (eh,
CURLOPT_SHARE,
- ctx->share)) ||
- (CURLM_OK !=
+ ctx->share)) )
+ {
+ GNUNET_break (0);
+ GNUNET_free (job);
+ curl_easy_cleanup (eh);
+ return NULL;
+ }
+ if ( (CURLM_OK !=
curl_multi_add_handle (ctx->multi,
eh)) )
{
@@ -638,10 +654,12 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
json_error_t error;
char *ct;
+#if DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Downloaded body: %.*s\n",
(int) db->buf_size,
(char *) db->buf);
+#endif
if (CURLE_OK !=
curl_easy_getinfo (eh,
CURLINFO_RESPONSE_CODE,
@@ -651,6 +669,8 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
GNUNET_break (0);
*response_code = 0;
}
+ if (MHD_HTTP_NO_CONTENT == *response_code)
+ return NULL;
if ((CURLE_OK !=
curl_easy_getinfo (eh,
CURLINFO_CONTENT_TYPE,
@@ -661,14 +681,21 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
/* No content type or explicitly not JSON, refuse to parse
(but keep response code) */
if (0 != db->buf_size)
+ {
+ char *url;
+
+ if (CURLE_OK !=
+ curl_easy_getinfo (eh,
+ CURLINFO_EFFECTIVE_URL,
+ &url))
+ url = "<unknown URL>";
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Did NOT detect response `%.*s' as JSON\n",
- (int) db->buf_size,
- (const char *) db->buf);
+ "Request to `%s' was expected to return a body of type `application/json', got `%s'\n",
+ url,
+ ct);
+ }
return NULL;
}
- if (MHD_HTTP_NO_CONTENT == *response_code)
- return NULL;
if (0 == *response_code)
{
char *url;
@@ -731,6 +758,7 @@ GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx,
&n_completed)))
{
struct GNUNET_CURL_Job *job;
+ struct GNUNET_TIME_Relative duration;
long response_code;
void *response;
@@ -742,6 +770,7 @@ GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx,
(char **) &job));
GNUNET_assert (job->ctx == ctx);
response_code = 0;
+ duration = GNUNET_TIME_absolute_get_duration (job->start_time);
if (NULL != job->jcc_raw)
{
/* RAW mode, no parsing */
@@ -765,6 +794,22 @@ GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx,
response);
rc (response);
}
+ {
+ char *url = NULL;
+
+ if (CURLE_UNKNOWN_OPTION ==
+ curl_easy_getinfo (job->easy_handle,
+ CURLINFO_EFFECTIVE_URL,
+ &url))
+ url = "<unknown>";
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "HTTP request for `%s' finished with %u after %s\n",
+ url,
+ (unsigned int) response_code,
+ GNUNET_TIME_relative2s (duration,
+ true));
+ /* Note: we MUST NOT free 'url' here */
+ }
GNUNET_CURL_job_cancel (job);
}
}
diff --git a/src/curl/curl_reschedule.c b/src/curl/curl_reschedule.c
index a1fe55aa5..0c19bd171 100644
--- a/src/curl/curl_reschedule.c
+++ b/src/curl/curl_reschedule.c
@@ -59,12 +59,6 @@ struct GNUNET_CURL_RescheduleContext
};
-/**
- * Initialize reschedule context; with custom response parser
- *
- * @param ctx context to manage
- * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
- */
struct GNUNET_CURL_RescheduleContext *
GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx,
GNUNET_CURL_RawParser rp,
@@ -93,12 +87,6 @@ clean_result (void *response)
}
-/**
- * Initialize reschedule context.
- *
- * @param ctx context to manage
- * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
- */
struct GNUNET_CURL_RescheduleContext *
GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
{
@@ -112,11 +100,6 @@ GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
}
-/**
- * Destroy reschedule context.
- *
- * @param rc context to destroy
- */
void
GNUNET_CURL_gnunet_rc_destroy (struct GNUNET_CURL_RescheduleContext *rc)
{
@@ -159,13 +142,18 @@ context_task (void *cls)
&timeout);
if (timeout >= 0)
delay =
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, timeout);
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+ timeout);
else
delay = GNUNET_TIME_UNIT_FOREVER_REL;
rs = GNUNET_NETWORK_fdset_create ();
- GNUNET_NETWORK_fdset_copy_native (rs, &read_fd_set, max_fd + 1);
+ GNUNET_NETWORK_fdset_copy_native (rs,
+ &read_fd_set,
+ max_fd + 1);
ws = GNUNET_NETWORK_fdset_create ();
- GNUNET_NETWORK_fdset_copy_native (ws, &write_fd_set, max_fd + 1);
+ GNUNET_NETWORK_fdset_copy_native (ws,
+ &write_fd_set,
+ max_fd + 1);
if (NULL == rc->task)
rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
delay,
@@ -178,15 +166,6 @@ context_task (void *cls)
}
-/**
- * Implementation of the #GNUNET_CURL_RescheduleCallback for GNUnet's
- * scheduler. Will run the CURL context using GNUnet's scheduler.
- * Note that you MUST immediately destroy the reschedule context after
- * calling #GNUNET_CURL_fini().
- *
- * @param cls must point to a `struct GNUNET_CURL_RescheduleContext *`
- * (pointer to a pointer!)
- */
void
GNUNET_CURL_gnunet_scheduler_reschedule (void *cls)
{
@@ -194,7 +173,8 @@ GNUNET_CURL_gnunet_scheduler_reschedule (void *cls)
if (NULL != rc->task)
GNUNET_SCHEDULER_cancel (rc->task);
- rc->task = GNUNET_SCHEDULER_add_now (&context_task, rc);
+ rc->task = GNUNET_SCHEDULER_add_now (&context_task,
+ rc);
}
diff --git a/src/curl/meson.build b/src/curl/meson.build
new file mode 100644
index 000000000..dd38843a8
--- /dev/null
+++ b/src/curl/meson.build
@@ -0,0 +1,19 @@
+libgnunetcurl_src = ['curl.c',
+ 'curl_reschedule.c']
+
+if get_option('monolith')
+ foreach p : libgnunetcurl_src
+ gnunet_src += 'curl/' + p
+ endforeach
+endif
+
+libgnunetcurl = library('gnunetcurl',
+ libgnunetcurl_src,
+ soversion: '0',
+ version: '0.0.0',
+ dependencies: [libgnunetutil_dep, curl_dep, json_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetcurl_dep = declare_dependency(link_with : libgnunetcurl)
+
diff --git a/src/datacache/Makefile.am b/src/datacache/Makefile.am
index 4789706ff..14778e0a3 100644
--- a/src/datacache/Makefile.am
+++ b/src/datacache/Makefile.am
@@ -8,6 +8,13 @@ pkgcfgdir= $(pkgdatadir)/config.d/
dist_pkgcfg_DATA = \
datacache.conf
+sqldir = $(prefix)/share/gnunet/sql/
+
+sql_DATA = \
+ datacache-0001.sql \
+ datacache-drop.sql
+
+
if USE_COVERAGE
AM_CFLAGS = --coverage -O0
XLIBS = -lgcov
@@ -195,4 +202,5 @@ EXTRA_DIST = \
test_datacache_data_heap.conf \
perf_datacache_data_heap.conf \
test_datacache_data_postgres.conf \
- perf_datacache_data_postgres.conf
+ perf_datacache_data_postgres.conf \
+ $(sql_DATA)
diff --git a/src/datacache/datacache-0001.sql b/src/datacache/datacache-0001.sql
new file mode 100644
index 000000000..6567de3c2
--- /dev/null
+++ b/src/datacache/datacache-0001.sql
@@ -0,0 +1,48 @@
+--
+-- This file is part of GNUnet
+-- Copyright (C) 2014--2022 GNUnet e.V.
+--
+-- GNUnet is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- GNUnet; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+-- Everything in one big transaction
+BEGIN;
+
+-- Check patch versioning is in place.
+SELECT _v.register_patch('datacache-0001', NULL, NULL);
+
+-------------------- Schema ----------------------------
+
+CREATE SCHEMA datacache;
+COMMENT ON SCHEMA datacache IS 'gnunet-datacache data';
+
+SET search_path TO datacache;
+
+CREATE TABLE IF NOT EXISTS gn180dc (
+ oid BIGINT GENERATED BY DEFAULT AS IDENTITY,
+ type INT4 NOT NULL,
+ ro INT4 NOT NULL,
+ prox INT4 NOT NULL,
+ expiration_time INT8 NOT NULL,
+ key BYTEA NOT NULL CHECK(LENGTH(key)=64),
+ trunc BYTEA NOT NULL CHECK(LENGTH(trunc)=32),
+ value BYTEA NOT NULL,
+ path BYTEA DEFAULT NULL);
+
+CREATE INDEX IF NOT EXISTS idx_oid
+ ON gn180dc (oid);
+CREATE INDEX IF NOT EXISTS idx_key
+ ON gn180dc (key);
+CREATE INDEX IF NOT EXISTS idx_dt
+ ON gn180dc (expiration_time);
+
+COMMIT;
diff --git a/src/datacache/datacache-drop.sql b/src/datacache/datacache-drop.sql
new file mode 100644
index 000000000..2dd84bca8
--- /dev/null
+++ b/src/datacache/datacache-drop.sql
@@ -0,0 +1,25 @@
+--
+-- This file is part of GNUnet
+-- Copyright (C) 2014--2022 GNUnet e.V.
+--
+-- GNUnet is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- GNUnet; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+-- Everything in one big transaction
+BEGIN;
+
+
+SELECT _v.unregister_patch('datacache-0001');
+
+DROP SCHEMA datacache CASCADE;
+
+COMMIT;
diff --git a/src/datacache/datacache.conf b/src/datacache/datacache.conf
index f9c718eb0..ed5c3da06 100644
--- a/src/datacache/datacache.conf
+++ b/src/datacache/datacache.conf
@@ -1,2 +1,6 @@
[datacache-postgres]
CONFIG = postgres:///gnunet
+
+# Where are the SQL files to setup our tables?
+# Important: this MUST end with a "/"!
+SQL_DIR = $DATADIR/sql/ \ No newline at end of file
diff --git a/src/datacache/meson.build b/src/datacache/meson.build
new file mode 100644
index 000000000..e753ca6eb
--- /dev/null
+++ b/src/datacache/meson.build
@@ -0,0 +1,51 @@
+libgnunetdatacache_src = ['datacache.c']
+
+configure_file(input : 'datacache.conf',
+ output : 'datacache.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+install_data ('datacache-0001.sql',
+ 'datacache-drop.sql',
+ install_dir: get_option('datadir')/'gnunet'/'sql')
+
+if get_option('monolith')
+ foreach p : libgnunetdatacache_src
+ gnunet_src += 'datacache/' + p
+ endforeach
+endif
+
+libgnunetdatacache = library('gnunetdatacache',
+ libgnunetdatacache_src,
+ soversion: '0',
+ version: '0.0.1',
+ dependencies: [libgnunetutil_dep, libgnunetstatistics_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetdatacache_dep = declare_dependency(link_with : libgnunetdatacache)
+pkg.generate(libgnunetdatacache, url: 'https://www.gnunet.org',
+ description : 'Provides datacache API for temporary storage to disk')
+
+shared_module('gnunet_plugin_datacache_sqlite',
+ ['plugin_datacache_sqlite.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetdatacache_dep,
+ sqlite_dep,
+ libgnunetsq_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+
+if pq_dep.found()
+ shared_module('gnunet_plugin_datacache_postgres',
+ ['plugin_datacache_postgres.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetdatacache_dep,
+ pq_dep,
+ libgnunetpq_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+endif
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 84bc4a852..adbb958cc 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -160,7 +160,7 @@ main (int argc, char *argv[])
GNUNET_log_setup ("perf-datacache",
"WARNING",
NULL);
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (cfg_name, sizeof(cfg_name), "perf_datacache_data_%s.conf",
plugin_name);
GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1, xargv,
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index b1f9a1b8e..8bfd04aea 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -66,80 +66,54 @@ struct Plugin
static enum GNUNET_GenericReturnValue
init_connection (struct Plugin *plugin)
{
- struct GNUNET_PQ_ExecuteStatement es[] = {
- GNUNET_PQ_make_try_execute (
- "CREATE TEMPORARY SEQUENCE IF NOT EXISTS gn180dc_oid_seq"),
- GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn180dc ("
- " oid OID NOT NULL DEFAULT nextval('gn180dc_oid_seq'),"
- " type INT4 NOT NULL,"
- " ro INT4 NOT NULL,"
- " prox INT4 NOT NULL,"
- " expiration_time INT8 NOT NULL,"
- " key BYTEA NOT NULL CHECK(LENGTH(key)=64),"
- " trunc BYTEA NOT NULL CHECK(LENGTH(trunc)=32),"
- " value BYTEA NOT NULL,"
- " path BYTEA DEFAULT NULL)"),
- GNUNET_PQ_make_try_execute (
- "ALTER SEQUENCE gnu011dc_oid_seq OWNED BY gn180dc.oid"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_oid ON gn180dc (oid)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_key ON gn180dc (key)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_dt ON gn180dc (expiration_time)"),
- GNUNET_PQ_make_execute (
- "ALTER TABLE gn180dc ALTER value SET STORAGE EXTERNAL"),
- GNUNET_PQ_make_execute ("ALTER TABLE gn180dc ALTER key SET STORAGE PLAIN"),
- GNUNET_PQ_EXECUTE_STATEMENT_END
- };
struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("getkt",
- "SELECT expiration_time,type,ro,value,trunc,path FROM gn180dc "
- "WHERE key=$1 AND type=$2 AND expiration_time >= $3",
- 3),
+ "SELECT expiration_time,type,ro,value,trunc,path"
+ " FROM datacache.gn180dc"
+ " WHERE key=$1 AND type=$2 AND expiration_time >= $3"),
GNUNET_PQ_make_prepare ("getk",
- "SELECT expiration_time,type,ro,value,trunc,path FROM gn180dc "
- "WHERE key=$1 AND expiration_time >= $2",
- 2),
+ "SELECT expiration_time,type,ro,value,trunc,path"
+ " FROM datacache.gn180dc"
+ " WHERE key=$1 AND expiration_time >= $2"),
GNUNET_PQ_make_prepare ("getex",
- "SELECT LENGTH(value) AS len,oid,key FROM gn180dc"
+ "SELECT LENGTH(value) AS len,oid,key"
+ " FROM datacache.gn180dc"
" WHERE expiration_time < $1"
- " ORDER BY expiration_time ASC LIMIT 1",
- 1),
+ " ORDER BY expiration_time ASC LIMIT 1"),
GNUNET_PQ_make_prepare ("getm",
- "SELECT LENGTH(value) AS len,oid,key FROM gn180dc"
- " ORDER BY prox ASC, expiration_time ASC LIMIT 1",
- 0),
+ "SELECT LENGTH(value) AS len,oid,key"
+ " FROM datacache.gn180dc"
+ " ORDER BY prox ASC, expiration_time ASC LIMIT 1"),
GNUNET_PQ_make_prepare ("get_closest",
- "(SELECT expiration_time,type,ro,value,trunc,path,key FROM gn180dc"
+ "(SELECT expiration_time,type,ro,value,trunc,path,key"
+ " FROM datacache.gn180dc"
" WHERE key >= $1"
" AND expiration_time >= $2"
" AND ( (type = $3) OR ( 0 = $3) )"
" ORDER BY key ASC"
" LIMIT $4)"
" UNION "
- "(SELECT expiration_time,type,ro,value,trunc,path,key FROM gn180dc"
+ "(SELECT expiration_time,type,ro,value,trunc,path,key"
+ " FROM datacache.gn180dc"
" WHERE key <= $1"
" AND expiration_time >= $2"
" AND ( (type = $3) OR ( 0 = $3) )"
" ORDER BY key DESC"
- " LIMIT $4)",
- 4),
+ " LIMIT $4)"),
GNUNET_PQ_make_prepare ("delrow",
- "DELETE FROM gn180dc WHERE oid=$1",
- 1),
+ "DELETE FROM datacache.gn180dc"
+ " WHERE oid=$1"),
GNUNET_PQ_make_prepare ("put",
- "INSERT INTO gn180dc"
+ "INSERT INTO datacache.gn180dc"
" (type, ro, prox, expiration_time, key, value, trunc, path) "
- "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
- 8),
+ "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)"),
GNUNET_PQ_PREPARED_STATEMENT_END
};
plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->env->cfg,
"datacache-postgres",
+ "datacache-",
NULL,
- es,
ps);
if (NULL == plugin->dbh)
return GNUNET_SYSERR;
@@ -172,9 +146,12 @@ postgres_plugin_put (void *cls,
GNUNET_PQ_query_param_fixed_size (block->data,
block->data_size),
GNUNET_PQ_query_param_auto_from_type (&block->trunc_peer),
- GNUNET_PQ_query_param_fixed_size (block->put_path,
- block->put_path_length
- * sizeof(struct GNUNET_DHT_PathElement)),
+ (0 == block->put_path_length)
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_fixed_size (
+ block->put_path,
+ block->put_path_length
+ * sizeof(struct GNUNET_DHT_PathElement)),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus ret;
@@ -218,7 +195,7 @@ struct HandleResultContext
*
* @param cls closure of type `struct HandleResultContext`
* @param result the postgres result
- * @param num_result the number of results in @a result
+ * @param num_results the number of results in @a result
*/
static void
handle_results (void *cls,
@@ -233,8 +210,8 @@ handle_results (void *cls,
uint32_t bro32;
void *data;
struct GNUNET_DATACACHE_Block block;
- void *path;
- size_t path_size;
+ void *path = NULL;
+ size_t path_size = 0;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_absolute_time ("expiration_time",
&block.expiration_time),
@@ -247,9 +224,11 @@ handle_results (void *cls,
&block.data_size),
GNUNET_PQ_result_spec_auto_from_type ("trunc",
&block.trunc_peer),
- GNUNET_PQ_result_spec_variable_size ("path",
- &path,
- &path_size),
+ GNUNET_PQ_result_spec_allow_null (
+ GNUNET_PQ_result_spec_variable_size ("path",
+ &path,
+ &path_size),
+ NULL),
GNUNET_PQ_result_spec_end
};
@@ -358,12 +337,12 @@ postgres_plugin_del (void *cls)
GNUNET_PQ_query_param_end
};
uint32_t size;
- uint32_t oid;
+ uint64_t oid;
struct GNUNET_HashCode key;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint32 ("len",
&size),
- GNUNET_PQ_result_spec_uint32 ("oid",
+ GNUNET_PQ_result_spec_uint64 ("oid",
&oid),
GNUNET_PQ_result_spec_auto_from_type ("key",
&key),
@@ -371,7 +350,7 @@ postgres_plugin_del (void *cls)
};
enum GNUNET_DB_QueryStatus res;
struct GNUNET_PQ_QueryParam dparam[] = {
- GNUNET_PQ_query_param_uint32 (&oid),
+ GNUNET_PQ_query_param_uint64 (&oid),
GNUNET_PQ_query_param_end
};
struct GNUNET_TIME_Absolute now;
@@ -440,7 +419,7 @@ struct ExtractResultContext
*
* @param cls closure with the `struct ExtractResultContext`
* @param result the postgres result
- * @param num_result the number of results in @a result
+ * @param num_results the number of results in @a result
*/
static void
extract_result_cb (void *cls,
@@ -624,6 +603,9 @@ libgnunet_plugin_datacache_postgres_done (void *cls)
struct GNUNET_DATACACHE_PluginFunctions *api = cls;
struct Plugin *plugin = api->cls;
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_PQ_exec_sql (plugin->dbh,
+ "datacache-drop"));
GNUNET_PQ_disconnect (plugin->dbh);
GNUNET_free (plugin);
GNUNET_free (api);
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 0753d87ce..1c6f24a82 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -161,7 +161,7 @@ struct Plugin
* @brief Prepare a SQL statement
*
* @param dbh database handle
- * @param zsql SQL statement text
+ * @param zSql SQL statement text
* @param[out] ppStmt set to the prepared statement
* @return 0 on success
*/
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index fd5a5f54c..a97a3f33c 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -182,7 +182,7 @@ main (int argc, char *argv[])
GNUNET_log_setup ("test-datacache",
"WARNING",
NULL);
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (cfg_name,
sizeof(cfg_name),
"test_datacache_data_%s.conf",
@@ -198,6 +198,7 @@ main (int argc, char *argv[])
fprintf (stderr,
"Missed some testcases: %d\n",
ok);
+ GNUNET_free (plugin_name);
return ok;
}
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c
index 994147a64..2cdff8083 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -170,7 +170,7 @@ main (int argc,
"WARNING",
NULL);
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (cfg_name,
sizeof(cfg_name),
"test_datacache_data_%s.conf",
@@ -186,6 +186,7 @@ main (int argc,
fprintf (stderr,
"Missed some testcases: %d\n",
ok);
+ GNUNET_free (plugin_name);
return ok;
}
diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am
index 07ae004b3..595c7da3d 100644
--- a/src/datastore/Makefile.am
+++ b/src/datastore/Makefile.am
@@ -10,6 +10,12 @@ libexecdir= $(pkglibdir)/libexec/
pkgcfg_DATA = \
datastore.conf
+sqldir = $(prefix)/share/gnunet/sql/
+
+sql_DATA = \
+ datastore-0001.sql \
+ datastore-drop.sql
+
if USE_COVERAGE
AM_CFLAGS = --coverage -O0
XLIBS = -lgcov
@@ -50,19 +56,6 @@ gnunet_datastore_LDADD = \
$(GN_LIBINTL)
-if HAVE_MYSQL
- MYSQL_PLUGIN = libgnunet_plugin_datastore_mysql.la
-if HAVE_BENCHMARKS
- MYSQL_BENCHMARKS = \
- perf_datastore_api_mysql \
- perf_plugin_datastore_mysql
-endif
- MYSQL_TESTS = \
- test_datastore_api_mysql \
- test_datastore_api_management_mysql \
- test_plugin_datastore_mysql \
- $(MYSQL_BENCHMARKS)
-endif
if HAVE_SQLITE
SQLITE_PLUGIN = libgnunet_plugin_datastore_sqlite.la
if HAVE_BENCHMARKS
@@ -92,7 +85,6 @@ endif
plugin_LTLIBRARIES = \
$(SQLITE_PLUGIN) \
- $(MYSQL_PLUGIN) \
$(POSTGRES_PLUGIN) \
libgnunet_plugin_datastore_heap.la
@@ -122,18 +114,6 @@ libgnunet_plugin_datastore_heap_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_datastore_mysql_la_SOURCES = \
- plugin_datastore_mysql.c
-libgnunet_plugin_datastore_mysql_la_LIBADD = \
- $(top_builddir)/src/my/libgnunetmy.la \
- $(top_builddir)/src/mysql/libgnunetmysql.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) $(Z_LIBS) -lmysqlclient
-libgnunet_plugin_datastore_mysql_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS) $(MYSQL_LDFLAGS) -lmysqlclient
-libgnunet_plugin_datastore_mysql_la_CPPFLAGS = \
- $(MYSQL_CPPFLAGS) $(AM_CPPFLAGS)
-
libgnunet_plugin_datastore_postgres_la_SOURCES = \
plugin_datastore_postgres.c
libgnunet_plugin_datastore_postgres_la_LIBADD = \
@@ -161,7 +141,6 @@ check_PROGRAMS = \
perf_plugin_datastore_heap \
test_plugin_datastore_heap \
$(SQLITE_TESTS) \
- $(MYSQL_TESTS) \
$(POSTGRES_TESTS)
if ENABLE_TEST_RUN
@@ -237,40 +216,6 @@ test_plugin_datastore_sqlite_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la
-test_datastore_api_mysql_SOURCES = \
- test_datastore_api.c
-test_datastore_api_mysql_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_datastore_api_management_mysql_SOURCES = \
- test_datastore_api_management.c
-test_datastore_api_management_mysql_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_datastore_api_mysql_SOURCES = \
- perf_datastore_api.c
-perf_datastore_api_mysql_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- libgnunetdatastore.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_plugin_datastore_mysql_SOURCES = \
- test_plugin_datastore.c
-test_plugin_datastore_mysql_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_plugin_datastore_mysql_SOURCES = \
- perf_plugin_datastore.c
-perf_plugin_datastore_mysql_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-
test_datastore_api_postgres_SOURCES = \
test_datastore_api.c
test_datastore_api_postgres_LDADD = \
@@ -313,9 +258,7 @@ EXTRA_DIST = \
test_datastore_api_data_heap.conf \
perf_plugin_datastore_data_heap.conf \
test_plugin_datastore_data_heap.conf \
- test_datastore_api_data_mysql.conf \
- perf_plugin_datastore_data_mysql.conf \
- test_plugin_datastore_data_mysql.conf \
test_datastore_api_data_postgres.conf \
perf_plugin_datastore_data_postgres.conf \
- test_plugin_datastore_data_postgres.conf
+ test_plugin_datastore_data_postgres.conf \
+ $(sql_DATA)
diff --git a/src/datastore/datastore-0001.sql b/src/datastore/datastore-0001.sql
new file mode 100644
index 000000000..0d4758be2
--- /dev/null
+++ b/src/datastore/datastore-0001.sql
@@ -0,0 +1,49 @@
+--
+-- This file is part of GNUnet
+-- Copyright (C) 2014--2022 GNUnet e.V.
+--
+-- GNUnet is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- GNUnet; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+-- Everything in one big transaction
+BEGIN;
+
+-- Check patch versioning is in place.
+SELECT _v.register_patch('datastore-0001', NULL, NULL);
+
+-------------------- Schema ----------------------------
+
+CREATE SCHEMA datastore;
+COMMENT ON SCHEMA datastore IS 'gnunet-datastore data';
+
+SET search_path TO datastore;
+
+CREATE TABLE IF NOT EXISTS gn090 (
+ repl INTEGER NOT NULL DEFAULT 0,
+ type INTEGER NOT NULL DEFAULT 0,
+ prio INTEGER NOT NULL DEFAULT 0,
+ anonLevel INTEGER NOT NULL DEFAULT 0,
+ expire BIGINT NOT NULL DEFAULT 0,
+ rvalue BIGINT NOT NULL DEFAULT 0,
+ hash BYTEA NOT NULL DEFAULT '',
+ vhash BYTEA NOT NULL DEFAULT '',
+ value BYTEA NOT NULL DEFAULT '',
+ oid BIGINT GENERATED BY DEFAULT AS IDENTITY);
+
+CREATE INDEX IF NOT EXISTS oid_hash ON gn090 (oid);
+CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash);
+CREATE INDEX IF NOT EXISTS idx_prio_anon ON gn090 (prio,anonLevel);
+CREATE INDEX IF NOT EXISTS idx_prio_hash_anon ON gn090 (prio,hash,anonLevel);
+CREATE INDEX IF NOT EXISTS idx_repl_rvalue ON gn090 (repl,rvalue);
+CREATE INDEX IF NOT EXISTS idx_expire_hash ON gn090 (expire,hash);
+
+COMMIT;
diff --git a/src/datastore/datastore-drop.sql b/src/datastore/datastore-drop.sql
new file mode 100644
index 000000000..67fee303d
--- /dev/null
+++ b/src/datastore/datastore-drop.sql
@@ -0,0 +1,25 @@
+--
+-- This file is part of GNUnet
+-- Copyright (C) 2014--2022 GNUnet e.V.
+--
+-- GNUnet is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- GNUnet; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+-- Everything in one big transaction
+BEGIN;
+
+
+SELECT _v.unregister_patch('datastore-0001');
+
+DROP SCHEMA datastore CASCADE;
+
+COMMIT;
diff --git a/src/datastore/datastore.conf.in b/src/datastore/datastore.conf.in
index 21d24bb52..bcd495c8f 100644
--- a/src/datastore/datastore.conf.in
+++ b/src/datastore/datastore.conf.in
@@ -18,6 +18,7 @@ FILENAME = $GNUNET_DATA_HOME/datastore/sqlite.db
[datastore-postgres]
CONFIG = postgres:///gnunet
+SQL_DIR = ${DATADIR}/sql/
[datastore-mysql]
DATABASE = gnunet
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index a49bc8586..4d27efb4e 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -278,7 +278,7 @@ free_queue_entry (struct GNUNET_DATASTORE_QueueEntry *qe)
/**
* Task that logs an error after some time.
*
- * @param qe `struct GNUNET_DATASTORE_QueueEntry` about which the error is
+ * @param cls `struct GNUNET_DATASTORE_QueueEntry` about which the error is
*/
static void
delay_warning (void *cls)
@@ -941,31 +941,6 @@ drop_status_cont (void *cls,
}
-/**
- * Store an item in the datastore. If the item is already present,
- * the priorities are summed up and the higher expiration time and
- * lower anonymity level is used.
- *
- * @param h handle to the datastore
- * @param rid reservation ID to use (from "reserve"); use 0 if no
- * prior reservation was made
- * @param key key for the value
- * @param size number of bytes in data
- * @param data content stored
- * @param type type of the content
- * @param priority priority of the content
- * @param anonymity anonymity-level for the content
- * @param replication how often should the content be replicated to other peers?
- * @param expiration expiration time for the content
- * @param queue_priority ranking of this request in the priority queue
- * @param max_queue_size at what queue size should this request be dropped
- * (if other requests of higher priority are in the queue)
- * @param cont continuation to call when done
- * @param cont_cls closure for @a cont
- * @return NULL if the entry was not queued, otherwise a handle that can be used to
- * cancel; note that even if NULL is returned, the callback will be invoked
- * (or rather, will already have been invoked)
- */
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
uint32_t rid,
@@ -1098,26 +1073,6 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
}
-/**
- * Signal that all of the data for which a reservation was made has
- * been stored and that whatever excess space might have been reserved
- * can now be released.
- *
- * @param h handle to the datastore
- * @param rid reservation ID (value of "success" in original continuation
- * from the "reserve" function).
- * @param queue_priority ranking of this request in the priority queue
- * @param max_queue_size at what queue size should this request be dropped
- * (if other requests of higher priority are in the queue)
- * @param queue_priority ranking of this request in the priority queue
- * @param max_queue_size at what queue size should this request be dropped
- * (if other requests of higher priority are in the queue)
- * @param cont continuation to call when done
- * @param cont_cls closure for @a cont
- * @return NULL if the entry was not queued, otherwise a handle that can be used to
- * cancel; note that even if NULL is returned, the callback will be invoked
- * (or rather, will already have been invoked)
- */
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h,
uint32_t rid,
@@ -1162,26 +1117,6 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h,
}
-/**
- * Explicitly remove some content from the database.
- * The @a cont continuation will be called with `status`
- * #GNUNET_OK" if content was removed, #GNUNET_NO
- * if no matching entry was found and #GNUNET_SYSERR
- * on all other types of errors.
- *
- * @param h handle to the datastore
- * @param key key for the value
- * @param size number of bytes in data
- * @param data content stored
- * @param queue_priority ranking of this request in the priority queue
- * @param max_queue_size at what queue size should this request be dropped
- * (if other requests of higher priority are in the queue)
- * @param cont continuation to call when done
- * @param cont_cls closure for @a cont
- * @return NULL if the entry was not queued, otherwise a handle that can be used to
- * cancel; note that even if NULL is returned, the callback will be invoked
- * (or rather, will already have been invoked)
- */
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
const struct GNUNET_HashCode *key,
@@ -1299,22 +1234,6 @@ GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h,
}
-/**
- * Get a single zero-anonymity value from the datastore.
- *
- * @param h handle to the datastore
- * @param next_uid return the result with lowest uid >= next_uid
- * @param queue_priority ranking of this request in the priority queue
- * @param max_queue_size at what queue size should this request be dropped
- * (if other requests of higher priority are in the queue)
- * @param type allowed type for the operation (never zero)
- * @param proc function to call on a random value; it
- * will be called once with a value (if available)
- * or with NULL if none value exists.
- * @param proc_cls closure for @a proc
- * @return NULL if the entry was not queued, otherwise a handle that can be used to
- * cancel
- */
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h,
uint64_t next_uid,
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c
index 5901cce54..9a76d1160 100644
--- a/src/datastore/gnunet-datastore.c
+++ b/src/datastore/gnunet-datastore.c
@@ -23,8 +23,8 @@
* @brief tool to manipulate datastores
* @author Christian Grothoff
*/
-#include <inttypes.h>
#include "platform.h"
+#include <inttypes.h>
#include "gnunet_util_lib.h"
#include "gnunet_datastore_service.h"
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 498a7b3e6..f45e71ee9 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -560,7 +560,7 @@ transmit_item (void *cls,
* Handle RESERVE-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param msg the actual message
*/
static void
handle_reserve (void *cls, const struct ReserveMessage *msg)
@@ -644,7 +644,7 @@ handle_reserve (void *cls, const struct ReserveMessage *msg)
* Handle RELEASE_RESERVE-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param msg the actual message
*/
static void
handle_release_reserve (void *cls, const struct ReleaseReserveMessage *msg)
@@ -768,7 +768,7 @@ put_continuation (void *cls,
* Verify PUT-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param dm the actual message
* @return #GNUNET_OK if @a dm is well-formed
*/
static int
@@ -787,7 +787,7 @@ check_put (void *cls, const struct DataMessage *dm)
* Handle PUT-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param dm the actual message
*/
static void
handle_put (void *cls, const struct DataMessage *dm)
@@ -949,7 +949,7 @@ handle_get_replication (void *cls, const struct GNUNET_MessageHeader *message)
* Handle GET_ZERO_ANONYMITY-message.
*
* @param cls client identification of the client
- * @param message the actual message
+ * @param msg the actual message
*/
static void
handle_get_zero_anonymity (void *cls, const struct GetZeroAnonymityMessage *msg)
@@ -1028,7 +1028,7 @@ remove_continuation (void *cls,
* Verify REMOVE-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param dm the actual message
* @return #GNUNET_OK if @a dm is well-formed
*/
static int
@@ -1047,8 +1047,7 @@ check_remove (void *cls, const struct DataMessage *dm)
* Handle REMOVE-message.
*
* @param cls closure
- * @param client identification of the client
- * @param message the actual message
+ * @param dm the actual message
*/
static void
handle_remove (void *cls, const struct DataMessage *dm)
diff --git a/src/datastore/meson.build b/src/datastore/meson.build
new file mode 100644
index 000000000..0b20a446c
--- /dev/null
+++ b/src/datastore/meson.build
@@ -0,0 +1,74 @@
+libgnunetdatastore_src = ['datastore_api.c']
+
+gnunetservicedatastore_src = ['gnunet-service-datastore.c']
+
+configure_file(input : 'datastore.conf.in',
+ output : 'datastore.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+install_data ('datastore-0001.sql',
+ 'datastore-drop.sql',
+ install_dir: get_option('datadir')/'gnunet'/'sql')
+
+if get_option('monolith')
+ foreach p : libgnunetdatastore_src + gnunetservicedatastore_src
+ gnunet_src += 'datastore/' + p
+ endforeach
+endif
+libgnunetdatastore = library('gnunetdatastore',
+ libgnunetdatastore_src,
+ soversion: '1',
+ version: '1.0.0',
+ dependencies: [libgnunetutil_dep,
+ libgnunetstatistics_dep,
+ libgnunetdatacache_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetdatastore_dep = declare_dependency(link_with : libgnunetdatastore)
+pkg.generate(libgnunetdatastore, url: 'https://www.gnunet.org',
+ description : 'Management API for the datastore for persistent storage to disk')
+
+shared_module('gnunet_plugin_datastore_sqlite',
+ ['plugin_datastore_sqlite.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetdatastore_dep,
+ sqlite_dep,
+ libgnunetsq_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+if pq_dep.found()
+ shared_module('gnunet_plugin_datastore_postgres',
+ ['plugin_datastore_postgres.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunetdatastore_dep,
+ pq_dep,
+ libgnunetpq_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+endif
+
+executable ('gnunet-datastore',
+ ['gnunet-datastore.c'],
+ dependencies: [libgnunetdatastore_dep,
+ libgnunetutil_dep,
+ libgnunetstatistics_dep,
+ libgnunetdatacache_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-service-datastore',
+ gnunetservicedatastore_src,
+ dependencies: [libgnunetdatastore_dep,
+ libgnunetutil_dep,
+ libgnunetstatistics_dep,
+ libgnunetdatacache_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet'/'libexec')
+
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index fef38891e..f7d9fa544 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -610,7 +610,7 @@ main (int argc,
{
char cfg_name[PATH_MAX];
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (cfg_name,
sizeof(cfg_name),
"test_datastore_api_data_%s.conf",
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index d7488d4e7..8e63b08e6 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -550,7 +550,7 @@ main (int argc, char *argv[])
GNUNET_GETOPT_OPTION_END
};
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (dir_name, sizeof(dir_name), "/tmp/perf-gnunet-datastore-%s",
plugin_name);
GNUNET_DISK_directory_remove (dir_name);
diff --git a/src/datastore/perf_plugin_datastore_data_mysql.conf b/src/datastore/perf_plugin_datastore_data_mysql.conf
deleted file mode 100644
index a32b830c3..000000000
--- a/src/datastore/perf_plugin_datastore_data_mysql.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-@INLINE@ test_defaults.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/perf-gnunet-datastore-mysql/
-
-[datastore]
-DATABASE = mysql
-
-[datastore-mysql]
-DATABASE = gnunetcheck
-
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
deleted file mode 100644
index 216a6faa4..000000000
--- a/src/datastore/plugin_datastore_mysql.c
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*
- This file is part of GNUnet
- Copyright (C) 2009, 2010, 2011 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file datastore/plugin_datastore_mysql.c
- * @brief mysql-based datastore backend
- * @author Igor Wronsky
- * @author Christian Grothoff
- * @author Christophe Genevey
- *
- * NOTE: This db module does NOT work with mysql prior to 4.1 since
- * it uses prepared statements. MySQL 5.0.46 promises to fix a bug
- * in MyISAM that is causing us grief. At the time of this writing,
- * that version is yet to be released. In anticipation, the code
- * will use MyISAM with 5.0.46 (and higher). If you run such a
- * version, please run "make check" to verify that the MySQL bug
- * was actually fixed in your version (and if not, change the
- * code below to use MyISAM for gn071).
- *
- * HIGHLIGHTS
- *
- * Pros
- * + On up-to-date hardware where mysql can be used comfortably, this
- * module will have better performance than the other db choices
- * (according to our tests).
- * + Its often possible to recover the mysql database from internal
- * inconsistencies. The other db choices do not support repair!
- * Cons
- * - Memory usage (Comment: "I have 1G and it never caused me trouble")
- * - Manual setup
- *
- * MANUAL SETUP INSTRUCTIONS
- *
- * 1) in gnunet.conf, set
- * @verbatim
- [datastore]
- DATABASE = "mysql"
- @endverbatim
- * 2) Then access mysql as root,
- * @verbatim
- $ mysql -u root -p
- @endverbatim
- * and do the following. [You should replace $USER with the username
- * that will be running the gnunetd process].
- * @verbatim
- CREATE DATABASE gnunet;
- GRANT select,insert,update,delete,create,alter,drop,create temporary tables
- ON gnunet.* TO $USER@localhost;
- SET PASSWORD FOR $USER@localhost=PASSWORD('$the_password_you_like');
- FLUSH PRIVILEGES;
- @endverbatim
- * 3) In the $HOME directory of $USER, create a ".my.cnf" file
- * with the following lines
- * @verbatim
- [client]
- user=$USER
- password=$the_password_you_like
- @endverbatim
- *
- * That's it. Note that .my.cnf file is a security risk unless its on
- * a safe partition etc. The $HOME/.my.cnf can of course be a symbolic
- * link. Even greater security risk can be achieved by setting no
- * password for $USER. Luckily $USER has only privileges to mess
- * up GNUnet's tables, nothing else (unless you give them more,
- * of course).<p>
- *
- * 4) Still, perhaps you should briefly try if the DB connection
- * works. First, login as $USER. Then use,
- *
- * @verbatim
- $ mysql -u $USER -p $the_password_you_like
- mysql> use gnunet;
- @endverbatim
- *
- * If you get the message &quot;Database changed&quot; it probably works.
- *
- * [If you get &quot;ERROR 2002: Can't connect to local MySQL server
- * through socket '/tmp/mysql.sock' (2)&quot; it may be resolvable by
- * &quot;ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock&quot;
- * so there may be some additional trouble depending on your mysql setup.]
- *
- * REPAIRING TABLES
- *
- * - Its probably healthy to check your tables for inconsistencies
- * every now and then.
- * - If you get odd SEGVs on gnunetd startup, it might be that the mysql
- * databases have been corrupted.
- * - The tables can be verified/fixed in two ways;
- * 1) by running mysqlcheck -A, or
- * 2) by executing (inside of mysql using the GNUnet database):
- * @verbatim
- mysql> REPAIR TABLE gn090;
- @endverbatim
- *
- * PROBLEMS?
- *
- * If you have problems related to the mysql module, your best
- * friend is probably the mysql manual. The first thing to check
- * is that mysql is basically operational, that you can connect
- * to it, create tables, issue queries etc.
- */
-
-#include "platform.h"
-#include "gnunet_datastore_plugin.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_mysql_lib.h"
-#include "gnunet_my_lib.h"
-
-#define MAX_DATUM_SIZE 65536
-
-
-/**
- * Context for all functions in this plugin.
- */
-struct Plugin
-{
- /**
- * Our execution environment.
- */
- struct GNUNET_DATASTORE_PluginEnvironment *env;
-
- /**
- * Handle to talk to MySQL.
- */
- struct GNUNET_MYSQL_Context *mc;
-
- /**
- * Prepared statements.
- */
-#define INSERT_ENTRY \
- "INSERT INTO gn090 (repl,type,prio,anonLevel,expire,rvalue,hash,vhash,value) VALUES (?,?,?,?,?,?,?,?,?)"
- struct GNUNET_MYSQL_StatementHandle *insert_entry;
-
-#define DELETE_ENTRY_BY_UID "DELETE FROM gn090 WHERE uid=?"
- struct GNUNET_MYSQL_StatementHandle *delete_entry_by_uid;
-
-#define DELETE_ENTRY_BY_HASH_VALUE "DELETE FROM gn090 " \
- "WHERE hash = ? AND " \
- "value = ? " \
- "LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *delete_entry_by_hash_value;
-
-#define RESULT_COLUMNS "repl, type, prio, anonLevel, expire, hash, value, uid"
-
-#define SELECT_ENTRY "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "WHERE uid >= ? AND " \
- "(rvalue >= ? OR 0 = ?) " \
- "ORDER BY uid LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *select_entry;
-
-#define SELECT_ENTRY_BY_HASH "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "FORCE INDEX (idx_hash_type_uid) " \
- "WHERE hash=? AND " \
- "uid >= ? AND " \
- "(rvalue >= ? OR 0 = ?) " \
- "ORDER BY uid LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *select_entry_by_hash;
-
-#define SELECT_ENTRY_BY_HASH_AND_TYPE "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "FORCE INDEX (idx_hash_type_uid) " \
- "WHERE hash = ? AND " \
- "type = ? AND " \
- "uid >= ? AND " \
- "(rvalue >= ? OR 0 = ?) " \
- "ORDER BY uid LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *select_entry_by_hash_and_type;
-
-#define UPDATE_ENTRY "UPDATE gn090 SET " \
- "prio = prio + ?, " \
- "repl = repl + ?, " \
- "expire = GREATEST(expire, ?) " \
- "WHERE hash = ? AND vhash = ?"
- struct GNUNET_MYSQL_StatementHandle *update_entry;
-
-#define DEC_REPL "UPDATE gn090 SET repl=GREATEST (1, repl) - 1 WHERE uid=?"
- struct GNUNET_MYSQL_StatementHandle *dec_repl;
-
-#define SELECT_SIZE "SELECT SUM(LENGTH(value)+256) FROM gn090"
- struct GNUNET_MYSQL_StatementHandle *get_size;
-
-#define SELECT_IT_NON_ANONYMOUS "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "FORCE INDEX (idx_anonLevel_type_rvalue) " \
- "WHERE anonLevel=0 AND " \
- "type=? AND " \
- "uid >= ? " \
- "ORDER BY uid LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *zero_iter;
-
-#define SELECT_IT_EXPIRATION "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "FORCE INDEX (idx_expire) " \
- "WHERE expire < ? " \
- "ORDER BY expire ASC LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *select_expiration;
-
-#define SELECT_IT_PRIORITY "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "FORCE INDEX (idx_prio) " \
- "ORDER BY prio ASC LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *select_priority;
-
-#define SELECT_IT_REPLICATION "SELECT " RESULT_COLUMNS " FROM gn090 " \
- "FORCE INDEX (idx_repl_rvalue) " \
- "WHERE repl=? AND " \
- " (rvalue>=? OR" \
- " NOT EXISTS (SELECT 1 FROM gn090 FORCE INDEX (idx_repl_rvalue) WHERE repl=? AND rvalue>=?)) " \
- "ORDER BY rvalue ASC " \
- "LIMIT 1"
- struct GNUNET_MYSQL_StatementHandle *select_replication;
-
-#define SELECT_MAX_REPL "SELECT MAX(repl) FROM gn090"
- struct GNUNET_MYSQL_StatementHandle *max_repl;
-
-#define GET_ALL_KEYS "SELECT hash from gn090"
- struct GNUNET_MYSQL_StatementHandle *get_all_keys;
-};
-
-#define MAX_PARAM 16
-
-/**
- * Delete an entry from the gn090 table.
- *
- * @param plugin plugin context
- * @param uid unique ID of the entry to delete
- * @return #GNUNET_OK on success, #GNUNET_NO if no such value exists, #GNUNET_SYSERR on error
- */
-static int
-do_delete_entry (struct Plugin *plugin,
- unsigned long long uid)
-{
- int ret;
- uint64_t uid64 = (uint64_t) uid;
- struct GNUNET_MY_QueryParam params_delete[] = {
- GNUNET_MY_query_param_uint64 (&uid64),
- GNUNET_MY_query_param_end
- };
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Deleting value %llu from gn090 table\n",
- uid);
- ret = GNUNET_MY_exec_prepared (plugin->mc,
- plugin->delete_entry_by_uid,
- params_delete);
- if (ret >= 0)
- {
- return GNUNET_OK;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Deleting value %llu from gn090 table failed\n",
- (unsigned long long) uid);
- return ret;
-}
-
-
-/**
- * Get an estimate of how much space the database is
- * currently using.
- *
- * @param cls our `struct Plugin *`
- * @return number of bytes used on disk
- */
-static void
-mysql_plugin_estimate_size (void *cls,
- unsigned long long *estimate)
-{
- struct Plugin *plugin = cls;
- uint64_t total;
- int ret;
- struct GNUNET_MY_QueryParam params_get[] = {
- GNUNET_MY_query_param_end
- };
- struct GNUNET_MY_ResultSpec results_get[] = {
- GNUNET_MY_result_spec_uint64 (&total),
- GNUNET_MY_result_spec_end
- };
-
- ret = GNUNET_MY_exec_prepared (plugin->mc,
- plugin->get_size,
- params_get);
- *estimate = 0;
- total = UINT64_MAX;
- if ((GNUNET_OK == ret) &&
- (GNUNET_OK ==
- GNUNET_MY_extract_result (plugin->get_size,
- results_get)))
- {
- *estimate = (unsigned long long) total;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Size estimate for MySQL payload is %lld\n",
- (long long) total);
- GNUNET_assert (UINT64_MAX != total);
- GNUNET_break (GNUNET_NO ==
- GNUNET_MY_extract_result (plugin->get_size,
- NULL));
- }
-}
-
-
-/**
- * Store an item in the datastore.
- *
- * @param cls closure
- * @param key key for the item
- * @param absent true if the key was not found in the bloom filter
- * @param size number of bytes in @a data
- * @param data content stored
- * @param type type of the content
- * @param priority priority of the content
- * @param anonymity anonymity-level for the content
- * @param replication replication-level for the content
- * @param expiration expiration time for the content
- * @param cont continuation called with success or failure status
- * @param cont_cls closure for @a cont
- */
-static void
-mysql_plugin_put (void *cls,
- const struct GNUNET_HashCode *key,
- bool absent,
- uint32_t size,
- const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- uint32_t replication,
- struct GNUNET_TIME_Absolute expiration,
- PluginPutCont cont,
- void *cont_cls)
-{
- struct Plugin *plugin = cls;
- uint64_t lexpiration = expiration.abs_value_us;
- struct GNUNET_HashCode vhash;
-
- GNUNET_CRYPTO_hash (data,
- size,
- &vhash);
- if (! absent)
- {
- struct GNUNET_MY_QueryParam params_update[] = {
- GNUNET_MY_query_param_uint32 (&priority),
- GNUNET_MY_query_param_uint32 (&replication),
- GNUNET_MY_query_param_uint64 (&lexpiration),
- GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_auto_from_type (&vhash),
- GNUNET_MY_query_param_end
- };
-
- if (GNUNET_OK !=
- GNUNET_MY_exec_prepared (plugin->mc,
- plugin->update_entry,
- params_update))
- {
- cont (cont_cls,
- key,
- size,
- GNUNET_SYSERR,
- _ ("MySQL statement run failure"));
- return;
- }
-
- MYSQL_STMT *stmt = GNUNET_MYSQL_statement_get_stmt (plugin->update_entry);
- my_ulonglong rows = mysql_stmt_affected_rows (stmt);
-
- GNUNET_break (GNUNET_NO ==
- GNUNET_MY_extract_result (plugin->update_entry,
- NULL));
- if (0 != rows)
- {
- cont (cont_cls,
- key,
- size,
- GNUNET_NO,
- NULL);
- return;
- }
- }
-
- uint64_t lrvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT64_MAX);
- struct GNUNET_MY_QueryParam params_insert[] = {
- GNUNET_MY_query_param_uint32 (&replication),
- GNUNET_MY_query_param_uint32 (&type),
- GNUNET_MY_query_param_uint32 (&priority),
- GNUNET_MY_query_param_uint32 (&anonymity),
- GNUNET_MY_query_param_uint64 (&lexpiration),
- GNUNET_MY_query_param_uint64 (&lrvalue),
- GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_auto_from_type (&vhash),
- GNUNET_MY_query_param_fixed_size (data, size),
- GNUNET_MY_query_param_end
- };
-
- if (size > MAX_DATUM_SIZE)
- {
- GNUNET_break (0);
- cont (cont_cls, key, size, GNUNET_SYSERR, _ ("Data too large"));
- return;
- }
-
- if (GNUNET_OK !=
- GNUNET_MY_exec_prepared (plugin->mc,
- plugin->insert_entry,
- params_insert))
- {
- cont (cont_cls,
- key,
- size,
- GNUNET_SYSERR,
- _ ("MySQL statement run failure"));
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Inserted value `%s' with size %u into gn090 table\n",
- GNUNET_h2s (key),
- (unsigned int) size);
- if (size > 0)
- plugin->env->duc (plugin->env->cls,
- size);
- GNUNET_break (GNUNET_NO ==
- GNUNET_MY_extract_result (plugin->insert_entry,
- NULL));
- cont (cont_cls,
- key,
- size,
- GNUNET_OK,
- NULL);
-}
-
-
-/**
- * Run the given select statement and call 'proc' on the resulting
- * values (which must be in particular positions).
- *
- * @param plugin the plugin handle
- * @param stmt select statement to run
- * @param proc function to call on result
- * @param proc_cls closure for @a proc
- * @param params_select arguments to initialize stmt
- */
-static void
-execute_select (struct Plugin *plugin,
- struct GNUNET_MYSQL_StatementHandle *stmt,
- PluginDatumProcessor proc,
- void *proc_cls,
- struct GNUNET_MY_QueryParam *params_select)
-{
- int ret;
- uint32_t replication;
- uint32_t type;
- uint32_t priority;
- uint32_t anonymity;
- uint64_t uid;
- size_t value_size;
- void *value;
- struct GNUNET_HashCode key;
- struct GNUNET_TIME_Absolute expiration;
- struct GNUNET_MY_ResultSpec results_select[] = {
- GNUNET_MY_result_spec_uint32 (&replication),
- GNUNET_MY_result_spec_uint32 (&type),
- GNUNET_MY_result_spec_uint32 (&priority),
- GNUNET_MY_result_spec_uint32 (&anonymity),
- GNUNET_MY_result_spec_absolute_time (&expiration),
- GNUNET_MY_result_spec_auto_from_type (&key),
- GNUNET_MY_result_spec_variable_size (&value, &value_size),
- GNUNET_MY_result_spec_uint64 (&uid),
- GNUNET_MY_result_spec_end
- };
-
- ret = GNUNET_MY_exec_prepared (plugin->mc,
- stmt,
- params_select);
- if (GNUNET_OK != ret)
- {
- proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
- return;
- }
-
- ret = GNUNET_MY_extract_result (stmt,
- results_select);
- if (GNUNET_OK != ret)
- {
- proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
- return;
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n",
- (unsigned int) value_size,
- GNUNET_h2s (&key),
- (unsigned int) priority,
- (unsigned int) anonymity,
- GNUNET_STRINGS_absolute_time_to_string (expiration));
- GNUNET_assert (value_size < MAX_DATUM_SIZE);
- GNUNET_break (GNUNET_NO ==
- GNUNET_MY_extract_result (stmt,
- NULL));
- ret = proc (proc_cls,
- &key,
- value_size,
- value,
- type,
- priority,
- anonymity,
- replication,
- expiration,
- uid);
- GNUNET_MY_cleanup_result (results_select);
- if (GNUNET_NO == ret)
- {
- do_delete_entry (plugin, uid);
- if (0 != value_size)
- plugin->env->duc (plugin->env->cls,
- -value_size);
- }
-}
-
-
-/**
- * Get one of the results for a particular key in the datastore.
- *
- * @param cls closure
- * @param next_uid return the result with lowest uid >= next_uid
- * @param random if true, return a random result instead of using next_uid
- * @param key key to match, never NULL
- * @param type entries of which type are relevant?
- * Use 0 for any type.
- * @param proc function to call on the matching value,
- * with NULL for if no value matches
- * @param proc_cls closure for @a proc
- */
-static void
-mysql_plugin_get_key (void *cls,
- uint64_t next_uid,
- bool random,
- const struct GNUNET_HashCode *key,
- enum GNUNET_BLOCK_Type type,
- PluginDatumProcessor proc,
- void *proc_cls)
-{
- struct Plugin *plugin = cls;
- uint64_t rvalue;
-
- if (random)
- {
- rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT64_MAX);
- next_uid = 0;
- }
- else
- rvalue = 0;
-
- if (NULL == key)
- {
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_uint64 (&next_uid),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_end
- };
-
- execute_select (plugin,
- plugin->select_entry,
- proc,
- proc_cls,
- params_select);
- }
- else if (type != GNUNET_BLOCK_TYPE_ANY)
- {
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_uint32 (&type),
- GNUNET_MY_query_param_uint64 (&next_uid),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_end
- };
-
- execute_select (plugin,
- plugin->select_entry_by_hash_and_type,
- proc,
- proc_cls,
- params_select);
- }
- else
- {
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_uint64 (&next_uid),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_end
- };
-
- execute_select (plugin,
- plugin->select_entry_by_hash,
- proc,
- proc_cls,
- params_select);
- }
-}
-
-
-/**
- * Get a zero-anonymity datum from the datastore.
- *
- * @param cls our `struct Plugin *`
- * @param next_uid return the result with lowest uid >= next_uid
- * @param type entries of which type should be considered?
- * Must not be zero (ANY).
- * @param proc function to call on a matching value;
- * will be called with NULL if no value matches
- * @param proc_cls closure for @a proc
- */
-static void
-mysql_plugin_get_zero_anonymity (void *cls,
- uint64_t next_uid,
- enum GNUNET_BLOCK_Type type,
- PluginDatumProcessor proc,
- void *proc_cls)
-{
- struct Plugin *plugin = cls;
- uint32_t typei = (uint32_t) type;
-
- struct GNUNET_MY_QueryParam params_zero_iter[] = {
- GNUNET_MY_query_param_uint32 (&typei),
- GNUNET_MY_query_param_uint64 (&next_uid),
- GNUNET_MY_query_param_end
- };
-
- execute_select (plugin,
- plugin->zero_iter,
- proc,
- proc_cls,
- params_zero_iter);
-}
-
-
-/**
- * Context for #repl_proc() function.
- */
-struct ReplCtx
-{
- /**
- * Plugin handle.
- */
- struct Plugin *plugin;
-
- /**
- * Function to call for the result (or the NULL).
- */
- PluginDatumProcessor proc;
-
- /**
- * Closure for @e proc.
- */
- void *proc_cls;
-};
-
-
-/**
- * Wrapper for the processor for #mysql_plugin_get_replication().
- * Decrements the replication counter and calls the original
- * iterator.
- *
- * @param cls closure
- * @param key key for the content
- * @param size number of bytes in @a data
- * @param data content stored
- * @param type type of the content
- * @param priority priority of the content
- * @param anonymity anonymity-level for the content
- * @param replication replication-level for the content
- * @param expiration expiration time for the content
- * @param uid unique identifier for the datum;
- * maybe 0 if no unique identifier is available
- * @return #GNUNET_SYSERR to abort the iteration, #GNUNET_OK to continue
- * (continue on call to "next", of course),
- * #GNUNET_NO to delete the item and continue (if supported)
- */
-static int
-repl_proc (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
- const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- uint32_t replication,
- struct GNUNET_TIME_Absolute expiration,
- uint64_t uid)
-{
- struct ReplCtx *rc = cls;
- struct Plugin *plugin = rc->plugin;
- int ret;
- int iret;
-
- ret = rc->proc (rc->proc_cls,
- key,
- size,
- data,
- type,
- priority,
- anonymity,
- replication,
- expiration,
- uid);
- if (NULL != key)
- {
- struct GNUNET_MY_QueryParam params_proc[] = {
- GNUNET_MY_query_param_uint64 (&uid),
- GNUNET_MY_query_param_end
- };
-
- iret = GNUNET_MY_exec_prepared (plugin->mc,
- plugin->dec_repl,
- params_proc);
- if (GNUNET_SYSERR == iret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to reduce replication counter\n");
- return GNUNET_SYSERR;
- }
- }
- return ret;
-}
-
-
-/**
- * Get a random item for replication. Returns a single, not expired,
- * random item from those with the highest replication counters. The
- * item's replication counter is decremented by one IF it was positive
- * before. Call @a proc with all values ZERO or NULL if the datastore
- * is empty.
- *
- * @param cls closure
- * @param proc function to call the value (once only).
- * @param proc_cls closure for @a proc
- */
-static void
-mysql_plugin_get_replication (void *cls,
- PluginDatumProcessor proc,
- void *proc_cls)
-{
- struct Plugin *plugin = cls;
- uint64_t rvalue;
- uint32_t repl;
- struct ReplCtx rc;
- struct GNUNET_MY_QueryParam params_get[] = {
- GNUNET_MY_query_param_end
- };
- struct GNUNET_MY_ResultSpec results_get[] = {
- GNUNET_MY_result_spec_uint32 (&repl),
- GNUNET_MY_result_spec_end
- };
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_uint32 (&repl),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_uint32 (&repl),
- GNUNET_MY_query_param_uint64 (&rvalue),
- GNUNET_MY_query_param_end
- };
-
- rc.plugin = plugin;
- rc.proc = proc;
- rc.proc_cls = proc_cls;
-
- if (1 !=
- GNUNET_MY_exec_prepared (plugin->mc,
- plugin->max_repl,
- params_get))
- {
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
- return;
- }
-
- if (GNUNET_OK !=
- GNUNET_MY_extract_result (plugin->max_repl,
- results_get))
- {
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
- return;
- }
- GNUNET_break (GNUNET_NO ==
- GNUNET_MY_extract_result (plugin->max_repl,
- NULL));
- rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT64_MAX);
-
- execute_select (plugin,
- plugin->select_replication,
- &repl_proc,
- &rc,
- params_select);
-}
-
-
-/**
- * Get all of the keys in the datastore.
- *
- * @param cls closure
- * @param proc function to call on each key
- * @param proc_cls closure for @a proc
- */
-static void
-mysql_plugin_get_keys (void *cls,
- PluginKeyProcessor proc,
- void *proc_cls)
-{
- struct Plugin *plugin = cls;
- int ret;
- MYSQL_STMT *statement;
- unsigned int cnt;
- struct GNUNET_HashCode key;
- struct GNUNET_HashCode last;
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_end
- };
- struct GNUNET_MY_ResultSpec results_select[] = {
- GNUNET_MY_result_spec_auto_from_type (&key),
- GNUNET_MY_result_spec_end
- };
-
- GNUNET_assert (NULL != proc);
- statement = GNUNET_MYSQL_statement_get_stmt (plugin->get_all_keys);
- if (GNUNET_OK !=
- GNUNET_MY_exec_prepared (plugin->mc,
- plugin->get_all_keys,
- params_select))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("`%s' for `%s' failed at %s:%d with error: %s\n"),
- "mysql_stmt_execute",
- GET_ALL_KEYS,
- __FILE__,
- __LINE__,
- mysql_stmt_error (statement));
- GNUNET_MYSQL_statements_invalidate (plugin->mc);
- proc (proc_cls, NULL, 0);
- return;
- }
- memset (&last, 0, sizeof(last)); /* make static analysis happy */
- ret = GNUNET_YES;
- cnt = 0;
- while (ret == GNUNET_YES)
- {
- ret = GNUNET_MY_extract_result (plugin->get_all_keys,
- results_select);
- if (0 != GNUNET_memcmp (&last,
- &key))
- {
- if (0 != cnt)
- proc (proc_cls,
- &last,
- cnt);
- cnt = 1;
- last = key;
- }
- else
- {
- cnt++;
- }
- }
- if (0 != cnt)
- proc (proc_cls,
- &last,
- cnt);
- /* finally, let app know we are done */
- proc (proc_cls,
- NULL,
- 0);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("`%s' failed at %s:%d with error: %s\n"),
- "mysql_stmt_fetch",
- __FILE__,
- __LINE__,
- mysql_stmt_error (statement));
- GNUNET_MYSQL_statements_invalidate (plugin->mc);
- return;
- }
-}
-
-
-/**
- * Context for #expi_proc() function.
- */
-struct ExpiCtx
-{
- /**
- * Plugin handle.
- */
- struct Plugin *plugin;
-
- /**
- * Function to call for the result (or the NULL).
- */
- PluginDatumProcessor proc;
-
- /**
- * Closure for @e proc.
- */
- void *proc_cls;
-};
-
-
-/**
- * Wrapper for the processor for #mysql_plugin_get_expiration().
- * If no expired value was found, we do a second query for
- * low-priority content.
- *
- * @param cls closure
- * @param key key for the content
- * @param size number of bytes in data
- * @param data content stored
- * @param type type of the content
- * @param priority priority of the content
- * @param anonymity anonymity-level for the content
- * @param replication replication-level for the content
- * @param expiration expiration time for the content
- * @param uid unique identifier for the datum;
- * maybe 0 if no unique identifier is available
- * @return #GNUNET_SYSERR to abort the iteration, #GNUNET_OK to continue
- * (continue on call to "next", of course),
- * #GNUNET_NO to delete the item and continue (if supported)
- */
-static int
-expi_proc (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
- const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- uint32_t replication,
- struct GNUNET_TIME_Absolute expiration,
- uint64_t uid)
-{
- struct ExpiCtx *rc = cls;
- struct Plugin *plugin = rc->plugin;
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_end
- };
-
- if (NULL == key)
- {
- execute_select (plugin,
- plugin->select_priority,
- rc->proc,
- rc->proc_cls,
- params_select);
- return GNUNET_SYSERR;
- }
- return rc->proc (rc->proc_cls,
- key,
- size,
- data,
- type,
- priority,
- anonymity,
- replication,
- expiration,
- uid);
-}
-
-
-/**
- * Get a random item for expiration.
- * Call @a proc with all values ZERO or NULL if the datastore is empty.
- *
- * @param cls closure
- * @param proc function to call the value (once only).
- * @param proc_cls closure for @a proc
- */
-static void
-mysql_plugin_get_expiration (void *cls,
- PluginDatumProcessor proc,
- void *proc_cls)
-{
- struct Plugin *plugin = cls;
- struct GNUNET_TIME_Absolute now = { 0 };
- struct GNUNET_MY_QueryParam params_select[] = {
- GNUNET_MY_query_param_absolute_time (&now),
- GNUNET_MY_query_param_end
- };
- struct ExpiCtx rc;
-
- rc.plugin = plugin;
- rc.proc = proc;
- rc.proc_cls = proc_cls;
- now = GNUNET_TIME_absolute_get ();
- execute_select (plugin,
- plugin->select_expiration,
- expi_proc,
- &rc,
- params_select);
-}
-
-
-/**
- * Drop database.
- *
- * @param cls the `struct Plugin *`
- */
-static void
-mysql_plugin_drop (void *cls)
-{
- struct Plugin *plugin = cls;
-
- if (GNUNET_OK !=
- GNUNET_MYSQL_statement_run (plugin->mc,
- "DROP TABLE gn090"))
- return; /* error */
- plugin->env->duc (plugin->env->cls, 0);
-}
-
-
-/**
- * Remove a particular key in the datastore.
- *
- * @param cls closure
- * @param key key for the content
- * @param size number of bytes in data
- * @param data content stored
- * @param cont continuation called with success or failure status
- * @param cont_cls continuation closure for @a cont
- */
-static void
-mysql_plugin_remove_key (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
- const void *data,
- PluginRemoveCont cont,
- void *cont_cls)
-{
- struct Plugin *plugin = cls;
- struct GNUNET_MY_QueryParam params_delete[] = {
- GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_fixed_size (data, size),
- GNUNET_MY_query_param_end
- };
-
- if (GNUNET_OK !=
- GNUNET_MY_exec_prepared (plugin->mc,
- plugin->delete_entry_by_hash_value,
- params_delete))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Removing key `%s' from gn090 table failed\n",
- GNUNET_h2s (key));
- cont (cont_cls,
- key,
- size,
- GNUNET_SYSERR,
- _ ("MySQL statement run failure"));
- return;
- }
-
- MYSQL_STMT *stmt = GNUNET_MYSQL_statement_get_stmt (
- plugin->delete_entry_by_hash_value);
- my_ulonglong rows = mysql_stmt_affected_rows (stmt);
-
- if (0 == rows)
- {
- cont (cont_cls,
- key,
- size,
- GNUNET_NO,
- NULL);
- return;
- }
- plugin->env->duc (plugin->env->cls,
- -size);
- cont (cont_cls,
- key,
- size,
- GNUNET_OK,
- NULL);
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls the `struct GNUNET_DATASTORE_PluginEnvironment *`
- * @return our `struct Plugin *`
- */
-void *
-libgnunet_plugin_datastore_mysql_init (void *cls)
-{
- struct GNUNET_DATASTORE_PluginEnvironment *env = cls;
- struct GNUNET_DATASTORE_PluginFunctions *api;
- struct Plugin *plugin;
-
- plugin = GNUNET_new (struct Plugin);
- plugin->env = env;
- plugin->mc = GNUNET_MYSQL_context_create (env->cfg,
- "datastore-mysql");
- if (NULL == plugin->mc)
- {
- GNUNET_free (plugin);
- return NULL;
- }
-#define MRUNS(a) (GNUNET_OK != GNUNET_MYSQL_statement_run (plugin->mc, a))
-#define PINIT(a, b) (NULL == (a = GNUNET_MYSQL_statement_prepare (plugin->mc, \
- b)))
- if (MRUNS
- ("CREATE TABLE IF NOT EXISTS gn090 ("
- " repl INT(11) UNSIGNED NOT NULL DEFAULT 0,"
- " type INT(11) UNSIGNED NOT NULL DEFAULT 0,"
- " prio INT(11) UNSIGNED NOT NULL DEFAULT 0,"
- " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0,"
- " expire BIGINT UNSIGNED NOT NULL DEFAULT 0,"
- " rvalue BIGINT UNSIGNED NOT NULL,"
- " hash BINARY(64) NOT NULL DEFAULT '',"
- " vhash BINARY(64) NOT NULL DEFAULT '',"
- " value BLOB NOT NULL DEFAULT '',"
- " uid BIGINT NOT NULL AUTO_INCREMENT,"
- " PRIMARY KEY (uid),"
- " INDEX idx_hash_type_uid (hash(64),type,rvalue),"
- " INDEX idx_prio (prio),"
- " INDEX idx_repl_rvalue (repl,rvalue),"
- " INDEX idx_expire (expire),"
- " INDEX idx_anonLevel_type_rvalue (anonLevel,type,rvalue)"
- ") ENGINE=InnoDB") || MRUNS ("SET AUTOCOMMIT = 1") ||
- PINIT (plugin->insert_entry, INSERT_ENTRY) ||
- PINIT (plugin->delete_entry_by_uid, DELETE_ENTRY_BY_UID) ||
- PINIT (plugin->delete_entry_by_hash_value, DELETE_ENTRY_BY_HASH_VALUE) ||
- PINIT (plugin->select_entry, SELECT_ENTRY) ||
- PINIT (plugin->select_entry_by_hash, SELECT_ENTRY_BY_HASH) ||
- PINIT (plugin->select_entry_by_hash_and_type,
- SELECT_ENTRY_BY_HASH_AND_TYPE) ||
- PINIT (plugin->get_size, SELECT_SIZE) ||
- PINIT (plugin->update_entry, UPDATE_ENTRY) ||
- PINIT (plugin->dec_repl, DEC_REPL) ||
- PINIT (plugin->zero_iter, SELECT_IT_NON_ANONYMOUS) ||
- PINIT (plugin->select_expiration, SELECT_IT_EXPIRATION) ||
- PINIT (plugin->select_priority, SELECT_IT_PRIORITY) ||
- PINIT (plugin->max_repl, SELECT_MAX_REPL) ||
- PINIT (plugin->get_all_keys, GET_ALL_KEYS) ||
- PINIT (plugin->select_replication, SELECT_IT_REPLICATION) ||
- false)
- {
- GNUNET_MYSQL_context_destroy (plugin->mc);
- GNUNET_free (plugin);
- return NULL;
- }
-#undef PINIT
-#undef MRUNS
-
- api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions);
- api->cls = plugin;
- api->estimate_size = &mysql_plugin_estimate_size;
- api->put = &mysql_plugin_put;
- api->get_key = &mysql_plugin_get_key;
- api->get_replication = &mysql_plugin_get_replication;
- api->get_expiration = &mysql_plugin_get_expiration;
- api->get_zero_anonymity = &mysql_plugin_get_zero_anonymity;
- api->get_keys = &mysql_plugin_get_keys;
- api->drop = &mysql_plugin_drop;
- api->remove_key = &mysql_plugin_remove_key;
- GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "mysql",
- _ ("Mysql database running\n"));
- return api;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls our `struct Plugin *`
- * @return always NULL
- */
-void *
-libgnunet_plugin_datastore_mysql_done (void *cls)
-{
- struct GNUNET_DATASTORE_PluginFunctions *api = cls;
- struct Plugin *plugin = api->cls;
-
- GNUNET_MYSQL_context_destroy (plugin->mc);
- GNUNET_free (plugin);
- GNUNET_free (api);
- return NULL;
-}
-
-
-/* end of plugin_datastore_mysql.c */
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 8fb0bf6ee..5fcacc17b 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- Copyright (C) 2009-2017 GNUnet e.V.
+ Copyright (C) 2009-2017, 2022 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -64,122 +64,76 @@ struct Plugin
* @param plugin global context
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
-static int
+static enum GNUNET_GenericReturnValue
init_connection (struct Plugin *plugin)
{
- struct GNUNET_PQ_ExecuteStatement es[] = {
- /* FIXME: PostgreSQL does not have unsigned integers! This is ok for the type column because
- * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel
- * we do math or inequality tests, so we can't handle the entire range of uint32_t.
- * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC.
- */
- GNUNET_PQ_make_try_execute (
- "CREATE SEQUENCE IF NOT EXISTS gn090_oid_seq"),
- GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 ("
- " repl INTEGER NOT NULL DEFAULT 0,"
- " type INTEGER NOT NULL DEFAULT 0,"
- " prio INTEGER NOT NULL DEFAULT 0,"
- " anonLevel INTEGER NOT NULL DEFAULT 0,"
- " expire BIGINT NOT NULL DEFAULT 0,"
- " rvalue BIGINT NOT NULL DEFAULT 0,"
- " hash BYTEA NOT NULL DEFAULT '',"
- " vhash BYTEA NOT NULL DEFAULT '',"
- " value BYTEA NOT NULL DEFAULT '',"
- " oid OID NOT NULL DEFAULT nextval('gn090_oid_seq'))"),
- GNUNET_PQ_make_try_execute (
- "ALTER SEQUENCE gn090_oid_seq OWNED BY gn090.oid"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS oid_hash ON gn090 (oid)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_prio ON gn090 (prio)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_expire ON gn090 (expire)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_prio_anon ON gn090 (prio,anonLevel)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_prio_hash_anon ON gn090 (prio,hash,anonLevel)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_repl_rvalue ON gn090 (repl,rvalue)"),
- GNUNET_PQ_make_try_execute (
- "CREATE INDEX IF NOT EXISTS idx_expire_hash ON gn090 (expire,hash)"),
- GNUNET_PQ_make_execute (
- "ALTER TABLE gn090 ALTER value SET STORAGE EXTERNAL"),
- GNUNET_PQ_make_execute ("ALTER TABLE gn090 ALTER hash SET STORAGE PLAIN"),
- GNUNET_PQ_make_execute ("ALTER TABLE gn090 ALTER vhash SET STORAGE PLAIN"),
- GNUNET_PQ_EXECUTE_STATEMENT_END
- };
-
#define RESULT_COLUMNS "repl, type, prio, anonLevel, expire, hash, value, oid"
struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("get",
- "SELECT " RESULT_COLUMNS " FROM gn090"
+ "SELECT " RESULT_COLUMNS
+ " FROM datastore.gn090"
" WHERE oid >= $1::bigint AND"
" (rvalue >= $2 OR 0 = $3::smallint) AND"
" (hash = $4 OR 0 = $5::smallint) AND"
" (type = $6 OR 0 = $7::smallint)"
- " ORDER BY oid ASC LIMIT 1",
- 7),
+ " ORDER BY oid ASC LIMIT 1"),
GNUNET_PQ_make_prepare ("put",
- "INSERT INTO gn090 (repl, type, prio, anonLevel, expire, rvalue, hash, vhash, value) "
- "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
- 9),
+ "INSERT INTO datastore.gn090"
+ " (repl, type, prio, anonLevel, expire, rvalue, hash, vhash, value) "
+ "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)"),
GNUNET_PQ_make_prepare ("update",
- "UPDATE gn090"
+ "UPDATE datastore.gn090"
" SET prio = prio + $1,"
" repl = repl + $2,"
" expire = GREATEST(expire, $3)"
- " WHERE hash = $4 AND vhash = $5",
- 5),
+ " WHERE hash = $4 AND vhash = $5"),
GNUNET_PQ_make_prepare ("decrepl",
- "UPDATE gn090 SET repl = GREATEST (repl - 1, 0) "
- "WHERE oid = $1",
- 1),
+ "UPDATE datastore.gn090"
+ " SET repl = GREATEST (repl - 1, 0)"
+ " WHERE oid = $1"),
GNUNET_PQ_make_prepare ("select_non_anonymous",
- "SELECT " RESULT_COLUMNS " FROM gn090 "
- "WHERE anonLevel = 0 AND type = $1 AND oid >= $2::bigint "
- "ORDER BY oid ASC LIMIT 1",
- 2),
+ "SELECT " RESULT_COLUMNS
+ " FROM datastore.gn090"
+ " WHERE anonLevel = 0 AND type = $1 AND oid >= $2::bigint"
+ " ORDER BY oid ASC LIMIT 1"),
GNUNET_PQ_make_prepare ("select_expiration_order",
- "(SELECT " RESULT_COLUMNS " FROM gn090 "
- "WHERE expire < $1 ORDER BY prio ASC LIMIT 1) "
+ "(SELECT " RESULT_COLUMNS
+ " FROM datastore.gn090"
+ " WHERE expire < $1 ORDER BY prio ASC LIMIT 1) "
"UNION "
- "(SELECT " RESULT_COLUMNS " FROM gn090 "
- "ORDER BY prio ASC LIMIT 1) "
- "ORDER BY expire ASC LIMIT 1",
- 1),
+ "(SELECT " RESULT_COLUMNS
+ " FROM datastore.gn090"
+ " ORDER BY prio ASC LIMIT 1)"
+ " ORDER BY expire ASC LIMIT 1"),
GNUNET_PQ_make_prepare ("select_replication_order",
- "SELECT " RESULT_COLUMNS " FROM gn090 "
- "ORDER BY repl DESC,RANDOM() LIMIT 1",
- 0),
+ "SELECT " RESULT_COLUMNS
+ " FROM datastore.gn090"
+ " ORDER BY repl DESC,RANDOM() LIMIT 1"),
GNUNET_PQ_make_prepare ("delrow",
- "DELETE FROM gn090 "
- "WHERE oid=$1",
- 1),
+ "DELETE FROM datastore.gn090"
+ " WHERE oid=$1"),
GNUNET_PQ_make_prepare ("remove",
- "DELETE FROM gn090"
+ "DELETE FROM datastore.gn090"
" WHERE hash = $1 AND"
- " value = $2",
- 2),
+ " value = $2"),
GNUNET_PQ_make_prepare ("get_keys",
- "SELECT hash FROM gn090",
- 0),
+ "SELECT hash"
+ " FROM datastore.gn090"),
GNUNET_PQ_make_prepare ("estimate_size",
"SELECT CASE WHEN NOT EXISTS"
- " (SELECT 1 FROM gn090)"
+ " (SELECT 1 FROM datastore.gn090)"
" THEN 0"
- " ELSE (SELECT SUM(LENGTH(value))+256*COUNT(*) FROM gn090)"
- "END AS total",
- 0),
+ " ELSE (SELECT SUM(LENGTH(value))+256*COUNT(*)"
+ " FROM datastore.gn090)"
+ "END AS total"),
GNUNET_PQ_PREPARED_STATEMENT_END
};
#undef RESULT_COLUMNS
plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->env->cfg,
"datastore-postgres",
+ "datastore-",
NULL,
- es,
ps);
if (NULL == plugin->dbh)
return GNUNET_SYSERR;
@@ -400,7 +354,7 @@ process_result (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
int iret;
- uint32_t rowid;
+ uint64_t rowid;
uint32_t utype;
uint32_t anonymity;
uint32_t replication;
@@ -417,7 +371,7 @@ process_result (void *cls,
GNUNET_PQ_result_spec_absolute_time ("expire", &expiration_time),
GNUNET_PQ_result_spec_auto_from_type ("hash", &key),
GNUNET_PQ_result_spec_variable_size ("value", &data, &size),
- GNUNET_PQ_result_spec_uint32 ("oid", &rowid),
+ GNUNET_PQ_result_spec_uint64 ("oid", &rowid),
GNUNET_PQ_result_spec_end
};
@@ -450,7 +404,7 @@ process_result (void *cls,
if (iret == GNUNET_NO)
{
struct GNUNET_PQ_QueryParam param[] = {
- GNUNET_PQ_query_param_uint32 (&rowid),
+ GNUNET_PQ_query_param_uint64 (&rowid),
GNUNET_PQ_query_param_end
};
@@ -646,9 +600,8 @@ repl_proc (void *cls,
struct ReplCtx *rc = cls;
struct Plugin *plugin = rc->plugin;
int ret;
- uint32_t oid = (uint32_t) uid;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint32 (&oid),
+ GNUNET_PQ_query_param_uint64 (&uid),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qret;
@@ -771,7 +724,7 @@ struct ProcessKeysContext
*
* @param cls closure with a `struct ProcessKeysContext`
* @param result the postgres result
- * @param num_result the number of results in @a result
+ * @param num_results the number of results in @a result
*/
static void
process_keys (void *cls,
@@ -951,9 +904,6 @@ libgnunet_plugin_datastore_postgres_init (void *cls)
api->get_keys = &postgres_plugin_get_keys;
api->drop = &postgres_plugin_drop;
api->remove_key = &postgres_plugin_remove_key;
- GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
- "datastore-postgres",
- _ ("Postgres database running\n"));
return api;
}
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index 3c2d7f2d4..5ea9da4cb 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -253,6 +253,7 @@ create_indices (sqlite3 *dbh)
{ \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", e); \
sqlite3_free (e); \
+ e = NULL; \
}
#endif
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index e72a6acd3..58a6b7a28 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -710,7 +710,7 @@ main (int argc,
char cfg_name[PATH_MAX];
int ret;
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (cfg_name,
sizeof(cfg_name),
"test_datastore_api_data_%s.conf",
diff --git a/src/datastore/test_datastore_api_data_mysql.conf b/src/datastore/test_datastore_api_data_mysql.conf
deleted file mode 100644
index c0052c5ea..000000000
--- a/src/datastore/test_datastore_api_data_mysql.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-@INLINE@ test_defaults.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-datastore-mysql/
-
-[datastore]
-QUOTA = 10 MB
-DATABASE = mysql
-
-[datastore-mysql]
-DATABASE = gnunetcheck
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index 175765267..b9b134fbc 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -387,7 +387,7 @@ main (int argc, char *argv[])
char cfg_name[PATH_MAX];
int ret;
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (cfg_name,
sizeof(cfg_name),
"test_datastore_api_data_%s.conf",
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index 9fe2462e7..7de1acf2d 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -457,7 +457,7 @@ main (int argc, char *argv[])
};
/* determine name of plugin to use */
- plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
GNUNET_snprintf (dir_name, sizeof(dir_name),
"/tmp/test-gnunet-datastore-plugin-%s", plugin_name);
GNUNET_DISK_directory_remove (dir_name);
diff --git a/src/datastore/test_plugin_datastore_data_mysql.conf b/src/datastore/test_plugin_datastore_data_mysql.conf
deleted file mode 100644
index 07d3ec58e..000000000
--- a/src/datastore/test_plugin_datastore_data_mysql.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ test_defaults.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-datastore-plugin-mysql/
-
-[datastore]
-DATABASE = mysql
-
-[datastore-mysql]
-DATABASE = gnunetcheck
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index 5fa8f759f..e31ac596c 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -1385,7 +1385,6 @@ GNUNET_DHT_verify_path (const void *data,
"GP%u=%s\n",
j,
GNUNET_i2s (&get_path[j].pred));
-
GNUNET_CRYPTO_hash (data,
data_size,
&hs.h_data);
diff --git a/src/dht/dhtu_testbed_connect.sh b/src/dht/dhtu_testbed_connect.sh
index 871e9eb1b..b0ba474bf 100755
--- a/src/dht/dhtu_testbed_connect.sh
+++ b/src/dht/dhtu_testbed_connect.sh
@@ -1,17 +1,21 @@
#!/bin/bash
# This file is in the public domain.
+set -eu
+
+GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)"
+
# Helper script for dhtu_testbed_deploy.sh.
# Do not invoke directly.
n=$1
-CFG="/tmp/deployment/${n}.conf"
+CFG="$GNUNET_TMP/deployment/${n}.conf"
HELLO=`gnunet-dht-hello -c $CFG`
# Create dense topology:
#for OFF in `seq 1 $MAX`
#do
-# TCFG="/tmp/deployment/${OFF}.conf"
+# TCFG="$GNUNET_TMP/deployment/${OFF}.conf"
# gnunet-dht-hello -c $TCFG $HELLO
#done
#exit 0
@@ -24,7 +28,7 @@ do
for M in `seq $R $R $END`
do
OFF=`expr \( $n + $M \) % $MAX`
- TCFG="/tmp/deployment/${OFF}.conf"
+ TCFG="$GNUNET_TMP/deployment/${OFF}.conf"
gnunet-dht-hello -c $TCFG $HELLO
done
R=`expr $R + 1`
diff --git a/src/dht/dhtu_testbed_deploy.conf b/src/dht/dhtu_testbed_deploy.conf
index 59d69894a..efabd97d3 100644
--- a/src/dht/dhtu_testbed_deploy.conf
+++ b/src/dht/dhtu_testbed_deploy.conf
@@ -4,7 +4,7 @@
# with peers using the IP underlay.
[paths]
-GNUNET_DATA_HOME=/tmp/%N%
+GNUNET_DATA_HOME=$GNUNET_TMP/%N%
[dht]
UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-dht-%N%.sock
diff --git a/src/dht/dhtu_testbed_deploy.sh b/src/dht/dhtu_testbed_deploy.sh
index 5a7fdde15..e8ac8d5d1 100755
--- a/src/dht/dhtu_testbed_deploy.sh
+++ b/src/dht/dhtu_testbed_deploy.sh
@@ -1,6 +1,9 @@
#!/bin/bash
# This file is in the public domain.
+# Getting location for temporary files
+GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)"
+
# We will use UDP ports above this number.
MINPORT=10000
@@ -23,12 +26,20 @@ then
exit 1
fi
+echo -n "Testing for GNU parallel ..."
+
if test ! -x `which parallel`
then
echo "This script requires GNU parallel"
exit 1
fi
+parallel -V | grep "GNU parallel" > /dev/null || exit 1
+
+echo " OK"
+
+
+
if test ! -x `which gnunet-service-dht`
then
echo "This script requires gnunet-service-dht in \$PATH"
@@ -46,13 +57,13 @@ MAX=`expr $1 - 1`
export GNUNET_FORCE_LOG="dht*;;;;DEBUG"
echo -n "Starting $1 peers "
-mkdir -p /tmp/deployment
+mkdir -p "$GNUNET_TMP/deployment"
for n in `seq 0 $MAX`
do
PORT=`expr $MINPORT + $n`
- CFG="/tmp/deployment/${n}.conf"
+ CFG="$GNUNET_TMP/deployment/${n}.conf"
cat dhtu_testbed_deploy.conf | sed -e "s/%N%/$PORT/" > $CFG
- gnunet-service-dht -c $CFG &> /tmp/deployment/$n.log &
+ gnunet-service-dht -c $CFG -L DEBUG &> "$GNUNET_TMP/deployment/$n.log" &
echo -n "."
done
@@ -77,7 +88,7 @@ fi
echo ""
echo "Network ready. Press ENTER to terminate the testbed!"
-echo "Interact with peers using '-c /tmp/deployment/\$N.conf'"
+echo "Interact with peers using '-c $GNUNET_TMP/deployment/\$N.conf'"
read
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 806cafd0d..393184bb6 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -171,6 +171,23 @@ get_result_iterator (void *cls,
(char *) data);
if (record_route && verbose)
{
+ {
+ struct GNUNET_PeerIdentity my_identity;
+
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CRYPTO_get_peer_identity (cfg,
+ &my_identity));
+ GNUNET_break (0 ==
+ GNUNET_DHT_verify_path (data,
+ size,
+ exp,
+ trunc_peer,
+ put_path,
+ put_path_length,
+ get_path,
+ get_path_length,
+ &my_identity));
+ }
fprintf (stdout,
" GET path: ");
for (unsigned int i = 0; i < get_path_length; i++)
@@ -187,7 +204,7 @@ get_result_iterator (void *cls,
GNUNET_i2s (&put_path[i].pred));
if (NULL != trunc_peer)
fprintf (stdout,
- "T%s",
+ "!%s",
GNUNET_i2s (trunc_peer));
fprintf (stdout,
"\n");
@@ -267,6 +284,7 @@ run (void *cls,
int
main (int argc, char *const *argv)
{
+ char *u8_argv = NULL;
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_string (
'k',
@@ -312,18 +330,22 @@ main (int argc, char *const *argv)
GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (
- argc,
- argv,
- "gnunet-dht-get",
- gettext_noop (
- "Issue a GET request to the GNUnet DHT, prints results."),
- options,
- &run,
- NULL))
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (
+ argc,
+ argv,
+ "gnunet-dht-get",
+ gettext_noop (
+ "Issue a GET request to the GNUnet DHT, prints results."),
+ options,
+ &run,
+ NULL))
? ret
: 1;
+ // This is ugly, but meh. The GNUNET_STRINGS_get_utf8_args allows us to do this.
+ u8_argv = (char*) argv;
+ GNUNET_free (u8_argv);
+ return ret;
}
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 531107ef2..37e7911b5 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -179,6 +179,7 @@ run (void *cls,
int
main (int argc, char *const *argv)
{
+ char *u8_argv = NULL;
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_string (
'd',
@@ -244,6 +245,9 @@ main (int argc, char *const *argv)
NULL))
? ret
: 1;
+ // This is ugly, but meh. The GNUNET_STRINGS_get_utf8_args allows us to do this.
+ u8_argv = (char*) argv;
+ GNUNET_free (u8_argv);
}
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h
index ecb79fa50..dcc972fc2 100644
--- a/src/dht/gnunet-service-dht.h
+++ b/src/dht/gnunet-service-dht.h
@@ -144,7 +144,6 @@ GDS_u_hold (struct GDS_Underlay *u,
*
* @param bd block details
* @param query_hash hash of the original query, might not match key in @a bd
- * @param trunc_peer peer at which the path was truncated, or NULL if path starts at the origin
* @param get_path_length number of entries in @a get_path
* @param get_path path the reply has taken
* @return true on success, false on failures
@@ -158,7 +157,8 @@ GDS_CLIENTS_handle_reply (const struct GNUNET_DATACACHE_Block *bd,
/**
* Check if some client is monitoring GET messages and notify
- * them in that case.
+ * them in that case. If tracked, @a path should include the local peer.
+ *
*
* @param options Options, for instance RecordRoute, DemultiplexEverywhere.
* @param type The type of data in the request.
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index fdcc31f13..90bb4d1f7 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -40,7 +40,7 @@
* 1: check all external inputs
* 2: check internal computations as well
*/
-#define SANITY_CHECKS 2
+#define SANITY_CHECKS 0
/**
* Should routing details be logged to stderr (for debugging)?
@@ -506,6 +506,7 @@ handle_dht_local_put (void *cls,
(unsigned long) (size - sizeof(struct GNUNET_DHT_ClientPutMessage)),
GNUNET_h2s (&dht_msg->key),
(unsigned int) bd.type);
+#if SANITY_CHECKS > 0
if (GNUNET_OK !=
GNUNET_BLOCK_check_block (GDS_block_context,
bd.type,
@@ -515,6 +516,7 @@ handle_dht_local_put (void *cls,
GNUNET_break (0);
return;
}
+#endif
GNUNET_STATISTICS_update (GDS_stats,
"# PUT requests received from clients",
1,
@@ -584,7 +586,7 @@ handle_local_result (void *cls,
* Check DHT GET messages from the client.
*
* @param cls the client we received this message from
- * @param message the actual message received
+ * @param get the actual message received
* @return #GNUNET_OK (always)
*/
static enum GNUNET_GenericReturnValue
@@ -602,7 +604,7 @@ check_dht_local_get (void *cls,
* Handler for DHT GET messages from the client.
*
* @param cls the client we received this message from
- * @param message the actual message received
+ * @param get the actual message received
*/
static void
handle_dht_local_get (void *cls,
@@ -720,7 +722,7 @@ find_by_unique_id (void *cls,
* Check "GET result seen" messages from the client.
*
* @param cls the client we received this message from
- * @param message the actual message received
+ * @param seen the actual message received
* @return #GNUNET_OK if @a seen is well-formed
*/
static enum GNUNET_GenericReturnValue
@@ -746,7 +748,7 @@ check_dht_local_get_result_seen (
* Handler for "GET result seen" messages from the client.
*
* @param cls the client we received this message from
- * @param message the actual message received
+ * @param seen the actual message received
*/
static void
handle_dht_local_get_result_seen (
@@ -835,7 +837,7 @@ remove_by_unique_id (void *cls,
* depending on message type (if processed locally)
*
* @param cls client we received this message from
- * @param message the actual message received
+ * @param dht_stop_msg the actual message received
*
*/
static void
@@ -917,13 +919,13 @@ forward_reply (void *cls,
LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
"CLIENT-RESULT %s\n",
- GNUNET_h2s_full (&frc->bd->key));
+ GNUNET_h2s_full (&bd->key));
if ( (record->type != GNUNET_BLOCK_TYPE_ANY) &&
- (record->type != frc->bd->type) )
+ (record->type != bd->type) )
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Record type mismatch, not passing request for key %s to local client\n",
- GNUNET_h2s (&frc->bd->key));
+ GNUNET_h2s (&bd->key));
GNUNET_STATISTICS_update (GDS_stats,
"# Key match, type mismatches in REPLY to CLIENT",
1,
@@ -931,7 +933,7 @@ forward_reply (void *cls,
return GNUNET_YES; /* type mismatch */
}
if ( (0 == (record->msg_options & GNUNET_DHT_RO_FIND_APPROXIMATE)) &&
- (0 != GNUNET_memcmp (&frc->bd->key,
+ (0 != GNUNET_memcmp (&bd->key,
query_hash)) )
{
GNUNET_STATISTICS_update (GDS_stats,
@@ -940,8 +942,8 @@ forward_reply (void *cls,
GNUNET_NO);
return GNUNET_YES; /* type mismatch */
}
- GNUNET_CRYPTO_hash (frc->bd->data,
- frc->bd->data_size,
+ GNUNET_CRYPTO_hash (bd->data,
+ bd->data_size,
&ch);
for (unsigned int i = 0; i < record->seen_replies_count; i++)
if (0 ==
@@ -950,7 +952,7 @@ forward_reply (void *cls,
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Duplicate reply, not passing request for key %s to local client\n",
- GNUNET_h2s (&frc->bd->key));
+ GNUNET_h2s (&bd->key));
GNUNET_STATISTICS_update (GDS_stats,
"# Duplicate REPLIES to CLIENT request dropped",
1,
@@ -961,15 +963,15 @@ forward_reply (void *cls,
= GNUNET_BLOCK_check_reply (GDS_block_context,
record->type,
NULL,
- &frc->bd->key,
+ &bd->key,
record->xquery,
record->xquery_size,
- frc->bd->data,
- frc->bd->data_size);
+ bd->data,
+ bd->data_size);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Evaluation result is %d for key %s for local client's query\n",
(int) eval,
- GNUNET_h2s (&frc->bd->key));
+ GNUNET_h2s (&bd->key));
switch (eval)
{
case GNUNET_BLOCK_REPLY_OK_LAST:
@@ -996,19 +998,35 @@ forward_reply (void *cls,
"# RESULTS queued for clients",
1,
GNUNET_NO);
- xsize += (frc->get_path_length + frc->bd->put_path_length)
+ xsize += (frc->get_path_length + bd->put_path_length)
* sizeof(struct GNUNET_DHT_PathElement);
if (truncated)
xsize += sizeof (struct GNUNET_PeerIdentity);
+
+#if SUPER_REDUNDANT_CHECK
+ GNUNET_break (0 ==
+ GNUNET_DHT_verify_path (bd->data,
+ bd->data_size,
+ bd->expiration_time,
+ truncated
+ ? &bd->trunc_peer
+ : NULL,
+ bd->put_path,
+ bd->put_path_length,
+ frc->get_path,
+ frc->get_path_length,
+ &GDS_my_identity));
+#endif
+
env = GNUNET_MQ_msg_extra (reply,
xsize,
GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT);
- reply->type = htonl (frc->bd->type);
+ reply->type = htonl (bd->type);
reply->options = htonl (bd->ro);
reply->get_path_length = htonl (frc->get_path_length);
- reply->put_path_length = htonl (frc->bd->put_path_length);
+ reply->put_path_length = htonl (bd->put_path_length);
reply->unique_id = record->unique_id;
- reply->expiration = GNUNET_TIME_absolute_hton (frc->bd->expiration_time);
+ reply->expiration = GNUNET_TIME_absolute_hton (bd->expiration_time);
reply->key = *query_hash;
if (truncated)
{
@@ -1025,16 +1043,16 @@ forward_reply (void *cls,
paths = (struct GNUNET_DHT_PathElement *) &reply[1];
}
GNUNET_memcpy (paths,
- frc->bd->put_path,
+ bd->put_path,
sizeof(struct GNUNET_DHT_PathElement)
- * frc->bd->put_path_length);
- GNUNET_memcpy (&paths[frc->bd->put_path_length],
+ * bd->put_path_length);
+ GNUNET_memcpy (&paths[bd->put_path_length],
frc->get_path,
sizeof(struct GNUNET_DHT_PathElement)
* frc->get_path_length);
- GNUNET_memcpy (&paths[frc->get_path_length + frc->bd->put_path_length],
- frc->bd->data,
- frc->bd->data_size);
+ GNUNET_memcpy (&paths[frc->get_path_length + bd->put_path_length],
+ bd->data,
+ bd->data_size);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending reply to query %s for client %p\n",
GNUNET_h2s (query_hash),
@@ -1058,7 +1076,9 @@ GDS_CLIENTS_handle_reply (const struct GNUNET_DATACACHE_Block *bd,
+ bd->data_size
+ (get_path_length + bd->put_path_length)
* sizeof(struct GNUNET_DHT_PathElement);
+#if SANITY_CHECKS > 1
bool truncated = (0 != (bd->ro & GNUNET_DHT_RO_TRUNCATED));
+#endif
if (msize >= GNUNET_MAX_MESSAGE_SIZE)
{
@@ -1382,16 +1402,6 @@ get_action (void *cls,
}
-/**
- * Check if some client is monitoring GET messages and notify
- * them in that case. If tracked, @a path should include the local peer.
- *
- * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
- * @param type The type of data in the request.
- * @param hop_count Hop count so far.
- * @param desired_replication_level Desired replication level.
- * @param key Key of the requested data.
- */
void
GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options,
enum GNUNET_BLOCK_Type type,
@@ -1597,8 +1607,6 @@ GDS_CLIENTS_process_put (const struct GNUNET_DATACACHE_Block *bd,
/**
* Initialize client subsystem.
- *
- * @param server the initialized server
*/
static void
GDS_CLIENTS_init (void)
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index cc7333a9c..010a7dd62 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -111,7 +111,7 @@ struct PeerPutMessage
struct GNUNET_MessageHeader header;
/**
- * Content type.
+ * Content type, must not be zero.
*/
uint32_t type GNUNET_PACKED;
@@ -176,9 +176,14 @@ struct PeerResultMessage
uint32_t type GNUNET_PACKED;
/**
+ * Always 0.
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+ /**
* Message options, actually an 'enum GNUNET_DHT_RouteOption' value in NBO.
*/
- uint32_t options GNUNET_PACKED;
+ uint16_t options GNUNET_PACKED;
/**
* Length of the PUT path that follows (if tracked).
@@ -524,7 +529,6 @@ do_send (struct PeerInfo *pi,
* Sign that we are routing a message from @a pred to @a succ.
* (So the route is $PRED->us->$SUCC).
*
- * @param key key of the data (not necessarily the query hash)
* @param data payload (the block)
* @param data_size number of bytes in @a data
* @param exp_time expiration time of @a data
@@ -658,11 +662,12 @@ send_find_peer_message (void *cls)
struct GNUNET_CONTAINER_BloomFilter *peer_bf;
bg = GNUNET_BLOCK_group_create (GDS_block_context,
- GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
+ GNUNET_BLOCK_TYPE_DHT_HELLO,
NULL,
0,
- "filter-size",
- DHT_BLOOM_SIZE,
+ "set-seen-size",
+ GNUNET_CONTAINER_multipeermap_size (
+ all_connected_peers),
NULL);
GNUNET_CONTAINER_multipeermap_iterate (all_connected_peers,
&add_known_to_bloom,
@@ -672,7 +677,7 @@ send_find_peer_message (void *cls)
DHT_BLOOM_SIZE,
GNUNET_CONSTANTS_BLOOMFILTER_K);
if (GNUNET_OK !=
- GDS_NEIGHBOURS_handle_get (GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
+ GDS_NEIGHBOURS_handle_get (GNUNET_BLOCK_TYPE_DHT_HELLO,
GNUNET_DHT_RO_FIND_APPROXIMATE
| GNUNET_DHT_RO_RECORD_ROUTE,
FIND_PEER_REPLICATION_LEVEL,
@@ -1299,7 +1304,7 @@ hello_check (const struct GNUNET_DATACACHE_Block *bd)
struct GNUNET_PeerIdentity pid;
struct GNUNET_HELLO_Builder *b;
- if (GNUNET_BLOCK_TYPE_DHT_URL_HELLO != bd->type)
+ if (GNUNET_BLOCK_TYPE_DHT_HELLO != bd->type)
return;
b = GNUNET_HELLO_builder_from_block (bd->data,
@@ -1771,7 +1776,8 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
prm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT);
prm->header.size = htons (sizeof (buf));
prm->type = htonl ((uint32_t) bd->type);
- prm->options = htonl ((uint32_t) ro);
+ prm->reserved = htons (0);
+ prm->options = htons ((uint16_t) ro);
prm->put_path_length = htons ((uint16_t) ppl);
prm->get_path_length = htons ((uint16_t) get_path_length);
prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time);
@@ -1884,7 +1890,7 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
* Check validity of a p2p put request.
*
* @param cls closure with the `struct PeerInfo` of the sender
- * @param message message
+ * @param put message
* @return #GNUNET_OK if the message is valid
*/
static enum GNUNET_GenericReturnValue
@@ -1919,6 +1925,11 @@ check_dht_p2p_put (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ if (GNUNET_BLOCK_TYPE_ANY == htonl (put->type))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
return GNUNET_OK;
}
@@ -1927,7 +1938,7 @@ check_dht_p2p_put (void *cls,
* Core handler for p2p put requests.
*
* @param cls closure with the `struct Target` of the sender
- * @param message message
+ * @param put message
*/
static void
handle_dht_p2p_put (void *cls,
@@ -1959,8 +1970,8 @@ handle_dht_p2p_put (void *cls,
: (const char *) &put_path[putlen];
size_t var_meta_size
= putlen * sizeof(struct GNUNET_DHT_PathElement)
- + has_path ? sizeof (*last_sig) : 0
- + truncated ? sizeof (*trunc_peer) : 0;
+ + (has_path ? sizeof (*last_sig) : 0)
+ + (truncated ? sizeof (*trunc_peer) : 0);
struct GNUNET_DATACACHE_Block bd = {
.key = put->key,
.expiration_time = GNUNET_TIME_absolute_ntoh (put->expiration_time),
@@ -1986,14 +1997,45 @@ handle_dht_p2p_put (void *cls,
GNUNET_NO);
return;
}
- if (GNUNET_NO ==
- GNUNET_BLOCK_check_block (GDS_block_context,
- bd.type,
- bd.data,
- bd.data_size))
{
- GNUNET_break_op (0);
- return;
+ /* Only call 'check_block' if that keeps our CPU load (from
+ the cryptography) below 50% on average */
+ static struct GNUNET_TIME_Relative avg_latency;
+ static struct GNUNET_TIME_Absolute next_time;
+
+ if (GNUNET_TIME_absolute_is_past (next_time))
+ {
+ struct GNUNET_TIME_Absolute now
+ = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Relative latency;
+ struct GNUNET_TIME_Relative delta;
+
+ if (GNUNET_NO ==
+ GNUNET_BLOCK_check_block (GDS_block_context,
+ bd.type,
+ bd.data,
+ bd.data_size))
+ {
+ GNUNET_break_op (0);
+ return;
+ }
+ latency = GNUNET_TIME_absolute_get_duration (now);
+ /* Use *moving average* to estimate check_block latency */
+ avg_latency
+ = GNUNET_TIME_relative_divide (
+ GNUNET_TIME_relative_add (
+ GNUNET_TIME_relative_multiply (avg_latency,
+ 7),
+ latency),
+ 8);
+ /* average delay = 50% of avg_latency => 50% CPU load from crypto (at most) */
+ delta.rel_value_us
+ = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
+ avg_latency.rel_value_us > 0
+ ? avg_latency.rel_value_us
+ : 1LLU);
+ next_time = GNUNET_TIME_relative_to_absolute (delta);
+ }
}
if (! has_path)
putlen = 0;
@@ -2044,7 +2086,7 @@ handle_dht_p2p_put (void *cls,
GNUNET_CONTAINER_bloomfilter_test (bf,
&peer->phash));
/* extend 'put path' by sender */
- bd.put_path = (const struct GNUNET_DHT_PathElement *) pp;
+ bd.put_path = pp;
bd.put_path_length = putlen + 1;
if (has_path)
{
@@ -2078,7 +2120,7 @@ handle_dht_p2p_put (void *cls,
failure_offset);
GNUNET_assert (failure_offset <= putlen + 1);
bd.put_path = &pp[failure_offset];
- bd.put_path_length = putlen - failure_offset;
+ bd.put_path_length = (putlen + 1) - failure_offset;
bd.ro |= GNUNET_DHT_RO_TRUNCATED;
bd.trunc_peer = pp[failure_offset - 1].pred;
}
@@ -2158,7 +2200,7 @@ handle_find_my_hello (struct PeerInfo *pi,
}
else if (GNUNET_BLOCK_REPLY_OK_MORE ==
GNUNET_BLOCK_check_reply (GDS_block_context,
- GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
+ GNUNET_BLOCK_TYPE_DHT_HELLO,
bg,
&GDS_my_identity_hash,
NULL, 0,
@@ -2166,7 +2208,7 @@ handle_find_my_hello (struct PeerInfo *pi,
block_size))
{
struct GNUNET_DATACACHE_Block bd = {
- .type = GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
+ .type = GNUNET_BLOCK_TYPE_DHT_HELLO,
.expiration_time
= GNUNET_TIME_relative_to_absolute (
GNUNET_HELLO_ADDRESS_EXPIRATION),
@@ -2215,7 +2257,7 @@ handle_find_local_hello (struct PeerInfo *pi,
(GNUNET_BLOCK_REPLY_OK_MORE ==
GNUNET_BLOCK_check_reply (
GDS_block_context,
- GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
+ GNUNET_BLOCK_TYPE_DHT_HELLO,
bg,
&peer->phash,
NULL, 0, /* xquery */
@@ -2223,7 +2265,7 @@ handle_find_local_hello (struct PeerInfo *pi,
peer->hello_size)) )
{
struct GNUNET_DATACACHE_Block bd = {
- .type = GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
+ .type = GNUNET_BLOCK_TYPE_DHT_HELLO,
.expiration_time = peer->hello_expiration,
.key = peer->phash,
.data = peer->hello,
@@ -2352,7 +2394,8 @@ handle_dht_p2p_get (void *cls,
(GDS_am_closest_peer (&get->key,
peer_bf)) )
{
- if (GNUNET_BLOCK_TYPE_DHT_URL_HELLO == type)
+ if ( (GNUNET_BLOCK_TYPE_DHT_HELLO == type) ||
+ (GNUNET_BLOCK_TYPE_ANY == type) )
{
GNUNET_STATISTICS_update (GDS_stats,
"# P2P HELLO lookup requests processed",
@@ -2366,7 +2409,7 @@ handle_dht_p2p_get (void *cls,
&get->key,
bg);
}
- else
+ if (GNUNET_BLOCK_TYPE_DHT_HELLO != type)
{
if (0 != (options & GNUNET_DHT_RO_FIND_APPROXIMATE))
eval = GDS_DATACACHE_get_closest (&get->key,
@@ -2473,9 +2516,11 @@ process_reply_with_path (const struct GNUNET_DATACACHE_Block *bd,
+ bd->put_path_length)];
struct GNUNET_DATACACHE_Block bdx = *bd;
- GNUNET_memcpy (xput_path,
- bd->put_path,
- bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
+ if (NULL != bd->put_path)
+ GNUNET_memcpy (xput_path,
+ bd->put_path,
+ bd->put_path_length * sizeof(struct
+ GNUNET_DHT_PathElement));
GNUNET_memcpy (&xput_path[bd->put_path_length],
get_path,
get_path_length * sizeof(struct GNUNET_DHT_PathElement));
@@ -2496,21 +2541,28 @@ process_reply_with_path (const struct GNUNET_DATACACHE_Block *bd,
* Check validity of p2p result message.
*
* @param cls closure
- * @param message message
+ * @param prm message
* @return #GNUNET_YES if the message is well-formed
*/
static enum GNUNET_GenericReturnValue
check_dht_p2p_result (void *cls,
const struct PeerResultMessage *prm)
{
+ uint16_t msize = ntohs (prm->header.size) - sizeof (*prm);
+ enum GNUNET_DHT_RouteOption ro
+ = (enum GNUNET_DHT_RouteOption) ntohs (prm->options);
+ bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
+ bool tracked = (0 != (ro & GNUNET_DHT_RO_RECORD_ROUTE));
+
uint16_t get_path_length = ntohs (prm->get_path_length);
uint16_t put_path_length = ntohs (prm->put_path_length);
- uint16_t msize = ntohs (prm->header.size);
+ size_t vsize = (truncated ? sizeof (struct GNUNET_PeerIdentity) : 0)
+ + (tracked ? sizeof (struct GNUNET_CRYPTO_EddsaSignature) : 0);
(void) cls;
- if ( (msize <
- sizeof(struct PeerResultMessage)
- + (get_path_length + put_path_length)
+ if ( (msize < vsize) ||
+ (msize - vsize <
+ (get_path_length + put_path_length)
* sizeof(struct GNUNET_DHT_PathElement)) ||
(get_path_length >
GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ||
@@ -2528,7 +2580,7 @@ check_dht_p2p_result (void *cls,
* Core handler for p2p result messages.
*
* @param cls closure
- * @param message message
+ * @param prm message
*/
static void
handle_dht_p2p_result (void *cls,
@@ -2538,7 +2590,7 @@ handle_dht_p2p_result (void *cls,
struct PeerInfo *peer = t->pi;
uint16_t msize = ntohs (prm->header.size) - sizeof (*prm);
enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (prm->options);
+ = (enum GNUNET_DHT_RouteOption) ntohs (prm->options);
bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
bool tracked = (0 != (ro & GNUNET_DHT_RO_RECORD_ROUTE));
uint16_t get_path_length = ntohs (prm->get_path_length);
@@ -2740,7 +2792,7 @@ check_dht_p2p_hello (void *cls,
* Core handler for p2p HELLO messages.
*
* @param cls closure
- * @param message message
+ * @param hello message
*/
static void
handle_dht_p2p_hello (void *cls,
@@ -2852,8 +2904,6 @@ GDS_try_connect (void *cls,
GNUNET_assert ( (peer_bucket >= 0) &&
((unsigned int) peer_bucket < MAX_BUCKETS));
bucket = &k_buckets[peer_bucket];
- if (bucket->peers_size >= bucket_size)
- return; /* do not care */
for (struct PeerInfo *pi = bucket->head;
NULL != pi;
pi = pi->next)
@@ -2862,10 +2912,12 @@ GDS_try_connect (void *cls,
pid))
{
/* already connected */
- /* TODO: maybe consider 'uri' anyway as an additional
- alternative address??? */
+ GDS_u_try_connect (pid,
+ uri);
return;
}
+ if (bucket->peers_size >= bucket_size)
+ return; /* do not care */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Discovered peer %s at %s suitable for bucket %d (%u/%u), trying to connect\n",
GNUNET_i2s (pid),
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h
index 96db21b9b..85e18d46d 100644
--- a/src/dht/gnunet-service-dht_neighbours.h
+++ b/src/dht/gnunet-service-dht_neighbours.h
@@ -101,7 +101,6 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
* forwarding to local clients.
*
* @param pi neighbour that should receive the block
- * @param type type of the block
* @param bd details about the reply
* @param query_hash query that was used for the request
* @param get_path_length number of entries in put_path
@@ -150,7 +149,7 @@ GDS_try_connect (void *cls,
* @param cls the closure, must be a `struct GDS_Underlay`
* @param target handle to the target,
* pointer will remain valid until @e disconnect_cb is called
- * @para pid peer identity,
+ * @param pid peer identity,
* pointer will remain valid until @e disconnect_cb is called
* @param[out] ctx storage space for DHT to use in association with this target
*/
@@ -175,7 +174,6 @@ GDS_u_disconnect (void *ctx);
* Function to call when we receive a message.
*
* @param cls the closure
- * @param origin where the message originated from
* @param[in,out] tctx ctx of target address where we received the message from
* @param[in,out] sctx ctx of our own source address at which we received the message
* @param message the message we received @param message_size number of
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index 8f87751bb..d81a2b2e1 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -341,8 +341,6 @@ try_combine_recent (void *cls,
* @param key key for the content
* @param xquery extended query
* @param xquery_size number of bytes in @a xquery
- * @param reply_bf bloomfilter to filter duplicates
- * @param reply_bf_mutator mutator for @a reply_bf
*/
void
GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
diff --git a/src/dht/meson.build b/src/dht/meson.build
new file mode 100644
index 000000000..f42ae354c
--- /dev/null
+++ b/src/dht/meson.build
@@ -0,0 +1,90 @@
+libgnunetdht_src = ['dht_api.c']
+
+gnunetservicedht_src = ['gnunet-service-dht.c',
+ 'gnunet-service-dht_datacache.c',
+ 'gnunet-service-dht_neighbours.c',
+ 'gnunet-service-dht_routing.c']
+
+configure_file(input : 'dht.conf.in',
+ output : 'dht.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetdht_src + gnunetservicedht_src
+ gnunet_src += 'dht/' + p
+ endforeach
+endif
+
+libgnunetdht = library('gnunetdht',
+ libgnunetdht_src,
+ soversion: '4',
+ version: '4.0.0',
+ dependencies: libgnunetutil_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetdht_dep = declare_dependency(link_with : libgnunetdht)
+pkg.generate(libgnunetdht, url: 'https://www.gnunet.org',
+ description : 'Provides API for the R5N distributed hash table')
+
+shared_module('gnunet_plugin_block_dht',
+ ['plugin_block_dht.c'],
+ dependencies: [libgnunetutil_dep,
+ libgnunethello_dep,
+ libgnunetblock_dep,
+ libgnunetblockgroup_dep],
+ include_directories: [incdir, configuration_inc],
+ install:true,
+ install_dir: get_option('libdir')/'gnunet')
+
+executable ('gnunet-dht',
+ gnunetservicedht_src,
+ dependencies: [libgnunetdht_dep, libgnunetutil_dep,
+ libgnunetblock_dep,
+ m_dep,
+ libgnunetdatacache_dep,
+ libgnunetstatistics_dep,
+ libgnunetblockgroup_dep,
+ libgnunethello_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-dht-put',
+ ['gnunet-dht-put.c'],
+ dependencies: [libgnunetdht_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-dht-get',
+ ['gnunet-dht-get.c'],
+ dependencies: [libgnunetdht_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-dht-monitor',
+ ['gnunet-dht-monitor.c'],
+ dependencies: [libgnunetdht_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-dht-hello',
+ ['gnunet-dht-hello.c'],
+ dependencies: [libgnunetdht_dep, libgnunetutil_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-service-dht',
+ gnunetservicedht_src,
+ dependencies: [libgnunetdht_dep, libgnunetutil_dep,
+ libgnunetblock_dep,
+ m_dep,
+ libgnunetdatacache_dep,
+ libgnunetstatistics_dep,
+ libgnunetblockgroup_dep,
+ libgnunethello_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet'/'libexec')
+
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index bee16736c..6375fa272 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -105,14 +105,14 @@ block_plugin_dht_check_query (void *cls,
{
switch (type)
{
- case GNUNET_BLOCK_TYPE_DHT_HELLO:
+ case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
if (0 != xquery_size)
{
GNUNET_break_op (0);
return GNUNET_NO;
}
return GNUNET_OK;
- case GNUNET_BLOCK_TYPE_DHT_URL_HELLO:
+ case GNUNET_BLOCK_TYPE_DHT_HELLO:
if (0 != xquery_size)
{
GNUNET_break_op (0);
@@ -143,7 +143,7 @@ block_plugin_dht_check_block (void *cls,
{
switch (type)
{
- case GNUNET_BLOCK_TYPE_DHT_HELLO:
+ case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
{
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_PeerIdentity pid;
@@ -170,7 +170,7 @@ block_plugin_dht_check_block (void *cls,
}
return GNUNET_OK;
}
- case GNUNET_BLOCK_TYPE_DHT_URL_HELLO:
+ case GNUNET_BLOCK_TYPE_DHT_HELLO:
{
struct GNUNET_HELLO_Builder *b;
struct GNUNET_PeerIdentity pid;
@@ -228,8 +228,9 @@ block_plugin_dht_check_reply (
{
switch (type)
{
- case GNUNET_BLOCK_TYPE_DHT_HELLO:
+ case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
{
+ /* LEGACY */
const struct GNUNET_MessageHeader *msg = reply_block;
const struct GNUNET_HELLO_Message *hello = reply_block;
struct GNUNET_PeerIdentity pid;
@@ -249,7 +250,7 @@ block_plugin_dht_check_reply (
return GNUNET_BLOCK_REPLY_OK_DUPLICATE;
return GNUNET_BLOCK_REPLY_OK_MORE;
}
- case GNUNET_BLOCK_TYPE_DHT_URL_HELLO:
+ case GNUNET_BLOCK_TYPE_DHT_HELLO:
{
struct GNUNET_HELLO_Builder *b;
struct GNUNET_PeerIdentity pid;
@@ -297,8 +298,9 @@ block_plugin_dht_get_key (void *cls,
{
switch (type)
{
- case GNUNET_BLOCK_TYPE_DHT_HELLO:
+ case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
{
+ /* LEGACY */
const struct GNUNET_MessageHeader *msg;
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_PeerIdentity *pid;
@@ -337,7 +339,7 @@ block_plugin_dht_get_key (void *cls,
}
return GNUNET_OK;
}
- case GNUNET_BLOCK_TYPE_DHT_URL_HELLO:
+ case GNUNET_BLOCK_TYPE_DHT_HELLO:
{
struct GNUNET_HELLO_Builder *b;
struct GNUNET_PeerIdentity pid;
@@ -375,8 +377,8 @@ void *
libgnunet_plugin_block_dht_init (void *cls)
{
static enum GNUNET_BLOCK_Type types[] = {
+ GNUNET_BLOCK_TYPE_LEGACY_HELLO,
GNUNET_BLOCK_TYPE_DHT_HELLO,
- GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
GNUNET_BLOCK_TYPE_ANY /* end of list */
};
struct GNUNET_BLOCK_PluginFunctions *api;
diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh
index 56cc99e15..462866f87 100755
--- a/src/dht/test_dht_tools.sh
+++ b/src/dht/test_dht_tools.sh
@@ -1,8 +1,9 @@
#!/bin/sh
# This file is in the public domain.
-out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX`
-tempcfg=`mktemp /tmp/test-dht-tools.XXXXXXXX`
+GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)"
+out=`mktemp $GNUNET_TMP/test-gnunet-dht-logXXXXXXXX`
+tempcfg=`mktemp $GNUNET_TMP/test-dht-tools.XXXXXXXX`
checkout="check.out"
armexe="gnunet-arm -c $tempcfg "
putexe="gnunet-dht-put -c $tempcfg "
diff --git a/src/dhtu/meson.build b/src/dhtu/meson.build
new file mode 100644
index 000000000..bec4c2ec2
--- /dev/null
+++ b/src/dhtu/meson.build
@@ -0,0 +1,36 @@
+libgnunetplugindhtuip_src = ['plugin_dhtu_ip.c']
+libgnunetplugindhtugnunet_src = ['plugin_dhtu_gnunet.c']
+
+configure_file(input : 'dhtu.conf',
+ output : 'dhtu.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetplugindhtuip_src + libgnunetplugindhtugnunet_src
+ gnunet_src += 'dhtu/' + p
+ endforeach
+endif
+
+shared_module('gnunet_plugin_dhtu_ip',
+ libgnunetplugindhtuip_src,
+ dependencies: [libgnunetutil_dep, m_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+shared_module('gnunet_plugin_dhtu_gnunet',
+ libgnunetplugindhtugnunet_src,
+ dependencies: [libgnunetutil_dep,
+ libgnunetats_dep,
+ m_dep,
+ libgnunetcore_dep,
+ libgnunethello_dep,
+ libgnunetpeerinfo_dep,
+ libgnunetnse_dep,
+ libgnunettransport_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c
index b072be2be..b0cee7e01 100644
--- a/src/dhtu/plugin_dhtu_gnunet.c
+++ b/src/dhtu/plugin_dhtu_gnunet.c
@@ -424,7 +424,7 @@ core_disconnect_cb (void *cls,
* @param cls a `struct Plugin`
* @param peer id of the peer, NULL for last call
* @param hello hello message for the peer (can be NULL)
- * @param error message
+ * @param err_msg message
*/
static void
peerinfo_cb (void *cls,
diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c
index 612d2c119..06d0f0f60 100644
--- a/src/dhtu/plugin_dhtu_ip.c
+++ b/src/dhtu/plugin_dhtu_ip.c
@@ -303,7 +303,6 @@ create_target (struct Plugin *plugin,
*
* @param plugin the plugin handle
* @param pid presumed identity of the target
- * @param src source target is from, or NULL if unknown
* @param addr socket address to find
* @param addrlen number of bytes in @a addr
* @return matching target object
diff --git a/src/dhtu/testing_dhtu_cmd_send.c b/src/dhtu/testing_dhtu_cmd_send.c
index fe8e1c18a..45d166b14 100644
--- a/src/dhtu/testing_dhtu_cmd_send.c
+++ b/src/dhtu/testing_dhtu_cmd_send.c
@@ -107,12 +107,12 @@ GNUNET_TESTING_DHTU_cmd_send (const char *label)
{
struct GNUNET_TESTING_Command cmd = {
.cls = ss,
- .label = label,
.run = &send_run,
.ac = &ss->ac,
.cleanup = &send_cleanup,
.traits = &send_traits
};
+ strncpy (cmd.label, label, GNUNET_TESTING_CMD_MAX_LABEL_LENGTH);
return cmd;
}
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c
index 448d86a17..b0bbb894f 100644
--- a/src/dns/dns_api.c
+++ b/src/dns/dns_api.c
@@ -102,7 +102,6 @@ struct GNUNET_DNS_Handle
* Reconnect to the DNS service.
*
* @param cls handle with the connection to connect
- * @param tc scheduler context (unused)
*/
static void
reconnect (void *cls);
@@ -171,7 +170,7 @@ check_request (void *cls,
* handle it.
*
* @param cls the `struct GNUNET_DNS_Handle *`
- * @param msg message from the service (request)
+ * @param req message from the service (request)
*/
static void
handle_request (void *cls,
@@ -193,11 +192,6 @@ handle_request (void *cls,
}
-/**
- * Reconnect to the DNS service.
- *
- * @param cls handle with the connection to connect
- */
static void
reconnect (void *cls)
{
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c
index 48923b613..c1ef17255 100644
--- a/src/dns/gnunet-dns-monitor.c
+++ b/src/dns/gnunet-dns-monitor.c
@@ -27,7 +27,6 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
-#include "gnunet_dnsparser_lib.h"
/**
* Handle to transport service.
diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c
index 835497dba..045207f8c 100644
--- a/src/dns/gnunet-dns-redirector.c
+++ b/src/dns/gnunet-dns-redirector.c
@@ -27,7 +27,6 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
-#include "gnunet_dnsparser_lib.h"
/**
* Handle to DNS service.
diff --git a/src/dns/gnunet-helper-dns.c b/src/dns/gnunet-helper-dns.c
index f0e39464d..54443cd7a 100644
--- a/src/dns/gnunet-helper-dns.c
+++ b/src/dns/gnunet-helper-dns.c
@@ -72,7 +72,7 @@
/**
* Need 'struct GNUNET_MessageHeader'.
*/
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_common.h"
/**
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index 4840c0c95..24566ae21 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -44,10 +44,7 @@
#include "gnunet_signatures.h"
#include "dns.h"
#include "gnunet_dns_service.h"
-#include "gnunet_dnsparser_lib.h"
-#include "gnunet_dnsstub_lib.h"
#include "gnunet_statistics_service.h"
-#include "gnunet_tun_lib.h"
/**
* Port number for DNS
diff --git a/src/dns/gnunet-zonewalk.c b/src/dns/gnunet-zonewalk.c
index 91f8456df..0526df698 100644
--- a/src/dns/gnunet-zonewalk.c
+++ b/src/dns/gnunet-zonewalk.c
@@ -25,8 +25,6 @@
*/
#include "platform.h"
#include <gnunet_util_lib.h>
-#include <gnunet_dnsstub_lib.h>
-#include <gnunet_dnsparser_lib.h>
/**
* Request we should make.
diff --git a/src/dns/meson.build b/src/dns/meson.build
new file mode 100644
index 000000000..20002a9fc
--- /dev/null
+++ b/src/dns/meson.build
@@ -0,0 +1,65 @@
+libgnunetdns_src = ['dns_api.c']
+libgnunetpluginblockdns_src = ['plugin_block_dns.c']
+
+gnunetservicedns_src = ['gnunet-service-dns.c']
+gnunetdnsredirector_src = ['gnunet-dns-monitor.c']
+gnunetdnsmonitor_src = ['gnunet-dns-redirector.c']
+
+configure_file(input : 'dns.conf.in',
+ output : 'dns.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+if get_option('monolith')
+ foreach p : libgnunetdns_src + gnunetservicedns_src + libgnunetpluginblockdns_src
+ gnunet_src += 'dns/' + p
+ endforeach
+ subdir_done()
+endif
+
+libgnunetdns = library('gnunetdns',
+ libgnunetdns_src,
+ soversion: '0',
+ version: '0.0.0',
+ dependencies: libgnunetutil_dep,
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetdns_dep = declare_dependency(link_with : libgnunetdns)
+pkg.generate(libgnunetdns, url: 'https://www.gnunet.org',
+ description : 'Provides API to access GNUnet\'s DNS service (to intercept and manipulate DNS queries)')
+
+shared_module('gnunet_plugin_block_dns',
+ libgnunetpluginblockdns_src,
+ dependencies: [libgnunetutil_dep, libgnunetblockgroup_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet')
+
+executable ('gnunet-service-dns',
+ gnunetservicedns_src,
+ dependencies: [libgnunetdns_dep, libgnunetutil_dep,
+ libgnunetstatistics_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('bindir'))
+executable ('gnunet-dns-monitor',
+ gnunetdnsmonitor_src,
+ dependencies: [libgnunetdns_dep, libgnunetutil_dep, libgnunetdns_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet'/'libexec')
+executable ('gnunet-dns-redirector',
+ gnunetdnsredirector_src,
+ dependencies: [libgnunetdns_dep, libgnunetutil_dep, libgnunetdns_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet'/'libexec')
+executable ('gnunet-helper-dns',
+ ['gnunet-helper-dns.c'],
+ dependencies: [libgnunetdns_dep, libgnunetutil_dep, libgnunetdns_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir')/'gnunet'/'libexec')
+
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c
index 0531a8a5f..1bbd7f750 100644
--- a/src/dns/plugin_block_dns.c
+++ b/src/dns/plugin_block_dns.c
@@ -90,7 +90,6 @@ block_plugin_dns_create_group (void *cls,
* Function called to validate a query.
*
* @param cls closure
- * @param ctx block context
* @param type block type
* @param query original query (hash)
* @param xquery extrended query data (can be NULL, depending on type)
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index f4a17e32a..eb2380439 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -40,12 +40,9 @@
#include "gnunet_applications.h"
#include "gnunet_dht_service.h"
#include "gnunet_cadet_service.h"
-#include "gnunet_dnsparser_lib.h"
-#include "gnunet_dnsstub_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
-#include "gnunet_tun_lib.h"
#include "gnunet_regex_service.h"
#include "exit.h"
#include "block_dns.h"
@@ -1821,7 +1818,7 @@ handle_tcp_remote (void *cls,
* connection via this peer.
*
* @param cls our `struct ChannelState *`
- * @param message the actual message
+ * @param data the actual message
* @return #GNUNET_OK to keep the connection open,
* #GNUNET_SYSERR to close it (signal serious error)
*/
@@ -1861,7 +1858,7 @@ check_tcp_data (void *cls,
* connection via this peer.
*
* @param cls our `struct ChannelState *`
- * @param message the actual message
+ * @param data the actual message
*/
static void
handle_tcp_data (void *cls,
@@ -3231,7 +3228,6 @@ free_iterate (void *cls,
* service process alive by virtue of being scheduled.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
dummy_task (void *cls)
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c
index 4f32ea1f1..d9578cfa0 100644
--- a/src/exit/gnunet-helper-exit.c
+++ b/src/exit/gnunet-helper-exit.c
@@ -55,7 +55,7 @@
/**
* Need 'struct GNUNET_MessageHeader'.
*/
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_common.h"
/**
diff --git a/src/exit/meson.build b/src/exit/meson.build
new file mode 100644
index 000000000..e75f2b080
--- /dev/null
+++ b/src/exit/meson.build
@@ -0,0 +1,29 @@
+configure_file(input : 'exit.conf',
+ output : 'exit.conf',
+ configuration : cdata,
+ install: true,
+ install_dir: pkgcfgdir)
+
+
+if get_option('monolith')
+ subdir_done()
+endif
+
+if host_machine.system() == 'linux'
+ executable ('gnunet-helper-exit',
+ ['gnunet-helper-exit.c'],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
+endif
+
+executable ('gnunet-daemon-exit',
+ ['gnunet-daemon-exit.c'],
+ dependencies: [libgnunetdht_dep,
+ libgnunetutil_dep,
+ libgnunetstatistics_dep,
+ libgnunetregex_dep,
+ libgnunetcadet_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir') / 'gnunet' / 'libexec')
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c
index a2e097b8b..b35ccc100 100644
--- a/src/fragmentation/fragmentation.c
+++ b/src/fragmentation/fragmentation.c
@@ -23,7 +23,6 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_fragmentation_lib.h"
#include "gnunet_protocols.h"
#include "fragmentation.h"
diff --git a/src/fragmentation/fragmentation.h b/src/fragmentation/fragmentation.h
index 2d7abd4f7..1207e4eeb 100644
--- a/src/fragmentation/fragmentation.h
+++ b/src/fragmentation/fragmentation.h
@@ -24,7 +24,9 @@
*/
#ifndef FRAGMENTATION_H
#define FRAGMENTATION_H
+
#include "platform.h"
+#include "gnunet_util_lib.h"
#include "gnunet_fragmentation_lib.h"
GNUNET_NETWORK_STRUCT_BEGIN
diff --git a/src/fragmentation/meson.build b/src/fragmentation/meson.build
new file mode 100644
index 000000000..148a4efe8
--- /dev/null
+++ b/src/fragmentation/meson.build
@@ -0,0 +1,21 @@
+libgnunetfragmentation_src = ['fragmentation.c',
+ 'defragmentation.c']
+
+if get_option('monolith')
+ foreach p : libgnunetfragmentation_src
+ gnunet_src += 'fragmentation/' + p
+ endforeach
+endif
+
+libgnunetfragmentation = library('gnunetfragmentation',
+ libgnunetfragmentation_src,
+ soversion: '2',
+ version: '2.0.0',
+ dependencies: [m_dep, libgnunetutil_dep, libgnunetstatistics_dep],
+ include_directories: [incdir, configuration_inc],
+ install: true,
+ install_dir: get_option('libdir'))
+libgnunetfragmentation_dep = declare_dependency(link_with : libgnunetfragmentation)
+pkg.generate(libgnunetfragmentation, url: 'https://www.gnunet.org',
+ description : 'Provides API for sending and receiving messages that are larger than the MTU of the transport')
+
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 3d8ec2bac..7773c58ee 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -40,7 +40,8 @@ libgnunetfs_la_SOURCES = \
fs_sharetree.c \
fs_tree.c fs_tree.h \
fs_unindex.c \
- fs_uri.c
+ fs_uri.c \
+ meta_data.c
libgnunetfs_la_LIBADD = \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
@@ -148,8 +149,9 @@ endif
gnunet_helper_fs_publish_SOURCES = \
gnunet-helper-fs-publish.c
gnunet_helper_fs_publish_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(GN_LIBINTL)
+ libgnunetfs.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(GN_LIBINTL)
if HAVE_LIBEXTRACTOR
gnunet_helper_fs_publish_LDADD += \
@@ -249,6 +251,7 @@ check_PROGRAMS = \
test_fs_unindex \
test_fs_unindex_persistence \
test_fs_uri \
+ test_fs_meta_data \
test_gnunet_service_fs_migration \
test_gnunet_service_fs_p2p \
test_gnunet_service_fs_p2p_cadet \
@@ -273,7 +276,7 @@ endif
if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; $(MONKEY)
+AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
TESTS = \
test_fs_directory \
test_fs_download \
@@ -294,6 +297,7 @@ TESTS = \
test_fs_unindex_persistence \
test_fs_uri \
test_fs_test_lib \
+ test_fs_meta_data \
test_gnunet_service_fs_migration \
test_gnunet_service_fs_p2p \
test_gnunet_service_fs_p2p_cadet \
@@ -446,6 +450,13 @@ test_fs_unindex_persistence_LDADD = \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
+test_fs_meta_data_SOURCES = \
+ test_fs_meta_data.c
+test_fs_meta_data_LDADD = \
+ libgnunetfs.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+
test_fs_uri_SOURCES = \
test_fs_uri.c
test_fs_uri_LDADD = \
@@ -520,7 +531,6 @@ perf_gnunet_service_fs_p2p_respect_LDADD = \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
-
test_gnunet_fs_psd.py: test_gnunet_fs_psd.py.in Makefile
$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_fs_psd.py.in > test_gnunet_fs_psd.py
chmod +x test_gnunet_fs_psd.py
diff --git a/src/fs/fs.conf.in b/src/fs/fs.conf.in
index 797109d07..be02619bf 100644
--- a/src/fs/fs.conf.in
+++ b/src/fs/fs.conf.in
@@ -1,4 +1,5 @@
[fs]
+RUN_PER_USER = YES
START_ON_DEMAND = @START_ON_DEMAND@
IMMEDIATE_START = YES
INDEXDB = $GNUNET_DATA_HOME/fs/idxinfo.lst
@@ -23,7 +24,7 @@ CONTENT_CACHING = YES
# (may improve anonymity, probably not a good idea if content_caching is NO)
CONTENT_PUSHING = YES
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-fs.sock
+UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-fs.sock
# Do we require users that want to access file-sharing to run this process
# (usually not a good idea)
diff --git a/src/fs/fs.h b/src/fs/fs.h
index 4c433e774..c3bae65d2 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -29,6 +29,7 @@
#include "gnunet_constants.h"
#include "gnunet_datastore_service.h"
#include "gnunet_dht_service.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_block_lib.h"
#include "block_fs.h"
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 63b17a93e..627c58004 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
@@ -316,17 +317,6 @@ process_job_queue (void *cls)
}
-/**
- * Add a job to the queue.
- *
- * @param h handle to the overall FS state
- * @param start function to call to begin the job
- * @param stop function to call to pause the job, or on dequeue (if the job was running)
- * @param cls closure for start and stop
- * @param blocks number of blocks this jobs uses
- * @param priority how important is this download
- * @return queue handle
- */
struct GNUNET_FS_QueueEntry *
GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h,
GNUNET_SCHEDULER_TaskCallback start,
@@ -515,12 +505,6 @@ GNUNET_FS_data_reader_file_ (void *cls,
}
-/**
- * Create the closure for the #GNUNET_FS_data_reader_file_() callback.
- *
- * @param filename file to read
- * @return closure to use, NULL on error
- */
void *
GNUNET_FS_make_file_reader_context_ (const char *filename)
{
@@ -919,7 +903,7 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
chks = NULL;
skss = NULL;
filename = NULL;
- if ((GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "metadata", &ret->meta)) ||
+ if ((GNUNET_OK != GNUNET_FS_read_meta_data (rh, "metadata", &ret->meta)) ||
(GNUNET_OK != GNUNET_BIO_read_string (rh, "ksk-uri", &ksks, 32 * 1024)) ||
((NULL != ksks) &&
((NULL == (ret->keywords = GNUNET_FS_uri_parse (ksks, NULL))) ||
@@ -1387,7 +1371,7 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi)
skss = NULL;
struct GNUNET_BIO_WriteSpec ws1[] = {
GNUNET_BIO_write_spec_object ("b", &b, sizeof (b)),
- GNUNET_BIO_write_spec_meta_data ("meta", fi->meta),
+ GNUNET_FS_write_spec_meta_data ("meta", fi->meta),
GNUNET_BIO_write_spec_string ("ksks", ksks),
GNUNET_BIO_write_spec_string ("chks", chks),
GNUNET_BIO_write_spec_string ("skss", skss),
@@ -1588,7 +1572,7 @@ static int
fip_signal_resume (void *cls,
struct GNUNET_FS_FileInformation *fi,
uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_MetaData *meta,
struct GNUNET_FS_Uri **uri,
struct GNUNET_FS_BlockOptions *bo,
int *do_index,
@@ -2098,7 +2082,7 @@ GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc)
uris = GNUNET_FS_uri_to_string (dc->uri);
struct GNUNET_BIO_WriteSpec ws1[] = {
GNUNET_BIO_write_spec_string ("uris", uris),
- GNUNET_BIO_write_spec_meta_data ("metadata", dc->meta),
+ GNUNET_FS_write_spec_meta_data ("metadata", dc->meta),
GNUNET_BIO_write_spec_string ("emsg", dc->emsg),
GNUNET_BIO_write_spec_string ("filename", dc->filename),
GNUNET_BIO_write_spec_string ("temp filename", dc->temp_filename),
@@ -2201,7 +2185,7 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr)
(sr->update_search != NULL)
? sr->update_search->serialization
: NULL),
- GNUNET_BIO_write_spec_meta_data ("metadata", sr->meta),
+ GNUNET_FS_write_spec_meta_data ("metadata", sr->meta),
GNUNET_BIO_write_spec_object ("key", &sr->key,
sizeof(struct GNUNET_HashCode)),
GNUNET_BIO_write_spec_int32 ("mandatory missing",
@@ -2575,7 +2559,7 @@ deserialize_search_result (void *cls, const char *filename)
GNUNET_BIO_read_string (rh, "download-lnk", &download, 16)) ||
(GNUNET_OK !=
GNUNET_BIO_read_string (rh, "search-lnk", &update_srch, 16)) ||
- (GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "result-meta", &sr->meta)) ||
+ (GNUNET_OK != GNUNET_FS_read_meta_data (rh, "result-meta", &sr->meta)) ||
(GNUNET_OK != GNUNET_BIO_read (rh,
"result-key",
&sr->key,
@@ -2672,7 +2656,7 @@ cleanup:
if (NULL != sr->uri)
GNUNET_FS_uri_destroy (sr->uri);
if (NULL != sr->meta)
- GNUNET_CONTAINER_meta_data_destroy (sr->meta);
+ GNUNET_FS_meta_data_destroy (sr->meta);
GNUNET_free (sr->serialization);
GNUNET_free (sr);
if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
@@ -2795,7 +2779,7 @@ free_result (void *cls, const struct GNUNET_HashCode *key, void *value)
free_search_context (sr->update_search);
GNUNET_assert (NULL == sr->update_search);
}
- GNUNET_CONTAINER_meta_data_destroy (sr->meta);
+ GNUNET_FS_meta_data_destroy (sr->meta);
GNUNET_FS_uri_destroy (sr->uri);
GNUNET_free (sr);
return GNUNET_YES;
@@ -2893,7 +2877,7 @@ free_download_context (struct GNUNET_FS_DownloadContext *dc)
struct GNUNET_FS_DownloadContext *dcc;
if (NULL != dc->meta)
- GNUNET_CONTAINER_meta_data_destroy (dc->meta);
+ GNUNET_FS_meta_data_destroy (dc->meta);
if (NULL != dc->uri)
GNUNET_FS_uri_destroy (dc->uri);
GNUNET_free (dc->temp_filename);
@@ -2942,7 +2926,7 @@ deserialize_download (struct GNUNET_FS_Handle *h,
dc->h = h;
dc->serialization = GNUNET_strdup (serialization);
struct GNUNET_BIO_ReadSpec rs[] = {
- GNUNET_BIO_read_spec_meta_data ("download-meta", &dc->meta),
+ GNUNET_FS_read_spec_meta_data ("download-meta", &dc->meta),
GNUNET_BIO_read_spec_string ("download-emsg", &dc->emsg, 10 * 1024),
GNUNET_BIO_read_spec_string ("download-fn", &dc->filename, 10 * 1024),
GNUNET_BIO_read_spec_string ("download-tfn",
@@ -3207,16 +3191,20 @@ deserialize_download_file (void *cls, const char *filename)
if (NULL == rh)
{
if (0 != unlink (filename))
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", filename);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "unlink",
+ filename);
GNUNET_free (set);
return GNUNET_OK;
}
deserialize_download (h, rh, NULL, NULL, set);
GNUNET_free (set);
- if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
+ if (GNUNET_OK !=
+ GNUNET_BIO_read_close (rh,
+ &emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _ ("Failure while resuming download operation `%s': %s\n"),
+ "Failure while resuming download operation `%s': %s\n",
filename,
emsg);
GNUNET_free (emsg);
@@ -3242,23 +3230,16 @@ deserialization_master (const char *master_path,
dn = get_serialization_file_name (h, master_path, "");
if (NULL == dn)
return;
- if (GNUNET_YES == GNUNET_DISK_directory_test (dn, GNUNET_YES))
- GNUNET_DISK_directory_scan (dn, proc, h);
+ if (GNUNET_YES ==
+ GNUNET_DISK_directory_test (dn,
+ GNUNET_YES))
+ GNUNET_DISK_directory_scan (dn,
+ proc,
+ h);
GNUNET_free (dn);
}
-/**
- * Setup a connection to the file-sharing service.
- *
- * @param cfg configuration to use
- * @param client_name unique identifier for this client
- * @param upcb function to call to notify about FS actions
- * @param upcb_cls closure for @a upcb
- * @param flags specific attributes for fs-operations
- * @param ... list of optional options, terminated with #GNUNET_FS_OPTIONS_END
- * @return NULL on error
- */
struct GNUNET_FS_Handle *
GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *client_name,
@@ -3325,15 +3306,6 @@ GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
-/**
- * Close our connection with the file-sharing service.
- * The callback given to #GNUNET_FS_start() will no longer be
- * called after this function returns.
- * This function MUST NOT be called from within the
- * callback itself.
- *
- * @param h handle that was returned from #GNUNET_FS_start()
- */
void
GNUNET_FS_stop (struct GNUNET_FS_Handle *h)
{
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h
index 050d5f46c..fdda91928 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -29,6 +29,7 @@
#include "gnunet_constants.h"
#include "gnunet_datastore_service.h"
#include "gnunet_dht_service.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_block_lib.h"
#include "block_fs.h"
@@ -249,7 +250,7 @@ struct GNUNET_FS_FileInformation
/**
* Metadata to use for the file.
*/
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
/**
* Keywords to use for KBlocks.
@@ -525,7 +526,7 @@ struct GNUNET_FS_SearchResult
/**
* Metadata for the search result.
*/
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
/**
* Client info for this search result.
@@ -670,7 +671,7 @@ GNUNET_FS_data_reader_file_ (void *cls,
* Create the closure for the #GNUNET_FS_data_reader_file_() callback.
*
* @param filename file to read
- * @return closure to use
+ * @return closure to use, NULL on error
*/
void *
GNUNET_FS_make_file_reader_context_ (const char *filename);
@@ -839,7 +840,7 @@ GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc);
* GNUnet FS service.
*
* @param sc search context
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc);
@@ -1801,7 +1802,7 @@ struct GNUNET_FS_DownloadContext
/**
* Known meta-data for the file (can be NULL).
*/
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
/**
* Error message, NULL if we're doing OK.
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c
index eb7aac5bb..c693f9216 100644
--- a/src/fs/fs_directory.c
+++ b/src/fs/fs_directory.c
@@ -33,6 +33,7 @@
* into memory
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
@@ -52,15 +53,15 @@
*/
int
GNUNET_FS_meta_data_test_for_directory (const struct
- GNUNET_CONTAINER_MetaData *md)
+ GNUNET_FS_MetaData *md)
{
char *mime;
int ret;
if (NULL == md)
return GNUNET_SYSERR;
- mime = GNUNET_CONTAINER_meta_data_get_by_type (md,
- EXTRACTOR_METATYPE_MIMETYPE);
+ mime = GNUNET_FS_meta_data_get_by_type (md,
+ EXTRACTOR_METATYPE_MIMETYPE);
if (NULL == mime)
return GNUNET_SYSERR;
ret = (0 == strcasecmp (mime, GNUNET_FS_DIRECTORY_MIME)) ? GNUNET_YES :
@@ -77,19 +78,19 @@ GNUNET_FS_meta_data_test_for_directory (const struct
* @param md metadata to add mimetype to
*/
void
-GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md)
+GNUNET_FS_meta_data_make_directory (struct GNUNET_FS_MetaData *md)
{
char *mime;
mime =
- GNUNET_CONTAINER_meta_data_get_by_type (md, EXTRACTOR_METATYPE_MIMETYPE);
+ GNUNET_FS_meta_data_get_by_type (md, EXTRACTOR_METATYPE_MIMETYPE);
if (mime != NULL)
{
GNUNET_break (0 == strcmp (mime, GNUNET_FS_DIRECTORY_MIME));
GNUNET_free (mime);
return;
}
- GNUNET_CONTAINER_meta_data_insert (md, "<gnunet>",
+ GNUNET_FS_meta_data_insert (md, "<gnunet>",
EXTRACTOR_METATYPE_MIMETYPE,
EXTRACTOR_METAFORMAT_UTF8, "text/plain",
GNUNET_FS_DIRECTORY_MIME,
@@ -192,7 +193,7 @@ GNUNET_FS_directory_list_contents (size_t size,
uint32_t mdSize;
uint64_t epos;
struct GNUNET_FS_Uri *uri;
- struct GNUNET_CONTAINER_MetaData *md;
+ struct GNUNET_FS_MetaData *md;
char *filename;
if ((offset == 0) &&
@@ -215,8 +216,8 @@ GNUNET_FS_directory_list_contents (size_t size,
_ ("MAGIC mismatch. This is not a GNUnet directory.\n"));
return GNUNET_SYSERR;
}
- md = GNUNET_CONTAINER_meta_data_deserialize (&cdata[8 + sizeof(uint32_t)],
- mdSize);
+ md = GNUNET_FS_meta_data_deserialize (&cdata[8 + sizeof(uint32_t)],
+ mdSize);
if (md == NULL)
{
GNUNET_break (0);
@@ -228,7 +229,7 @@ GNUNET_FS_directory_list_contents (size_t size,
md,
0,
NULL);
- GNUNET_CONTAINER_meta_data_destroy (md);
+ GNUNET_FS_meta_data_destroy (md);
pos = 8 + sizeof(uint32_t) + mdSize;
}
while (pos < size)
@@ -283,7 +284,7 @@ GNUNET_FS_directory_list_contents (size_t size,
return GNUNET_NO; /* malformed - or partial download */
}
- md = GNUNET_CONTAINER_meta_data_deserialize (&cdata[pos],
+ md = GNUNET_FS_meta_data_deserialize (&cdata[pos],
mdSize);
if (NULL == md)
{
@@ -293,11 +294,11 @@ GNUNET_FS_directory_list_contents (size_t size,
}
pos += mdSize;
filename =
- GNUNET_CONTAINER_meta_data_get_by_type (md,
+ GNUNET_FS_meta_data_get_by_type (md,
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
full_data.size = 0;
full_data.data = NULL;
- GNUNET_CONTAINER_meta_data_iterate (md,
+ GNUNET_FS_meta_data_iterate (md,
&find_full_data,
&full_data);
if (NULL != dep)
@@ -311,7 +312,7 @@ GNUNET_FS_directory_list_contents (size_t size,
}
GNUNET_free (full_data.data);
GNUNET_free (filename);
- GNUNET_CONTAINER_meta_data_destroy (md);
+ GNUNET_FS_meta_data_destroy (md);
GNUNET_FS_uri_destroy (uri);
}
return GNUNET_OK;
@@ -342,7 +343,7 @@ struct GNUNET_FS_DirectoryBuilder
/**
* Meta-data for the directory itself.
*/
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
/**
* Head of linked list of entries.
@@ -362,16 +363,16 @@ struct GNUNET_FS_DirectoryBuilder
* @param mdir metadata for the directory
*/
struct GNUNET_FS_DirectoryBuilder *
-GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData
+GNUNET_FS_directory_builder_create (const struct GNUNET_FS_MetaData
*mdir)
{
struct GNUNET_FS_DirectoryBuilder *ret;
ret = GNUNET_new (struct GNUNET_FS_DirectoryBuilder);
if (mdir != NULL)
- ret->meta = GNUNET_CONTAINER_meta_data_duplicate (mdir);
+ ret->meta = GNUNET_FS_meta_data_duplicate (mdir);
else
- ret->meta = GNUNET_CONTAINER_meta_data_create ();
+ ret->meta = GNUNET_FS_meta_data_create ();
GNUNET_FS_meta_data_make_directory (ret->meta);
return ret;
}
@@ -390,7 +391,7 @@ GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData
void
GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *md,
+ const struct GNUNET_FS_MetaData *md,
const void *data)
{
struct GNUNET_FS_Uri *curi;
@@ -404,8 +405,8 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
char *serialized;
char *sptr;
size_t slen;
- struct GNUNET_CONTAINER_MetaData *meta;
- const struct GNUNET_CONTAINER_MetaData *meta_use;
+ struct GNUNET_FS_MetaData *meta;
+ const struct GNUNET_FS_MetaData *meta_use;
GNUNET_assert (! GNUNET_FS_uri_test_ksk (uri));
if (NULL != data)
@@ -431,17 +432,17 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
fsize = 0; /* too large */
uris = GNUNET_FS_uri_to_string (uri);
slen = strlen (uris) + 1;
- mds = GNUNET_CONTAINER_meta_data_get_serialized_size (md);
+ mds = GNUNET_FS_meta_data_get_serialized_size (md);
meta_use = md;
meta = NULL;
if (fsize > 0)
{
- meta = GNUNET_CONTAINER_meta_data_duplicate (md);
- GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
+ meta = GNUNET_FS_meta_data_duplicate (md);
+ GNUNET_FS_meta_data_insert (meta, "<gnunet>",
EXTRACTOR_METATYPE_GNUNET_FULL_DATA,
EXTRACTOR_METAFORMAT_BINARY, NULL, data,
fsize);
- mdxs = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
+ mdxs = GNUNET_FS_meta_data_get_serialized_size (meta);
if ((slen + sizeof(uint32_t) + mdxs - 1) / DBLOCK_SIZE ==
(slen + sizeof(uint32_t) + mds - 1) / DBLOCK_SIZE)
{
@@ -461,10 +462,10 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
GNUNET_free (uris);
sptr = &serialized[slen + sizeof(uint32_t)];
ret =
- GNUNET_CONTAINER_meta_data_serialize (meta_use, &sptr, mds,
- GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
+ GNUNET_FS_meta_data_serialize (meta_use, &sptr, mds,
+ GNUNET_FS_META_DATA_SERIALIZE_PART);
if (NULL != meta)
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
if (ret == -1)
mds = 0;
else
@@ -593,7 +594,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
uint32_t big;
size = strlen (GNUNET_DIRECTORY_MAGIC) + sizeof(uint32_t);
- size += GNUNET_CONTAINER_meta_data_get_serialized_size (bld->meta);
+ size += GNUNET_FS_meta_data_get_serialized_size (bld->meta);
sizes = NULL;
perm = NULL;
bes = NULL;
@@ -643,10 +644,10 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
sptr = &data[off + sizeof(uint32_t)];
ret =
- GNUNET_CONTAINER_meta_data_serialize (bld->meta,
+ GNUNET_FS_meta_data_serialize (bld->meta,
&sptr,
size - off - sizeof(uint32_t),
- GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
+ GNUNET_FS_META_DATA_SERIALIZE_FULL);
GNUNET_assert (ret != -1);
big = htonl (ret);
GNUNET_memcpy (&data[off],
@@ -666,7 +667,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
GNUNET_free (perm);
GNUNET_free (bes);
GNUNET_assert (off == size);
- GNUNET_CONTAINER_meta_data_destroy (bld->meta);
+ GNUNET_FS_meta_data_destroy (bld->meta);
GNUNET_free (bld);
return GNUNET_OK;
}
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index cb50182f9..2379e29ce 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -26,6 +26,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_scheduler_lib.h"
#include <pthread.h>
@@ -112,14 +113,6 @@ GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds)
}
-/**
- * Obtain the result of the scan after the scan has signalled
- * completion. Must not be called prior to completion. The 'ds' is
- * freed as part of this call.
- *
- * @param ds directory scanner structure
- * @return the results of the scan (a directory tree)
- */
struct GNUNET_FS_ShareTreeItem *
GNUNET_FS_directory_scan_get_result (struct GNUNET_FS_DirScanner *ds)
{
@@ -367,26 +360,26 @@ process_helper_msgs (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED);
if (0 < left)
{
- ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, left);
+ ds->pos->meta = GNUNET_FS_meta_data_deserialize (end, left);
if (NULL == ds->pos->meta)
{
GNUNET_break (0);
break;
}
/* having full filenames is too dangerous; always make sure we clean them up */
- GNUNET_CONTAINER_meta_data_delete (ds->pos->meta,
- EXTRACTOR_METATYPE_FILENAME,
- NULL,
- 0);
+ GNUNET_FS_meta_data_delete (ds->pos->meta,
+ EXTRACTOR_METATYPE_FILENAME,
+ NULL,
+ 0);
/* instead, put in our 'safer' original filename */
- GNUNET_CONTAINER_meta_data_insert (ds->pos->meta,
- "<libgnunetfs>",
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METAFORMAT_UTF8,
- "text/plain",
- ds->pos->short_filename,
- strlen (ds->pos->short_filename)
- + 1);
+ GNUNET_FS_meta_data_insert (ds->pos->meta,
+ "<libgnunetfs>",
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ ds->pos->short_filename,
+ strlen (ds->pos->short_filename)
+ + 1);
}
ds->pos->ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (
ds->pos->meta);
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 5c98d224a..2a21e4810 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -24,6 +24,7 @@
*/
#include "platform.h"
#include "gnunet_constants.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
@@ -184,9 +185,9 @@ struct ProcessResultClosure
* Iterator over entries in the pending requests in the 'active' map for the
* reply that we just got.
*
- * @param cls closure (our 'struct ProcessResultClosure')
+ * @param cls closure (our `struct ProcessResultClosure`)
* @param key query for the given value / request
- * @param value value in the hash map (a 'struct DownloadRequest')
+ * @param value value in the hash map (a `struct DownloadRequest`)
* @return #GNUNET_YES (we should continue to iterate); unless serious error
*/
static int
@@ -280,7 +281,7 @@ static void
trigger_recursive_download (void *cls,
const char *filename,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
size_t length,
const void *data);
@@ -850,7 +851,7 @@ static void
trigger_recursive_download (void *cls,
const char *filename,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
size_t length,
const void *data)
{
@@ -968,7 +969,7 @@ trigger_recursive_download (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Triggering recursive download of size %llu with %u bytes MD\n",
(unsigned long long) GNUNET_FS_uri_chk_get_file_size (uri),
- (unsigned int) GNUNET_CONTAINER_meta_data_get_serialized_size (
+ (unsigned int) GNUNET_FS_meta_data_get_serialized_size (
meta));
GNUNET_FS_download_start (dc->h,
uri,
@@ -1004,15 +1005,6 @@ GNUNET_FS_free_download_request_ (struct DownloadRequest *dr)
}
-/**
- * Iterator over entries in the pending requests in the 'active' map for the
- * reply that we just got.
- *
- * @param cls closure (our `struct ProcessResultClosure`)
- * @param key query for the given value / request
- * @param value value in the hash map (a `struct DownloadRequest`)
- * @return #GNUNET_YES (we should continue to iterate); unless serious error
- */
static int
process_result_with_request (void *cls,
const struct GNUNET_HashCode *key,
@@ -1431,7 +1423,6 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc)
* We're allowed to ask the FS service for our blocks. Start the download.
*
* @param cls the 'struct GNUNET_FS_DownloadContext'
- * @param mq handle to use for communication with FS (we must destroy it!)
*/
static void
activate_fs_download (void *cls)
@@ -1917,8 +1908,8 @@ GNUNET_FS_download_start_task_ (void *cls)
GNUNET_ERROR_TYPE_DEBUG,
"Trying to find embedded meta data for download of size %llu with %u bytes MD\n",
(unsigned long long) GNUNET_FS_uri_chk_get_file_size (dc->uri),
- (unsigned int) GNUNET_CONTAINER_meta_data_get_serialized_size (dc->meta));
- GNUNET_CONTAINER_meta_data_iterate (dc->meta, &match_full_data, dc);
+ (unsigned int) GNUNET_FS_meta_data_get_serialized_size (dc->meta));
+ GNUNET_FS_meta_data_iterate (dc->meta, &match_full_data, dc);
if (BRS_DOWNLOAD_UP == dc->top_request->state)
{
if (NULL != dc->rfh)
@@ -1958,12 +1949,6 @@ GNUNET_FS_download_start_task_ (void *cls)
}
-/**
- * Create SUSPEND event for the given download operation
- * and then clean up our state (without stop signal).
- *
- * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for
- */
void
GNUNET_FS_download_signal_suspend_ (void *cls)
{
@@ -2012,7 +1997,7 @@ GNUNET_FS_download_signal_suspend_ (void *cls)
dc->active = NULL;
}
GNUNET_free (dc->filename);
- GNUNET_CONTAINER_meta_data_destroy (dc->meta);
+ GNUNET_FS_meta_data_destroy (dc->meta);
GNUNET_FS_uri_destroy (dc->uri);
GNUNET_free (dc->temp_filename);
GNUNET_free (dc->serialization);
@@ -2043,7 +2028,7 @@ GNUNET_FS_download_signal_suspend_ (void *cls)
struct GNUNET_FS_DownloadContext *
create_download_context (struct GNUNET_FS_Handle *h,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const char *filename,
const char *tempname,
uint64_t offset,
@@ -2069,7 +2054,7 @@ create_download_context (struct GNUNET_FS_Handle *h,
(unsigned long long) offset);
dc->h = h;
dc->uri = GNUNET_FS_uri_dup (uri);
- dc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ dc->meta = GNUNET_FS_meta_data_duplicate (meta);
dc->client_info = cctx;
dc->start_time = GNUNET_TIME_absolute_get ();
if (NULL != filename)
@@ -2111,40 +2096,10 @@ create_download_context (struct GNUNET_FS_Handle *h,
}
-/**
- * Download parts of a file. Note that this will store
- * the blocks at the respective offset in the given file. Also, the
- * download is still using the blocking of the underlying FS
- * encoding. As a result, the download may *write* outside of the
- * given boundaries (if offset and length do not match the 32k FS
- * block boundaries). <p>
- *
- * This function should be used to focus a download towards a
- * particular portion of the file (optimization), not to strictly
- * limit the download to exactly those bytes.
- *
- * @param h handle to the file sharing subsystem
- * @param uri the URI of the file (determines what to download); CHK or LOC URI
- * @param meta known metadata for the file (can be NULL)
- * @param filename where to store the file, maybe NULL (then no file is
- * created on disk and data must be grabbed from the callbacks)
- * @param tempname where to store temporary file data, not used if filename is non-NULL;
- * can be NULL (in which case we will pick a name if needed); the temporary file
- * may already exist, in which case we will try to use the data that is there and
- * if it is not what is desired, will overwrite it
- * @param offset at what offset should we start the download (typically 0)
- * @param length how many bytes should be downloaded starting at offset
- * @param anonymity anonymity level to use for the download
- * @param options various options
- * @param cctx initial value for the client context for this download
- * @param parent parent download to associate this download with (use NULL
- * for top-level downloads; useful for manually-triggered recursive downloads)
- * @return context that can be used to control this download
- */
struct GNUNET_FS_DownloadContext *
GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const char *filename,
const char *tempname,
uint64_t offset,
@@ -2178,40 +2133,6 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
}
-/**
- * Download parts of a file based on a search result. The download
- * will be associated with the search result (and the association
- * will be preserved when serializing/deserializing the state).
- * If the search is stopped, the download will not be aborted but
- * be 'promoted' to a stand-alone download.
- *
- * As with the other download function, this will store
- * the blocks at the respective offset in the given file. Also, the
- * download is still using the blocking of the underlying FS
- * encoding. As a result, the download may *write* outside of the
- * given boundaries (if offset and length do not match the 32k FS
- * block boundaries). <p>
- *
- * The given range can be used to focus a download towards a
- * particular portion of the file (optimization), not to strictly
- * limit the download to exactly those bytes.
- *
- * @param h handle to the file sharing subsystem
- * @param sr the search result to use for the download (determines uri and
- * meta data and associations)
- * @param filename where to store the file, maybe NULL (then no file is
- * created on disk and data must be grabbed from the callbacks)
- * @param tempname where to store temporary file data, not used if filename is non-NULL;
- * can be NULL (in which case we will pick a name if needed); the temporary file
- * may already exist, in which case we will try to use the data that is there and
- * if it is not what is desired, will overwrite it
- * @param offset at what offset should we start the download (typically 0)
- * @param length how many bytes should be downloaded starting at offset
- * @param anonymity anonymity level to use for the download
- * @param options various download options
- * @param cctx initial value for the client context for this download
- * @return context that can be used to control this download
- */
struct GNUNET_FS_DownloadContext *
GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_SearchResult *sr,
@@ -2399,7 +2320,7 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete)
}
GNUNET_free (dc->filename);
}
- GNUNET_CONTAINER_meta_data_destroy (dc->meta);
+ GNUNET_FS_meta_data_destroy (dc->meta);
GNUNET_FS_uri_destroy (dc->uri);
if (NULL != dc->temp_filename)
{
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index c5faa14d4..f23b9da2a 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -57,7 +57,8 @@ GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s)
* @return "filename" field of the structure (can be NULL)
*/
const char *
-GNUNET_FS_file_information_get_filename (const struct GNUNET_FS_FileInformation *s)
+GNUNET_FS_file_information_get_filename (const struct
+ GNUNET_FS_FileInformation *s)
{
return s->filename;
}
@@ -83,27 +84,13 @@ GNUNET_FS_file_information_set_filename (struct GNUNET_FS_FileInformation *s,
}
-/**
- * Create an entry for a file in a publish-structure.
- *
- * @param h handle to the file sharing subsystem
- * @param client_info initial value for the client-info value for this entry
- * @param filename name of the file or directory to publish
- * @param keywords under which keywords should this file be available
- * directly; can be NULL
- * @param meta metadata for the file
- * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion,
- * #GNUNET_SYSERR for simulation
- * @param bo block options
- * @return publish structure entry for the file
- */
struct GNUNET_FS_FileInformation *
GNUNET_FS_file_information_create_from_file (
struct GNUNET_FS_Handle *h,
void *client_info,
const char *filename,
const struct GNUNET_FS_Uri *keywords,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
int do_index,
const struct GNUNET_FS_BlockOptions *bo)
{
@@ -146,33 +133,17 @@ GNUNET_FS_file_information_create_from_file (
/* FIXME: If we assume that on other platforms CRT is UTF-8-aware, then
* this should be changed to EXTRACTOR_METAFORMAT_UTF8
*/
- GNUNET_CONTAINER_meta_data_insert (ret->meta,
- "<gnunet>",
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METAFORMAT_C_STRING,
- "text/plain",
- fn,
- strlen (fn) + 1);
+ GNUNET_FS_meta_data_insert (ret->meta,
+ "<gnunet>",
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METAFORMAT_C_STRING,
+ "text/plain",
+ fn,
+ strlen (fn) + 1);
return ret;
}
-/**
- * Create an entry for a file in a publish-structure.
- *
- * @param h handle to the file sharing subsystem
- * @param client_info initial value for the client-info value for this entry
- * @param length length of the file
- * @param data data for the file (should not be used afterwards by
- * the caller; callee will "free")
- * @param keywords under which keywords should this file be available
- * directly; can be NULL
- * @param meta metadata for the file
- * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
- * GNUNET_SYSERR for simulation
- * @param bo block options
- * @return publish structure entry for the file
- */
struct GNUNET_FS_FileInformation *
GNUNET_FS_file_information_create_from_data (
struct GNUNET_FS_Handle *h,
@@ -180,7 +151,7 @@ GNUNET_FS_file_information_create_from_data (
uint64_t length,
void *data,
const struct GNUNET_FS_Uri *keywords,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
int do_index,
const struct GNUNET_FS_BlockOptions *bo)
{
@@ -202,22 +173,6 @@ GNUNET_FS_file_information_create_from_data (
}
-/**
- * Create an entry for a file in a publish-structure.
- *
- * @param h handle to the file sharing subsystem
- * @param client_info initial value for the client-info value for this entry
- * @param length length of the file
- * @param reader function that can be used to obtain the data for the file
- * @param reader_cls closure for "reader"
- * @param keywords under which keywords should this file be available
- * directly; can be NULL
- * @param meta metadata for the file
- * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion,
- * #GNUNET_SYSERR for simulation
- * @param bo block options
- * @return publish structure entry for the file
- */
struct GNUNET_FS_FileInformation *
GNUNET_FS_file_information_create_from_reader (
struct GNUNET_FS_Handle *h,
@@ -226,7 +181,7 @@ GNUNET_FS_file_information_create_from_reader (
GNUNET_FS_DataReader reader,
void *reader_cls,
const struct GNUNET_FS_Uri *keywords,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
int do_index,
const struct GNUNET_FS_BlockOptions *bo)
{
@@ -240,9 +195,9 @@ GNUNET_FS_file_information_create_from_reader (
ret = GNUNET_new (struct GNUNET_FS_FileInformation);
ret->h = h;
ret->client_info = client_info;
- ret->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ ret->meta = GNUNET_FS_meta_data_duplicate (meta);
if (ret->meta == NULL)
- ret->meta = GNUNET_CONTAINER_meta_data_create ();
+ ret->meta = GNUNET_FS_meta_data_create ();
ret->keywords = (keywords == NULL) ? NULL : GNUNET_FS_uri_dup (keywords);
ret->data.file.reader = reader;
ret->data.file.reader_cls = reader_cls;
@@ -267,24 +222,12 @@ GNUNET_FS_file_information_is_directory (
}
-/**
- * Create an entry for an empty directory in a publish-structure.
- *
- * @param h handle to the file sharing subsystem
- * @param client_info initial value for the client-info value for this entry
- * @param meta metadata for the directory
- * @param keywords under which keywords should this directory be available
- * directly; can be NULL
- * @param bo block options
- * @param filename name of the directory; can be NULL
- * @return publish structure entry for the directory , NULL on error
- */
struct GNUNET_FS_FileInformation *
GNUNET_FS_file_information_create_empty_directory (
struct GNUNET_FS_Handle *h,
void *client_info,
const struct GNUNET_FS_Uri *keywords,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const struct GNUNET_FS_BlockOptions *bo,
const char *filename)
{
@@ -293,7 +236,7 @@ GNUNET_FS_file_information_create_empty_directory (
ret = GNUNET_new (struct GNUNET_FS_FileInformation);
ret->h = h;
ret->client_info = client_info;
- ret->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ ret->meta = GNUNET_FS_meta_data_duplicate (meta);
ret->keywords = GNUNET_FS_uri_dup (keywords);
ret->bo = *bo;
ret->is_directory = GNUNET_YES;
@@ -303,17 +246,6 @@ GNUNET_FS_file_information_create_empty_directory (
}
-/**
- * Add an entry to a directory in a publish-structure. Clients
- * should never modify publish structures that were passed to
- * #GNUNET_FS_publish_start already.
- *
- * @param dir the directory
- * @param ent the entry to add; the entry must not have been
- * added to any other directory at this point and
- * must not include @a dir in its structure
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
int
GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir,
struct GNUNET_FS_FileInformation *ent)
@@ -461,7 +393,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
if (NULL != fi->keywords)
GNUNET_FS_uri_destroy (fi->keywords);
if (NULL != fi->meta)
- GNUNET_CONTAINER_meta_data_destroy (fi->meta);
+ GNUNET_FS_meta_data_destroy (fi->meta);
GNUNET_free (fi->serialization);
if (NULL != fi->te)
{
diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c
index 43a02a9fa..0135e2e05 100644
--- a/src/fs/fs_getopt.c
+++ b/src/fs/fs_getopt.c
@@ -24,8 +24,8 @@
* @author Igor Wronsky, Christian Grothoff
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
-#include "gnunet_getopt_lib.h"
#include "fs_api.h"
/* ******************** command-line option parsing API ******************** */
@@ -164,20 +164,20 @@ getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
const char *option,
const char *value)
{
- struct GNUNET_CONTAINER_MetaData **mm = scls;
+ struct GNUNET_FS_MetaData **mm = scls;
#if HAVE_EXTRACTOR_H && HAVE_LIBEXTRACTOR
enum EXTRACTOR_MetaType type;
const char *typename;
const char *typename_i18n;
#endif
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
char *tmp;
meta = *mm;
if (meta == NULL)
{
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
*mm = meta;
}
@@ -197,12 +197,12 @@ getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
(tmp[strlen (typename)] == ':') &&
(0 == strncmp (typename, tmp, strlen (typename))))
{
- GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>", type,
- EXTRACTOR_METAFORMAT_UTF8,
- "text/plain",
- &tmp[strlen (typename) + 1],
- strlen (&tmp[strlen (typename) + 1])
- + 1);
+ GNUNET_FS_meta_data_insert (meta, "<gnunet>", type,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ &tmp[strlen (typename) + 1],
+ strlen (&tmp[strlen (typename) + 1])
+ + 1);
GNUNET_free (tmp);
tmp = NULL;
break;
@@ -211,13 +211,13 @@ getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
(tmp[strlen (typename_i18n)] == ':') &&
(0 == strncmp (typename_i18n, tmp, strlen (typename_i18n))))
{
- GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>", type,
- EXTRACTOR_METAFORMAT_UTF8,
- "text/plain",
- &tmp[strlen (typename_i18n) + 1],
- strlen (&tmp
- [strlen (typename_i18n) + 1])
- + 1);
+ GNUNET_FS_meta_data_insert (meta, "<gnunet>", type,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ &tmp[strlen (typename_i18n) + 1],
+ strlen (&tmp
+ [strlen (typename_i18n) + 1])
+ + 1);
GNUNET_free (tmp);
tmp = NULL;
break;
@@ -227,10 +227,10 @@ getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
if (NULL != tmp)
{
- GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
- EXTRACTOR_METATYPE_UNKNOWN,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain",
- tmp, strlen (tmp) + 1);
+ GNUNET_FS_meta_data_insert (meta, "<gnunet>",
+ EXTRACTOR_METATYPE_UNKNOWN,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ tmp, strlen (tmp) + 1);
GNUNET_free (tmp);
printf (_
(
@@ -255,7 +255,7 @@ GNUNET_FS_GETOPT_METADATA (char shortName,
const char *name,
const char *argumentHelp,
const char *description,
- struct GNUNET_CONTAINER_MetaData **meta)
+ struct GNUNET_FS_MetaData **meta)
{
struct GNUNET_GETOPT_CommandLineOption clo = {
.shortName = shortName,
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c
index 0e16fb01b..78816cad1 100644
--- a/src/fs/fs_list_indexed.c
+++ b/src/fs/fs_list_indexed.c
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunet_constants.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_protocols.h"
#include "fs_api.h"
@@ -148,21 +149,16 @@ mq_error_handler (void *cls,
struct GNUNET_FS_GetIndexedContext *gic = cls;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _ ("Failed to receive response from `%s' service.\n"),
- "fs");
- (void) gic->iterator (gic->iterator_cls, NULL, NULL);
+ "Failed to receive response from `%s' service (error code is %d).\n",
+ "fs",
+ error);
+ (void) gic->iterator (gic->iterator_cls,
+ NULL,
+ NULL);
GNUNET_FS_get_indexed_files_cancel (gic);
}
-/**
- * Iterate over all indexed files.
- *
- * @param h handle to the file sharing subsystem
- * @param iterator function to call on each indexed file
- * @param iterator_cls closure for iterator
- * @return NULL on error ('iter' is not called)
- */
struct GNUNET_FS_GetIndexedContext *
GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h,
GNUNET_FS_IndexedFileProcessor iterator,
diff --git a/src/fs/fs_misc.c b/src/fs/fs_misc.c
index 2e7816d65..a8e23f042 100644
--- a/src/fs/fs_misc.c
+++ b/src/fs/fs_misc.c
@@ -24,6 +24,7 @@
*/
#include "platform.h"
#include "gnunet_constants.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
@@ -35,7 +36,7 @@
* @return NULL if meta data is useless for suggesting a filename
*/
char *
-GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData
+GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_FS_MetaData
*md)
{
static const char *mimeMap[][2] = {
@@ -111,13 +112,13 @@ GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData
const char *ext;
ret =
- GNUNET_CONTAINER_meta_data_get_by_type (md,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
+ GNUNET_FS_meta_data_get_by_type (md,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
if (ret != NULL)
return ret;
ext = NULL;
mime =
- GNUNET_CONTAINER_meta_data_get_by_type (md, EXTRACTOR_METATYPE_MIMETYPE);
+ GNUNET_FS_meta_data_get_by_type (md, EXTRACTOR_METATYPE_MIMETYPE);
if (mime != NULL)
{
i = 0;
@@ -131,24 +132,24 @@ GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData
GNUNET_free (mime);
}
base =
- GNUNET_CONTAINER_meta_data_get_first_by_types (md,
- EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METATYPE_BOOK_TITLE,
- EXTRACTOR_METATYPE_ORIGINAL_TITLE,
- EXTRACTOR_METATYPE_PACKAGE_NAME,
- EXTRACTOR_METATYPE_URL,
- EXTRACTOR_METATYPE_URI,
- EXTRACTOR_METATYPE_DESCRIPTION,
- EXTRACTOR_METATYPE_ISRC,
- EXTRACTOR_METATYPE_JOURNAL_NAME,
- EXTRACTOR_METATYPE_AUTHOR_NAME,
- EXTRACTOR_METATYPE_SUBJECT,
- EXTRACTOR_METATYPE_ALBUM,
- EXTRACTOR_METATYPE_ARTIST,
- EXTRACTOR_METATYPE_KEYWORDS,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_UNKNOWN,
- -1);
+ GNUNET_FS_meta_data_get_first_by_types (md,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_BOOK_TITLE,
+ EXTRACTOR_METATYPE_ORIGINAL_TITLE,
+ EXTRACTOR_METATYPE_PACKAGE_NAME,
+ EXTRACTOR_METATYPE_URL,
+ EXTRACTOR_METATYPE_URI,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_ISRC,
+ EXTRACTOR_METATYPE_JOURNAL_NAME,
+ EXTRACTOR_METATYPE_AUTHOR_NAME,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_ALBUM,
+ EXTRACTOR_METATYPE_ARTIST,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_UNKNOWN,
+ -1);
if ((base == NULL) && (ext == NULL))
return NULL;
if (base == NULL)
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c
index 155486be5..f8b7b91c0 100644
--- a/src/fs/fs_namespace.c
+++ b/src/fs/fs_namespace.c
@@ -28,6 +28,7 @@
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_publish_ublock.h"
@@ -52,7 +53,7 @@ struct NamespaceUpdateNode
/**
* Metadata for this entry.
*/
- struct GNUNET_CONTAINER_MetaData *md;
+ struct GNUNET_FS_MetaData *md;
/**
* URI of this entry in the namespace.
@@ -167,7 +168,7 @@ free_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig)
for (i = 0; i < uig->update_node_count; i++)
{
nsn = uig->update_nodes[i];
- GNUNET_CONTAINER_meta_data_destroy (nsn->md);
+ GNUNET_FS_meta_data_destroy (nsn->md);
GNUNET_FS_uri_destroy (nsn->uri);
GNUNET_free (nsn->id);
GNUNET_free (nsn->update);
@@ -215,7 +216,7 @@ write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig)
uris = GNUNET_FS_uri_to_string (n->uri);
struct GNUNET_BIO_WriteSpec ws[] = {
GNUNET_BIO_write_spec_string ("fs-namespace-node-id", n->id),
- GNUNET_BIO_write_spec_meta_data ("fs-namespace-node-meta", n->md),
+ GNUNET_FS_write_spec_meta_data ("fs-namespace-node-meta", n->md),
GNUNET_BIO_write_spec_string ("fs-namespace-node-update", n->update),
GNUNET_BIO_write_spec_string ("fs-namespace-uris", uris),
GNUNET_BIO_write_spec_end (),
@@ -227,7 +228,7 @@ write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig)
}
GNUNET_free (uris);
}
-END:
+ END:
if (GNUNET_OK != GNUNET_BIO_write_close (wh, NULL))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Failed to write `%s': %s\n"),
@@ -293,7 +294,7 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
n = GNUNET_new (struct NamespaceUpdateNode);
struct GNUNET_BIO_ReadSpec rs[] = {
GNUNET_BIO_read_spec_string ("identifier", &n->id, 1024),
- GNUNET_BIO_read_spec_meta_data ("meta", &n->md),
+ GNUNET_FS_read_spec_meta_data ("meta", &n->md),
GNUNET_BIO_read_spec_string ("update-id", &n->update, 1024),
GNUNET_BIO_read_spec_string ("uri", &uris, 1024 * 2),
GNUNET_BIO_read_spec_end (),
@@ -304,7 +305,7 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
GNUNET_free (n->id);
GNUNET_free (n->update);
if (n->md != NULL)
- GNUNET_CONTAINER_meta_data_destroy (n->md);
+ GNUNET_FS_meta_data_destroy (n->md);
GNUNET_free (n);
break;
}
@@ -316,14 +317,14 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
GNUNET_free (emsg);
GNUNET_free (n->id);
GNUNET_free (n->update);
- GNUNET_CONTAINER_meta_data_destroy (n->md);
+ GNUNET_FS_meta_data_destroy (n->md);
GNUNET_free (n);
break;
}
uig->update_nodes[i] = n;
}
uig->update_node_count = i;
-END:
+ END:
if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -423,27 +424,12 @@ sks_publish_cont (void *cls, const char *msg)
}
-/**
- * Publish an SBlock on GNUnet.
- *
- * @param h handle to the file sharing subsystem
- * @param ns namespace to publish in
- * @param identifier identifier to use
- * @param update update identifier to use
- * @param meta metadata to use
- * @param uri URI to refer to in the SBlock
- * @param bo block options
- * @param options publication options
- * @param cont continuation
- * @param cont_cls closure for cont
- * @return NULL on error ('cont' will still be called)
- */
struct GNUNET_FS_PublishSksContext *
GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns,
const char *identifier,
const char *update,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_FS_BlockOptions *bo,
enum GNUNET_FS_PublishOptions options,
@@ -478,7 +464,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
psc->nsn = GNUNET_new (struct NamespaceUpdateNode);
psc->nsn->id = GNUNET_strdup (identifier);
psc->nsn->update = GNUNET_strdup (update);
- psc->nsn->md = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ psc->nsn->md = GNUNET_FS_meta_data_duplicate (meta);
psc->nsn->uri = GNUNET_FS_uri_dup (uri);
}
psc->uc = GNUNET_FS_publish_ublock_ (h,
@@ -517,7 +503,7 @@ GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc)
GNUNET_FS_uri_destroy (psc->uri);
if (NULL != psc->nsn)
{
- GNUNET_CONTAINER_meta_data_destroy (psc->nsn->md);
+ GNUNET_FS_meta_data_destroy (psc->nsn->md);
GNUNET_FS_uri_destroy (psc->nsn->uri);
GNUNET_free (psc->nsn->id);
GNUNET_free (psc->nsn->update);
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index f891f37a1..d1662c78b 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -28,6 +28,7 @@
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
@@ -699,7 +700,7 @@ check_index_start_failed (void *cls,
size_t msize = ntohs (msg->size) - sizeof(*msg);
const char *emsg = (const char *) &msg[1];
- if (emsg[msize - sizeof(struct GNUNET_MessageHeader) - 1] != '\0')
+ if (emsg[msize - 1] != '\0')
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -1098,8 +1099,8 @@ GNUNET_FS_publish_main_ (void *cls)
* related files as well! */
while (NULL != p->dir)
{
- fn = GNUNET_CONTAINER_meta_data_get_by_type (p->meta,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
+ fn = GNUNET_FS_meta_data_get_by_type (p->meta,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
p = p->dir;
if (fn != NULL)
{
@@ -1193,7 +1194,7 @@ static int
fip_signal_start (void *cls,
struct GNUNET_FS_FileInformation *fi,
uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_MetaData *meta,
struct GNUNET_FS_Uri **uri,
struct GNUNET_FS_BlockOptions *bo,
int *do_index,
@@ -1319,7 +1320,7 @@ static int
fip_signal_suspend (void *cls,
struct GNUNET_FS_FileInformation *fi,
uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_MetaData *meta,
struct GNUNET_FS_Uri **uri,
struct GNUNET_FS_BlockOptions *bo,
int *do_index,
@@ -1523,7 +1524,7 @@ static int
fip_signal_stop (void *cls,
struct GNUNET_FS_FileInformation *fi,
uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_MetaData *meta,
struct GNUNET_FS_Uri **uri,
struct GNUNET_FS_BlockOptions *bo,
int *do_index, void **client_info)
diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c
index 372ac705d..3981ad335 100644
--- a/src/fs/fs_publish_ksk.c
+++ b/src/fs/fs_publish_ksk.c
@@ -30,6 +30,7 @@
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
+
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
@@ -53,7 +54,7 @@ struct GNUNET_FS_PublishKskContext
/**
* Metadata to use.
*/
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
/**
* Global FS context.
@@ -139,12 +140,6 @@ kb_put_cont (void *cls,
}
-/**
- * Continuation of #GNUNET_FS_publish_ksk() that performs the actual
- * publishing operation (iterating over all of the keywords).
- *
- * @param cls closure of type `struct GNUNET_FS_PublishKskContext *`
- */
static void
publish_ksk_cont (void *cls)
{
@@ -192,7 +187,7 @@ publish_ksk_cont (void *cls)
struct GNUNET_FS_PublishKskContext *
GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
const struct GNUNET_FS_Uri *ksk_uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_FS_BlockOptions *bo,
enum GNUNET_FS_PublishOptions options,
@@ -207,7 +202,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
pkc->options = options;
pkc->cont = cont;
pkc->cont_cls = cont_cls;
- pkc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ pkc->meta = GNUNET_FS_meta_data_duplicate (meta);
if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY))
{
pkc->dsh = GNUNET_DATASTORE_connect (h->cfg);
@@ -250,7 +245,7 @@ GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc)
GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
pkc->dsh = NULL;
}
- GNUNET_CONTAINER_meta_data_destroy (pkc->meta);
+ GNUNET_FS_meta_data_destroy (pkc->meta);
GNUNET_FS_uri_destroy (pkc->ksk_uri);
GNUNET_FS_uri_destroy (pkc->uri);
GNUNET_free (pkc);
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c
index fd6f2bd72..ad12d9b08 100644
--- a/src/fs/fs_publish_ublock.c
+++ b/src/fs/fs_publish_ublock.c
@@ -62,15 +62,6 @@ derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
}
-/**
- * Decrypt the given UBlock, storing the result in output.
- *
- * @param input input data
- * @param input_len number of bytes in @a input
- * @param ns public key under which the UBlock was stored
- * @param label label under which the UBlock was stored
- * @param output where to write the result, has input_len bytes
- */
void
GNUNET_FS_ublock_decrypt_ (const void *input,
size_t input_len,
@@ -158,29 +149,13 @@ run_cont (void *cls)
}
-/**
- * Publish a UBlock.
- *
- * @param h handle to the file sharing subsystem
- * @param dsh datastore handle to use for storage operation
- * @param label identifier to use
- * @param ulabel update label to use, may be an empty string for none
- * @param ns namespace to publish in
- * @param meta metadata to use
- * @param uri URI to refer to in the UBlock
- * @param bo per-block options
- * @param options publication options
- * @param cont continuation
- * @param cont_cls closure for @a cont
- * @return NULL on error (@a cont will still be called)
- */
struct GNUNET_FS_PublishUblockContext *
GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
struct GNUNET_DATASTORE_Handle *dsh,
const char *label,
const char *ulabel,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_FS_BlockOptions *bo,
enum GNUNET_FS_PublishOptions options,
@@ -206,7 +181,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
if (NULL == meta)
mdsize = 0;
else
- mdsize = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
+ mdsize = GNUNET_FS_meta_data_get_serialized_size (meta);
GNUNET_assert (mdsize >= 0);
uris = GNUNET_FS_uri_to_string (uri);
slen = strlen (uris) + 1;
@@ -231,8 +206,8 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
sptr = kbe;
if (NULL != meta)
mdsize =
- GNUNET_CONTAINER_meta_data_serialize (meta, &sptr, mdsize,
- GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
+ GNUNET_FS_meta_data_serialize (meta, &sptr, mdsize,
+ GNUNET_FS_META_DATA_SERIALIZE_PART);
if (-1 == mdsize)
{
GNUNET_break (0);
diff --git a/src/fs/fs_publish_ublock.h b/src/fs/fs_publish_ublock.h
index 83c6a50aa..4adffc6c1 100644
--- a/src/fs/fs_publish_ublock.h
+++ b/src/fs/fs_publish_ublock.h
@@ -30,6 +30,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_datastore_service.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_identity_service.h"
@@ -38,7 +39,7 @@
* Decrypt the given UBlock, storing the result in output.
*
* @param input input data
- * @param input_len number of bytes in input
+ * @param input_len number of bytes in @a input
* @param ns public key under which the UBlock was stored
* @param label label under which the UBlock was stored
* @param output where to write the result, has input_len bytes
@@ -81,8 +82,8 @@ typedef void (*GNUNET_FS_UBlockContinuation) (void *cls,
* @param bo per-block options
* @param options publication options
* @param cont continuation
- * @param cont_cls closure for cont
- * @return NULL on error ('cont' will still be called)
+ * @param cont_cls closure for @a cont
+ * @return NULL on error (@a cont will still be called)
*/
struct GNUNET_FS_PublishUblockContext *
GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
@@ -90,7 +91,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
const char *label,
const char *ulabel,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_FS_BlockOptions *bo,
enum GNUNET_FS_PublishOptions options,
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 3dbee43ef..8b8c54c67 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -24,6 +24,7 @@
*/
#include "platform.h"
#include "gnunet_constants.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_protocols.h"
#include "fs_api.h"
@@ -487,7 +488,7 @@ GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr)
struct GNUNET_FS_SearchResult *
GNUNET_FS_probe (struct GNUNET_FS_Handle *h,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
void *client_info,
uint32_t anonymity)
{
@@ -498,7 +499,7 @@ GNUNET_FS_probe (struct GNUNET_FS_Handle *h,
sr = GNUNET_new (struct GNUNET_FS_SearchResult);
sr->h = h;
sr->uri = GNUNET_FS_uri_dup (uri);
- sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ sr->meta = GNUNET_FS_meta_data_duplicate (meta);
sr->client_info = client_info;
sr->anonymity = anonymity;
GNUNET_FS_search_start_probe_ (sr);
@@ -543,7 +544,7 @@ GNUNET_FS_probe_stop (struct GNUNET_FS_SearchResult *sr)
GNUNET_assert (NULL == sr->sc);
GNUNET_FS_search_stop_probe_ (sr);
GNUNET_FS_uri_destroy (sr->uri);
- GNUNET_CONTAINER_meta_data_destroy (sr->meta);
+ GNUNET_FS_meta_data_destroy (sr->meta);
client_info = sr->client_info;
GNUNET_free (sr);
return client_info;
@@ -564,7 +565,7 @@ static void
process_ksk_result (struct GNUNET_FS_SearchContext *sc,
struct SearchRequestEntry *ent,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta)
+ const struct GNUNET_FS_MetaData *meta)
{
struct GNUNET_HashCode key;
struct GNUNET_FS_SearchResult *sr;
@@ -602,7 +603,7 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
sr->sc = sc;
sr->anonymity = sc->anonymity;
sr->uri = GNUNET_FS_uri_dup (uri);
- sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ sr->meta = GNUNET_FS_meta_data_duplicate (meta);
sr->mandatory_missing = sc->mandatory_count;
sr->key = key;
sr->keyword_bitmap = GNUNET_malloc ((sc->uri->data.ksk.keywordCount + 7)
@@ -612,7 +613,7 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
}
else
{
- GNUNET_CONTAINER_meta_data_merge (sr->meta, meta);
+ GNUNET_FS_meta_data_merge (sr->meta, meta);
}
GNUNET_break (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (ent->results,
@@ -685,7 +686,7 @@ static void
process_sks_result (struct GNUNET_FS_SearchContext *sc,
const char *id_update,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta)
+ const struct GNUNET_FS_MetaData *meta)
{
struct GNUNET_FS_Uri uu;
struct GNUNET_HashCode key;
@@ -713,7 +714,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc,
sr->sc = sc;
sr->anonymity = sc->anonymity;
sr->uri = GNUNET_FS_uri_dup (uri);
- sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
+ sr->meta = GNUNET_FS_meta_data_duplicate (meta);
sr->key = key;
GNUNET_CONTAINER_multihashmap_put (sc->master_result_map, &key, sr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
@@ -800,7 +801,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc,
size_t j;
char pt[size - sizeof(struct UBlock)];
const char *eos;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *uri;
char *emsg;
int i;
@@ -835,9 +836,9 @@ process_kblock (struct GNUNET_FS_SearchContext *sc,
}
j = eos - pt + 1;
if (sizeof(pt) == j)
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
else
- meta = GNUNET_CONTAINER_meta_data_deserialize (&pt[j], sizeof(pt) - j);
+ meta = GNUNET_FS_meta_data_deserialize (&pt[j], sizeof(pt) - j);
if (NULL == meta)
{
GNUNET_break_op (0); /* ublock malformed */
@@ -850,7 +851,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc,
meta);
/* clean up */
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_FS_uri_destroy (uri);
}
@@ -872,7 +873,7 @@ process_sblock (struct GNUNET_FS_SearchContext *sc,
size_t len = size - sizeof(struct UBlock);
char pt[len];
struct GNUNET_FS_Uri *uri;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
const char *id;
const char *uris;
size_t off;
@@ -888,8 +889,8 @@ process_sblock (struct GNUNET_FS_SearchContext *sc,
GNUNET_break_op (0); /* ublock malformed */
return;
}
- if (NULL == (meta = GNUNET_CONTAINER_meta_data_deserialize (&pt[off], len
- - off)))
+ if (NULL == (meta = GNUNET_FS_meta_data_deserialize (&pt[off], len
+ - off)))
{
GNUNET_break_op (0); /* ublock malformed */
return;
@@ -901,14 +902,14 @@ process_sblock (struct GNUNET_FS_SearchContext *sc,
uris, emsg);
GNUNET_break_op (0); /* ublock malformed */
GNUNET_free (emsg);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
return;
}
/* process */
process_sks_result (sc, id, uri, meta);
/* clean up */
GNUNET_FS_uri_destroy (uri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
}
@@ -927,7 +928,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc);
* We check a result message from the service.
*
* @param cls closure
- * @param msg result message received
+ * @param cm result message received
*/
static int
check_result (void *cls,
@@ -942,7 +943,7 @@ check_result (void *cls,
* We process a search result from the service.
*
* @param cls closure
- * @param msg result message received
+ * @param cm result message received
*/
static void
handle_result (void *cls,
@@ -1397,13 +1398,6 @@ update_sre_result_maps (void *cls,
}
-/**
- * Build the request and actually initiate the search using the
- * GNUnet FS service.
- *
- * @param sc search context
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
int
GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
{
@@ -1550,19 +1544,13 @@ search_result_suspend (void *cls,
GNUNET_break (NULL == sr->client_info);
GNUNET_free (sr->serialization);
GNUNET_FS_uri_destroy (sr->uri);
- GNUNET_CONTAINER_meta_data_destroy (sr->meta);
+ GNUNET_FS_meta_data_destroy (sr->meta);
GNUNET_free (sr->keyword_bitmap);
GNUNET_free (sr);
return GNUNET_OK;
}
-/**
- * Create SUSPEND event for the given search operation
- * and then clean up our state (without stop signal).
- *
- * @param cls the `struct GNUNET_FS_SearchContext` to signal for
- */
void
GNUNET_FS_search_signal_suspend_ (void *cls)
{
@@ -1762,7 +1750,7 @@ search_result_free (void *cls,
GNUNET_break (NULL == sr->client_info);
GNUNET_free (sr->serialization);
GNUNET_FS_uri_destroy (sr->uri);
- GNUNET_CONTAINER_meta_data_destroy (sr->meta);
+ GNUNET_FS_meta_data_destroy (sr->meta);
GNUNET_free (sr->keyword_bitmap);
GNUNET_free (sr);
return GNUNET_OK;
@@ -1823,7 +1811,10 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc)
{
GNUNET_assert (GNUNET_FS_uri_test_ksk (sc->uri));
for (i = 0; i < sc->uri->data.ksk.keywordCount; i++)
+ {
GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results);
+ GNUNET_free (sc->requests[i].keyword);
+ }
}
GNUNET_free (sc->requests);
GNUNET_free (sc->emsg);
diff --git a/src/fs/fs_sharetree.c b/src/fs/fs_sharetree.c
index 3610b202e..6c246a3ad 100644
--- a/src/fs/fs_sharetree.c
+++ b/src/fs/fs_sharetree.c
@@ -25,6 +25,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_scheduler_lib.h"
#include <pthread.h>
@@ -308,13 +309,13 @@ migrate_and_drop_metadata (void *cls, const struct GNUNET_HashCode *key,
if (counter->count >= tc->move_threshold)
{
if (NULL == tc->pos->meta)
- tc->pos->meta = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_insert (tc->pos->meta,
- counter->plugin_name,
- counter->type,
- counter->format,
- counter->data_mime_type, counter->data,
- counter->data_size);
+ tc->pos->meta = GNUNET_FS_meta_data_create ();
+ GNUNET_FS_meta_data_insert (tc->pos->meta,
+ counter->plugin_name,
+ counter->type,
+ counter->format,
+ counter->data_mime_type, counter->data,
+ counter->data_size);
}
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (tc->metacounter,
@@ -356,12 +357,12 @@ share_tree_trim (struct TrimContext *tc,
{
/* only use filename if it doesn't match $USER */
if (NULL == tree->meta)
- tree->meta = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_insert (tree->meta, "<libgnunetfs>",
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METAFORMAT_UTF8,
- "text/plain", tree->short_filename,
- strlen (tree->short_filename) + 1);
+ tree->meta = GNUNET_FS_meta_data_create ();
+ GNUNET_FS_meta_data_insert (tree->meta, "<libgnunetfs>",
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", tree->short_filename,
+ strlen (tree->short_filename) + 1);
}
}
@@ -372,8 +373,8 @@ share_tree_trim (struct TrimContext *tc,
for (pos = tree->children_head; NULL != pos; pos = pos->next)
{
if (NULL != pos->meta)
- GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter,
- tc->metacounter);
+ GNUNET_FS_meta_data_iterate (pos->meta, &add_to_meta_counter,
+ tc->metacounter);
if (NULL != pos->ksk_uri)
GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter,
tc->keywordcounter);
@@ -444,7 +445,7 @@ GNUNET_FS_share_tree_free (struct GNUNET_FS_ShareTreeItem *toplevel)
toplevel->parent->children_tail,
toplevel);
if (NULL != toplevel->meta)
- GNUNET_CONTAINER_meta_data_destroy (toplevel->meta);
+ GNUNET_FS_meta_data_destroy (toplevel->meta);
if (NULL != toplevel->ksk_uri)
GNUNET_FS_uri_destroy (toplevel->ksk_uri);
GNUNET_free (toplevel->filename);
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index dc4b214d9..f80a2859c 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -177,7 +177,6 @@ struct TestDownloadOperation
* Task scheduled to report on the completion of our publish operation.
*
* @param cls the publish operation context
- * @param tc scheduler context (unused)
*/
static void
report_uri (void *cls)
@@ -430,21 +429,6 @@ publish_fs_connect_complete_cb (void *cls,
}
-/**
- * Publish a file at the given peer.
- *
- * @param peer where to publish
- * @param timeout if this operation cannot be completed within the
- * given period, call the continuation with an error code
- * @param anonymity option for publication
- * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
- * GNUNET_SYSERR for simulation
- * @param size size of the file to publish
- * @param seed seed to use for file generation
- * @param verbose how verbose to be in reporting
- * @param cont function to call when done
- * @param cont_cls closure for cont
- */
void
GNUNET_FS_TEST_publish (struct GNUNET_TESTBED_Peer *peer,
struct GNUNET_TIME_Relative timeout, uint32_t anonymity,
@@ -612,19 +596,6 @@ download_fs_connect_complete_cb (void *cls,
}
-/**
- * Perform test download.
- *
- * @param peer which peer to download from
- * @param timeout if this operation cannot be completed within the
- * given period, call the continuation with an error code
- * @param anonymity option for download
- * @param seed used for file validation
- * @param uri URI of file to download (CHK/LOC only)
- * @param verbose how verbose to be in reporting
- * @param cont function to call when done
- * @param cont_cls closure for cont
- */
void
GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer,
struct GNUNET_TIME_Relative timeout,
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c
index 4d49809f8..65f589966 100644
--- a/src/fs/fs_tree.c
+++ b/src/fs/fs_tree.c
@@ -207,17 +207,6 @@ GNUNET_FS_tree_compute_iblock_size (unsigned int depth, uint64_t end_offset)
}
-/**
- * Compute how many bytes of data should be stored in
- * the specified block.
- *
- * @param fsize overall file size, must be > 0.
- * @param offset offset in the original data corresponding
- * to the beginning of the tree induced by the block;
- * must be <= fsize
- * @param depth depth of the node in the tree, 0 for DBLOCK
- * @return number of bytes stored in this node
- */
size_t
GNUNET_FS_tree_calculate_block_size (uint64_t fsize, uint64_t offset,
unsigned int depth)
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c
index 8c27af9de..68ba667c4 100644
--- a/src/fs/fs_unindex.c
+++ b/src/fs/fs_unindex.c
@@ -26,6 +26,7 @@
*/
#include "platform.h"
#include "gnunet_constants.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_protocols.h"
#include "fs_api.h"
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 2d5566b54..b0be0db4f 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -81,6 +81,7 @@
*
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_signatures.h"
#include "fs_api.h"
@@ -91,14 +92,6 @@
#include <unistdio.h>
-/**
- * Get a unique key from a URI. This is for putting URIs
- * into HashMaps. The key may change between FS implementations.
- *
- * @param uri uri to convert to a unique key
- * @param key where to store the unique key
- * @return #GNUNET_OK on success
- */
int
GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
struct GNUNET_HashCode *key)
@@ -351,7 +344,7 @@ uri_ksk_parse (const char *s, char **emsg)
ret->data.ksk.keywordCount = iret;
ret->data.ksk.keywords = keywords;
return ret;
-CLEANUP:
+ CLEANUP:
for (i = 0; i < max; i++)
GNUNET_free (keywords[i]);
GNUNET_free (keywords);
@@ -628,7 +621,7 @@ uri_loc_parse (const char *s, char **emsg)
uri->data.loc.contentSignature = sig;
return uri;
-ERR:
+ ERR:
return NULL;
}
@@ -723,15 +716,6 @@ GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri)
}
-/**
- * Iterate over all keywords in this keyword URI.
- *
- * @param uri ksk uri to get the keywords from
- * @param iterator function to call on each keyword
- * @param iterator_cls closure for iterator
- * @return -1 if this is not a keyword URI, otherwise number of
- * keywords iterated over until iterator aborted
- */
int
GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri,
GNUNET_FS_KeywordIterator iterator,
@@ -1785,7 +1769,7 @@ gather_uri_data (void *cls,
*/
struct GNUNET_FS_Uri *
GNUNET_FS_uri_ksk_create_from_meta_data (
- const struct GNUNET_CONTAINER_MetaData *md)
+ const struct GNUNET_FS_MetaData *md)
{
struct GNUNET_FS_Uri *ret;
char *filename;
@@ -1799,10 +1783,10 @@ GNUNET_FS_uri_ksk_create_from_meta_data (
return NULL;
ret = GNUNET_new (struct GNUNET_FS_Uri);
ret->type = GNUNET_FS_URI_KSK;
- ent = GNUNET_CONTAINER_meta_data_iterate (md, NULL, NULL);
+ ent = GNUNET_FS_meta_data_iterate (md, NULL, NULL);
if (ent > 0)
{
- full_name = GNUNET_CONTAINER_meta_data_get_first_by_types (
+ full_name = GNUNET_FS_meta_data_get_first_by_types (
md,
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
-1);
@@ -1818,7 +1802,7 @@ GNUNET_FS_uri_ksk_create_from_meta_data (
plus theoretically one more for mime... */
ret->data.ksk.keywords =
GNUNET_new_array ((ent + tok_keywords + paren_keywords) * 3, char *);
- GNUNET_CONTAINER_meta_data_iterate (md, &gather_uri_data, ret);
+ GNUNET_FS_meta_data_iterate (md, &gather_uri_data, ret);
}
if (tok_keywords > 0)
ret->data.ksk.keywordCount +=
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c
index fbb7c6028..b99933cfa 100644
--- a/src/fs/gnunet-daemon-fsprofiler.c
+++ b/src/fs/gnunet-daemon-fsprofiler.c
@@ -27,6 +27,7 @@
* - how to signal driver that we're done?
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_statistics_service.h"
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index ef5c40ae2..ab9f2905a 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -23,6 +23,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
static int ret;
@@ -90,20 +91,20 @@ static void
print_entry (void *cls,
const char *filename,
const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_FS_MetaData *meta,
size_t length,
const void *data)
{
char *string;
char *name;
- name = GNUNET_CONTAINER_meta_data_get_by_type (
+ name = GNUNET_FS_meta_data_get_by_type (
meta,
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
if (uri == NULL)
{
printf (_ ("Directory `%s' meta data:\n"), name ? name : "");
- GNUNET_CONTAINER_meta_data_iterate (meta, &item_printer, NULL);
+ GNUNET_FS_meta_data_iterate (meta, &item_printer, NULL);
printf ("\n");
printf (_ ("Directory `%s' contents:\n"), name ? name : "");
GNUNET_free (name);
@@ -112,7 +113,7 @@ print_entry (void *cls,
string = GNUNET_FS_uri_to_string (uri);
printf ("%s (%s):\n", name ? name : "", string);
GNUNET_free (string);
- GNUNET_CONTAINER_meta_data_iterate (meta, &item_printer, NULL);
+ GNUNET_FS_meta_data_iterate (meta, &item_printer, NULL);
printf ("\n");
GNUNET_free (name);
}
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index eebf8e993..4694077e9 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -26,6 +26,7 @@
* @author Igor Wronsky
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
static int ret;
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 70a0034a0..21e3c4a40 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -23,6 +23,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
/**
@@ -36,6 +37,11 @@ static int ret;
static struct GNUNET_FS_Handle *fs;
/**
+ * Handle for the index listing operation.
+ */
+static struct GNUNET_FS_GetIndexedContext *gic;
+
+/**
* Option -i given?
*/
static int list_indexed_files;
@@ -52,28 +58,55 @@ static unsigned int verbose;
* @param cls closure
* @param filename the name of the file
* @param file_id hash of the contents of the indexed file
- * @return GNUNET_OK to continue iteration
+ * @return #GNUNET_OK to continue iteration
*/
-static int
+static enum GNUNET_GenericReturnValue
print_indexed (void *cls,
const char *filename,
const struct GNUNET_HashCode *file_id)
{
if (NULL == filename)
{
- GNUNET_FS_stop (fs);
- fs = NULL;
+ gic = NULL;
+ GNUNET_SCHEDULER_shutdown ();
return GNUNET_OK;
}
if (verbose)
- fprintf (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename);
+ fprintf (stdout,
+ "%s: %s\n",
+ GNUNET_h2s (file_id),
+ filename);
else
- fprintf (stdout, "%s\n", filename);
+ fprintf (stdout,
+ "%s\n",
+ filename);
return GNUNET_OK;
}
/**
+ * Function run on shutdown.
+ *
+ * @param cls NULL
+ */
+static void
+do_shutdown (void *cls)
+{
+ (void) cls;
+ if (NULL != gic)
+ {
+ GNUNET_FS_get_indexed_files_cancel (gic);
+ gic = NULL;
+ }
+ if (NULL != fs)
+ {
+ GNUNET_FS_stop (fs);
+ fs = NULL;
+ }
+}
+
+
+/**
* Main function that will be run by the scheduler.
*
* @param cls closure
@@ -87,26 +120,29 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- if (list_indexed_files)
+ if (! list_indexed_files)
+ return;
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
+ fs = GNUNET_FS_start (cfg,
+ "gnunet-fs",
+ NULL,
+ NULL,
+ GNUNET_FS_FLAGS_NONE,
+ GNUNET_FS_OPTIONS_END);
+ if (NULL == fs)
+ {
+ ret = 1;
+ return;
+ }
+ gic = GNUNET_FS_get_indexed_files (fs,
+ &print_indexed,
+ NULL);
+ if (NULL == gic)
{
- fs = GNUNET_FS_start (cfg,
- "gnunet-fs",
- NULL,
- NULL,
- GNUNET_FS_FLAGS_NONE,
- GNUNET_FS_OPTIONS_END);
- if (NULL == fs)
- {
- ret = 1;
- return;
- }
- if (NULL == GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL))
- {
- ret = 2;
- GNUNET_FS_stop (fs);
- fs = NULL;
- return;
- }
+ ret = 2;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
}
}
@@ -119,7 +155,8 @@ run (void *cls,
* @return 0 ok, 1 on error
*/
int
-main (int argc, char *const *argv)
+main (int argc,
+ char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('i',
@@ -132,7 +169,9 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END
};
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
ret = (GNUNET_OK ==
GNUNET_PROGRAM_run (argc,
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c
index ef1a9ce4b..0e07b79dc 100644
--- a/src/fs/gnunet-helper-fs-publish.c
+++ b/src/fs/gnunet-helper-fs-publish.c
@@ -27,6 +27,7 @@
* and report the results to stdout.
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
@@ -120,7 +121,7 @@ add_to_md (void *cls,
const char *data,
size_t data_len)
{
- struct GNUNET_CONTAINER_MetaData *md = cls;
+ struct GNUNET_FS_MetaData *md = cls;
if (((EXTRACTOR_METAFORMAT_UTF8 == format) ||
(EXTRACTOR_METAFORMAT_C_STRING == format)) &&
@@ -129,23 +130,23 @@ add_to_md (void *cls,
char zdata[data_len + 1];
GNUNET_memcpy (zdata, data, data_len);
zdata[data_len] = '\0';
- (void) GNUNET_CONTAINER_meta_data_insert (md,
- plugin_name,
- type,
- format,
- data_mime_type,
- zdata,
- data_len + 1);
+ (void) GNUNET_FS_meta_data_insert (md,
+ plugin_name,
+ type,
+ format,
+ data_mime_type,
+ zdata,
+ data_len + 1);
}
else
{
- (void) GNUNET_CONTAINER_meta_data_insert (md,
- plugin_name,
- type,
- format,
- data_mime_type,
- data,
- data_len);
+ (void) GNUNET_FS_meta_data_insert (md,
+ plugin_name,
+ type,
+ format,
+ data_mime_type,
+ data,
+ data_len);
}
return 0;
}
@@ -373,7 +374,7 @@ preprocess_file (const char *filename, struct ScanTreeNode **dst)
static int
extract_files (struct ScanTreeNode *item)
{
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
ssize_t size;
size_t slen;
@@ -390,16 +391,16 @@ extract_files (struct ScanTreeNode *item)
}
/* this is the expensive operation, *afterwards* we'll check for aborts */
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
#if HAVE_LIBEXTRACTOR
EXT