summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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/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/block/bg_bf.c2
-rw-r--r--src/block/block.c7
-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.c26
-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/test_cadet.c2
-rw-r--r--src/cadet/test_cadet_flow.c2
-rw-r--r--src/consensus/consensus_api.c3
-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/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/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.c28
-rw-r--r--src/curl/Makefile.am14
-rw-r--r--src/curl/curl.c16
-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/plugin_datacache_postgres.c104
-rw-r--r--src/datacache/plugin_datacache_sqlite.c2
-rw-r--r--src/datastore/Makefile.am9
-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/plugin_datastore_mysql.c1
-rw-r--r--src/datastore/plugin_datastore_postgres.c136
-rw-r--r--src/datastore/plugin_datastore_sqlite.c1
-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.c19
-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.c66
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h4
-rw-r--r--src/dht/gnunet-service-dht_routing.c2
-rwxr-xr-xsrc/dht/test_dht_tools.sh5
-rw-r--r--src/dhtu/plugin_dhtu_gnunet.c2
-rw-r--r--src/dhtu/plugin_dhtu_ip.c1
-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/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/fragmentation/fragmentation.c1
-rw-r--r--src/fragmentation/fragmentation.h2
-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.c56
-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.c34
-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/meta_data.c (renamed from src/util/container_meta_data.c)517
-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.am27
-rw-r--r--src/gns/gns.conf.in13
-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.c21
-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/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/gnsrecord.c17
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c265
-rw-r--r--src/gnsrecord/gnsrecord_crypto.h2
-rw-r--r--src/gnsrecord/gnsrecord_misc.c72
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c20
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c15
-rw-r--r--src/gnsrecord/json_gnsrecord.c162
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c9
-rw-r--r--src/gnsrecord/test_gnsrecord_block_expiration.c2
-rw-r--r--src/gnsrecord/test_gnsrecord_crypto.c1
-rw-r--r--src/gnsrecord/test_gnsrecord_serialization.c1
-rw-r--r--src/hello/address.c18
-rw-r--r--src/hello/hello-ng.c4
-rw-r--r--src/hello/hello.c22
-rw-r--r--src/hostlist/Makefile.am26
-rw-r--r--src/hostlist/gnunet-daemon-hostlist_client.c9
-rw-r--r--src/identity/Makefile.am21
-rw-r--r--src/identity/gnunet-identity.c89
-rw-r--r--src/identity/gnunet-service-identity.c325
-rw-r--r--src/identity/identity.h75
-rw-r--r--src/identity/identity_api.c378
-rw-r--r--src/identity/identity_api_lookup.c23
-rw-r--r--src/identity/identity_api_suffix_lookup.c25
-rw-r--r--src/identity/plugin_rest_identity.c490
-rw-r--r--src/identity/test_identity.c30
-rw-r--r--src/identity/test_identity_defaults.c299
-rwxr-xr-xsrc/identity/test_identity_messages.sh17
-rwxr-xr-xsrc/identity/test_plugin_rest_identity_signature.sh81
-rw-r--r--src/include/.gitignore4
-rw-r--r--src/include/Makefile.am9
-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/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.h69
-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.h10
-rw-r--r--src/include/gnunet_client_lib.h19
-rw-r--r--src/include/gnunet_common.h51
-rw-r--r--src/include/gnunet_config.h.in58
-rw-r--r--src/include/gnunet_configuration_lib.h9
-rw-r--r--src/include/gnunet_consensus_service.h10
-rw-r--r--src/include/gnunet_container_lib.h492
-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.h47
-rw-r--r--src/include/gnunet_curl_lib.h21
-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_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_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.h8
-rw-r--r--src/include/gnunet_gnsrecord_lib.h145
-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.h12
-rw-r--r--src/include/gnunet_identity_service.h96
-rw-r--r--src/include/gnunet_json_lib.h86
-rw-r--r--src/include/gnunet_load_lib.h6
-rw-r--r--src/include/gnunet_messenger_service.h24
-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.h31
-rw-r--r--src/include/gnunet_mst_lib.h19
-rw-r--r--src/include/gnunet_my_lib.h25
-rw-r--r--src/include/gnunet_mysql_compat.h63
-rw-r--r--src/include/gnunet_mysql_lib.h8
-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.h12
-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.h14
-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.h13
-rw-r--r--src/include/gnunet_pq_lib.h85
-rw-r--r--src/include/gnunet_program_lib.h11
-rw-r--r--src/include/gnunet_protocols.h28
-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.h22
-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_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.h19
-rw-r--r--src/include/gnunet_testbed_logger_service.h6
-rw-r--r--src/include/gnunet_testbed_service.h14
-rw-r--r--src/include/gnunet_testing_lib.h12
-rw-r--r--src/include/gnunet_testing_netjail_lib.h79
-rw-r--r--src/include/gnunet_testing_ng_lib.h5
-rw-r--r--src/include/gnunet_testing_plugin.h6
-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.h11
-rw-r--r--src/include/gnunet_transport_core_service.h6
-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.h6
-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.h49
-rw-r--r--src/include/gnunet_vpn_service.h6
-rw-r--r--src/include/platform.h2
-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.c66
-rw-r--r--src/json/json_pack.c17
-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/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.c19
-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/my.c1
-rw-r--r--src/my/my_query_helper.c15
-rw-r--r--src/my/my_result_helper.c12
-rw-r--r--src/my/test_my.c1
-rw-r--r--src/mysql/mysql.c2
-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/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/.gitignore42
-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.c1404
-rw-r--r--src/namestore/gnunet-service-namestore.c1472
-rw-r--r--src/namestore/gnunet-zoneimport.c22
-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.c592
-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.c405
-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.c6
-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.c62
-rw-r--r--src/namestore/test_namestore_api.conf21
-rw-r--r--src/namestore/test_namestore_api_edit_records.c398
-rw-r--r--src/namestore/test_namestore_api_flat.conf7
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c11
-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.c6
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c47
-rw-r--r--src/namestore/test_namestore_api_postgres.conf3
-rw-r--r--src/namestore/test_namestore_api_remove.c21
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c16
-rw-r--r--src/namestore/test_namestore_api_sqlite.conf1
-rw-r--r--src/namestore/test_namestore_api_store.c5
-rw-r--r--src/namestore/test_namestore_api_store_update.c76
-rw-r--r--src/namestore/test_namestore_api_tx_rollback.c (renamed from src/namestore/test_namestore_api_lookup_private.c)187
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c8
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c17
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c8
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c7
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c9
-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.c21
-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/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/nat_api.c27
-rw-r--r--src/nat/nat_api_stun.c2
-rw-r--r--src/nse/gnunet-service-nse.c2
-rw-r--r--src/nt/nt.c6
-rw-r--r--src/peerinfo/peerinfo.h5
-rw-r--r--src/peerinfo/peerinfo_api.c23
-rw-r--r--src/peerstore/peerstore_api.c11
-rw-r--r--src/peerstore/peerstore_common.c7
-rw-r--r--src/pq/Makefile.am11
-rw-r--r--src/pq/pq.c4
-rw-r--r--src/pq/pq.h10
-rw-r--r--src/pq/pq_connect.c92
-rw-r--r--src/pq/pq_eval.c10
-rw-r--r--src/pq/pq_event.c17
-rw-r--r--src/pq/pq_exec.c13
-rw-r--r--src/pq/pq_prepare.c93
-rw-r--r--src/pq/pq_result_helper.c26
-rw-r--r--src/pq/test_pq.c6
-rw-r--r--src/pq/versioning.sql293
-rw-r--r--src/pt/Makefile.am37
-rw-r--r--src/pt/gnunet-daemon-pt.c2
-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-service-reclaim.c456
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.c117
-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.c132
-rw-r--r--src/reclaim/test_reclaim.conf6
-rw-r--r--src/reclaim/test_reclaim_attribute.c1
-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/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/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.c129
-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/gnunet-revocation-tvg.c8
-rw-r--r--src/revocation/gnunet-revocation.c2
-rw-r--r--src/revocation/gnunet-service-revocation.c50
-rw-r--r--src/revocation/plugin_block_revocation.c63
-rw-r--r--src/revocation/revocation.h7
-rw-r--r--src/revocation/revocation_api.c51
-rw-r--r--src/revocation/test_revocation.c6
-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/scalarproduct_api.c25
-rw-r--r--src/secretsharing/gnunet-service-secretsharing.c1
-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/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/ibf.c1
-rw-r--r--src/set/ibf_sim.c1
-rw-r--r--src/set/set_api.c63
-rw-r--r--src/seti/gnunet-service-seti.c1
-rw-r--r--src/seti/seti_api.c26
-rw-r--r--src/setu/ibf.c31
-rw-r--r--src/setu/ibf_sim.c1
-rw-r--r--src/setu/setu_api.c26
-rw-r--r--src/sq/sq.c13
-rw-r--r--src/sq/sq_prepare.c8
-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/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/testbed_api.c75
-rw-r--r--src/testbed/testbed_api_barriers.c11
-rw-r--r--src/testbed/testbed_api_hosts.c19
-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/gnunet-cmds-helper.c74
-rw-r--r--src/testing/testing.c530
-rw-r--r--src/testing/testing_api_cmd_local_test_prepared.c8
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c65
-rw-r--r--src/testing/testing_api_loop.c12
-rw-r--r--src/testing/testing_cmds.h3
-rw-r--r--src/topology/test_gnunet_daemon_topology.c4
-rw-r--r--src/transport/.gitignore1
-rw-r--r--src/transport/Makefile.am78
-rw-r--r--src/transport/gnunet-communicator-tcp.c41
-rw-r--r--src/transport/gnunet-communicator-udp.c19
-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.c680
-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/plugin_transport_http_client.c12
-rw-r--r--src/transport/plugin_transport_http_common.c45
-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.h2
-rw-r--r--src/transport/tcp_server_legacy.c20
-rw-r--r--src/transport/test_transport_api2_tcp_node1.conf6
-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
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c69
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_broadcast.c70
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_dv.c73
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c77
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_circle.sh1
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_inverse.sh12
-rw-r--r--src/transport/transport-testing-cmds.h10
-rw-r--r--src/transport/transport-testing-communicator.c15
-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.c34
-rw-r--r--src/transport/transport-testing2.h2
-rw-r--r--src/transport/transport.h7
-rw-r--r--src/transport/transport_api2_communication.c105
-rw-r--r--src/transport/transport_api_address_to_string.c4
-rw-r--r--src/transport/transport_api_cmd_backchannel_check.c64
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c35
-rw-r--r--src/transport/transport_api_cmd_send_simple.c52
-rw-r--r--src/transport/transport_api_cmd_start_peer.c11
-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
-rw-r--r--src/util/.gitignore3
-rw-r--r--src/util/Makefile.am14
-rw-r--r--src/util/bandwidth.c36
-rw-r--r--src/util/benchmark.c1
-rw-r--r--src/util/bio.c207
-rw-r--r--src/util/buffer.c2
-rw-r--r--src/util/child_management.c4
-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.c12
-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.c65
-rw-r--r--src/util/container_multihashmap.c128
-rw-r--r--src/util/container_multihashmap32.c80
-rw-r--r--src/util/container_multipeermap.c138
-rw-r--r--src/util/container_multishortmap.c113
-rw-r--r--src/util/container_multiuuidmap.c113
-rw-r--r--src/util/crypto_crc.c42
-rw-r--r--src/util/crypto_cs.c3
-rw-r--r--src/util/crypto_ecc.c25
-rw-r--r--src/util/crypto_ecc_dlog.c4
-rw-r--r--src/util/crypto_ecc_gnsrecord.c4
-rw-r--r--src/util/crypto_ecc_setup.c28
-rw-r--r--src/util/crypto_edx25519.c4
-rw-r--r--src/util/crypto_hash.c7
-rw-r--r--src/util/crypto_hash_file.c11
-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.c5
-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.c6
-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/helper.c49
-rw-r--r--src/util/load.c1
-rw-r--r--src/util/mq.c2
-rw-r--r--src/util/mst.c36
-rw-r--r--src/util/nc.c1
-rw-r--r--src/util/network.c25
-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.c52
-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.c29
-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.c5
-rw-r--r--src/util/test_bio.c142
-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.c1
-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_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/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.c878
-rw-r--r--src/zonemaster/zonemaster.conf.in19
881 files changed, 17002 insertions, 14735 deletions
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/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/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/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..82ba326b4 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
{
/**
@@ -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)
{
@@ -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/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/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/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/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/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..eb5ca7c2b 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -722,22 +722,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..b21153980 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.
@@ -428,8 +432,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 +648,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,
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/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/datastore/Makefile.am b/src/datastore/Makefile.am
index 07ae004b3..b73a0497b 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
@@ -318,4 +324,5 @@ EXTRA_DIST = \
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/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index 216a6faa4..f62c51778 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -121,6 +121,7 @@
#include "gnunet_datastore_plugin.h"
#include "gnunet_util_lib.h"
#include "gnunet_mysql_lib.h"
+#include "gnunet_mysql_compat.h"
#include "gnunet_my_lib.h"
#define MAX_DATUM_SIZE 65536
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/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..1ae9235f8 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");
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..25d69ac65 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
@@ -1771,7 +1775,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 +1889,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 +1924,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 +1937,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 +1969,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),
@@ -2044,7 +2054,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 +2088,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;
}
@@ -2352,7 +2362,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_URL_HELLO == type) ||
+ (GNUNET_BLOCK_TYPE_ANY == type) )
{
GNUNET_STATISTICS_update (GDS_stats,
"# P2P HELLO lookup requests processed",
@@ -2366,7 +2377,7 @@ handle_dht_p2p_get (void *cls,
&get->key,
bg);
}
- else
+ if (GNUNET_BLOCK_TYPE_DHT_URL_HELLO != type)
{
if (0 != (options & GNUNET_DHT_RO_FIND_APPROXIMATE))
eval = GDS_DATACACHE_get_closest (&get->key,
@@ -2473,9 +2484,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 +2509,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 +2548,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 +2558,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 +2760,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,
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/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/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/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/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/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/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..823f046ed 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;
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
EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
#endif
slen = strlen (item->filename) + 1;
- size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
+ size = GNUNET_FS_meta_data_get_serialized_size (meta);
if (-1 == size)
{
/* no meta data */
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
if (GNUNET_OK !=
write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA,
item->filename,
@@ -417,17 +418,17 @@ extract_files (struct ScanTreeNode *item)
char *dst = &buf[slen];
GNUNET_memcpy (buf, item->filename, slen);
- size = GNUNET_CONTAINER_meta_data_serialize (
+ size = GNUNET_FS_meta_data_serialize (
meta,
&dst,
size,
- GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
+ GNUNET_FS_META_DATA_SERIALIZE_PART);
if (size < 0)
{
GNUNET_break (0);
size = 0;
}
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
if (GNUNET_OK !=
write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA,
buf,
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index c62edcd61..59f16210a 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -26,6 +26,7 @@
* @author Igor Wronsky
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
#include "gnunet_identity_service.h"
@@ -57,7 +58,7 @@ static struct GNUNET_FS_PublishContext *pc;
/**
* Meta-data provided via command-line option.
*/
-static struct GNUNET_CONTAINER_MetaData *meta;
+static struct GNUNET_FS_MetaData *meta;
/**
* Keywords provided via command-line option.
@@ -175,7 +176,7 @@ do_stop_task (void *cls)
}
if (NULL != meta)
{
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
meta = NULL;
}
if (NULL != uri)
@@ -376,7 +377,7 @@ static int
publish_inspector (void *cls,
struct GNUNET_FS_FileInformation *fi,
uint64_t length,
- struct GNUNET_CONTAINER_MetaData *m,
+ struct GNUNET_FS_MetaData *m,
struct GNUNET_FS_Uri **uri,
struct GNUNET_FS_BlockOptions *bo,
int *do_index,
@@ -410,20 +411,20 @@ publish_inspector (void *cls,
}
if (NULL != meta)
{
- GNUNET_CONTAINER_meta_data_merge (m, meta);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_merge (m, meta);
+ GNUNET_FS_meta_data_destroy (meta);
meta = NULL;
}
if (enable_creation_time)
- GNUNET_CONTAINER_meta_data_add_publication_date (m);
+ GNUNET_FS_meta_data_add_publication_date (m);
if (extract_only)
{
- fn = GNUNET_CONTAINER_meta_data_get_by_type (
+ fn = GNUNET_FS_meta_data_get_by_type (
m,
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
fs = GNUNET_STRINGS_byte_size_fancy (length);
fprintf (stdout, _ ("Meta data for file `%s' (%s)\n"), fn, fs);
- GNUNET_CONTAINER_meta_data_iterate (m, &meta_printer, NULL);
+ GNUNET_FS_meta_data_iterate (m, &meta_printer, NULL);
fprintf (stdout, _ ("Keywords for file `%s' (%s)\n"), fn, fs);
GNUNET_free (fn);
GNUNET_free (fs);
@@ -521,11 +522,11 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item)
if (GNUNET_YES == item->is_directory)
{
if (NULL == item->meta)
- item->meta = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_delete (item->meta,
- EXTRACTOR_METATYPE_MIMETYPE,
- NULL,
- 0);
+ item->meta = GNUNET_FS_meta_data_create ();
+ GNUNET_FS_meta_data_delete (item->meta,
+ EXTRACTOR_METATYPE_MIMETYPE,
+ NULL,
+ 0);
GNUNET_FS_meta_data_make_directory (item->meta);
if (NULL == item->ksk_uri)
{
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index 7e2e4d2a6..a72cf97cc 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -26,15 +26,16 @@
* @author Igor Wronsky
* @author madmurphy
*/
+#include "platform.h"
#include <ctype.h>
#include <inttypes.h>
#include <limits.h>
-#include "platform.h"
+
#include "gnunet_fs_service.h"
#define GNUNET_SEARCH_log(kind, ...) \
- GNUNET_log_from(kind, "gnunet-search", __VA_ARGS__)
+ GNUNET_log_from (kind, "gnunet-search", __VA_ARGS__)
/* The default settings that we use for the printed output */
@@ -61,14 +62,16 @@
#define GENERIC_FILE_MIMETYPE "application/octet-stream"
-enum GNUNET_SEARCH_MetadataPrinterFlags {
+enum GNUNET_SEARCH_MetadataPrinterFlags
+{
METADATA_PRINTER_FLAG_NONE = 0,
METADATA_PRINTER_FLAG_ONE_RUN = 1,
METADATA_PRINTER_FLAG_HAVE_TYPE = 2
};
-struct GNUNET_SEARCH_MetadataPrinterInfo {
+struct GNUNET_SEARCH_MetadataPrinterInfo
+{
unsigned int counter;
unsigned int flags;
int type;
@@ -114,6 +117,8 @@ static int silent_mode;
static struct GNUNET_SCHEDULER_Task *tt;
+static int stop_searching;
+
/**
* Print the escape sequence at the beginning of a string.
@@ -130,7 +135,7 @@ static const char *
print_escape_sequence (const char *const esc)
{
unsigned int probe;
- const char * cursor = esc + 1;
+ const char *cursor = esc + 1;
char tmp;
switch (*cursor)
{
@@ -148,7 +153,7 @@ print_escape_sequence (const char *const esc)
/* Possibly hexadecimal code point */
case 'x':
probe = 0;
- while (probe < 256 && isxdigit((tmp = *++cursor)))
+ while (probe < 256 && isxdigit ((tmp = *++cursor)))
probe = (probe << 4) + tmp - (tmp > 96 ? 87 : tmp > 64 ? 55 : 48);
goto maybe_codepoint;
@@ -165,7 +170,7 @@ print_escape_sequence (const char *const esc)
default: printf ("\\%c", *cursor); return cursor + 1;
}
-maybe_codepoint:
+ maybe_codepoint:
if (probe < 256)
putchar (probe);
else
@@ -210,31 +215,31 @@ item_printer (void *const cls,
return 0;
const char *cursor = meta_format_string;
- const char *next_spec = strchr(cursor, '%');
- const char *next_esc = strchr(cursor, '\\');
+ const char *next_spec = strchr (cursor, '%');
+ const char *next_esc = strchr (cursor, '\\');
-parse_format:
+ parse_format:
/* If an escape sequence exists before the next format specifier... */
- if (next_esc && (!next_spec || next_esc < next_spec))
+ if (next_esc && (! next_spec || next_esc < next_spec))
{
if (next_esc > cursor)
fwrite (cursor, 1, next_esc - cursor, stdout);
cursor = print_escape_sequence (next_esc);
- next_esc = strchr(cursor, '\\');
+ next_esc = strchr (cursor, '\\');
goto parse_format;
}
/* If a format specifier exists before the next escape sequence... */
- if (next_spec && (!next_esc || next_spec < next_esc))
+ if (next_spec && (! next_esc || next_spec < next_esc))
{
if (next_spec > cursor)
fwrite (cursor, 1, next_spec - cursor, stdout);
switch (*++next_spec)
{
- case '%': putchar('%'); break;
+ case '%': putchar ('%'); break;
case 'i': printf ("%d", type); break;
case 'l': printf ("%lu", (long unsigned int) data_size); break;
case 'n': printf ("%u", info->counter); break;
@@ -247,11 +252,11 @@ parse_format:
break;
#endif
case 'w': printf ("%s", plugin_name); break;
- case '\0': putchar('%'); return 0;
+ case '\0': putchar ('%'); return 0;
default: printf ("%%%c", *next_spec); break;
}
cursor = next_spec + 1;
- next_spec = strchr(cursor, '%');
+ next_spec = strchr (cursor, '%');
goto parse_format;
}
@@ -268,7 +273,7 @@ parse_format:
*
* @param filename the filename for this result
* @param uri the `struct GNUNET_FS_Uri` this result refers to
- * @param metadata the `struct GNUNET_CONTAINER_MetaData` associated with this
+ * @param metadata the `struct GNUNET_FS_MetaData` associated with this
result
* @param resultnum the result number
* @param is_directory GNUNET_YES if this is a directory, otherwise GNUNET_NO
@@ -277,34 +282,34 @@ parse_format:
static void
print_search_result (const char *const filename,
const struct GNUNET_FS_Uri *const uri,
- const struct GNUNET_CONTAINER_MetaData *const metadata,
+ const struct GNUNET_FS_MetaData *const metadata,
const unsigned int resultnum,
const int is_directory)
{
const char *cursor = GNUNET_YES == is_directory ?
- dir_format_string
+ dir_format_string
: format_string;
- const char *next_spec = strchr(cursor, '%');
- const char *next_esc = strchr(cursor, '\\');
+ const char *next_spec = strchr (cursor, '%');
+ const char *next_esc = strchr (cursor, '\\');
char *placeholder;
struct GNUNET_SEARCH_MetadataPrinterInfo info;
-parse_format:
+ parse_format:
/* If an escape sequence exists before the next format specifier... */
- if (next_esc && (!next_spec || next_esc < next_spec))
+ if (next_esc && (! next_spec || next_esc < next_spec))
{
if (next_esc > cursor)
fwrite (cursor, 1, next_esc - cursor, stdout);
cursor = print_escape_sequence (next_esc);
- next_esc = strchr(cursor, '\\');
+ next_esc = strchr (cursor, '\\');
goto parse_format;
}
/* If a format specifier exists before the next escape sequence... */
- if (next_spec && (!next_esc || next_spec < next_esc))
+ if (next_spec && (! next_esc || next_spec < next_esc))
{
if (next_spec > cursor)
fwrite (cursor, 1, next_spec - cursor, stdout);
@@ -315,9 +320,9 @@ parse_format:
case 'a':
info.flags = METADATA_PRINTER_FLAG_NONE;
-iterate_meta:
+ iterate_meta:
info.counter = 0;
- GNUNET_CONTAINER_meta_data_iterate (metadata, &item_printer, &info);
+ GNUNET_FS_meta_data_iterate (metadata, &item_printer, &info);
break;
/* File's name */
case 'f':
@@ -335,11 +340,11 @@ iterate_meta:
/* File name's length */
case 'l':
printf ("%lu",
- (long unsigned int) ( GNUNET_YES == is_directory ?
- strlen(filename) +
- (sizeof(GNUNET_FS_DIRECTORY_EXT) - 1)
+ (long unsigned int) (GNUNET_YES == is_directory ?
+ strlen (filename)
+ + (sizeof(GNUNET_FS_DIRECTORY_EXT) - 1)
:
- strlen(filename)));
+ strlen (filename)));
break;
/* File's mime type */
case 'm':
@@ -348,7 +353,7 @@ iterate_meta:
printf ("%s", GNUNET_FS_DIRECTORY_MIME);
break;
}
- placeholder = GNUNET_CONTAINER_meta_data_get_by_type (
+ placeholder = GNUNET_FS_meta_data_get_by_type (
metadata,
EXTRACTOR_METATYPE_MIMETYPE);
printf ("%s", placeholder ? placeholder : GENERIC_FILE_MIMETYPE);
@@ -374,7 +379,7 @@ iterate_meta:
case '5': case '6': case '7': case '8': case '9':
cursor = next_spec;
info.type = *cursor - 48;
- while (isdigit(*++cursor) && info.type < (INT_MAX - *cursor + 48) / 10)
+ while (isdigit (*++cursor) && info.type < (INT_MAX - *cursor + 48) / 10)
info.type = info.type * 10 + *cursor - 48;
if (info.type == 0 || *cursor != '#')
goto not_a_specifier;
@@ -389,21 +394,21 @@ iterate_meta:
/* Only the first metadata field of type `info.type` */
case 'j':
next_spec = cursor;
- info.flags = METADATA_PRINTER_FLAG_HAVE_TYPE |
- METADATA_PRINTER_FLAG_ONE_RUN;
+ info.flags = METADATA_PRINTER_FLAG_HAVE_TYPE
+ | METADATA_PRINTER_FLAG_ONE_RUN;
goto iterate_meta;
}
goto not_a_specifier;
/* All other cases */
- case '%': putchar('%'); break;
- case '\0': putchar('%'); return;
+ case '%': putchar ('%'); break;
+ case '\0': putchar ('%'); return;
-not_a_specifier:
+ not_a_specifier:
default: printf ("%%%c", *next_spec); break;
}
cursor = next_spec + 1;
- next_spec = strchr(cursor, '%');
+ next_spec = strchr (cursor, '%');
goto parse_format;
}
@@ -437,10 +442,10 @@ clean_task (void *const cls)
GNUNET_DISK_PERM_USER_READ
| GNUNET_DISK_PERM_USER_WRITE))
{
- GNUNET_SEARCH_log(GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to write directory with search results to "
- "`%s'\n"),
- output_filename);
+ GNUNET_SEARCH_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to write directory with search results to "
+ "`%s'\n"),
+ output_filename);
}
GNUNET_free (ddata);
GNUNET_free (output_filename);
@@ -474,7 +479,7 @@ progress_cb (void *const cls,
break;
case GNUNET_FS_STATUS_SEARCH_RESULT:
- if (silent_mode)
+ if (stop_searching)
break;
if (db != NULL)
@@ -484,8 +489,11 @@ progress_cb (void *const cls,
info->value.search.specifics.result.meta,
NULL);
+ if (silent_mode)
+ break;
+
cnt++;
- filename = GNUNET_CONTAINER_meta_data_get_by_type (
+ filename = GNUNET_FS_meta_data_get_by_type (
info->value.search.specifics.result.meta,
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
is_directory = GNUNET_FS_meta_data_test_for_directory (
@@ -496,12 +504,12 @@ progress_cb (void *const cls,
filename[strlen (filename) - 1] = '\0';
GNUNET_DISK_filename_canonicalize (filename);
}
- print_search_result ( filename ?
- filename
+ print_search_result (filename ?
+ filename
: is_directory ?
- GENERIC_DIRECTORY_NAME
+ GENERIC_DIRECTORY_NAME
:
- GENERIC_FILE_NAME,
+ GENERIC_FILE_NAME,
info->value.search.specifics.result.uri,
info->value.search.specifics.result.meta,
cnt,
@@ -513,7 +521,7 @@ progress_cb (void *const cls,
{
GNUNET_SCHEDULER_shutdown ();
/* otherwise the function might keep printing results for a while... */
- silent_mode = GNUNET_YES;
+ stop_searching = GNUNET_YES;
}
break;
@@ -523,9 +531,9 @@ progress_cb (void *const cls,
break;
case GNUNET_FS_STATUS_SEARCH_ERROR:
- GNUNET_SEARCH_log(GNUNET_ERROR_TYPE_ERROR,
- _ ("Error searching: %s.\n"),
- info->value.search.specifics.error.message);
+ GNUNET_SEARCH_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Error searching: %s.\n"),
+ info->value.search.specifics.error.message);
GNUNET_SCHEDULER_shutdown ();
break;
@@ -534,9 +542,9 @@ progress_cb (void *const cls,
break;
default:
- GNUNET_SEARCH_log(GNUNET_ERROR_TYPE_ERROR,
- _ ("Unexpected status: %d\n"),
- info->status);
+ GNUNET_SEARCH_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Unexpected status: %d\n"),
+ info->status);
break;
}
return NULL;
@@ -558,7 +566,7 @@ static void
timeout_task (void *const cls)
{
tt = NULL;
- silent_mode = GNUNET_YES;
+ stop_searching = GNUNET_YES;
GNUNET_SCHEDULER_shutdown ();
}
@@ -595,7 +603,7 @@ run (void *const cls,
ret = 1;
return;
}
- if (silent_mode && !output_filename)
+ if (silent_mode && ! output_filename)
{
fprintf (stderr, _ ("An output file is mandatory for silent mode.\n"));
ret = 1;
@@ -622,7 +630,7 @@ run (void *const cls,
ret = 1;
return;
}
- if (!GNUNET_FS_uri_test_ksk (uri) && !GNUNET_FS_uri_test_sks (uri))
+ if (! GNUNET_FS_uri_test_ksk (uri) && ! GNUNET_FS_uri_test_sks (uri))
{
fprintf (stderr,
"%s",
@@ -635,7 +643,7 @@ run (void *const cls,
}
if (bookmark_only)
{
- char * bmstr = GNUNET_FS_uri_to_string (uri);
+ char *bmstr = GNUNET_FS_uri_to_string (uri);
printf ("%s\n", bmstr);
GNUNET_free (bmstr);
GNUNET_FS_uri_destroy (uri);
@@ -774,15 +782,15 @@ main (int argc, char *const *argv)
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 12;
- if (GNUNET_SYSERR ==
+ if (GNUNET_SYSERR ==
GNUNET_PROGRAM_run (argc,
argv,
"gnunet-search [OPTIONS] KEYWORD1 KEYWORD2 ...",
gettext_noop ("Search for files that have been "
"published on GNUnet\n"),
- options,
- &run,
- NULL))
+ options,
+ &run,
+ NULL))
ret = 1;
GNUNET_free_nz ((void *) argv);
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 05c7e2192..597e89e14 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -30,7 +30,6 @@
#include "gnunet_dht_service.h"
#include "gnunet_datastore_service.h"
#include "gnunet_load_lib.h"
-#include "gnunet_peer_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
@@ -603,7 +602,7 @@ update_latencies (void *cls,
* Check P2P "PUT" message.
*
* @param cls closure with the `struct GSF_ConnectedPeer`
- * @param message the actual message
+ * @param put the actual message
* @return #GNUNET_OK to keep the connection open,
* #GNUNET_SYSERR to close it (signal serious error)
*/
@@ -1041,8 +1040,14 @@ hash_for_index_val (void *cls,
"Hash mismatch trying to index file `%s' which does not have hash `%s'\n"),
isc->filename,
GNUNET_h2s (&isc->file_id));
- env = GNUNET_MQ_msg (msg,
- GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED);
+
+ const char *emsg = "hash mismatch";
+ const size_t msize = strlen(emsg) + 1;
+
+ env = GNUNET_MQ_msg_extra (msg,
+ msize,
+ GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED);
+ memcpy((char*) &msg[1], emsg, msize);
GNUNET_MQ_send (lc->mq,
env);
GNUNET_SERVICE_client_continue (lc->client);
@@ -1057,7 +1062,7 @@ hash_for_index_val (void *cls,
* Handle INDEX_START-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param ism the actual message
*/
static void
handle_client_index_start (void *cls,
@@ -1138,7 +1143,7 @@ handle_client_index_list_get (void *cls,
* Handle UNINDEX-message.
*
* @param cls identification of the client
- * @param message the actual message
+ * @param um the actual message
*/
static void
handle_client_unindex (void *cls,
diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c
index 395842ebb..8bfe91cf0 100644
--- a/src/fs/gnunet-service-fs_cadet_server.c
+++ b/src/fs/gnunet-service-fs_cadet_server.c
@@ -415,7 +415,6 @@ connect_cb (void *cls,
*
* @param cls our `struct CadetClient`
* @param channel channel of the disconnecting client
- * @param channel_ctx
*/
static void
disconnect_cb (void *cls,
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 30b895752..29e4c5910 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -565,15 +565,6 @@ consider_peer_for_forwarding (void *cls,
}
-/**
- * A peer connected to us. Setup the connected peer
- * records.
- *
- * @param cls NULL
- * @param peer identity of peer that connected
- * @param mq message queue for talking to @a peer
- * @return our internal handle for the peer
- */
void *
GSF_peer_connect_handler (void *cls,
const struct GNUNET_PeerIdentity *peer,
@@ -648,12 +639,6 @@ revive_migration (void *cls)
}
-/**
- * Get a handle for a connected peer.
- *
- * @param peer peer's identity
- * @return NULL if the peer is not currently connected
- */
struct GSF_ConnectedPeer *
GSF_peer_get_ (const struct GNUNET_PeerIdentity *peer)
{
@@ -1357,8 +1342,6 @@ handle_p2p_get (void *cls,
* @param cp target peer
* @param is_query is this a query (#GNUNET_YES) or content (#GNUNET_NO) or neither (#GNUNET_SYSERR)
* @param priority how important is this request?
- * @param timeout when does this request timeout
- * @param size number of bytes we would like to send to the peer
* @param env message to send
*/
void
@@ -1488,14 +1471,6 @@ flush_respect (void *cls,
}
-/**
- * A peer disconnected from us. Tear down the connected peer
- * record.
- *
- * @param cls unused
- * @param peer identity of peer that disconnected
- * @param internal_cls the corresponding `struct GSF_ConnectedPeer`
- */
void
GSF_peer_disconnect_handler (void *cls,
const struct GNUNET_PeerIdentity *peer,
@@ -1620,12 +1595,6 @@ call_iterator (void *cls,
}
-/**
- * Iterate over all connected peers.
- *
- * @param it function to call for each peer
- * @param it_cls closure for @a it
- */
void
GSF_iterate_connected_peers_ (GSF_ConnectedPeerIterator it,
void *it_cls)
diff --git a/src/fs/gnunet-service-fs_cp.h b/src/fs/gnunet-service-fs_cp.h
index 54f952778..cea82b10c 100644
--- a/src/fs/gnunet-service-fs_cp.h
+++ b/src/fs/gnunet-service-fs_cp.h
@@ -199,7 +199,7 @@ struct GSF_PeerTransmitHandle;
*
* @param cls NULL
* @param peer identity of peer that connected
- * @param mq queue for sending messages to @a peer
+ * @param mq message queue for talking to @a peer
* @return internal handle for the peer
*/
void *
@@ -333,8 +333,8 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
* record.
*
* @param cls unused
- * @param peer identity of peer that connected
- * @param internal_cls our `struct GSF_ConnectedPeer` for @a peer
+ * @param peer identity of peer that disconnected
+ * @param internal_cls the corresponding `struct GSF_ConnectedPeer`
*/
void
GSF_peer_disconnect_handler (void *cls,
@@ -391,7 +391,7 @@ GSF_connected_peer_get_identity2_ (const struct GSF_ConnectedPeer *cp);
* Iterate over all connected peers.
*
* @param it function to call for each peer
- * @param it_cls closure for it
+ * @param it_cls closure for @a it
*/
void
GSF_iterate_connected_peers_ (GSF_ConnectedPeerIterator it, void *it_cls);
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index f4d560176..8fb34c067 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -27,7 +27,6 @@
#include <float.h>
#include "gnunet_core_service.h"
#include "gnunet_datastore_service.h"
-#include "gnunet_peer_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
@@ -246,26 +245,6 @@ remove_cont (void *cls,
}
-/**
- * We've received an on-demand encoded block from the datastore.
- * Attempt to do on-demand encoding and (if successful), call the
- * continuation with the resulting block. On error, clean up and ask
- * the datastore for more results.
- *
- * @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
- * @param cont function to call with the actual block (at most once, on success)
- * @param cont_cls closure for cont
- * @return GNUNET_OK on success
- */
int
GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode *key,
uint32_t size,
@@ -501,12 +480,6 @@ GNUNET_FS_indexing_done ()
}
-/**
- * Initialize the indexing submodule.
- *
- * @param c configuration to use
- * @param d datastore to use
- */
int
GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_DATASTORE_Handle *d)
diff --git a/src/fs/gnunet-service-fs_indexing.h b/src/fs/gnunet-service-fs_indexing.h
index 546dbb172..244a51900 100644
--- a/src/fs/gnunet-service-fs_indexing.h
+++ b/src/fs/gnunet-service-fs_indexing.h
@@ -29,7 +29,6 @@
#include "gnunet_block_lib.h"
#include "gnunet_core_service.h"
#include "gnunet_datastore_service.h"
-#include "gnunet_peer_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index ee2dbca32..b938e3593 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -274,26 +274,6 @@ refresh_bloomfilter (enum GNUNET_BLOCK_Type type,
}
-/**
- * Create a new pending request.
- *
- * @param options request options
- * @param type type of the block that is being requested
- * @param query key for the lookup
- * @param target preferred target for the request, NULL for none
- * @param bf_data raw data for bloom filter for known replies, can be NULL
- * @param bf_size number of bytes in @a bf_data
- * @param anonymity_level desired anonymity level
- * @param priority maximum outgoing cumulative request priority to use
- * @param ttl current time-to-live for the request
- * @param sender_pid peer ID to use for the sender when forwarding, 0 for none
- * @param origin_pid peer ID of origin of query (do not loop back)
- * @param replies_seen hash codes of known local replies
- * @param replies_seen_count size of the @a replies_seen array
- * @param rh handle to call when we get a reply
- * @param rh_cls closure for @a rh
- * @return handle for the new pending request
- */
struct GSF_PendingRequest *
GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
enum GNUNET_BLOCK_Type type,
@@ -455,14 +435,6 @@ GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra,
}
-/**
- * Update a given pending request with additional replies
- * that have been seen.
- *
- * @param pr request to update
- * @param replies_seen hash codes of replies that we've seen
- * @param replies_seen_count size of the replies_seen array
- */
void
GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
const struct GNUNET_HashCode *replies_seen,
@@ -714,12 +686,6 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup)
}
-/**
- * Iterate over all pending requests.
- *
- * @param it function to call for each request
- * @param cls closure for @a it
- */
void
GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, void *cls)
{
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index 1825e8eb3..92dbba8e6 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -201,7 +201,7 @@ delete_migration_block (struct MigrationReadyBlock *mb)
/**
* Find content for migration to this peer.
*
- * @param cls a `struct MigrationReadyPeer *`
+ * @param cls A `struct MigrationReadyPeer *` to find content for
*/
static void
find_content (void *cls);
@@ -210,7 +210,7 @@ find_content (void *cls);
/**
* Send the given block to the given peer.
*
- * @param peer target peer
+ * @param mrp target peer
* @param block the block
* @return #GNUNET_YES if the block was deleted (!)
*/
@@ -325,11 +325,6 @@ static void
consider_gathering (void);
-/**
- * Find content for migration to this peer.
- *
- * @param cls peer to find content for
- */
static void
find_content (void *cls)
{
diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c
index 93333b7a2..ca2c85724 100644
--- a/src/fs/gnunet-service-fs_put.c
+++ b/src/fs/gnunet-service-fs_put.c
@@ -97,7 +97,6 @@ static struct PutOperator operators[] = {
* Task that is run periodically to obtain blocks for DHT PUTs.
*
* @param cls type of blocks to gather
- * @param tc scheduler context (unused)
*/
static void
gather_dht_put_blocks (void *cls);
@@ -219,11 +218,6 @@ process_dht_put_content (void *cls,
}
-/**
- * Task that is run periodically to obtain blocks for DHT PUTs.
- *
- * @param cls type of blocks to gather
- */
static void
gather_dht_put_blocks (void *cls)
{
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c
index afc547127..326f75a63 100644
--- a/src/fs/gnunet-unindex.c
+++ b/src/fs/gnunet-unindex.c
@@ -26,6 +26,7 @@
* @author Igor Wronsky
*/
#include "platform.h"
+
#include "gnunet_fs_service.h"
static int ret;
diff --git a/src/util/container_meta_data.c b/src/fs/meta_data.c
index 2c477db40..7112a150a 100644
--- a/src/util/container_meta_data.c
+++ b/src/fs/meta_data.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 GNUnet e.V.
+ Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 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
@@ -19,103 +19,28 @@
*/
/**
- * @file util/container_meta_data.c
+ * @file fs/meta_data.c
* @brief Storing of meta data
* @author Christian Grothoff
+ * @author Martin Schanzenbach
*/
+
#include "platform.h"
#include "gnunet_util_lib.h"
-#if HAVE_EXTRACTOR_H
-#include <extractor.h>
-#endif
-#include <zlib.h>
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "util-container-meta-data", \
- __VA_ARGS__)
+#include "gnunet_fs_service.h"
/**
- * Try to compress the given block of data using libz. Only returns
- * the compressed block if compression worked and the new block is
- * actually smaller. Decompress using #GNUNET_decompress().
- *
- * @param data block to compress; if compression
- * resulted in a smaller block, the first
- * bytes of data are updated to the compressed
- * data
- * @param old_size number of bytes in data
- * @param[out] result set to the compressed data, if compression worked
- * @param[out] new_size set to size of result, if compression worked
- * @return #GNUNET_YES if compression reduce the size,
- * #GNUNET_NO if compression did not help
+ * Maximum size allowed for meta data written/read from disk.
+ * File-sharing limits to 64k, so this should be rather generous.
*/
-int
-GNUNET_try_compression (const char *data,
- size_t old_size,
- char **result,
- size_t *new_size)
-{
- char *tmp;
- uLongf dlen;
-
- *result = NULL;
- *new_size = 0;
-#ifdef compressBound
- dlen = compressBound (old_size);
-#else
- dlen = old_size + (old_size / 100) + 20;
- /* documentation says 100.1% oldSize + 12 bytes, but we
- * should be able to overshoot by more to be safe */
-#endif
- tmp = GNUNET_malloc (dlen);
- if (Z_OK ==
- compress2 ((Bytef *) tmp,
- &dlen,
- (const Bytef *) data,
- old_size, 9))
- {
- if (dlen < old_size)
- {
- *result = tmp;
- *new_size = dlen;
- return GNUNET_YES;
- }
- }
- GNUNET_free (tmp);
- return GNUNET_NO;
-}
+#define MAX_META_DATA (1024 * 1024)
-/**
- * Decompress input, return the decompressed data as output. Dual to
- * #GNUNET_try_compression(). Caller must set @a output_size to the
- * number of bytes that were originally compressed.
- *
- * @param input compressed data
- * @param input_size number of bytes in input
- * @param output_size expected size of the output
- * @return NULL on error, buffer of @a output_size decompressed bytes otherwise
- */
-char *
-GNUNET_decompress (const char *input,
- size_t input_size,
- size_t output_size)
-{
- char *output;
- uLongf olen;
-
- olen = output_size;
- output = GNUNET_malloc (olen);
- if (Z_OK ==
- uncompress ((Bytef *) output,
- &olen,
- (const Bytef *) input,
- input_size))
- return output;
- GNUNET_free (output);
- return NULL;
-}
+#define LOG(kind, ...) GNUNET_log_from (kind, "fs-meta-data", \
+ __VA_ARGS__)
+
/**
@@ -167,7 +92,7 @@ struct MetaItem
/**
* Meta data to associate with a file, directory or namespace.
*/
-struct GNUNET_CONTAINER_MetaData
+struct GNUNET_FS_MetaData
{
/**
* Head of linked list of the meta data items.
@@ -198,14 +123,14 @@ struct GNUNET_CONTAINER_MetaData
/**
- * Create a fresh struct CONTAINER_MetaData token.
+ * Create a fresh struct FS_MetaData token.
*
* @return empty meta-data container
*/
-struct GNUNET_CONTAINER_MetaData *
-GNUNET_CONTAINER_meta_data_create ()
+struct GNUNET_FS_MetaData *
+GNUNET_FS_meta_data_create ()
{
- return GNUNET_new (struct GNUNET_CONTAINER_MetaData);
+ return GNUNET_new (struct GNUNET_FS_MetaData);
}
@@ -231,7 +156,7 @@ meta_item_free (struct MetaItem *mi)
* @param md meta data that changed
*/
static void
-invalidate_sbuf (struct GNUNET_CONTAINER_MetaData *md)
+invalidate_sbuf (struct GNUNET_FS_MetaData *md)
{
if (NULL == md->sbuf)
return;
@@ -241,13 +166,8 @@ invalidate_sbuf (struct GNUNET_CONTAINER_MetaData *md)
}
-/**
- * Free meta data.
- *
- * @param md what to free
- */
void
-GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md)
+GNUNET_FS_meta_data_destroy (struct GNUNET_FS_MetaData *md)
{
struct MetaItem *pos;
@@ -263,13 +183,8 @@ GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md)
}
-/**
- * Remove all items in the container.
- *
- * @param md metadata to manipulate
- */
void
-GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
+GNUNET_FS_meta_data_clear (struct GNUNET_FS_MetaData *md)
{
struct MetaItem *mi;
@@ -281,25 +196,15 @@ GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
meta_item_free (mi);
}
GNUNET_free (md->sbuf);
- memset (md, 0, sizeof(struct GNUNET_CONTAINER_MetaData));
+ memset (md, 0, sizeof(struct GNUNET_FS_MetaData));
}
-/**
- * Test if two MDs are equal. We consider them equal if
- * the meta types, formats and content match (we do not
- * include the mime types and plugins names in this
- * consideration).
- *
- * @param md1 first value to check
- * @param md2 other value to check
- * @return #GNUNET_YES if they are equal
- */
int
-GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
- *md1,
- const struct GNUNET_CONTAINER_MetaData
- *md2)
+GNUNET_FS_meta_data_test_equal (const struct GNUNET_FS_MetaData
+ *md1,
+ const struct GNUNET_FS_MetaData
+ *md2)
{
struct MetaItem *i;
struct MetaItem *j;
@@ -350,12 +255,12 @@ GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
* data_mime_type and plugin_name are not considered for "exists" checks
*/
int
-GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
- const char *plugin_name,
- enum EXTRACTOR_MetaType type,
- enum EXTRACTOR_MetaFormat format,
- const char *data_mime_type, const char *data,
- size_t data_size)
+GNUNET_FS_meta_data_insert (struct GNUNET_FS_MetaData *md,
+ const char *plugin_name,
+ enum EXTRACTOR_MetaType type,
+ enum EXTRACTOR_MetaFormat format,
+ const char *data_mime_type, const char *data,
+ size_t data_size)
{
struct MetaItem *pos;
struct MetaItem *mi;
@@ -425,7 +330,7 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
/**
* Merge given meta data.
*
- * @param cls the `struct GNUNET_CONTAINER_MetaData` to merge into
+ * @param cls the `struct GNUNET_FS_MetaData` to merge into
* @param plugin_name name of the plugin that produced this value;
* special values can be used (e.g. '&lt;zlib&gt;' for zlib being
* used in the main libextractor library and yielding
@@ -443,43 +348,26 @@ merge_helper (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
const char *data, size_t data_size)
{
- struct GNUNET_CONTAINER_MetaData *md = cls;
+ struct GNUNET_FS_MetaData *md = cls;
- (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
- data_mime_type, data, data_size);
+ (void) GNUNET_FS_meta_data_insert (md, plugin_name, type, format,
+ data_mime_type, data, data_size);
return 0;
}
-/**
- * Extend metadata. Merges the meta data from the second argument
- * into the first, discarding duplicate key-value pairs.
- *
- * @param md metadata to extend
- * @param in metadata to merge
- */
void
-GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
- const struct GNUNET_CONTAINER_MetaData *in)
+GNUNET_FS_meta_data_merge (struct GNUNET_FS_MetaData *md,
+ const struct GNUNET_FS_MetaData *in)
{
- GNUNET_CONTAINER_meta_data_iterate (in, &merge_helper, md);
+ GNUNET_FS_meta_data_iterate (in, &merge_helper, md);
}
-/**
- * Remove an item.
- *
- * @param md metadata to manipulate
- * @param type type of the item to remove
- * @param data specific value to remove, NULL to remove all
- * entries of the given type
- * @param data_size number of bytes in @a data
- * @return #GNUNET_OK on success, #GNUNET_SYSERR if the item does not exist in md
- */
int
-GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
- enum EXTRACTOR_MetaType type,
- const char *data, size_t data_size)
+GNUNET_FS_meta_data_delete (struct GNUNET_FS_MetaData *md,
+ enum EXTRACTOR_MetaType type,
+ const char *data, size_t data_size)
{
struct MetaItem *pos;
@@ -503,28 +391,22 @@ GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
}
-/**
- * Add the current time as the publication date
- * to the meta-data.
- *
- * @param md metadata to modify
- */
void
-GNUNET_CONTAINER_meta_data_add_publication_date (struct
- GNUNET_CONTAINER_MetaData *md)
+GNUNET_FS_meta_data_add_publication_date (struct
+ GNUNET_FS_MetaData *md)
{
const char *dat;
struct GNUNET_TIME_Absolute t;
t = GNUNET_TIME_absolute_get ();
- GNUNET_CONTAINER_meta_data_delete (md,
- EXTRACTOR_METATYPE_PUBLICATION_DATE,
- NULL, 0);
+ GNUNET_FS_meta_data_delete (md,
+ EXTRACTOR_METATYPE_PUBLICATION_DATE,
+ NULL, 0);
dat = GNUNET_STRINGS_absolute_time_to_string (t);
- GNUNET_CONTAINER_meta_data_insert (md, "<gnunet>",
- EXTRACTOR_METATYPE_PUBLICATION_DATE,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain",
- dat, strlen (dat) + 1);
+ GNUNET_FS_meta_data_insert (md, "<gnunet>",
+ EXTRACTOR_METATYPE_PUBLICATION_DATE,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ dat, strlen (dat) + 1);
}
@@ -537,9 +419,9 @@ GNUNET_CONTAINER_meta_data_add_publication_date (struct
* @return number of entries
*/
int
-GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
- EXTRACTOR_MetaDataProcessor iter,
- void *iter_cls)
+GNUNET_FS_meta_data_iterate (const struct GNUNET_FS_MetaData *md,
+ EXTRACTOR_MetaDataProcessor iter,
+ void *iter_cls)
{
struct MetaItem *pos;
@@ -556,20 +438,10 @@ GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
}
-/**
- * Get the first MD entry of the given type. Caller
- * is responsible for freeing the return value.
- * Also, only meta data items that are strings (0-terminated)
- * are returned by this function.
- *
- * @param md metadata to inspect
- * @param type type to look for
- * @return NULL if no entry was found
- */
char *
-GNUNET_CONTAINER_meta_data_get_by_type (const struct
- GNUNET_CONTAINER_MetaData *md,
- enum EXTRACTOR_MetaType type)
+GNUNET_FS_meta_data_get_by_type (const struct
+ GNUNET_FS_MetaData *md,
+ enum EXTRACTOR_MetaType type)
{
struct MetaItem *pos;
@@ -584,21 +456,10 @@ GNUNET_CONTAINER_meta_data_get_by_type (const struct
}
-/**
- * Get the first matching MD entry of the given types. Caller is
- * responsible for freeing the return value. Also, only meta data
- * items that are strings (0-terminated) are returned by this
- * function.
- *
- * @param md metadata to inspect
- * @param ... -1-terminated list of types
- * @return NULL if we do not have any such entry,
- * otherwise client is responsible for freeing the value!
- */
char *
-GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
- GNUNET_CONTAINER_MetaData *md,
- ...)
+GNUNET_FS_meta_data_get_first_by_types (const struct
+ GNUNET_FS_MetaData *md,
+ ...)
{
char *ret;
va_list args;
@@ -613,7 +474,7 @@ GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
type = va_arg (args, int);
if (-1 == type)
break;
- if (NULL != (ret = GNUNET_CONTAINER_meta_data_get_by_type (md, type)))
+ if (NULL != (ret = GNUNET_FS_meta_data_get_by_type (md, type)))
break;
}
va_end (args);
@@ -630,8 +491,8 @@ GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
* @return number of bytes in thumbnail, 0 if not available
*/
size_t
-GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
- *md, unsigned char **thumb)
+GNUNET_FS_meta_data_get_thumbnail (const struct GNUNET_FS_MetaData
+ *md, unsigned char **thumb)
{
struct MetaItem *pos;
struct MetaItem *match;
@@ -661,25 +522,25 @@ GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
/**
- * Duplicate a `struct GNUNET_CONTAINER_MetaData`.
+ * Duplicate a `struct GNUNET_FS_MetaData`.
*
* @param md what to duplicate
* @return duplicate meta-data container
*/
-struct GNUNET_CONTAINER_MetaData *
-GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
- *md)
+struct GNUNET_FS_MetaData *
+GNUNET_FS_meta_data_duplicate (const struct GNUNET_FS_MetaData
+ *md)
{
- struct GNUNET_CONTAINER_MetaData *ret;
+ struct GNUNET_FS_MetaData *ret;
struct MetaItem *pos;
if (NULL == md)
return NULL;
- ret = GNUNET_CONTAINER_meta_data_create ();
+ ret = GNUNET_FS_meta_data_create ();
for (pos = md->items_tail; NULL != pos; pos = pos->prev)
- GNUNET_CONTAINER_meta_data_insert (ret, pos->plugin_name, pos->type,
- pos->format, pos->mime_type, pos->data,
- pos->data_size);
+ GNUNET_FS_meta_data_insert (ret, pos->plugin_name, pos->type,
+ pos->format, pos->mime_type, pos->data,
+ pos->data_size);
return ret;
}
@@ -777,13 +638,13 @@ struct MetaDataEntry
* space)
*/
ssize_t
-GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
- *md, char **target, size_t max,
- enum
- GNUNET_CONTAINER_MetaDataSerializationOptions
- opt)
+GNUNET_FS_meta_data_serialize (const struct GNUNET_FS_MetaData
+ *md, char **target, size_t max,
+ enum
+ GNUNET_FS_MetaDataSerializationOptions
+ opt)
{
- struct GNUNET_CONTAINER_MetaData *vmd;
+ struct GNUNET_FS_MetaData *vmd;
struct MetaItem *pos;
struct MetaDataHeader ihdr;
struct MetaDataHeader *hdr;
@@ -817,7 +678,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
GNUNET_memcpy (*target, md->sbuf, md->sbuf_size);
return md->sbuf_size;
}
- if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
+ if (0 == (opt & GNUNET_FS_META_DATA_SERIALIZE_PART))
return GNUNET_SYSERR; /* can say that this will fail */
/* need to compute a partial serialization, sbuf useless ... */
}
@@ -884,7 +745,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
for (pos = md->items_head; NULL != pos; pos = pos->next)
{
comp = GNUNET_NO;
- if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS))
+ if (0 == (opt & GNUNET_FS_META_DATA_SERIALIZE_NO_COMPRESS))
comp = GNUNET_try_compression ((const char *) &ent[i],
left,
&cdata,
@@ -895,7 +756,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
/* fill 'sbuf'; this "modifies" md, but since this is only
* an internal cache we will cast away the 'const' instead
* of making the API look strange. */
- vmd = (struct GNUNET_CONTAINER_MetaData *) md;
+ vmd = (struct GNUNET_FS_MetaData *) md;
hdr = GNUNET_malloc (left + sizeof(struct MetaDataHeader));
hdr->size = htonl (left);
hdr->entries = htonl (md->item_count);
@@ -960,7 +821,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
return rlen;
}
- if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
+ if (0 == (opt & GNUNET_FS_META_DATA_SERIALIZE_PART))
{
/* does not fit! */
GNUNET_free (ent);
@@ -997,15 +858,9 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
}
-/**
- * Get the size of the full meta-data in serialized form.
- *
- * @param md metadata to inspect
- * @return number of bytes needed for serialization, -1 on error
- */
ssize_t
-GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
- GNUNET_CONTAINER_MetaData *md)
+GNUNET_FS_meta_data_get_serialized_size (const struct
+ GNUNET_FS_MetaData *md)
{
ssize_t ret;
char *ptr;
@@ -1014,8 +869,8 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
return md->sbuf_size;
ptr = NULL;
ret =
- GNUNET_CONTAINER_meta_data_serialize (md, &ptr, GNUNET_MAX_MALLOC_CHECKED,
- GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
+ GNUNET_FS_meta_data_serialize (md, &ptr, GNUNET_MAX_MALLOC_CHECKED,
+ GNUNET_FS_META_DATA_SERIALIZE_FULL);
if (-1 != ret)
GNUNET_free (ptr);
return ret;
@@ -1030,10 +885,10 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
* @return MD on success, NULL on error (i.e.
* bad format)
*/
-struct GNUNET_CONTAINER_MetaData *
-GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
+struct GNUNET_FS_MetaData *
+GNUNET_FS_meta_data_deserialize (const char *input, size_t size)
{
- struct GNUNET_CONTAINER_MetaData *md;
+ struct GNUNET_FS_MetaData *md;
struct MetaDataHeader hdr;
struct MetaDataEntry ent;
uint32_t ic;
@@ -1108,7 +963,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
}
}
- md = GNUNET_CONTAINER_meta_data_create ();
+ md = GNUNET_FS_meta_data_create ();
left = dataSize - ic * sizeof(struct MetaDataEntry);
mdata = &cdata[ic * sizeof(struct MetaDataEntry)];
for (i = 0; i < ic; i++)
@@ -1178,14 +1033,200 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
mime_type = NULL;
else
mime_type = &mdata[left];
- GNUNET_CONTAINER_meta_data_insert (md, plugin_name,
- (enum EXTRACTOR_MetaType)
- ntohl (ent.type), format, mime_type,
- meta_data, dlen);
+ GNUNET_FS_meta_data_insert (md, plugin_name,
+ (enum EXTRACTOR_MetaType)
+ ntohl (ent.type), format, mime_type,
+ meta_data, dlen);
}
GNUNET_free (data);
return md;
}
+/**
+ * Read a metadata container.
+ *
+ * @param h handle to an open file
+ * @param what describes what is being read (for error message creation)
+ * @param result the buffer to store a pointer to the (allocated) metadata
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
+ */
+int
+GNUNET_FS_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
+ const char *what,
+ struct GNUNET_FS_MetaData **result)
+{
+ uint32_t size;
+ char *buf;
+ char *emsg;
+ struct GNUNET_FS_MetaData *meta;
+
+ if (GNUNET_OK != GNUNET_BIO_read_int32 (h,
+ _ ("metadata length"),
+ (int32_t *) &size))
+ return GNUNET_SYSERR;
+ if (0 == size)
+ {
+ *result = NULL;
+ return GNUNET_OK;
+ }
+ if (MAX_META_DATA < size)
+ {
+ GNUNET_asprintf (&emsg,
+ _ (
+ "Serialized metadata `%s' larger than allowed (%u > %u)\n"),
+ what,
+ size,
+ MAX_META_DATA);
+ GNUNET_BIO_read_set_error (h, emsg);
+ GNUNET_free (emsg);
+ return GNUNET_SYSERR;
+ }
+ buf = GNUNET_malloc (size);
+ if (GNUNET_OK != GNUNET_BIO_read (h, what, buf, size))
+ {
+ GNUNET_free (buf);
+ return GNUNET_SYSERR;
+ }
+ meta = GNUNET_FS_meta_data_deserialize (buf, size);
+ if (NULL == meta)
+ {
+ GNUNET_free (buf);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to deserialize metadata `%s'"), what);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (buf);
+ *result = meta;
+ return GNUNET_OK;
+}
+
+/**
+ * Write a metadata container.
+ *
+ * @param h the IO handle to write to
+ * @param what what is being written (for error message creation)
+ * @param m metadata to write
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_FS_write_meta_data (struct GNUNET_BIO_WriteHandle *h,
+ const char *what,
+ const struct GNUNET_FS_MetaData *m)
+{
+ ssize_t size;
+ char *buf;
+
+ if (m == NULL)
+ return GNUNET_BIO_write_int32 (h, _ ("metadata length"), 0);
+ buf = NULL;
+ size = GNUNET_FS_meta_data_serialize (m,
+ &buf,
+ MAX_META_DATA,
+ GNUNET_FS_META_DATA_SERIALIZE_PART);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Serialized %ld bytes of metadata"),
+ size);
+
+ if (-1 == size)
+ {
+ GNUNET_free (buf);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to serialize metadata `%s'"),
+ what);
+ return GNUNET_SYSERR;
+ }
+ if ((GNUNET_OK != GNUNET_BIO_write_int32 (h,
+ _ ("metadata length"),
+ (uint32_t) size))
+ || (GNUNET_OK != GNUNET_BIO_write (h, what, buf, size)))
+ {
+ GNUNET_free (buf);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (buf);
+ return GNUNET_OK;
+}
+
+/**
+ * Function used internally to read a metadata container from within a read
+ * spec.
+ *
+ * @param cls ignored, always NULL
+ * @param h the IO handle to read from
+ * @param what what is being read (for error message creation)
+ * @param target where to store the data
+ * @param target_size ignored
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+static int
+read_spec_handler_meta_data (void *cls,
+ struct GNUNET_BIO_ReadHandle *h,
+ const char *what,
+ void *target,
+ size_t target_size)
+{
+ struct GNUNET_FS_MetaData **result = target;
+ return GNUNET_FS_read_meta_data (h, what, result);
+}
+
+/**
+ * Create the specification to read a metadata container.
+ *
+ * @param what describes what is being read (for error message creation)
+ * @param result the buffer to store a pointer to the (allocated) metadata
+ * @return the read spec
+ */
+struct GNUNET_BIO_ReadSpec
+GNUNET_FS_read_spec_meta_data (const char *what,
+ struct GNUNET_FS_MetaData **result)
+{
+ struct GNUNET_BIO_ReadSpec rs = {
+ .rh = &read_spec_handler_meta_data,
+ .cls = NULL,
+ .target = result,
+ .size = 0,
+ };
+
+ return rs;
+}
+
+/**
+ * Function used internally to write a metadata container from within a write
+ * spec.
+ *
+ * @param cls ignored, always NULL
+ * @param h the IO handle to write to
+ * @param what what is being written (for error message creation)
+ * @param source the data to write
+ * @param source_size ignored
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
+ */
+static int
+write_spec_handler_meta_data (void *cls,
+ struct GNUNET_BIO_WriteHandle *h,
+ const char *what,
+ void *source,
+ size_t source_size)
+{
+ const struct GNUNET_FS_MetaData *m = source;
+ return GNUNET_FS_write_meta_data (h, what, m);
+}
+
+
+struct GNUNET_BIO_WriteSpec
+GNUNET_FS_write_spec_meta_data (const char *what,
+ const struct GNUNET_FS_MetaData *m)
+{
+ struct GNUNET_BIO_WriteSpec ws = {
+ .wh = &write_spec_handler_meta_data,
+ .cls = NULL,
+ .what = what,
+ .source = (void *) m,
+ .source_size = 0,
+ };
+
+ return ws;
+}
+
-/* end of container_meta_data.c */
+/* end of meta_data.c */
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c
index 062f062b5..2c7830f5f 100644
--- a/src/fs/perf_gnunet_service_fs_p2p.c
+++ b/src/fs/perf_gnunet_service_fs_p2p.c
@@ -360,7 +360,9 @@ main (int argc, char *argv[])
NUM_DAEMONS,
0, NULL, NULL,
&do_publish, NULL);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
+ GNUNET_DISK_purge_cfg_dir
+ ("perf_gnunet_service_fs_p2p.conf",
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/fs/perf_gnunet_service_fs_p2p_respect.c b/src/fs/perf_gnunet_service_fs_p2p_respect.c
index c48db2383..6b71b1f93 100644
--- a/src/fs/perf_gnunet_service_fs_p2p_respect.c
+++ b/src/fs/perf_gnunet_service_fs_p2p_respect.c
@@ -471,7 +471,8 @@ main (int argc, char *argv[])
NUM_DAEMONS,
0, NULL, NULL,
&do_connect, NULL);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
+ GNUNET_DISK_purge_cfg_dir ("perf_gnunet_service_fs_p2p.conf",
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c
index 18aa289ef..bbd0ff57b 100644
--- a/src/fs/plugin_block_fs.c
+++ b/src/fs/plugin_block_fs.c
@@ -25,6 +25,7 @@
*/
#include "platform.h"
#include "gnunet_block_plugin.h"
+
#include "gnunet_fs_service.h"
#include "block_fs.h"
#include "gnunet_signatures.h"
@@ -158,10 +159,9 @@ block_plugin_fs_get_key (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
*/
diff --git a/src/fs/test_fs_directory.c b/src/fs/test_fs_directory.c
index 908e7c555..f5121a3e7 100644
--- a/src/fs/test_fs_directory.c
+++ b/src/fs/test_fs_directory.c
@@ -36,14 +36,14 @@
struct PCLS
{
struct GNUNET_FS_Uri **uri;
- struct GNUNET_CONTAINER_MetaData **md;
+ struct GNUNET_FS_MetaData **md;
unsigned int pos;
unsigned int max;
};
static void
processor (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *md, size_t length,
+ const struct GNUNET_FS_MetaData *md, size_t length,
const void *data)
{
struct PCLS *p = cls;
@@ -53,7 +53,7 @@ processor (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
return; /* ignore directory's meta data */
for (i = 0; i < p->max; i++)
{
- if (GNUNET_CONTAINER_meta_data_test_equal (p->md[i], md) &&
+ if (GNUNET_FS_meta_data_test_equal (p->md[i], md) &&
GNUNET_FS_uri_test_equal (p->uri[i], uri))
{
p->pos++;
@@ -71,8 +71,8 @@ testDirectory (unsigned int i)
char *data;
size_t dlen;
struct GNUNET_FS_Uri **uris;
- struct GNUNET_CONTAINER_MetaData **mds;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData **mds;
+ struct GNUNET_FS_MetaData *meta;
struct PCLS cls;
char *emsg;
int p;
@@ -85,29 +85,29 @@ testDirectory (unsigned int i)
cls.max = i;
uris = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri *) * i);
- mds = GNUNET_malloc (sizeof(struct GNUNET_CONTAINER_MetaData *) * i);
- meta = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_insert (meta, "<test>", EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain",
- "A title", strlen ("A title") + 1);
- GNUNET_CONTAINER_meta_data_insert (meta, "<test>",
- EXTRACTOR_METATYPE_AUTHOR_NAME,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain",
- "An author", strlen ("An author") + 1);
+ mds = GNUNET_malloc (sizeof(struct GNUNET_FS_MetaData *) * i);
+ meta = GNUNET_FS_meta_data_create ();
+ GNUNET_FS_meta_data_insert (meta, "<test>", EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ "A title", strlen ("A title") + 1);
+ GNUNET_FS_meta_data_insert (meta, "<test>",
+ EXTRACTOR_METATYPE_AUTHOR_NAME,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ "An author", strlen ("An author") + 1);
for (p = 0; p < i; p++)
{
- mds[p] = GNUNET_CONTAINER_meta_data_create ();
+ mds[p] = GNUNET_FS_meta_data_create ();
for (q = 0; q <= p; q++)
{
GNUNET_snprintf (txt, sizeof(txt), "%u -- %u\n", p, q);
- GNUNET_CONTAINER_meta_data_insert (mds[p], "<test>",
+ GNUNET_FS_meta_data_insert (mds[p], "<test>",
#if HAVE_EXTRACTOR_H && HAVE_LIBEXTRACTOR
- q % EXTRACTOR_metatype_get_max (),
+ q % EXTRACTOR_metatype_get_max (),
#else
- q % 128,
+ q % 128,
#endif
- EXTRACTOR_METAFORMAT_UTF8,
- "text/plain", txt, strlen (txt) + 1);
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", txt, strlen (txt) + 1);
}
GNUNET_snprintf (uri, sizeof(uri),
"gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.%u",
@@ -116,16 +116,16 @@ testDirectory (unsigned int i)
uris[p] = GNUNET_FS_uri_parse (uri, &emsg);
if (uris[p] == NULL)
{
- GNUNET_CONTAINER_meta_data_destroy (mds[p]);
+ GNUNET_FS_meta_data_destroy (mds[p]);
while (--p > 0)
{
- GNUNET_CONTAINER_meta_data_destroy (mds[p]);
+ GNUNET_FS_meta_data_destroy (mds[p]);
GNUNET_FS_uri_destroy (uris[p]);
}
GNUNET_free (mds);
GNUNET_free (uris);
GNUNET_free (emsg);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
ABORT (); /* error in testcase */
}
GNUNET_assert (emsg == NULL);
@@ -150,10 +150,10 @@ testDirectory (unsigned int i)
GNUNET_assert (cls.pos == i);
}
GNUNET_free (data);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
for (p = 0; p < i; p++)
{
- GNUNET_CONTAINER_meta_data_destroy (mds[p]);
+ GNUNET_FS_meta_data_destroy (mds[p]);
GNUNET_FS_uri_destroy (uris[p]);
}
GNUNET_free (uris);
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index 2fe0da77c..fc6b32c0f 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -267,7 +267,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi;
size_t i;
@@ -286,7 +286,7 @@ run (void *cls,
buf = GNUNET_malloc (FILESIZE);
for (i = 0; i < FILESIZE; i++)
buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = anonymity_level;
@@ -322,7 +322,7 @@ run (void *cls,
indexed = GNUNET_NO;
}
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
timeout_kill =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_kill_task, NULL);
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c
index 35d4ed441..b66fefd6b 100644
--- a/src/fs/test_fs_download_persistence.c
+++ b/src/fs/test_fs_download_persistence.c
@@ -302,7 +302,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi;
size_t i;
@@ -315,7 +315,7 @@ run (void *cls,
buf = GNUNET_malloc (FILESIZE);
for (i = 0; i < FILESIZE; i++)
buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -325,7 +325,7 @@ run (void *cls,
FILESIZE, buf, kuri, meta,
GNUNET_NO, &bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
timeout_kill =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_kill_task, NULL);
diff --git a/src/fs/test_fs_file_information.c b/src/fs/test_fs_file_information.c
index 22013db27..15380bfc4 100644
--- a/src/fs/test_fs_file_information.c
+++ b/src/fs/test_fs_file_information.c
@@ -49,7 +49,7 @@
static int
mycleaner (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri,
struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info)
{
return GNUNET_OK;
@@ -67,7 +67,7 @@ run (void *cls, char *const *args, const char *cfgfile,
char *fn1;
char *fn2;
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi1;
struct GNUNET_FS_FileInformation *fi2;
@@ -100,7 +100,7 @@ run (void *cls, char *const *args, const char *cfgfile,
| GNUNET_DISK_PERM_USER_WRITE));
GNUNET_free (buf);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -125,7 +125,7 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fidir);
/* FIXME: test more of API! */
GNUNET_FS_file_information_destroy (fidir, &mycleaner, NULL);
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c
index 2f04a017a..7e06c47f5 100644
--- a/src/fs/test_fs_list_indexed.c
+++ b/src/fs/test_fs_list_indexed.c
@@ -183,7 +183,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi1;
struct GNUNET_FS_FileInformation *fi2;
@@ -216,7 +216,7 @@ run (void *cls,
| GNUNET_DISK_PERM_USER_WRITE));
GNUNET_free (buf);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -241,7 +241,7 @@ run (void *cls,
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fidir);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_meta_data.c b/src/fs/test_fs_meta_data.c
new file mode 100644
index 000000000..4e7439d7b
--- /dev/null
+++ b/src/fs/test_fs_meta_data.c
@@ -0,0 +1,492 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2003, 2004, 2006, 2009, 2010, 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
+ 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 util/test_fs_meta_data.c
+ * @brief Test for fs_meta_data.c
+ * @author Christian Grothoff
+ * @author Martin Schanzenbach
+ */
+
+
+#include "platform.h"
+#include "gnunet_util_lib.h"
+
+#include "gnunet_fs_service.h"
+
+#define ABORT(m) { fprintf (stderr, "Error at %s:%d\n", __FILE__, __LINE__); \
+ if (m != NULL) GNUNET_FS_meta_data_destroy (m); \
+ return 1; }
+
+
+static int
+testMeta (int i)
+{
+ struct GNUNET_FS_MetaData *m;
+ char val[256];
+ char *sval;
+ int j;
+ unsigned int size;
+
+ m = GNUNET_FS_meta_data_create ();
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_insert (m, "<test>", EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", "TestTitle",
+ strlen ("TestTitle") + 1))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_insert (m, "<test>",
+ EXTRACTOR_METATYPE_AUTHOR_NAME,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", "TestTitle",
+ strlen ("TestTitle") + 1))
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_FS_meta_data_insert (m, "<test>",
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ "TestTitle", strlen (
+ "TestTitle") + 1)) /* dup! */
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_FS_meta_data_insert (m, "<test>",
+ EXTRACTOR_METATYPE_AUTHOR_NAME,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ "TestTitle", strlen (
+ "TestTitle") + 1)) /* dup! */
+ ABORT (m);
+ if (2 != GNUNET_FS_meta_data_iterate (m, NULL, NULL))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_delete (m, EXTRACTOR_METATYPE_AUTHOR_NAME,
+ "TestTitle", strlen ("TestTitle") + 1))
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_FS_meta_data_delete (m,
+ EXTRACTOR_METATYPE_AUTHOR_NAME,
+ "TestTitle", strlen (
+ "TestTitle") + 1)) /* already gone */
+ ABORT (m);
+ if (1 != GNUNET_FS_meta_data_iterate (m, NULL, NULL))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_delete (m, EXTRACTOR_METATYPE_TITLE,
+ "TestTitle", strlen ("TestTitle") + 1))
+ ABORT (m);
+ if (GNUNET_OK == GNUNET_FS_meta_data_delete (m,
+ EXTRACTOR_METATYPE_TITLE,
+ "TestTitle", strlen (
+ "TestTitle") + 1)) /* already gone */
+ ABORT (m);
+ if (0 != GNUNET_FS_meta_data_iterate (m, NULL, NULL))
+ ABORT (m);
+ for (j = 0; j < i; j++)
+ {
+ GNUNET_snprintf (val, sizeof(val), "%s.%d",
+ "A teststring that should compress well.", j);
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_insert (m, "<test>",
+ EXTRACTOR_METATYPE_UNKNOWN,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", val, strlen (val) + 1))
+ ABORT (m);
+ }
+ if (i != GNUNET_FS_meta_data_iterate (m, NULL, NULL))
+ ABORT (m);
+
+ size = GNUNET_FS_meta_data_get_serialized_size (m);
+ sval = NULL;
+ if (size !=
+ GNUNET_FS_meta_data_serialize (m, &sval, size,
+ GNUNET_FS_META_DATA_SERIALIZE_FULL))
+ {
+ GNUNET_free (sval);
+ ABORT (m);
+ }
+ GNUNET_FS_meta_data_destroy (m);
+ m = GNUNET_FS_meta_data_deserialize (sval, size);
+ GNUNET_free (sval);
+ if (m == NULL)
+ ABORT (m);
+ for (j = 0; j < i; j++)
+ {
+ GNUNET_snprintf (val,
+ sizeof(val),
+ "%s.%d",
+ "A teststring that should compress well.",
+ j);
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_delete (m,
+ EXTRACTOR_METATYPE_UNKNOWN,
+ val,
+ strlen (val) + 1))
+ {
+ ABORT (m);
+ }
+ }
+ if (0 != GNUNET_FS_meta_data_iterate (m, NULL, NULL))
+ ABORT (m);
+ GNUNET_FS_meta_data_destroy (m);
+ return 0;
+}
+
+
+static int
+testMetaMore (int i)
+{
+ struct GNUNET_FS_MetaData *meta;
+ int q;
+ char txt[128];
+ char *data;
+ unsigned long long size;
+
+ meta = GNUNET_FS_meta_data_create ();
+ for (q = 0; q <= i; q++)
+ {
+ GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q);
+ GNUNET_FS_meta_data_insert (meta, "<test>",
+ q
+ % 42 /* EXTRACTOR_metatype_get_max () */,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ txt, strlen (txt) + 1);
+ }
+ size = GNUNET_FS_meta_data_get_serialized_size (meta);
+ data = GNUNET_malloc (size * 4);
+ if (size !=
+ GNUNET_FS_meta_data_serialize (meta, &data, size * 4,
+ GNUNET_FS_META_DATA_SERIALIZE_FULL))
+ {
+ GNUNET_free (data);
+ ABORT (meta);
+ }
+ GNUNET_FS_meta_data_destroy (meta);
+ GNUNET_free (data);
+ return 0;
+}
+
+
+static int
+testMetaLink ()
+{
+ struct GNUNET_FS_MetaData *m;
+ char *val;
+ unsigned int size;
+
+ m = GNUNET_FS_meta_data_create ();
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_insert (m, "<test>",
+ EXTRACTOR_METATYPE_UNKNOWN,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", "link",
+ strlen ("link") + 1))
+ ABORT (m);
+ if (GNUNET_OK !=
+ GNUNET_FS_meta_data_insert (m, "<test>",
+ EXTRACTOR_METATYPE_FILENAME,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain", "lib-link.m4",
+ strlen ("lib-link.m4") + 1))
+ ABORT (m);
+ val = NULL;
+ size =
+ GNUNET_FS_meta_data_serialize (m, &val, (size_t) -1,
+ GNUNET_FS_META_DATA_SERIALIZE_FULL);
+ GNUNET_FS_meta_data_destroy (m);
+ m = GNUNET_FS_meta_data_deserialize (val, size);
+ GNUNET_free (val);
+ if (m == NULL)
+ ABORT (m);
+ GNUNET_FS_meta_data_destroy (m);
+ return 0;
+}
+
+
+static int
+check ()
+{
+ struct GNUNET_FS_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta2;
+ int q;
+ int i = 100;
+ char txt[128];
+ char *str;
+ unsigned char *thumb;
+
+ meta = GNUNET_FS_meta_data_create ();
+ meta2 = GNUNET_FS_meta_data_create ();
+ for (q = 0; q <= i; q++)
+ {
+ GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q);
+ GNUNET_FS_meta_data_insert (meta, "<test>",
+ EXTRACTOR_METATYPE_UNKNOWN,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ "TestTitle", strlen ("TestTitle") + 1);
+ GNUNET_FS_meta_data_insert (meta2, "<test>",
+ EXTRACTOR_METATYPE_UNKNOWN,
+ EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ "TestTitle", strlen ("TestTitle") + 1);
+ }
+
+ // check meta_data_test_equal
+ if (GNUNET_YES != GNUNET_FS_meta_data_test_equal (meta, meta2))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+
+ // check meta_data_clear
+ GNUNET_FS_meta_data_clear (meta2);
+ if (0 != GNUNET_FS_meta_data_iterate (meta2, NULL, NULL))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+ // check equal branch in meta_data_test_equal
+ if (GNUNET_YES != GNUNET_FS_meta_data_test_equal (meta, meta))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+ // check "count" branch in meta_data_test_equal
+ if (GNUNET_NO != GNUNET_FS_meta_data_test_equal (meta, meta2))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+
+ // check meta_data_add_publication_date
+ GNUNET_FS_meta_data_add_publication_date (meta2);
+
+ // check meta_data_merge
+ GNUNET_FS_meta_data_clear (meta2);
+ GNUNET_FS_meta_data_merge (meta2, meta);
+ if (100 == GNUNET_FS_meta_data_iterate (meta2, NULL, NULL))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+
+ // check meta_data_get_by_type
+ GNUNET_FS_meta_data_clear (meta2);
+ if (NULL !=
+ (str =
+ GNUNET_FS_meta_data_get_by_type (meta2,
+ EXTRACTOR_METATYPE_UNKNOWN)))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ GNUNET_free (str);
+ ABORT (meta);
+ }
+
+ str =
+ GNUNET_FS_meta_data_get_by_type (meta, EXTRACTOR_METATYPE_UNKNOWN);
+ GNUNET_assert (NULL != str);
+ if (str[0] != 'T')
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ GNUNET_free (str);
+ ABORT (meta);
+ }
+ GNUNET_free (str);
+
+ // check branch
+ if (NULL !=
+ (str =
+ GNUNET_FS_meta_data_get_by_type (meta,
+ EXTRACTOR_METATYPE_PUBLICATION_DATE)))
+ {
+ GNUNET_free (str);
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+
+ // check meta_data_get_first_by_types
+ str =
+ GNUNET_FS_meta_data_get_first_by_types (meta,
+ EXTRACTOR_METATYPE_UNKNOWN,
+ -1);
+ GNUNET_assert (NULL != str);
+ if (str[0] != 'T')
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ GNUNET_free (str);
+ ABORT (meta);
+ }
+ GNUNET_free (str);
+
+ // check meta_data_get_thumbnail
+ if (GNUNET_FS_meta_data_get_thumbnail (meta, &thumb) != 0)
+ {
+ GNUNET_free (thumb);
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+ GNUNET_FS_meta_data_destroy (meta2);
+ // check meta_data_duplicate
+ meta2 = GNUNET_FS_meta_data_duplicate (meta);
+ if (200 == GNUNET_FS_meta_data_iterate (meta2, NULL, NULL))
+ {
+ GNUNET_FS_meta_data_destroy (meta2);
+ ABORT (meta);
+ }
+ GNUNET_FS_meta_data_destroy (meta2);
+ GNUNET_FS_meta_data_destroy (meta);
+ return 0;
+}
+
+
+static int
+test_bigmeta_rw (void)
+{
+ static char meta[1024 * 1024 * 10];
+ struct GNUNET_BIO_WriteHandle *wh;
+ struct GNUNET_BIO_ReadHandle *rh;
+ char *filename = GNUNET_DISK_mktemp ("gnunet_bio");
+ struct GNUNET_FS_MetaData *mdR = NULL;
+
+ memset (meta, 'b', sizeof (meta));
+ meta[sizeof (meta) - 1] = '\0';
+
+ wh = GNUNET_BIO_write_open_file (filename);
+ GNUNET_assert (NULL != wh);
+ if (GNUNET_OK != GNUNET_BIO_write_int32 (wh,
+ "test-bigmeta-rw-int32",
+ sizeof (meta)))
+ {
+ GNUNET_BIO_write_close (wh, NULL);
+ return 1;
+ }
+ if (GNUNET_OK != GNUNET_BIO_write (wh,
+ "test-bigmeta-rw-bytes",
+ meta,
+ sizeof (meta)))
+ {
+ GNUNET_BIO_write_close (wh, NULL);
+ return 1;
+ }
+ GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (wh, NULL));
+
+ rh = GNUNET_BIO_read_open_file (filename);
+ GNUNET_assert (NULL != rh);
+ GNUNET_assert (GNUNET_SYSERR ==
+ GNUNET_FS_read_meta_data (rh,
+ "test-bigmeta-rw-metadata",
+ &mdR));
+ GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
+
+ GNUNET_assert (NULL == mdR);
+
+ GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
+ GNUNET_free (filename);
+ return 0;
+}
+
+static int
+test_fakemeta_rw (void)
+{
+ struct GNUNET_BIO_WriteHandle *wh;
+ struct GNUNET_BIO_ReadHandle *rh;
+ char *filename = GNUNET_DISK_mktemp ("gnunet_bio");
+ struct GNUNET_FS_MetaData *mdR = NULL;
+
+ wh = GNUNET_BIO_write_open_file (filename);
+ GNUNET_assert (NULL != wh);
+ if (GNUNET_OK != GNUNET_BIO_write_int32 (wh,
+ "test-fakestring-rw-int32",
+ 2))
+ {
+ GNUNET_BIO_write_close (wh, NULL);
+ return 1;
+ }
+ GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (wh, NULL));
+
+ rh = GNUNET_BIO_read_open_file (filename);
+ GNUNET_assert (NULL != rh);
+ GNUNET_assert (GNUNET_SYSERR ==
+ GNUNET_FS_read_meta_data (rh,
+ "test-fakestring-rw-metadata",
+ &mdR));
+ GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
+
+ GNUNET_assert (NULL == mdR);
+
+ GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
+ GNUNET_free (filename);
+ return 0;
+}
+
+static int
+test_fakebigmeta_rw (void)
+{
+ struct GNUNET_BIO_WriteHandle *wh;
+ struct GNUNET_BIO_ReadHandle *rh;
+ char *filename = GNUNET_DISK_mktemp ("gnunet_bio");
+ struct GNUNET_FS_MetaData *mdR = NULL;
+ int32_t wNum = 1024 * 1024 * 10;
+
+ wh = GNUNET_BIO_write_open_file (filename);
+ GNUNET_assert (NULL != wh);
+ GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_int32 (wh,
+ "test-fakebigmeta-rw-int32",
+ wNum));
+ GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (wh, NULL));
+
+ rh = GNUNET_BIO_read_open_file (filename);
+ GNUNET_assert (NULL != rh);
+ GNUNET_assert (GNUNET_SYSERR ==
+ GNUNET_FS_read_meta_data (rh,
+ "test-fakebigmeta-rw-metadata",
+ &mdR));
+ GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
+
+ GNUNET_assert (NULL == mdR);
+
+ GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
+ GNUNET_free (filename);
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int failureCount = 0;
+ int i;
+
+ GNUNET_log_setup ("test-fs-meta-data", "WARNING", NULL);
+ for (i = 0; i < 255; i++)
+ failureCount += testMeta (i);
+ for (i = 1; i < 255; i++)
+ failureCount += testMetaMore (i);
+ failureCount += testMetaLink ();
+ failureCount += test_fakebigmeta_rw ();
+ failureCount += test_fakemeta_rw ();
+ failureCount += test_bigmeta_rw ();
+ int ret = check ();
+
+ if (ret == 1)
+ return 1;
+
+ if (failureCount != 0)
+ return 1;
+ return 0;
+}
+
+
+/* end of test_container_meta_data.c */
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c
index c1e10d575..85d489598 100644
--- a/src/fs/test_fs_namespace.c
+++ b/src/fs/test_fs_namespace.c
@@ -206,7 +206,7 @@ publish_cont (void *cls, const struct GNUNET_FS_Uri *ksk_uri, const char *emsg)
static void
sks_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
{
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *ksk_uri;
char *msg;
struct GNUNET_FS_BlockOptions bo;
@@ -218,7 +218,7 @@ sks_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
GNUNET_FS_stop (fs);
return;
}
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
msg = NULL;
ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/ns-search", &msg);
GNUNET_assert (NULL == msg);
@@ -231,14 +231,14 @@ sks_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
GNUNET_FS_publish_ksk (fs, ksk_uri, meta, uri, &bo,
GNUNET_FS_PUBLISH_OPTION_NONE, &publish_cont, NULL);
GNUNET_FS_uri_destroy (ksk_uri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
}
static void
adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
{
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_CRYPTO_EcdsaPrivateKey ns;
struct GNUNET_FS_BlockOptions bo;
@@ -250,7 +250,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
return;
}
GNUNET_CRYPTO_ecdsa_key_create (&ns);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
sks_expect_uri = GNUNET_FS_uri_dup (uri);
bo.content_priority = 1;
bo.anonymity_level = 1;
@@ -262,7 +262,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
GNUNET_FS_publish_sks (fs,
&ns, "this", "next", meta, uri,
&bo, GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont, NULL);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
}
@@ -270,11 +270,11 @@ static void
testNamespace (void)
{
struct GNUNET_FS_BlockOptions bo;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *ksk_uri;
struct GNUNET_FS_Uri *sks_uri;
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/testnsa", NULL);
bo.content_priority = 1;
bo.anonymity_level = 1;
@@ -291,7 +291,7 @@ testNamespace (void)
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &do_timeout,
NULL);
GNUNET_FS_uri_destroy (ksk_uri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
}
diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c
index 2132220fb..d883b7bea 100644
--- a/src/fs/test_fs_namespace_list_updateable.c
+++ b/src/fs/test_fs_namespace_list_updateable.c
@@ -35,7 +35,7 @@ static int err;
static struct GNUNET_CRYPTO_EcdsaPrivateKey ns;
-static struct GNUNET_CONTAINER_MetaData *meta;
+static struct GNUNET_FS_MetaData *meta;
static struct GNUNET_FS_Uri *uri_this;
@@ -59,14 +59,14 @@ do_shutdown ()
if (uri_next != NULL)
GNUNET_FS_uri_destroy (uri_next);
if (meta != NULL)
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
}
static void
check_next (void *cls, const char *last_id,
const struct GNUNET_FS_Uri *last_uri,
- const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const struct GNUNET_FS_MetaData *last_meta,
const char *next_id)
{
GNUNET_break (0 == strcmp (last_id, "next"));
@@ -78,7 +78,7 @@ check_next (void *cls, const char *last_id,
static void
check_this_next (void *cls, const char *last_id,
const struct GNUNET_FS_Uri *last_uri,
- const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const struct GNUNET_FS_MetaData *last_meta,
const char *next_id)
{
GNUNET_break (0 == strcmp (last_id, "this"));
@@ -101,7 +101,7 @@ sks_cont_next (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
static void
check_this (void *cls, const char *last_id,
const struct GNUNET_FS_Uri *last_uri,
- const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const struct GNUNET_FS_MetaData *last_meta,
const char *next_id)
{
GNUNET_break (0 == strcmp (last_id, "this"));
@@ -131,7 +131,7 @@ testNamespace (void)
bo.replication_level = 0;
bo.expiration_time =
GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
uri_this =
GNUNET_FS_uri_parse
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c
index 2ffc722da..0e379bc29 100644
--- a/src/fs/test_fs_publish.c
+++ b/src/fs/test_fs_publish.c
@@ -169,7 +169,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi1;
struct GNUNET_FS_FileInformation *fi2;
@@ -202,7 +202,7 @@ run (void *cls,
| GNUNET_DISK_PERM_USER_WRITE));
GNUNET_free (buf);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -227,7 +227,7 @@ run (void *cls,
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fidir);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c
index da0209793..e1563f448 100644
--- a/src/fs/test_fs_publish_persistence.c
+++ b/src/fs/test_fs_publish_persistence.c
@@ -242,7 +242,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi1;
struct GNUNET_FS_FileInformation *fi2;
@@ -276,7 +276,7 @@ run (void *cls,
| GNUNET_DISK_PERM_USER_WRITE));
GNUNET_free (buf);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -299,7 +299,7 @@ run (void *cls,
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fidir);
start = GNUNET_TIME_absolute_get ();
GNUNET_FS_publish_start (fs, fidir, NULL, NULL, NULL,
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c
index b392cc8ac..f9266582e 100644
--- a/src/fs/test_fs_search.c
+++ b/src/fs/test_fs_search.c
@@ -204,7 +204,7 @@ run (void *cls,
"down_bar"
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_BlockOptions bo;
struct GNUNET_FS_FileInformation *fi;
@@ -216,7 +216,7 @@ run (void *cls,
buf = GNUNET_malloc (FILESIZE);
for (i = 0; i < FILESIZE; i++)
buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -226,7 +226,7 @@ run (void *cls,
FILESIZE, buf, kuri, meta,
GNUNET_NO, &bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c
index d523a6404..4ddd40e73 100644
--- a/src/fs/test_fs_search_persistence.c
+++ b/src/fs/test_fs_search_persistence.c
@@ -269,7 +269,7 @@ run (void *cls,
"down_bar"
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi;
size_t i;
@@ -282,7 +282,7 @@ run (void *cls,
buf = GNUNET_malloc (FILESIZE);
for (i = 0; i < FILESIZE; i++)
buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -292,7 +292,7 @@ run (void *cls,
FILESIZE, buf, kuri, meta,
GNUNET_NO, &bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_search_probes.c b/src/fs/test_fs_search_probes.c
index b3c717aa1..776babaee 100644
--- a/src/fs/test_fs_search_probes.c
+++ b/src/fs/test_fs_search_probes.c
@@ -209,7 +209,7 @@ run (void *cls,
"down_bar"
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_BlockOptions bo;
struct GNUNET_FS_FileInformation *fi;
@@ -222,7 +222,7 @@ run (void *cls,
buf = GNUNET_malloc (FILESIZE);
for (i = 0; i < FILESIZE; i++)
buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -232,7 +232,7 @@ run (void *cls,
FILESIZE, buf, kuri, meta,
GNUNET_NO, &bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_search_with_and.c b/src/fs/test_fs_search_with_and.c
index 2187f4531..9c20936b6 100644
--- a/src/fs/test_fs_search_with_and.c
+++ b/src/fs/test_fs_search_with_and.c
@@ -216,7 +216,7 @@ run (void *cls,
"down_bar"
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_BlockOptions bo;
struct GNUNET_FS_FileInformation *fi;
@@ -233,7 +233,7 @@ run (void *cls,
buf = GNUNET_malloc (FILESIZE);
for (i = 0; i < FILESIZE; i++)
buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -243,7 +243,7 @@ run (void *cls,
FILESIZE, buf, kuri, meta,
GNUNET_NO, &bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c
index 7f0077bdd..714dd452e 100644
--- a/src/fs/test_fs_test_lib.c
+++ b/src/fs/test_fs_test_lib.c
@@ -165,13 +165,15 @@ run (void *cls,
int
main (int argc, char *argv[])
{
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
+ GNUNET_DISK_purge_cfg_dir ("fs_test_lib_data.conf",
+ "GNUNET_TEST_HOME");
(void) GNUNET_TESTBED_test_run ("test_fs_test_lib",
"fs_test_lib_data.conf",
NUM_DAEMONS,
0, NULL, NULL,
&run, NULL);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
+ GNUNET_DISK_purge_cfg_dir ("fs_test_lib_data.conf",
+ "GNUNET_TEST_HOME");
return ret;
}
diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c
index 992672244..dbc33090d 100644
--- a/src/fs/test_fs_unindex.c
+++ b/src/fs/test_fs_unindex.c
@@ -184,7 +184,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi;
size_t i;
@@ -203,7 +203,7 @@ run (void *cls,
GNUNET_DISK_PERM_USER_READ
| GNUNET_DISK_PERM_USER_WRITE));
GNUNET_free (buf);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -213,7 +213,7 @@ run (void *cls,
kuri, meta, GNUNET_YES,
&bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c
index 802aaf7ca..b81ce64ab 100644
--- a/src/fs/test_fs_unindex_persistence.c
+++ b/src/fs/test_fs_unindex_persistence.c
@@ -253,7 +253,7 @@ run (void *cls,
"down_bar",
};
char *buf;
- struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_MetaData *meta;
struct GNUNET_FS_Uri *kuri;
struct GNUNET_FS_FileInformation *fi;
size_t i;
@@ -273,7 +273,7 @@ run (void *cls,
GNUNET_DISK_PERM_USER_READ
| GNUNET_DISK_PERM_USER_WRITE));
GNUNET_free (buf);
- meta = GNUNET_CONTAINER_meta_data_create ();
+ meta = GNUNET_FS_meta_data_create ();
kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
bo.content_priority = 42;
bo.anonymity_level = 1;
@@ -283,7 +283,7 @@ run (void *cls,
kuri, meta, GNUNET_YES,
&bo);
GNUNET_FS_uri_destroy (kuri);
- GNUNET_CONTAINER_meta_data_destroy (meta);
+ GNUNET_FS_meta_data_destroy (meta);
GNUNET_assert (NULL != fi);
start = GNUNET_TIME_absolute_get ();
publish =
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c
index aac7b1b97..e0f23097b 100644
--- a/src/fs/test_fs_uri.c
+++ b/src/fs/test_fs_uri.c
@@ -327,7 +327,10 @@ main (int argc, char *argv[])
failureCount += testFile (i);
}
/* fprintf (stderr, "%s", "\n"); */
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-uri");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_fs_uri.conf",
+ "GNUNET_TEST_HOME");
+
if (failureCount != 0)
return 1;
return 0;
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c
index d4a1c38b5..38b00f3e8 100644
--- a/src/fs/test_gnunet_service_fs_migration.c
+++ b/src/fs/test_gnunet_service_fs_migration.c
@@ -213,7 +213,9 @@ main (int argc,
0, NULL, NULL,
&do_publish,
NULL);
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-service-fs-migration/");
+ GNUNET_DISK_purge_cfg_dir
+ ("test_gnunet_service_fs_migration_data.conf",
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index bedcb7173..2d1fbb788 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -158,7 +158,8 @@ main (int argc, char *argv[])
NUM_DAEMONS,
0, NULL, NULL,
&do_publish, NULL);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/");
+ GNUNET_DISK_purge_cfg_dir (config,
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index d49e0c5c8..2fbb49b18 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -42,19 +42,8 @@ dist_pkgcfg_DATA = \
lib_LTLIBRARIES = \
libgnunetgns.la
-
if HAVE_GNUTLS
-if HAVE_LIBGNURL
- DO_PROXY=gnunet-gns-proxy
-LIB_GNURL=@LIBGNURL@
-CPP_GNURL=@LIBGNURL_CPPFLAGS@
-else
-if HAVE_LIBCURL
- DO_PROXY=gnunet-gns-proxy
-LIB_GNURL=@LIBCURL@
-CPP_GNURL=@LIBCURL_CPPFLAGS@
-endif
-endif
+DO_PROXY=gnunet-gns-proxy
endif
libexec_PROGRAMS = \
@@ -177,7 +166,7 @@ endif
gnunet_gns_proxy_SOURCES = \
gnunet-gns-proxy.c
-gnunet_gns_proxy_LDADD = $(MHD_LIBS) $(LIB_GNURL) -lgnutls \
+gnunet_gns_proxy_LDADD = $(MHD_LIBS) @LIBCURL@ -lgnutls \
libgnunetgns.la \
$(top_builddir)/src/identity/libgnunetidentity.la \
$(top_builddir)/src/util/libgnunetutil.la \
@@ -185,14 +174,14 @@ gnunet_gns_proxy_LDADD = $(MHD_LIBS) $(LIB_GNURL) -lgnutls \
if HAVE_GNUTLS_DANE
gnunet_gns_proxy_LDADD += -lgnutls-dane
endif
-gnunet_gns_proxy_CFLAGS = $(MHD_CFLAGS) $(CPP_GNURL) $(AM_CFLAGS)
+gnunet_gns_proxy_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
test_gns_proxy_SOURCES = \
test_gns_proxy.c
-test_gns_proxy_LDADD = $(MHD_LIBS) $(LIB_GNURL) -lgnutls \
+test_gns_proxy_LDADD = $(MHD_LIBS) @LIBCURL@ -lgnutls \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
-test_gns_proxy_CFLAGS = $(MHD_CFLAGS) $(CPP_GNURL) $(AM_CFLAGS)
+test_gns_proxy_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
#gnunet_gns_import_SOURCES = \
# gnunet-gns-import.c
@@ -247,11 +236,9 @@ libgnunet_plugin_block_gns_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
if HAVE_GNUTLS
-if HAVE_LIBGNURL
check_PROGRAMS = \
test_gns_proxy
endif
-endif
check_SCRIPTS = \
test_gns_lookup.sh \
@@ -272,12 +259,10 @@ check_SCRIPTS = \
test_gns_revocation.sh\
test_gns_redirect_lookup.sh
-if HAVE_GNUTLS
-if HAVE_LIBGNURL
+if HAVE_GNUTLS_CURL
check_SCRIPTS += \
test_proxy.sh
endif
-endif
check_SCRIPTS += \
test_plugin_rest_gns.sh
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 13741bee9..309c7ada2 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -39,9 +39,16 @@ PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock
[dns2gns]
BINARY = gnunet-dns2gns
START_ON_DEMAND = NO
-RUN_PER_USER = YES
+RUN_PER_USER = NO
BIND_TO=127.0.0.1
BIND_TO6=::1
-# -d: DNS resolver to use, -s: suffix to use, -f: fcfs suffix to use
-OPTIONS = -d 8.8.8.8
+# -d: DNS resolver to use
+OPTIONS = -d 9.9.9.9
+PORT = 15353
+
+# This setting is useful in combination with systemd-resolve and
+# NetworkManager-dispatcher. It allows the interfaces to automatically
+# configure the dns2gns server for interfaces going up
+# See also: contrib/packages/fedora/10-dns2gns.sh
+ENABLE_RESOLVECTL_NMDISPATCHER = NO
diff --git a/src/gns/gns.h b/src/gns/gns.h
index d824742ad..d882278f5 100644
--- a/src/gns/gns.h
+++ b/src/gns/gns.h
@@ -46,11 +46,6 @@ struct LookupMessage
uint32_t id GNUNET_PACKED;
/**
- * Zone that is to be used for lookup
- */
- struct GNUNET_IDENTITY_PublicKey zone;
-
- /**
* Local options for where to look for results
* (an `enum GNUNET_GNS_LocalOptions` in NBO).
*/
@@ -68,7 +63,13 @@ struct LookupMessage
*/
int32_t type GNUNET_PACKED;
- /* Followed by the zero-terminated name to look up */
+ /**
+ * Length of the zone key
+ */
+ uint32_t key_len GNUNET_PACKED;
+ /**
+ * Followed by the zone that is to be used for lookup
+ * Followed by the zero-terminated name to look up */
};
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 841a0d240..9e25154ef 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -354,6 +354,9 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
struct LookupMessage *lookup_msg;
struct GNUNET_GNS_LookupRequest *lr;
size_t nlen;
+ size_t key_len;
+ ssize_t written;
+ char *buf;
if (NULL == name)
{
@@ -374,16 +377,23 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
lr->lookup_proc = proc;
lr->proc_cls = proc_cls;
lr->r_id = handle->r_id_gen++;
+ key_len = GNUNET_IDENTITY_public_key_get_length (zone);
lr->env = GNUNET_MQ_msg_extra (lookup_msg,
- nlen,
+ nlen + key_len,
GNUNET_MESSAGE_TYPE_GNS_LOOKUP);
+ buf = (char *) &lookup_msg[1];
lookup_msg->id = htonl (lr->r_id);
lookup_msg->options = htons ((uint16_t) options);
lookup_msg->recursion_depth_limit
= htons (recursion_depth_limit);
- lookup_msg->zone = *zone;
+ lookup_msg->key_len = htonl (key_len);
+ written = GNUNET_IDENTITY_write_public_key_to_buffer (zone,
+ buf,
+ key_len);
+ GNUNET_assert (0 <= written);
+ buf += written;
lookup_msg->type = htonl (type);
- GNUNET_memcpy (&lookup_msg[1],
+ GNUNET_memcpy (buf,
name,
nlen);
GNUNET_CONTAINER_DLL_insert (handle->lookup_head,
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index 1b711cf40..c88ce776e 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -186,7 +186,7 @@ lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr,
* @param cls a `struct GNUNET_GNS_LookupWithTldRequest *`
* @param ego ego handle, NULL at the end of the iteration
* @param ctx context we could store data to associate with @e ego
- * @param name name of the ego
+ * @param ego_name name of the ego
*/
static void
identity_zone_cb (void *cls,
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index 60fe25945..754f8ac6f 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -484,14 +484,14 @@ create_response (void *cls,
internal_error->response);
}
- MHD_add_response_header (pdfrs,
+ GNUNET_assert (MHD_NO != MHD_add_response_header (pdfrs,
MHD_HTTP_HEADER_CONTENT_TYPE,
- (NULL == qrpng) ? "application/pdf" : "image/png");
- MHD_add_response_header (pdfrs,
+ (NULL == qrpng) ? "application/pdf" : "image/png"));
+ GNUNET_assert (MHD_NO != MHD_add_response_header (pdfrs,
MHD_HTTP_HEADER_CONTENT_DISPOSITION,
(NULL == qrpng) ?
"attachment; filename=\"gns-business-card.pdf\"" :
- "attachment; filename=\"gns-qr-code.png\"");
+ "attachment; filename=\"gns-qr-code.png\""));
MHD_RESULT r = MHD_queue_response (connection, MHD_HTTP_OK, pdfrs);
MHD_destroy_response (pdfrs);
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 46659cdda..04d320c62 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -24,9 +24,7 @@
*/
#include "platform.h"
#include <gnunet_util_lib.h>
-#include <gnunet_dnsparser_lib.h>
#include <gnunet_gns_service.h>
-#include <gnunet_dnsstub_lib.h>
#include "gnunet_vpn_service.h"
#include "gns.h"
@@ -193,7 +191,7 @@ static char *dns_ip;
/**
* UDP Port we listen on for inbound DNS requests.
*/
-static unsigned int listen_port = 53;
+static unsigned long long listen_port = 53;
/**
* Configuration to use.
@@ -561,7 +559,8 @@ result_processor (void *cls,
if ((GNUNET_DNSPARSER_TYPE_A != request->packet->queries[0].type) &&
(GNUNET_DNSPARSER_TYPE_AAAA != request->packet->queries[0].type))
break;
- af = (GNUNET_DNSPARSER_TYPE_A == request->packet->queries[0].type) ? AF_INET :
+ af = (GNUNET_DNSPARSER_TYPE_A == request->packet->queries[0].type) ?
+ AF_INET :
AF_INET6;
if (sizeof(struct GNUNET_TUN_GnsVpnRecord) >
rd[i].data_size)
@@ -903,6 +902,11 @@ run (void *cls,
return;
}
GNUNET_free (addr_str);
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (c, "dns2gns",
+ "PORT",
+ &listen_port))
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Listening on %llu\n", listen_port);
listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET,
SOCK_DGRAM,
@@ -994,12 +998,6 @@ main (int argc,
gettext_noop (
"IP of recursive DNS resolver to use (required)"),
&dns_ip),
- GNUNET_GETOPT_option_uint ('p',
- "port",
- "UDPPORT",
- gettext_noop (
- "UDP port to listen on for inbound DNS requests; default: 2853"),
- &listen_port),
GNUNET_GETOPT_OPTION_END
};
int ret;
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index ec9fb12ae..312fde293 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -970,7 +970,7 @@ check_ssl_certificate (struct Socks5Request *s5r)
"Checking X.509 certificate\n");
if (CURLE_OK !=
curl_easy_getinfo (s5r->curl,
- CURLINFO_TLS_SESSION,
+ CURLINFO_TLS_SSL_PTR,
&tlsinfo))
return GNUNET_SYSERR;
if (CURLSSLBACKEND_GNUTLS != tlsinfo->backend)
@@ -1230,6 +1230,7 @@ curl_check_hdr (void *buffer,
new_cookie_hdr[offset++] = ';';
}
hdr_val = new_cookie_hdr;
+ hdr_val[offset] = '\0';
}
new_location = NULL;
@@ -1265,7 +1266,7 @@ curl_check_hdr (void *buffer,
GNUNET_free (leho_host);
}
else if (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
- hdr_type))
+ hdr_type))
{
char *leho_host;
@@ -1309,7 +1310,7 @@ curl_check_hdr (void *buffer,
s5r->header_tail,
header);
}
-cleanup:
+ cleanup:
GNUNET_free (ndup);
GNUNET_free (new_cookie_hdr);
GNUNET_free (new_location);
@@ -2565,11 +2566,6 @@ schedule_httpd (struct MhdHttpList *hd)
}
-/**
- * Task run whenever HTTP server operations are pending.
- *
- * @param cls the `struct MhdHttpList` of the daemon that is being run
- */
static void
do_httpd (void *cls)
{
@@ -3433,7 +3429,6 @@ do_s5r_read (void *cls)
* Accept new incoming connections
*
* @param cls the closure with the lsock4 or lsock6
- * @param tc the scheduler context
*/
static void
do_accept (void *cls)
@@ -3806,6 +3801,14 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
+ if (CURLSSLSET_OK != curl_global_sslset (CURLSSLBACKEND_GNUTLS,
+ NULL,
+ NULL))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "cURL does not support the GnuTLS backend\n");
+
+ }
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 5cf496808..c71676a08 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -37,7 +37,6 @@
#endif
#endif
#include <gnunet_util_lib.h>
-#include <gnunet_dnsparser_lib.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_namestore_service.h>
#include <gnunet_gns_service.h>
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index b28236fed..fc8de860d 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -26,7 +26,6 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
-#include "gnunet_dnsparser_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_namecache_service.h"
#include "gnunet_gnsrecord_lib.h"
@@ -395,10 +394,11 @@ check_lookup (void *cls,
const struct LookupMessage *l_msg)
{
size_t nlen;
+ size_t klen;
(void) cls;
- GNUNET_MQ_check_zero_termination (l_msg);
- nlen = ntohs (l_msg->header.size) - sizeof(struct LookupMessage);
+ klen = ntohl (l_msg->key_len);
+ nlen = ntohs (l_msg->header.size) - sizeof(struct LookupMessage) - klen;
if (nlen > GNUNET_DNSPARSER_MAX_NAME_LENGTH)
{
GNUNET_break (0);
@@ -412,8 +412,7 @@ check_lookup (void *cls,
* Handle lookup requests from client
*
* @param cls the closure
- * @param client the client
- * @param message the message
+ * @param sh_msg the message
*/
static void
handle_lookup (void *cls,
@@ -421,19 +420,37 @@ handle_lookup (void *cls,
{
struct GnsClient *gc = cls;
struct ClientLookupHandle *clh;
+ struct GNUNET_IDENTITY_PublicKey zone;
const char *name;
+ size_t key_len;
+ size_t read;
GNUNET_SERVICE_client_continue (gc->client);
- name = (const char *) &sh_msg[1];
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received LOOKUP `%s' message\n",
- name);
+ key_len = ntohl (sh_msg->key_len);
clh = GNUNET_new (struct ClientLookupHandle);
GNUNET_CONTAINER_DLL_insert (gc->clh_head,
gc->clh_tail,
clh);
clh->gc = gc;
clh->request_id = sh_msg->id;
+ if ((GNUNET_SYSERR ==
+ GNUNET_IDENTITY_read_public_key_from_buffer (&sh_msg[1],
+ key_len,
+ &zone,
+ &read)) ||
+ (read != key_len))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "LOOKUP: Failed to read zone key!");
+ send_lookup_response (clh,
+ 0,
+ NULL);
+ return;
+ }
+ name = (const char *) &sh_msg[1] + key_len;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received LOOKUP `%s' message\n",
+ name);
if ((GNUNET_DNSPARSER_TYPE_A == ntohl (sh_msg->type)) &&
(GNUNET_OK != v4_enabled))
{
@@ -454,7 +471,7 @@ handle_lookup (void *cls,
NULL);
return;
}
- clh->lookup = GNS_resolver_lookup (&sh_msg->zone,
+ clh->lookup = GNS_resolver_lookup (&zone,
ntohl (sh_msg->type),
name,
(enum GNUNET_GNS_LocalOptions) ntohs (
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 255f85598..3358692da 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -26,7 +26,6 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
-#include "gnunet_dnsparser_lib.h"
#include "gnunet-service-gns.h"
#include "gnunet-service-gns_resolver.h"
#include "gnunet-service-gns_interceptor.h"
@@ -365,12 +364,6 @@ handle_dns_request (void *cls,
}
-/**
- * Initialized the interceptor
- *
- * @param c the configuration
- * @return #GNUNET_OK on success
- */
int
GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 0d844bc2e..b6a81b3a1 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -39,15 +39,12 @@
#endif
#endif
#include "gnunet_util_lib.h"
-#include "gnunet_dnsstub_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_namecache_service.h"
#include "gnunet_dns_service.h"
#include "gnunet_resolver_service.h"
#include "gnunet_revocation_service.h"
-#include "gnunet_dnsparser_lib.h"
-#include "gnunet_tun_lib.h"
#include "gnunet_gns_service.h"
#include "gns.h"
#include "gnunet-service-gns.h"
@@ -849,7 +846,6 @@ handle_dns_result (void *cls,
* Task scheduled to continue with the resolution process.
*
* @param cls the 'struct GNS_ResolverHandle' of the resolution
- * @param tc task context
*/
static void
recursive_resolution (void *cls);
@@ -1379,7 +1375,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
/**
- * Process a records that were decrypted from a block.
+ * Process records that were decrypted from a block.
*
* @param cls closure with the 'struct GNS_ResolverHandle'
* @param rd_count number of entries in @a rd array
@@ -1894,13 +1890,6 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
}
-/**
- * Process a records that were decrypted from a block.
- *
- * @param cls closure with the `struct GNS_ResolverHandle`
- * @param rd_count number of entries in @a rd array
- * @param rd array of records with data to store
- */
static void
handle_gns_resolution_result (void *cls,
unsigned int rd_count,
@@ -2698,11 +2687,6 @@ recursive_gns_resolution_revocation (struct GNS_ResolverHandle *rh)
}
-/**
- * Task scheduled to continue with the resolution process.
- *
- * @param cls the `struct GNS_ResolverHandle` of the resolution
- */
static void
recursive_resolution (void *cls)
{
@@ -2724,12 +2708,6 @@ recursive_resolution (void *cls)
}
-/**
- * Begin the resolution process from 'name', starting with
- * the identification of the zone specified by 'name'.
- *
- * @param cls the `struct GNS_ResolverHandle`
- */
static void
start_resolver_lookup (void *cls)
{
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c
index 77b4340ee..b05cfff55 100644
--- a/src/gns/nss/nss_gns.c
+++ b/src/gns/nss/nss_gns.c
@@ -19,7 +19,7 @@
USA.
***/
-#include <gnunet_config.h>
+#include <gnunet_private_config.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
@@ -193,7 +193,7 @@ finish:
* @param result the result hostent
* @param buffer the result buffer
* @param buflen length of the buffer
- * @param errnop[out] the low-level error code to return to the application
+ * @param[out] errnop the low-level error code to return to the application
* @param h_errnop idk
* @return a nss_status code
*/
@@ -225,7 +225,7 @@ _nss_gns_gethostbyname_r (const char *name,
* @param result the result hostent
* @param buffer the result buffer
* @param buflen length of the buffer
- * @param errnop[out] the low-level error code to return to the application
+ * @param[out] errnop the low-level error code to return to the application
* @param h_errnop idk
* @return NSS_STATUS_UNAVAIL
*/
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index a683ecacc..75e182092 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -133,7 +133,6 @@ block_plugin_gns_get_key (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/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index 0ce782a43..7c1c9b2e6 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -29,7 +29,6 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_dnsparser_lib.h"
#include "gnunet_gnsrecord_plugin.h"
#include <inttypes.h>
@@ -178,7 +177,7 @@ gns_string_to_value (void *cls,
s);
return GNUNET_SYSERR;
}
- *data_size = GNUNET_IDENTITY_key_get_length (&pk);
+ *data_size = GNUNET_IDENTITY_public_key_get_length (&pk);
if (GNUNET_OK !=
GNUNET_GNSRECORD_data_from_identity (&pk,
(char **) data,
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 3a35c9999..659b77493 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -159,7 +159,7 @@ static struct RequestHandle *requests_tail;
/**
* Cleanup lookup handle
- * @param handle Handle to clean up
+ * @param cls `struct RequestHandle` to clean up
*/
static void
cleanup_handle (void *cls)
diff --git a/src/gns/test_dns2gns.conf b/src/gns/test_dns2gns.conf
index 3b034f8d5..f484d4114 100644
--- a/src/gns/test_dns2gns.conf
+++ b/src/gns/test_dns2gns.conf
@@ -22,7 +22,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
[namestore]
IMMEDIATE_START = YES
-#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
+#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log
[revocation]
WORKBITS = 1
diff --git a/src/gns/test_gns_at_lookup.sh b/src/gns/test_gns_at_lookup.sh
index 998bca700..6a2c958de 100755
--- a/src/gns/test_gns_at_lookup.sh
+++ b/src/gns/test_gns_at_lookup.sh
@@ -25,6 +25,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z delegatedego -a -n '@' -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+sleep 0.5
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u b.$MY_EGO -t A -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -z delegatedego -d -n '@' -t A -V $TEST_IP -e never -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_caa_lookup.sh b/src/gns/test_gns_caa_lookup.sh
index 043a1a937..fb488f47b 100755
--- a/src/gns/test_gns_caa_lookup.sh
+++ b/src/gns/test_gns_caa_lookup.sh
@@ -22,6 +22,7 @@ LABEL="testcaa"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t CAA -V "$TEST_CAA" -e never -c test_gns_lookup.conf
+sleep 0.5
RES_CAA=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t CAA -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n $LABEL -t CAA -V "$TEST_CAA" -e never -c test_gns_lookup.conf
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_delegated_lookup.sh b/src/gns/test_gns_delegated_lookup.sh
index c4885820d..5105abdb5 100755
--- a/src/gns/test_gns_delegated_lookup.sh
+++ b/src/gns/test_gns_delegated_lookup.sh
@@ -28,6 +28,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO |
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $DELEGATION_LABEL -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $OTHER_EGO -a -n $FINAL_LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+sleep 0.5
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $FINAL_LABEL.$DELEGATION_LABEL.$MY_EGO -t A -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -z $OTHER_EGO -d -n $FINAL_LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh
index 8d446c507..da87d8477 100755
--- a/src/gns/test_gns_dht_lookup.sh
+++ b/src/gns/test_gns_dht_lookup.sh
@@ -40,14 +40,12 @@ gnunet-arm -i zonemaster -c test_gns_lookup.conf
#gnunet-arm -r -c test_gns_lookup.conf
#gnunet-arm -i zonemaster
#gnunet-arm -i gns -c test_gns_lookup.conf
-gnunet-arm -I -c test_gns_lookup.conf
#gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf
#gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
#gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
RES_IP_REL=`$DO_TIMEOUT gnunet-gns --raw -u www2.b.$MY_EGO -t A -c test_gns_lookup.conf`
#gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
-gnunet-arm -I -c test_gns_lookup.conf
gnunet-arm -e -c test_gns_lookup.conf
rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
diff --git a/src/gns/test_gns_gns2dns_cname_lookup.sh b/src/gns/test_gns_gns2dns_cname_lookup.sh
index 9315f6b2f..c33c9d132 100755
--- a/src/gns/test_gns_gns2dns_cname_lookup.sh
+++ b/src/gns/test_gns_gns2dns_cname_lookup.sh
@@ -63,8 +63,7 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECOR
gnunet-namestore -z $MY_EGO -D -c test_gns_lookup.conf
-echo "EGOs:"
-gnunet-identity -d
+sleep 0.5
# lookup 'www.gnunet.org', IPv4
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
diff --git a/src/gns/test_gns_gns2dns_lookup.sh b/src/gns/test_gns_gns2dns_lookup.sh
index 240e441a4..43a4756d3 100755
--- a/src/gns/test_gns_gns2dns_lookup.sh
+++ b/src/gns/test_gns_gns2dns_lookup.sh
@@ -18,8 +18,6 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
TEST_IP_ALT2="147.87.255.218"
# IP address of 'www.gnunet.org'
TEST_IP="147.87.255.218"
-# IP address of 'gnunet.org'
-TEST_IP_ALT="131.159.74.67"
# IPv6 address of 'gnunet.org'
TEST_IP6="2a07:6b47:100:464::9357:ffdb"
# permissive DNS resolver we will use for the test
@@ -64,9 +62,9 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2D
# map '$TEST_RECORD_NAME.$MY_EGO' to 'gnunet.org' in DNS
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
+sleep 1
-echo "EGOs:"
-gnunet-identity -d
+gnunet-gns -u $TEST_RECORD_NAME.$MY_EGO -t GNS2DNS -c test_gns_lookup.conf
# lookup 'www.gnunet.org', IPv4
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
@@ -101,7 +99,7 @@ else
ret=1
fi
-if echo "$RES_IP_ALT" | grep "$TEST_IP_ALT" > /dev/null
+if echo "$RES_IP_ALT" | grep "$TEST_IP" > /dev/null
then
echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
else
diff --git a/src/gns/test_gns_gns2dns_zkey_lookup.sh b/src/gns/test_gns_gns2dns_zkey_lookup.sh
index a299c34b6..03549314e 100755
--- a/src/gns/test_gns_gns2dns_zkey_lookup.sh
+++ b/src/gns/test_gns_gns2dns_zkey_lookup.sh
@@ -18,8 +18,6 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
TEST_IP_ALT2="147.87.255.218"
# IP address of 'www.gnunet.org'
TEST_IP="147.87.255.218"
-# IP address of 'www.gnunet.org'
-TEST_IP_ALT="131.159.74.67"
# IPv6 address of 'gnunet.org'
TEST_IP6="2a07:6b47:100:464::9357:ffdb"
# permissive DNS resolver we will use for the test
@@ -65,6 +63,8 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2D
# map '$TEST_RECORD_NAME.$MY_EGO' to 'gnunet.org' in DNS
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf
+sleep 1
+
# lookup 'www.gnunet.org', IPv4
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
# lookup 'www.gnunet.org', IPv6
@@ -98,7 +98,7 @@ else
ret=1
fi
-if echo "$RES_IP_ALT" | grep "$TEST_IP_ALT" > /dev/null
+if echo "$RES_IP_ALT" | grep "$TEST_IP" > /dev/null
then
echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
else
diff --git a/src/gns/test_gns_ipv6_lookup.sh b/src/gns/test_gns_ipv6_lookup.sh
index 9766ac902..31e662f68 100755
--- a/src/gns/test_gns_ipv6_lookup.sh
+++ b/src/gns/test_gns_ipv6_lookup.sh
@@ -21,6 +21,7 @@ TEST_IP="dead::beef"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf
+sleep 0.5
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.$MY_EGO -t AAAA -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_lookup.conf b/src/gns/test_gns_lookup.conf
index db0b4bfbe..322af0784 100644
--- a/src/gns/test_gns_lookup.conf
+++ b/src/gns/test_gns_lookup.conf
@@ -20,7 +20,18 @@ ZONE_PUBLISH_TIME_WINDOW = 1 h
DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
[namestore]
-#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
+#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log
+
+[zonemaster-monitor]
+IMMEDIATE_START = YES
+START_ON_DEMAND = YES
+
+[zonemaster]
+IMMEDIATE_START = YES
+START_ON_DEMAND = YES
+
+[rest]
+BASIC_AUTH_ENABLED=NO
[revocation]
WORKBITS = 2
diff --git a/src/gns/test_gns_lookup.sh b/src/gns/test_gns_lookup.sh
index fe273b2a3..92dfae28b 100755
--- a/src/gns/test_gns_lookup.sh
+++ b/src/gns/test_gns_lookup.sh
@@ -22,6 +22,7 @@ LABEL="www"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+sleep 0.5
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t A -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n $LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_lookup_peer1.conf b/src/gns/test_gns_lookup_peer1.conf
index 1cf0ba628..69e2f0973 100644
--- a/src/gns/test_gns_lookup_peer1.conf
+++ b/src/gns/test_gns_lookup_peer1.conf
@@ -24,7 +24,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
[namestore]
IMMEDIATE_START = YES
-#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
+#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log
[revocation]
WORKBITS = 1
diff --git a/src/gns/test_gns_lookup_peer2.conf b/src/gns/test_gns_lookup_peer2.conf
index 2e861ff0a..3de81d7f3 100644
--- a/src/gns/test_gns_lookup_peer2.conf
+++ b/src/gns/test_gns_lookup_peer2.conf
@@ -29,7 +29,7 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
[namestore]
IMMEDIATE_START = YES
-#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
+#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/ns_log
[revocation]
WORKBITS = 1
diff --git a/src/gns/test_gns_mx_lookup.sh b/src/gns/test_gns_mx_lookup.sh
index 4afc93bb8..6f2b8192d 100755
--- a/src/gns/test_gns_mx_lookup.sh
+++ b/src/gns/test_gns_mx_lookup.sh
@@ -18,13 +18,13 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
MY_EGO="myego"
-TEST_MX="5,mail.+"
+TEST_MX="5 mail.+"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
PKEY=`gnunet-identity -d | grep "$MY_EGO - " | awk '{print $3'}`
-WANT_MX="5,mail.$PKEY"
+WANT_MX="5 mail.$PKEY"
gnunet-namestore -p -z $MY_EGO -a -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf
-
+sleep 0.5
RES_MX=`$DO_TIMEOUT gnunet-gns --raw -u www.$MY_EGO -t MX -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_proxy.conf b/src/gns/test_gns_proxy.conf
index 3b21f1d90..3dfeacafe 100644
--- a/src/gns/test_gns_proxy.conf
+++ b/src/gns/test_gns_proxy.conf
@@ -13,9 +13,18 @@ RECORD_PUT_INTERVAL = 1 h
ZONE_PUBLISH_TIME_WINDOW = 1 h
DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
+[zonemaster-monitor]
+IMMEDIATE_START = YES
+START_ON_DEMAND = YES
+
+[zonemaster]
+IMMEDIATE_START = YES
+START_ON_DEMAND = YES
+
+
[gns-proxy]
-PROXY_CACERT = /tmp/proxy_cacert.pem
+PROXY_CACERT = $GNUNET_TMP/proxy_cacert.pem
PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock
[namestore]
diff --git a/src/gns/test_gns_redirect_lookup.sh b/src/gns/test_gns_redirect_lookup.sh
index dfe5087ef..90729713d 100755
--- a/src/gns/test_gns_redirect_lookup.sh
+++ b/src/gns/test_gns_redirect_lookup.sh
@@ -26,7 +26,7 @@ fi
rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
TEST_IP_PLUS="127.0.0.1"
-TEST_IP_DNS="131.159.74.67"
+TEST_IP_DNS="147.87.255.218"
TEST_RECORD_REDIRECT_SERVER="server"
TEST_RECORD_REDIRECT_PLUS="server.+"
TEST_RECORD_REDIRECT_DNS="gnunet.org"
@@ -48,7 +48,7 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_DNS -t REDIRECT -V $TEST_
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_PLUS -t REDIRECT -V $TEST_RECORD_REDIRECT_PLUS -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_ZKEY -t REDIRECT -V $TEST_RECORD_REDIRECT_ZKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_REDIRECT_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf
-gnunet-namestore -D -z $MY_EGO
+sleep 1
RES_REDIRECT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t A -c test_gns_lookup.conf`
RES_REDIRECT_RAW=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t REDIRECT -c test_gns_lookup.conf`
RES_REDIRECT_ZKEY=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ZKEY -t A -c test_gns_lookup.conf`
diff --git a/src/gns/test_gns_rel_expiration.sh b/src/gns/test_gns_rel_expiration.sh
index 5334e048d..a240cfd0f 100755
--- a/src/gns/test_gns_rel_expiration.sh
+++ b/src/gns/test_gns_rel_expiration.sh
@@ -34,6 +34,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO |
gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf
gnunet-arm -i gns -c test_gns_lookup.conf
+sleep 0.5
# confirm that lookup currently works
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
# remove entry
diff --git a/src/gns/test_gns_revocation.sh b/src/gns/test_gns_revocation.sh
index 500cced1e..2253adcb4 100755
--- a/src/gns/test_gns_revocation.sh
+++ b/src/gns/test_gns_revocation.sh
@@ -26,6 +26,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO |
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf
gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf
+sleep 1
RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
gnunet-revocation -R $OTHER_EGO -p -c test_gns_lookup.conf
RES_IP_REV=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf`
diff --git a/src/gns/test_gns_soa_lookup.sh b/src/gns/test_gns_soa_lookup.sh
index 326b99a8f..a697782bb 100755
--- a/src/gns/test_gns_soa_lookup.sh
+++ b/src/gns/test_gns_soa_lookup.sh
@@ -34,6 +34,7 @@ fi
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf
+sleep 0.5
RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf > /dev/null 2>&1
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
diff --git a/src/gns/test_gns_txt_lookup.sh b/src/gns/test_gns_txt_lookup.sh
index 5956d8bc7..4e36e8ad8 100755
--- a/src/gns/test_gns_txt_lookup.sh
+++ b/src/gns/test_gns_txt_lookup.sh
@@ -22,6 +22,7 @@ LABEL="testtxt"
gnunet-arm -s -c test_gns_lookup.conf
gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf
+sleep 0.5
RES_TXT=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t TXT -c test_gns_lookup.conf`
gnunet-namestore -z $MY_EGO -d -n $LABEL -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf
gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
diff --git a/src/gns/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh
index 25c39f135..3bcfb5a08 100755
--- a/src/gns/test_plugin_rest_gns.sh
+++ b/src/gns/test_plugin_rest_gns.sh
@@ -21,10 +21,10 @@ wrong_link="http://localhost:7776/gnsandmore"
curl_get () {
#$1 is link
#$2 is grep
- XURL=`which gnurl || which curl`
+ XURL=`which curl`
if [ "" = "$XURL" ]
then
- echo "HTTP client (curl/gnurl) not found, exiting"
+ echo "HTTP client (curl) not found, exiting"
exit 77
fi
sleep 0.5
@@ -34,13 +34,14 @@ curl_get () {
then
gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
gnunet-arm -e -c test_gns_lookup.conf
- echo "Download of $1 using $XURL failed"
+ echo "Download of $1 using $XURL failed, expected $2"
exit 1
fi
}
TEST_TLD="testtld"
gnunet-arm -s -c test_gns_lookup.conf
+
curl_get "$gns_link/www.$TEST_TLD" "error"
gnunet-identity -C "$TEST_TLD" -c test_gns_lookup.conf
diff --git a/src/gns/test_proxy.sh b/src/gns/test_proxy.sh
index ee288413f..720fe643d 100755
--- a/src/gns/test_proxy.sh
+++ b/src/gns/test_proxy.sh
@@ -1,9 +1,11 @@
#!/bin/bash
# This file is in the public domain.
TEST_DOMAIN="www.test"
+GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)"
+PROXY_CACERT="$(gnunet-config -f -c test_gnunet_proxy.conf -s gns-proxy -o PROXY_CACERT)"
# Delete old files before starting test
-rm -rf /tmp/gnunet/test-gnunet-gns-testing/
+rm -rf "$GNUNET_TMP/test-gnunet-gns-testing/"
gnunet-arm -s -c test_gns_proxy.conf
gnunet-gns-proxy-setup-ca -c test_gns_