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/arm/gnunet-service-arm.c2
-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_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/gnunet-cadet-profiler.c2
-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/consensus/consensus_api.c2
-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/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_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/curl/curl_reschedule.c40
-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-service-datastore.c15
-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/plugin_block_dns.c1
-rw-r--r--src/exit/gnunet-daemon-exit.c5
-rw-r--r--src/fs/Makefile.am2
-rw-r--r--src/fs/fs.conf.in3
-rw-r--r--src/fs/fs_api.c55
-rw-r--r--src/fs/fs_api.h4
-rw-r--r--src/fs/fs_dirmetascan.c8
-rw-r--r--src/fs/fs_download.c84
-rw-r--r--src/fs/fs_file_information.c69
-rw-r--r--src/fs/fs_list_indexed.c17
-rw-r--r--src/fs/fs_namespace.c15
-rw-r--r--src/fs/fs_publish.c2
-rw-r--r--src/fs/fs_publish_ksk.c6
-rw-r--r--src/fs/fs_publish_ublock.c25
-rw-r--r--src/fs/fs_publish_ublock.h6
-rw-r--r--src/fs/fs_search.c17
-rw-r--r--src/fs/fs_test_lib.c29
-rw-r--r--src/fs/fs_tree.c11
-rw-r--r--src/fs/fs_uri.c17
-rw-r--r--src/fs/gnunet-fs.c92
-rw-r--r--src/fs/gnunet-search.c11
-rw-r--r--src/fs/gnunet-service-fs.c16
-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.c26
-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/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.c3
-rw-r--r--src/fs/test_fs_test_lib.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.c16
-rw-r--r--src/gns/gnunet-gns-proxy.c21
-rw-r--r--src/gns/gnunet-service-gns.c36
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c6
-rw-r--r--src/gns/gnunet-service-gns_resolver.c21
-rw-r--r--src/gns/nss/nss_gns.c4
-rw-r--r--src/gns/plugin_block_gns.c1
-rw-r--r--src/gns/plugin_gnsrecord_gns.c2
-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.c16
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c264
-rw-r--r--src/gnsrecord/gnsrecord_misc.c70
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c17
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c12
-rw-r--r--src/gnsrecord/json_gnsrecord.c162
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c8
-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/.gitignore2
-rw-r--r--src/include/Makefile.am4
-rw-r--r--src/include/block_dns.h5
-rw-r--r--src/include/block_fs.h5
-rw-r--r--src/include/gnunet_abd_service.h9
-rw-r--r--src/include/gnunet_applications.h5
-rw-r--r--src/include/gnunet_ats_application_service.h5
-rw-r--r--src/include/gnunet_ats_plugin.h5
-rw-r--r--src/include/gnunet_ats_service.h28
-rw-r--r--src/include/gnunet_bandwidth_lib.h6
-rw-r--r--src/include/gnunet_bio_lib.h6
-rw-r--r--src/include/gnunet_block_group_lib.h2
-rw-r--r--src/include/gnunet_block_lib.h8
-rw-r--r--src/include/gnunet_block_plugin.h5
-rw-r--r--src/include/gnunet_buffer_lib.h6
-rw-r--r--src/include/gnunet_cadet_service.h8
-rw-r--r--src/include/gnunet_child_management_lib.h6
-rw-r--r--src/include/gnunet_client_lib.h14
-rw-r--r--src/include/gnunet_common.h10
-rw-r--r--src/include/gnunet_configuration_lib.h137
-rw-r--r--src/include/gnunet_consensus_service.h9
-rw-r--r--src/include/gnunet_container_lib.h102
-rw-r--r--src/include/gnunet_conversation_service.h5
-rw-r--r--src/include/gnunet_core_service.h5
-rw-r--r--src/include/gnunet_crypto_lib.h41
-rw-r--r--src/include/gnunet_curl_lib.h20
-rw-r--r--src/include/gnunet_datacache_lib.h5
-rw-r--r--src/include/gnunet_datacache_plugin.h5
-rw-r--r--src/include/gnunet_datastore_plugin.h27
-rw-r--r--src/include/gnunet_datastore_service.h5
-rw-r--r--src/include/gnunet_dht_service.h11
-rw-r--r--src/include/gnunet_dhtu_plugin.h2
-rw-r--r--src/include/gnunet_disk_lib.h8
-rw-r--r--src/include/gnunet_dns_service.h5
-rw-r--r--src/include/gnunet_dnsparser_lib.h5
-rw-r--r--src/include/gnunet_dnsstub_lib.h7
-rw-r--r--src/include/gnunet_fragmentation_lib.h5
-rw-r--r--src/include/gnunet_friends_lib.h5
-rw-r--r--src/include/gnunet_fs_service.h12
-rw-r--r--src/include/gnunet_getopt_lib.h7
-rw-r--r--src/include/gnunet_gns_service.h5
-rw-r--r--src/include/gnunet_gnsrecord_json_lib.h7
-rw-r--r--src/include/gnunet_gnsrecord_lib.h144
-rw-r--r--src/include/gnunet_gnsrecord_plugin.h5
-rw-r--r--src/include/gnunet_hello_lib.h13
-rw-r--r--src/include/gnunet_hello_uri_lib.h5
-rw-r--r--src/include/gnunet_helper_lib.h6
-rw-r--r--src/include/gnunet_identity_service.h95
-rw-r--r--src/include/gnunet_json_lib.h85
-rw-r--r--src/include/gnunet_load_lib.h5
-rw-r--r--src/include/gnunet_messenger_service.h20
-rw-r--r--src/include/gnunet_microphone_lib.h5
-rw-r--r--src/include/gnunet_mq_lib.h25
-rw-r--r--src/include/gnunet_mst_lib.h13
-rw-r--r--src/include/gnunet_my_lib.h19
-rw-r--r--src/include/gnunet_mysql_lib.h6
-rw-r--r--src/include/gnunet_namecache_plugin.h5
-rw-r--r--src/include/gnunet_namecache_service.h5
-rw-r--r--src/include/gnunet_namestore_plugin.h121
-rw-r--r--src/include/gnunet_namestore_service.h293
-rw-r--r--src/include/gnunet_nat_auto_service.h2
-rw-r--r--src/include/gnunet_nc_lib.h8
-rw-r--r--src/include/gnunet_network_lib.h11
-rw-r--r--src/include/gnunet_nse_service.h5
-rw-r--r--src/include/gnunet_nt_lib.h7
-rw-r--r--src/include/gnunet_op_lib.h6
-rw-r--r--src/include/gnunet_os_lib.h6
-rw-r--r--src/include/gnunet_peer_lib.h6
-rw-r--r--src/include/gnunet_peerinfo_service.h6
-rw-r--r--src/include/gnunet_peerstore_plugin.h5
-rw-r--r--src/include/gnunet_peerstore_service.h6
-rw-r--r--src/include/gnunet_plugin_lib.h6
-rw-r--r--src/include/gnunet_pq_lib.h84
-rw-r--r--src/include/gnunet_program_lib.h6
-rw-r--r--src/include/gnunet_protocols.h28
-rw-r--r--src/include/gnunet_reclaim_lib.h21
-rw-r--r--src/include/gnunet_reclaim_plugin.h5
-rw-r--r--src/include/gnunet_reclaim_service.h52
-rw-r--r--src/include/gnunet_regex_service.h5
-rw-r--r--src/include/gnunet_resolver_service.h5
-rw-r--r--src/include/gnunet_rest_lib.h5
-rw-r--r--src/include/gnunet_rest_plugin.h5
-rw-r--r--src/include/gnunet_revocation_service.h5
-rw-r--r--src/include/gnunet_rps_service.h5
-rw-r--r--src/include/gnunet_scalarproduct_service.h2
-rw-r--r--src/include/gnunet_scheduler_lib.h6
-rw-r--r--src/include/gnunet_service_lib.h15
-rw-r--r--src/include/gnunet_set_service.h15
-rw-r--r--src/include/gnunet_seti_service.h5
-rw-r--r--src/include/gnunet_setu_service.h11
-rw-r--r--src/include/gnunet_signal_lib.h6
-rw-r--r--src/include/gnunet_socks.h5
-rw-r--r--src/include/gnunet_speaker_lib.h5
-rw-r--r--src/include/gnunet_sq_lib.h2
-rw-r--r--src/include/gnunet_statistics_service.h5
-rw-r--r--src/include/gnunet_strings_lib.h10
-rw-r--r--src/include/gnunet_testbed_logger_service.h5
-rw-r--r--src/include/gnunet_testbed_service.h13
-rw-r--r--src/include/gnunet_testing_lib.h11
-rw-r--r--src/include/gnunet_testing_netjail_lib.h70
-rw-r--r--src/include/gnunet_testing_ng_lib.h4
-rw-r--r--src/include/gnunet_testing_plugin.h6
-rw-r--r--src/include/gnunet_time_lib.h8
-rw-r--r--src/include/gnunet_transport_application_service.h9
-rw-r--r--src/include/gnunet_transport_communication_service.h10
-rw-r--r--src/include/gnunet_transport_core_service.h5
-rw-r--r--src/include/gnunet_transport_hello_service.h5
-rw-r--r--src/include/gnunet_transport_manipulation_service.h5
-rw-r--r--src/include/gnunet_transport_monitor_service.h5
-rw-r--r--src/include/gnunet_transport_plugin.h5
-rw-r--r--src/include/gnunet_transport_service.h10
-rw-r--r--src/include/gnunet_tun_lib.h5
-rw-r--r--src/include/gnunet_util_lib.h1
-rw-r--r--src/include/gnunet_vpn_service.h5
-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.c14
-rw-r--r--src/messenger/gnunet-service-messenger.c257
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.c30
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.h24
-rw-r--r--src/messenger/gnunet-service-messenger_handle.c4
-rw-r--r--src/messenger/gnunet-service-messenger_handle.h26
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.h10
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.h8
-rw-r--r--src/messenger/gnunet-service-messenger_member.h20
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.h16
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.h12
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.h32
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.h2
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.h12
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.h16
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.c2
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.h12
-rw-r--r--src/messenger/gnunet-service-messenger_operation.h8
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.h8
-rw-r--r--src/messenger/gnunet-service-messenger_room.h56
-rw-r--r--src/messenger/gnunet-service-messenger_service.h32
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.h26
-rw-r--r--src/messenger/messenger_api.c14
-rw-r--r--src/messenger/messenger_api_contact.h10
-rw-r--r--src/messenger/messenger_api_contact_store.h14
-rw-r--r--src/messenger/messenger_api_handle.h18
-rw-r--r--src/messenger/messenger_api_list_tunnels.h16
-rw-r--r--src/messenger/messenger_api_message.c18
-rw-r--r--src/messenger/messenger_api_message.h10
-rw-r--r--src/messenger/messenger_api_room.h12
-rw-r--r--src/messenger/messenger_api_util.h2
-rw-r--r--src/messenger/testing_messenger_barrier.h4
-rw-r--r--src/my/my_query_helper.c14
-rw-r--r--src/my/my_result_helper.c11
-rw-r--r--src/mysql/mysql.c1
-rw-r--r--src/namecache/Makefile.am10
-rw-r--r--src/namecache/gnunet-service-namecache.c2
-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.c1
-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.c4
-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.c1403
-rw-r--r--src/namestore/gnunet-service-namestore.c1471
-rw-r--r--src/namestore/gnunet-zoneimport.c20
-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.c590
-rw-r--r--src/namestore/namestore_api_monitor.c119
-rw-r--r--src/namestore/perf_namestore_api_flat.conf10
-rw-r--r--src/namestore/perf_namestore_api_import.c406
-rw-r--r--src/namestore/perf_namestore_api_postgres.conf5
-rw-r--r--src/namestore/perf_namestore_api_sqlite.conf1
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c5
-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.c61
-rw-r--r--src/namestore/test_namestore_api.conf21
-rw-r--r--src/namestore/test_namestore_api_edit_records.c399
-rw-r--r--src/namestore/test_namestore_api_flat.conf7
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c10
-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.c5
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c46
-rw-r--r--src/namestore/test_namestore_api_postgres.conf3
-rw-r--r--src/namestore/test_namestore_api_remove.c20
-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.c4
-rw-r--r--src/namestore/test_namestore_api_store_update.c75
-rw-r--r--src/namestore/test_namestore_api_tx_rollback.c (renamed from src/namestore/test_namestore_api_lookup_private.c)186
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c7
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c16
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c7
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c6
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c8
-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.c20
-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-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.c20
-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_api.c23
-rw-r--r--src/peerstore/peerstore_api.c11
-rw-r--r--src/peerstore/peerstore_common.c6
-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/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.c264
-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.c116
-rw-r--r--src/reclaim/oidc_helper.c38
-rw-r--r--src/reclaim/oidc_helper.h6
-rw-r--r--src/reclaim/plugin_reclaim_credential_jwt.c12
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c48
-rw-r--r--src/reclaim/plugin_rest_reclaim.c4
-rw-r--r--src/reclaim/reclaim.h170
-rw-r--r--src/reclaim/reclaim_api.c499
-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
-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-service-regex.c6
-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/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.c7
-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/scalarproduct/gnunet-scalarproduct.c1
-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_protocol.h8
-rw-r--r--src/set/gnunet-service-set.c4
-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/set_api.c63
-rw-r--r--src/seti/seti_api.c26
-rw-r--r--src/setu/ibf.c30
-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.c10
-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.c9
-rw-r--r--src/testbed/gnunet-service-testbed.h11
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c4
-rw-r--r--src/testbed/gnunet-service-testbed_peers.c18
-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.h4
-rw-r--r--src/testbed/testbed_api_peers.c55
-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/testing/gnunet-cmds-helper.c70
-rw-r--r--src/testing/testing.c365
-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.am77
-rw-r--r--src/transport/gnunet-communicator-tcp.c37
-rw-r--r--src/transport/gnunet-communicator-udp.c19
-rw-r--r--src/transport/gnunet-service-tng.c597
-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/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.sh11
-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.c28
-rw-r--r--src/transport/transport-testing-main.c2
-rw-r--r--src/transport/transport-testing-main2.c2
-rw-r--r--src/transport/transport-testing2.c33
-rw-r--r--src/transport/transport-testing2.h2
-rw-r--r--src/transport/transport.h5
-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.am6
-rw-r--r--src/util/bandwidth.c35
-rw-r--r--src/util/bio.c3
-rw-r--r--src/util/child_management.c2
-rw-r--r--src/util/client.c24
-rw-r--r--src/util/common_allocation.c17
-rw-r--r--src/util/common_endian.c10
-rw-r--r--src/util/common_logging.c80
-rw-r--r--src/util/configuration.c6
-rw-r--r--src/util/container_bloomfilter.c11
-rw-r--r--src/util/container_heap.c62
-rw-r--r--src/util/container_meta_data.c70
-rw-r--r--src/util/container_multihashmap.c125
-rw-r--r--src/util/container_multihashmap32.c77
-rw-r--r--src/util/container_multipeermap.c137
-rw-r--r--src/util/container_multishortmap.c112
-rw-r--r--src/util/container_multiuuidmap.c112
-rw-r--r--src/util/crypto_crc.c33
-rw-r--r--src/util/crypto_ecc.c21
-rw-r--r--src/util/crypto_ecc_setup.c27
-rw-r--r--src/util/crypto_hash.c3
-rw-r--r--src/util/crypto_hash_file.c10
-rw-r--r--src/util/crypto_paillier.c22
-rw-r--r--src/util/crypto_random.c13
-rw-r--r--src/util/crypto_rsa.c2
-rw-r--r--src/util/crypto_symmetric.c9
-rw-r--r--src/util/dnsparser.c4
-rw-r--r--src/util/dnsstub.c14
-rw-r--r--src/util/gnunet-config.c19
-rw-r--r--src/util/gnunet-crypto-tvg.c5
-rw-r--r--src/util/gnunet-scrypt.c1
-rw-r--r--src/util/gnunet-service-resolver.c8
-rw-r--r--src/util/helper.c46
-rw-r--r--src/util/mq.c1
-rw-r--r--src/util/mst.c35
-rw-r--r--src/util/network.c23
-rw-r--r--src/util/os_installation.c5
-rw-r--r--src/util/os_priority.c51
-rw-r--r--src/util/peer.c12
-rw-r--r--src/util/plugin.c68
-rw-r--r--src/util/regex.c42
-rw-r--r--src/util/scheduler.c28
-rw-r--r--src/util/service.c2
-rw-r--r--src/util/socks.c2
-rw-r--r--src/util/speedup.c6
-rw-r--r--src/util/tun.c39
-rw-r--r--src/vpn/gnunet-service-vpn.c4
-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.c877
-rw-r--r--src/zonemaster/zonemaster.conf.in19
637 files changed, 14406 insertions, 12685 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/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/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_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/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c
index e61053f94..b84337370 100644
--- a/src/cadet/gnunet-cadet-profiler.c
+++ b/src/cadet/gnunet-cadet-profiler.c
@@ -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/consensus/consensus_api.c b/src/consensus/consensus_api.c
index b4a9e5d39..d0af2d2d9 100644
--- a/src/consensus/consensus_api.c
+++ b/src/consensus/consensus_api.c
@@ -305,8 +305,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/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_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/curl/curl_reschedule.c b/src/curl/curl_reschedule.c
index a1fe55aa5..0c19bd171 100644
--- a/src/curl/curl_reschedule.c
+++ b/src/curl/curl_reschedule.c
@@ -59,12 +59,6 @@ struct GNUNET_CURL_RescheduleContext
};
-/**
- * Initialize reschedule context; with custom response parser
- *
- * @param ctx context to manage
- * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
- */
struct GNUNET_CURL_RescheduleContext *
GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx,
GNUNET_CURL_RawParser rp,
@@ -93,12 +87,6 @@ clean_result (void *response)
}
-/**
- * Initialize reschedule context.
- *
- * @param ctx context to manage
- * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
- */
struct GNUNET_CURL_RescheduleContext *
GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
{
@@ -112,11 +100,6 @@ GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
}
-/**
- * Destroy reschedule context.
- *
- * @param rc context to destroy
- */
void
GNUNET_CURL_gnunet_rc_destroy (struct GNUNET_CURL_RescheduleContext *rc)
{
@@ -159,13 +142,18 @@ context_task (void *cls)
&timeout);
if (timeout >= 0)
delay =
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, timeout);
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+ timeout);
else
delay = GNUNET_TIME_UNIT_FOREVER_REL;
rs = GNUNET_NETWORK_fdset_create ();
- GNUNET_NETWORK_fdset_copy_native (rs, &read_fd_set, max_fd + 1);
+ GNUNET_NETWORK_fdset_copy_native (rs,
+ &read_fd_set,
+ max_fd + 1);
ws = GNUNET_NETWORK_fdset_create ();
- GNUNET_NETWORK_fdset_copy_native (ws, &write_fd_set, max_fd + 1);
+ GNUNET_NETWORK_fdset_copy_native (ws,
+ &write_fd_set,
+ max_fd + 1);
if (NULL == rc->task)
rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
delay,
@@ -178,15 +166,6 @@ context_task (void *cls)
}
-/**
- * Implementation of the #GNUNET_CURL_RescheduleCallback for GNUnet's
- * scheduler. Will run the CURL context using GNUnet's scheduler.
- * Note that you MUST immediately destroy the reschedule context after
- * calling #GNUNET_CURL_fini().
- *
- * @param cls must point to a `struct GNUNET_CURL_RescheduleContext *`
- * (pointer to a pointer!)
- */
void
GNUNET_CURL_gnunet_scheduler_reschedule (void *cls)
{
@@ -194,7 +173,8 @@ GNUNET_CURL_gnunet_scheduler_reschedule (void *cls)
if (NULL != rc->task)
GNUNET_SCHEDULER_cancel (rc->task);
- rc->task = GNUNET_SCHEDULER_add_now (&context_task, rc);
+ rc->task = GNUNET_SCHEDULER_add_now (&context_task,
+ rc);
}
diff --git a/src/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-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_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/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..425f7c816 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -1821,7 +1821,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 +1861,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 +3231,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/fs/Makefile.am b/src/fs/Makefile.am
index 3d8ec2bac..56df4bfc7 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -273,7 +273,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 \
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_api.c b/src/fs/fs_api.c
index 63b17a93e..6e97a3812 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -316,17 +316,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 +504,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)
{
@@ -3207,16 +3190,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 +3229,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 +3305,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..7c0c58bff 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -670,7 +670,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 +839,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);
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index cb50182f9..8dd216324 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -112,14 +112,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)
{
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 5c98d224a..102b297c1 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -184,9 +184,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
@@ -1004,15 +1004,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 +1422,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)
@@ -1958,12 +1948,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)
{
@@ -2111,36 +2095,6 @@ 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,
@@ -2178,40 +2132,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,
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index c5faa14d4..dc5db9d3f 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -83,20 +83,6 @@ 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,
@@ -157,22 +143,6 @@ GNUNET_FS_file_information_create_from_file (
}
-/**
- * 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,
@@ -202,22 +172,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,
@@ -267,18 +221,6 @@ 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,
@@ -303,17 +245,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)
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c
index 0e16fb01b..eaee4ce55 100644
--- a/src/fs/fs_list_indexed.c
+++ b/src/fs/fs_list_indexed.c
@@ -148,21 +148,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_namespace.c b/src/fs/fs_namespace.c
index 155486be5..bc94dd1fc 100644
--- a/src/fs/fs_namespace.c
+++ b/src/fs/fs_namespace.c
@@ -423,21 +423,6 @@ 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,
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index f891f37a1..5cdf8f6e8 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -699,7 +699,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;
diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c
index 372ac705d..dae5ccdf3 100644
--- a/src/fs/fs_publish_ksk.c
+++ b/src/fs/fs_publish_ksk.c
@@ -139,12 +139,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)
{
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c
index fd6f2bd72..aed090bb3 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,22 +149,6 @@ 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,
diff --git a/src/fs/fs_publish_ublock.h b/src/fs/fs_publish_ublock.h
index 83c6a50aa..bd1c1a4dd 100644
--- a/src/fs/fs_publish_ublock.h
+++ b/src/fs/fs_publish_ublock.h
@@ -38,7 +38,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 +81,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,
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 3dbee43ef..5538b7838 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -927,7 +927,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 +942,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 +1397,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)
{
@@ -1557,12 +1550,6 @@ search_result_suspend (void *cls,
}
-/**
- * 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)
{
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_uri.c b/src/fs/fs_uri.c
index 2d5566b54..cdea8b72d 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -91,14 +91,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)
@@ -723,15 +715,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,
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 70a0034a0..0f8f02a1c 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -36,6 +36,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 +57,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 +119,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 +154,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 +168,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-search.c b/src/fs/gnunet-search.c
index 7e2e4d2a6..54f0095ea 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -114,6 +114,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.
@@ -474,7 +476,7 @@ progress_cb (void *const cls,
break;
case GNUNET_FS_STATUS_SEARCH_RESULT:
- if (silent_mode)
+ if (stop_searching)
break;
if (db != NULL)
@@ -484,6 +486,9 @@ 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 (
info->value.search.specifics.result.meta,
@@ -513,7 +518,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;
@@ -558,7 +563,7 @@ static void
timeout_task (void *const cls)
{
tt = NULL;
- silent_mode = GNUNET_YES;
+ stop_searching = GNUNET_YES;
GNUNET_SCHEDULER_shutdown ();
}
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 05c7e2192..7da92ed44 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -603,7 +603,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 +1041,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 +1063,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 +1144,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..b88cbe365 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -246,26 +246,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 +481,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_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/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..11677a6b2 100644
--- a/src/fs/plugin_block_fs.c
+++ b/src/fs/plugin_block_fs.c
@@ -158,10 +158,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_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_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..960d84fb3 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -193,7 +193,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 +561,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 +904,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 +1000,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-service-gns.c b/src/gns/gnunet-service-gns.c
index b28236fed..7e770ce5a 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -395,10 +395,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 +413,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 +421,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 +472,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..86c059c5f 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -365,12 +365,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..45d971c85 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -849,7 +849,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 +1378,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 +1893,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 +2690,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 +2711,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..ff34cedd5 100644
--- a/src/gns/nss/nss_gns.c
+++ b/src/gns/nss/nss_gns.c
@@ -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..296957f19 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -178,7 +178,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_proxy.conf
@@ -27,8 +29,9 @@ HEXCERT=`xxd -p local.der | tr -d '\n'`
#echo "This is the certificate the server does use: $HEXCERT"
BOXVALUE="6 8443 52 3 0 0 $HEXCERT"
-cat local.crt > /tmp/server_cacert.pem
-cat local.key >> /tmp/server_cacert.pem
+SERVER_CACERT="$GNUNET_TMP/server_cacert.pem"
+cat local.crt > "$SERVER_CACERT"
+cat local.key >> "$SERVER_CACERT"
gnunet-identity -C test -c test_gns_proxy.conf
gnunet-namestore -p -z "test" -a -n www -t A -V 127.0.0.1 -e never -c test_gns_proxy.conf
@@ -38,13 +41,13 @@ gnunet-namestore -p -z "test" -a -n www -t BOX -V "$BOXVALUE" -e never -c test_g
gnunet-arm -i gns-proxy -c test_gns_proxy.conf
-#gnurl --socks5-hostname 127.0.0.1:7777 https://www.test -v --cacert /tmp/proxy_cacert.pem
-./test_gns_proxy -A /tmp/proxy_cacert.pem -S /tmp/server_cacert.pem -p 8443 -c test_gns_proxy.conf
+#gnurl --socks5-hostname 127.0.0.1:7777 "https://$TEST_DOMAIN" -v --cacert "$PROXY_CACERT"
+./test_gns_proxy -A "$PROXY_CACERT" -S "$SERVER_CACERT" -p 8443 -c test_gns_proxy.conf
RES=$?
-rm /tmp/proxy_cacert.pem
-rm /tmp/server_cacert.pem
+rm "$PROXY_CACERT"
+rm "$SERVER_CACERT"
gnunet-arm -e test_gns_proxy.conf
diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c
index 52c480ef6..ae4223021 100644
--- a/src/gnsrecord/gnsrecord.c
+++ b/src/gnsrecord/gnsrecord.c
@@ -174,16 +174,6 @@ GNUNET_GNSRECORD_value_to_string (uint32_t type,
}
-/**
- * Convert human-readable version of a 'value' of a record to the binary
- * representation.
- *
- * @param type type of the record
- * @param s human-readable string
- * @param data set to value in binary encoding (will be allocated)
- * @param data_size set to number of bytes in @a data
- * @return #GNUNET_OK on success
- */
int
GNUNET_GNSRECORD_string_to_value (uint32_t type,
const char *s,
@@ -207,12 +197,6 @@ GNUNET_GNSRECORD_string_to_value (uint32_t type,
}
-/**
- * Convert a type name (e.g "AAAA") to the corresponding number.
- *
- * @param dns_typename name to convert
- * @return corresponding number, UINT32_MAX on error
- */
uint32_t
GNUNET_GNSRECORD_typename_to_number (const char *dns_typename)
{
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index b5e8be82b..a62304c40 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -95,7 +95,8 @@ eddsa_symmetric_decrypt (
if (ctlen < 0)
return GNUNET_SYSERR;
if (0 != crypto_secretbox_open_detached (result,
- ((unsigned char*) block) + crypto_secretbox_MACBYTES, // Ciphertext
+ ((unsigned char*) block)
+ + crypto_secretbox_MACBYTES, // Ciphertext
block, // Tag
ctlen,
nonce, key))
@@ -193,6 +194,116 @@ block_get_size_ecdsa (const struct GNUNET_GNSRECORD_Data *rd,
return len;
}
+enum GNUNET_GenericReturnValue
+block_sign_ecdsa (const struct
+ GNUNET_CRYPTO_EcdsaPrivateKey *key,
+ const struct
+ GNUNET_CRYPTO_EcdsaPublicKey *pkey,
+ const char *label,
+ struct GNUNET_GNSRECORD_Block *block)
+{
+ struct GNRBlockPS *gnr_block;
+ struct GNUNET_GNSRECORD_EcdsaBlock *ecblock;
+ size_t size = ntohl (block->size) - sizeof (*block) + sizeof (*gnr_block);
+
+ gnr_block = GNUNET_malloc (size);
+ ecblock = &(block)->ecdsa_block;
+ gnr_block->purpose.size = htonl (size);
+ gnr_block->purpose.purpose =
+ htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
+ gnr_block->expiration_time = ecblock->expiration_time;
+ /* encrypt and sign */
+ GNUNET_memcpy (&gnr_block[1], &ecblock[1],
+ size - sizeof (*gnr_block));
+ GNUNET_CRYPTO_ecdsa_public_key_derive (pkey,
+ label,
+ "gns",
+ &ecblock->derived_key);
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_ecdsa_sign_derived (key,
+ label,
+ "gns",
+ &gnr_block->purpose,
+ &ecblock->signature))
+ {
+ GNUNET_break (0);
+ GNUNET_free (gnr_block);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (gnr_block);
+ return GNUNET_OK;
+}
+
+
+enum GNUNET_GenericReturnValue
+block_sign_eddsa (const struct
+ GNUNET_CRYPTO_EddsaPrivateKey *key,
+ const struct
+ GNUNET_CRYPTO_EddsaPublicKey *pkey,
+ const char *label,
+ struct GNUNET_GNSRECORD_Block *block)
+{
+ struct GNRBlockPS *gnr_block;
+ struct GNUNET_GNSRECORD_EddsaBlock *edblock;
+ size_t size = ntohl (block->size) - sizeof (*block) + sizeof (*gnr_block);
+ gnr_block = GNUNET_malloc (size);
+ edblock = &(block)->eddsa_block;
+ gnr_block->purpose.size = htonl (size);
+ gnr_block->purpose.purpose =
+ htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
+ gnr_block->expiration_time = edblock->expiration_time;
+ GNUNET_memcpy (&gnr_block[1], &edblock[1],
+ size - sizeof (*gnr_block));
+ /* encrypt and sign */
+ GNUNET_CRYPTO_eddsa_public_key_derive (pkey,
+ label,
+ "gns",
+ &edblock->derived_key);
+ GNUNET_CRYPTO_eddsa_sign_derived (key,
+ label,
+ "gns",
+ &gnr_block->purpose,
+ &edblock->signature);
+ GNUNET_free (gnr_block);
+ return GNUNET_OK;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_GNSRECORD_block_sign (const struct
+ GNUNET_IDENTITY_PrivateKey *key,
+ const char *label,
+ struct GNUNET_GNSRECORD_Block *block)
+{
+ struct GNUNET_IDENTITY_PublicKey pkey;
+ enum GNUNET_GenericReturnValue res = GNUNET_SYSERR;
+ char *norm_label;
+
+ GNUNET_IDENTITY_key_get_public (key,
+ &pkey);
+ norm_label = GNUNET_GNSRECORD_string_normalize (label);
+
+ switch (ntohl (key->type))
+ {
+ case GNUNET_GNSRECORD_TYPE_PKEY:
+ res = block_sign_ecdsa (&key->ecdsa_key,
+ &pkey.ecdsa_key,
+ norm_label,
+ block);
+ break;
+ case GNUNET_GNSRECORD_TYPE_EDKEY:
+ res = block_sign_eddsa (&key->eddsa_key,
+ &pkey.eddsa_key,
+ norm_label,
+ block);
+ break;
+ default:
+ GNUNET_assert (0);
+ }
+ GNUNET_free (norm_label);
+ return res;
+}
+
/**
* Sign name and records
@@ -204,6 +315,7 @@ block_get_size_ecdsa (const struct GNUNET_GNSRECORD_Data *rd,
* @param rd record data
* @param rd_count number of records
* @param block the block result. Must be allocated sufficiently.
+ * @param sign sign the block GNUNET_NO if block will be signed later.
* @return GNUNET_SYSERR on error (otherwise GNUNET_OK)
*/
static enum GNUNET_GenericReturnValue
@@ -213,12 +325,12 @@ block_create_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
const char *label,
const struct GNUNET_GNSRECORD_Data *rd,
unsigned int rd_count,
- struct GNUNET_GNSRECORD_Block **block)
+ struct GNUNET_GNSRECORD_Block **block,
+ int sign)
{
ssize_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count,
rd);
struct GNUNET_GNSRECORD_EcdsaBlock *ecblock;
- struct GNRBlockPS *gnr_block;
unsigned char ctr[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
unsigned char skey[GNUNET_CRYPTO_AES_KEY_LENGTH];
struct GNUNET_GNSRECORD_Data rdc[GNUNET_NZL (rd_count)];
@@ -251,7 +363,7 @@ block_create_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
}
/* serialize */
*block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block) + payload_len);
- (*block)->size = htonl(sizeof (struct GNUNET_GNSRECORD_Block) + payload_len);
+ (*block)->size = htonl (sizeof (struct GNUNET_GNSRECORD_Block) + payload_len);
{
char payload[payload_len];
@@ -260,19 +372,9 @@ block_create_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
rdc,
payload_len,
payload));
- gnr_block = GNUNET_malloc (sizeof (struct GNRBlockPS) + payload_len);
ecblock = &(*block)->ecdsa_block;
(*block)->type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
- gnr_block->purpose.size = htonl (sizeof(struct GNRBlockPS) + payload_len);
- gnr_block->purpose.purpose =
- htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
- gnr_block->expiration_time = GNUNET_TIME_absolute_hton (expire);
- ecblock->expiration_time = gnr_block->expiration_time;
- /* encrypt and sign */
- GNUNET_CRYPTO_ecdsa_public_key_derive (pkey,
- label,
- "gns",
- &ecblock->derived_key);
+ ecblock->expiration_time = GNUNET_TIME_absolute_hton (expire);
GNR_derive_block_aes_key (ctr,
skey,
label,
@@ -284,21 +386,16 @@ block_create_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
skey,
ctr,
&ecblock[1]));
- GNUNET_memcpy (&gnr_block[1], &ecblock[1], payload_len);
}
+ if (GNUNET_YES != sign)
+ return GNUNET_OK;
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_sign_derived (key,
- label,
- "gns",
- &gnr_block->purpose,
- &ecblock->signature))
+ block_sign_ecdsa (key, pkey, label, *block))
{
GNUNET_break (0);
GNUNET_free (*block);
- GNUNET_free (gnr_block);
return GNUNET_SYSERR;
}
- GNUNET_free (gnr_block);
return GNUNET_OK;
}
@@ -327,6 +424,7 @@ block_get_size_eddsa (const struct GNUNET_GNSRECORD_Data *rd,
* @param rd record data
* @param rd_count number of records
* @param block where to store the block. Must be allocated sufficiently.
+ * @param sign GNUNET_YES if block shall be signed as well
* @return GNUNET_SYSERR on error (otherwise GNUNET_OK)
*/
enum GNUNET_GenericReturnValue
@@ -336,12 +434,12 @@ block_create_eddsa (const struct GNUNET_CRYPTO_EddsaPrivateKey *key,
const char *label,
const struct GNUNET_GNSRECORD_Data *rd,
unsigned int rd_count,
- struct GNUNET_GNSRECORD_Block **block)
+ struct GNUNET_GNSRECORD_Block **block,
+ int sign)
{
ssize_t payload_len = GNUNET_GNSRECORD_records_get_size (rd_count,
rd);
struct GNUNET_GNSRECORD_EddsaBlock *edblock;
- struct GNRBlockPS *gnr_block;
unsigned char nonce[crypto_secretbox_NONCEBYTES];
unsigned char skey[crypto_secretbox_KEYBYTES];
struct GNUNET_GNSRECORD_Data rdc[GNUNET_NZL (rd_count)];
@@ -375,8 +473,8 @@ block_create_eddsa (const struct GNUNET_CRYPTO_EddsaPrivateKey *key,
/* serialize */
*block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block)
+ payload_len + crypto_secretbox_MACBYTES);
- (*block)->size = htonl(sizeof (struct GNUNET_GNSRECORD_Block)
- + payload_len + crypto_secretbox_MACBYTES);
+ (*block)->size = htonl (sizeof (struct GNUNET_GNSRECORD_Block)
+ + payload_len + crypto_secretbox_MACBYTES);
{
char payload[payload_len];
@@ -385,24 +483,9 @@ block_create_eddsa (const struct GNUNET_CRYPTO_EddsaPrivateKey *key,
rdc,
payload_len,
payload));
- gnr_block = GNUNET_malloc (sizeof (struct GNRBlockPS)
- + payload_len
- + crypto_secretbox_MACBYTES);
edblock = &(*block)->eddsa_block;
(*block)->type = htonl (GNUNET_GNSRECORD_TYPE_EDKEY);
- gnr_block->purpose.size =
- htonl (sizeof(struct GNRBlockPS)
- + payload_len
- + crypto_secretbox_MACBYTES);
- gnr_block->purpose.purpose =
- htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
- gnr_block->expiration_time = GNUNET_TIME_absolute_hton (expire);
- edblock->expiration_time = gnr_block->expiration_time;
- /* encrypt and sign */
- GNUNET_CRYPTO_eddsa_public_key_derive (pkey,
- label,
- "gns",
- &edblock->derived_key);
+ edblock->expiration_time = GNUNET_TIME_absolute_hton (expire);
GNR_derive_block_xsalsa_key (nonce,
skey,
label,
@@ -414,14 +497,9 @@ block_create_eddsa (const struct GNUNET_CRYPTO_EddsaPrivateKey *key,
skey,
nonce,
&edblock[1]));
- GNUNET_memcpy (&gnr_block[1], &edblock[1],
- payload_len + crypto_secretbox_MACBYTES);
-
- GNUNET_CRYPTO_eddsa_sign_derived (key,
- label,
- "gns",
- &gnr_block->purpose,
- &edblock->signature);
+ if (GNUNET_YES != sign)
+ return GNUNET_OK;
+ block_sign_eddsa (key, pkey, label, *block);
}
return GNUNET_OK;
}
@@ -477,7 +555,8 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
norm_label,
rd,
rd_count,
- result);
+ result,
+ GNUNET_YES);
break;
case GNUNET_GNSRECORD_TYPE_EDKEY:
res = block_create_eddsa (&key->eddsa_key,
@@ -486,7 +565,8 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
norm_label,
rd,
rd_count,
- result);
+ result,
+ GNUNET_YES);
break;
default:
GNUNET_assert (0);
@@ -513,13 +593,14 @@ struct KeyCacheLine
};
-enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
- struct GNUNET_TIME_Absolute expire,
- const char *label,
- const struct GNUNET_GNSRECORD_Data *rd,
- unsigned int rd_count,
- struct GNUNET_GNSRECORD_Block **result)
+static enum GNUNET_GenericReturnValue
+block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
+ struct GNUNET_TIME_Absolute expire,
+ const char *label,
+ const struct GNUNET_GNSRECORD_Data *rd,
+ unsigned int rd_count,
+ struct GNUNET_GNSRECORD_Block **result,
+ int sign)
{
const struct GNUNET_CRYPTO_EcdsaPrivateKey *key;
struct GNUNET_CRYPTO_EddsaPublicKey edpubkey;
@@ -552,7 +633,8 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
norm_label,
rd,
rd_count,
- result);
+ result,
+ sign);
}
else if (GNUNET_IDENTITY_TYPE_EDDSA == ntohl (pkey->type))
{
@@ -564,13 +646,40 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
norm_label,
rd,
rd_count,
- result);
+ result,
+ sign);
}
GNUNET_free (norm_label);
return res;
}
+
+enum GNUNET_GenericReturnValue
+GNUNET_GNSRECORD_block_create_unsigned (const struct
+ GNUNET_IDENTITY_PrivateKey *pkey,
+ struct GNUNET_TIME_Absolute expire,
+ const char *label,
+ const struct GNUNET_GNSRECORD_Data *rd,
+ unsigned int rd_count,
+ struct GNUNET_GNSRECORD_Block **result)
+{
+ return block_create2 (pkey, expire, label, rd, rd_count, result, GNUNET_NO);
+}
+
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
+ struct GNUNET_TIME_Absolute expire,
+ const char *label,
+ const struct GNUNET_GNSRECORD_Data *rd,
+ unsigned int rd_count,
+ struct GNUNET_GNSRECORD_Block **result)
+{
+ return block_create2 (pkey, expire, label, rd, rd_count, result, GNUNET_YES);
+}
+
/**
* Check if a signature is valid. This API is used by the GNS Block
* to validate signatures received from the network.
@@ -684,7 +793,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block,
continue;
}
- if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD))
+ if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW))
{
int include_record = GNUNET_YES;
/* Shadow record, figure out if we have a not expired active record */
@@ -696,7 +805,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block,
include_record = GNUNET_NO; /* Shadow record is expired */
if ((rd[k].record_type == rd[i].record_type) &&
(rd[k].expiration_time >= now.abs_value_us) &&
- (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)))
+ (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW)))
{
include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -706,7 +815,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block,
}
if (GNUNET_YES == include_record)
{
- rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW_RECORD; /* Remove Flag */
+ rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW; /* Remove Flag */
if (j != i)
rd[j] = rd[i];
j++;
@@ -810,7 +919,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block,
continue;
}
- if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD))
+ if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW))
{
int include_record = GNUNET_YES;
/* Shadow record, figure out if we have a not expired active record */
@@ -822,7 +931,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block,
include_record = GNUNET_NO; /* Shadow record is expired */
if ((rd[k].record_type == rd[i].record_type) &&
(rd[k].expiration_time >= now.abs_value_us) &&
- (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)))
+ (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW)))
{
include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -832,7 +941,7 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block,
}
if (GNUNET_YES == include_record)
{
- rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW_RECORD; /* Remove Flag */
+ rd[i].flags ^= GNUNET_GNSRECORD_RF_SHADOW; /* Remove Flag */
if (j != i)
rd[j] = rd[i];
j++;
@@ -868,17 +977,6 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block,
}
-/**
- * Decrypt block.
- *
- * @param block block to decrypt
- * @param zone_key public key of the zone
- * @param label the name for the records
- * @param proc function to call with the result
- * @param proc_cls closure for proc
- * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
- * not well-formed
- */
enum GNUNET_GenericReturnValue
GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
const struct
@@ -946,14 +1044,6 @@ GNUNET_GNSRECORD_query_from_private_key (const struct
}
-/**
- * Calculate the DHT query for a given @a label in a given @a zone.
- * FIXME: We may want to plugin-ize this at some point.
- *
- * @param pub public key of the zone
- * @param label label of the record
- * @param query hash to use for the query
- */
void
GNUNET_GNSRECORD_query_from_public_key (const struct
GNUNET_IDENTITY_PublicKey *pub,
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 5e3bbdb8c..e225bcc7f 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -62,14 +62,6 @@ GNUNET_GNSRECORD_label_check (const char*label, char **emsg)
}
-/**
- * Convert a zone key to a string (for printing debug messages).
- * This is one of the very few calls in the entire API that is
- * NOT reentrant!
- *
- * @param z the zone key
- * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s
- */
const char *
GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z)
{
@@ -181,7 +173,7 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
/* Check for shadow record */
if ((c == c2) ||
(rd[c].record_type != rd[c2].record_type) ||
- (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)))
+ (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW)))
continue;
/* We have a shadow record */
if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
@@ -312,7 +304,7 @@ GNUNET_GNSRECORD_data_from_identity (const struct
{
char *tmp;
*type = ntohl (key->type);
- *data_size = GNUNET_IDENTITY_key_get_length (key) - sizeof (key->type);
+ *data_size = GNUNET_IDENTITY_public_key_get_length (key) - sizeof (key->type);
if (0 == *data_size)
return GNUNET_SYSERR;
tmp = GNUNET_malloc (*data_size);
@@ -421,7 +413,7 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
rd_public,
unsigned int *rd_count_public,
struct GNUNET_TIME_Absolute *expiry,
- int include_private,
+ enum GNUNET_GNSRECORD_Filter filter,
char **emsg)
{
struct GNUNET_TIME_Absolute now;
@@ -438,10 +430,32 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
rd_count_tmp = 0;
for (unsigned int i = 0; i < rd_count; i++)
{
- /* Ignore the tombstone. For maintenance only. Remember expiration time. */
+ /* Ignore private records for public record set */
+ if ((0 != (filter & GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE)) &&
+ (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Filtering private record filter=%u...\n", filter);
+ continue;
+ }
+ /* Skip expired records */
+ if ((0 == (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) &&
+ (rd[i].expiration_time < now.abs_value_us))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Filtering expired record...\n");
+ continue; /* record already expired, skip it */
+ }
+ /* Ignore the tombstone unless filter permits explicitly.
+ * Remember expiration time. */
if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
{
minimum_expiration.abs_value_us = rd[i].expiration_time;
+ if (0 != (filter & GNUNET_GNSRECORD_FILTER_INCLUDE_MAINTENANCE))
+ {
+ rd_public[rd_count_tmp] = rd[i];
+ rd_count_tmp++;
+ }
continue;
}
/* No NICK records unless empty label */
@@ -537,15 +551,6 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
have_other = GNUNET_YES;
}
- /* Ignore private records for public record set */
-
- if ((GNUNET_NO == include_private) &&
- (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)))
- continue;
- /* Skip expired records */
- if ((0 == (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) &&
- (rd[i].expiration_time < now.abs_value_us))
- continue; /* record already expired, skip it */
rd_public[rd_count_tmp] = rd[i];
/* Make sure critical record types are marked as such */
if (GNUNET_YES == GNUNET_GNSRECORD_is_critical (rd[i].record_type))
@@ -561,27 +566,4 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
}
-enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_convert_records_for_export (const char *label,
- const struct
- GNUNET_GNSRECORD_Data *rd,
- unsigned int rd_count,
- struct GNUNET_GNSRECORD_Data *
- rd_public,
- unsigned int *rd_count_public,
- struct GNUNET_TIME_Absolute *expiry,
- char **emsg)
-{
- return GNUNET_GNSRECORD_normalize_record_set (label,
- rd,
- rd_count,
- rd_public,
- rd_count_public,
- expiry,
- GNUNET_NO,
- emsg);
-
-}
-
-
/* end of gnsrecord_misc.c */
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c
index 97c488c2b..ef7684892 100644
--- a/src/gnsrecord/gnsrecord_serialization.c
+++ b/src/gnsrecord/gnsrecord_serialization.c
@@ -77,14 +77,6 @@ struct NetworkRecord
GNUNET_NETWORK_STRUCT_END
-/**
- * Calculate how many bytes we will need to serialize the given
- * records.
- *
- * @param rd_count number of records in the rd array
- * @param rd array of #GNUNET_GNSRECORD_Data with @a rd_count elements
- * @return the required size to serialize, -1 on error
- */
ssize_t
GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd)
@@ -143,15 +135,6 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
}
-/**
- * Serialize the given records to the given destination buffer.
- *
- * @param rd_count number of records in the rd array
- * @param rd array of #GNUNET_GNSRECORD_Data with @a rd_count elements
- * @param dest_size size of the destination array
- * @param dest where to write the result
- * @return the size of serialized records, -1 if records do not fit
- */
ssize_t
GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd,
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c
index 4d5eb73b3..91abe1954 100644
--- a/src/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -154,10 +154,10 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char *label)
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), 8, 1);
printf ("\n");
printf ("Zone identifier (ztype|zkey):\n");
- GNUNET_assert (0 < GNUNET_IDENTITY_key_get_length (&id_pub));
- print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 8);
+ GNUNET_assert (0 < GNUNET_IDENTITY_public_key_get_length (&id_pub));
+ print_bytes (&id_pub, GNUNET_IDENTITY_public_key_get_length (&id_pub), 8);
GNUNET_STRINGS_data_to_string (&id_pub,
- GNUNET_IDENTITY_key_get_length (&id_pub),
+ GNUNET_IDENTITY_public_key_get_length (&id_pub),
ztld,
sizeof (ztld));
printf ("\n");
@@ -280,10 +280,10 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char*label)
GNUNET_CRYPTO_EddsaPrivateKey), 8);
printf ("\n");
printf ("Zone identifier (ztype|zkey):\n");
- GNUNET_assert (0 < GNUNET_IDENTITY_key_get_length (&id_pub));
- print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 8);
+ GNUNET_assert (0 < GNUNET_IDENTITY_public_key_get_length (&id_pub));
+ print_bytes (&id_pub, GNUNET_IDENTITY_public_key_get_length (&id_pub), 8);
GNUNET_STRINGS_data_to_string (&id_pub,
- GNUNET_IDENTITY_key_get_length (&id_pub),
+ GNUNET_IDENTITY_public_key_get_length (&id_pub),
ztld,
sizeof (ztld));
printf ("\n");
diff --git a/src/gnsrecord/json_gnsrecord.c b/src/gnsrecord/json_gnsrecord.c
index 068ff48c1..0725cb1a1 100644
--- a/src/gnsrecord/json_gnsrecord.c
+++ b/src/gnsrecord/json_gnsrecord.c
@@ -31,13 +31,13 @@
#define GNUNET_JSON_GNSRECORD_VALUE "value"
#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data"
#define GNUNET_JSON_GNSRECORD_TYPE "record_type"
-#define GNUNET_JSON_GNSRECORD_EXPIRATION_TIME "expiration_time"
-#define GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "private"
-#define GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "supplemental"
-#define GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "relative_expiration"
-#define GNUNET_JSON_GNSRECORD_FLAG_SHADOW "shadow"
+#define GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME "relative_expiration"
+#define GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME "absolute_expiration"
+#define GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "is_private"
+#define GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "is_supplemental"
+#define GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "is_relative_expiration"
+#define GNUNET_JSON_GNSRECORD_FLAG_SHADOW "is_shadow"
#define GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name"
-#define GNUNET_JSON_GNSRECORD_NEVER "never"
struct GnsRecordInfo
{
@@ -82,39 +82,69 @@ cleanup_recordinfo (struct GnsRecordInfo *gnsrecord_info)
static int
parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd)
{
- struct GNUNET_TIME_Absolute abs_expiration_time;
- struct GNUNET_TIME_Relative rel_expiration_time;
+ struct GNUNET_TIME_Absolute abs_exp;
+ struct GNUNET_TIME_Relative rel_exp;
const char *value;
const char *record_type;
- const char *expiration_time;
int private;
int supplemental;
- int rel_exp;
+ int is_rel_exp;
int shadow;
int unpack_state = 0;
+ json_error_t err;
// interpret single gns record
- unpack_state = json_unpack (data,
- "{s:s, s:s, s:s, s:b, s:b, s:b, s:b}",
- GNUNET_JSON_GNSRECORD_VALUE,
- &value,
- GNUNET_JSON_GNSRECORD_TYPE,
- &record_type,
- GNUNET_JSON_GNSRECORD_EXPIRATION_TIME,
- &expiration_time,
- GNUNET_JSON_GNSRECORD_FLAG_PRIVATE,
- &private,
- GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL,
- &supplemental,
- GNUNET_JSON_GNSRECORD_FLAG_RELATIVE,
- &rel_exp,
- GNUNET_JSON_GNSRECORD_FLAG_SHADOW,
- &shadow);
+ unpack_state = json_unpack_ex (data,
+ &err,
+ 0,
+ "{s:s, s:s, s:I, s:b, s:b, s:b, s:b}",
+ GNUNET_JSON_GNSRECORD_VALUE,
+ &value,
+ GNUNET_JSON_GNSRECORD_TYPE,
+ &record_type,
+ GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME,
+ &rel_exp.rel_value_us,
+ GNUNET_JSON_GNSRECORD_FLAG_PRIVATE,
+ &private,
+ GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL,
+ &supplemental,
+ GNUNET_JSON_GNSRECORD_FLAG_RELATIVE,
+ &is_rel_exp,
+ GNUNET_JSON_GNSRECORD_FLAG_SHADOW,
+ &shadow);
if (0 != unpack_state)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error gnsdata object has a wrong format!\n");
- return GNUNET_SYSERR;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Error gnsdata object has a wrong format: `%s'!\n",
+ err.text);
+ unpack_state = json_unpack_ex (data,
+ &err,
+ 0,
+ "{s:s, s:s, s:I, s:b, s:b, s:b, s:b}",
+ GNUNET_JSON_GNSRECORD_VALUE,
+ &value,
+ GNUNET_JSON_GNSRECORD_TYPE,
+ &record_type,
+ GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME,
+ &abs_exp.abs_value_us,
+ GNUNET_JSON_GNSRECORD_FLAG_PRIVATE,
+ &private,
+ GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL,
+ &supplemental,
+ GNUNET_JSON_GNSRECORD_FLAG_RELATIVE,
+ &is_rel_exp,
+ GNUNET_JSON_GNSRECORD_FLAG_SHADOW,
+ &shadow);
+ if ((0 != unpack_state) || (is_rel_exp))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Error gnsdata object has a wrong format: `%s'!\n",
+ (is_rel_exp) ? "No relative expiration given" : err.text);
+ return GNUNET_SYSERR;
+ }
+ rd->expiration_time = abs_exp.abs_value_us;
+ } else {
+ rd->expiration_time = rel_exp.rel_value_us;
}
rd->record_type = GNUNET_GNSRECORD_typename_to_number (record_type);
if (UINT32_MAX == rd->record_type)
@@ -131,35 +161,14 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd)
return GNUNET_SYSERR;
}
- if (0 == strcmp (expiration_time, GNUNET_JSON_GNSRECORD_NEVER))
- {
- rd->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
- }
- else if ((1 != rel_exp) &&
- (GNUNET_OK ==
- GNUNET_STRINGS_fancy_time_to_absolute (expiration_time,
- &abs_expiration_time)))
- {
- rd->expiration_time = abs_expiration_time.abs_value_us;
- }
- else if (GNUNET_OK ==
- GNUNET_STRINGS_fancy_time_to_relative (expiration_time,
- &rel_expiration_time))
- {
+ if (is_rel_exp)
rd->flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
- rd->expiration_time = rel_expiration_time.rel_value_us;
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expiration time invalid\n");
- return GNUNET_SYSERR;
- }
if (1 == private)
rd->flags |= GNUNET_GNSRECORD_RF_PRIVATE;
if (1 == supplemental)
rd->flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL;
if (1 == shadow)
- rd->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
+ rd->flags |= GNUNET_GNSRECORD_RF_SHADOW;
return GNUNET_OK;
}
@@ -260,8 +269,8 @@ clean_gnsrecordobject (void *cls, struct GNUNET_JSON_Specification *spec)
*/
struct GNUNET_JSON_Specification
GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
- unsigned int *rd_count,
- char **name)
+ unsigned int *rd_count,
+ char **name)
{
struct GnsRecordInfo *gnsrecord_info = GNUNET_new (struct GnsRecordInfo);
@@ -289,12 +298,9 @@ GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
*/
json_t *
GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
- const struct GNUNET_GNSRECORD_Data *rd,
- unsigned int rd_count)
+ const struct GNUNET_GNSRECORD_Data *rd,
+ unsigned int rd_count)
{
- struct GNUNET_TIME_Absolute abs_exp;
- struct GNUNET_TIME_Relative rel_exp;
- const char *expiration_time_str;
const char *record_type_str;
char *value_str;
json_t *data;
@@ -328,36 +334,26 @@ GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
rd[i].data,
rd[i].data_size);
- if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags)
- {
- rel_exp.rel_value_us = rd[i].expiration_time;
- expiration_time_str = GNUNET_STRINGS_relative_time_to_string (rel_exp,
- GNUNET_NO);
- }
- else
- {
- abs_exp.abs_value_us = rd[i].expiration_time;
- expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp);
- }
record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Packing %s %s %s %d\n",
- value_str, record_type_str, expiration_time_str, rd[i].flags);
- record = json_pack ("{s:s,s:s,s:s,s:b,s:b,s:b,s:b}",
- "value",
+ "Packing %s %s %lu %d\n",
+ value_str, record_type_str, rd[i].expiration_time, rd[i].flags);
+ record = json_pack ("{s:s,s:s,s:I,s:b,s:b,s:b,s:b}",
+ GNUNET_JSON_GNSRECORD_VALUE,
value_str,
- "record_type",
+ GNUNET_JSON_GNSRECORD_TYPE,
record_type_str,
- "expiration_time",
- expiration_time_str,
- "private",
+ (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) ?
+ GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME : GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME,
+ rd[i].expiration_time,
+ GNUNET_JSON_GNSRECORD_FLAG_PRIVATE,
rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE,
- "relative_expiration",
+ GNUNET_JSON_GNSRECORD_FLAG_RELATIVE,
rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION,
- "supplemental",
+ GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL,
rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL,
- "shadow",
- rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD);
+ GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL,
+ rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW);
GNUNET_free (value_str);
if (NULL == record)
{
@@ -387,5 +383,3 @@ GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
}
return data;
}
-
-
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c
index 649133cd1..e8c24501c 100644
--- a/src/gnsrecord/plugin_gnsrecord_dns.c
+++ b/src/gnsrecord/plugin_gnsrecord_dns.c
@@ -100,7 +100,7 @@ dns_value_to_string (void *cls,
return NULL;
}
GNUNET_asprintf (&result,
- "rname=%s mname=%s %u,%u,%u,%u,%u",
+ "%s %s ( %u %u %u %u %u )",
soa->rname,
soa->mname,
soa->serial,
@@ -169,7 +169,7 @@ dns_value_to_string (void *cls,
return NULL;
}
GNUNET_asprintf (&result,
- "%u,%s",
+ "%u %s",
(unsigned int) mx->preference,
mx->mxhost);
GNUNET_DNSPARSER_free_mx (mx);
@@ -503,7 +503,7 @@ dns_string_to_value (void *cls,
size_t off;
if (7 != sscanf (s,
- "rname=%253s mname=%253s %u,%u,%u,%u,%u",
+ "%253s %253s ( %u %u %u %u %u )",
soa_rname,
soa_mname,
&soa_serial,
@@ -567,7 +567,7 @@ dns_string_to_value (void *cls,
unsigned int mx_pref;
size_t off;
- if (2 != sscanf (s, "%u,%253s", &mx_pref, mxhost))
+ if (2 != sscanf (s, "%u %253s", &mx_pref, mxhost))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Unable to parse MX record `%s'\n"),
diff --git a/src/hello/address.c b/src/hello/address.c
index e22f3850f..6a1b68029 100644
--- a/src/hello/address.c
+++ b/src/hello/address.c
@@ -59,16 +59,6 @@ GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address)
}
-/**
- * Allocate an address struct.
- *
- * @param peer the peer
- * @param transport_name plugin name
- * @param address binary address
- * @param address_length number of bytes in 'address'
- * @param local_info additional local information for the address
- * @return the address struct
- */
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
const char *transport_name,
@@ -118,14 +108,6 @@ GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
}
-/**
- * Compare two addresses. Does NOT compare the peer identity,
- * that is assumed already to match!
- *
- * @param a1 first address
- * @param a2 second address
- * @return 0 if the addresses are equal, -1 if a1<a2, 1 if a1>a2.
- */
int
GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
const struct GNUNET_HELLO_Address *a2)
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c
index 96856a692..da3a069e0 100644
--- a/src/hello/hello-ng.c
+++ b/src/hello/hello-ng.c
@@ -60,8 +60,8 @@ GNUNET_NETWORK_STRUCT_END
* @param nt network type of @a address
* @param mono_time monotonic time at which @a address was valid
* @param private_key signing key to use
- * @param result[out] where to write address record (allocated)
- * @param result_size[out] set to size of @a result
+ * @param[out] result where to write address record (allocated)
+ * @param[out] result_size set to size of @a result
*/
void
GNUNET_HELLO_sign_address (
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 12b576ceb..45d27c5d4 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -511,15 +511,6 @@ merge_addr (void *cls,
}
-/**
- * Construct a HELLO message by merging the
- * addresses in two existing HELLOs (which
- * must be for the same peer).
- *
- * @param h1 first HELLO message
- * @param h2 the second HELLO message
- * @return the combined HELLO message
- */
struct GNUNET_HELLO_Message *
GNUNET_HELLO_merge (const struct GNUNET_HELLO_Message *h1,
const struct GNUNET_HELLO_Message *h2)
@@ -606,19 +597,6 @@ delta_match (void *cls,
}
-/**
- * Iterate over addresses in @a new_hello that are NOT already present
- * in @a old_hello. Note that if the address is present in @a old_hello
- * but the expiration time in @a new_hello is more recent, the iterator
- * is also called.
- *
- * @param new_hello a HELLO message
- * @param old_hello a HELLO message
- * @param expiration_limit ignore addresses in @a old_hello
- * that expired before the given time stamp
- * @param it iterator to call on each address
- * @param it_cls closure for @a it
- */
void
GNUNET_HELLO_iterate_new_addresses (const struct
GNUNET_HELLO_Message *new_hello,
diff --git a/src/hostlist/Makefile.am b/src/hostlist/Makefile.am
index 3b534de70..77c9eb1de 100644
--- a/src/hostlist/Makefile.am
+++ b/src/hostlist/Makefile.am
@@ -15,23 +15,10 @@ endif
GN_LIBMHD = $(MHD_LIBS)
GN_CPPMHD = $(MHD_CFLAGS)
-if HAVE_LIBGNURL
libexec_PROGRAMS = \
gnunet-daemon-hostlist
-LIB_GNURL=@LIBGNURL@
-CPP_GNURL=@LIBGNURL_CPPFLAGS@
dist_pkgcfg_DATA = \
hostlist.conf
-else
-if HAVE_LIBCURL
-libexec_PROGRAMS = \
- gnunet-daemon-hostlist
-LIB_GNURL=@LIBCURL@
-CPP_GNURL=@LIBCURL_CPPFLAGS@
-dist_pkgcfg_DATA = \
- hostlist.conf
-endif
-endif
gnunet_daemon_hostlist_SOURCES = \
gnunet-daemon-hostlist.c gnunet-daemon-hostlist.h \
@@ -46,27 +33,18 @@ gnunet_daemon_hostlist_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBMHD) \
- $(LIB_GNURL) \
+ @LIBCURL@ \
$(GN_LIBINTL)
gnunet_daemon_hostlist_CFLAGS = \
$(GN_CPPMHD) \
- $(CPP_GNURL) \
+ @LIBCURL_CPPFLAGS@ \
$(AM_CFLAGS)
-if HAVE_LIBGNURL
check_PROGRAMS = \
test_gnunet_daemon_hostlist \
test_gnunet_daemon_hostlist_reconnect \
test_gnunet_daemon_hostlist_learning
-else
-if HAVE_LIBCURL
-check_PROGRAMS = \
- test_gnunet_daemon_hostlist \
- test_gnunet_daemon_hostlist_reconnect \
- test_gnunet_daemon_hostlist_learning
-endif
-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;
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c
index 1f7d4cc35..399a7dc39 100644
--- a/src/hostlist/gnunet-daemon-hostlist_client.c
+++ b/src/hostlist/gnunet-daemon-hostlist_client.c
@@ -802,7 +802,6 @@ clean_up ()
* server.
*
* @param cls closure, unused
- * @param tc task context, unused
*/
static void
task_download (void *cls);
@@ -873,12 +872,6 @@ download_prepare ()
}
-/**
- * Task that is run when we are ready to receive more data from the hostlist
- * server.
- *
- * @param cls closure, unused
- */
static void
task_download (void *cls)
{
@@ -1325,8 +1318,6 @@ primary_task (void *cls, int success)
* we go the stat. Initiates hostlist download scheduling.
*
* @param cls closure
- * @param success #GNUNET_OK if statistics were
- * successfully obtained, #GNUNET_SYSERR if not.
*/
static void
stat_timeout_task (void *cls)
diff --git a/src/identity/Makefile.am b/src/identity/Makefile.am
index 5a2110974..be6bbf822 100644
--- a/src/identity/Makefile.am
+++ b/src/identity/Makefile.am
@@ -49,18 +49,19 @@ bin_PROGRAMS = \
gnunet-identity
libexec_PROGRAMS = \
- gnunet-service-identity
+ gnunet-service-identity
gnunet_service_identity_SOURCES = \
- gnunet-service-identity.c
+ gnunet-service-identity.c
gnunet_service_identity_LDADD = \
+ libgnunetidentity.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
gnunet_identity_SOURCES = \
- gnunet-identity.c
+ gnunet-identity.c
gnunet_identity_LDADD = \
libgnunetidentity.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -68,8 +69,7 @@ gnunet_identity_LDADD = \
$(GN_LIBINTL)
check_PROGRAMS = \
- test_identity \
- test_identity_defaults
+ test_identity
check_SCRIPTS = \
test_identity_messages.sh
@@ -85,17 +85,10 @@ test_identity_SOURCES = \
test_identity_LDADD = \
libgnunetidentity.la \
$(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_identity_defaults_SOURCES = \
- test_identity_defaults.c
-test_identity_defaults_LDADD = \
- libgnunetidentity.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/util/libgnunetutil.la
EXTRA_DIST = \
test_identity.conf \
- test_identity_messages.sh
+ test_identity_messages.sh
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 97dc2ce7e..06e6fb613 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -106,11 +106,6 @@ static char *pubkey_msg;
static char *set_ego;
/**
- * -S option.
- */
-static char *set_subsystem;
-
-/**
* Operation handle for set operation.
*/
static struct GNUNET_IDENTITY_Operation *set_op;
@@ -178,7 +173,6 @@ test_finished (void)
if ( (NULL == create_op) &&
(NULL == delete_op) &&
(NULL == set_op) &&
- (NULL == set_subsystem) &&
(NULL == write_msg) &&
(NULL == read_msg) &&
(! list) &&
@@ -195,17 +189,17 @@ test_finished (void)
* Deletion operation finished.
*
* @param cls pointer to operation handle
- * @param emsg NULL on success, otherwise an error message
+ * @param ec the error code
*/
static void
delete_finished (void *cls,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_IDENTITY_Operation **op = cls;
*op = NULL;
- if (NULL != emsg)
- fprintf (stderr, "%s\n", gettext (emsg));
+ if (GNUNET_EC_NONE != ec)
+ fprintf (stderr, "%s\n", GNUNET_ErrorCode_get_hint (ec));
test_finished ();
}
@@ -215,12 +209,12 @@ delete_finished (void *cls,
*
* @param cls pointer to operation handle
* @param pk private key of the ego, or NULL on error
- * @param emsg error message, NULL on success
+ * @param ec the error code
*/
static void
create_finished (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_IDENTITY_Operation **op = cls;
@@ -229,7 +223,7 @@ create_finished (void *cls,
{
fprintf (stderr,
_ ("Failed to create ego: %s\n"),
- emsg);
+ GNUNET_ErrorCode_get_hint (ec));
global_ret = 1;
}
else if (verbose)
@@ -258,25 +252,6 @@ create_finished (void *cls,
/**
- * Function called by #GNUNET_IDENTITY_set up on completion.
- *
- * @param cls NULL
- * @param emsg error message (NULL on success)
- */
-static void
-set_done (void *cls, const char *emsg)
-{
- set_op = NULL;
- if (NULL != emsg)
- {
- fprintf (stderr, _ ("Failed to set default ego: %s\n"), emsg);
- global_ret = 1;
- }
- test_finished ();
-}
-
-
-/**
* Encrypt a message given with -W, encrypted using public key of
* an identity given with -k.
*/
@@ -288,7 +263,7 @@ write_encrypted_message (void)
GNUNET_SYSERR)
{
struct GNUNET_CRYPTO_EcdhePublicKey message_key;
- size_t msg_len = strlen (write_msg);
+ size_t msg_len = strlen (write_msg) + 1;
ssize_t res = GNUNET_IDENTITY_encrypt (write_msg,
msg_len,
&recipient,
@@ -380,6 +355,7 @@ read_encrypted_message (struct GNUNET_IDENTITY_Ego *ego)
deserialized_msg);
if (-1 != res)
{
+ deserialized_msg[res - 1] = '\0';
fprintf (stdout,
"%s\n",
deserialized_msg);
@@ -447,35 +423,6 @@ print_ego (void *cls,
char *s;
char *privs;
- if ( (NULL != set_ego) &&
- (NULL != set_subsystem) &&
- (NULL != ego) &&
- (NULL != identifier) &&
- (0 == strcmp (identifier, set_ego)))
- {
- set_op = GNUNET_IDENTITY_set (sh,
- set_subsystem,
- ego,
- &set_done,
- NULL);
- GNUNET_free (set_subsystem);
- set_subsystem = NULL;
- GNUNET_free (set_ego);
- set_ego = NULL;
- }
- if ( (NULL == ego) &&
- (NULL != set_ego) &&
- (NULL != set_subsystem) )
- {
- fprintf (stderr,
- "Could not set ego to `%s' for subsystem `%s', ego not known\n",
- set_ego,
- set_subsystem);
- GNUNET_free (set_subsystem);
- set_subsystem = NULL;
- GNUNET_free (set_ego);
- set_ego = NULL;
- }
if ( (NULL == ego) &&
(NULL != set_ego) &&
(NULL != read_msg) )
@@ -557,12 +504,6 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- if ((NULL != set_subsystem) && (NULL == set_ego))
- {
- fprintf (stderr, "Option -s requires option -e to be specified as well.\n");
- return;
- }
-
if ((NULL != read_msg) && (NULL == set_ego))
{
fprintf (stderr,
@@ -577,8 +518,7 @@ run (void *cls,
}
sh = GNUNET_IDENTITY_connect (cfg,
(monitor | list) ||
- (NULL != set_ego) ||
- (NULL != set_subsystem)
+ (NULL != set_ego)
? &print_ego
: NULL,
NULL);
@@ -686,7 +626,7 @@ main (int argc, char *const *argv)
"ego",
"NAME",
gettext_noop (
- "set default identity to NAME for a subsystem SUBSYSTEM (use together with -s), restrict results to NAME (use together with -d) or read and decrypt a message for NAME (use together with -R)"),
+ "restrict results to NAME (use together with -d) or read and decrypt a message for NAME (use together with -R)"),
&set_ego),
GNUNET_GETOPT_option_string ('k',
"key",
@@ -702,13 +642,6 @@ main (int argc, char *const *argv)
"private-keys",
gettext_noop ("display private keys as well"),
&private_keys),
- GNUNET_GETOPT_option_string (
- 's',
- "set",
- "SUBSYSTEM",
- gettext_noop (
- "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"),
- &set_subsystem),
GNUNET_GETOPT_option_verbose (&verbose),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index 51f897557..07296a882 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -205,30 +205,21 @@ shutdown_task (void *cls)
*
* @param client client that should receive the result code
* @param result_code code to transmit
- * @param emsg error message to include (or NULL for none)
*/
static void
send_result_code (struct GNUNET_SERVICE_Client *client,
- uint32_t result_code,
- const char *emsg)
+ uint32_t result_code)
{
struct ResultCodeMessage *rcm;
struct GNUNET_MQ_Envelope *env;
- size_t elen;
- if (NULL == emsg)
- elen = 0;
- else
- elen = strlen (emsg) + 1;
env =
- GNUNET_MQ_msg_extra (rcm, elen, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
+ GNUNET_MQ_msg (rcm, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
rcm->result_code = htonl (result_code);
- if (0 < elen)
- GNUNET_memcpy (&rcm[1], emsg, elen);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending result %d (%s) to client\n",
(int) result_code,
- emsg);
+ GNUNET_ErrorCode_get_hint (result_code));
GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
}
@@ -245,40 +236,19 @@ create_update_message (struct Ego *ego)
struct UpdateMessage *um;
struct GNUNET_MQ_Envelope *env;
size_t name_len;
+ ssize_t key_len;
+ key_len = GNUNET_IDENTITY_private_key_get_length (&ego->pk);
name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
- env = GNUNET_MQ_msg_extra (um, name_len, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
+ env = GNUNET_MQ_msg_extra (um, name_len + key_len,
+ GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
um->name_len = htons (name_len);
um->end_of_list = htons (GNUNET_NO);
- um->private_key = ego->pk;
+ um->key_len = htons (key_len);
GNUNET_memcpy (&um[1], ego->identifier, name_len);
- return env;
-}
-
-
-/**
- * Create a set default message with information about the current state of an ego.
- *
- * @param ego ego to create message for
- * @param servicename name of the service to provide in the message
- * @return corresponding set default message
- */
-static struct GNUNET_MQ_Envelope *
-create_set_default_message (struct Ego *ego,
- const char *servicename)
-{
- struct SetDefaultMessage *sdm;
- struct GNUNET_MQ_Envelope *env;
- size_t name_len;
-
- name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
- env = GNUNET_MQ_msg_extra (sdm,
- name_len,
- GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
- sdm->name_len = htons (name_len);
- sdm->reserved = htons (0);
- sdm->private_key = ego->pk;
- GNUNET_memcpy (&sdm[1], servicename, name_len);
+ GNUNET_IDENTITY_write_private_key_to_buffer (&ego->pk,
+ ((char*) &um[1]) + name_len,
+ key_len);
return env;
}
@@ -318,6 +288,7 @@ handle_start_message (void *cls,
GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
ume->end_of_list = htons (GNUNET_YES);
ume->name_len = htons (0);
+ ume->key_len = htons (0);
GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
env);
}
@@ -370,7 +341,7 @@ handle_lookup_message (void *cls,
GNUNET_SERVICE_client_continue (client);
return;
}
- send_result_code (client, 0, "ego not found");
+ send_result_code (client, GNUNET_EC_IDENTITY_NOT_FOUND);
GNUNET_SERVICE_client_continue (client);
}
@@ -433,202 +404,7 @@ handle_lookup_by_suffix_message (void *cls,
GNUNET_SERVICE_client_continue (client);
return;
}
- send_result_code (client, 0, "ego not found");
- GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT message
- *
- * @param cls client sending the message
- * @param msg message of type `struct GetDefaultMessage`
- * @return #GNUNET_OK if @a msg is well-formed
- */
-static int
-check_get_default_message (void *cls,
- const struct GetDefaultMessage *msg)
-{
- uint16_t size;
- uint16_t name_len;
- const char *name;
-
- size = ntohs (msg->header.size);
- if (size <= sizeof(struct GetDefaultMessage))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- name = (const char *) &msg[1];
- name_len = ntohs (msg->name_len);
- if ((name_len + sizeof(struct GetDefaultMessage) != size) ||
- (0 != ntohs (msg->reserved)) || ('\0' != name[name_len - 1]))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
-}
-
-
-/**
- * Handler for GET_DEFAULT message from client, returns
- * default identity for some service.
- *
- * @param cls unused
- * @param client who sent the message
- * @param message the message received
- */
-static void
-handle_get_default_message (void *cls,
- const struct GetDefaultMessage *gdm)
-{
- struct GNUNET_MQ_Envelope *env;
- struct GNUNET_SERVICE_Client *client = cls;
- char *name;
- char *identifier;
-
- name = GNUNET_strdup ((const char *) &gdm[1]);
- GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1], name);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received GET_DEFAULT for service `%s' from client\n",
- name);
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
- name,
- "DEFAULT_IDENTIFIER",
- &identifier))
- {
- send_result_code (client, 1, gettext_noop ("no default known"));
- GNUNET_SERVICE_client_continue (client);
- GNUNET_free (name);
- return;
- }
- for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next)
- {
- if (0 == strcmp (ego->identifier, identifier))
- {
- env = create_set_default_message (ego, name);
- GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
- GNUNET_SERVICE_client_continue (client);
- GNUNET_free (identifier);
- GNUNET_free (name);
- return;
- }
- }
- GNUNET_free (identifier);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to find ego `%s'\n",
- name);
- GNUNET_free (name);
- send_result_code (client,
- 1,
- gettext_noop (
- "default configured, but ego unknown (internal error)"));
- GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Compare the given two private keys for equality.
- *
- * @param pk1 one private key
- * @param pk2 another private key
- * @return 0 if the keys are equal
- */
-static int
-key_cmp (const struct GNUNET_IDENTITY_PrivateKey *pk1,
- const struct GNUNET_IDENTITY_PrivateKey *pk2)
-{
- return GNUNET_memcmp (pk1, pk2);
-}
-
-
-/**
- * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT message
- *
- * @param cls client sending the message
- * @param msg message of type `struct SetDefaultMessage`
- * @return #GNUNET_OK if @a msg is well-formed
- */
-static int
-check_set_default_message (void *cls,
- const struct SetDefaultMessage *msg)
-{
- uint16_t size;
- uint16_t name_len;
- const char *str;
-
- size = ntohs (msg->header.size);
- if (size <= sizeof(struct SetDefaultMessage))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- name_len = ntohs (msg->name_len);
- GNUNET_break (0 == ntohs (msg->reserved));
- if (name_len + sizeof(struct SetDefaultMessage) != size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- str = (const char *) &msg[1];
- if ('\0' != str[name_len - 1])
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
-}
-
-
-/**
- * Handler for SET_DEFAULT message from client, updates
- * default identity for some service.
- *
- * @param cls unused
- * @param client who sent the message
- * @param message the message received
- */
-static void
-handle_set_default_message (void *cls,
- const struct SetDefaultMessage *sdm)
-{
- struct Ego *ego;
- struct GNUNET_SERVICE_Client *client = cls;
- char *str;
-
- str = GNUNET_strdup ((const char *) &sdm[1]);
- GNUNET_STRINGS_utf8_tolower ((const char *) &sdm[1], str);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received SET_DEFAULT for service `%s' from client\n",
- str);
- for (ego = ego_head; NULL != ego; ego = ego->next)
- {
- if (0 == key_cmp (&ego->pk,
- &sdm->private_key))
- {
- GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
- str,
- "DEFAULT_IDENTIFIER",
- ego->identifier);
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file))
- GNUNET_log (
- GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to write subsystem default identifier map to `%s'.\n"),
- subsystem_cfg_file);
- send_result_code (client, 0, NULL);
- GNUNET_SERVICE_client_continue (client);
- GNUNET_free (str);
- return;
- }
- }
- send_result_code (client,
- 1,
- _ ("Unknown ego specified for service (internal error)"));
- GNUNET_free (str);
+ send_result_code (client, GNUNET_EC_IDENTITY_NOT_FOUND);
GNUNET_SERVICE_client_continue (client);
}
@@ -643,15 +419,20 @@ notify_listeners (struct Ego *ego)
{
struct UpdateMessage *um;
size_t name_len;
+ ssize_t key_len;
name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
- um = GNUNET_malloc (sizeof(struct UpdateMessage) + name_len);
+ key_len = GNUNET_IDENTITY_private_key_get_length (&ego->pk);
+ um = GNUNET_malloc (sizeof(struct UpdateMessage) + name_len + key_len);
um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
- um->header.size = htons (sizeof(struct UpdateMessage) + name_len);
+ um->header.size = htons (sizeof(struct UpdateMessage) + name_len + key_len);
um->name_len = htons (name_len);
um->end_of_list = htons (GNUNET_NO);
- um->private_key = ego->pk;
+ um->key_len = htons (key_len);
GNUNET_memcpy (&um[1], ego->identifier, name_len);
+ GNUNET_IDENTITY_write_private_key_to_buffer (&ego->pk,
+ ((char*) &um[1]) + name_len,
+ key_len);
GNUNET_notification_context_broadcast (nc, &um->header, GNUNET_NO);
GNUNET_free (um);
}
@@ -670,6 +451,7 @@ check_create_message (void *cls,
{
uint16_t size;
uint16_t name_len;
+ size_t key_len;
const char *str;
size = ntohs (msg->header.size);
@@ -679,13 +461,13 @@ check_create_message (void *cls,
return GNUNET_SYSERR;
}
name_len = ntohs (msg->name_len);
- GNUNET_break (0 == ntohs (msg->reserved));
- if (name_len + sizeof(struct CreateRequestMessage) != size)
+ key_len = ntohs (msg->key_len);
+ if (name_len + key_len + sizeof(struct CreateRequestMessage) != size)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- str = (const char *) &msg[1];
+ str = (const char *) &msg[1] + key_len;
if ('\0' != str[name_len - 1])
{
GNUNET_break (0);
@@ -699,45 +481,56 @@ check_create_message (void *cls,
* Handler for CREATE message from client, creates new identity.
*
* @param cls unused
- * @param client who sent the message
- * @param message the message received
+ * @param crm the message received
*/
static void
handle_create_message (void *cls,
const struct CreateRequestMessage *crm)
{
+ struct GNUNET_IDENTITY_PrivateKey private_key;
struct GNUNET_SERVICE_Client *client = cls;
struct Ego *ego;
char *str;
char *fn;
+ size_t key_len;
+ size_t kb_read;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from client\n");
- str = GNUNET_strdup ((const char *) &crm[1]);
- GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1], str);
+ key_len = ntohs (crm->key_len);
+ if ((GNUNET_SYSERR ==
+ GNUNET_IDENTITY_read_private_key_from_buffer (&crm[1],
+ key_len,
+ &private_key,
+ &kb_read)) ||
+ (kb_read != key_len))
+ {
+ GNUNET_SERVICE_client_drop (client);
+ return;
+ }
+ str = GNUNET_strdup ((const char *) &crm[1] + key_len);
+ GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1] + key_len, str);
for (ego = ego_head; NULL != ego; ego = ego->next)
{
if (0 == strcmp (ego->identifier, str))
{
send_result_code (client,
- 1,
- gettext_noop (
- "identifier already in use for another ego"));
+ GNUNET_EC_IDENTITY_NAME_CONFLICT);
GNUNET_SERVICE_client_continue (client);
GNUNET_free (str);
return;
}
}
ego = GNUNET_new (struct Ego);
- ego->pk = crm->private_key;
+ ego->pk = private_key;
ego->identifier = GNUNET_strdup (str);
GNUNET_CONTAINER_DLL_insert (ego_head,
ego_tail,
ego);
- send_result_code (client, 0, NULL);
+ send_result_code (client, GNUNET_EC_NONE);
fn = get_ego_filename (ego);
if (GNUNET_OK !=
GNUNET_DISK_fn_write (fn,
- &crm->private_key,
+ &private_key,
sizeof(struct GNUNET_IDENTITY_PrivateKey),
GNUNET_DISK_PERM_USER_READ
| GNUNET_DISK_PERM_USER_WRITE))
@@ -839,8 +632,7 @@ check_rename_message (void *cls, const struct RenameMessage *msg)
* new identity.
*
* @param cls unused
- * @param client who sent the message
- * @param message the message received
+ * @param rm the message received
*/
static void
handle_rename_message (void *cls, const struct RenameMessage *rm)
@@ -868,7 +660,7 @@ handle_rename_message (void *cls, const struct RenameMessage *rm)
{
if (0 == strcmp (ego->identifier, new_name))
{
- send_result_code (client, 1, gettext_noop ("target name already exists"));
+ send_result_code (client, GNUNET_EC_IDENTITY_NAME_CONFLICT);
GNUNET_SERVICE_client_continue (client);
GNUNET_free (old_name);
GNUNET_free (new_name);
@@ -903,14 +695,14 @@ handle_rename_message (void *cls, const struct RenameMessage *rm)
GNUNET_free (old_name);
GNUNET_free (new_name);
notify_listeners (ego);
- send_result_code (client, 0, NULL);
+ send_result_code (client, GNUNET_EC_NONE);
GNUNET_SERVICE_client_continue (client);
return;
}
}
/* failed to locate old name */
- send_result_code (client, 1, gettext_noop ("no matching ego found"));
+ send_result_code (client, GNUNET_EC_IDENTITY_NOT_FOUND);
GNUNET_free (old_name);
GNUNET_free (new_name);
GNUNET_SERVICE_client_continue (client);
@@ -985,8 +777,7 @@ check_delete_message (void *cls, const struct DeleteMessage *msg)
* new identity.
*
* @param cls unused
- * @param client who sent the message
- * @param message the message received
+ * @param dm the message received
*/
static void
handle_delete_message (void *cls, const struct DeleteMessage *dm)
@@ -1023,13 +814,13 @@ handle_delete_message (void *cls, const struct DeleteMessage *dm)
notify_listeners (ego);
GNUNET_free (ego);
GNUNET_free (name);
- send_result_code (client, 0, NULL);
+ send_result_code (client, GNUNET_EC_NONE);
GNUNET_SERVICE_client_continue (client);
return;
}
}
- send_result_code (client, 1, gettext_noop ("no matching ego found"));
+ send_result_code (client, GNUNET_EC_IDENTITY_NOT_FOUND);
GNUNET_free (name);
GNUNET_SERVICE_client_continue (client);
}
@@ -1226,14 +1017,6 @@ GNUNET_SERVICE_MAIN (
GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX,
struct LookupMessage,
NULL),
- GNUNET_MQ_hd_var_size (get_default_message,
- GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT,
- struct GetDefaultMessage,
- NULL),
- GNUNET_MQ_hd_var_size (set_default_message,
- GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
- struct SetDefaultMessage,
- NULL),
GNUNET_MQ_hd_var_size (create_message,
GNUNET_MESSAGE_TYPE_IDENTITY_CREATE,
struct CreateRequestMessage,
diff --git a/src/identity/identity.h b/src/identity/identity.h
index 11c5883bc..a3193ca2a 100644
--- a/src/identity/identity.h
+++ b/src/identity/identity.h
@@ -89,8 +89,6 @@ struct ResultCodeMessage
* (currently not used).
*/
uint32_t result_code GNUNET_PACKED;
-
- /* followed by 0-terminated error message (on error) */
};
@@ -131,67 +129,17 @@ struct UpdateMessage
uint16_t end_of_list GNUNET_PACKED;
/**
- * The private key
- */
- struct GNUNET_IDENTITY_PrivateKey private_key;
-
- /* followed by 0-terminated ego name */
-};
-
-
-/**
- * Client requests knowledge about default identity for
- * a subsystem from identity service.
- */
-struct GetDefaultMessage
-{
- /**
- * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * Number of bytes in service name string including 0-termination, in NBO.
- */
- uint16_t name_len GNUNET_PACKED;
-
- /**
- * Always zero.
- */
- uint16_t reserved GNUNET_PACKED;
-
-
- /* followed by 0-terminated service name */
-};
-
-
-/**
- * Used from service to client as a result to the GET_DEFAULT
- * message, used from client to service to SET_DEFAULT.
- */
-struct SetDefaultMessage
-{
- /**
- * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
+ * Key length
*/
- struct GNUNET_MessageHeader header;
+ uint16_t key_len GNUNET_PACKED;
/**
- * Number of bytes in service name string including 0-termination, in NBO.
- */
- uint16_t name_len GNUNET_PACKED;
-
- /**
- * Always zero.
+ * Reserved (alignment)
*/
uint16_t reserved GNUNET_PACKED;
- /**
- * The private key
- */
- struct GNUNET_IDENTITY_PrivateKey private_key;
-
- /* followed by 0-terminated service name */
+ /* followed by 0-terminated ego name */
+ /* followed by the private key */
};
@@ -212,16 +160,13 @@ struct CreateRequestMessage
uint16_t name_len GNUNET_PACKED;
/**
- * Always zero.
- */
- uint16_t reserved GNUNET_PACKED;
-
- /**
- * The private key
+ * Key length
*/
- struct GNUNET_IDENTITY_PrivateKey private_key;
+ uint16_t key_len GNUNET_PACKED;
- /* followed by 0-terminated identity name */
+ /*
+ * Followed by the private key
+ * followed by 0-terminated identity name */
};
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 471569cb3..47a78e2bb 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
+#include "gnunet_error_codes.h"
#include "gnunet_protocols.h"
#include "gnunet_identity_service.h"
#include "identity.h"
@@ -157,14 +158,17 @@ GNUNET_IDENTITY_ego_get_anonymous ()
{
static struct GNUNET_IDENTITY_Ego anon;
static int setup;
+ ssize_t key_len;
if (setup)
return &anon;
anon.pk.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
anon.pub.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
anon.pk.ecdsa_key = *GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
+ key_len = GNUNET_IDENTITY_private_key_get_length (&anon.pk);
+ GNUNET_assert (0 < key_len);
GNUNET_CRYPTO_hash (&anon.pk,
- sizeof(anon.pk),
+ key_len,
&anon.id);
setup = 1;
return &anon;
@@ -195,7 +199,7 @@ GNUNET_IDENTITY_key_get_public (const struct
}
-static int
+static enum GNUNET_GenericReturnValue
private_key_create (enum GNUNET_IDENTITY_KeyType ktype,
struct GNUNET_IDENTITY_PrivateKey *key)
{
@@ -279,13 +283,13 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
op);
if (NULL != op->cont)
op->cont (op->cls,
- "Error in communication with the identity service");
+ GNUNET_EC_SERVICE_COMMUNICATION_FAILED);
else if (NULL != op->cb)
op->cb (op->cls, NULL, NULL, NULL);
else if (NULL != op->create_cont)
op->create_cont (op->cls,
NULL,
- "Failed to communicate with the identity service");
+ GNUNET_EC_SERVICE_COMMUNICATION_FAILED);
GNUNET_free (op);
}
GNUNET_CONTAINER_multihashmap_iterate (h->egos,
@@ -322,24 +326,6 @@ mq_error_handler (void *cls,
/**
- * We received a result code from the service. Check the message
- * is well-formed.
- *
- * @param cls closure
- * @param rcm result message received
- * @return #GNUNET_OK if the message is well-formed
- */
-static int
-check_identity_result_code (void *cls,
- const struct ResultCodeMessage *rcm)
-{
- if (sizeof(*rcm) != htons (rcm->header.size))
- GNUNET_MQ_check_zero_termination (rcm);
- return GNUNET_OK;
-}
-
-
-/**
* We received a result code from the service.
*
* @param cls closure
@@ -351,8 +337,7 @@ handle_identity_result_code (void *cls,
{
struct GNUNET_IDENTITY_Handle *h = cls;
struct GNUNET_IDENTITY_Operation *op;
- uint16_t size = ntohs (rcm->header.size) - sizeof(*rcm);
- const char *str = (0 == size) ? NULL : (const char *) &rcm[1];
+ enum GNUNET_ErrorCode ec = ntohl (rcm->result_code);
op = h->op_head;
if (NULL == op)
@@ -363,11 +348,11 @@ handle_identity_result_code (void *cls,
}
GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
if (NULL != op->cont)
- op->cont (op->cls, str);
+ op->cont (op->cls, ec);
else if (NULL != op->cb)
op->cb (op->cls, NULL, NULL, NULL);
else if (NULL != op->create_cont)
- op->create_cont (op->cls, (NULL == str) ? &op->pk : NULL, str);
+ op->create_cont (op->cls, (GNUNET_EC_NONE == ec) ? &op->pk : NULL, ec);
GNUNET_free (op);
}
@@ -387,7 +372,7 @@ check_identity_update (void *cls,
uint16_t name_len = ntohs (um->name_len);
const char *str = (const char *) &um[1];
- if ((size != name_len + sizeof(struct UpdateMessage)) ||
+ if ((size < name_len + sizeof(struct UpdateMessage)) ||
((0 != name_len) && ('\0' != str[name_len - 1])))
{
GNUNET_break (0);
@@ -409,9 +394,13 @@ handle_identity_update (void *cls,
{
struct GNUNET_IDENTITY_Handle *h = cls;
uint16_t name_len = ntohs (um->name_len);
- const char *str = (0 == name_len) ? NULL : (const char *) &um[1];
+ const char *str;
+ size_t key_len;
+ size_t kb_read;
struct GNUNET_HashCode id;
struct GNUNET_IDENTITY_Ego *ego;
+ struct GNUNET_IDENTITY_PrivateKey private_key;
+ const char *tmp;
if (GNUNET_YES == ntohs (um->end_of_list))
{
@@ -420,8 +409,18 @@ handle_identity_update (void *cls,
h->cb (h->cb_cls, NULL, NULL, NULL);
return;
}
- GNUNET_CRYPTO_hash (&um->private_key,
- sizeof (um->private_key),
+ tmp = (const char*) &um[1];
+ str = (0 == name_len) ? NULL : tmp;
+ memset (&private_key, 0, sizeof (private_key));
+ key_len = ntohs (um->key_len);
+ GNUNET_assert (GNUNET_SYSERR !=
+ GNUNET_IDENTITY_read_private_key_from_buffer (tmp + name_len,
+ key_len,
+ &private_key,
+ &kb_read));
+ GNUNET_assert (0 <= GNUNET_IDENTITY_private_key_get_length (&private_key));
+ GNUNET_CRYPTO_hash (&private_key,
+ GNUNET_IDENTITY_private_key_get_length (&private_key),
&id);
ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
&id);
@@ -437,7 +436,7 @@ handle_identity_update (void *cls,
}
ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
ego->pub_initialized = GNUNET_NO;
- ego->pk = um->private_key;
+ ego->pk = private_key;
ego->name = GNUNET_strdup (str);
ego->id = id;
GNUNET_assert (GNUNET_YES ==
@@ -477,80 +476,6 @@ handle_identity_update (void *cls,
/**
- * Function called when we receive a set default message from the
- * service.
- *
- * @param cls closure
- * @param sdm message received
- * @return #GNUNET_OK if the message is well-formed
- */
-static int
-check_identity_set_default (void *cls,
- const struct SetDefaultMessage *sdm)
-{
- uint16_t size = ntohs (sdm->header.size) - sizeof(*sdm);
- uint16_t name_len = ntohs (sdm->name_len);
- const char *str = (const char *) &sdm[1];
-
- if ((size != name_len) || ((0 != name_len) && ('\0' != str[name_len - 1])))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- GNUNET_break (0 == ntohs (sdm->reserved));
- return GNUNET_OK;
-}
-
-
-/**
- * Type of a function to call when we receive a message
- * from the service.
- *
- * @param cls closure
- * @param sdm message received
- */
-static void
-handle_identity_set_default (void *cls,
- const struct SetDefaultMessage *sdm)
-{
- struct GNUNET_IDENTITY_Handle *h = cls;
- struct GNUNET_IDENTITY_Operation *op;
- struct GNUNET_HashCode id;
- struct GNUNET_IDENTITY_Ego *ego;
-
- GNUNET_CRYPTO_hash (&sdm->private_key,
- sizeof(sdm->private_key),
- &id);
- ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
- &id);
- if (NULL == ego)
- {
- GNUNET_break (0);
- reschedule_connect (h);
- return;
- }
- op = h->op_head;
- if (NULL == op)
- {
- GNUNET_break (0);
- reschedule_connect (h);
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received SET_DEFAULT message from identity service\n");
- GNUNET_CONTAINER_DLL_remove (h->op_head,
- h->op_tail,
- op);
- if (NULL != op->cb)
- op->cb (op->cls,
- ego,
- &ego->ctx,
- ego->name);
- GNUNET_free (op);
-}
-
-
-/**
* Try again to connect to the identity service.
*
* @param cls handle to the identity service.
@@ -560,18 +485,14 @@ reconnect (void *cls)
{
struct GNUNET_IDENTITY_Handle *h = cls;
struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_var_size (identity_result_code,
- GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE,
- struct ResultCodeMessage,
- h),
+ GNUNET_MQ_hd_fixed_size (identity_result_code,
+ GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE,
+ struct ResultCodeMessage,
+ h),
GNUNET_MQ_hd_var_size (identity_update,
GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE,
struct UpdateMessage,
h),
- GNUNET_MQ_hd_var_size (identity_set_default,
- GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
- struct SetDefaultMessage,
- h),
GNUNET_MQ_handler_end ()
};
struct GNUNET_MQ_Envelope *env;
@@ -661,98 +582,6 @@ GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
}
-/**
- * Obtain the identity that is currently preferred/default
- * for a service.
- *
- * @param h identity service to query
- * @param service_name for which service is an identity wanted
- * @param cb function to call with the result (will only be called once)
- * @param cb_cls closure for @a cb
- * @return handle to abort the operation
- */
-struct GNUNET_IDENTITY_Operation *
-GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h,
- const char *service_name,
- GNUNET_IDENTITY_Callback cb,
- void *cb_cls)
-{
- struct GNUNET_IDENTITY_Operation *op;
- struct GNUNET_MQ_Envelope *env;
- struct GetDefaultMessage *gdm;
- size_t slen;
-
- if (NULL == h->mq)
- return NULL;
- GNUNET_assert (NULL != h->cb);
- slen = strlen (service_name) + 1;
- if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(struct GetDefaultMessage))
- {
- GNUNET_break (0);
- return NULL;
- }
- op = GNUNET_new (struct GNUNET_IDENTITY_Operation);
- op->h = h;
- op->cb = cb;
- op->cls = cb_cls;
- GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
- env =
- GNUNET_MQ_msg_extra (gdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT);
- gdm->name_len = htons (slen);
- gdm->reserved = htons (0);
- GNUNET_memcpy (&gdm[1], service_name, slen);
- GNUNET_MQ_send (h->mq, env);
- return op;
-}
-
-
-/**
- * Set the preferred/default identity for a service.
- *
- * @param h identity service to inform
- * @param service_name for which service is an identity set
- * @param ego new default identity to be set for this service
- * @param cont function to call once the operation finished
- * @param cont_cls closure for @a cont
- * @return handle to abort the operation
- */
-struct GNUNET_IDENTITY_Operation *
-GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
- const char *service_name,
- struct GNUNET_IDENTITY_Ego *ego,
- GNUNET_IDENTITY_Continuation cont,
- void *cont_cls)
-{
- struct GNUNET_IDENTITY_Operation *op;
- struct GNUNET_MQ_Envelope *env;
- struct SetDefaultMessage *sdm;
- size_t slen;
-
- if (NULL == h->mq)
- return NULL;
- GNUNET_assert (NULL != h->cb);
- slen = strlen (service_name) + 1;
- if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(struct SetDefaultMessage))
- {
- GNUNET_break (0);
- return NULL;
- }
- op = GNUNET_new (struct GNUNET_IDENTITY_Operation);
- op->h = h;
- op->cont = cont;
- op->cls = cont_cls;
- GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
- env =
- GNUNET_MQ_msg_extra (sdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
- sdm->name_len = htons (slen);
- sdm->reserved = htons (0);
- sdm->private_key = ego->pk;
- GNUNET_memcpy (&sdm[1], service_name, slen);
- GNUNET_MQ_send (h->mq, env);
- return op;
-}
-
-
struct GNUNET_IDENTITY_Operation *
GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
const char *name,
@@ -761,10 +590,12 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
GNUNET_IDENTITY_CreateContinuation cont,
void *cont_cls)
{
+ struct GNUNET_IDENTITY_PrivateKey private_key;
struct GNUNET_IDENTITY_Operation *op;
struct GNUNET_MQ_Envelope *env;
struct CreateRequestMessage *crm;
size_t slen;
+ size_t key_len;
if (NULL == h->mq)
return NULL;
@@ -779,18 +610,23 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
op->create_cont = cont;
op->cls = cont_cls;
GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
- env = GNUNET_MQ_msg_extra (crm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
- crm->name_len = htons (slen);
- crm->reserved = htons (0);
if (NULL == privkey)
{
GNUNET_assert (GNUNET_OK ==
- private_key_create (ktype, &crm->private_key));
+ private_key_create (ktype, &private_key));
}
else
- crm->private_key = *privkey;
- op->pk = crm->private_key;
- GNUNET_memcpy (&crm[1], name, slen);
+ private_key = *privkey;
+ key_len = GNUNET_IDENTITY_private_key_get_length (&private_key);
+ env = GNUNET_MQ_msg_extra (crm, slen + key_len,
+ GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
+ crm->name_len = htons (slen);
+ GNUNET_IDENTITY_write_private_key_to_buffer (&private_key,
+ &crm[1],
+ key_len);
+ crm->key_len = htons (key_len);
+ op->pk = private_key;
+ GNUNET_memcpy ((char*) &crm[1] + key_len, name, slen);
GNUNET_MQ_send (h->mq, env);
return op;
}
@@ -969,8 +805,9 @@ check_key_type (uint32_t type)
}
-static ssize_t
-private_key_get_length (const struct GNUNET_IDENTITY_PrivateKey *key)
+ssize_t
+GNUNET_IDENTITY_private_key_get_length (const struct
+ GNUNET_IDENTITY_PrivateKey *key)
{
switch (ntohl (key->type))
{
@@ -981,6 +818,8 @@ private_key_get_length (const struct GNUNET_IDENTITY_PrivateKey *key)
return sizeof (key->type) + sizeof (key->eddsa_key);
break;
default:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Got key type %u\n", ntohl (key->type));
GNUNET_break (0);
}
return -1;
@@ -988,7 +827,8 @@ private_key_get_length (const struct GNUNET_IDENTITY_PrivateKey *key)
ssize_t
-GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key)
+GNUNET_IDENTITY_public_key_get_length (const struct
+ GNUNET_IDENTITY_PublicKey *key)
{
switch (ntohl (key->type))
{
@@ -1004,34 +844,98 @@ GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key)
ssize_t
-GNUNET_IDENTITY_read_key_from_buffer (struct GNUNET_IDENTITY_PublicKey *key,
- const void *buffer,
- size_t len)
+GNUNET_IDENTITY_private_key_length_by_type (enum GNUNET_IDENTITY_KeyType kt)
+{
+ switch (kt)
+ {
+ case GNUNET_IDENTITY_TYPE_ECDSA:
+ return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
+ break;
+ case GNUNET_IDENTITY_TYPE_EDDSA:
+ return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
+ break;
+ default:
+ GNUNET_break (0);
+ }
+ return -1;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_IDENTITY_read_public_key_from_buffer (const void *buffer,
+ size_t len,
+ struct GNUNET_IDENTITY_PublicKey *
+ key,
+ size_t *kb_read)
{
if (len < sizeof (key->type))
- return -1;
+ return GNUNET_SYSERR;
GNUNET_memcpy (&key->type,
buffer,
sizeof (key->type));
- ssize_t length = GNUNET_IDENTITY_key_get_length (key);
+ ssize_t length = GNUNET_IDENTITY_public_key_get_length (key);
+ if (len < length)
+ return GNUNET_SYSERR;
+ if (length < 0)
+ return GNUNET_SYSERR;
+ GNUNET_memcpy (&key->ecdsa_key,
+ buffer + sizeof (key->type),
+ length - sizeof (key->type));
+ *kb_read = length;
+ return GNUNET_OK;
+}
+
+
+ssize_t
+GNUNET_IDENTITY_write_public_key_to_buffer (const struct
+ GNUNET_IDENTITY_PublicKey *key,
+ void*buffer,
+ size_t len)
+{
+ const ssize_t length = GNUNET_IDENTITY_public_key_get_length (key);
if (len < length)
return -1;
if (length < 0)
return -2;
+ GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
+ GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
+ - sizeof (key->type));
+ return length;
+}
+
+
+enum GNUNET_GenericReturnValue
+GNUNET_IDENTITY_read_private_key_from_buffer (const void *buffer,
+ size_t len,
+ struct
+ GNUNET_IDENTITY_PrivateKey *key,
+ size_t *kb_read)
+{
+ if (len < sizeof (key->type))
+ return GNUNET_SYSERR;
+ GNUNET_memcpy (&key->type,
+ buffer,
+ sizeof (key->type));
+ ssize_t length = GNUNET_IDENTITY_private_key_get_length (key);
+ if (len < length)
+ return GNUNET_SYSERR;
+ if (length < 0)
+ return GNUNET_SYSERR;
GNUNET_memcpy (&key->ecdsa_key,
buffer + sizeof (key->type),
length - sizeof (key->type));
- return length;
+ *kb_read = length;
+ return GNUNET_OK;
}
ssize_t
-GNUNET_IDENTITY_write_key_to_buffer (const struct
- GNUNET_IDENTITY_PublicKey *key,
- void*buffer,
- size_t len)
+GNUNET_IDENTITY_write_private_key_to_buffer (const struct
+ GNUNET_IDENTITY_PrivateKey *key,
+ void *buffer,
+ size_t len)
{
- const ssize_t length = GNUNET_IDENTITY_key_get_length (key);
+ const ssize_t length = GNUNET_IDENTITY_private_key_get_length (key);
if (len < length)
return -1;
if (length < 0)
@@ -1080,7 +984,6 @@ GNUNET_IDENTITY_signature_get_raw_length_by_type (uint32_t type)
}
-
ssize_t
GNUNET_IDENTITY_read_signature_from_buffer (struct
GNUNET_IDENTITY_Signature *sig,
@@ -1118,6 +1021,7 @@ GNUNET_IDENTITY_write_signature_to_buffer (const struct
return length;
}
+
enum GNUNET_GenericReturnValue
GNUNET_IDENTITY_sign_raw_ (const struct
GNUNET_IDENTITY_PrivateKey *priv,
@@ -1129,11 +1033,13 @@ GNUNET_IDENTITY_sign_raw_ (const struct
{
case GNUNET_IDENTITY_TYPE_ECDSA:
return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
- (struct GNUNET_CRYPTO_EcdsaSignature*)sig);
+ (struct
+ GNUNET_CRYPTO_EcdsaSignature*) sig);
break;
case GNUNET_IDENTITY_TYPE_EDDSA:
return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
- (struct GNUNET_CRYPTO_EddsaSignature*)sig);
+ (struct
+ GNUNET_CRYPTO_EddsaSignature*) sig);
break;
default:
GNUNET_break (0);
@@ -1143,7 +1049,6 @@ GNUNET_IDENTITY_sign_raw_ (const struct
}
-
enum GNUNET_GenericReturnValue
GNUNET_IDENTITY_sign_ (const struct
GNUNET_IDENTITY_PrivateKey *priv,
@@ -1212,12 +1117,14 @@ GNUNET_IDENTITY_signature_verify_raw_ (uint32_t purpose,
{
case GNUNET_IDENTITY_TYPE_ECDSA:
return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
- (struct GNUNET_CRYPTO_EcdsaSignature*)sig,
+ (struct
+ GNUNET_CRYPTO_EcdsaSignature*) sig,
&(pub->ecdsa_key));
break;
case GNUNET_IDENTITY_TYPE_EDDSA:
return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
- (struct GNUNET_CRYPTO_EddsaSignature*)sig,
+ (struct
+ GNUNET_CRYPTO_EddsaSignature*) sig,
&(pub->eddsa_key));
break;
default:
@@ -1228,8 +1135,6 @@ GNUNET_IDENTITY_signature_verify_raw_ (uint32_t purpose,
}
-
-
ssize_t
GNUNET_IDENTITY_encrypt (const void *block,
size_t size,
@@ -1308,7 +1213,7 @@ char *
GNUNET_IDENTITY_public_key_to_string (const struct
GNUNET_IDENTITY_PublicKey *key)
{
- size_t size = GNUNET_IDENTITY_key_get_length (key);
+ size_t size = GNUNET_IDENTITY_public_key_get_length (key);
return GNUNET_STRINGS_data_to_string_alloc (key,
size);
}
@@ -1318,11 +1223,12 @@ char *
GNUNET_IDENTITY_private_key_to_string (const struct
GNUNET_IDENTITY_PrivateKey *key)
{
- size_t size = private_key_get_length (key);
+ size_t size = GNUNET_IDENTITY_private_key_get_length (key);
return GNUNET_STRINGS_data_to_string_alloc (key,
size);
}
+
enum GNUNET_GenericReturnValue
GNUNET_IDENTITY_public_key_from_string (const char *str,
struct GNUNET_IDENTITY_PublicKey *key)
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 51afb2515..4cc0b6334 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -105,7 +105,7 @@ check_identity_update (void *cls, const struct UpdateMessage *um)
uint16_t name_len = ntohs (um->name_len);
const char *str = (const char *) &um[1];
- if ((size != name_len + sizeof(struct UpdateMessage)) ||
+ if ((size < name_len + sizeof(struct UpdateMessage)) ||
((0 != name_len) && ('\0' != str[name_len - 1])))
{
GNUNET_break (0);
@@ -126,14 +126,29 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
{
struct GNUNET_IDENTITY_EgoLookup *el = cls;
uint16_t name_len = ntohs (um->name_len);
- const char *str = (0 == name_len) ? NULL : (const char *) &um[1];
+ const char *str;
+ size_t key_len;
+ size_t kb_read;
struct GNUNET_HashCode id;
struct GNUNET_IDENTITY_Ego ego;
+ struct GNUNET_IDENTITY_PrivateKey private_key;
+ const char *tmp;
+
memset (&ego, 0, sizeof (ego));
GNUNET_break (GNUNET_YES != ntohs (um->end_of_list));
- GNUNET_CRYPTO_hash (&um->private_key, sizeof(um->private_key), &id);
- ego.pk = um->private_key;
+ tmp = (const char*) &um[1];
+ str = (0 == name_len) ? NULL : tmp;
+ memset (&private_key, 0, sizeof (private_key));
+ key_len = ntohs (um->header.size) - sizeof (*um) - name_len;
+ GNUNET_assert (GNUNET_SYSERR !=
+ GNUNET_IDENTITY_read_private_key_from_buffer (tmp + name_len,
+ key_len,
+ &private_key,
+ &kb_read));
+ GNUNET_assert (key_len == kb_read);
+ GNUNET_CRYPTO_hash (&private_key, sizeof (private_key), &id);
+ ego.pk = private_key;
ego.name = (char *) str;
ego.id = id;
el->cb (el->cb_cls, &ego);
diff --git a/src/identity/identity_api_suffix_lookup.c b/src/identity/identity_api_suffix_lookup.c
index 2667ddbc8..4b459345d 100644
--- a/src/identity/identity_api_suffix_lookup.c
+++ b/src/identity/identity_api_suffix_lookup.c
@@ -108,7 +108,7 @@ check_identity_update (void *cls, const struct UpdateMessage *um)
const char *str = (const char *) &um[1];
(void) cls;
- if ((size != name_len + sizeof(struct UpdateMessage)) ||
+ if ((size < name_len + sizeof(struct UpdateMessage)) ||
((0 != name_len) && ('\0' != str[name_len - 1])))
{
GNUNET_break (0);
@@ -129,9 +129,26 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
{
struct GNUNET_IDENTITY_EgoSuffixLookup *el = cls;
uint16_t name_len = ntohs (um->name_len);
- const char *str = (0 == name_len) ? NULL : (const char *) &um[1];
-
- el->cb (el->cb_cls, &um->private_key, str);
+ const char *str;
+ size_t key_len;
+ size_t kb_read;
+ struct GNUNET_IDENTITY_PrivateKey private_key;
+ const char *tmp;
+
+ tmp = (const char*) &um[1];
+ str = (0 == name_len) ? NULL : tmp;
+ memset (&private_key, 0, sizeof (private_key));
+ key_len = ntohs (um->header.size) - name_len - sizeof (*um);
+ if (0 < key_len)
+ {
+ GNUNET_assert (GNUNET_SYSERR !=
+ GNUNET_IDENTITY_read_private_key_from_buffer (tmp + name_len,
+ key_len,
+ &private_key,
+ &kb_read));
+ GNUNET_assert (key_len == kb_read);
+ }
+ el->cb (el->cb_cls, &private_key, str);
GNUNET_IDENTITY_ego_lookup_by_suffix_cancel (el);
}
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index d7cd0e826..17d214c15 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -28,6 +28,8 @@
#include "gnunet_rest_plugin.h"
#include "gnunet_identity_service.h"
#include "gnunet_rest_lib.h"
+#include "identity.h"
+#include "gnunet_crypto_lib.h"
#include "microhttpd.h"
#include <jansson.h>
@@ -47,9 +49,9 @@
#define GNUNET_REST_API_NS_IDENTITY_NAME "/identity/name"
/**
- * Identity Subsystem Namespace
+ * Identity Namespace with sign specifier
*/
-#define GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM "/identity/subsystem"
+#define GNUNET_REST_API_NS_SIGN "/sign"
/**
* Parameter public key
@@ -62,11 +64,6 @@
#define GNUNET_REST_IDENTITY_PARAM_PRIVKEY "privkey"
/**
- * Parameter subsystem
- */
-#define GNUNET_REST_IDENTITY_PARAM_SUBSYSTEM "subsystem"
-
-/**
* Parameter name
*/
#define GNUNET_REST_IDENTITY_PARAM_NAME "name"
@@ -77,16 +74,6 @@
#define GNUNET_REST_IDENTITY_PARAM_NEWNAME "newname"
/**
- * Error message Unknown Error
- */
-#define GNUNET_REST_IDENTITY_ERROR_UNKNOWN "Unknown Error"
-
-/**
- * Error message No identity found
- */
-#define GNUNET_REST_IDENTITY_NOT_FOUND "No identity found"
-
-/**
* Error message Missing identity name
*/
#define GNUNET_REST_IDENTITY_MISSING_NAME "Missing identity name"
@@ -251,14 +238,9 @@ struct RequestHandle
char *url;
/**
- * Error response message
+ * Error code
*/
- char *emsg;
-
- /**
- * Response code
- */
- int response_code;
+ enum GNUNET_ErrorCode ec;
};
/**
@@ -273,7 +255,7 @@ static struct RequestHandle *requests_tail;
/**
* Cleanup lookup handle
- * @param handle Handle to clean up
+ * @param cls Handle to clean up
*/
static void
cleanup_handle (void *cls)
@@ -289,8 +271,6 @@ cleanup_handle (void *cls)
if (NULL != handle->url)
GNUNET_free (handle->url);
- if (NULL != handle->emsg)
- GNUNET_free (handle->emsg);
if (NULL != handle->name)
GNUNET_free (handle->name);
GNUNET_CONTAINER_DLL_remove (requests_head,
@@ -312,20 +292,20 @@ do_error (void *cls)
struct MHD_Response *resp;
json_t *json_error = json_object ();
char *response;
+ int response_code;
- if (NULL == handle->emsg)
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_ERROR_UNKNOWN);
-
- json_object_set_new (json_error, "error", json_string (handle->emsg));
-
- if (0 == handle->response_code)
- handle->response_code = MHD_HTTP_OK;
+ json_object_set_new (json_error, "error",
+ json_string (GNUNET_ErrorCode_get_hint (handle->ec)));
+ json_object_set_new (json_error, "error_code", json_integer (handle->ec));
+ response_code = GNUNET_ErrorCode_get_http_status (handle->ec);
+ if (0 == response_code)
+ response_code = MHD_HTTP_OK;
response = json_dumps (json_error, 0);
resp = GNUNET_REST_create_response (response);
GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
"Content-Type",
"application/json"));
- handle->proc (handle->proc_cls, resp, handle->response_code);
+ handle->proc (handle->proc_cls, resp, response_code);
json_decref (json_error);
GNUNET_free (response);
GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
@@ -371,101 +351,6 @@ get_egoentry (struct RequestHandle *handle, char *pubkey, char *name)
/**
- * Callback for GET Request with subsystem
- *
- * @param cls the RequestHandle
- * @param ego the Ego found
- * @param ctx the context
- * @param name the id of the ego
- */
-static void
-ego_get_for_subsystem (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
- struct RequestHandle *handle = cls;
- struct MHD_Response *resp;
- struct GNUNET_IDENTITY_PublicKey public_key;
- json_t *json_root;
- char *result_str;
- char *public_key_string;
-
- if (NULL == ego)
- {
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
-
- GNUNET_IDENTITY_ego_get_public_key (ego, &public_key);
- public_key_string = GNUNET_IDENTITY_public_key_to_string (&public_key);
-
- // create json with subsystem identity
- json_root = json_object ();
- json_object_set_new (json_root,
- GNUNET_REST_IDENTITY_PARAM_PUBKEY,
- json_string (public_key_string));
- json_object_set_new (json_root,
- GNUNET_REST_IDENTITY_PARAM_NAME,
- json_string (name));
-
- result_str = json_dumps (json_root, 0);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
- resp = GNUNET_REST_create_response (result_str);
- GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
- "Content-Type",
- "application/json"));
- json_decref (json_root);
- handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
- GNUNET_free (result_str);
- GNUNET_free (public_key_string);
- GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
-}
-
-
-/**
- * Handle identity GET request for subsystem
- *
- * @param con_handle the connection handle
- * @param url the url
- * @param cls the RequestHandle
- */
-void
-ego_get_subsystem (struct GNUNET_REST_RequestHandle *con_handle,
- const char *url,
- void *cls)
-{
- struct RequestHandle *handle = cls;
- char *subsystem;
-
- if (strlen (GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM) >= strlen (handle->url))
- {
- handle->emsg = GNUNET_strdup ("Missing subsystem name");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
- subsystem = &handle->url[strlen (GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM) + 1];
- // requested default identity of subsystem
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking for %s's ego\n", subsystem);
-
- handle->op = GNUNET_IDENTITY_get (identity_handle,
- subsystem,
- &ego_get_for_subsystem,
- handle);
-
- if (NULL == handle->op)
- {
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
-}
-
-
-/**
* Handle identity GET request - responds with all identities
*
* @param con_handle the connection handle
@@ -596,8 +481,7 @@ ego_get_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_PUBKEY) >= strlen (handle->url))
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_PUBKEY);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -606,8 +490,7 @@ ego_get_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -636,8 +519,7 @@ ego_get_name (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_NAME) >= strlen (handle->url))
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_NAME);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -646,8 +528,7 @@ ego_get_name (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -660,27 +541,28 @@ ego_get_name (struct GNUNET_REST_RequestHandle *con_handle,
* Processing finished
*
* @param cls request handle
- * @param emsg error message
+ * @param ec error code
*/
static void
-do_finished (void *cls, const char *emsg)
+do_finished (void *cls, enum GNUNET_ErrorCode ec)
{
struct RequestHandle *handle = cls;
struct MHD_Response *resp;
+ int response_code;
handle->op = NULL;
- if (NULL != emsg)
+ handle->ec = ec;
+ if (GNUNET_EC_NONE != ec)
{
- handle->emsg = GNUNET_strdup (emsg);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- if (0 == handle->response_code)
- {
- handle->response_code = MHD_HTTP_NO_CONTENT;
- }
+ if (GNUNET_EC_NONE == handle->ec)
+ response_code = MHD_HTTP_NO_CONTENT;
+ else
+ response_code = GNUNET_ErrorCode_get_http_status (ec);
resp = GNUNET_REST_create_response (NULL);
- handle->proc (handle->proc_cls, resp, handle->response_code);
+ handle->proc (handle->proc_cls, resp, response_code);
GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
}
@@ -689,18 +571,18 @@ do_finished (void *cls, const char *emsg)
* Processing finished, when creating an ego.
*
* @param cls request handle
- * @param private key of the ego, or NULL on error
- * @param emsg error message
+ * @param pk private key of the ego, or NULL on error
+ * @param ec error code
*/
static void
do_finished_create (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
struct RequestHandle *handle = cls;
(void) pk;
- do_finished (handle, emsg);
+ do_finished (handle, ec);
}
@@ -713,8 +595,6 @@ do_finished_create (void *cls,
void
ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
{
- struct EgoEntry *ego_entry_tmp;
- struct MHD_Response *resp;
json_t *data_js;
json_error_t err;
char *newname;
@@ -724,7 +604,7 @@ ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
// if no data
if (0 >= handle->data_size)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -735,7 +615,7 @@ ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
if (NULL == data_js)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -750,7 +630,7 @@ ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
// Change name with pubkey or name identifier
if (0 != json_state)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
@@ -758,7 +638,7 @@ ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
if (NULL == newname)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
@@ -766,22 +646,12 @@ ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
if (0 >= strlen (newname))
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
}
- ego_entry_tmp = get_egoentry (handle, NULL, newname);
- if (NULL != ego_entry_tmp)
- {
- // Ego with same name not allowed (even if its the ego we change)
- resp = GNUNET_REST_create_response (NULL);
- handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT);
- GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
- json_decref (data_js);
- return;
- }
handle->op = GNUNET_IDENTITY_rename (identity_handle,
ego_entry->identifier,
newname,
@@ -789,7 +659,7 @@ ego_edit (struct RequestHandle *handle, struct EgoEntry *ego_entry)
handle);
if (NULL == handle->op)
{
- handle->emsg = GNUNET_strdup ("Rename failed");
+ handle->ec = GNUNET_EC_UNKNOWN;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
@@ -819,8 +689,7 @@ ego_edit_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_PUBKEY) >= strlen (handle->url))
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_PUBKEY);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -829,8 +698,7 @@ ego_edit_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -859,8 +727,7 @@ ego_edit_name (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_NAME) >= strlen (handle->url))
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_NAME);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -869,8 +736,7 @@ ego_edit_name (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -880,115 +746,6 @@ ego_edit_name (struct GNUNET_REST_RequestHandle *con_handle,
/**
- * Handle identity subsystem PUT request with name
- *
- * @param con_handle the connection handle
- * @param url the url
- * @param cls the RequestHandle
- */
-void
-ego_edit_subsystem (struct GNUNET_REST_RequestHandle *con_handle,
- const char *url,
- void *cls)
-{
- struct RequestHandle *handle = cls;
- struct EgoEntry *ego_entry;
- json_t *data_js;
- json_error_t err;
- char *newsubsys;
- char *name;
- char term_data[handle->data_size + 1];
- int json_state;
-
- name = NULL;
-
- if (strlen (GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM) >= strlen (handle->url))
- {
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_NAME);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
- name = &handle->url[strlen (GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM) + 1];
- ego_entry = get_egoentry (handle, NULL, name);
-
- if (NULL == ego_entry)
- {
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
-
- // if no data
- if (0 >= handle->data_size)
- {
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
- // if not json
- term_data[handle->data_size] = '\0';
- GNUNET_memcpy (term_data, handle->data, handle->data_size);
- data_js = json_loads (term_data, JSON_DECODE_ANY, &err);
-
- if (NULL == data_js)
- {
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
-
- newsubsys = NULL;
- // SUBSYSTEM
- json_state = 0;
- json_state = json_unpack (data_js,
- "{s:s!}",
- GNUNET_REST_IDENTITY_PARAM_SUBSYSTEM,
- &newsubsys);
- // Change subsystem with pubkey or name identifier
- if (0 != json_state)
- {
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- json_decref (data_js);
- return;
- }
-
- if (NULL == newsubsys)
- {
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- json_decref (data_js);
- return;
- }
-
- if (0 >= strlen (newsubsys))
- {
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- json_decref (data_js);
- return;
- }
-
- handle->response_code = MHD_HTTP_NO_CONTENT;
- handle->op = GNUNET_IDENTITY_set (identity_handle,
- newsubsys,
- ego_entry->ego,
- &do_finished,
- handle);
- if (NULL == handle->op)
- {
- handle->emsg = GNUNET_strdup ("Setting subsystem failed");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
- }
- json_decref (data_js);
- return;
-}
-
-
-/**
* Handle identity POST request
*
* @param con_handle the connection handle
@@ -1001,8 +758,6 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
void *cls)
{
struct RequestHandle *handle = cls;
- struct EgoEntry *ego_entry;
- struct MHD_Response *resp;
json_t *data_js;
json_error_t err;
char *egoname;
@@ -1020,7 +775,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
if (0 >= handle->data_size)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -1029,7 +784,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
data_js = json_loads (term_data, JSON_DECODE_ANY, &err);
if (NULL == data_js)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
@@ -1042,7 +797,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
GNUNET_REST_IDENTITY_PARAM_PRIVKEY, &privkey);
if (0 != json_unpack_state)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
@@ -1050,31 +805,19 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == egoname)
{
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
GNUNET_SCHEDULER_add_now (&do_error, handle);
json_decref (data_js);
return;
}
if (0 >= strlen (egoname))
{
+ handle->ec = GNUNET_EC_IDENTITY_INVALID;
json_decref (data_js);
- handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
GNUNET_STRINGS_utf8_tolower (egoname, egoname);
- for (ego_entry = ego_head; NULL != ego_entry;
- ego_entry = ego_entry->next)
- {
- if (0 == strcasecmp (egoname, ego_entry->identifier))
- {
- resp = GNUNET_REST_create_response (NULL);
- handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT);
- GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
- json_decref (data_js);
- return;
- }
- }
handle->name = GNUNET_strdup (egoname);
if (NULL != privkey)
{
@@ -1088,7 +831,6 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
else
pk_ptr = NULL;
json_decref (data_js);
- handle->response_code = MHD_HTTP_CREATED;
handle->op = GNUNET_IDENTITY_create (identity_handle,
handle->name,
pk_ptr,
@@ -1118,8 +860,7 @@ ego_delete_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_PUBKEY) >= strlen (handle->url))
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_PUBKEY);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -1128,13 +869,11 @@ ego_delete_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- handle->response_code = MHD_HTTP_NO_CONTENT;
handle->op = GNUNET_IDENTITY_delete (identity_handle,
ego_entry->identifier,
&do_finished,
@@ -1162,8 +901,7 @@ ego_delete_name (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_NAME) >= strlen (handle->url))
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_MISSING_NAME);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -1172,19 +910,131 @@ ego_delete_name (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- handle->response_code = MHD_HTTP_NOT_FOUND;
- handle->emsg = GNUNET_strdup (GNUNET_REST_IDENTITY_NOT_FOUND);
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- handle->response_code = MHD_HTTP_NO_CONTENT;
handle->op = GNUNET_IDENTITY_delete (identity_handle,
ego_entry->identifier,
&do_finished,
handle);
}
+struct ego_sign_data_cls
+{
+ void *data;
+ struct RequestHandle *handle;
+};
+
+void
+ego_sign_data_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
+{
+ struct RequestHandle *handle = ((struct ego_sign_data_cls *) cls)->handle;
+ unsigned char *data
+ = (unsigned char *) ((struct ego_sign_data_cls *) cls)->data; // data is url decoded
+ struct MHD_Response *resp;
+ struct GNUNET_CRYPTO_EddsaSignature sig;
+ char *sig_str;
+ char *result;
+
+ if (ego == NULL)
+ {
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+
+ if (ntohl (ego->pk.type) != GNUNET_IDENTITY_TYPE_EDDSA)
+ {
+ handle->ec = GNUNET_EC_IDENTITY_NOT_FOUND;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+
+ if ( GNUNET_OK != GNUNET_CRYPTO_eddsa_sign_raw (&(ego->pk.eddsa_key),
+ (void *) data,
+ strlen ( (char*) data),
+ &sig))
+ {
+ handle->ec = GNUNET_EC_UNKNOWN;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+
+ GNUNET_STRINGS_base64url_encode (&sig,
+ sizeof (struct GNUNET_CRYPTO_EddsaSignature),
+ &sig_str);
+
+ GNUNET_asprintf (&result,
+ "{\"signature\": \"%s\"}",
+ sig_str);
+
+ resp = GNUNET_REST_create_response (result);
+ handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
+
+ free (data);
+ free (sig_str);
+ free (result);
+ free (cls);
+ GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
+}
+
+/**
+ *
+ * @param con_handle the connection handle
+ * @param url the url
+ * @param cls the RequestHandle
+ */
+void
+ego_sign_data (struct GNUNET_REST_RequestHandle *con_handle,
+ const char *url,
+ void *cls)
+{
+ // TODO: replace with precompiler #define
+ const char *username_key = "user";
+ const char *data_key = "data";
+
+ struct RequestHandle *handle = cls;
+ struct GNUNET_HashCode cache_key_username;
+ struct GNUNET_HashCode cache_key_data;
+ char *username;
+ char *data;
+
+ struct ego_sign_data_cls *cls2;
+
+ GNUNET_CRYPTO_hash (username_key, strlen (username_key), &cache_key_username);
+ GNUNET_CRYPTO_hash (data_key, strlen (data_key), &cache_key_data);
+
+ if ((GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (
+ handle->rest_handle->url_param_map,
+ &cache_key_username)) ||
+ (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (
+ handle->rest_handle->url_param_map,
+ &cache_key_data)))
+ {
+ handle->ec = GNUNET_EC_UNKNOWN;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+
+ username = (char *) GNUNET_CONTAINER_multihashmap_get (
+ handle->rest_handle->url_param_map,
+ &cache_key_username);
+
+ data = (char *) GNUNET_CONTAINER_multihashmap_get (
+ handle->rest_handle->url_param_map,
+ &cache_key_data);
+
+ cls2 = malloc (sizeof(struct ego_sign_data_cls));
+ cls2->data = (void *) GNUNET_strdup (data);
+ cls2->handle = handle;
+
+ GNUNET_IDENTITY_ego_lookup (cfg,
+ username,
+ ego_sign_data_cb,
+ cls2);
+}
/**
* Respond to OPTIONS request
@@ -1316,17 +1166,11 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
{ { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_PUBKEY,
&ego_get_pubkey },
{ MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_NAME, &ego_get_name },
- { MHD_HTTP_METHOD_GET,
- GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM,
- &ego_get_subsystem },
{ MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY, &ego_get_all },
{ MHD_HTTP_METHOD_PUT,
GNUNET_REST_API_NS_IDENTITY_PUBKEY,
&ego_edit_pubkey },
{ MHD_HTTP_METHOD_PUT, GNUNET_REST_API_NS_IDENTITY_NAME, &ego_edit_name },
- { MHD_HTTP_METHOD_PUT,
- GNUNET_REST_API_NS_IDENTITY_SUBSYSTEM,
- &ego_edit_subsystem },
{ MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY, &ego_create },
{ MHD_HTTP_METHOD_DELETE,
GNUNET_REST_API_NS_IDENTITY_PUBKEY,
@@ -1335,10 +1179,10 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
GNUNET_REST_API_NS_IDENTITY_NAME,
&ego_delete_name },
{ MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_IDENTITY, &options_cont },
+ { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_SIGN, &ego_sign_data},
GNUNET_REST_HANDLER_END };
- handle->response_code = 0;
handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
handle->proc_cls = proc_cls;
handle->proc = proc;
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c
index 4954fe7be..2c44f73ba 100644
--- a/src/identity/test_identity.c
+++ b/src/identity/test_identity.c
@@ -189,13 +189,13 @@ notification_cb (void *cls,
* Continuation called from successful delete operation.
*
* @param cls NULL
- * @param emsg (should also be NULL)
+ * @param ec
*/
static void
-delete_cont (void *cls, const char *emsg)
+delete_cont (void *cls, enum GNUNET_ErrorCode ec)
{
op = NULL;
- CHECK (NULL == emsg);
+ CHECK (GNUNET_EC_NONE == ec);
res = 0;
end ();
}
@@ -217,12 +217,12 @@ finally_delete (void *cls)
* Continuation called from expected-to-fail rename operation.
*
* @param cls NULL
- * @param emsg (should also be NULL)
+ * @param ec
*/
static void
-fail_rename_cont (void *cls, const char *emsg)
+fail_rename_cont (void *cls, enum GNUNET_ErrorCode ec)
{
- CHECK (NULL != emsg);
+ CHECK (GNUNET_EC_NONE != ec);
op = NULL;
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&finally_delete,
@@ -234,12 +234,12 @@ fail_rename_cont (void *cls, const char *emsg)
* Continuation called from successful rename operation.
*
* @param cls NULL
- * @param emsg (should also be NULL)
+ * @param ec
*/
static void
-success_rename_cont (void *cls, const char *emsg)
+success_rename_cont (void *cls, enum GNUNET_ErrorCode ec)
{
- CHECK (NULL == emsg);
+ CHECK (GNUNET_EC_NONE == ec);
op = GNUNET_IDENTITY_rename (h, "test-id", "test", &fail_rename_cont, NULL);
}
@@ -249,15 +249,15 @@ success_rename_cont (void *cls, const char *emsg)
*
* @param cls NULL
* @param pk private key of the ego, or NULL on error
- * @param emsg error message
+ * @param ec
*/
static void
create_cb (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
CHECK (NULL != pk);
- CHECK (NULL == emsg);
+ CHECK (GNUNET_EC_NONE == ec);
op =
GNUNET_IDENTITY_rename (h, "test-id", "test", &success_rename_cont, NULL);
}
@@ -290,7 +290,8 @@ run (void *cls,
int
main (int argc, char *argv[])
{
- GNUNET_DISK_directory_remove ("/tmp/gnunet/test-identity-service");
+ GNUNET_DISK_purge_cfg_dir ("test_identity.conf",
+ "GNUNET_TEST_HOME");
res = 1;
if (0 != GNUNET_TESTING_service_run ("test-identity",
"identity",
@@ -298,7 +299,8 @@ main (int argc, char *argv[])
&run,
NULL))
return 1;
- GNUNET_DISK_directory_remove ("/tmp/gnunet/test-identity-service");
+ GNUNET_DISK_purge_cfg_dir ("test_identity.conf",
+ "GNUNET_TEST_HOME");
return res;
}
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c
deleted file mode 100644
index 2d5244d1b..000000000
--- a/src/identity/test_identity_defaults.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2013 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 identity/test_identity.c
- * @brief testcase for identity service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_identity_service.h"
-#include "gnunet_testing_lib.h"
-
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
-
-
-/**
- * Return value from 'main'.
- */
-static int res;
-
-/**
- * Handle to identity service.
- */
-static struct GNUNET_IDENTITY_Handle *h;
-
-/**
- * Handle to identity operation.
- */
-static struct GNUNET_IDENTITY_Operation *op;
-
-/**
- * Handle for task for timeout termination.
- */
-static struct GNUNET_SCHEDULER_Task *endbadly_task;
-
-#define CHECK(cond) \
- do \
- { \
- if (! (cond)) \
- { \
- GNUNET_break (0); \
- end (); \
- return; \
- } \
- } while (0)
-
-
-/**
- * Clean up all resources used.
- */
-static void
-cleanup (void *cls)
-{
- (void) cls;
- if (NULL != op)
- {
- GNUNET_IDENTITY_cancel (op);
- op = NULL;
- }
- if (NULL != h)
- {
- GNUNET_IDENTITY_disconnect (h);
- h = NULL;
- }
-}
-
-
-/**
- * Termiante the testcase (failure).
- *
- * @param cls NULL
- */
-static void
-endbadly (void *cls)
-{
- GNUNET_SCHEDULER_shutdown ();
- res = 1;
-}
-
-
-/**
- * Termiante the testcase.
- */
-static void
-end ()
-{
- if (NULL != endbadly_task)
- {
- GNUNET_SCHEDULER_cancel (endbadly_task);
- endbadly_task = NULL;
- }
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
-/**
- * Continuation called from successful delete operation.
- *
- * @param cls NULL
- * @param emsg (should also be NULL)
- */
-static void
-delete_cont (void *cls, const char *emsg)
-{
- op = NULL;
- CHECK (NULL == emsg);
- res = 0;
- end ();
-}
-
-
-/**
- * Continuation called from expected-to-fail rename operation.
- *
- * @param cls NULL
- * @param emsg (should also be NULL)
- */
-static void
-get_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *identifier)
-{
- op = NULL;
- CHECK (NULL != ego);
- CHECK (NULL != identifier);
- CHECK (0 == strcmp (identifier, "test-id"));
- op = GNUNET_IDENTITY_delete (h, "test-id", &delete_cont, NULL);
-}
-
-
-/**
- * Called with events about egos.
- *
- * @param cls NULL
- * @param ego ego handle
- * @param ego_ctx context for application to store data for this ego
- * (during the lifetime of this process, initially NULL)
- * @param identifier identifier assigned by the user for this ego,
- * NULL if the user just deleted the ego and it
- * must thus no longer be used
- */
-static void
-dummy_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *identifier)
-{
- (void) cls;
- (void) ego;
- (void) ctx;
- (void) identifier;
-}
-
-
-/**
- * Main function of the test, run from scheduler.
- *
- * @param cls NULL
- * @param cfg configuration we use (also to connect to identity service)
- * @param peer handle to access more of the peer (not used)
- */
-static void
-run_get (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Peer *peer)
-{
- endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL);
- GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
- h = GNUNET_IDENTITY_connect (cfg, &dummy_cb, NULL);
- CHECK (NULL != h);
- op = GNUNET_IDENTITY_get (h, "test-service", &get_cb, NULL);
-}
-
-
-/**
- * Continuation called from successful rename operation.
- *
- * @param cls NULL
- * @param emsg (should also be NULL)
- */
-static void
-success_set_cont (void *cls, const char *emsg)
-{
- op = NULL;
- CHECK (NULL == emsg);
- end ();
-}
-
-
-/**
- * Called with events about egos.
- *
- * @param cls NULL
- * @param ego ego handle
- * @param ego_ctx context for application to store data for this ego
- * (during the lifetime of this process, initially NULL)
- * @param identifier identifier assigned by the user for this ego,
- * NULL if the user just deleted the ego and it
- * must thus no longer be used
- */
-static void
-notification_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *identifier)
-{
- if (NULL == ego)
- return; /* skip first call */
- if (NULL == identifier)
- return; /* deletion / shutdown */
- op = GNUNET_IDENTITY_set (h, "test-service", ego, &success_set_cont, NULL);
-}
-
-
-/**
- * Called with events about created ego.
- *
- * @param cls NULL
- * @param pk private key of the ego, or NULL on error
- * @param emsg error message
- */
-static void
-create_cb (void *cls,
- const struct GNUNET_IDENTITY_PrivateKey *pk,
- const char *emsg)
-{
- CHECK (NULL == emsg);
- CHECK (NULL != pk);
- op = NULL;
-}
-
-
-/**
- * Main function of the test, run from scheduler.
- *
- * @param cls NULL
- * @param cfg configuration we use (also to connect to identity service)
- * @param peer handle to access more of the peer (not used)
- */
-static void
-run_set (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Peer *peer)
-{
- endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL);
- GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
- h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
- CHECK (NULL != h);
- op = GNUNET_IDENTITY_create (h,
- "test-id",
- NULL,
- GNUNET_IDENTITY_TYPE_ECDSA,
- &create_cb, NULL);
-}
-
-
-int
-main (int argc, char *argv[])
-{
- GNUNET_DISK_directory_remove ("/tmp/gnunet/test-identity-service");
- res = 1;
- if (0 != GNUNET_TESTING_service_run ("test-identity-defaults",
- "identity",
- "test_identity.conf",
- &run_set,
- NULL))
- return 1;
- if (0 != GNUNET_TESTING_service_run ("test-identity-defaults",
- "identity",
- "test_identity.conf",
- &run_get,
- NULL))
- return 1;
- GNUNET_DISK_directory_remove ("/tmp/gnunet/test-identity-service");
- return res;
-}
-
-
-/* end of test_identity_defaults.c */
diff --git a/src/identity/test_identity_messages.sh b/src/identity/test_identity_messages.sh
index 250c6a6f1..d29d14acc 100755
--- a/src/identity/test_identity_messages.sh
+++ b/src/identity/test_identity_messages.sh
@@ -20,15 +20,16 @@ which timeout >/dev/null 2>&1 && DO_TIMEOUT="timeout 30"
TEST_MSG="This is a test message. 123"
gnunet-arm -s -c test_identity.conf
gnunet-identity -C recipientego -c test_identity.conf
-RECIPIENT_KEY=$(gnunet-identity -d -e recipientego -q -c test_identity.conf)
-MSG_ENC=$(gnunet-identity -W "$TEST_MSG" -k $RECIPIENT_KEY -c test_identity.conf)
-MSG_DEC=$(gnunet-identity -R "$MSG_ENC" -e recipientego -c test_identity.conf)
-
-if test "$TEST_MSG" != "$MSG_DEC"
+RECIPIENT_KEY=`gnunet-identity -d -e recipientego -q -c test_identity.conf`
+MSG_ENC=`gnunet-identity -W "$TEST_MSG" -k $RECIPIENT_KEY -c test_identity.conf`
+MSG_DEC=`gnunet-identity -R "$MSG_ENC" -e recipientego -c test_identity.conf`
+gnunet-identity -D recipientego -c test_identity.conf
+gnunet-arm -e -c test_identity.conf
+if [ "$TEST_MSG" != "$MSG_DEC" ]
then
- echo "Failed - $TEST_MSG != $MSG_DEC"
+ diff <(echo "$TEST_MSG" ) <(echo "$MSG_DEC")
+ echo "Failed - \"$TEST_MSG\" != \"$MSG_DEC\""
exit 1
fi
-gnunet-identity -D recipientego -c test_identity.conf
-gnunet-arm -e -c test_identity.conf
+
diff --git a/src/identity/test_plugin_rest_identity_signature.sh b/src/identity/test_plugin_rest_identity_signature.sh
new file mode 100755
index 000000000..a4d5fa5d7
--- /dev/null
+++ b/src/identity/test_plugin_rest_identity_signature.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/bash
+
+# https://www.rfc-editor.org/rfc/rfc7515#appendix-A.3
+
+header='{"alg":"EdDSA"}'
+payload='Example of Ed25519 signing'
+key='{ "kty":"OKP",
+ "crv":"Ed25519",
+ "d":"nWGxne_9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A",
+ "x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"
+ }'
+
+header_payload_test="eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc"
+signature_test="hgyY0il_MGCjP0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_MuM0KAg"
+
+base64url_add_padding() {
+ for i in $( seq 1 $(( 4 - ${#1} % 4 )) ); do padding+="="; done
+ echo "$1""$padding"
+}
+
+base64url_encode () {
+ echo -n -e "$1" | base64 -w0 | tr '+/' '-_' | tr -d '='
+}
+
+base64url_decode () {
+ padded_input=$(base64url_add_padding "$1")
+ echo -n "$padded_input" | basenc --base64url -d
+}
+
+base32crockford_encode () {
+ echo -n -e "$1" | basenc --base32hex | tr 'IJKLMNOPQRSTUV' 'JKMNPQRSTVWXYZ'
+}
+
+echo -n "jwk: "
+echo $key | jq
+
+# Create Header
+# 65556 (decimal)
+# = 00000000-00000001-00000000-00010100 (binary little endian)
+# = 00-01-00-14 (hex little endian)
+header_hex=("00" "01" "00" "14")
+
+# Convert secret JWK to HEX array
+key_hex=( $( base64url_decode $( echo -n "$key" | jq -r '.d' ) | xxd -p | tr -d '\n' | fold -w 2 | tr '\n' ' ' ) )
+
+# Concat header and key
+header_key_hex=(${header_hex[@]} ${key_hex[@]})
+
+# Encode with Base32Crogford
+key_gnunet=$(echo -n "${header_key_hex[*]}" | tr -d " " | xxd -p -r | basenc --base32hex | tr 'IJKLMNOPQRSTUV' 'JKMNPQRSTVWXYZ' | tr -d "=")
+echo "gnunet skey: $key_gnunet"
+
+# Create ego
+gnunet-identity -C ego9696595726 -X -P "$key_gnunet"
+
+# Test base64url encoding and header.payload generation
+header_payload_enc="$(base64url_encode "$header").$(base64url_encode "$payload")"
+if [ $header_payload_enc != $header_payload_test ] ;
+then
+ exit 1
+fi
+echo "header.payload: $header_payload_enc"
+
+# Sign JWT
+signature_enc=$(curl -s "localhost:7776/sign?user=ego9696595726&data=$header_payload_enc" | jq -r '.signature')
+jwt="$header_payload_enc.$signature_enc"
+echo "header.payload.signature: $jwt"
+
+gnunet-identity -D ego9696595726
+
+if [ $signature_enc != $signature_test ]
+then
+ echo "Signature does not check out:"
+ echo "$signature_enc"
+ echo "$signature_test"
+ exit 1
+else
+ echo "Signature does check out!"
+ exit 1
+fi
+
diff --git a/src/include/.gitignore b/src/include/.gitignore
index 6c12255e5..9da6d8eea 100644
--- a/src/include/.gitignore
+++ b/src/include/.gitignore
@@ -1,2 +1,4 @@
+gnunet_error_codes.h
+gnu_name_system_record_flags.h
gnu_name_system_record_types.h
gnunet_signatures.h
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 586645567..15f5626ab 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -21,7 +21,7 @@ gnunetinclude_HEADERS = \
gnunet_ats_plugin.h \
gnunet_bandwidth_lib.h \
gnunet_bio_lib.h \
- gnunet_dht_block_types.h \
+ gnunet_dht_block_types.h \
gnunet_block_lib.h \
gnunet_block_group_lib.h \
gnunet_block_plugin.h \
@@ -48,6 +48,7 @@ gnunetinclude_HEADERS = \
gnunet_dnsparser_lib.h \
gnunet_dnsstub_lib.h \
gnunet_dns_service.h \
+ gnunet_error_codes.h \
gnunet_fragmentation_lib.h \
gnunet_friends_lib.h \
gnunet_fs_service.h \
@@ -56,6 +57,7 @@ gnunetinclude_HEADERS = \
gnunet_gnsrecord_lib.h \
gnunet_gnsrecord_json_lib.h \
gnunet_gnsrecord_plugin.h \
+ gnu_name_system_record_flags.h \
gnu_name_system_record_types.h \
gnunet_hello_lib.h \
gnunet_hello_uri_lib.h \
diff --git a/src/include/block_dns.h b/src/include/block_dns.h
index 2186cb1a1..2c573fb20 100644
--- a/src/include/block_dns.h
+++ b/src/include/block_dns.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup vpn_suite
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -65,3 +68,5 @@ GNUNET_NETWORK_STRUCT_END
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition to vpn_suite */
diff --git a/src/include/block_fs.h b/src/include/block_fs.h
index e4caf6e50..f05bb4a29 100644
--- a/src/include/block_fs.h
+++ b/src/include/block_fs.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup fs_l2
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -98,3 +101,5 @@ GNUNET_NETWORK_STRUCT_END
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition to fs_l2 */
diff --git a/src/include/gnunet_abd_service.h b/src/include/gnunet_abd_service.h
index 21f668a8d..a52ed29ff 100644
--- a/src/include/gnunet_abd_service.h
+++ b/src/include/gnunet_abd_service.h
@@ -19,13 +19,16 @@
*/
/**
+ * @addtogroup reclaim_suite
+ * @{
+ *
* @author Martin Schanzenbach
*
* @file
* API to the Credential service
*
* @defgroup abd Credential service
- * Credentials
+ * Credential service for Attribute-Based Decryption
*
* @{
*/
@@ -384,7 +387,7 @@ GNUNET_ABD_remove_delegation (struct GNUNET_ABD_Handle *handle,
*
* @param issuer the ego that should be used to issue the attribute
* @param subject the subject of the attribute
- * @param attribute the name of the attribute
+ * @param iss_attr the name of the attribute
* @param expiration the TTL of the credential
* @return handle to the queued request
*/
@@ -415,3 +418,5 @@ GNUNET_ABD_request_cancel (struct GNUNET_ABD_Request *lr);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition to reclaim_suite */
diff --git a/src/include/gnunet_applications.h b/src/include/gnunet_applications.h
index 1e2ac59f7..489dc7050 100644
--- a/src/include/gnunet_applications.h
+++ b/src/include/gnunet_applications.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -133,4 +136,6 @@ extern "C"
/** @} */ /* end of group */
+/** @} */ /* end of group addition to Backbone */
+
/* end of gnunet_applications.h */
diff --git a/src/include/gnunet_ats_application_service.h b/src/include/gnunet_ats_application_service.h
index a48dba825..4d976572e 100644
--- a/src/include/gnunet_ats_application_service.h
+++ b/src/include/gnunet_ats_application_service.h
@@ -18,6 +18,9 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @file
* Bandwidth allocation API for applications to interact with
*
@@ -99,5 +102,7 @@ GNUNET_ATS_application_suggest_cancel (struct
/** @} */ /* end of group */
+/** @} */ /* end of Backbone addition*/
+
#endif
/* end of file gnunet_ats_application_service.h */
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h
index c0662673c..59d09f690 100644
--- a/src/include/gnunet_ats_plugin.h
+++ b/src/include/gnunet_ats_plugin.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -484,3 +487,5 @@ struct GNUNET_ATS_PluginEnvironment
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index 68ba8e6b2..321e621d2 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -18,6 +18,9 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @file
* Automatic transport selection and outbound bandwidth determination
*
@@ -155,7 +158,7 @@ struct GNUNET_ATS_PropertiesNBO
/**
* Convert ATS properties from host to network byte order.
*
- * @param nbo[OUT] value written
+ * @param nbo[out] value written
* @param hbo value read
*/
void
@@ -166,7 +169,7 @@ GNUNET_ATS_properties_hton (struct GNUNET_ATS_PropertiesNBO *nbo,
/**
* Convert ATS properties from network to host byte order.
*
- * @param hbo[OUT] value written
+ * @param hbo[out] value written
* @param nbo value read
*/
void
@@ -225,7 +228,7 @@ GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
/**
* We no longer care about being connected to a peer.
*
- * @param sh handle
+ * @param sh handle to stop
*/
void
GNUNET_ATS_connectivity_suggest_cancel (struct
@@ -341,7 +344,7 @@ GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
* @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
+ * #GNUNET_NO if the @a ar was kept because we can
* use it still to establish a new session
*/
int
@@ -370,7 +373,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar,
/**
* An address got destroyed, stop using it as a valid address.
*
- * @param ar address record to destroy, it's validation has
+ * @param ar address record to destroy, its validation has
* expired and ATS may no longer use it
*/
void
@@ -521,7 +524,7 @@ 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
+ * @param rc context returned by the original #GNUNET_ATS_reserve_bandwidth() call
*/
void
GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc);
@@ -569,7 +572,7 @@ enum GNUNET_ATS_PreferenceKind
/**
- * Convert a GNUNET_ATS_PreferenceType to a string
+ * Convert an `enum GNUNET_ATS_PreferenceType` to a string
*
* @param type the preference type
* @return a string or NULL if invalid
@@ -579,12 +582,13 @@ GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type);
/**
- * Change preferences for the given peer. Preference changes are forgotten if peers
- * disconnect.
+ * Change preferences for the given peer. Preference changes are
+ * forgotten if peers disconnect.
*
- * @param ph performance handle @param peer identifies the peer
+ * @param ph performance handle
+ * @param peer identifies the peer
* @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the
- * desired changes
+ * desired changes
*/
void
GNUNET_ATS_performance_change_preference (struct
@@ -621,4 +625,6 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
/** @} */ /* end of group */
+/** @} */ /* end of Backbone addition */
+
/* end of file gnunet-service-transport_ats.h */
diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h
index 9130ff57e..9f173a691 100644
--- a/src/include/gnunet_bandwidth_lib.h
+++ b/src/include/gnunet_bandwidth_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -351,4 +355,6 @@ GNUNET_BANDWIDTH_tracker_update_quota (
/** @} */ /* end of group */
+/** @} */ /* end of group addition */
+
/* end of gnunet_bandwidth_lib.h */
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h
index 142f1b088..5eefabff2 100644
--- a/src/include/gnunet_bio_lib.h
+++ b/src/include/gnunet_bio_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -683,4 +687,6 @@ GNUNET_BIO_write_spec_commit (struct GNUNET_BIO_WriteHandle *h,
/** @} */ /* end of group bio */
+/** @} */ /* end of group addition */
+
/* end of gnunet_bio_lib.h */
diff --git a/src/include/gnunet_block_group_lib.h b/src/include/gnunet_block_group_lib.h
index d242ceefb..53827f5f4 100644
--- a/src/include/gnunet_block_group_lib.h
+++ b/src/include/gnunet_block_group_lib.h
@@ -90,7 +90,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/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index af61dcfb0..6a6de712b 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup dht_libs DHT and support libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -128,7 +131,6 @@ struct GNUNET_BLOCK_Group;
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param ... type-specific additional data, can be empty
@@ -269,7 +271,7 @@ GNUNET_BLOCK_group_set_seen (struct GNUNET_BLOCK_Group *bg,
/**
* Try merging two block groups. Afterwards, @a bg1 should remain
- * valid and contain the rules from both @a bg1 and @bg2, and
+ * valid and contain the rules from both @a bg1 and @a bg2, and
* @a bg2 should be destroyed (as part of this call). The latter
* should happen even if merging is not supported.
*
@@ -296,4 +298,6 @@ GNUNET_BLOCK_group_merge (struct GNUNET_BLOCK_Group *bg1,
/** @} */ /* end of group */
+/** @} */ /* end of group addition */
+
/* end of gnunet_block_lib.h */
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h
index 6f9e8e9dc..7cd744ac4 100644
--- a/src/include/gnunet_block_plugin.h
+++ b/src/include/gnunet_block_plugin.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup dht_libs DHT and support libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -289,3 +292,5 @@ struct GNUNET_BLOCK_PluginFunctions
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_buffer_lib.h b/src/include/gnunet_buffer_lib.h
index 7239eccfb..174d2d010 100644
--- a/src/include/gnunet_buffer_lib.h
+++ b/src/include/gnunet_buffer_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* Common buffer management functions.
*
* @author Florian Dold
@@ -203,3 +207,5 @@ GNUNET_buffer_clear (struct GNUNET_Buffer *buf);
#endif
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index f08c1572a..45c70df3e 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -18,6 +18,9 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @author Christian Grothoff
* @author Bart Polot
*
@@ -309,7 +312,9 @@ union GNUNET_CADET_ChannelInfo
* 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 *
@@ -627,4 +632,7 @@ GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt);
/** @} */ /* end of group */
+/** @} */ /* end of group addition */
+
/* end of gnunet_cadet_service.h */
+
diff --git a/src/include/gnunet_child_management_lib.h b/src/include/gnunet_child_management_lib.h
index a35b37865..e7f1271ee 100644
--- a/src/include/gnunet_child_management_lib.h
+++ b/src/include/gnunet_child_management_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @file include/gnunet_child_management_lib.h
* @brief GNUnet child management api
* @author Christian Grothoff
@@ -70,3 +74,5 @@ void
GNUNET_wait_child_cancel (struct GNUNET_ChildWaitHandle *cwh);
#endif
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h
index 2ecd38b04..321810eb4 100644
--- a/src/include/gnunet_client_lib.h
+++ b/src/include/gnunet_client_lib.h
@@ -19,6 +19,13 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
+ * @addtogroup networking
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -67,7 +74,8 @@ GNUNET_CLIENT_test (const struct GNUNET_CONFIGURATION_Handle *cfg,
* Create a message queue to connect to a GNUnet service.
* If handlers are specified, receive messages from the connection.
*
- * @param connection the client connection
+ * @param cfg our configuration
+ * @param service_name name of the service to connect to
* @param handlers handlers for receiving messages, can be NULL
* @param error_handler error handler
* @param error_handler_cls closure for the @a error_handler
@@ -93,4 +101,8 @@ GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
/** @} */ /* end of group client */
+/** @} */ /* end of group addition */
+
+/** @} */ /* end of group addition */
+
/* end of gnunet_client_lib.h */
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 9bcd99c7b..8c58fd6e3 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @file include/gnunet_common.h
* @brief commonly used definitions; globals in this file
* are exempt from the rule that the module name ("common")
@@ -1506,7 +1510,7 @@ GNUNET_is_zero_ (const void *a,
* will be updated to reflect the new address. The TYPE of
* arr is important since size is the number of elements and
* not the size in bytes
- * @param len the number of elements in the existing vector (number
+ * @param len2 the number of elements in the existing vector (number
* of elements to copy over), will be updated with the new
* array size
@@ -1739,7 +1743,7 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg);
* Set the async scope for the current thread.
*
* @param aid the async scope identifier
- * @param old_scope[out] location to save the old scope
+ * @param[out] old_scope location to save the old scope
*/
void
GNUNET_async_scope_enter (const struct GNUNET_AsyncScopeId *aid,
@@ -1861,3 +1865,5 @@ enum GNUNET_SCHEDULER_Priority
#endif
#endif /* GNUNET_COMMON_H */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 3384c6d45..2d26f3c05 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -160,8 +164,8 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
* present. This memory should be freed by the caller
*/
char *
-GNUNET_CONFIGURATION_serialize_diagnostics (const struct
- GNUNET_CONFIGURATION_Handle *cfg);
+GNUNET_CONFIGURATION_serialize_diagnostics (
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
* De-serializes configuration
@@ -170,7 +174,7 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct
* @param mem the memory block of serialized configuration
* @param size the size of the memory block
* @param source_filename source filename, will be used
- * to resolve relative @INLINE@ statements
+ * to resolve relative \@INLINE\@ statements
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
@@ -266,8 +270,8 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename,
* @param cfg configuration handle
*/
void
-GNUNET_CONFIGURATION_enable_diagnostics (struct
- GNUNET_CONFIGURATION_Handle *cfg);
+GNUNET_CONFIGURATION_enable_diagnostics (
+ struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -292,8 +296,8 @@ typedef void
* @param section name of the section
*/
typedef void
-(*GNUNET_CONFIGURATION_Section_Iterator) (void *cls,
- const char *section);
+(*GNUNET_CONFIGURATION_SectionIterator) (void *cls,
+ const char *section);
/**
@@ -319,7 +323,7 @@ GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
void
GNUNET_CONFIGURATION_iterate_sections (
const struct GNUNET_CONFIGURATION_Handle *cfg,
- GNUNET_CONFIGURATION_Section_Iterator iter,
+ GNUNET_CONFIGURATION_SectionIterator iter,
void *iter_cls);
@@ -344,11 +348,11 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg,
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_number (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- unsigned long long *number);
+GNUNET_CONFIGURATION_get_value_number (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ unsigned long long *number);
/**
@@ -361,11 +365,11 @@ GNUNET_CONFIGURATION_get_value_number (const struct
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_float (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- float *number);
+GNUNET_CONFIGURATION_get_value_float (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ float *number);
/**
@@ -378,11 +382,11 @@ GNUNET_CONFIGURATION_get_value_float (const struct
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_time (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- struct GNUNET_TIME_Relative *time);
+GNUNET_CONFIGURATION_get_value_time (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ struct GNUNET_TIME_Relative *time);
/**
@@ -395,11 +399,11 @@ GNUNET_CONFIGURATION_get_value_time (const struct
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_size (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- unsigned long long *size);
+GNUNET_CONFIGURATION_get_value_size (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ unsigned long long *size);
/**
@@ -446,11 +450,11 @@ GNUNET_CONFIGURATION_get_value_string (
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_filename (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- char **value);
+GNUNET_CONFIGURATION_get_value_filename (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ char **value);
/**
@@ -464,12 +468,13 @@ GNUNET_CONFIGURATION_get_value_filename (const struct
* @return number of filenames iterated over, -1 on error
*/
int
-GNUNET_CONFIGURATION_iterate_value_filenames (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- GNUNET_FileNameCallback cb,
- void *cb_cls);
+GNUNET_CONFIGURATION_iterate_value_filenames (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ GNUNET_FileNameCallback cb,
+ void *cb_cls);
+
/**
* Iterate over values of a section in the configuration.
@@ -480,11 +485,12 @@ GNUNET_CONFIGURATION_iterate_value_filenames (const struct
* @param iter_cls closure for @a iter
*/
void
-GNUNET_CONFIGURATION_iterate_section_values (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- GNUNET_CONFIGURATION_Iterator iter,
- void *iter_cls);
+GNUNET_CONFIGURATION_iterate_section_values (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ GNUNET_CONFIGURATION_Iterator iter,
+ void *iter_cls);
+
/**
* Get a configuration value that should be in a set of
@@ -499,12 +505,13 @@ GNUNET_CONFIGURATION_iterate_section_values (const struct
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_choice (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- const char *const *choices,
- const char **value);
+GNUNET_CONFIGURATION_get_value_choice (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ const char *const *choices,
+ const char **value);
+
/**
* Get a configuration value that should be in a set of
@@ -516,10 +523,10 @@ GNUNET_CONFIGURATION_get_value_choice (const struct
* @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_get_value_yesno (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option);
+GNUNET_CONFIGURATION_get_value_yesno (
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option);
/**
@@ -606,11 +613,11 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg,
* #GNUNET_SYSERR if the filename is not in the list
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_remove_value_filename (struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- const char *value);
+GNUNET_CONFIGURATION_remove_value_filename (
+ struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ const char *value);
/**
@@ -625,11 +632,11 @@ GNUNET_CONFIGURATION_remove_value_filename (struct
* #GNUNET_SYSERR if the filename already in the list
*/
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_append_value_filename (struct
- GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- const char *value);
+GNUNET_CONFIGURATION_append_value_filename (
+ struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ const char *option,
+ const char *value);
/**
@@ -792,3 +799,5 @@ GNUNET_CONFIGURATION_config_tool_run (
#endif
/** @} */ /* end of group configuration */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h
index 9387aa095..1d2ec63cd 100644
--- a/src/include/gnunet_consensus_service.h
+++ b/src/include/gnunet_consensus_service.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup Sets
+ * @{
+ *
* @author Florian Dold
*
* @file
@@ -78,8 +81,8 @@ struct GNUNET_CONSENSUS_Handle;
* Create a consensus session. The set being reconciled is initially
* empty.
*
- * @param cfg
- * @param num_peers
+ * @param cfg configuration to use for connecting to the consensus service
+ * @param num_peers number of peers in the peers array
* @param peers array of peers participating in this consensus session
* Inclusion of the local peer is optional.
* @param session_id session identifier
@@ -180,3 +183,5 @@ GNUNET_CONSENSUS_destroy (struct GNUNET_CONSENSUS_Handle *consensus);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index ae6c34f2b..b31a95fac 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -19,29 +19,39 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @author Christian Grothoff
* @author Nils Durner
*
* @file
* Container classes for GNUnet
- *
- * @defgroup hashmap Container library: MultiHashMap
+ *
+ * @addtogroup container
+ * Common data structures in GNUnet programs
+ * @{
+ *
+ * @defgroup hashmap MultiHashMap
* Hash map with multiple values per key.
*
* @see [Documentation](https://gnunet.org/util_multihashmap)
*
- * @defgroup heap Container library: Heap
+ * @defgroup heap Heap
* Min- or max-heap with arbitrary element removal
*
- * @defgroup bloomfilter Container library: Bloom filter
+ * @defgroup bloomfilter Bloom filter
* Probabilistic set tests
*
- * @defgroup dll Container library: Doubly-linked list
+ * @defgroup dll Doubly-linked list
*
* @see [Documentation](https://gnunet.org/mdll-api)
*
- * @defgroup metadata Container library: Metadata
+ * @defgroup metadata Metadata
* GNU libextractor key-value pairs
+ *
+ * @}
*/
#ifndef GNUNET_CONTAINER_LIB_H
@@ -766,7 +776,8 @@ enum GNUNET_CONTAINER_MultiHashMapOption
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_MulitHashMapIteratorCallback) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_MulitHashMapIteratorCallback)(
void *cls,
const struct GNUNET_HashCode *key,
void *value);
@@ -834,7 +845,7 @@ GNUNET_CONTAINER_multihashmap_get (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key,
const void *value);
@@ -876,7 +887,7 @@ GNUNET_CONTAINER_multihashmap_clear (struct GNUNET_CONTAINER_MultiHashMap *map);
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_contains (
const struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key);
@@ -893,7 +904,7 @@ GNUNET_CONTAINER_multihashmap_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_contains_value (
const struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key,
@@ -913,7 +924,7 @@ GNUNET_CONTAINER_multihashmap_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_put (
struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key,
@@ -982,7 +993,7 @@ GNUNET_CONTAINER_multihashmap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_iterator_next (
struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
struct GNUNET_HashCode *key,
@@ -1050,7 +1061,8 @@ GNUNET_CONTAINER_multihashmap_get_random (
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_PeerMapIterator) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_PeerMapIterator)(
void *cls,
const struct GNUNET_PeerIdentity *key,
void *value);
@@ -1123,7 +1135,7 @@ GNUNET_CONTAINER_multipeermap_get (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
const struct GNUNET_PeerIdentity *key,
const void *value);
@@ -1153,7 +1165,7 @@ GNUNET_CONTAINER_multipeermap_remove_all (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_contains (
const struct GNUNET_CONTAINER_MultiPeerMap *map,
const struct GNUNET_PeerIdentity *key);
@@ -1170,7 +1182,7 @@ GNUNET_CONTAINER_multipeermap_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_contains_value (
const struct GNUNET_CONTAINER_MultiPeerMap *map,
const struct GNUNET_PeerIdentity *key,
@@ -1250,9 +1262,12 @@ GNUNET_CONTAINER_multipeermap_iterator_create (
* @ingroup hashmap
* Retrieve the next element from the hash map at the iterator's
* position. If there are no elements left, #GNUNET_NO is returned,
- * and @a key and @a value are not modified. This operation is only
- * allowed if no elements have been removed from the multihashmap
- * since the creation of @a iter, and the map has not been destroyed.
+ * and @a key and @a value are not modified.
+ *
+ * This operation is only allowed if no elements have been removed
+ * from the multihashmap since the creation of @a iter, and the map
+ * has not been destroyed.
+ *
* Adding elements may result in repeating or skipping elements.
*
* @param iter the iterator to get the next element from
@@ -1261,7 +1276,7 @@ GNUNET_CONTAINER_multipeermap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_iterator_next (
struct GNUNET_CONTAINER_MultiPeerMapIterator *iter,
struct GNUNET_PeerIdentity *key,
@@ -1329,7 +1344,8 @@ GNUNET_CONTAINER_multipeermap_get_random (
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_ShortmapIterator) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_ShortmapIterator)(
void *cls,
const struct GNUNET_ShortHashCode *key,
void *value);
@@ -1470,7 +1486,7 @@ GNUNET_CONTAINER_multishortmap_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multishortmap_put (
struct GNUNET_CONTAINER_MultiShortmap *map,
const struct GNUNET_ShortHashCode *key,
@@ -1543,7 +1559,7 @@ GNUNET_CONTAINER_multishortmap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multishortmap_iterator_next (
struct GNUNET_CONTAINER_MultiShortmapIterator *iter,
struct GNUNET_ShortHashCode *key,
@@ -1612,7 +1628,8 @@ GNUNET_CONTAINER_multishortmap_get_random (
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_MultiUuidmapIteratorCallback) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_MultiUuidmapIteratorCallback)(
void *cls,
const struct GNUNET_Uuid *key,
void *value);
@@ -1685,7 +1702,7 @@ GNUNET_CONTAINER_multiuuidmap_get (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_remove (struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key,
const void *value);
@@ -1715,7 +1732,7 @@ GNUNET_CONTAINER_multiuuidmap_remove_all (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_contains (
const struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key);
@@ -1732,7 +1749,7 @@ GNUNET_CONTAINER_multiuuidmap_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_contains_value (
const struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key,
@@ -1752,7 +1769,7 @@ GNUNET_CONTAINER_multiuuidmap_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_put (
struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key,
@@ -1825,7 +1842,7 @@ GNUNET_CONTAINER_multiuuidmap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_iterator_next (
struct GNUNET_CONTAINER_MultiUuidmapIterator *iter,
struct GNUNET_Uuid *key,
@@ -1908,9 +1925,11 @@ struct GNUNET_CONTAINER_MultiHashMap32Iterator;
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_MulitHashMapIterator32Callback) (void *cls,
- uint32_t key,
- void *value);
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_MulitHashMapIterator32Callback)(
+ void *cls,
+ uint32_t key,
+ void *value);
/**
@@ -1994,7 +2013,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_remove (
struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key,
@@ -2026,7 +2045,7 @@ GNUNET_CONTAINER_multihashmap32_remove_all (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_contains (
const struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key);
@@ -2043,7 +2062,7 @@ GNUNET_CONTAINER_multihashmap32_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_contains_value (
const struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key,
@@ -2063,7 +2082,7 @@ GNUNET_CONTAINER_multihashmap32_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_put (
struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key,
@@ -2121,7 +2140,7 @@ GNUNET_CONTAINER_multihashmap32_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_iterator_next (
struct GNUNET_CONTAINER_MultiHashMap32Iterator *iter,
uint32_t *key,
@@ -2568,7 +2587,7 @@ GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap);
* @return #GNUNET_YES if an element is returned,
* #GNUNET_NO if the heap is empty.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_heap_peek2 (const struct GNUNET_CONTAINER_Heap *heap,
void **element,
GNUNET_CONTAINER_HeapCostType *cost);
@@ -2608,8 +2627,8 @@ GNUNET_CONTAINER_heap_node_get_cost (
* @return #GNUNET_YES if we should continue to iterate,
* #GNUNET_NO if not.
*/
-typedef int
-(*GNUNET_CONTAINER_HeapIterator) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_HeapIterator)(
void *cls,
struct GNUNET_CONTAINER_HeapNode *node,
void *element,
@@ -2704,4 +2723,7 @@ GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node,
/* ifndef GNUNET_CONTAINER_LIB_H */
#endif
+
+/** @} */ /* end of group addition */
+
/* end of gnunet_container_lib.h */
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index be5a81cfb..e201c2cf3 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup conversation_l2 Conversation service and libraries
+ * @{
+ *
* @author Simon Dieterle
* @author Andreas Fuchs
* @author Christian Grothoff
@@ -438,3 +441,5 @@ GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index 59d9613f8..4b824980b 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -20,6 +20,9 @@
/**
* @author Christian Grothoff
*
+ * @addtogroup Backbone
+ * @{
+ *
* @file include/gnunet_core_service.h
* Core service; the main API for encrypted P2P communications
*
@@ -441,4 +444,6 @@ GNUNET_CORE_mq_create (struct GNUNET_CORE_Handle *h,
/** @} */ /* end of group core */
+/** @} */ /* end of backbone addition */
+
/* end of gnunet_core_service.h */
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 2737ee0e9..36e6743b3 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @file include/gnunet_crypto_lib.h
* @brief cryptographic primitives for GNUnet
*
@@ -693,7 +697,7 @@ GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i);
/**
* @ingroup crypto
- * Random on unsigned 64-bit values.
+ * Generate a random unsigned 64-bit value.
*
* @param mode desired quality of the random number
* @param max value returned will be in range [0,@a max) (exclusive)
@@ -1427,7 +1431,7 @@ enum GNUNET_GenericReturnValue
GNUNET_CRYPTO_eddsa_private_key_from_string (
const char *enc,
size_t enclen,
- struct GNUNET_CRYPTO_EddsaPrivateKey *pub);
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
/**
@@ -1631,7 +1635,7 @@ GNUNET_CRYPTO_eddsa_setup_hostkey (const char *cfg_name);
* @return #GNUNET_OK on success, #GNUNET_SYSERR if the identity
* could not be retrieved
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_PeerIdentity *dst);
@@ -1679,7 +1683,7 @@ GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
* Calculate ECC discrete logarithm for small factors.
* Opposite of #GNUNET_CRYPTO_ecc_dexp().
*
- * @param dlc precalculated values, determine range of factors
+ * @param edc precalculated values, determine range of factors
* @param input point on the curve to factor
* @return INT_MAX if dlog failed, otherwise the factor
*/
@@ -1945,6 +1949,21 @@ GNUNET_CRYPTO_ecdsa_sign_ (
const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EcdsaSignature *sig);
+/**
+ * @brief
+ *
+ * @param priv
+ * @param data
+ * @param size
+ * @param sig
+ * @return enum GNUNET_GenericReturnValue
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CRYPTO_eddsa_sign_raw (
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+ void *data,
+ size_t size,
+ struct GNUNET_CRYPTO_EddsaSignature *sig);
/**
* @ingroup crypto
@@ -2220,7 +2239,7 @@ GNUNET_CRYPTO_ecdsa_public_key_derive (
* @param label label to use for key deriviation
* @param context additional context to use for HKDF of 'h';
* typically the name of the subsystem/application
- * @param purp the signature purpose
+ * @param purpose the signature purpose
* @param sig the resulting signature
* @return GNUNET_OK on success
*/
@@ -2285,7 +2304,7 @@ GNUNET_CRYPTO_eddsa_public_key_derive (
* @param label label to use for key deriviation
* @param context additional context to use for HKDF of 'h';
* typically the name of the subsystem/application
- * @param purp the signature purpose
+ * @param purpose the signature purpose
* @param sig the resulting signature
* @return GNUNET_OK on success
*/
@@ -2413,7 +2432,7 @@ GNUNET_CRYPTO_paillier_encrypt (
* @param private_key Private key to use for decryption.
* @param public_key Public key to use for decryption.
* @param ciphertext Ciphertext to decrypt.
- * @param[out] m Decryption of @a ciphertext with @private_key.
+ * @param[out] m Decryption of @a ciphertext with @a private_key.
*/
void
GNUNET_CRYPTO_paillier_decrypt (
@@ -2424,7 +2443,8 @@ GNUNET_CRYPTO_paillier_decrypt (
/**
- * Compute a ciphertext that represents the sum of the plaintext in @a x1 and @a x2
+ * Compute a ciphertext that represents the sum of the plaintext in @a c1
+ * and @a c2
*
* Note that this operation can only be done a finite number of times
* before an overflow occurs.
@@ -2670,7 +2690,7 @@ GNUNET_CRYPTO_rsa_public_key_cmp (const struct GNUNET_CRYPTO_RsaPublicKey *p1,
* Blinds the given message with the given blinding key
*
* @param hash hash of the message to sign
- * @param bkey the blinding key
+ * @param bks the blinding key
* @param pkey the public key of the signer
* @param[out] buf set to a buffer with the blinded message to be signed
* @param[out] buf_size number of bytes stored in @a buf
@@ -2942,4 +2962,7 @@ GNUNET_CRYPTO_cs_verify (const struct GNUNET_CRYPTO_CsSignature *sig,
/* ifndef GNUNET_CRYPTO_LIB_H */
#endif
+
+/** @} */ /* end of group addition */
+
/* end of gnunet_crypto_lib.h */
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 38acecc48..92334887d 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -18,6 +18,9 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup lib_extra Additional libraries
+ * @{
+ *
* @file src/include/gnunet_curl_lib.h
* @brief library to make it easy to download JSON replies over HTTP
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
@@ -29,13 +32,7 @@
*/
#ifndef GNUNET_CURL_LIB_H
#define GNUNET_CURL_LIB_H
-#if HAVE_LIBCURL
#include <curl/curl.h>
-#elif HAVE_LIBGNURL
-#include <gnurl/curl.h>
-#else
-#error "needs curl or gnurl"
-#endif
#include "gnunet_util_lib.h"
@@ -230,7 +227,7 @@ typedef void
* be executed AND cleaned up
* @param jcc callback to invoke upon completion
* @param jcc_cls closure for @a jcc
- * @return NULL on error (in this case, @eh is still released!)
+ * @return NULL on error (in this case, @a eh is still released!)
*/
struct GNUNET_CURL_Job *
GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
@@ -252,7 +249,7 @@ GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
* be executed AND cleaned up
* @param jcc callback to invoke upon completion
* @param jcc_cls closure for @a jcc
- * @return NULL on error (in this case, @eh is still released!)
+ * @return NULL on error (in this case, @a eh is still released!)
*/
struct GNUNET_CURL_Job *
GNUNET_CURL_job_add_with_ct_json (struct GNUNET_CURL_Context *ctx,
@@ -310,7 +307,7 @@ GNUNET_CURL_set_tlscert (struct GNUNET_CURL_Context *ctx,
* @param job_headers extra headers to add for this request
* @param jcc callback to invoke upon completion
* @param jcc_cls closure for @a jcc
- * @return NULL on error (in this case, @eh is still released!)
+ * @return NULL on error (in this case, @a eh is still released!)
*/
struct GNUNET_CURL_Job *
GNUNET_CURL_job_add2 (struct GNUNET_CURL_Context *ctx,
@@ -330,10 +327,9 @@ GNUNET_CURL_job_add2 (struct GNUNET_CURL_Context *ctx,
* @param eh curl easy handle for the request, will
* be executed AND cleaned up
* @param job_headers extra headers to add for this request
- * @param max_reply_size largest acceptable response body
* @param jcc callback to invoke upon completion
* @param jcc_cls closure for @a jcc
- * @return NULL on error (in this case, @eh is still released!)
+ * @return NULL on error (in this case, @a eh is still released!)
*/
struct GNUNET_CURL_Job *
GNUNET_CURL_job_add_raw (struct GNUNET_CURL_Context *ctx,
@@ -443,4 +439,6 @@ GNUNET_CURL_is_valid_scope_id (const char *scope_id);
#endif
/** @} */ /* end of group */
+/** @} */ /* end of group addition to lib_extra */
+
/* end of gnunet_curl_lib.h */
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h
index b4ef346e2..5a876af8c 100644
--- a/src/include/gnunet_datacache_lib.h
+++ b/src/include/gnunet_datacache_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup dht_libs DHT and support libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -208,3 +211,5 @@ GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h,
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h
index 7e63d87d9..298623cb1 100644
--- a/src/include/gnunet_datacache_plugin.h
+++ b/src/include/gnunet_datacache_plugin.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup dht_libs DHT and support libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -180,3 +183,5 @@ struct GNUNET_DATACACHE_PluginFunctions
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h
index 113f6b2f2..4d1a7ff67 100644
--- a/src/include/gnunet_datastore_plugin.h
+++ b/src/include/gnunet_datastore_plugin.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup fs_l2 File sharing and support services/libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -98,17 +101,17 @@ struct GNUNET_DATASTORE_PluginEnvironment
* @return #GNUNET_OK to keep the item
* #GNUNET_NO to delete the item
*/
-typedef int
-(*PluginDatumProcessor) (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
- const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- uint32_t replication,
- struct GNUNET_TIME_Absolute expiration,
- uint64_t uid);
+typedef enum GNUNET_GenericReturnValue
+(*PluginDatumProcessor)(void *cls,
+ const struct GNUNET_HashCode *key,
+ uint32_t size,
+ const void *data,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
+ uint64_t uid);
/**
@@ -377,3 +380,5 @@ struct GNUNET_DATASTORE_PluginFunctions
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h
index c99db67bc..c2ec9ce1f 100644
--- a/src/include/gnunet_datastore_service.h
+++ b/src/include/gnunet_datastore_service.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup fs_l2 File sharing and support services/libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -361,3 +364,5 @@ GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index ebc6e2767..0d1041a88 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -19,6 +19,11 @@
*/
/**
+ * @addtogroup Backbone
+ * @{
+ * @addtogroup dht_libs DHT and support libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -138,7 +143,7 @@ struct GNUNET_DHT_HopSignature
/**
* Hash over the payload of the block.
*/
- struct GNUNET_HashCode h_data;
+ struct GNUNET_HashCode h_data GNUNET_PACKED;
/**
* Previous hop the message was received from. All zeros
@@ -580,3 +585,7 @@ GNUNET_DHT_hello_offer (struct GNUNET_DHT_Handle *dht_handle,
#endif
/** @} */ /* end of group dht */
+
+/** @} */ /* end of group addition */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h
index fa0b5f667..81b0f1d7b 100644
--- a/src/include/gnunet_dhtu_plugin.h
+++ b/src/include/gnunet_dhtu_plugin.h
@@ -119,7 +119,7 @@ struct GNUNET_DHTU_PluginEnvironment
* @param cls the closure
* @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
*/
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 7dfd9ccf1..c76cdc231 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -18,6 +18,10 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -670,7 +674,7 @@ GNUNET_DISK_directory_scan (const char *dir_name,
* Currently, the glob_pattern only supports asterisks in the last
* path component.
*
- * @param glob_patterb the glob pattern to search for
+ * @param glob_pattern the glob pattern to search for
* @param callback the method to call for each file
* @param callback_cls closure for @a callback
* @return the number of files found, -1 on error
@@ -815,4 +819,6 @@ GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h);
/** @} */ /* end of group */
+/** @} */ /* end of group addition */
+
/* end of gnunet_disk_lib.h */
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h
index 20f0f13ee..fd1319dd9 100644
--- a/src/include/gnunet_dns_service.h
+++ b/src/include/gnunet_dns_service.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup vpn_suite VPN services and libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -191,3 +194,5 @@ GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *dh);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h
index f77073264..b8b908e84 100644
--- a/src/include/gnunet_dnsparser_lib.h
+++ b/src/include/gnunet_dnsparser_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * @{
+ *
* @author Philipp Toelke
* @author Christian Grothoff
*
@@ -978,3 +981,5 @@ GNUNET_DNSPARSER_hex_to_bin (const char *hex,
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_dnsstub_lib.h b/src/include/gnunet_dnsstub_lib.h
index 4e93105bb..4cc5e7fd0 100644
--- a/src/include/gnunet_dnsstub_lib.h
+++ b/src/include/gnunet_dnsstub_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -86,7 +89,7 @@ GNUNET_DNSSTUB_add_dns_sa (struct GNUNET_DNSSTUB_Context *ctx,
* Only effective for requests issued after this call.
*
* @param ctx resolver context to modify
- * @param retry_frequ how long to wait between retries
+ * @param retry_freq how long to wait between retries
*/
void
GNUNET_DNSSTUB_set_retry (struct GNUNET_DNSSTUB_Context *ctx,
@@ -147,3 +150,5 @@ GNUNET_DNSSTUB_resolve_cancel (struct GNUNET_DNSSTUB_RequestSocket *rs);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_fragmentation_lib.h b/src/include/gnunet_fragmentation_lib.h
index c964b5434..bb4a3ee8c 100644
--- a/src/include/gnunet_fragmentation_lib.h
+++ b/src/include/gnunet_fragmentation_lib.h
@@ -18,6 +18,9 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -228,3 +231,5 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_friends_lib.h b/src/include/gnunet_friends_lib.h
index d591ea082..03fa6c72d 100644
--- a/src/include/gnunet_friends_lib.h
+++ b/src/include/gnunet_friends_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -116,3 +119,5 @@ GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w,
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition to backbone */
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index 96936bad2..d9f2ee563 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -18,6 +18,9 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
+ * @addtogroup fs_l2 File sharing and support services/libraries
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -108,7 +111,7 @@ typedef int
* into HashMaps. The key may change between FS implementations.
*
* @param uri uri to convert to a unique key
- * @param key wherer to store the unique key
+ * @param key where to store the unique key
* @return #GNUNET_OK on success
*/
int
@@ -461,7 +464,7 @@ GNUNET_FS_GETOPT_KEYWORDS (char shortName,
* @param name long name of the option
* @param argumentHelp help text for the option argument
* @param description long help text for the option
- * @param[out] metadata set to the desired value
+ * @param[out] meta metadata set to the desired value
*/
struct GNUNET_GETOPT_CommandLineOption
GNUNET_FS_GETOPT_METADATA (char shortName,
@@ -1729,7 +1732,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);
/**
@@ -2788,3 +2792,5 @@ GNUNET_FS_share_tree_free (struct GNUNET_FS_ShareTreeItem *toplevel);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h
index 259d648dd..87ad591b7 100644
--- a/src/include/gnunet_getopt_lib.h
+++ b/src/include/gnunet_getopt_lib.h
@@ -19,6 +19,10 @@
*/
/**
+ * @addtogroup libgnunetutil
+ * Multi-function utilities library for GNUnet programs
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -400,7 +404,6 @@ GNUNET_GETOPT_option_timestamp (char shortName,
*
* @param shortName short name of the option
* @param name long name of the option
- * @param argumentHelp help text for the option argument
* @param description long help text for the option
* @param[out] val set to 1 if the option is present
*/
@@ -507,4 +510,6 @@ GNUNET_GETOPT_run (const char *binaryOptions,
/** @} */ /* end of group getopt */
+/** @} */ /* end of group addition */
+
/* end of gnunet_getopt_lib.h */
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 5c06f8045..a32bb77ae 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup GNS
+ * @{
+ *
* @author Martin Schanzenbach
*
* @file
@@ -235,3 +238,5 @@ GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_gnsrecord_json_lib.h b/src/include/gnunet_gnsrecord_json_lib.h
index 966461705..833e684f9 100644
--- a/src/include/gnunet_gnsrecord_json_lib.h
+++ b/src/include/gnunet_gnsrecord_json_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup GNS
+ * @{
+ *
* @author Martin Schanzenbach
*
* @file
@@ -71,3 +74,7 @@ GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
#endif
+
+/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 006211aee..0ccf28e7d 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup GNS
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -66,46 +69,9 @@ extern "C" {
#include "gnu_name_system_record_types.h"
/**
- * Flags that can be set for a record.
- * MUST fit into 16 bit.
+ * Include the record flags generated from GANA
*/
-enum GNUNET_GNSRECORD_Flags
-{
- /**
- * No special options.
- */
- GNUNET_GNSRECORD_RF_NONE = 0,
-
- /**
- * This record is critical. If it cannot be processed
- * (for example because the record type is unknown)
- * resolution MUST fail
- */
- GNUNET_GNSRECORD_RF_CRITICAL = 1,
-
- /**
- * This record should not be used unless all (other) records with an absolute
- * expiration time have expired.
- */
- GNUNET_GNSRECORD_RF_SHADOW_RECORD = 2,
-
- /**
- * This is a supplemental record.
- */
- GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 4,
-
- /**
- * This expiration time of the record is a relative
- * time (not an absolute time).
- */
- GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION = 16384, /* 2^14 */
-
- /**
- * This is a private record of this peer and it should
- * thus not be handed out to other peers.
- */
- GNUNET_GNSRECORD_RF_PRIVATE = 32768, /* 2^15 */
-
+#include "gnu_name_system_record_flags.h"
/**
* When comparing flags for record equality for removal,
@@ -119,6 +85,34 @@ enum GNUNET_GNSRECORD_Flags
* #GNUNET_GNSRECORD_records_cmp.
*/
#define GNUNET_GNSRECORD_RF_RCMP_FLAGS (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)
+
+/**
+ * Filter for GNUNET_GNSRECORD_normalize_record_set().
+ */
+enum GNUNET_GNSRECORD_Filter
+{
+ /**
+ * No filter flags set.
+ * Private and public records are returned,
+ * maintenance records (TOMBSTONE etc) are not.
+ */
+ GNUNET_GNSRECORD_FILTER_NONE = 0,
+
+ /**
+ * Include maintenance records (TOMBSTONE etc).
+ */
+ GNUNET_GNSRECORD_FILTER_INCLUDE_MAINTENANCE = 1,
+
+ /**
+ * Filter private records
+ */
+ GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE = 2,
+
+ /**
+ * Filter public records.
+ * FIXME: Not implemented
+ */
+ // GNUNET_NAMESTORE_FILTER_OMIT_PUBLIC = 4,
};
@@ -496,6 +490,7 @@ GNUNET_GNSRECORD_query_from_private_key (
/**
* Calculate the DHT query for a given @a label in a given @a zone.
+ * FIXME: We may want to plugin-ize this at some point.
*
* @param pub public key of the zone
* @param label label of the record
@@ -521,6 +516,19 @@ GNUNET_GNSRECORD_block_calculate_size (const struct
const struct GNUNET_GNSRECORD_Data *rd,
unsigned int rd_count);
+/**
+ * Sign a block create with #GNUNET_GNSRECORD_block_create_unsigned
+ *
+ * @param key the private key
+ * @param label the label of the block
+ * @param block the unsigned block
+ * @return GNUNET_OK on success
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_GNSRECORD_block_sign (const struct
+ GNUNET_IDENTITY_PrivateKey *key,
+ const char *label,
+ struct GNUNET_GNSRECORD_Block *block);
/**
* Sign name and records
@@ -543,6 +551,31 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
/**
+ * Create name and records but do not sign!
+ * Sign later with #GNUNET_GNSRECORD_block_sign().
+ * Cache derived public key (also keeps the
+ * private key in static memory, so do not use this function if
+ * keeping the private key in the process'es RAM is a major issue).
+ *
+ * @param key the private key
+ * @param expire block expiration
+ * @param label the name for the records
+ * @param rd record data
+ * @param rd_count number of records in @a rd
+ * @param result the block buffer. Will be allocated.
+ * @return GNUNET_OK on success.
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_GNSRECORD_block_create_unsigned (const struct
+ GNUNET_IDENTITY_PrivateKey *key,
+ struct GNUNET_TIME_Absolute expire,
+ const char *label,
+ const struct GNUNET_GNSRECORD_Data *rd,
+ unsigned int rd_count,
+ struct GNUNET_GNSRECORD_Block **result);
+
+
+/**
* Sign name and records, cache derived public key (also keeps the
* private key in static memory, so do not use this function if
* keeping the private key in the process'es RAM is a major issue).
@@ -720,9 +753,9 @@ GNUNET_GNSRECORD_is_critical (uint32_t type);
* @param rd input records
* @param rd_count size of the @a rd and @a rd_public arrays
* @param rd_public where to write the converted records
- * @param rd_public_count number of records written to @a rd_public
+ * @param rd_count_public number of records written to @a rd_public
* @param min_expiry the minimum expiration of this set
- * @param include_private GNUNET_YES if private records should be included.
+ * @param filter the record set filter, see GNUNET_GNSRECORD_Filter.
* @param emsg the error message if something went wrong
* @return GNUNET_OK if set could be normalized and is consistent
*/
@@ -733,34 +766,9 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
struct GNUNET_GNSRECORD_Data *rd_public,
unsigned int *rd_count_public,
struct GNUNET_TIME_Absolute *min_expiry,
- int include_private,
+ enum GNUNET_GNSRECORD_Filter filter,
char **emsg);
-
-/**
- * Convert namestore records from the internal format to that
- * suitable for publication (removes private records).
- *
- * @param label the label under which this set is (supposed to be) published.
- * @param rd input records
- * @param rd_count size of the @a rd and @a rd_public arrays
- * @param rd_public where to write the converted records
- * @param rd_public_count number of records written to @a rd_public
- * @param expiry the expiration of the block
- * @param emsg the error message if something went wrong
- * @return GNUNET_OK if set is consistent and can be exported
- */
-enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_convert_records_for_export (const char *label,
- const struct
- GNUNET_GNSRECORD_Data *rd,
- unsigned int rd_count,
- struct GNUNET_GNSRECORD_Data *
- rd_public,
- unsigned int *rd_count_public,
- struct GNUNET_TIME_Absolute *expiry,
- char **emsg);
-
/**
* Check label for invalid characters.
*
@@ -781,3 +789,5 @@ GNUNET_GNSRECORD_label_check (const char*label, char **emsg);
#endif
/** @} */ /* end of group */
+
+/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_gnsrecord_plugin.h b/src/include/gnunet_gnsrecord_plugin.h
index 84b7c3c23..f55934b60 100644
--- a/src/include/gnunet_gnsrecord_plugin.h
+++ b/src/include/gnunet_gnsrecord_plugin.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup GNS
+ * @{
+ *
* @author Christian Grothoff
*
* @file
@@ -157,6 +160,8 @@ struct GNUNET_GNSRECORD_PluginFunctions
/** @} */ /* end of group */
+/** @} */ /* end of group addition */
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 74eca999d..86bf35110 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -19,6 +19,9 @@
*/
/**
+ * @addtogroup Backbone
+ * @{
+ *
* @author Christian Grothoff
* @file
* Helper library for handling HELLOs
@@ -482,8 +485,8 @@ GNUNET_HELLO_parse_uri (const char *uri,
* @param nt network type of @a address
* @param mono_time when was @a address valid
* @param private_key signing key to use
- * @param result[out] where to write address record (allocated)
- * @param result_size[out] set to size of @a result
+ * @param[out] result where to write address record (allocated)
+ * @param[out] result_size set to size of @a result
*/
void
GNUNET_HELLO_sign_address (
@@ -501,8 +504,8 @@ GNUNET_HELLO_sign_address (
* @param raw raw signed address
* @param raw_size size of @a raw
* @param pid public key to use for signature verification
- * @param nt[out] set to network type
- * @param mono_time[out] when was the address generated
+ * @param[out] nt set to network type
+ * @param[out] mono_time when was the address generated
* @return NULL on error, otherwise the address
*/
char *
@@ -536,4 +539,6 @@ GNUNET_HELLO_address_to_prefix (const char *address);